00001 #include "yuvwindow.h"
00002
00003 #include <libintl.h>
00004 #define _(String) gettext(String)
00005 #define gettext_noop(String) String
00006 #define N_(String) gettext_noop (String)
00007
00008
00009 YUVThread::YUVThread(YUVMain *client)
00010 : Thread()
00011 {
00012 this->client = client;
00013 synchronous = 1;
00014 gui_started.lock();
00015 }
00016
00017 YUVThread::~YUVThread()
00018 {
00019 }
00020
00021 void YUVThread::run()
00022 {
00023 window = new YUVWindow(client);
00024 window->create_objects();
00025 gui_started.unlock();
00026 window->run_window();
00027 delete window;
00028 }
00029
00030
00031
00032
00033
00034
00035 YUVWindow::YUVWindow(YUVMain *client)
00036 : BC_Window("", MEGREY, client->gui_string, 210, 170, 200, 170, 0, !client->show_initially)
00037 { this->client = client; }
00038
00039 YUVWindow::~YUVWindow()
00040 {
00041 delete y_slider;
00042 delete u_slider;
00043 delete v_slider;
00044 delete automation[0];
00045 delete automation[1];
00046 delete automation[2];
00047 }
00048
00049 int YUVWindow::create_objects()
00050 {
00051 int x = 10, y = 10;
00052 add_tool(new BC_Title(x, y, _("Y:")));
00053 add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
00054 y += 20;
00055 add_tool(y_slider = new YSlider(client, x, y));
00056 y += 35;
00057 add_tool(new BC_Title(x, y, _("U:")));
00058 add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
00059 y += 20;
00060 add_tool(u_slider = new USlider(client, x, y));
00061 y += 35;
00062 add_tool(new BC_Title(x, y, _("V:")));
00063 add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
00064 y += 20;
00065 add_tool(v_slider = new VSlider(client, x, y));
00066 }
00067
00068 int YUVWindow::close_event()
00069 {
00070 client->save_defaults();
00071 hide_window();
00072 client->send_hide_gui();
00073 }
00074
00075 YSlider::YSlider(YUVMain *client, int x, int y)
00076 : BC_ISlider(x, y, 190, 30, 200, client->y, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
00077 {
00078 this->client = client;
00079 }
00080 YSlider::~YSlider()
00081 {
00082 }
00083 int YSlider::handle_event()
00084 {
00085 client->y = get_value();
00086 client->send_configure_change();
00087 }
00088
00089 USlider::USlider(YUVMain *client, int x, int y)
00090 : BC_ISlider(x, y, 190, 30, 200, client->u, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
00091 {
00092 this->client = client;
00093 }
00094 USlider::~USlider()
00095 {
00096 }
00097 int USlider::handle_event()
00098 {
00099 client->u = get_value();
00100 client->send_configure_change();
00101 }
00102
00103 VSlider::VSlider(YUVMain *client, int x, int y)
00104 : BC_ISlider(x, y, 190, 30, 200, client->v, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
00105 {
00106 this->client = client;
00107 }
00108 VSlider::~VSlider()
00109 {
00110 }
00111 int VSlider::handle_event()
00112 {
00113 client->v = get_value();
00114 client->send_configure_change();
00115 }
00116
00117 AutomatedFn::AutomatedFn(YUVMain *client, YUVWindow *window, int x, int y, int number)
00118 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
00119 {
00120 this->client = client;
00121 this->window = window;
00122 this->number = number;
00123 }
00124
00125 AutomatedFn::~AutomatedFn()
00126 {
00127 }
00128
00129 int AutomatedFn::handle_event()
00130 {
00131 for(int i = 0; i < 3; i++)
00132 {
00133 if(i != number) window->automation[i]->update(0);
00134 }
00135 update(1);
00136 client->automated_function = number;
00137 client->send_configure_change();
00138 }
00139