anonymous contribution for much improved ChromakeyHSV plugin menu with boxes to set...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / swapframes / swapframes.C
index 60a8a98c000314b286e2a972c5dbf6f7b3a58acc..69b395f6c86e17b31ea728ef1baad28edd07ee2e 100644 (file)
@@ -45,6 +45,11 @@ REGISTER_PLUGIN(SwapFrames)
 
 
 SwapFramesConfig::SwapFramesConfig()
+{
+       reset();
+}
+
+void SwapFramesConfig::reset()
 {
        on = 1;
        swap_even = 1;
@@ -155,12 +160,34 @@ int SwapFramesOdd::handle_event()
 
 
 
+
+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;
@@ -168,25 +195,37 @@ SwapFramesWindow::SwapFramesWindow(SwapFrames *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);
+}