confirm prefs update, fix bg_pixmap sz, plugin layout tweaks
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / yuv411 / yuv411win.C
index 605f1aaf2d741e4172d34362f9d10e6cd71877f9..271389a9de3e6ca2af00f82473be830fcd957dff 100644 (file)
@@ -3,7 +3,7 @@
 #include "language.h"
 
 yuv411Window::yuv411Window(yuv411Main *client)
- : PluginClientWindow(client, 250, 220, 250, 220, 0)
+ : PluginClientWindow(client, xS(260), yS(230), xS(260), yS(230), 0)
 {
        this->client = client;
 }
@@ -14,34 +14,37 @@ yuv411Window::~yuv411Window()
 
 void yuv411Window::create_objects()
 {
-       int x = 10, y = 10, x1=90;
+       int xs10 = xS(10), xs90 = xS(90);
+       int ys10 = yS(10), ys30 = yS(30);
+       int x = xs10, y = ys10, x1=xs90;
        add_tool(avg_vertical = new yuv411Toggle(client,
                &(client->config.avg_vertical),
                _("Vertical average"),
                x,
                y));
-       y += 30;
+       y += ys30;
        add_tool(int_horizontal = new yuv411Toggle(client,
                &(client->config.int_horizontal),
                _("Horizontal interpolate"),
                x,
                y));
-       y += 30;
+       y += ys30;
        add_tool(inpainting = new yuv411Toggle(client,
                &(client->config.inpainting),
                _("Inpainting method"),
                x,
                y));
-       y += 30;
+       y += ys30;
        add_subwindow(new BC_Title(x, y, _("Offset:")));
        add_subwindow(offset=new yuv411Offset(client,x1,y));
-       y += 30;
+       y += ys30;
        add_subwindow(new BC_Title(x, y, _("Threshold:")));
        add_subwindow(thresh=new yuv411Thresh(client,x1,y));
-       y += 30;
+       y += ys30;
        add_subwindow(new BC_Title(x, y, _("Bias:")));
        add_subwindow(bias=new yuv411Bias(client,x1,y));
-       y += 30;
+       y += ys30;
+       add_subwindow(reset = new yuv411Reset(client, this, x, y+ys10));
        show_window();
        flush();
 
@@ -50,6 +53,16 @@ void yuv411Window::create_objects()
        yuv_warning->hide_window();
 }
 
+void yuv411Window::update()
+{
+       avg_vertical->update(client->config.avg_vertical);
+       int_horizontal->update(client->config.int_horizontal);
+       inpainting->update(client->config.inpainting);
+       offset->update(client->config.offset);
+       thresh->update(client->config.thresh);
+       bias->update(client->config.bias);
+}
+
 int yuv411Window::close_event()
 {
        set_done(1);
@@ -74,7 +87,7 @@ int yuv411Toggle::handle_event()
 }
 
 yuv411Offset::yuv411Offset(yuv411Main *client, int x, int y)
- :  BC_FSlider(x, y, 0, 100, 100, (float)0, (float)2,
+ :  BC_FSlider(x+xS(60), y, 0, xS(100), yS(100), (float)0, (float)2,
             (float)client->config.offset)
 {
        this->client = client;
@@ -88,7 +101,7 @@ int yuv411Offset::handle_event()
 }
 
 yuv411Thresh::yuv411Thresh(yuv411Main *client, int x, int y)
- :  BC_FSlider(x, y, 0, 100, 100, (float)1, (float)100,
+ :  BC_FSlider(x+xS(60), y, 0, xS(100), yS(100), (float)1, (float)100,
             (float)client->config.thresh)
 {
        this->client = client;
@@ -102,7 +115,7 @@ int yuv411Thresh::handle_event()
 }
 
 yuv411Bias::yuv411Bias(yuv411Main *client, int x, int y)
- :  BC_FSlider(x, y, 0, 100, 100, (float)0, (float)25,
+ :  BC_FSlider(x+xS(60), y, 0, xS(100), yS(100), (float)0, (float)25,
             (float)client->config.bias)
 {
        this->client = client;
@@ -116,6 +129,25 @@ int yuv411Bias::handle_event()
        return 1;
 }
 
+yuv411Reset::yuv411Reset(yuv411Main *client, yuv411Window *window, int x, int y)
+ : BC_GenericButton(x, y, _("Reset"))
+{
+       this->client = client;
+       this->window = window;
+}
+yuv411Reset::~yuv411Reset()
+{
+}
+int yuv411Reset::handle_event()
+{
+       client->config.reset();
+       window->update();
+       window->update_enables();
+       client->send_configure_change();
+       return 1;
+}
+
+
 void yuv411Window::update_enables()
 {
        yuv411Config &config = client->config;