remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / yuv411 / yuv411win.C
1 #include "bcdisplayinfo.h"
2 #include "yuv411win.h"
3 #include "language.h"
4
5 yuv411Window::yuv411Window(yuv411Main *client)
6  : PluginClientWindow(client, 250, 220, 250, 220, 0)
7 {
8         this->client = client;
9 }
10
11 yuv411Window::~yuv411Window()
12 {
13 }
14
15 void yuv411Window::create_objects()
16 {
17         int x = 10, y = 10, x1=90;
18         add_tool(avg_vertical = new yuv411Toggle(client,
19                 &(client->config.avg_vertical),
20                 _("Vertical average"),
21                 x,
22                 y));
23         y += 30;
24         add_tool(int_horizontal = new yuv411Toggle(client,
25                 &(client->config.int_horizontal),
26                 _("Horizontal interpolate"),
27                 x,
28                 y));
29         y += 30;
30         add_tool(inpainting = new yuv411Toggle(client,
31                 &(client->config.inpainting),
32                 _("Inpainting method"),
33                 x,
34                 y));
35         y += 30;
36         add_subwindow(new BC_Title(x, y, _("Offset:")));
37         add_subwindow(offset=new yuv411Offset(client,x1,y));
38         y += 30;
39         add_subwindow(new BC_Title(x, y, _("Threshold:")));
40         add_subwindow(thresh=new yuv411Thresh(client,x1,y));
41         y += 30;
42         add_subwindow(new BC_Title(x, y, _("Bias:")));
43         add_subwindow(bias=new yuv411Bias(client,x1,y));
44         y += 30;
45         show_window();
46         flush();
47
48         yuv_warning = new BC_Title(x, y, _("Warning: colormodel not YUV"),MEDIUMFONT,RED);
49         add_subwindow(yuv_warning);
50         yuv_warning->hide_window();
51 }
52
53 int yuv411Window::close_event()
54 {
55         set_done(1);
56         return 1;
57 }
58
59 yuv411Toggle::yuv411Toggle(yuv411Main *client, int *output, char *string, int x, int y)
60  : BC_CheckBox(x, y, *output, string)
61 {
62         this->client = client;
63         this->output = output;
64 }
65 yuv411Toggle::~yuv411Toggle()
66 {
67 }
68 int yuv411Toggle::handle_event()
69 {
70         *output = get_value();
71         ((yuv411Window*)client->thread->window)->update_enables();
72         client->send_configure_change();
73         return 1;
74 }
75
76 yuv411Offset::yuv411Offset(yuv411Main *client, int x, int y)
77  :  BC_FSlider(x, y, 0, 100, 100, (float)0, (float)2,
78             (float)client->config.offset)
79 {
80         this->client = client;
81         set_precision(1.0);
82 }
83 int yuv411Offset::handle_event()
84 {
85         client->config.offset = get_value();
86         client->send_configure_change();
87         return 1;
88 }
89
90 yuv411Thresh::yuv411Thresh(yuv411Main *client, int x, int y)
91  :  BC_FSlider(x, y, 0, 100, 100, (float)1, (float)100,
92             (float)client->config.thresh)
93 {
94         this->client = client;
95         set_precision(1.0);
96 }
97 int yuv411Thresh::handle_event()
98 {
99         client->config.thresh = get_value();
100         client->send_configure_change();
101         return 1;
102 }
103
104 yuv411Bias::yuv411Bias(yuv411Main *client, int x, int y)
105  :  BC_FSlider(x, y, 0, 100, 100, (float)0, (float)25,
106             (float)client->config.bias)
107 {
108         this->client = client;
109         set_precision(1.0);
110 }
111
112 int yuv411Bias::handle_event()
113 {
114         client->config.bias = get_value();
115         client->send_configure_change();
116         return 1;
117 }
118
119 void yuv411Window::update_enables()
120 {
121         yuv411Config &config = client->config;
122         if( !config.int_horizontal && config.inpainting ) {
123                 config.inpainting = 0;
124                 inpainting->set_value(0);
125         }
126         if( config.int_horizontal ) {
127                 inpainting->enable();
128                 offset->show_window();
129         }
130         else {
131                 inpainting->disable();
132                 offset->hide_window();
133         }
134         if( config.int_horizontal && config.inpainting ) {
135                 thresh->show_window();
136                 bias->show_window();
137         }
138         else {
139                 thresh->hide_window();
140                 bias->hide_window();
141         }
142 }
143
144 void yuv411Window::show_warning(int warn)
145 {
146         if( warn )
147                 yuv_warning->show_window();
148         else
149                 yuv_warning->hide_window();
150 }
151
152