1 #include "bcdisplayinfo.h"
3 #include "mainprogress.h"
9 #define _(String) gettext(String)
10 #define gettext_noop(String) String
11 #define N_(String) gettext_noop (String)
16 REGISTER_PLUGIN(ReFrame)
27 ReFrame::ReFrame(PluginServer *server)
28 : PluginVClient(server)
40 char* ReFrame::plugin_title() { return _("Reframe"); }
42 NEW_PICON_MACRO(ReFrame)
45 int ReFrame::load_defaults()
49 // set the default directory
50 sprintf(directory, "%sreframe.rc", BCASTDIR);
54 defaults = new Defaults(directory);
58 scale = defaults->get("SCALE", (double)1);
62 int ReFrame::save_defaults()
64 defaults->update("SCALE", scale);
69 int ReFrame::get_parameters()
72 ReFrameWindow window(this, info.get_abs_cursor_x(), info.get_abs_cursor_y());
73 window.create_objects();
74 int result = window.run_window();
80 int ReFrame::start_loop()
82 if(PluginClient::interactive)
84 char string[BCTEXTLEN];
85 sprintf(string, "%s...", plugin_title());
86 progress = start_progress(string,
87 (PluginClient::end - PluginClient::start));
94 int ReFrame::stop_loop()
96 if(PluginClient::interactive)
98 progress->stop_progress();
105 int ReFrame::process_loop(VFrame *buffer)
109 int64_t input_offset = Units::to_int64((double)current_position *
111 PluginClient::start);
113 read_frame(buffer, input_offset);
116 input_offset = Units::to_int64((double)current_position *
118 PluginClient::start);
120 if(PluginClient::interactive)
121 result = progress->update(input_offset - PluginClient::start);
123 if(input_offset >= PluginClient::end) result = 1;
139 ReFrameOutput::ReFrameOutput(ReFrame *plugin, int x, int y)
140 : BC_TextBox(x, y, 150, 1, (float)plugin->scale)
142 this->plugin = plugin;
145 int ReFrameOutput::handle_event()
147 plugin->scale = atof(get_text());
153 ReFrameWindow::ReFrameWindow(ReFrame *plugin, int x, int y)
154 : BC_Window(plugin->plugin_title(),
165 this->plugin = plugin;
168 ReFrameWindow::~ReFrameWindow()
173 void ReFrameWindow::create_objects()
176 add_subwindow(new BC_Title(x, y, _("Scale factor:")));
178 add_subwindow(new ReFrameOutput(plugin, x, y));
179 add_subwindow(new BC_OKButton(this));
180 add_subwindow(new BC_CancelButton(this));
186 int ReFrameWindow::close_event()