SwapFramesConfig::SwapFramesConfig()
+{
+ reset();
+}
+
+void SwapFramesConfig::reset()
{
on = 1;
swap_even = 1;
+
+SwapFramesReset::SwapFramesReset(SwapFrames *plugin, SwapFramesWindow *gui, int x, int y)
+ : BC_GenericButton(x, y, _("Reset"))
+{
+ this->plugin = plugin;
+ this->gui = gui;
+}
+SwapFramesReset::~SwapFramesReset()
+{
+}
+int SwapFramesReset::handle_event()
+{
+ plugin->config.reset();
+ gui->update();
+ plugin->send_configure_change();
+ return 1;
+}
+
+
+
+
+
SwapFramesWindow::SwapFramesWindow(SwapFrames *plugin)
: PluginClientWindow(plugin,
- 260,
- 130,
- 260,
- 130,
+ xS(260),
+ yS(135),
+ xS(260),
+ yS(135),
0)
{
this->plugin = plugin;
void SwapFramesWindow::create_objects()
{
- int x = 10, y = 10;
+ int xs10 = xS(10);
+ int ys5 = yS(5), ys10 = yS(10), ys35 = yS(35);
+ int x = xs10, y = ys10;
add_subwindow(on = new SwapFramesOn(plugin, x, y));
- y += on->get_h() + 5;
+ y += on->get_h() + ys5;
BC_Bar *bar;
- add_subwindow(bar = new BC_Bar(x, y, get_w() - x * 2));
- y += bar->get_h() + 5;
+ add_subwindow(bar = new BC_Bar(x, y, get_w() - x * xS(2)));
+ y += bar->get_h() + ys5;
add_subwindow(swap_even = new SwapFramesEven(plugin,
this,
x,
y));
- y += swap_even->get_h() + 5;
+ y += swap_even->get_h() + ys5;
add_subwindow(swap_odd = new SwapFramesOdd(plugin,
this,
x,
y));
+
+ y += ys35;
+ add_subwindow(reset = new SwapFramesReset(plugin, this, x, y));
+
show_window();
}
-
+// for Reset button
+void SwapFramesWindow::update()
+{
+ on->update(plugin->config.swap_even);
+ swap_even->update(plugin->config.swap_even);
+ swap_odd->update(!plugin->config.swap_even);
+}