1 #include "bcdisplayinfo.h"
3 #include "edlsession.h"
7 yuv411Window::yuv411Window(yuv411Main *client)
8 : PluginClientWindow(client, xS(260), yS(250), xS(260), yS(250), 0)
10 this->client = client;
14 yuv411Window::~yuv411Window()
18 void yuv411Window::create_objects()
20 int xs10 = xS(10), xs90 = xS(90);
21 int ys10 = yS(10), ys30 = yS(30);
22 int x = xs10, y = ys10, x1=xs90;
23 add_tool(avg_vertical = new yuv411Toggle(client,
24 &(client->config.avg_vertical),
25 _("Vertical average"),
29 add_tool(int_horizontal = new yuv411Toggle(client,
30 &(client->config.int_horizontal),
31 _("Horizontal interpolate"),
35 add_tool(inpainting = new yuv411Toggle(client,
36 &(client->config.inpainting),
37 _("Inpainting method"),
41 add_subwindow(new BC_Title(x, y, _("Offset:")));
42 add_subwindow(offset=new yuv411Offset(client,x1,y));
44 add_subwindow(new BC_Title(x, y, _("Threshold:")));
45 add_subwindow(thresh=new yuv411Thresh(client,x1,y));
47 add_subwindow(new BC_Title(x, y, _("Bias:")));
48 add_subwindow(bias=new yuv411Bias(client,x1,y));
50 int y1 = get_h() - yuv411Reset::calculate_h() - yS(20);
51 add_subwindow(reset = new yuv411Reset(client, this, x, y1+ys10));
55 yuv_warning = new BC_Title(x, y, _("Warning: colormodel not YUV"),MEDIUMFONT,RED);
56 add_subwindow(yuv_warning);
57 EDL *edl = client->get_edl();
58 colormodel = edl->session->color_model;
59 switch( colormodel ) {
62 yuv_warning->hide_window();
67 void yuv411Window::update()
69 avg_vertical->update(client->config.avg_vertical);
70 int_horizontal->update(client->config.int_horizontal);
71 inpainting->update(client->config.inpainting);
72 offset->update(client->config.offset);
73 thresh->update(client->config.thresh);
74 bias->update(client->config.bias);
77 int yuv411Window::close_event()
83 yuv411Toggle::yuv411Toggle(yuv411Main *client, int *output, char *string, int x, int y)
84 : BC_CheckBox(x, y, *output, string)
86 this->client = client;
87 this->output = output;
89 yuv411Toggle::~yuv411Toggle()
92 int yuv411Toggle::handle_event()
94 *output = get_value();
95 ((yuv411Window*)client->thread->window)->update_enables();
96 client->send_configure_change();
100 yuv411Offset::yuv411Offset(yuv411Main *client, int x, int y)
101 : BC_FSlider(x+xS(60), y, 0, xS(100), yS(100), (float)0, (float)2,
102 (float)client->config.offset)
104 this->client = client;
107 int yuv411Offset::handle_event()
109 client->config.offset = get_value();
110 client->send_configure_change();
114 yuv411Thresh::yuv411Thresh(yuv411Main *client, int x, int y)
115 : BC_FSlider(x+xS(60), y, 0, xS(100), yS(100), (float)1, (float)100,
116 (float)client->config.thresh)
118 this->client = client;
121 int yuv411Thresh::handle_event()
123 client->config.thresh = get_value();
124 client->send_configure_change();
128 yuv411Bias::yuv411Bias(yuv411Main *client, int x, int y)
129 : BC_FSlider(x+xS(60), y, 0, xS(100), yS(100), (float)0, (float)25,
130 (float)client->config.bias)
132 this->client = client;
136 int yuv411Bias::handle_event()
138 client->config.bias = get_value();
139 client->send_configure_change();
143 yuv411Reset::yuv411Reset(yuv411Main *client, yuv411Window *window, int x, int y)
144 : BC_GenericButton(x, y, _("Reset"))
146 this->client = client;
147 this->window = window;
149 yuv411Reset::~yuv411Reset()
152 int yuv411Reset::handle_event()
154 client->config.reset();
156 window->update_enables();
157 client->send_configure_change();
162 void yuv411Window::update_enables()
164 yuv411Config &config = client->config;
165 if( !config.int_horizontal && config.inpainting ) {
166 config.inpainting = 0;
167 inpainting->set_value(0);
169 if( config.int_horizontal ) {
170 inpainting->enable();
171 offset->show_window();
174 inpainting->disable();
175 offset->hide_window();
177 if( config.int_horizontal && config.inpainting ) {
178 thresh->show_window();
182 thresh->hide_window();
187 void yuv411Window::show_warning(int warn)
190 yuv_warning->show_window();
192 yuv_warning->hide_window();