igor b reset btns, reframert bug fix
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / gamma / gammawindow.C
index 5b75102e141daa014caae5b822db789d684c4dea..b00d324512322c4f61673fef77e65c3e41a1e0a8 100644 (file)
 
 
 
-
-
-
-
-
-
-
 GammaWindow::GammaWindow(GammaMain *client)
  : PluginClientWindow(client,
        400,
@@ -45,7 +38,7 @@ GammaWindow::GammaWindow(GammaMain *client)
 
 void GammaWindow::create_objects()
 {
-       int x = 10, y = 10;
+       int x = 10, y = 10, x1 = x;
        add_subwindow(histogram = new BC_SubWindow(x,
                y,
                get_w() - x * 2,
@@ -56,6 +49,7 @@ void GammaWindow::create_objects()
        BC_Title *title;
        add_tool(title = new BC_Title(x, y, _("Maximum:")));
        x += title->get_w() + 10;
+       x1 = x; // save x to align the two sliders
        add_tool(max_slider = new MaxSlider(client,
                this,
                x,
@@ -70,10 +64,10 @@ void GammaWindow::create_objects()
        y += max_text->get_h() + 10;
        x = 10;
        add_tool(automatic = new GammaAuto(client, x, y));
-
        y += automatic->get_h() + 10;
        add_tool(title = new BC_Title(x, y, _("Gamma:")));
        x += title->get_w() + 10;
+       x = x1; // recover x of the "MaxSlider" to align the "GammaSlider"
        add_tool(gamma_slider = new GammaSlider(client,
                this,
                x,
@@ -93,6 +87,8 @@ void GammaWindow::create_objects()
 
        add_tool(new GammaColorPicker(client, this, x, y));
 
+       add_tool(reset = new GammaReset(client, this, get_w()-110, y));
+
        show_window();
        flush();
 }
@@ -315,3 +311,18 @@ int GammaColorPicker::handle_event()
 }
 
 
+GammaReset::GammaReset(GammaMain *plugin, GammaWindow *gui, int x, int y)
+ : BC_GenericButton(x, y, _("Reset"))
+{
+       this->plugin = plugin;
+       this->gui = gui;
+}
+
+int GammaReset::handle_event()
+{
+       plugin->config.reset();
+       gui->update();
+       plugin->send_configure_change();
+       return 1;
+}
+