raise vwdw stacking tweak, drag handle for transitions, cleanup histogram plugin...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / swapchannels / swapchannels.C
index cf169d26c99049b48f1dce1fa3b3a67fb6a53ae2..3fc831fbe1a739f6007ab380ea961041bd847d50 100644 (file)
@@ -47,11 +47,16 @@ REGISTER_PLUGIN(SwapMain)
 
 
 SwapConfig::SwapConfig()
+{
+       reset_Config();
+}
+
+void SwapConfig::reset_Config()
 {
        red = RED_SRC;
        green = GREEN_SRC;
        blue = BLUE_SRC;
-    alpha = ALPHA_SRC;
+       alpha = ALPHA_SRC;
 }
 
 
@@ -80,10 +85,10 @@ void SwapConfig::copy_from(SwapConfig &that)
 
 SwapWindow::SwapWindow(SwapMain *plugin)
  : PluginClientWindow(plugin,
-       250,
-       170,
-       250,
-       170,
+       xS(250),
+       yS(200),
+       xS(250),
+       yS(200),
        0)
 {
        this->plugin = plugin;
@@ -96,27 +101,32 @@ SwapWindow::~SwapWindow()
 
 void SwapWindow::create_objects()
 {
-       int x = 10, y = 10;
-       int margin = 30;
+       int xs10 = xS(10), xs30 = xS(30), xs160 = xS(160);
+       int ys5 = yS(5), ys10 = yS(10), ys40 = yS(40);
+       int x = xs10, y = ys10;
+       int margin = xs30;
 
        add_subwindow(new BC_Title(x, y, _("Swap channels")));
        y += margin;
-       add_subwindow(new BC_Title(x + 160, y + 5, _("-> Red")));
+       add_subwindow(new BC_Title(x + xs160, y + ys5, _("-> Red")));
        add_subwindow(red = new SwapMenu(plugin, &(plugin->config.red), x, y));
        red->create_objects();
        y += margin;
-       add_subwindow(new BC_Title(x + 160, y + 5, _("-> Green")));
+       add_subwindow(new BC_Title(x + xs160, y + ys5, _("-> Green")));
        add_subwindow(green = new SwapMenu(plugin, &(plugin->config.green), x, y));
        green->create_objects();
        y += margin;
-       add_subwindow(new BC_Title(x + 160, y + 5, _("-> Blue")));
+       add_subwindow(new BC_Title(x + xs160, y + ys5, _("-> Blue")));
        add_subwindow(blue = new SwapMenu(plugin, &(plugin->config.blue), x, y));
        blue->create_objects();
        y += margin;
-       add_subwindow(new BC_Title(x + 160, y + 5, _("-> Alpha")));
+       add_subwindow(new BC_Title(x + xs160, y + ys5, _("-> Alpha")));
        add_subwindow(alpha = new SwapMenu(plugin, &(plugin->config.alpha), x, y));
        alpha->create_objects();
 
+       y += ys40;
+       add_subwindow(reset = new SwapReset(plugin, this, x, y));
+
        show_window();
        flush();
 }
@@ -128,9 +138,8 @@ void SwapWindow::create_objects()
 
 
 
-
 SwapMenu::SwapMenu(SwapMain *client, int *output, int x, int y)
- : BC_PopupMenu(x, y, 150, client->output_to_text(*output))
+ : BC_PopupMenu(x, y, xS(150), client->output_to_text(*output))
 {
        this->client = client;
        this->output = output;
@@ -171,7 +180,22 @@ int SwapItem::handle_event()
 
 
 
-
+SwapReset::SwapReset(SwapMain *plugin, SwapWindow *gui, int x, int y)
+ : BC_GenericButton(x, y, _("Reset"))
+{
+       this->plugin = plugin;
+       this->gui = gui;
+}
+SwapReset::~SwapReset()
+{
+}
+int SwapReset::handle_event()
+{
+       plugin->config.reset_Config();
+       plugin->send_configure_change();
+       plugin->update_gui();
+       return 1;
+}