add BC_SCALE env var for hi def monitors, cleanup theme data
[goodguy/cinelerra.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, xS(235), yS(100), xS(235), yS(100), 0)
38 {
39         this->client = client;
40 }
41
42 RGB601Window::~RGB601Window()
43 {
44 }
45
46 void RGB601Window::create_objects()
47 {
48         int xs10 = xS(10);
49         int ys10 = yS(10), ys30 = yS(30);
50         int x = xs10, y = ys10;
51
52         add_tool(forward = new RGB601Direction(this,
53                 x,
54                 y,
55                 &client->config.direction,
56                 1,
57                 _("RGB -> 601 compression")));
58         y += ys30;
59         add_tool(reverse = new RGB601Direction(this,
60                 x,
61                 y,
62                 &client->config.direction,
63                 2,
64                 _("601 -> RGB expansion")));
65
66         show_window();
67         flush();
68 }
69
70 void RGB601Window::update()
71 {
72         forward->update(client->config.direction == 1);
73         reverse->update(client->config.direction == 2);
74 }
75
76
77
78 RGB601Direction::RGB601Direction(RGB601Window *window, int x, int y, int *output, int true_value, char *text)
79  : BC_CheckBox(x, y, *output == true_value, text)
80 {
81         this->output = output;
82         this->true_value = true_value;
83         this->window = window;
84 }
85 RGB601Direction::~RGB601Direction()
86 {
87 }
88
89 int RGB601Direction::handle_event()
90 {
91         *output = get_value() ? true_value : 0;
92         window->update();
93         window->client->send_configure_change();
94         return 1;
95 }
96