remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / yuv / yuvwindow.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "language.h"
23 #include "yuvwindow.h"
24
25
26 YUVWindow::YUVWindow(YUVMain *client)
27  : BC_Window("", MEGREY, client->gui_string, 210, 170, 200, 170, 0, !client->show_initially)
28 { this->client = client; }
29
30 YUVWindow::~YUVWindow()
31 {
32         delete y_slider;
33         delete u_slider;
34         delete v_slider;
35         delete automation[0];
36         delete automation[1];
37         delete automation[2];
38 }
39
40 int YUVWindow::create_objects()
41 {
42         int x = 10, y = 10;
43         add_tool(new BC_Title(x, y, _("Y:")));
44         add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
45         y += 20;
46         add_tool(y_slider = new YSlider(client, x, y));
47         y += 35;
48         add_tool(new BC_Title(x, y, _("U:")));
49         add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
50         y += 20;
51         add_tool(u_slider = new USlider(client, x, y));
52         y += 35;
53         add_tool(new BC_Title(x, y, _("V:")));
54         add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
55         y += 20;
56         add_tool(v_slider = new VSlider(client, x, y));
57 }
58
59 int YUVWindow::close_event()
60 {
61         client->save_defaults();
62         hide_window();
63         client->send_hide_gui();
64 }
65
66 YSlider::YSlider(YUVMain *client, int x, int y)
67  : BC_ISlider(x, y, 190, 30, 200, client->y, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
68 {
69         this->client = client;
70 }
71 YSlider::~YSlider()
72 {
73 }
74 int YSlider::handle_event()
75 {
76         client->y = get_value();
77         client->send_configure_change();
78 }
79
80 USlider::USlider(YUVMain *client, int x, int y)
81  : BC_ISlider(x, y, 190, 30, 200, client->u, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
82 {
83         this->client = client;
84 }
85 USlider::~USlider()
86 {
87 }
88 int USlider::handle_event()
89 {
90         client->u = get_value();
91         client->send_configure_change();
92 }
93
94 VSlider::VSlider(YUVMain *client, int x, int y)
95  : BC_ISlider(x, y, 190, 30, 200, client->v, -MAXVALUE, MAXVALUE, DKGREY, BLACK, 1)
96 {
97         this->client = client;
98 }
99 VSlider::~VSlider()
100 {
101 }
102 int VSlider::handle_event()
103 {
104         client->v = get_value();
105         client->send_configure_change();
106 }
107
108 AutomatedFn::AutomatedFn(YUVMain *client, YUVWindow *window, int x, int y, int number)
109  : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
110 {
111         this->client = client;
112         this->window = window;
113         this->number = number;
114 }
115
116 AutomatedFn::~AutomatedFn()
117 {
118 }
119
120 int AutomatedFn::handle_event()
121 {
122         for(int i = 0; i < 3; i++)
123         {
124                 if(i != number) window->automation[i]->update(0);
125         }
126         update(1);
127         client->automated_function = number;
128         client->send_configure_change();
129 }
130