1 #include "whirlwindow.h"
4 #define _(String) gettext(String)
5 #define gettext_noop(String) String
6 #define N_(String) gettext_noop (String)
9 WhirlThread::WhirlThread(WhirlMain *client)
12 this->client = client;
13 synchronous = 1; // make thread wait for join
17 WhirlThread::~WhirlThread()
21 void WhirlThread::run()
23 window = new WhirlWindow(client);
24 window->create_objects();
35 WhirlWindow::WhirlWindow(WhirlMain *client)
36 : BC_Window("", MEGREY, client->gui_string, 210, 170, 200, 170, 0, !client->show_initially)
37 { this->client = client; }
39 WhirlWindow::~WhirlWindow()
49 int WhirlWindow::create_objects()
52 add_tool(new BC_Title(x, y, _("Angle")));
53 add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
55 add_tool(angle_slider = new AngleSlider(client, x, y));
57 add_tool(new BC_Title(x, y, _("Pinch")));
58 add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
60 add_tool(pinch_slider = new PinchSlider(client, x, y));
62 add_tool(new BC_Title(x, y, _("Radius")));
63 add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
65 add_tool(radius_slider = new RadiusSlider(client, x, y));
68 int WhirlWindow::close_event()
70 client->save_defaults();
72 client->send_hide_gui();
75 AngleSlider::AngleSlider(WhirlMain *client, int x, int y)
76 : BC_ISlider(x, y, 190, 30, 200, client->angle, -MAXANGLE, MAXANGLE, DKGREY, BLACK, 1)
78 this->client = client;
80 AngleSlider::~AngleSlider()
83 int AngleSlider::handle_event()
85 client->angle = get_value();
86 client->send_configure_change();
89 PinchSlider::PinchSlider(WhirlMain *client, int x, int y)
90 : BC_ISlider(x, y, 190, 30, 200, client->pinch, -MAXPINCH, MAXPINCH, DKGREY, BLACK, 1)
92 this->client = client;
94 PinchSlider::~PinchSlider()
97 int PinchSlider::handle_event()
99 client->pinch = get_value();
100 client->send_configure_change();
103 RadiusSlider::RadiusSlider(WhirlMain *client, int x, int y)
104 : BC_ISlider(x, y, 190, 30, 200, client->radius, 0, MAXRADIUS, DKGREY, BLACK, 1)
106 this->client = client;
108 RadiusSlider::~RadiusSlider()
111 int RadiusSlider::handle_event()
113 client->radius = get_value();
114 client->send_configure_change();
117 AutomatedFn::AutomatedFn(WhirlMain *client, WhirlWindow *window, int x, int y, int number)
118 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
120 this->client = client;
121 this->window = window;
122 this->number = number;
125 AutomatedFn::~AutomatedFn()
129 int AutomatedFn::handle_event()
131 for(int i = 0; i < 3; i++)
133 if(i != number) window->automation[i]->update(0);
136 client->automated_function = number;
137 client->send_configure_change();