X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fbrightness%2Fbrightnesswindow.C;h=b127e275fa2de3175a79f2f643abf97adc6aeca4;hp=5a455e0189548a27ebbaa5dd0fdadeec7f7374e4;hb=c857b2fb7965d27d86d5785fb9f1b8957a871a1a;hpb=1c6e05239a27d92813c27c697ccac25378b9efa0 diff --git a/cinelerra-5.1/plugins/brightness/brightnesswindow.C b/cinelerra-5.1/plugins/brightness/brightnesswindow.C index 5a455e01..b127e275 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, 370, 155, 370, 155, 0) { this->client = client; } @@ -48,22 +44,28 @@ BrightnessWindow::~BrightnessWindow() void BrightnessWindow::create_objects() { - int x = 10, y = 10; + int x = 10, y = 10, x1 = x + 90; + int x2 = 0; int clrBtn_w = 50; + add_tool(new BC_Title(x, y, _("Brightness/Contrast"))); y += 25; add_tool(new BC_Title(x, y,_("Brightness:"))); add_tool(brightness = new BrightnessSlider(client, &(client->config.brightness), - x + 80, + x1, y, 1)); + x2 = x1 + brightness->get_w() + 10; + add_subwindow(brightnessClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 1)); y += 25; add_tool(new BC_Title(x, y, _("Contrast:"))); add_tool(contrast = new BrightnessSlider(client, &(client->config.contrast), - x + 80, + x1, y, 0)); + + add_subwindow(contrastClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 0)); y += 30; add_tool(luma = new BrightnessLuma(client, x, @@ -77,11 +79,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, @@ -162,8 +173,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; }