b3eb329908999f9712a1ebcaa9da7c68a534360a
[goodguy/history.git] / cinelerra-5.1 / plugins / rgb601 / rgb601window.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 "bcdisplayinfo.h"
23 #include "language.h"
24 #include "rgb601window.h"
25
26
27
28
29
30
31
32
33
34
35
36 RGB601Window::RGB601Window(RGB601Main *client)
37  : PluginClientWindow(client,
38         210, 
39         200, 
40         210, 
41         200, 
42         0)
43
44         this->client = client; 
45 }
46
47 RGB601Window::~RGB601Window()
48 {
49 }
50
51 void RGB601Window::create_objects()
52 {
53         int x = 10, y = 10;
54         
55         add_tool(forward = new RGB601Direction(this, 
56                 x, 
57                 y, 
58                 &client->config.direction, 
59                 1, 
60                 _("RGB -> 601 compression")));
61         y += 30;
62         add_tool(reverse = new RGB601Direction(this, 
63                 x, 
64                 y, 
65                 &client->config.direction, 
66                 2, 
67                 _("601 -> RGB expansion")));
68
69         show_window();
70         flush();
71 }
72
73 void RGB601Window::update()
74 {
75         forward->update(client->config.direction == 1);
76         reverse->update(client->config.direction == 2);
77 }
78
79
80
81 RGB601Direction::RGB601Direction(RGB601Window *window, int x, int y, int *output, int true_value, char *text)
82  : BC_CheckBox(x, y, *output == true_value, text)
83 {
84         this->output = output;
85         this->true_value = true_value;
86         this->window = window;
87 }
88 RGB601Direction::~RGB601Direction()
89 {
90 }
91         
92 int RGB601Direction::handle_event()
93 {
94         *output = get_value() ? true_value : 0;
95         window->update();
96         window->client->send_configure_change();
97         return 1;
98 }
99