1 #include "rotatewindow.h"
4 #define _(String) gettext(String)
5 #define gettext_noop(String) String
6 #define N_(String) gettext_noop (String)
9 RotateThread::RotateThread(RotateMain *client)
12 this->client = client;
13 synchronous = 1; // make thread wait for join
17 RotateThread::~RotateThread()
21 void RotateThread::run()
23 window = new RotateWindow(client);
24 window->create_objects();
35 RotateWindow::RotateWindow(RotateMain *client)
36 : BC_Window("", MEGREY, client->gui_string, 250, 120, 250, 120, 0, !client->show_initially)
37 { this->client = client; }
39 RotateWindow::~RotateWindow()
45 int RotateWindow::create_objects()
48 add_tool(new BC_Title(x, y, _("Rotate")));
51 add_tool(toggle0 = new RotateToggle(this, client, client->angle == 0, x, y, 0, _("0")));
54 add_tool(toggle90 = new RotateToggle(this, client, client->angle == 90, x, y, 90, _("90")));
57 add_tool(toggle180 = new RotateToggle(this, client, client->angle == 180, x, y, 180, _("180")));
60 add_tool(toggle270 = new RotateToggle(this, client, client->angle == 270, x, y, 270, _("270")));
63 add_tool(fine = new RotateFine(this, client, x, y));
64 y += fine->get_h() + 10;
65 add_tool(new BC_Title(x, y, _("Angle")));
67 add_tool(new BC_Title(x, y, _("(Automated)")));
70 int RotateWindow::close_event()
72 client->save_defaults();
74 client->send_hide_gui();
77 int RotateWindow::update_parameters()
83 int RotateWindow::update_fine()
85 fine->update(client->angle);
88 int RotateWindow::update_toggles()
90 toggle0->update(client->angle == 0);
91 toggle90->update(client->angle == 90);
92 toggle180->update(client->angle == 180);
93 toggle270->update(client->angle == 270);
96 RotateToggle::RotateToggle(RotateWindow *window, RotateMain *client, int init_value, int x, int y, int value, char *string)
97 : BC_Radial(x, y, 16, 16, init_value, string)
100 this->client = client;
101 this->window = window;
103 RotateToggle::~RotateToggle()
106 int RotateToggle::handle_event()
108 client->angle = (float)RotateToggle::value;
109 window->update_parameters();
110 client->send_configure_change();
113 RotateFine::RotateFine(RotateWindow *window, RotateMain *client, int x, int y)
114 : BC_IPot(x, y, 40, 40, (int)client->angle, 0, 359, DKGREY, BLACK)
116 this->window = window;
117 this->client = client;
120 RotateFine::~RotateFine()
124 int RotateFine::handle_event()
126 client->angle = get_value();
127 window->update_toggles();
128 client->send_configure_change();