4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "yuvwindow.h"
25 #define _(String) gettext(String)
26 #define gettext_noop(String) String
27 #define N_(String) gettext_noop (String)
33 YUVWindow::YUVWindow(YUVMain *client)
34 : BC_Window("", MEGREY, client->gui_string, 210, 170, 200, 170, 0, !client->show_initially)
35 { this->client = client; }
37 YUVWindow::~YUVWindow()
47 int YUVWindow::create_objects()
50 add_tool(new BC_Title(x, y, _("Y:")));
51 add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
53 add_tool(y_slider = new YSlider(client, x, y));
55 add_tool(new BC_Title(x, y, _("U:")));
56 add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
58 add_tool(u_slider = new USlider(client, x, y));
60 add_tool(new BC_Title(x, y, _("V:")));
61 add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
63 add_tool(v_slider = new VSlider(client, x, y));
66 int YUVWindow::close_event()
68 client->save_defaults();
70 client->send_hide_gui();
73 YSlider::YSlider(YUVMain *client, int x, int y)
74 : BC_ISlider(x, y, 190, 30, 200, client->y, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
76 this->client = client;
81 int YSlider::handle_event()
83 client->y = get_value();
84 client->send_configure_change();
87 USlider::USlider(YUVMain *client, int x, int y)
88 : BC_ISlider(x, y, 190, 30, 200, client->u, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
90 this->client = client;
95 int USlider::handle_event()
97 client->u = get_value();
98 client->send_configure_change();
101 VSlider::VSlider(YUVMain *client, int x, int y)
102 : BC_ISlider(x, y, 190, 30, 200, client->v, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
104 this->client = client;
109 int VSlider::handle_event()
111 client->v = get_value();
112 client->send_configure_change();
115 AutomatedFn::AutomatedFn(YUVMain *client, YUVWindow *window, int x, int y, int number)
116 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
118 this->client = client;
119 this->window = window;
120 this->number = number;
123 AutomatedFn::~AutomatedFn()
127 int AutomatedFn::handle_event()
129 for(int i = 0; i < 3; i++)
131 if(i != number) window->automation[i]->update(0);
134 client->automated_function = number;
135 client->send_configure_change();