3 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "interpolatevideo.h"
24 #include "interpolatewindow.h"
35 InterpolateVideoWindow::InterpolateVideoWindow(InterpolateVideo *plugin)
36 : PluginClientWindow(plugin,
43 this->plugin = plugin;
46 InterpolateVideoWindow::~InterpolateVideoWindow()
50 void InterpolateVideoWindow::create_objects()
57 add_subwindow(title = new BC_Title(x, y, _("Input frames per second:")));
58 y += title->get_h() + plugin->get_theme()->widget_border;
59 add_subwindow(rate = new InterpolateVideoRate(plugin,
63 add_subwindow(rate_menu = new InterpolateVideoRateMenu(plugin,
65 x + rate->get_w() + 5,
67 y += rate->get_h() + plugin->get_theme()->widget_border;
68 add_subwindow(keyframes = new InterpolateVideoKeyframes(plugin,
72 y += keyframes->get_h() + plugin->get_theme()->widget_border;
73 add_subwindow(flow = new InterpolateVideoFlow(plugin,
78 y += flow->get_h() + plugin->get_theme()->widget_border;
79 add_subwindow(vectors = new InterpolateVideoVectors(plugin,
84 y += vectors->get_h() + plugin->get_theme()->widget_border;
85 add_subwindow(radius_title = new BC_Title(x, y, _("Search radius:")));
86 add_subwindow(radius = new InterpolateVideoRadius(plugin,
88 x + radius_title->get_w() + plugin->get_theme()->widget_border,
91 y += radius->get_h() + plugin->get_theme()->widget_border;
92 add_subwindow(size_title = new BC_Title(x, y, _("Macroblock size:")));
93 add_subwindow(size = new InterpolateVideoSize(plugin,
95 x + size_title->get_w() + plugin->get_theme()->widget_border,
103 void InterpolateVideoWindow::update_enabled()
105 if(plugin->config.use_keyframes)
114 if(plugin->config.optic_flow)
119 radius_title->set_color(get_resources()->default_text_color);
120 size_title->set_color(get_resources()->default_text_color);
127 radius_title->set_color(get_resources()->disabled_text_color);
128 size_title->set_color(get_resources()->disabled_text_color);
144 InterpolateVideoRate::InterpolateVideoRate(InterpolateVideo *plugin,
145 InterpolateVideoWindow *gui,
152 (float)plugin->config.input_rate)
154 this->plugin = plugin;
158 int InterpolateVideoRate::handle_event()
160 plugin->config.input_rate = Units::atoframerate(get_text());
161 plugin->send_configure_change();
168 InterpolateVideoRateMenu::InterpolateVideoRateMenu(InterpolateVideo *plugin,
169 InterpolateVideoWindow *gui,
177 &plugin->get_theme()->frame_rates,
184 this->plugin = plugin;
188 int InterpolateVideoRateMenu::handle_event()
190 char *text = get_selection(0, 0)->get_text();
191 plugin->config.input_rate = atof(text);
192 gui->rate->update(text);
193 plugin->send_configure_change();
200 InterpolateVideoKeyframes::InterpolateVideoKeyframes(InterpolateVideo *plugin,
201 InterpolateVideoWindow *gui,
206 plugin->config.use_keyframes,
207 _("Use keyframes as input"))
209 this->plugin = plugin;
212 int InterpolateVideoKeyframes::handle_event()
214 plugin->config.use_keyframes = get_value();
215 gui->update_enabled();
216 plugin->send_configure_change();
223 InterpolateVideoFlow::InterpolateVideoFlow(InterpolateVideo *plugin,
224 InterpolateVideoWindow *gui,
229 plugin->config.optic_flow,
232 this->plugin = plugin;
235 int InterpolateVideoFlow::handle_event()
237 plugin->config.optic_flow = get_value();
238 gui->update_enabled();
239 plugin->send_configure_change();
245 InterpolateVideoVectors::InterpolateVideoVectors(InterpolateVideo *plugin,
246 InterpolateVideoWindow *gui,
251 plugin->config.draw_vectors,
252 _("Draw motion vectors"))
254 this->plugin = plugin;
257 int InterpolateVideoVectors::handle_event()
259 plugin->config.draw_vectors = get_value();
260 plugin->send_configure_change();
269 InterpolateVideoRadius::InterpolateVideoRadius(InterpolateVideo *plugin,
270 InterpolateVideoWindow *gui,
275 plugin->config.search_radius,
279 this->plugin = plugin;
282 int InterpolateVideoRadius::handle_event()
284 plugin->config.search_radius = get_value();
285 plugin->send_configure_change();
297 InterpolateVideoSize::InterpolateVideoSize(InterpolateVideo *plugin,
298 InterpolateVideoWindow *gui,
303 plugin->config.macroblock_size,
307 this->plugin = plugin;
310 int InterpolateVideoSize::handle_event()
312 plugin->config.macroblock_size = get_value();
313 plugin->send_configure_change();