r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / yuv / yuvwindow.C
blobd73a7d1edbc0ea34e16d9530fa32bea345ca3436
1 #include "yuvwindow.h"
3 #include <libintl.h>
4 #define _(String) gettext(String)
5 #define gettext_noop(String) String
6 #define N_(String) gettext_noop (String)
9 YUVThread::YUVThread(YUVMain *client)
10  : Thread()
12         this->client = client;
13         synchronous = 1; // make thread wait for join
14         gui_started.lock();
17 YUVThread::~YUVThread()
20         
21 void YUVThread::run()
23         window = new YUVWindow(client);
24         window->create_objects();
25         gui_started.unlock();
26         window->run_window();
27         delete window;
35 YUVWindow::YUVWindow(YUVMain *client)
36  : BC_Window("", MEGREY, client->gui_string, 210, 170, 200, 170, 0, !client->show_initially)
37 { this->client = client; }
39 YUVWindow::~YUVWindow()
41         delete y_slider;
42         delete u_slider;
43         delete v_slider;
44         delete automation[0];
45         delete automation[1];
46         delete automation[2];
49 int YUVWindow::create_objects()
51         int x = 10, y = 10;
52         add_tool(new BC_Title(x, y, _("Y:")));
53         add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
54         y += 20;
55         add_tool(y_slider = new YSlider(client, x, y));
56         y += 35;
57         add_tool(new BC_Title(x, y, _("U:")));
58         add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
59         y += 20;
60         add_tool(u_slider = new USlider(client, x, y));
61         y += 35;
62         add_tool(new BC_Title(x, y, _("V:")));
63         add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
64         y += 20;
65         add_tool(v_slider = new VSlider(client, x, y));
68 int YUVWindow::close_event()
70         client->save_defaults();
71         hide_window();
72         client->send_hide_gui();
75 YSlider::YSlider(YUVMain *client, int x, int y)
76  : BC_ISlider(x, y, 190, 30, 200, client->y, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
78         this->client = client;
80 YSlider::~YSlider()
83 int YSlider::handle_event()
85         client->y = get_value();
86         client->send_configure_change();
89 USlider::USlider(YUVMain *client, int x, int y)
90  : BC_ISlider(x, y, 190, 30, 200, client->u, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
92         this->client = client;
94 USlider::~USlider()
97 int USlider::handle_event()
99         client->u = get_value();
100         client->send_configure_change();
103 VSlider::VSlider(YUVMain *client, int x, int y)
104  : BC_ISlider(x, y, 190, 30, 200, client->v, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
106         this->client = client;
108 VSlider::~VSlider()
111 int VSlider::handle_event()
113         client->v = get_value();
114         client->send_configure_change();
117 AutomatedFn::AutomatedFn(YUVMain *client, YUVWindow *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();