r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / whirl / whirlwindow.C
blob5b716e1293e5a1afe4d853db5989c18cc1ecadc1
1 #include "whirlwindow.h"
3 #include <libintl.h>
4 #define _(String) gettext(String)
5 #define gettext_noop(String) String
6 #define N_(String) gettext_noop (String)
9 WhirlThread::WhirlThread(WhirlMain *client)
10  : Thread()
12         this->client = client;
13         synchronous = 1; // make thread wait for join
14         gui_started.lock();
17 WhirlThread::~WhirlThread()
20         
21 void WhirlThread::run()
23         window = new WhirlWindow(client);
24         window->create_objects();
25         gui_started.unlock();
26         window->run_window();
27         delete window;
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()
41         delete angle_slider;
42         delete pinch_slider;
43         delete radius_slider;
44         delete automation[0];
45         delete automation[1];
46         delete automation[2];
49 int WhirlWindow::create_objects()
51         int x = 10, y = 10;
52         add_tool(new BC_Title(x, y, _("Angle")));
53         add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
54         y += 20;
55         add_tool(angle_slider = new AngleSlider(client, x, y));
56         y += 35;
57         add_tool(new BC_Title(x, y, _("Pinch")));
58         add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
59         y += 20;
60         add_tool(pinch_slider = new PinchSlider(client, x, y));
61         y += 35;
62         add_tool(new BC_Title(x, y, _("Radius")));
63         add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
64         y += 20;
65         add_tool(radius_slider = new RadiusSlider(client, x, y));
68 int WhirlWindow::close_event()
70         client->save_defaults();
71         hide_window();
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++)
132         {
133                 if(i != number) window->automation[i]->update(0);
134         }
135         update(1);
136         client->automated_function = number;
137         client->send_configure_change();