1 #include "bcdisplayinfo.h"
5 yuv411Window::yuv411Window(yuv411Main *client)
6 : PluginClientWindow(client, xS(250), yS(255), xS(250), yS(255), 0)
11 yuv411Window::~yuv411Window()
15 void yuv411Window::create_objects()
17 int xs10 = xS(10), xs90 = xS(90);
18 int ys10 = yS(10), ys30 = yS(30), ys35 = yS(35);
19 int x = xs10, y = ys10, x1=xs90;
20 add_tool(avg_vertical = new yuv411Toggle(client,
21 &(client->config.avg_vertical),
22 _("Vertical average"),
26 add_tool(int_horizontal = new yuv411Toggle(client,
27 &(client->config.int_horizontal),
28 _("Horizontal interpolate"),
32 add_tool(inpainting = new yuv411Toggle(client,
33 &(client->config.inpainting),
34 _("Inpainting method"),
38 add_subwindow(new BC_Title(x, y, _("Offset:")));
39 add_subwindow(offset=new yuv411Offset(client,x1,y));
41 add_subwindow(new BC_Title(x, y, _("Threshold:")));
42 add_subwindow(thresh=new yuv411Thresh(client,x1,y));
44 add_subwindow(new BC_Title(x, y, _("Bias:")));
45 add_subwindow(bias=new yuv411Bias(client,x1,y));
47 add_subwindow(reset = new yuv411Reset(client, this, x, y+ys35));
51 yuv_warning = new BC_Title(x, y, _("Warning: colormodel not YUV"),MEDIUMFONT,RED);
52 add_subwindow(yuv_warning);
53 yuv_warning->hide_window();
56 void yuv411Window::update()
58 avg_vertical->update(client->config.avg_vertical);
59 int_horizontal->update(client->config.int_horizontal);
60 inpainting->update(client->config.inpainting);
61 offset->update(client->config.offset);
62 thresh->update(client->config.thresh);
63 bias->update(client->config.bias);
66 int yuv411Window::close_event()
72 yuv411Toggle::yuv411Toggle(yuv411Main *client, int *output, char *string, int x, int y)
73 : BC_CheckBox(x, y, *output, string)
75 this->client = client;
76 this->output = output;
78 yuv411Toggle::~yuv411Toggle()
81 int yuv411Toggle::handle_event()
83 *output = get_value();
84 ((yuv411Window*)client->thread->window)->update_enables();
85 client->send_configure_change();
89 yuv411Offset::yuv411Offset(yuv411Main *client, int x, int y)
90 : BC_FSlider(x, y, 0, xS(100), yS(100), (float)0, (float)2,
91 (float)client->config.offset)
93 this->client = client;
96 int yuv411Offset::handle_event()
98 client->config.offset = get_value();
99 client->send_configure_change();
103 yuv411Thresh::yuv411Thresh(yuv411Main *client, int x, int y)
104 : BC_FSlider(x, y, 0, xS(100), yS(100), (float)1, (float)100,
105 (float)client->config.thresh)
107 this->client = client;
110 int yuv411Thresh::handle_event()
112 client->config.thresh = get_value();
113 client->send_configure_change();
117 yuv411Bias::yuv411Bias(yuv411Main *client, int x, int y)
118 : BC_FSlider(x, y, 0, xS(100), yS(100), (float)0, (float)25,
119 (float)client->config.bias)
121 this->client = client;
125 int yuv411Bias::handle_event()
127 client->config.bias = get_value();
128 client->send_configure_change();
132 yuv411Reset::yuv411Reset(yuv411Main *client, yuv411Window *window, int x, int y)
133 : BC_GenericButton(x, y, _("Reset"))
135 this->client = client;
136 this->window = window;
138 yuv411Reset::~yuv411Reset()
141 int yuv411Reset::handle_event()
143 client->config.reset();
145 window->update_enables();
146 client->send_configure_change();
151 void yuv411Window::update_enables()
153 yuv411Config &config = client->config;
154 if( !config.int_horizontal && config.inpainting ) {
155 config.inpainting = 0;
156 inpainting->set_value(0);
158 if( config.int_horizontal ) {
159 inpainting->enable();
160 offset->show_window();
163 inpainting->disable();
164 offset->hide_window();
166 if( config.int_horizontal && config.inpainting ) {
167 thresh->show_window();
171 thresh->hide_window();
176 void yuv411Window::show_warning(int warn)
179 yuv_warning->show_window();
181 yuv_warning->hide_window();