X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fbrightness%2Fbrightnesswindow.C;h=2552e20ea62223fdc4316de7d28ae2727afd0b98;hb=c9c0e07706fad701a70ee0d1ffb0fcb6304f138c;hp=5a455e0189548a27ebbaa5dd0fdadeec7f7374e4;hpb=1c6e05239a27d92813c27c697ccac25378b9efa0;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/plugins/brightness/brightnesswindow.C b/cinelerra-5.1/plugins/brightness/brightnesswindow.C index 5a455e01..2552e20e 100644 --- a/cinelerra-5.1/plugins/brightness/brightnesswindow.C +++ b/cinelerra-5.1/plugins/brightness/brightnesswindow.C @@ -22,6 +22,7 @@ #include "bcdisplayinfo.h" #include "brightnesswindow.h" #include "language.h" +#include "theme.h" @@ -32,12 +33,7 @@ BrightnessWindow::BrightnessWindow(BrightnessMain *client) - : PluginClientWindow(client, - 330, - 160, - 330, - 160, - 0) + : PluginClientWindow(client, xS(370), yS(155), xS(370), yS(155), 0) { this->client = client; } @@ -48,28 +44,36 @@ BrightnessWindow::~BrightnessWindow() void BrightnessWindow::create_objects() { - int x = 10, y = 10; + int xs10 = xS(10); + int ys10 = yS(10), ys25 = yS(25), ys30 = yS(30), ys35 = yS(35); + int x = xs10, y = ys10, x1 = x + xS(90); + int x2 = 0; int clrBtn_w = xS(50); + add_tool(new BC_Title(x, y, _("Brightness/Contrast"))); - y += 25; + y += ys25; add_tool(new BC_Title(x, y,_("Brightness:"))); add_tool(brightness = new BrightnessSlider(client, &(client->config.brightness), - x + 80, + x1, y, 1)); - y += 25; + x2 = x1 + brightness->get_w() + xs10; + add_subwindow(brightnessClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 1)); + y += ys25; add_tool(new BC_Title(x, y, _("Contrast:"))); add_tool(contrast = new BrightnessSlider(client, &(client->config.contrast), - x + 80, + x1, y, 0)); - y += 30; + + add_subwindow(contrastClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 0)); + y += ys30; add_tool(luma = new BrightnessLuma(client, x, y)); - y += 35; + y += ys35; add_subwindow(reset = new BrightnessReset(client, this, x, y)); show_window(); @@ -77,11 +81,20 @@ void BrightnessWindow::create_objects() } // for Reset button -void BrightnessWindow::update() +void BrightnessWindow::update_gui(int clear) { - brightness->update(client->config.brightness); - contrast->update(client->config.contrast); - luma->update(client->config.luma); + switch(clear) { + case RESET_CONTRAST : contrast->update(client->config.contrast); + break; + case RESET_BRIGHTNESS: brightness->update(client->config.brightness); + break; + case RESET_ALL : + default: + brightness->update(client->config.brightness); + contrast->update(client->config.contrast); + luma->update(client->config.luma); + break; + } } BrightnessSlider::BrightnessSlider(BrightnessMain *client, @@ -92,8 +105,8 @@ BrightnessSlider::BrightnessSlider(BrightnessMain *client, : BC_FSlider(x, y, 0, - 200, - 200, + xS(200), + yS(200), -100, 100, (int)*output) @@ -162,8 +175,28 @@ BrightnessReset::~BrightnessReset() } int BrightnessReset::handle_event() { - client->config.reset(); - window->update(); + client->config.reset(RESET_ALL); // clear=0 ==> reset all + window->update_gui(RESET_ALL); + client->send_configure_change(); + return 1; +} + +BrightnessSliderClr::BrightnessSliderClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int w, int is_brightness) + : BC_Button(x, y, w, client->get_theme()->get_image_set("reset_button")) +{ + this->client = client; + this->window = window; + this->is_brightness = is_brightness; +} +BrightnessSliderClr::~BrightnessSliderClr() +{ +} +int BrightnessSliderClr::handle_event() +{ + // is_brightness==0 means Contrast slider ==> "clear=1" + // is_brightness==1 means Brightness slider ==> "clear=2" + client->config.reset(is_brightness + 1); + window->update_gui(is_brightness + 1); client->send_configure_change(); return 1; }