11 #include "bcdisplayinfo.h"
12 #include "diffkeywindow.h"
17 PLUGIN_THREAD_OBJECT(DiffKeyMain, DiffKeyThread, DiffKeyWindow)
20 extern int grab_key_frame;
21 extern int add_key_frame;
25 DiffKeyWindow::DiffKeyWindow(DiffKeyMain *client, int x, int y)
26 : BC_Window(client->get_gui_string(),
30 310, // height was 360
43 printf("\nConstructing window....");
48 this->client = client;
51 DiffKeyWindow::~DiffKeyWindow()
54 printf("\nDestroying window....");
68 int DiffKeyWindow::create_objects()
72 printf("\nPopulating window....");
78 add_tool(new BC_Title(x, y, _("Hue sensitivity")));
80 add_tool(hue_on = new DiffKeyToggle(client,
81 &(client->config.hue_on),
87 add_tool(hue_imp = new DiffKeySlider(client,
88 &(client->config.hue_imp),
92 add_tool(new BC_Title(x, y, _("Saturation sensitivity")));
94 add_tool(sat_on = new DiffKeyToggle(client,
95 &(client->config.sat_on),
101 add_tool(sat_imp = new DiffKeySlider(client,
102 &(client->config.sat_imp),
106 add_tool(new BC_Title(x, y, _("Value sensitivity")));
108 add_tool(val_on = new DiffKeyToggle(client,
109 &(client->config.val_on),
115 add_tool(val_imp = new DiffKeySlider(client,
116 &(client->config.val_imp),
120 add_tool(new BC_Title(x, y, _("Visibility threshold")));
122 add_tool(vis_on = new DiffKeyToggle(client,
123 &(client->config.vis_on),
129 add_tool(vis_thresh = new DiffKeySlider(client,
130 &(client->config.vis_thresh),
134 add_tool(new BC_Title(x, y, _("Desaturation threshold")));
136 add_tool(desat_on = new DiffKeyToggle(client,
137 &(client->config.desat_on),
143 add_tool(desat_thresh = new DiffKeySlider(client,
144 &(client->config.desat_thresh),
148 /* add_tool(add_key_frame = new DiffKeyAddButton(client,
151 y += 40;*/// This button doesn't do anything yet.
163 add_tool(new BC_Title(x, y, _("Red sensitivity")));
165 add_tool(r_on = new DiffKeyToggle(client,
166 &(client->config.r_on),
172 add_tool(r_imp = new DiffKeySlider(client,
173 &(client->config.r_imp),
177 add_tool(new BC_Title(x, y, _("Green sensitivity")));
179 add_tool(g_on = new DiffKeyToggle(client,
180 &(client->config.g_on),
186 add_tool(g_imp = new DiffKeySlider(client,
187 &(client->config.g_imp),
191 add_tool(new BC_Title(x, y, _("Blue sensitivity")));
193 add_tool(b_on = new DiffKeyToggle(client,
194 &(client->config.b_on),
200 add_tool(b_imp = new DiffKeySlider(client,
201 &(client->config.b_imp),
205 add_tool(new BC_Title(x, y, _("Transparency threshold")));
207 add_tool(trans_on = new DiffKeyToggle(client,
208 &(client->config.trans_on),
214 add_tool(trans_thresh = new DiffKeySlider(client,
215 &(client->config.trans_thresh),
220 add_tool(reset_key_frame = new DiffKeyResetButton(client,
226 add_tool(show_mask = new DiffKeyToggle(client,
227 &(client->config.show_mask),
253 int DiffKeyWindow::close_event()
256 printf("\nClosing window....");
262 DiffKeyToggle::DiffKeyToggle(DiffKeyMain *client, int *output, char *string, int x, int y)
263 : BC_CheckBox(x, y, *output, string)
266 printf("\nDiffKeyToggle::DiffKeyToggle");
268 this->client = client;
269 this->output = output;
271 DiffKeyToggle::~DiffKeyToggle()
274 printf("\nDiffKeyToggle::~DiffKeyToggle");
277 int DiffKeyToggle::handle_event()
280 printf("\nToggle changed from %i", *output);
282 *output = get_value();
283 client->send_configure_change();
285 printf(" to %i", *output);
293 DiffKeyResetButton::DiffKeyResetButton(DiffKeyMain *client, int x, int y) : BC_GenericButton(x, y, "Reset key frame")
296 printf("\nDiffKeyResetButton::DiffKeyResetButton");
298 this->client = client;
301 int DiffKeyResetButton::handle_event()
304 printf("\nReset frame button pressed.");
305 printf("\ngrab_key_frame changed from %i", grab_key_frame);
309 client->send_configure_change();
311 printf(" to %i", grab_key_frame);
319 DiffKeyAddButton::DiffKeyAddButton(DiffKeyMain *client, int x, int y) : BC_GenericButton(x, y, "Add key frame")
322 printf("\nDiffKeyAddButton::DiffKeyAddButton");
324 this->client = client;
327 int DiffKeyAddButton::handle_event()
330 printf("\nAdd frame button pressed.");
331 printf("\nadd_key_frame changed from %i", add_key_frame);
335 client->send_configure_change();
337 printf(" to %i", add_key_frame);
345 DiffKeySlider::DiffKeySlider(DiffKeyMain *client,
359 printf("\nDiffKeySlider::DiffKeySlider");
361 this->client = client;
362 this->output = output;
365 int DiffKeySlider::handle_event()
367 *output = get_value();
368 client->send_configure_change();