From 1a2c313b568030b465b165089f0b90730d17884d Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sun, 19 Dec 2021 15:15:45 -0700 Subject: [PATCH] improved plugins with added Tumbler box and visible values --- cinelerra-5.1/plugins/alpha/alpha.C | 74 +++++- cinelerra-5.1/plugins/alpha/alpha.h | 30 +++ cinelerra-5.1/plugins/brightness/brightness.C | 6 +- .../plugins/brightness/brightnesswindow.C | 166 ++++++++---- .../plugins/brightness/brightnesswindow.h | 52 +++- .../plugins/huesaturation/huesaturation.C | 222 +++++++++++----- .../plugins/huesaturation/huesaturation.h | 73 +++++- cinelerra-5.1/plugins/linearblur/linearblur.C | 171 +++++++++--- cinelerra-5.1/plugins/linearblur/linearblur.h | 60 ++++- cinelerra-5.1/plugins/polar/polar.C | 185 ++++++++----- cinelerra-5.1/plugins/radialblur/radialblur.C | 208 ++++++++++----- cinelerra-5.1/plugins/radialblur/radialblur.h | 67 +++-- cinelerra-5.1/plugins/rgbshift/rgbshift.C | 195 ++++++++++---- cinelerra-5.1/plugins/rgbshift/rgbshift.h | 57 +++- cinelerra-5.1/plugins/sharpen/sharpen.C | 2 +- cinelerra-5.1/plugins/sharpen/sharpenwindow.C | 91 ++++--- cinelerra-5.1/plugins/sharpen/sharpenwindow.h | 32 ++- cinelerra-5.1/plugins/unsharp/unsharpwindow.C | 231 ++++++++++++---- cinelerra-5.1/plugins/unsharp/unsharpwindow.h | 120 +++++++-- cinelerra-5.1/plugins/wave/wave.C | 165 +++++++----- cinelerra-5.1/plugins/wave/wave.h | 62 +++-- cinelerra-5.1/plugins/whirl/whirl.C | 246 ++++++++++-------- cinelerra-5.1/plugins/yuv/yuv.C | 195 ++++++++++---- cinelerra-5.1/plugins/yuvshift/yuvshift.C | 197 ++++++++++---- cinelerra-5.1/plugins/yuvshift/yuvshift.h | 57 +++- cinelerra-5.1/plugins/zoomblur/zoomblur.C | 202 +++++++++----- cinelerra-5.1/plugins/zoomblur/zoomblur.h | 63 ++++- 27 files changed, 2336 insertions(+), 893 deletions(-) diff --git a/cinelerra-5.1/plugins/alpha/alpha.C b/cinelerra-5.1/plugins/alpha/alpha.C index f733033e..ac790211 100644 --- a/cinelerra-5.1/plugins/alpha/alpha.C +++ b/cinelerra-5.1/plugins/alpha/alpha.C @@ -23,6 +23,7 @@ #include #include "alpha.h" +#include "theme.h" #include "filexml.h" #include "keyframe.h" #include "language.h" @@ -32,6 +33,11 @@ REGISTER_PLUGIN(AlphaMain) AlphaConfig::AlphaConfig() +{ + reset(); +} + +void AlphaConfig::reset() { a = 1.; } @@ -56,12 +62,40 @@ void AlphaConfig::interpolate(AlphaConfig &prev, AlphaConfig &next, } +AlphaText::AlphaText(AlphaWindow *window, AlphaMain *plugin, + int x, int y) + : BC_TumbleTextBox(window, (float)plugin->config.a, + (float)OPACITY_MIN, (float)OPACITY_MAX, x, y, xS(60), 2) +{ + this->window = window; + this->plugin = plugin; + set_increment(0.1); +} +AlphaText::~AlphaText() +{ +} + +int AlphaText::handle_event() +{ + float min = OPACITY_MIN, max = OPACITY_MAX; + float output = atof(get_text()); + + if(output > max) output = max; + else if(output < min) output = min; + plugin->config.a = output; + window->alpha_slider->update(plugin->config.a); + window->alpha_text->update(plugin->config.a); + plugin->send_configure_change(); + return 1; +} + AlphaSlider::AlphaSlider(AlphaWindow *window, AlphaMain *plugin, int x, int y, int w) - : BC_FSlider(x, y, 0, w, w, 0.f, 1.f, plugin->config.a) + : BC_FSlider(x, y, 0, w, w, OPACITY_MIN, OPACITY_MAX, plugin->config.a) { this->window = window; this->plugin = plugin; + enable_show_value(0); // Hide caption set_precision(0.001); } AlphaSlider::~AlphaSlider() @@ -71,11 +105,30 @@ AlphaSlider::~AlphaSlider() int AlphaSlider::handle_event() { plugin->config.a = get_value(); + window->alpha_text->update(plugin->config.a); plugin->send_configure_change(); return 1; } -#define ALPHA_W xS(400) +AlphaClr::AlphaClr(AlphaWindow *window, AlphaMain *plugin, int x, int y) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) +{ + this->window = window; + this->plugin = plugin; +} +AlphaClr::~AlphaClr() +{ +} +int AlphaClr::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} + + +#define ALPHA_W xS(420) #define ALPHA_H yS(60) AlphaWindow::AlphaWindow(AlphaMain *plugin) @@ -90,17 +143,28 @@ AlphaWindow::~AlphaWindow() void AlphaWindow::create_objects() { - int x = xS(10), y = yS(10); + int xs10 = xS(10), xs200 = xS(200); + int ys10 = yS(10); + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 + BC_Title *title; + + y += ys10; add_subwindow(title = new BC_Title(x, y, _("Alpha:"))); - y += title->get_h() + yS(5); - add_subwindow(alpha_slider = new AlphaSlider(this, plugin, x, y, xS(380))); + alpha_text = new AlphaText(this, plugin, (x + x2), y); + alpha_text->create_objects(); + add_subwindow(alpha_slider = new AlphaSlider(this, plugin, x3, y, xs200)); + clr_x = x3 + alpha_slider->get_w() + x; + add_subwindow(alpha_clr = new AlphaClr(this, plugin, clr_x, y)); show_window(); } void AlphaWindow::update() { float alpha = plugin->config.a; + alpha_text->update(alpha); alpha_slider->update(alpha); } diff --git a/cinelerra-5.1/plugins/alpha/alpha.h b/cinelerra-5.1/plugins/alpha/alpha.h index 6f146ad8..4dff9be4 100644 --- a/cinelerra-5.1/plugins/alpha/alpha.h +++ b/cinelerra-5.1/plugins/alpha/alpha.h @@ -21,10 +21,16 @@ #ifndef __ALPHA_H__ #define __ALPHA_H__ +#define OPACITY_MIN 0.f +#define OPACITY_MAX 1.f + class AlphaConfig; class AlphaColors; class AlphaWindow; class AlphaMain; +class AlphaText; +class AlphaSlider; +class AlphaClr; #include "bccolors.h" #include "filexml.inc" @@ -36,6 +42,7 @@ class AlphaConfig { public: AlphaConfig(); + void reset(); int equivalent(AlphaConfig &that); void copy_from(AlphaConfig &that); @@ -45,6 +52,17 @@ public: float a; }; +class AlphaText : public BC_TumbleTextBox +{ +public: + AlphaText(AlphaWindow *window, AlphaMain *plugin, int x, int y); + ~AlphaText(); + int handle_event(); + + AlphaWindow *window; + AlphaMain *plugin; +}; + class AlphaSlider : public BC_FSlider { public: @@ -56,6 +74,16 @@ public: AlphaMain *plugin; }; +class AlphaClr : public BC_Button +{ +public: + AlphaClr(AlphaWindow *window, AlphaMain *plugin, int x, int y); + ~AlphaClr(); + int handle_event(); + + AlphaWindow *window; + AlphaMain *plugin; +}; class AlphaWindow : public PluginClientWindow { @@ -67,7 +95,9 @@ public: void update(); AlphaMain *plugin; + AlphaText *alpha_text; AlphaSlider *alpha_slider; + AlphaClr *alpha_clr; }; class AlphaMain : public PluginVClient diff --git a/cinelerra-5.1/plugins/brightness/brightness.C b/cinelerra-5.1/plugins/brightness/brightness.C index 604d249f..5de95b65 100644 --- a/cinelerra-5.1/plugins/brightness/brightness.C +++ b/cinelerra-5.1/plugins/brightness/brightness.C @@ -255,8 +255,10 @@ void BrightnessMain::update_gui() if(load_configuration()) { ((BrightnessWindow*)thread->window)->lock_window("BrightnessMain::update_gui"); - ((BrightnessWindow*)thread->window)->brightness->update(config.brightness); - ((BrightnessWindow*)thread->window)->contrast->update(config.contrast); + ((BrightnessWindow*)thread->window)->brightness_text->update(config.brightness); + ((BrightnessWindow*)thread->window)->brightness_slider->update(config.brightness); + ((BrightnessWindow*)thread->window)->contrast_text->update(config.contrast); + ((BrightnessWindow*)thread->window)->contrast_slider->update(config.contrast); ((BrightnessWindow*)thread->window)->luma->update(config.luma); ((BrightnessWindow*)thread->window)->unlock_window(); } diff --git a/cinelerra-5.1/plugins/brightness/brightnesswindow.C b/cinelerra-5.1/plugins/brightness/brightnesswindow.C index 2552e20e..48cd2e00 100644 --- a/cinelerra-5.1/plugins/brightness/brightnesswindow.C +++ b/cinelerra-5.1/plugins/brightness/brightnesswindow.C @@ -33,7 +33,7 @@ BrightnessWindow::BrightnessWindow(BrightnessMain *client) - : PluginClientWindow(client, xS(370), yS(155), xS(370), yS(155), 0) + : PluginClientWindow(client, xS(420), yS(160), xS(420), yS(160), 0) { this->client = client; } @@ -44,36 +44,47 @@ BrightnessWindow::~BrightnessWindow() void BrightnessWindow::create_objects() { - 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); + int xs10 = xS(10), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 - add_tool(new BC_Title(x, y, _("Brightness/Contrast"))); - y += ys25; + BC_Bar *bar; + +// Brightness + y += ys10; add_tool(new BC_Title(x, y,_("Brightness:"))); - add_tool(brightness = new BrightnessSlider(client, - &(client->config.brightness), - x1, - y, - 1)); - 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), - x1, - y, - 0)); + brightness_text = new BrightnessFText(this, client, + 0, &(client->config.brightness), (x + x2), y, -MAXVALUE, MAXVALUE); + brightness_text->create_objects(); + brightness_slider = new BrightnessFSlider(client, + brightness_text, &(client->config.brightness), x3, y, -MAXVALUE, MAXVALUE, xs200, 1); + add_subwindow(brightness_slider); + brightness_text->slider = brightness_slider; + clr_x = x3 + brightness_slider->get_w() + x; + add_subwindow(brightness_Clr = new BrightnessClr(client, this, clr_x, y, RESET_BRIGHTNESS)); + y += ys30; - add_subwindow(contrastClr = new BrightnessSliderClr(client, this, x2, y, clrBtn_w, 0)); +// Contrast + add_tool(new BC_Title(x, y, _("Contrast:"))); + contrast_text = new BrightnessFText(this, client, + 0, &(client->config.contrast), (x + x2), y, -MAXVALUE, MAXVALUE); + contrast_text->create_objects(); + contrast_slider = new BrightnessFSlider(client, + contrast_text, &(client->config.contrast), x3, y, -MAXVALUE, MAXVALUE, xs200, 0); + add_subwindow(contrast_slider); + contrast_text->slider = contrast_slider; + add_subwindow(contrast_Clr = new BrightnessClr(client, this, clr_x, y, RESET_CONTRAST)); y += ys30; - add_tool(luma = new BrightnessLuma(client, - x, - y)); - y += ys35; +// Luma + add_tool(luma = new BrightnessLuma(client, x, y)); + y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new BrightnessReset(client, this, x, y)); show_window(); @@ -84,48 +95,93 @@ void BrightnessWindow::create_objects() void BrightnessWindow::update_gui(int clear) { switch(clear) { - case RESET_CONTRAST : contrast->update(client->config.contrast); + case RESET_CONTRAST : + contrast_text->update(client->config.contrast); + contrast_slider->update(client->config.contrast); break; - case RESET_BRIGHTNESS: brightness->update(client->config.brightness); + case RESET_BRIGHTNESS: + brightness_text->update(client->config.brightness); + brightness_slider->update(client->config.brightness); break; case RESET_ALL : default: - brightness->update(client->config.brightness); - contrast->update(client->config.contrast); + brightness_text->update(client->config.brightness); + brightness_slider->update(client->config.brightness); + contrast_text->update(client->config.contrast); + contrast_slider->update(client->config.contrast); luma->update(client->config.luma); break; } } -BrightnessSlider::BrightnessSlider(BrightnessMain *client, - float *output, - int x, - int y, - int is_brightness) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - -100, - 100, - (int)*output) + +/* BRIGHTNESS VALUES + brightness is stored from -100.00 to +100.00 + brightness_slider goes from -100.00 to +100.00 + brightness_caption goes from -1.000 to +1.000 + brightness_text goes from -100.00 to +100.00 +*/ + +/* CONTRAST VALUES + contrast is stored from -100.00 to +100.00 + contrast_slider goes from -100.00 to +100.00 + contrast_caption goes from 0.000 to +5.000 (clear to +1.000) + contrast_text goes from -100.00 to +100.00 +*/ + +BrightnessFText::BrightnessFText(BrightnessWindow *window, BrightnessMain *client, + BrightnessFSlider *slider, float *output, int x, int y, float min, float max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 2) { + this->window = window; this->client = client; this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(0.01); +} + +BrightnessFText::~BrightnessFText() +{ +} + +int BrightnessFText::handle_event() +{ + *output = atof(get_text()); + if(*output > max) *output = max; + else if(*output < min) *output = min; + slider->update(*output); + client->send_configure_change(); + return 1; +} + +BrightnessFSlider::BrightnessFSlider(BrightnessMain *client, + BrightnessFText *text, float *output, int x, int y, + float min, float max, int w, int is_brightness) + : BC_FSlider(x, y, 0, w, w, min, max, *output) +{ + this->client = client; + this->output = output; + this->text = text; this->is_brightness = is_brightness; + enable_show_value(0); // Hide caption } -BrightnessSlider::~BrightnessSlider() + +BrightnessFSlider::~BrightnessFSlider() { } -int BrightnessSlider::handle_event() + +int BrightnessFSlider::handle_event() { *output = get_value(); + text->update(*output); client->send_configure_change(); return 1; } -char* BrightnessSlider::get_caption() +char* BrightnessFSlider::get_caption() { float fraction; if(is_brightness) @@ -181,22 +237,22 @@ int BrightnessReset::handle_event() 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")) +BrightnessClr::BrightnessClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int clear) + : BC_Button(x, y, client->get_theme()->get_image_set("reset_button")) { this->client = client; this->window = window; - this->is_brightness = is_brightness; + this->clear = clear; } -BrightnessSliderClr::~BrightnessSliderClr() +BrightnessClr::~BrightnessClr() { } -int BrightnessSliderClr::handle_event() +int BrightnessClr::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); + // clear==1 ==> Contrast text-slider + // clear==2 ==> Brightness text-slider + client->config.reset(clear); + window->update_gui(clear); client->send_configure_change(); return 1; } diff --git a/cinelerra-5.1/plugins/brightness/brightnesswindow.h b/cinelerra-5.1/plugins/brightness/brightnesswindow.h index 877d216b..393146d6 100644 --- a/cinelerra-5.1/plugins/brightness/brightnesswindow.h +++ b/cinelerra-5.1/plugins/brightness/brightnesswindow.h @@ -32,12 +32,15 @@ #define RESET_CONTRAST 1 #define RESET_BRIGHTNESS 2 +#define MAXVALUE 100.00 + class BrightnessThread; class BrightnessWindow; -class BrightnessSlider; +class BrightnessFText; +class BrightnessFSlider; class BrightnessLuma; class BrightnessReset; -class BrightnessSliderClr; +class BrightnessClr; class BrightnessWindow : public PluginClientWindow @@ -49,23 +52,45 @@ public: void create_objects(); BrightnessMain *client; - BrightnessSlider *brightness; - BrightnessSlider *contrast; + + BrightnessFText *brightness_text; + BrightnessFSlider *brightness_slider; + BrightnessClr *brightness_Clr; + + BrightnessFText *contrast_text; + BrightnessFSlider *contrast_slider; + BrightnessClr *contrast_Clr; + BrightnessLuma *luma; BrightnessReset *reset; - BrightnessSliderClr *brightnessClr; - BrightnessSliderClr *contrastClr; }; -class BrightnessSlider : public BC_FSlider +class BrightnessFText : public BC_TumbleTextBox +{ +public: + BrightnessFText(BrightnessWindow *window, BrightnessMain *client, + BrightnessFSlider *slider, float *output, int x, int y, float min, float max); + ~BrightnessFText(); + int handle_event(); + BrightnessWindow *window; + BrightnessMain *client; + BrightnessFSlider *slider; + float *output; + float min, max; +}; + +class BrightnessFSlider : public BC_FSlider { public: - BrightnessSlider(BrightnessMain *client, float *output, int x, int y, int is_brightness); - ~BrightnessSlider(); + BrightnessFSlider(BrightnessMain *client, + BrightnessFText *text, float *output, int x, int y, + float min, float max, int w, int is_brightness); + ~BrightnessFSlider(); int handle_event(); char* get_caption(); BrightnessMain *client; + BrightnessFText *text; float *output; int is_brightness; char string[BCTEXTLEN]; @@ -77,7 +102,6 @@ public: BrightnessLuma(BrightnessMain *client, int x, int y); ~BrightnessLuma(); int handle_event(); - BrightnessMain *client; }; @@ -91,15 +115,15 @@ public: BrightnessWindow *window; }; -class BrightnessSliderClr : public BC_Button +class BrightnessClr : public BC_Button { public: - BrightnessSliderClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int w, int is_brightness); - ~BrightnessSliderClr(); + BrightnessClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int clear); + ~BrightnessClr(); int handle_event(); BrightnessMain *client; BrightnessWindow *window; - int is_brightness; + int clear; }; #endif diff --git a/cinelerra-5.1/plugins/huesaturation/huesaturation.C b/cinelerra-5.1/plugins/huesaturation/huesaturation.C index bbaf2ca6..a1e26d82 100644 --- a/cinelerra-5.1/plugins/huesaturation/huesaturation.C +++ b/cinelerra-5.1/plugins/huesaturation/huesaturation.C @@ -97,48 +97,100 @@ void HueConfig::interpolate(HueConfig &prev, +/* SATURATION VALUES + saturation is stored from -100.00 to +100.00 + saturation_slider goes from -100.00 to +100.00 + saturation_caption goes from 0.000 to +2.000 (clear to +1.000) + saturation_text goes from -100.00 to +100.00 +*/ +/* VALUE VALUES + value is stored from -100.00 to +100.00 + value_slider goes from -100.00 to +100.00 + value_caption goes from 0.000 to +2.000 (clear to +1.000) + value_text goes from -100.00 to +100.00 +*/ + +HueText::HueText(HueEffect *plugin, HueWindow *gui, int x, int y) + : BC_TumbleTextBox(gui, plugin->config.hue, + (float)MINHUE, (float)MAXHUE, x, y, xS(60), 2) +{ + this->gui = gui; + this->plugin = plugin; + set_increment(0.01); +} + +HueText::~HueText() +{ +} +int HueText::handle_event() +{ + float min = MINHUE, max = MAXHUE; + float output = atof(get_text()); + if(output > max) output = max; + if(output < min) output = min; + plugin->config.hue = output; + gui->hue_slider->update(plugin->config.hue); + plugin->send_configure_change(); + return 1; +} -HueSlider::HueSlider(HueEffect *plugin, int x, int y, int w) - : BC_FSlider(x, - y, - 0, - w, - w, - (float)MINHUE, - (float)MAXHUE, - plugin->config.hue) +HueSlider::HueSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w) + : BC_FSlider(x, y, 0, w, w, + (float)MINHUE, (float)MAXHUE, + plugin->config.hue) { this->plugin = plugin; + this->gui = gui; + enable_show_value(0); // Hide caption } int HueSlider::handle_event() { plugin->config.hue = get_value(); + gui->hue_text->update(plugin->config.hue); plugin->send_configure_change(); return 1; } +SaturationText::SaturationText(HueEffect *plugin, HueWindow *gui, int x, int y) + : BC_TumbleTextBox(gui, plugin->config.saturation, + (float)MINSATURATION, (float)MAXSATURATION, x, y, xS(60), 2) +{ + this->gui = gui; + this->plugin = plugin; + set_increment(0.01); +} +SaturationText::~SaturationText() +{ +} +int SaturationText::handle_event() +{ + float min = MINSATURATION, max = MAXSATURATION; + float output = atof(get_text()); + if(output > max) output = max; + if(output < min) output = min; + plugin->config.saturation = output; + gui->sat_slider->update(plugin->config.saturation); + plugin->send_configure_change(); + return 1; +} - - -SaturationSlider::SaturationSlider(HueEffect *plugin, int x, int y, int w) - : BC_FSlider(x, - y, - 0, - w, - w, - (float)MINSATURATION, - (float)MAXSATURATION, - plugin->config.saturation) +SaturationSlider::SaturationSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w) + : BC_FSlider(x, y, 0, w, w, + (float)MINSATURATION, (float)MAXSATURATION, + plugin->config.saturation) { this->plugin = plugin; + this->gui = gui; + enable_show_value(0); // Hide caption } int SaturationSlider::handle_event() { plugin->config.saturation = get_value(); + gui->sat_text->update(plugin->config.saturation); plugin->send_configure_change(); return 1; } @@ -146,32 +198,50 @@ int SaturationSlider::handle_event() char* SaturationSlider::get_caption() { float fraction = ((float)plugin->config.saturation - MINSATURATION) / - MAXSATURATION;; + MAXSATURATION; sprintf(string, "%0.4f", fraction); return string; } +ValueText::ValueText(HueEffect *plugin, HueWindow *gui, int x, int y) + : BC_TumbleTextBox(gui, plugin->config.value, + (float)MINVALUE, (float)MAXVALUE, x, y, xS(60), 2) +{ + this->gui = gui; + this->plugin = plugin; + set_increment(0.01); +} +ValueText::~ValueText() +{ +} +int ValueText::handle_event() +{ + float min = MINVALUE, max = MAXVALUE; + float output = atof(get_text()); + if(output > max) output = max; + if(output < min) output = min; + plugin->config.value = output; + gui->value_slider->update(plugin->config.value); + plugin->send_configure_change(); + return 1; +} - - -ValueSlider::ValueSlider(HueEffect *plugin, int x, int y, int w) - : BC_FSlider(x, - y, - 0, - w, - w, - (float)MINVALUE, - (float)MAXVALUE, - plugin->config.value) +ValueSlider::ValueSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w) + : BC_FSlider(x, y, 0, w, w, + (float)MINVALUE, (float)MAXVALUE, + plugin->config.value) { this->plugin = plugin; + this->gui = gui; + enable_show_value(0); // Hide caption } int ValueSlider::handle_event() { plugin->config.value = get_value(); + gui->value_text->update(plugin->config.value); plugin->send_configure_change(); return 1; } @@ -202,21 +272,21 @@ int HueReset::handle_event() } -HueSliderClr::HueSliderClr(HueEffect *plugin, HueWindow *gui, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +HueClr::HueClr(HueEffect *plugin, HueWindow *gui, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->gui = gui; this->clear = clear; } -HueSliderClr::~HueSliderClr() +HueClr::~HueClr() { } -int HueSliderClr::handle_event() +int HueClr::handle_event() { - // clear==1 ==> Hue slider - // clear==2 ==> Saturation slider - // clear==3 ==> Value slider + // clear==1 ==> Hue + // clear==2 ==> Saturation + // clear==3 ==> Value plugin->config.reset(clear); gui->update_gui(clear); plugin->send_configure_change(); @@ -227,33 +297,49 @@ int HueSliderClr::handle_event() HueWindow::HueWindow(HueEffect *plugin) - : PluginClientWindow(plugin, xS(370), yS(140), xS(370), yS(140), 0) + : PluginClientWindow(plugin, xS(420), yS(160), xS(420), yS(160), 0) { this->plugin = plugin; } void HueWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100), xs200 = xS(200); + int xs10 = xS(10), xs200 = xS(200); int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); - int x = xs10, y = ys10, x1 = xs100; - int x2 = 0; int clrBtn_w = xs50; + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 - add_subwindow(new BC_Title(x, y, _("Hue:"))); - add_subwindow(hue = new HueSlider(plugin, x1, y, xs200)); - x2 = x1 + hue->get_w() + xs10; - add_subwindow(hueClr = new HueSliderClr(plugin, this, x2, y, clrBtn_w, RESET_HUV)); + BC_Bar *bar; +// Hue + y += ys10; + add_subwindow(new BC_Title(x, y, _("Hue:"))); + hue_text = new HueText(plugin, this, (x + x2), y); + hue_text->create_objects(); + add_subwindow(hue_slider = new HueSlider(plugin, this, x3, y, xs200)); + clr_x = x3 + hue_slider->get_w() + x; + add_subwindow(hue_clr = new HueClr(plugin, this, clr_x, y, RESET_HUV)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Saturation:"))); - add_subwindow(saturation = new SaturationSlider(plugin, x1, y, xs200)); - add_subwindow(satClr = new HueSliderClr(plugin, this, x2, y, clrBtn_w, RESET_SAT)); +// Saturation + add_subwindow(new BC_Title(x, y, _("Saturation:"))); + sat_text = new SaturationText(plugin, this, (x + x2), y); + sat_text->create_objects(); + add_subwindow(sat_slider = new SaturationSlider(plugin, this, x3, y, xs200)); + add_subwindow(sat_clr = new HueClr(plugin, this, clr_x, y, RESET_SAT)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Value:"))); - add_subwindow(value = new ValueSlider(plugin, x1, y, xs200)); - add_subwindow(valClr = new HueSliderClr(plugin, this, x2, y, clrBtn_w, RESET_VAL)); +// Value + add_subwindow(new BC_Title(x, y, _("Value:"))); + value_text = new ValueText(plugin, this, (x + x2), y); + value_text->create_objects(); + add_subwindow(value_slider = new ValueSlider(plugin, this, x3, y, xs200)); + add_subwindow(value_clr = new HueClr(plugin, this, clr_x, y, RESET_VAL)); y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new HueReset(plugin, this, x, y)); show_window(); flush(); @@ -264,17 +350,26 @@ void HueWindow::create_objects() void HueWindow::update_gui(int clear) { switch(clear) { - case RESET_HUV : hue->update(plugin->config.hue); + case RESET_HUV : + hue_text->update(plugin->config.hue); + hue_slider->update(plugin->config.hue); break; - case RESET_SAT : saturation->update(plugin->config.saturation); + case RESET_SAT : + sat_text->update(plugin->config.saturation); + sat_slider->update(plugin->config.saturation); break; - case RESET_VAL : value->update(plugin->config.value); + case RESET_VAL : + value_text->update(plugin->config.value); + value_slider->update(plugin->config.value); break; case RESET_ALL : default: - hue->update(plugin->config.hue); - saturation->update(plugin->config.saturation); - value->update(plugin->config.value); + hue_text->update(plugin->config.hue); + hue_slider->update(plugin->config.hue); + sat_text->update(plugin->config.saturation); + sat_slider->update(plugin->config.saturation); + value_text->update(plugin->config.value); + value_slider->update(plugin->config.value); break; } } @@ -565,9 +660,12 @@ void HueEffect::update_gui() { ((HueWindow*)thread->window)->lock_window(); load_configuration(); - ((HueWindow*)thread->window)->hue->update(config.hue); - ((HueWindow*)thread->window)->saturation->update(config.saturation); - ((HueWindow*)thread->window)->value->update(config.value); + ((HueWindow*)thread->window)->hue_text->update(config.hue); + ((HueWindow*)thread->window)->hue_slider->update(config.hue); + ((HueWindow*)thread->window)->sat_text->update(config.saturation); + ((HueWindow*)thread->window)->sat_slider->update(config.saturation); + ((HueWindow*)thread->window)->value_text->update(config.value); + ((HueWindow*)thread->window)->value_slider->update(config.value); ((HueWindow*)thread->window)->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/huesaturation/huesaturation.h b/cinelerra-5.1/plugins/huesaturation/huesaturation.h index c763ba4f..5d2093f0 100644 --- a/cinelerra-5.1/plugins/huesaturation/huesaturation.h +++ b/cinelerra-5.1/plugins/huesaturation/huesaturation.h @@ -41,8 +41,14 @@ class HueEffect; class HueWindow; +class HueText; +class HueSlider; +class SaturationText; +class SaturationSlider; +class ValueText; +class ValueSlider; class HueReset; -class HueSliderClr; +class HueClr; #define MINHUE -180 #define MAXHUE 180 @@ -73,31 +79,65 @@ public: float hue, saturation, value; }; +class HueText : public BC_TumbleTextBox +{ +public: + HueText(HueEffect *plugin, HueWindow *gui, int x, int y); + ~HueText(); + int handle_event(); + HueEffect *plugin; + HueWindow *gui; +}; + class HueSlider : public BC_FSlider { public: - HueSlider(HueEffect *plugin, int x, int y, int w); + HueSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w); int handle_event(); HueEffect *plugin; + HueWindow *gui; +}; + +class SaturationText : public BC_TumbleTextBox +{ +public: + SaturationText(HueEffect *plugin, HueWindow *gui, int x, int y); + ~SaturationText(); + int handle_event(); + HueEffect *plugin; + HueWindow *gui; }; class SaturationSlider : public BC_FSlider { public: - SaturationSlider(HueEffect *plugin, int x, int y, int w); + SaturationSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w); int handle_event(); char* get_caption(); HueEffect *plugin; + HueWindow *gui; char string[BCTEXTLEN]; }; +class ValueText : public BC_TumbleTextBox +{ +public: + ValueText(HueEffect *plugin, HueWindow *gui, int x, int y); + ~ValueText(); + int handle_event(); + HueEffect *plugin; + HueWindow *gui; +}; + + class ValueSlider : public BC_FSlider { public: - ValueSlider(HueEffect *plugin, int x, int y, int w); + ValueSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w); int handle_event(); char* get_caption(); HueEffect *plugin; + HueWindow *gui; char string[BCTEXTLEN]; }; @@ -111,11 +151,11 @@ public: HueWindow *gui; }; -class HueSliderClr : public BC_Button +class HueClr : public BC_Button { public: - HueSliderClr(HueEffect *plugin, HueWindow *gui, int x, int y, int w, int clear); - ~HueSliderClr(); + HueClr(HueEffect *plugin, HueWindow *gui, int x, int y, int clear); + ~HueClr(); int handle_event(); HueEffect *plugin; HueWindow *gui; @@ -129,13 +169,20 @@ public: void create_objects(); void update_gui(int clear); HueEffect *plugin; - HueSlider *hue; - SaturationSlider *saturation; - ValueSlider *value; + + HueText *hue_text; + HueSlider *hue_slider; + HueClr *hue_clr; + + SaturationText *sat_text; + SaturationSlider *sat_slider; + HueClr *sat_clr; + + ValueText *value_text; + ValueSlider *value_slider; + HueClr *value_clr; + HueReset *reset; - HueSliderClr *hueClr; - HueSliderClr *satClr; - HueSliderClr *valClr; }; diff --git a/cinelerra-5.1/plugins/linearblur/linearblur.C b/cinelerra-5.1/plugins/linearblur/linearblur.C index 428b6083..2c4f508f 100644 --- a/cinelerra-5.1/plugins/linearblur/linearblur.C +++ b/cinelerra-5.1/plugins/linearblur/linearblur.C @@ -135,10 +135,10 @@ void LinearBlurConfig::interpolate(LinearBlurConfig &prev, LinearBlurWindow::LinearBlurWindow(LinearBlurMain *plugin) : PluginClientWindow(plugin, - xS(280), - yS(320), - xS(280), - yS(320), + xS(420), + yS(200), + xS(420), + yS(200), 0) { this->plugin = plugin; @@ -150,42 +150,69 @@ LinearBlurWindow::~LinearBlurWindow() void LinearBlurWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100); - int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(40); + int xs10 = xS(10), xs100 = xS(100), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); int x = xs10, y = ys10; - int x1 = 0; int clrBtn_w = xs50; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; - add_subwindow(new BC_Title(x, y, _("Length:"))); - y += ys20; - add_subwindow(radius = new LinearBlurSize(plugin, x, y, &plugin->config.radius, 0, 100)); - x1 = x + radius->get_w() + xs10; - add_subwindow(radiusClr = new LinearBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_RADIUS)); + BC_Bar *bar; + y += ys10; + add_subwindow(new BC_Title(x, y, _("Length:"))); + radius_text = new LinearBlurIText(this, plugin, + 0, &plugin->config.radius, (x + x2), y, RADIUS_MIN, RADIUS_MAX); + radius_text->create_objects(); + radius_slider = new LinearBlurISlider(plugin, + radius_text, &plugin->config.radius, x3, y, RADIUS_MIN, RADIUS_MAX, xs200); + add_subwindow(radius_slider); + radius_text->slider = radius_slider; + clr_x = x3 + radius_slider->get_w() + x; + add_subwindow(radius_Clr = new LinearBlurClr(plugin, this, clr_x, y, RESET_RADIUS)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Angle:"))); - y += ys20; - add_subwindow(angle = new LinearBlurSize(plugin, x, y, &plugin->config.angle, -180, 180)); - add_subwindow(angleClr = new LinearBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ANGLE)); + add_subwindow(new BC_Title(x, y, _("Angle:"))); + angle_text = new LinearBlurIText(this, plugin, + 0, &plugin->config.angle, (x + x2), y, -ANGLE_MAX, ANGLE_MAX); + angle_text->create_objects(); + angle_slider = new LinearBlurISlider(plugin, + angle_text, &plugin->config.angle, x3, y, -ANGLE_MAX, ANGLE_MAX, xs200); + add_subwindow(angle_slider); + angle_text->slider = angle_slider; + add_subwindow(angle_Clr = new LinearBlurClr(plugin, this, clr_x, y, RESET_ANGLE)); y += ys30; + add_subwindow(new BC_Title(x, y, _("Steps:"))); - y += ys20; - add_subwindow(steps = new LinearBlurSize(plugin, x, y, &plugin->config.steps, 1, 200)); - add_subwindow(stepsClr = new LinearBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_STEPS)); + steps_text = new LinearBlurIText(this, plugin, + 0, &plugin->config.steps, (x + x2), y, STEPS_MIN, STEPS_MAX); + steps_text->create_objects(); + steps_slider = new LinearBlurISlider(plugin, + steps_text, &plugin->config.steps, x3, y, STEPS_MIN, STEPS_MAX, xs200); + add_subwindow(steps_slider); + steps_text->slider = steps_slider; + add_subwindow(steps_Clr = new LinearBlurClr(plugin, this, clr_x, y, RESET_STEPS)); + y += ys40; + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; + int x1 = x; + int toggle_w = (get_w()-2*x) / 4; + add_subwindow(r = new LinearBlurToggle(plugin, x1, y, &plugin->config.r, _("Red"))); + x1 += toggle_w; + add_subwindow(g = new LinearBlurToggle(plugin, x1, y, &plugin->config.g, _("Green"))); + x1 += toggle_w; + add_subwindow(b = new LinearBlurToggle(plugin, x1, y, &plugin->config.b, _("Blue"))); + x1 += toggle_w; + add_subwindow(a = new LinearBlurToggle(plugin, x1, y, &plugin->config.a, _("Alpha"))); y += ys30; - add_subwindow(r = new LinearBlurToggle(plugin, x, y, &plugin->config.r, _("Red"))); - y += ys30; - add_subwindow(g = new LinearBlurToggle(plugin, x, y, &plugin->config.g, _("Green"))); - y += ys30; - add_subwindow(b = new LinearBlurToggle(plugin, x, y, &plugin->config.b, _("Blue"))); - y += ys30; - add_subwindow(a = new LinearBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha"))); - y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new LinearBlurReset(plugin, this, x, y)); add_subwindow(default_settings = new LinearBlurDefaultSettings(plugin, this, - (xS(280) - xs10 - defaultBtn_w), y, defaultBtn_w)); + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -196,18 +223,27 @@ void LinearBlurWindow::create_objects() void LinearBlurWindow::update_gui(int clear) { switch(clear) { - case RESET_RADIUS : radius->update(plugin->config.radius); + case RESET_RADIUS : + radius_text->update((int64_t)plugin->config.radius); + radius_slider->update(plugin->config.radius); break; - case RESET_ANGLE : angle->update(plugin->config.angle); + case RESET_ANGLE : + angle_text->update((int64_t)plugin->config.angle); + angle_slider->update(plugin->config.angle); break; - case RESET_STEPS : steps->update(plugin->config.steps); + case RESET_STEPS : + steps_text->update((int64_t)plugin->config.steps); + steps_slider->update(plugin->config.steps); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: - radius->update(plugin->config.radius); - angle->update(plugin->config.angle); - steps->update(plugin->config.steps); + radius_text->update((int64_t)plugin->config.radius); + radius_slider->update(plugin->config.radius); + angle_text->update((int64_t)plugin->config.angle); + angle_slider->update(plugin->config.angle); + steps_text->update((int64_t)plugin->config.steps); + steps_slider->update(plugin->config.steps); r->update(plugin->config.r); g->update(plugin->config.g); b->update(plugin->config.b); @@ -246,7 +282,56 @@ int LinearBlurToggle::handle_event() +LinearBlurIText::LinearBlurIText(LinearBlurWindow *gui, LinearBlurMain *plugin, + LinearBlurISlider *slider, int *output, int x, int y, int min, int max) + : BC_TumbleTextBox(gui, *output, + min, max, x, y, xS(60), 0) +{ + this->gui = gui; + this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(1); +} +LinearBlurIText::~LinearBlurIText() +{ +} + +int LinearBlurIText::handle_event() +{ + *output = atoi(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); + plugin->send_configure_change(); + return 1; +} + + +LinearBlurISlider::LinearBlurISlider(LinearBlurMain *plugin, + LinearBlurIText *text, int *output, int x, int y, int min, int max, int w) + : BC_ISlider(x, y, 0, w, w, min, max, *output) +{ + this->plugin = plugin; + this->output = output; + this->text = text; + enable_show_value(0); // Hide caption +} + +LinearBlurISlider::~LinearBlurISlider() +{ +} + +int LinearBlurISlider::handle_event() +{ + *output = get_value(); + text->update((int64_t)*output); + plugin->send_configure_change(); + return 1; +} LinearBlurSize::LinearBlurSize(LinearBlurMain *plugin, @@ -304,17 +389,17 @@ int LinearBlurDefaultSettings::handle_event() } -LinearBlurSliderClr::LinearBlurSliderClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +LinearBlurClr::LinearBlurClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->gui = gui; this->clear = clear; } -LinearBlurSliderClr::~LinearBlurSliderClr() +LinearBlurClr::~LinearBlurClr() { } -int LinearBlurSliderClr::handle_event() +int LinearBlurClr::handle_event() { // clear==1 ==> Radius slider // clear==2 ==> Angle slider @@ -508,9 +593,13 @@ void LinearBlurMain::update_gui() { load_configuration(); ((LinearBlurWindow*)thread->window)->lock_window(); - ((LinearBlurWindow*)thread->window)->radius->update(config.radius); - ((LinearBlurWindow*)thread->window)->angle->update(config.angle); - ((LinearBlurWindow*)thread->window)->steps->update(config.steps); + ((LinearBlurWindow*)thread->window)->radius_text->update((int64_t)config.radius); + ((LinearBlurWindow*)thread->window)->radius_slider->update(config.radius); + ((LinearBlurWindow*)thread->window)->angle_text->update((int64_t)config.angle); + ((LinearBlurWindow*)thread->window)->angle_slider->update(config.angle); + ((LinearBlurWindow*)thread->window)->steps_text->update((int64_t)config.steps); + ((LinearBlurWindow*)thread->window)->steps_slider->update(config.steps); + ((LinearBlurWindow*)thread->window)->r->update(config.r); ((LinearBlurWindow*)thread->window)->g->update(config.g); ((LinearBlurWindow*)thread->window)->b->update(config.b); diff --git a/cinelerra-5.1/plugins/linearblur/linearblur.h b/cinelerra-5.1/plugins/linearblur/linearblur.h index 676f0331..5180ec65 100644 --- a/cinelerra-5.1/plugins/linearblur/linearblur.h +++ b/cinelerra-5.1/plugins/linearblur/linearblur.h @@ -43,12 +43,21 @@ #define RESET_ANGLE 2 #define RESET_STEPS 3 +#define RADIUS_MIN 0 +#define RADIUS_MAX 100 +#define ANGLE_MAX 180 +#define STEPS_MIN 1 +#define STEPS_MAX 200 + class LinearBlurMain; class LinearBlurWindow; class LinearBlurEngine; +class LinearBlurIText; +class LinearBlurISlider; +class LinearBlurToggle; class LinearBlurReset; class LinearBlurDefaultSettings; -class LinearBlurSliderClr; +class LinearBlurClr; @@ -91,6 +100,33 @@ public: int *output; }; +class LinearBlurIText : public BC_TumbleTextBox +{ +public: + LinearBlurIText(LinearBlurWindow *gui, LinearBlurMain *plugin, + LinearBlurISlider *slider, int *output, int x, int y, int min, int max); + ~LinearBlurIText(); + int handle_event(); + LinearBlurWindow *gui; + LinearBlurMain *plugin; + LinearBlurISlider *slider; + int *output; + int min, max; +}; + +class LinearBlurISlider : public BC_ISlider +{ +public: + LinearBlurISlider(LinearBlurMain *plugin, + LinearBlurIText *text, int *output, int x, int y, + int min, int max, int w); + ~LinearBlurISlider(); + int handle_event(); + LinearBlurMain *plugin; + LinearBlurIText *text; + int *output; +}; + class LinearBlurToggle : public BC_CheckBox { public: @@ -124,11 +160,11 @@ public: LinearBlurWindow *gui; }; -class LinearBlurSliderClr : public BC_Button +class LinearBlurClr : public BC_Button { public: - LinearBlurSliderClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w, int clear); - ~LinearBlurSliderClr(); + LinearBlurClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int clear); + ~LinearBlurClr(); int handle_event(); LinearBlurMain *plugin; LinearBlurWindow *gui; @@ -144,14 +180,22 @@ public: void create_objects(); void update_gui(int clear); - LinearBlurSize *angle, *steps, *radius; + LinearBlurIText *radius_text; + LinearBlurISlider *radius_slider; + LinearBlurClr *radius_Clr; + + LinearBlurIText *angle_text; + LinearBlurISlider *angle_slider; + LinearBlurClr *angle_Clr; + + LinearBlurIText *steps_text; + LinearBlurISlider *steps_slider; + LinearBlurClr *steps_Clr; + LinearBlurToggle *r, *g, *b, *a; LinearBlurMain *plugin; LinearBlurReset *reset; LinearBlurDefaultSettings *default_settings; - LinearBlurSliderClr *radiusClr; - LinearBlurSliderClr *angleClr; - LinearBlurSliderClr *stepsClr; }; diff --git a/cinelerra-5.1/plugins/polar/polar.C b/cinelerra-5.1/plugins/polar/polar.C index 417afc71..25da0ea7 100644 --- a/cinelerra-5.1/plugins/polar/polar.C +++ b/cinelerra-5.1/plugins/polar/polar.C @@ -43,11 +43,19 @@ #define RESET_DEPTH 1 #define RESET_ANGLE 2 +#define DEPTH_MIN 1.00 +#define DEPTH_MAX 100.00 +#define ANGLE_MIN 1.00 +#define ANGLE_MAX 360.00 + + class PolarEffect; class PolarEngine; class PolarWindow; +class PolarFText; +class PolarFSlider; class PolarReset; -class PolarSliderClr; +class PolarClr; class PolarConfig @@ -73,22 +81,34 @@ public: -class PolarDepth : public BC_FSlider +class PolarFText : public BC_TumbleTextBox { public: - PolarDepth(PolarEffect *plugin, int x, int y); + PolarFText(PolarWindow *window, PolarEffect *plugin, + PolarFSlider *slider, float *output, int x, int y, float min, float max); + ~PolarFText(); int handle_event(); + PolarWindow *window; PolarEffect *plugin; + PolarFSlider *slider; + float *output; + float min, max; }; -class PolarAngle : public BC_FSlider +class PolarFSlider : public BC_FSlider { public: - PolarAngle(PolarEffect *plugin, int x, int y); + PolarFSlider(PolarEffect *plugin, + PolarFText *text, float *output, int x, int y, + float min, float max, int w); + ~PolarFSlider(); int handle_event(); PolarEffect *plugin; + PolarFText *text; + float *output; }; + class PolarReset : public BC_GenericButton { public: @@ -99,11 +119,11 @@ public: PolarWindow *window; }; -class PolarSliderClr : public BC_Button +class PolarClr : public BC_Button { public: - PolarSliderClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int w, int clear); - ~PolarSliderClr(); + PolarClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int clear); + ~PolarClr(); int handle_event(); PolarEffect *plugin; PolarWindow *window; @@ -117,11 +137,16 @@ public: void create_objects(); void update_gui(int clear); PolarEffect *plugin; - PolarDepth *depth; - PolarAngle *angle; + + PolarFText *depth_text; + PolarFSlider *depth_slider; + PolarClr *depth_Clr; + + PolarFText *angle_text; + PolarFSlider *angle_slider; + PolarClr *angle_Clr; + PolarReset *reset; - PolarSliderClr *depthClr; - PolarSliderClr *angleClr; }; @@ -235,10 +260,10 @@ void PolarConfig::interpolate(PolarConfig &prev, PolarWindow::PolarWindow(PolarEffect *plugin) : PluginClientWindow(plugin, - xS(330), - yS(122), - xS(330), - yS(122), + xS(420), + yS(130), + xS(420), + yS(130), 0) { this->plugin = plugin; @@ -246,21 +271,41 @@ PolarWindow::PolarWindow(PolarEffect *plugin) void PolarWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50); - int ys10 = yS(10), ys40 = yS(40); - int x = xs10, y = ys10, x1 = x + xs50; - int x2 = 0; int clrBtn_w = xs50; + int xs10 = xS(10), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 + BC_Bar *bar; + + y += ys10; add_subwindow(new BC_Title(x, y, _("Depth:"))); - add_subwindow(depth = new PolarDepth(plugin, x1, y)); - x2 = x1 + depth->get_w() + xs10; - add_subwindow(depthClr = new PolarSliderClr(plugin, this, x2, y, clrBtn_w, RESET_DEPTH)); + depth_text = new PolarFText(this, plugin, + 0, &plugin->config.depth, (x + x2), y, DEPTH_MIN, DEPTH_MAX); + depth_text->create_objects(); + depth_slider = new PolarFSlider(plugin, + depth_text, &plugin->config.depth, x3, y, DEPTH_MIN, DEPTH_MAX, xs200); + add_subwindow(depth_slider); + depth_text->slider = depth_slider; + clr_x = x3 + depth_slider->get_w() + x; + add_subwindow(depth_Clr = new PolarClr(plugin, this, clr_x, y, RESET_DEPTH)); + y += ys30; - y += ys40; add_subwindow(new BC_Title(x, y, _("Angle:"))); - add_subwindow(angle = new PolarAngle(plugin, x1, y)); - add_subwindow(angleClr = new PolarSliderClr(plugin, this, x2, y, clrBtn_w, RESET_ANGLE)); + angle_text = new PolarFText(this, plugin, + 0, &plugin->config.angle, (x + x2), y, ANGLE_MIN, ANGLE_MAX); + angle_text->create_objects(); + angle_slider = new PolarFSlider(plugin, + angle_text, &plugin->config.angle, x3, y, ANGLE_MIN, ANGLE_MAX, xs200); + add_subwindow(angle_slider); + angle_text->slider = angle_slider; + add_subwindow(angle_Clr = new PolarClr(plugin, this, clr_x, y, RESET_ANGLE)); y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new PolarReset(plugin, this, x, y)); show_window(); @@ -271,14 +316,20 @@ void PolarWindow::create_objects() void PolarWindow::update_gui(int clear) { switch(clear) { - case RESET_DEPTH : depth->update(plugin->config.depth); + case RESET_DEPTH : + depth_text->update(plugin->config.depth); + depth_slider->update(plugin->config.depth); break; - case RESET_ANGLE : angle->update(plugin->config.angle); + case RESET_ANGLE : + angle_text->update(plugin->config.angle); + angle_slider->update(plugin->config.angle); break; case RESET_ALL : default: - depth->update(plugin->config.depth); - angle->update(plugin->config.angle); + depth_text->update(plugin->config.depth); + depth_slider->update(plugin->config.depth); + angle_text->update(plugin->config.angle); + angle_slider->update(plugin->config.angle); break; } } @@ -287,50 +338,58 @@ void PolarWindow::update_gui(int clear) -PolarDepth::PolarDepth(PolarEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)1, - (float)100, - plugin->config.depth) +PolarFText::PolarFText(PolarWindow *window, PolarEffect *plugin, + PolarFSlider *slider, float *output, int x, int y, float min, float max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 2) { + this->window = window; this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(0.1); } -int PolarDepth::handle_event() + +PolarFText::~PolarFText() { - plugin->config.depth = get_value(); +} + +int PolarFText::handle_event() +{ + *output = atof(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); plugin->send_configure_change(); return 1; } - - - -PolarAngle::PolarAngle(PolarEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)1, - (float)360, - plugin->config.angle) +PolarFSlider::PolarFSlider(PolarEffect *plugin, + PolarFText *text, float *output, int x, int y, float min, float max, int w) + : BC_FSlider(x, y, 0, w, w, min, max, *output) { this->plugin = plugin; + this->output = output; + this->text = text; + enable_show_value(0); // Hide caption +} + +PolarFSlider::~PolarFSlider() +{ } -int PolarAngle::handle_event() + +int PolarFSlider::handle_event() { - plugin->config.angle = get_value(); + *output = get_value(); + text->update(*output); plugin->send_configure_change(); return 1; } - PolarReset::PolarReset(PolarEffect *plugin, PolarWindow *window, int x, int y) : BC_GenericButton(x, y, _("Reset")) { @@ -349,17 +408,17 @@ int PolarReset::handle_event() } -PolarSliderClr::PolarSliderClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +PolarClr::PolarClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->window = window; this->clear = clear; } -PolarSliderClr::~PolarSliderClr() +PolarClr::~PolarClr() { } -int PolarSliderClr::handle_event() +int PolarClr::handle_event() { // clear==1 ==> Depth slider // clear==2 ==> Angle slider @@ -404,8 +463,10 @@ void PolarEffect::update_gui() { load_configuration(); thread->window->lock_window(); - ((PolarWindow*)thread->window)->angle->update(config.angle); - ((PolarWindow*)thread->window)->depth->update(config.depth); + ((PolarWindow*)thread->window)->angle_text->update(config.angle); + ((PolarWindow*)thread->window)->angle_slider->update(config.angle); + ((PolarWindow*)thread->window)->depth_text->update(config.depth); + ((PolarWindow*)thread->window)->depth_slider->update(config.depth); thread->window->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/radialblur/radialblur.C b/cinelerra-5.1/plugins/radialblur/radialblur.C index 7524a9fd..d2e5fac6 100644 --- a/cinelerra-5.1/plugins/radialblur/radialblur.C +++ b/cinelerra-5.1/plugins/radialblur/radialblur.C @@ -38,8 +38,8 @@ void RadialBlurConfig::reset(int clear) { switch(clear) { case RESET_ALL : - x = xS(50); - y = yS(50); + x = 50; + y = 50; angle = 0; steps = 1; r = 1; @@ -47,9 +47,9 @@ void RadialBlurConfig::reset(int clear) b = 1; a = 1; break; - case RESET_XSLIDER : x = xS(50); + case RESET_XSLIDER : x = 50; break; - case RESET_YSLIDER : y = yS(50); + case RESET_YSLIDER : y = 50; break; case RESET_ANGLE : angle = 0; break; @@ -57,8 +57,8 @@ void RadialBlurConfig::reset(int clear) break; case RESET_DEFAULT_SETTINGS : default: - x = xS(50); - y = yS(50); + x = 50; + y = 50; angle = 33; steps = 10; r = 1; @@ -126,10 +126,10 @@ void RadialBlurConfig::interpolate(RadialBlurConfig &prev, RadialBlurWindow::RadialBlurWindow(RadialBlurMain *plugin) : PluginClientWindow(plugin, - xS(250), - yS(380), - xS(250), - yS(380), + xS(420), + yS(230), + xS(420), + yS(230), 0) { this->plugin = plugin; @@ -141,48 +141,80 @@ RadialBlurWindow::~RadialBlurWindow() void RadialBlurWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100); - int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(45); + int xs10 = xS(10), xs100 = xS(100), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); int x = xs10, y = ys10; - int x1 = 0; int clrBtn_w = xs50; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; - add_subwindow(new BC_Title(x, y, _("X:"))); - y += ys20; - add_subwindow(this->x = new RadialBlurSize(plugin, x, y, &plugin->config.x, 0, 100)); - x1 = x + this->x->get_w() + xs10; - add_subwindow(xClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_XSLIDER)); + BC_Bar *bar; + y += ys10; + add_subwindow(new BC_Title(x, y, _("X:"))); + x_text = new RadialBlurIText(this, plugin, + 0, &plugin->config.x, (x + x2), y, XY_MIN, XY_MAX); + x_text->create_objects(); + x_slider = new RadialBlurISlider(plugin, + x_text, &plugin->config.x, x3, y, XY_MIN, XY_MAX, xs200); + add_subwindow(x_slider); + x_text->slider = x_slider; + clr_x = x3 + x_slider->get_w() + x; + add_subwindow(x_Clr = new RadialBlurClr(plugin, this, clr_x, y, RESET_XSLIDER)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Y:"))); - y += ys20; - add_subwindow(this->y = new RadialBlurSize(plugin, x, y, &plugin->config.y, 0, 100)); - add_subwindow(yClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_YSLIDER)); + add_subwindow(new BC_Title(x, y, _("Y:"))); + y_text = new RadialBlurIText(this, plugin, + 0, &plugin->config.y, (x + x2), y, XY_MIN, XY_MAX); + y_text->create_objects(); + y_slider = new RadialBlurISlider(plugin, + y_text, &plugin->config.y, x3, y, XY_MIN, XY_MAX, xs200); + add_subwindow(y_slider); + y_text->slider = y_slider; + add_subwindow(y_Clr = new RadialBlurClr(plugin, this, clr_x, y, RESET_YSLIDER)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Angle:"))); - y += ys20; - add_subwindow(angle = new RadialBlurSize(plugin, x, y, &plugin->config.angle, 0, 360)); - add_subwindow(angleClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ANGLE)); + add_subwindow(new BC_Title(x, y, _("Angle:"))); + angle_text = new RadialBlurIText(this, plugin, + 0, &plugin->config.angle, (x + x2), y, ANGLE_MIN, ANGLE_MAX); + angle_text->create_objects(); + angle_slider = new RadialBlurISlider(plugin, + angle_text, &plugin->config.angle, x3, y, ANGLE_MIN, ANGLE_MAX, xs200); + add_subwindow(angle_slider); + angle_text->slider = angle_slider; + add_subwindow(angle_Clr = new RadialBlurClr(plugin, this, clr_x, y, RESET_ANGLE)); y += ys30; + add_subwindow(new BC_Title(x, y, _("Steps:"))); - y += ys20; - add_subwindow(steps = new RadialBlurSize(plugin, x, y, &plugin->config.steps, 1, 100)); - add_subwindow(stepsClr = new RadialBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_STEPS)); + steps_text = new RadialBlurIText(this, plugin, + 0, &plugin->config.steps, (x + x2), y, STEPS_MIN, STEPS_MAX); + steps_text->create_objects(); + steps_slider = new RadialBlurISlider(plugin, + steps_text, &plugin->config.steps, x3, y, STEPS_MIN, STEPS_MAX, xs200); + add_subwindow(steps_slider); + steps_text->slider = steps_slider; + add_subwindow(steps_Clr = new RadialBlurClr(plugin, this, clr_x, y, RESET_STEPS)); + y += ys40; + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; + int x1 = x; + int toggle_w = (get_w()-2*x) / 4; + add_subwindow(r = new RadialBlurToggle(plugin, x1, y, &plugin->config.r, _("Red"))); + x1 += toggle_w; + add_subwindow(g = new RadialBlurToggle(plugin, x1, y, &plugin->config.g, _("Green"))); + x1 += toggle_w; + add_subwindow(b = new RadialBlurToggle(plugin, x1, y, &plugin->config.b, _("Blue"))); + x1 += toggle_w; + add_subwindow(a = new RadialBlurToggle(plugin, x1, y, &plugin->config.a, _("Alpha"))); y += ys30; - add_subwindow(r = new RadialBlurToggle(plugin, x, y, &plugin->config.r, _("Red"))); - y += ys30; - add_subwindow(g = new RadialBlurToggle(plugin, x, y, &plugin->config.g, _("Green"))); - y += ys30; - add_subwindow(b = new RadialBlurToggle(plugin, x, y, &plugin->config.b, _("Blue"))); - y += ys30; - add_subwindow(a = new RadialBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha"))); - y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new RadialBlurReset(plugin, this, x, y)); add_subwindow(default_settings = new RadialBlurDefaultSettings(plugin, this, - (xS(250) - xS(10) - defaultBtn_w), y, defaultBtn_w)); + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -192,21 +224,33 @@ void RadialBlurWindow::create_objects() void RadialBlurWindow::update_gui(int clear) { switch(clear) { - case RESET_XSLIDER : this->x->update(plugin->config.x); + case RESET_XSLIDER : + x_text->update((int64_t)plugin->config.x); + x_slider->update(plugin->config.x); break; - case RESET_YSLIDER : this->y->update(plugin->config.y); + case RESET_YSLIDER : + y_text->update((int64_t)plugin->config.y); + y_slider->update(plugin->config.y); break; - case RESET_ANGLE : angle->update(plugin->config.angle); + case RESET_ANGLE : + angle_text->update((int64_t)plugin->config.angle); + angle_slider->update(plugin->config.angle); break; - case RESET_STEPS : steps->update(plugin->config.steps); + case RESET_STEPS : + steps_text->update((int64_t)plugin->config.steps); + steps_slider->update(plugin->config.steps); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: - this->x->update(plugin->config.x); - this->y->update(plugin->config.y); - angle->update(plugin->config.angle); - steps->update(plugin->config.steps); + x_text->update((int64_t)plugin->config.x); + x_slider->update(plugin->config.x); + y_text->update((int64_t)plugin->config.y); + y_slider->update(plugin->config.y); + angle_text->update((int64_t)plugin->config.angle); + angle_slider->update(plugin->config.angle); + steps_text->update((int64_t)plugin->config.steps); + steps_slider->update(plugin->config.steps); r->update(plugin->config.r); g->update(plugin->config.g); b->update(plugin->config.b); @@ -242,35 +286,58 @@ int RadialBlurToggle::handle_event() } +RadialBlurIText::RadialBlurIText(RadialBlurWindow *gui, RadialBlurMain *plugin, + RadialBlurISlider *slider, int *output, int x, int y, int min, int max) + : BC_TumbleTextBox(gui, *output, + min, max, x, y, xS(60), 0) +{ + this->gui = gui; + this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(1); +} +RadialBlurIText::~RadialBlurIText() +{ +} +int RadialBlurIText::handle_event() +{ + *output = atoi(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); + plugin->send_configure_change(); + return 1; +} - -RadialBlurSize::RadialBlurSize(RadialBlurMain *plugin, - int x, - int y, - int *output, - int min, - int max) - : BC_ISlider(x, y, 0, xS(200), yS(200), min, max, *output) +RadialBlurISlider::RadialBlurISlider(RadialBlurMain *plugin, + RadialBlurIText *text, int *output, int x, int y, int min, int max, int w) + : BC_ISlider(x, y, 0, w, w, min, max, *output) { this->plugin = plugin; this->output = output; + this->text = text; + enable_show_value(0); // Hide caption } -int RadialBlurSize::handle_event() + +RadialBlurISlider::~RadialBlurISlider() +{ +} + +int RadialBlurISlider::handle_event() { *output = get_value(); + text->update((int64_t)*output); plugin->send_configure_change(); return 1; } - - - - - RadialBlurReset::RadialBlurReset(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y) : BC_GenericButton(x, y, _("Reset")) { @@ -307,17 +374,17 @@ int RadialBlurDefaultSettings::handle_event() } -RadialBlurSliderClr::RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +RadialBlurClr::RadialBlurClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->gui = gui; this->clear = clear; } -RadialBlurSliderClr::~RadialBlurSliderClr() +RadialBlurClr::~RadialBlurClr() { } -int RadialBlurSliderClr::handle_event() +int RadialBlurClr::handle_event() { // clear==1 ==> X slider // clear==2 ==> Y slider @@ -399,10 +466,15 @@ void RadialBlurMain::update_gui() { load_configuration(); thread->window->lock_window(); - ((RadialBlurWindow*)thread->window)->x->update(config.x); - ((RadialBlurWindow*)thread->window)->y->update(config.y); - ((RadialBlurWindow*)thread->window)->angle->update(config.angle); - ((RadialBlurWindow*)thread->window)->steps->update(config.steps); + ((RadialBlurWindow*)thread->window)->x_text->update((int64_t)config.x); + ((RadialBlurWindow*)thread->window)->x_slider->update(config.x); + ((RadialBlurWindow*)thread->window)->y_text->update((int64_t)config.y); + ((RadialBlurWindow*)thread->window)->y_slider->update(config.y); + ((RadialBlurWindow*)thread->window)->angle_text->update((int64_t)config.angle); + ((RadialBlurWindow*)thread->window)->angle_slider->update(config.angle); + ((RadialBlurWindow*)thread->window)->steps_text->update((int64_t)config.steps); + ((RadialBlurWindow*)thread->window)->steps_slider->update(config.steps); + ((RadialBlurWindow*)thread->window)->r->update(config.r); ((RadialBlurWindow*)thread->window)->g->update(config.g); ((RadialBlurWindow*)thread->window)->b->update(config.b); diff --git a/cinelerra-5.1/plugins/radialblur/radialblur.h b/cinelerra-5.1/plugins/radialblur/radialblur.h index 368c0e0c..11b1c183 100644 --- a/cinelerra-5.1/plugins/radialblur/radialblur.h +++ b/cinelerra-5.1/plugins/radialblur/radialblur.h @@ -47,12 +47,23 @@ #define RESET_ANGLE 3 #define RESET_STEPS 4 +#define XY_MIN 0 +#define XY_MAX 100 +#define ANGLE_MIN 0 +#define ANGLE_MAX 360 +#define STEPS_MIN 1 +#define STEPS_MAX 100 + class RadialBlurMain; class RadialBlurWindow; class RadialBlurEngine; +class RadialBlurIText; +class RadialBlurISlider; +class RadialBlurToggle; class RadialBlurReset; class RadialBlurDefaultSettings; -class RadialBlurSliderClr; +class RadialBlurClr; + @@ -81,18 +92,30 @@ public: }; +class RadialBlurIText : public BC_TumbleTextBox +{ +public: + RadialBlurIText(RadialBlurWindow *gui, RadialBlurMain *plugin, + RadialBlurISlider *slider, int *output, int x, int y, int min, int max); + ~RadialBlurIText(); + int handle_event(); + RadialBlurWindow *gui; + RadialBlurMain *plugin; + RadialBlurISlider *slider; + int *output; + int min, max; +}; -class RadialBlurSize : public BC_ISlider +class RadialBlurISlider : public BC_ISlider { public: - RadialBlurSize(RadialBlurMain *plugin, - int x, - int y, - int *output, - int min, - int max); + RadialBlurISlider(RadialBlurMain *plugin, + RadialBlurIText *text, int *output, int x, int y, + int min, int max, int w); + ~RadialBlurISlider(); int handle_event(); RadialBlurMain *plugin; + RadialBlurIText *text; int *output; }; @@ -129,11 +152,11 @@ public: RadialBlurWindow *gui; }; -class RadialBlurSliderClr : public BC_Button +class RadialBlurClr : public BC_Button { public: - RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear); - ~RadialBlurSliderClr(); + RadialBlurClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int clear); + ~RadialBlurClr(); int handle_event(); RadialBlurMain *plugin; RadialBlurWindow *gui; @@ -149,15 +172,27 @@ public: void create_objects(); void update_gui(int clear); - RadialBlurSize *x, *y, *steps, *angle; + + RadialBlurIText *x_text; + RadialBlurISlider *x_slider; + RadialBlurClr *x_Clr; + + RadialBlurIText *y_text; + RadialBlurISlider *y_slider; + RadialBlurClr *y_Clr; + + RadialBlurIText *angle_text; + RadialBlurISlider *angle_slider; + RadialBlurClr *angle_Clr; + + RadialBlurIText *steps_text; + RadialBlurISlider *steps_slider; + RadialBlurClr *steps_Clr; + RadialBlurToggle *r, *g, *b, *a; RadialBlurMain *plugin; RadialBlurReset *reset; RadialBlurDefaultSettings *default_settings; - RadialBlurSliderClr *xClr; - RadialBlurSliderClr *yClr; - RadialBlurSliderClr *angleClr; - RadialBlurSliderClr *stepsClr; }; diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.C b/cinelerra-5.1/plugins/rgbshift/rgbshift.C index 95d12058..ebdd96a5 100644 --- a/cinelerra-5.1/plugins/rgbshift/rgbshift.C +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.C @@ -94,18 +94,48 @@ void RGBShiftConfig::interpolate(RGBShiftConfig &prev, -#define MAXVALUE 100 -RGBShiftLevel::RGBShiftLevel(RGBShiftEffect *plugin, int *output, int x, int y) - : BC_ISlider(x, y, 0, xS(200), yS(200), -MAXVALUE, MAXVALUE, *output) +RGBShiftIText::RGBShiftIText(RGBShiftWindow *window, RGBShiftEffect *plugin, + RGBShiftISlider *slider, int *output, int x, int y, int min, int max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 0) +{ + this->window = window; + this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(1); +} + +RGBShiftIText::~RGBShiftIText() +{ +} + +int RGBShiftIText::handle_event() +{ + *output = atoi(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); + plugin->send_configure_change(); + return 1; +} + +RGBShiftISlider::RGBShiftISlider(RGBShiftEffect *plugin, RGBShiftIText *text, int *output, int x, int y) + : BC_ISlider(x, y, 0, xS(200), xS(200), -MAXVALUE, MAXVALUE, *output) { this->plugin = plugin; this->output = output; + this->text = text; + enable_show_value(0); // Hide caption } -int RGBShiftLevel::handle_event() +int RGBShiftISlider::handle_event() { *output = get_value(); + text->update((int64_t)*output); plugin->send_configure_change(); return 1; } @@ -129,17 +159,17 @@ int RGBShiftReset::handle_event() } -RGBShiftSliderClr::RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +RGBShiftClr::RGBShiftClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->window = window; this->clear = clear; } -RGBShiftSliderClr::~RGBShiftSliderClr() +RGBShiftClr::~RGBShiftClr() { } -int RGBShiftSliderClr::handle_event() +int RGBShiftClr::handle_event() { // clear==1 ==> r_dx slider --- clear==2 ==> r_dy slider // clear==3 ==> g_dx slider --- clear==4 ==> g_dy slider @@ -152,49 +182,92 @@ int RGBShiftSliderClr::handle_event() RGBShiftWindow::RGBShiftWindow(RGBShiftEffect *plugin) - : PluginClientWindow(plugin, xS(320), yS(230), xS(320), yS(230), 0) + : PluginClientWindow(plugin, xS(420), yS(250), xS(420), yS(250), 0) { this->plugin = plugin; } void RGBShiftWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50); + int xs10 = xS(10); int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); - int x = xs10, y = ys10, x1 = xs50; - int x2 = 0; int clrBtn_w = xs50; + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 - add_subwindow(new BC_Title(x, y, _("R_dx:"))); - add_subwindow(r_dx = new RGBShiftLevel(plugin, &plugin->config.r_dx, x1, y)); - x2 = x1 + r_dx->get_w() + xs10; - add_subwindow(r_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_R_DX)); + BC_Bar *bar; + y += ys10; + add_subwindow(new BC_Title(x, y, _("R_dx:"))); + r_dx_text = new RGBShiftIText(this, plugin, + 0, &plugin->config.r_dx, (x + x2), y, -MAXVALUE, MAXVALUE); + r_dx_text->create_objects(); + r_dx_slider = new RGBShiftISlider(plugin, + r_dx_text, &plugin->config.r_dx, x3, y); + add_subwindow(r_dx_slider); + r_dx_text->slider = r_dx_slider; + clr_x = x3 + r_dx_slider->get_w() + x; + add_subwindow(r_dx_Clr = new RGBShiftClr(plugin, this, clr_x, y, RESET_R_DX)); y += ys30; - add_subwindow(new BC_Title(x, y, _("R_dy:"))); - add_subwindow(r_dy = new RGBShiftLevel(plugin, &plugin->config.r_dy, x1, y)); - add_subwindow(r_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_R_DY)); + add_subwindow(new BC_Title(x, y, _("R_dy:"))); + r_dy_text = new RGBShiftIText(this, plugin, + 0, &plugin->config.r_dy, (x + x2), y, -MAXVALUE, MAXVALUE); + r_dy_text->create_objects(); + r_dy_slider = new RGBShiftISlider(plugin, + r_dy_text, &plugin->config.r_dy, x3, y); + add_subwindow(r_dy_slider); + r_dy_text->slider = r_dy_slider; + add_subwindow(r_dy_Clr = new RGBShiftClr(plugin, this, clr_x, y, RESET_R_DY)); y += ys30; - add_subwindow(new BC_Title(x, y, _("G_dx:"))); - add_subwindow(g_dx = new RGBShiftLevel(plugin, &plugin->config.g_dx, x1, y)); - add_subwindow(g_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_G_DX)); + add_subwindow(new BC_Title(x, y, _("G_dx:"))); + g_dx_text = new RGBShiftIText(this, plugin, + 0, &plugin->config.g_dx, (x + x2), y, -MAXVALUE, MAXVALUE); + g_dx_text->create_objects(); + g_dx_slider = new RGBShiftISlider(plugin, + g_dx_text, &plugin->config.g_dx, x3, y); + add_subwindow(g_dx_slider); + g_dx_text->slider = g_dx_slider; + add_subwindow(g_dx_Clr = new RGBShiftClr(plugin, this, clr_x, y, RESET_G_DX)); y += ys30; - add_subwindow(new BC_Title(x, y, _("G_dy:"))); - add_subwindow(g_dy = new RGBShiftLevel(plugin, &plugin->config.g_dy, x1, y)); - add_subwindow(g_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_G_DY)); + add_subwindow(new BC_Title(x, y, _("G_dy:"))); + g_dy_text = new RGBShiftIText(this, plugin, + 0, &plugin->config.g_dy, (x + x2), y, -MAXVALUE, MAXVALUE); + g_dy_text->create_objects(); + g_dy_slider = new RGBShiftISlider(plugin, + g_dy_text, &plugin->config.g_dy, x3, y); + add_subwindow(g_dy_slider); + g_dy_text->slider = g_dy_slider; + add_subwindow(g_dy_Clr = new RGBShiftClr(plugin, this, clr_x, y, RESET_G_DY)); y += ys30; - add_subwindow(new BC_Title(x, y, _("B_dx:"))); - add_subwindow(b_dx = new RGBShiftLevel(plugin, &plugin->config.b_dx, x1, y)); - add_subwindow(b_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_B_DX)); + add_subwindow(new BC_Title(x, y, _("B_dx:"))); + b_dx_text = new RGBShiftIText(this, plugin, + 0, &plugin->config.b_dx, (x + x2), y, -MAXVALUE, MAXVALUE); + b_dx_text->create_objects(); + b_dx_slider = new RGBShiftISlider(plugin, + b_dx_text, &plugin->config.b_dx, x3, y); + add_subwindow(b_dx_slider); + b_dx_text->slider = b_dx_slider; + add_subwindow(b_dx_Clr = new RGBShiftClr(plugin, this, clr_x, y, RESET_B_DX)); y += ys30; - add_subwindow(new BC_Title(x, y, _("B_dy:"))); - add_subwindow(b_dy = new RGBShiftLevel(plugin, &plugin->config.b_dy, x1, y)); - add_subwindow(b_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_B_DY)); + add_subwindow(new BC_Title(x, y, _("B_dy:"))); + b_dy_text = new RGBShiftIText(this, plugin, + 0, &plugin->config.b_dy, (x + x2), y, -MAXVALUE, MAXVALUE); + b_dy_text->create_objects(); + b_dy_slider = new RGBShiftISlider(plugin, + b_dy_text, &plugin->config.b_dy, x3, y); + add_subwindow(b_dy_slider); + b_dy_text->slider = b_dy_slider; + add_subwindow(b_dy_Clr = new RGBShiftClr(plugin, this, clr_x, y, RESET_B_DY)); y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new RGBShiftReset(plugin, this, x, y)); show_window(); @@ -206,26 +279,44 @@ void RGBShiftWindow::create_objects() void RGBShiftWindow::update_gui(int clear) { switch(clear) { - case RESET_R_DX : r_dx->update(plugin->config.r_dx); + case RESET_R_DX : + r_dx_text->update((int64_t)plugin->config.r_dx); + r_dx_slider->update(plugin->config.r_dx); break; - case RESET_R_DY : r_dy->update(plugin->config.r_dy); + case RESET_R_DY : + r_dy_text->update((int64_t)plugin->config.r_dy); + r_dy_slider->update(plugin->config.r_dy); break; - case RESET_G_DX : g_dx->update(plugin->config.g_dx); + case RESET_G_DX : + g_dx_text->update((int64_t)plugin->config.g_dx); + g_dx_slider->update(plugin->config.g_dx); break; - case RESET_G_DY : g_dy->update(plugin->config.g_dy); + case RESET_G_DY : + g_dy_text->update((int64_t)plugin->config.g_dy); + g_dy_slider->update(plugin->config.g_dy); break; - case RESET_B_DX : b_dx->update(plugin->config.b_dx); + case RESET_B_DX : + b_dx_text->update((int64_t)plugin->config.b_dx); + b_dx_slider->update(plugin->config.b_dx); break; - case RESET_B_DY : b_dy->update(plugin->config.b_dy); + case RESET_B_DY : + b_dy_text->update((int64_t)plugin->config.b_dy); + b_dy_slider->update(plugin->config.b_dy); break; case RESET_ALL : default: - r_dx->update(plugin->config.r_dx); - r_dy->update(plugin->config.r_dy); - g_dx->update(plugin->config.g_dx); - g_dy->update(plugin->config.g_dy); - b_dx->update(plugin->config.b_dx); - b_dy->update(plugin->config.b_dy); + r_dx_text->update((int64_t)plugin->config.r_dx); + r_dx_slider->update(plugin->config.r_dx); + r_dy_text->update((int64_t)plugin->config.r_dy); + r_dy_slider->update(plugin->config.r_dy); + g_dx_text->update((int64_t)plugin->config.g_dx); + g_dx_slider->update(plugin->config.g_dx); + g_dy_text->update((int64_t)plugin->config.g_dy); + g_dy_slider->update(plugin->config.g_dy); + b_dx_text->update((int64_t)plugin->config.b_dx); + b_dx_slider->update(plugin->config.b_dx); + b_dy_text->update((int64_t)plugin->config.b_dy); + b_dy_slider->update(plugin->config.b_dy); break; } } @@ -259,12 +350,18 @@ void RGBShiftEffect::update_gui() RGBShiftWindow *yuv_wdw = (RGBShiftWindow*)thread->window; yuv_wdw->lock_window("RGBShiftEffect::update_gui"); load_configuration(); - yuv_wdw->r_dx->update(config.r_dx); - yuv_wdw->r_dy->update(config.r_dy); - yuv_wdw->g_dx->update(config.g_dx); - yuv_wdw->g_dy->update(config.g_dy); - yuv_wdw->b_dx->update(config.b_dx); - yuv_wdw->b_dy->update(config.b_dy); + yuv_wdw->r_dx_text->update((int64_t)config.r_dx); + yuv_wdw->r_dx_slider->update(config.r_dx); + yuv_wdw->r_dy_text->update((int64_t)config.r_dy); + yuv_wdw->r_dy_slider->update(config.r_dy); + yuv_wdw->g_dx_text->update((int64_t)config.g_dx); + yuv_wdw->g_dx_slider->update(config.g_dx); + yuv_wdw->g_dy_text->update((int64_t)config.g_dy); + yuv_wdw->g_dy_slider->update(config.g_dy); + yuv_wdw->b_dx_text->update((int64_t)config.b_dx); + yuv_wdw->b_dx_slider->update(config.b_dx); + yuv_wdw->b_dy_text->update((int64_t)config.b_dy); + yuv_wdw->b_dy_slider->update(config.b_dy); yuv_wdw->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.h b/cinelerra-5.1/plugins/rgbshift/rgbshift.h index 4d71e6a8..75fc0d79 100644 --- a/cinelerra-5.1/plugins/rgbshift/rgbshift.h +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.h @@ -37,6 +37,8 @@ #include #include +#define MAXVALUE 100 + #define RESET_ALL 0 #define RESET_R_DX 1 #define RESET_R_DY 2 @@ -47,8 +49,10 @@ class RGBShiftEffect; class RGBShiftWindow; +class RGBShiftIText; +class RGBShiftISlider; class RGBShiftReset; -class RGBShiftSliderClr; +class RGBShiftClr; class RGBShiftConfig @@ -68,12 +72,27 @@ public: int r_dx, r_dy, g_dx, g_dy, b_dx, b_dy; }; -class RGBShiftLevel : public BC_ISlider +class RGBShiftIText : public BC_TumbleTextBox { public: - RGBShiftLevel(RGBShiftEffect *plugin, int *output, int x, int y); + RGBShiftIText(RGBShiftWindow *window, RGBShiftEffect *plugin, + RGBShiftISlider *slider, int *output, int x, int y, int min, int max); + ~RGBShiftIText(); int handle_event(); + RGBShiftWindow *window; RGBShiftEffect *plugin; + RGBShiftISlider *slider; + int *output; + int min, max; +}; + +class RGBShiftISlider : public BC_ISlider +{ +public: + RGBShiftISlider(RGBShiftEffect *plugin, RGBShiftIText *text, int *output, int x, int y); + int handle_event(); + RGBShiftEffect *plugin; + RGBShiftIText *text; int *output; }; @@ -87,11 +106,11 @@ public: RGBShiftWindow *window; }; -class RGBShiftSliderClr : public BC_Button +class RGBShiftClr : public BC_Button { public: - RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear); - ~RGBShiftSliderClr(); + RGBShiftClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int clear); + ~RGBShiftClr(); int handle_event(); RGBShiftEffect *plugin; RGBShiftWindow *window; @@ -104,12 +123,30 @@ public: RGBShiftWindow(RGBShiftEffect *plugin); void create_objects(); void update_gui(int clear); - RGBShiftLevel *r_dx, *r_dy, *g_dx, *g_dy, *b_dx, *b_dy; + + RGBShiftIText *r_dx_text; + RGBShiftISlider *r_dx_slider; + RGBShiftClr *r_dx_Clr; + RGBShiftIText *r_dy_text; + RGBShiftISlider *r_dy_slider; + RGBShiftClr *r_dy_Clr; + + RGBShiftIText *g_dx_text; + RGBShiftISlider *g_dx_slider; + RGBShiftClr *g_dx_Clr; + RGBShiftIText *g_dy_text; + RGBShiftISlider *g_dy_slider; + RGBShiftClr *g_dy_Clr; + + RGBShiftIText *b_dx_text; + RGBShiftISlider *b_dx_slider; + RGBShiftClr *b_dx_Clr; + RGBShiftIText *b_dy_text; + RGBShiftISlider *b_dy_slider; + RGBShiftClr *b_dy_Clr; + RGBShiftEffect *plugin; RGBShiftReset *reset; - RGBShiftSliderClr *r_dxClr, *r_dyClr; - RGBShiftSliderClr *g_dxClr, *g_dyClr; - RGBShiftSliderClr *b_dxClr, *b_dyClr; }; diff --git a/cinelerra-5.1/plugins/sharpen/sharpen.C b/cinelerra-5.1/plugins/sharpen/sharpen.C index fc5777f8..43185298 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpen.C +++ b/cinelerra-5.1/plugins/sharpen/sharpen.C @@ -52,7 +52,7 @@ void SharpenConfig::reset(int clear) horizontal = 0; luminance = 0; break; - case RESET_SHARPEN_SLIDER : sharpness = 0; + case RESET_SHARPEN : sharpness = 0; break; case RESET_DEFAULT_SETTINGS : default: diff --git a/cinelerra-5.1/plugins/sharpen/sharpenwindow.C b/cinelerra-5.1/plugins/sharpen/sharpenwindow.C index 61ab6b50..dfaaa0a6 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpenwindow.C +++ b/cinelerra-5.1/plugins/sharpen/sharpenwindow.C @@ -33,7 +33,7 @@ SharpenWindow::SharpenWindow(SharpenMain *client) - : PluginClientWindow(client, xS(280), yS(190), xS(280), yS(190), 0) //195 was 150 + : PluginClientWindow(client, xS(420), yS(190), xS(420), yS(190), 0) { this->client = client; } @@ -44,17 +44,22 @@ SharpenWindow::~SharpenWindow() void SharpenWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100); - int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(40); + int xs10 = xS(10), xs100 = xS(100), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); int x = xs10, y = ys10; - int x1 = 0; int clrBtn_w = xs50; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; - add_tool(new BC_Title(x, y, _("Sharpness"))); - y += ys20; - add_tool(sharpen_slider = new SharpenSlider(client, &(client->config.sharpness), x, y)); - x1 = x + sharpen_slider->get_w() + xs10; - add_subwindow(sharpen_sliderClr = new SharpenSliderClr(client, this, x1, y, clrBtn_w)); + BC_Bar *bar; + + y += ys10; + add_tool(new BC_Title(x, y, _("Sharpness:"))); + sharpen_text = new SharpenText(client, this, (x + x2), y); + sharpen_text->create_objects(); + add_tool(sharpen_slider = new SharpenSlider(client, this, x3, y, xs200)); + clr_x = x3 + sharpen_slider->get_w() + x; + add_subwindow(sharpen_Clr = new SharpenClr(client, this, clr_x, y)); y += ys30; add_tool(sharpen_interlace = new SharpenInterlace(client, x, y)); @@ -63,9 +68,13 @@ void SharpenWindow::create_objects() y += ys30; add_tool(sharpen_luminance = new SharpenLuminance(client, x, y)); y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_tool(reset = new SharpenReset(client, this, x, y)); add_subwindow(default_settings = new SharpenDefaultSettings(client, this, - (xS(280) - xs10 - defaultBtn_w), y, defaultBtn_w)); + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -74,12 +83,14 @@ void SharpenWindow::create_objects() void SharpenWindow::update_gui(int clear) { switch(clear) { - case RESET_SHARPEN_SLIDER : + case RESET_SHARPEN : + sharpen_text->update((int64_t)client->config.sharpness); sharpen_slider->update(client->config.sharpness); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: + sharpen_text->update((int64_t)client->config.sharpness); sharpen_slider->update(client->config.sharpness); sharpen_interlace->update(client->config.interlace); sharpen_horizontal->update(client->config.horizontal); @@ -88,28 +99,46 @@ void SharpenWindow::update_gui(int clear) } } -SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y) - : BC_ISlider(x, - y, - 0, - xS(200), - yS(200), - 0, - MAXSHARPNESS, - (int)*output, - 0, - 0, - 0) +SharpenText::SharpenText(SharpenMain *client, SharpenWindow *gui, int x, int y) + : BC_TumbleTextBox(gui, client->config.sharpness, + 0, MAXSHARPNESS, x, y, xS(60), 0) { this->client = client; - this->output = output; + this->gui = gui; + set_increment(1); +} + +SharpenText::~SharpenText() +{ +} + +int SharpenText::handle_event() +{ + client->config.sharpness = atoi(get_text()); + if(client->config.sharpness > MAXSHARPNESS) + client->config.sharpness = MAXSHARPNESS; + else + if(client->config.sharpness < 0) client->config.sharpness = 0; + + gui->sharpen_slider->update((int64_t)client->config.sharpness); + client->send_configure_change(); + return 1; +} + +SharpenSlider::SharpenSlider(SharpenMain *client, SharpenWindow *gui, int x, int y, int w) + : BC_ISlider(x, y, 0, w, w, 0, MAXSHARPNESS, client->config.sharpness, 0, 0, 0) +{ + this->client = client; + this->gui = gui; + enable_show_value(0); // Hide caption } SharpenSlider::~SharpenSlider() { } int SharpenSlider::handle_event() { - *output = get_value(); + client->config.sharpness = get_value(); + gui->sharpen_text->update(client->config.sharpness); client->send_configure_change(); return 1; } @@ -199,19 +228,19 @@ int SharpenDefaultSettings::handle_event() } -SharpenSliderClr::SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w) - : BC_Button(x, y, w, client->get_theme()->get_image_set("reset_button")) +SharpenClr::SharpenClr(SharpenMain *client, SharpenWindow *gui, int x, int y) + : BC_Button(x, y, client->get_theme()->get_image_set("reset_button")) { this->client = client; this->gui = gui; } -SharpenSliderClr::~SharpenSliderClr() +SharpenClr::~SharpenClr() { } -int SharpenSliderClr::handle_event() +int SharpenClr::handle_event() { - client->config.reset(RESET_SHARPEN_SLIDER); - gui->update_gui(RESET_SHARPEN_SLIDER); + client->config.reset(RESET_SHARPEN); + gui->update_gui(RESET_SHARPEN); client->send_configure_change(); return 1; } diff --git a/cinelerra-5.1/plugins/sharpen/sharpenwindow.h b/cinelerra-5.1/plugins/sharpen/sharpenwindow.h index 6cc21706..7f37bbd7 100644 --- a/cinelerra-5.1/plugins/sharpen/sharpenwindow.h +++ b/cinelerra-5.1/plugins/sharpen/sharpenwindow.h @@ -30,16 +30,17 @@ #define RESET_DEFAULT_SETTINGS 10 #define RESET_ALL 0 -#define RESET_SHARPEN_SLIDER 1 +#define RESET_SHARPEN 1 class SharpenWindow; class SharpenInterlace; +class SharpenText; class SharpenSlider; class SharpenHorizontal; class SharpenLuminance; class SharpenReset; class SharpenDefaultSettings; -class SharpenSliderClr; +class SharpenClr; class SharpenWindow : public PluginClientWindow { @@ -51,24 +52,39 @@ public: void update_gui(int clear); SharpenMain *client; + + SharpenText *sharpen_text; SharpenSlider *sharpen_slider; + SharpenClr *sharpen_Clr; + SharpenInterlace *sharpen_interlace; SharpenHorizontal *sharpen_horizontal; SharpenLuminance *sharpen_luminance; + SharpenReset *reset; SharpenDefaultSettings *default_settings; - SharpenSliderClr *sharpen_sliderClr; +}; + +class SharpenText : public BC_TumbleTextBox +{ +public: + SharpenText(SharpenMain *client, SharpenWindow *gui, int x, int y); + ~SharpenText(); + int handle_event(); + + SharpenMain *client; + SharpenWindow *gui; }; class SharpenSlider : public BC_ISlider { public: - SharpenSlider(SharpenMain *client, float *output, int x, int y); + SharpenSlider(SharpenMain *client, SharpenWindow *gui, int x, int y, int w); ~SharpenSlider(); int handle_event(); + SharpenWindow *gui; SharpenMain *client; - float *output; }; class SharpenInterlace : public BC_CheckBox @@ -121,11 +137,11 @@ public: SharpenWindow *gui; }; -class SharpenSliderClr : public BC_Button +class SharpenClr : public BC_Button { public: - SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w); - ~SharpenSliderClr(); + SharpenClr(SharpenMain *client, SharpenWindow *gui, int x, int y); + ~SharpenClr(); int handle_event(); SharpenMain *client; SharpenWindow *gui; diff --git a/cinelerra-5.1/plugins/unsharp/unsharpwindow.C b/cinelerra-5.1/plugins/unsharp/unsharpwindow.C index 495eb82a..5039259a 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharpwindow.C +++ b/cinelerra-5.1/plugins/unsharp/unsharpwindow.C @@ -27,7 +27,7 @@ UnsharpWindow::UnsharpWindow(UnsharpMain *plugin) - : PluginClientWindow(plugin, xS(285), yS(170), xS(285), yS(170), 0) + : PluginClientWindow(plugin, xS(420), yS(160), xS(420), yS(160), 0) { this->plugin = plugin; } @@ -38,32 +38,52 @@ UnsharpWindow::~UnsharpWindow() void UnsharpWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs90 = xS(90), xs100 = xS(100); - int ys10 = yS(10), ys40 = yS(40), ys50 = yS(50); - int x = xs10, y = ys10, x1 = xs90; - int x2 = 0; int clrBtn_w = xs50; + int xs10 = xS(10), xs100 = xS(100), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; - BC_Title *title; - - add_subwindow(title = new BC_Title(x, y + ys10, _("Radius:"))); - add_subwindow(radius = new UnsharpRadius(plugin, x + x1, y)); - x2 = xS(285) - xs10 - clrBtn_w; - add_subwindow(radiusClr = new UnsharpSliderClr(plugin, this, x2, y + ys10, clrBtn_w, RESET_RADIUS)); - y += ys40; - add_subwindow(title = new BC_Title(x, y + ys10, _("Amount:"))); - add_subwindow(amount = new UnsharpAmount(plugin, x + x1, y)); - add_subwindow(amountClr = new UnsharpSliderClr(plugin, this, x2, y + ys10, clrBtn_w, RESET_AMOUNT)); + BC_Title *title; + BC_Bar *bar; +// Radius + y += ys10; + add_subwindow(title = new BC_Title(x, y, _("Radius:"))); + radius_text = new UnsharpRadiusText(this, plugin, (x + x2), y); + radius_text->create_objects(); + radius_slider = new UnsharpRadiusSlider(this, plugin, x3, y, xs200); + add_subwindow(radius_slider); + clr_x = x3 + radius_slider->get_w() + x; + add_subwindow(radius_clr = new UnsharpClr(this, plugin, + clr_x, y, RESET_RADIUS)); + y += ys30; +// Amount + add_subwindow(title = new BC_Title(x, y, _("Amount:"))); + amount_text = new UnsharpAmountText(this, plugin, (x + x2), y); + amount_text->create_objects(); + amount_slider = new UnsharpAmountSlider(this, plugin, x3, y, xs200); + add_subwindow(amount_slider); + add_subwindow(amount_clr = new UnsharpClr(this, plugin, + clr_x, y, RESET_AMOUNT)); + y += ys30; +// Threshold + add_subwindow(title = new BC_Title(x, y, _("Threshold:"))); + threshold_text = new UnsharpThresholdText(this, plugin, (x + x2), y); + threshold_text->create_objects(); + threshold_slider = new UnsharpThresholdSlider(this, plugin, x3, y, xs200); + add_subwindow(threshold_slider); + add_subwindow(threshold_clr = new UnsharpClr(this, plugin, + clr_x, y, RESET_THRESHOLD)); y += ys40; - add_subwindow(title = new BC_Title(x, y + ys10, _("Threshold:"))); - add_subwindow(threshold = new UnsharpThreshold(plugin, x + x1, y)); - add_subwindow(thresholdClr = new UnsharpSliderClr(plugin, this, x2, y + ys10, clrBtn_w, RESET_THRESHOLD)); - y += ys50; - add_subwindow(reset = new UnsharpReset(plugin, this, x, y)); - add_subwindow(default_settings = new UnsharpDefaultSettings(plugin, this, - (xS(285) - xs10 - defaultBtn_w), y, defaultBtn_w)); +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; + add_subwindow(reset = new UnsharpReset(this, plugin, x, y)); + add_subwindow(default_settings = new UnsharpDefaultSettings(this,plugin, + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -73,68 +93,189 @@ void UnsharpWindow::create_objects() void UnsharpWindow::update_gui(int clear) { switch(clear) { - case RESET_RADIUS : radius->update(plugin->config.radius); + case RESET_RADIUS : + radius_text->update(plugin->config.radius); + radius_slider->update(plugin->config.radius); break; - case RESET_AMOUNT : amount->update(plugin->config.amount); + case RESET_AMOUNT : + amount_text->update(plugin->config.amount); + amount_slider->update(plugin->config.amount); break; - case RESET_THRESHOLD : threshold->update(plugin->config.threshold); + case RESET_THRESHOLD : + threshold_text->update((int64_t)plugin->config.threshold); + threshold_slider->update((int64_t)plugin->config.threshold); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: - radius->update(plugin->config.radius); - amount->update(plugin->config.amount); - threshold->update(plugin->config.threshold); + radius_text->update(plugin->config.radius); + radius_slider->update(plugin->config.radius); + amount_text->update(plugin->config.amount); + amount_slider->update(plugin->config.amount); + threshold_text->update((int64_t)plugin->config.threshold); + threshold_slider->update((int64_t)plugin->config.threshold); break; } } +/* *********************************** */ +/* **** UNSHARP RADIUS *************** */ +UnsharpRadiusText::UnsharpRadiusText(UnsharpWindow *window, UnsharpMain *plugin, int x, int y) + : BC_TumbleTextBox(window, plugin->config.radius, + (float)RADIUS_MIN, (float)RADIUS_MAX, x, y, xS(60), 2) +{ + this->window = window; + this->plugin = plugin; + set_increment(0.1); +} +UnsharpRadiusText::~UnsharpRadiusText() +{ +} +int UnsharpRadiusText::handle_event() +{ + float min = RADIUS_MIN, max = RADIUS_MAX; + float output = atof(get_text()); + if(output > max) output = max; + if(output < min) output = min; + plugin->config.radius = output; + window->radius_slider->update(plugin->config.radius); + window->radius_text->update(plugin->config.radius); + plugin->send_configure_change(); + return 1; +} +UnsharpRadiusSlider::UnsharpRadiusSlider(UnsharpWindow *window, UnsharpMain *plugin, + int x, int y, int w) + : BC_FSlider(x, y, 0, w, w, RADIUS_MIN, RADIUS_MAX, plugin->config.radius) +{ + this->window = window; + this->plugin = plugin; + enable_show_value(0); // Hide caption + set_precision(0.01); +} +UnsharpRadiusSlider::~UnsharpRadiusSlider() +{ +} +int UnsharpRadiusSlider::handle_event() +{ + plugin->config.radius = get_value(); + window->radius_text->update(plugin->config.radius); + plugin->send_configure_change(); + return 1; +} +/* *********************************** */ -UnsharpRadius::UnsharpRadius(UnsharpMain *plugin, int x, int y) - : BC_FPot(x, y, plugin->config.radius, 0.1, 120) +/* *********************************** */ +/* **** UNSHARP AMOUNT *************** */ +UnsharpAmountText::UnsharpAmountText(UnsharpWindow *window, UnsharpMain *plugin, int x, int y) + : BC_TumbleTextBox(window, plugin->config.amount, + (float)AMOUNT_MIN, (float)AMOUNT_MAX, x, y, xS(60), 2) { + this->window = window; this->plugin = plugin; + set_increment(0.1); } -int UnsharpRadius::handle_event() + +UnsharpAmountText::~UnsharpAmountText() { - plugin->config.radius = get_value(); +} + +int UnsharpAmountText::handle_event() +{ + float min = AMOUNT_MIN, max = AMOUNT_MAX; + float output = atof(get_text()); + if(output > max) output = max; + if(output < min) output = min; + plugin->config.amount = output; + window->amount_slider->update(plugin->config.amount); + window->amount_text->update(plugin->config.amount); plugin->send_configure_change(); return 1; } -UnsharpAmount::UnsharpAmount(UnsharpMain *plugin, int x, int y) - : BC_FPot(x, y, plugin->config.amount, 0, 5) +UnsharpAmountSlider::UnsharpAmountSlider(UnsharpWindow *window, UnsharpMain *plugin, + int x, int y, int w) + : BC_FSlider(x, y, 0, w, w, AMOUNT_MIN, AMOUNT_MAX, plugin->config.amount) { + this->window = window; this->plugin = plugin; + enable_show_value(0); // Hide caption + set_precision(0.01); +} + +UnsharpAmountSlider::~UnsharpAmountSlider() +{ } -int UnsharpAmount::handle_event() + +int UnsharpAmountSlider::handle_event() { plugin->config.amount = get_value(); + window->amount_text->update(plugin->config.amount); plugin->send_configure_change(); return 1; } +/* *********************************** */ + -UnsharpThreshold::UnsharpThreshold(UnsharpMain *plugin, int x, int y) - : BC_IPot(x, y, plugin->config.threshold, 0, 255) +/* *********************************** */ +/* **** UNSHARP THRESHOLD ************ */ +UnsharpThresholdText::UnsharpThresholdText(UnsharpWindow *window, UnsharpMain *plugin, int x, int y) + : BC_TumbleTextBox(window, plugin->config.threshold, + THRESHOLD_MIN, THRESHOLD_MAX, x, y, xS(60)) { + this->window = window; this->plugin = plugin; + set_increment(1); } -int UnsharpThreshold::handle_event() + +UnsharpThresholdText::~UnsharpThresholdText() +{ +} + +int UnsharpThresholdText::handle_event() +{ + int min = THRESHOLD_MIN, max = THRESHOLD_MAX; + int output = atoi(get_text()); + if(output > max) output = max; + if(output < min) output = min; + plugin->config.threshold = output; + window->threshold_slider->update(plugin->config.threshold); + window->threshold_text->update((int64_t)plugin->config.threshold); + plugin->send_configure_change(); + return 1; +} + +UnsharpThresholdSlider::UnsharpThresholdSlider(UnsharpWindow *window, UnsharpMain *plugin, + int x, int y, int w) + : BC_ISlider(x, y, 0, w, w, THRESHOLD_MIN, THRESHOLD_MAX, plugin->config.threshold) +{ + this->window = window; + this->plugin = plugin; + enable_show_value(0); // Hide caption +} + +UnsharpThresholdSlider::~UnsharpThresholdSlider() +{ +} + +int UnsharpThresholdSlider::handle_event() { plugin->config.threshold = get_value(); + window->threshold_text->update((int64_t)plugin->config.threshold); plugin->send_configure_change(); return 1; } +/* *********************************** */ -UnsharpReset::UnsharpReset(UnsharpMain *plugin, UnsharpWindow *window, int x, int y) + +UnsharpReset::UnsharpReset(UnsharpWindow *window, UnsharpMain *plugin, int x, int y) : BC_GenericButton(x, y, _("Reset")) { this->plugin = plugin; @@ -151,7 +292,7 @@ int UnsharpReset::handle_event() return 1; } -UnsharpDefaultSettings::UnsharpDefaultSettings(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w) +UnsharpDefaultSettings::UnsharpDefaultSettings(UnsharpWindow *window, UnsharpMain *plugin, int x, int y, int w) : BC_GenericButton(x, y, w, _("Default")) { this->plugin = plugin; @@ -168,17 +309,17 @@ int UnsharpDefaultSettings::handle_event() return 1; } -UnsharpSliderClr::UnsharpSliderClr(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +UnsharpClr::UnsharpClr(UnsharpWindow *window, UnsharpMain *plugin, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { - this->plugin = plugin; this->window = window; + this->plugin = plugin; this->clear = clear; } -UnsharpSliderClr::~UnsharpSliderClr() +UnsharpClr::~UnsharpClr() { } -int UnsharpSliderClr::handle_event() +int UnsharpClr::handle_event() { // clear==1 ==> Radius slider // clear==2 ==> Amount slider diff --git a/cinelerra-5.1/plugins/unsharp/unsharpwindow.h b/cinelerra-5.1/plugins/unsharp/unsharpwindow.h index 3b4ef7ca..b99f86e0 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharpwindow.h +++ b/cinelerra-5.1/plugins/unsharp/unsharpwindow.h @@ -26,68 +26,133 @@ #include "unsharp.inc" #include "unsharpwindow.inc" + #define RESET_DEFAULT_SETTINGS 10 #define RESET_ALL 0 #define RESET_RADIUS 1 #define RESET_AMOUNT 2 #define RESET_THRESHOLD 3 +#define RADIUS_MIN 0.10 +#define RADIUS_MAX 120.00 +#define AMOUNT_MIN 0.00 +#define AMOUNT_MAX 5.00 +#define THRESHOLD_MIN 0 +#define THRESHOLD_MAX 255 + -class UnsharpRadius : public BC_FPot + +class UnsharpRadiusText : public BC_TumbleTextBox { public: - UnsharpRadius(UnsharpMain *plugin, int x, int y); + UnsharpRadiusText(UnsharpWindow *window, + UnsharpMain *plugin, + int x, int y); + ~UnsharpRadiusText(); int handle_event(); + UnsharpWindow *window; UnsharpMain *plugin; }; -class UnsharpAmount : public BC_FPot +class UnsharpRadiusSlider : public BC_FSlider { public: - UnsharpAmount(UnsharpMain *plugin, int x, int y); + UnsharpRadiusSlider(UnsharpWindow *window, + UnsharpMain *plugin, + int x, int y, int w); + ~UnsharpRadiusSlider(); int handle_event(); + UnsharpWindow *window; UnsharpMain *plugin; }; -class UnsharpThreshold : public BC_IPot + +class UnsharpAmountText : public BC_TumbleTextBox { public: - UnsharpThreshold(UnsharpMain *plugin, int x, int y); + UnsharpAmountText(UnsharpWindow *window, + UnsharpMain *plugin, + int x, int y); + ~UnsharpAmountText(); int handle_event(); + UnsharpWindow *window; UnsharpMain *plugin; }; -class UnsharpReset : public BC_GenericButton + +class UnsharpAmountSlider : public BC_FSlider { public: - UnsharpReset(UnsharpMain *plugin, UnsharpWindow *window, int x, int y); - ~UnsharpReset(); + UnsharpAmountSlider(UnsharpWindow *window, + UnsharpMain *plugin, + int x, int y, int w); + ~UnsharpAmountSlider(); int handle_event(); + UnsharpWindow *window; UnsharpMain *plugin; +}; + + +class UnsharpThresholdText : public BC_TumbleTextBox +{ +public: + UnsharpThresholdText(UnsharpWindow *window, + UnsharpMain *plugin, + int x, int y); + ~UnsharpThresholdText(); + int handle_event(); UnsharpWindow *window; + UnsharpMain *plugin; }; -class UnsharpDefaultSettings : public BC_GenericButton +class UnsharpThresholdSlider : public BC_ISlider { public: - UnsharpDefaultSettings(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w); - ~UnsharpDefaultSettings(); + UnsharpThresholdSlider(UnsharpWindow *window, + UnsharpMain *plugin, + int x, int y, int w); + ~UnsharpThresholdSlider(); int handle_event(); + UnsharpWindow *window; UnsharpMain *plugin; +}; + + +class UnsharpClr : public BC_Button +{ +public: + UnsharpClr(UnsharpWindow *window, UnsharpMain *plugin, + int x, int y, int clear); + ~UnsharpClr(); + int handle_event(); UnsharpWindow *window; + UnsharpMain *plugin; + int clear; }; -class UnsharpSliderClr : public BC_Button + +class UnsharpReset : public BC_GenericButton { public: - UnsharpSliderClr(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w, int clear); - ~UnsharpSliderClr(); + UnsharpReset(UnsharpWindow *window, UnsharpMain *plugin, int x, int y); + ~UnsharpReset(); int handle_event(); + UnsharpWindow *window; UnsharpMain *plugin; +}; + +class UnsharpDefaultSettings : public BC_GenericButton +{ +public: + UnsharpDefaultSettings(UnsharpWindow *window, UnsharpMain *plugin, int x, int y, int w); + ~UnsharpDefaultSettings(); + int handle_event(); UnsharpWindow *window; - int clear; + UnsharpMain *plugin; }; + + class UnsharpWindow : public PluginClientWindow { public: @@ -97,22 +162,23 @@ public: void create_objects(); void update_gui(int clear); - UnsharpRadius *radius; - UnsharpAmount *amount; - UnsharpThreshold *threshold; UnsharpMain *plugin; - UnsharpReset *reset; - UnsharpDefaultSettings *default_settings; - UnsharpSliderClr *radiusClr; - UnsharpSliderClr *amountClr; - UnsharpSliderClr *thresholdClr; -}; - - + UnsharpRadiusText *radius_text; + UnsharpRadiusSlider *radius_slider; + UnsharpClr *radius_clr; + UnsharpAmountText *amount_text; + UnsharpAmountSlider *amount_slider; + UnsharpClr *amount_clr; + UnsharpThresholdText *threshold_text; + UnsharpThresholdSlider *threshold_slider; + UnsharpClr *threshold_clr; + UnsharpReset *reset; + UnsharpDefaultSettings *default_settings; +}; #endif diff --git a/cinelerra-5.1/plugins/wave/wave.C b/cinelerra-5.1/plugins/wave/wave.C index b3825fad..86317bce 100644 --- a/cinelerra-5.1/plugins/wave/wave.C +++ b/cinelerra-5.1/plugins/wave/wave.C @@ -152,65 +152,58 @@ int WaveReflective::handle_event() } -WaveAmplitude::WaveAmplitude(WaveEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)0, - (float)100, - plugin->config.amplitude) +WaveFText::WaveFText(WaveWindow *gui, WaveEffect *plugin, + WaveFSlider *slider, float *output, int x, int y, float min, float max) + : BC_TumbleTextBox(gui, *output, + min, max, x, y, xS(60), 2) { + this->gui = gui; this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(0.1); +} + +WaveFText::~WaveFText() +{ } -int WaveAmplitude::handle_event() + +int WaveFText::handle_event() { - plugin->config.amplitude = get_value(); + *output = atof(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); plugin->send_configure_change(); return 1; } - -WavePhase::WavePhase(WaveEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)0, - (float)360, - plugin->config.phase) +WaveFSlider::WaveFSlider(WaveEffect *plugin, + WaveFText *text, float *output, int x, int y, float min, float max) + : BC_FSlider(x, y, 0, xS(180), xS(180), min, max, *output) { this->plugin = plugin; -} -int WavePhase::handle_event() -{ - plugin->config.phase = get_value(); - plugin->send_configure_change(); - return 1; + this->output = output; + this->text = text; + enable_show_value(0); // Hide caption } -WaveLength::WaveLength(WaveEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)0, - (float)50, - plugin->config.wavelength) +WaveFSlider::~WaveFSlider() { - this->plugin = plugin; } -int WaveLength::handle_event() + +int WaveFSlider::handle_event() { - plugin->config.wavelength = get_value(); + *output = get_value(); + text->update(*output); plugin->send_configure_change(); return 1; } + WaveReset::WaveReset(WaveEffect *plugin, WaveWindow *gui, int x, int y) : BC_GenericButton(x, y, _("Reset")) { @@ -245,17 +238,17 @@ int WaveDefaultSettings::handle_event() return 1; } -WaveSliderClr::WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +WaveClr::WaveClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->gui = gui; this->clear = clear; } -WaveSliderClr::~WaveSliderClr() +WaveClr::~WaveClr() { } -int WaveSliderClr::handle_event() +int WaveClr::handle_event() { // clear==1 ==> Amplitude slider // clear==2 ==> Phase slider @@ -270,7 +263,7 @@ int WaveSliderClr::handle_event() WaveWindow::WaveWindow(WaveEffect *plugin) - : PluginClientWindow(plugin, xS(385), yS(140), xS(385), yS(140), 0) + : PluginClientWindow(plugin, xS(420), yS(160), xS(420), yS(160), 0) { this->plugin = plugin; } @@ -281,12 +274,15 @@ WaveWindow::~WaveWindow() void WaveWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100), xs115 = xS(115); + int xs10 = xS(10), xs100 = xS(100); int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); - int x = xs10, y = ys10, x1 = xs115; - int x2 = 0; int clrBtn_w = xs50; + int x = xs10, y = ys10; + int x2 = xS(100), x3 = xS(200); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; + BC_Bar *bar; + // add_subwindow(new BC_Title(x, y, _("Mode:"))); // add_subwindow(smear = new WaveSmear(plugin, this, x1, y)); // y += ys20; @@ -294,25 +290,48 @@ void WaveWindow::create_objects() // y += ys30; // add_subwindow(reflective = new WaveReflective(plugin, x1, y)); // y += ys30; - add_subwindow(new BC_Title(x, y, _("Amplitude:"))); - add_subwindow(amplitude = new WaveAmplitude(plugin, x1, y)); - x2 = x1 + amplitude->get_w() + xs10; - add_subwindow(amplitudeClr = new WaveSliderClr(plugin, this, x2, y, clrBtn_w, RESET_AMPLITUDE)); + y += ys10; + add_subwindow(new BC_Title(x, y, _("Amplitude:"))); + amplitude_text = new WaveFText(this, plugin, + 0, &plugin->config.amplitude, (x + x2), y, AMPLITUDE_MIN, AMPLITUDE_MAX); + amplitude_text->create_objects(); + amplitude_slider = new WaveFSlider(plugin, + amplitude_text, &plugin->config.amplitude, x3, y, AMPLITUDE_MIN, AMPLITUDE_MAX); + add_subwindow(amplitude_slider); + amplitude_text->slider = amplitude_slider; + clr_x = x3 + amplitude_slider->get_w() + x; + add_subwindow(amplitude_Clr = new WaveClr(plugin, this, clr_x, y, RESET_AMPLITUDE)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Phase:"))); - add_subwindow(phase = new WavePhase(plugin, x1, y)); - add_subwindow(phaseClr = new WaveSliderClr(plugin, this, x2, y, clrBtn_w, RESET_PHASE)); + add_subwindow(new BC_Title(x, y, _("Phase:"))); + phase_text = new WaveFText(this, plugin, + 0, &plugin->config.phase, (x + x2), y, PHASE_MIN, PHASE_MAX); + phase_text->create_objects(); + phase_slider = new WaveFSlider(plugin, + phase_text, &plugin->config.phase, x3, y, PHASE_MIN, PHASE_MAX); + add_subwindow(phase_slider); + phase_text->slider = phase_slider; + add_subwindow(phase_Clr = new WaveClr(plugin, this, clr_x, y, RESET_PHASE)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Wavelength:"))); - add_subwindow(wavelength = new WaveLength(plugin, x1, y)); - add_subwindow(wavelengthClr = new WaveSliderClr(plugin, this, x2, y, clrBtn_w, RESET_WAVELENGTH)); + add_subwindow(new BC_Title(x, y, _("Wavelength:"))); + wavelength_text = new WaveFText(this, plugin, + 0, &plugin->config.wavelength, (x + x2), y, WAVELENGTH_MIN, WAVELENGTH_MAX); + wavelength_text->create_objects(); + wavelength_slider = new WaveFSlider(plugin, + wavelength_text, &plugin->config.wavelength, x3, y, WAVELENGTH_MIN, WAVELENGTH_MAX); + add_subwindow(wavelength_slider); + wavelength_text->slider = wavelength_slider; + add_subwindow(wavelength_Clr = new WaveClr(plugin, this, clr_x, y, RESET_WAVELENGTH)); y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new WaveReset(plugin, this, x, y)); add_subwindow(default_settings = new WaveDefaultSettings(plugin, this, - (xS(385) - xs10 - defaultBtn_w), y, defaultBtn_w)); + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -328,18 +347,27 @@ void WaveWindow::update_mode() void WaveWindow::update_gui(int clear) { switch(clear) { - case RESET_AMPLITUDE : amplitude->update(plugin->config.amplitude); + case RESET_AMPLITUDE : + amplitude_text->update(plugin->config.amplitude); + amplitude_slider->update(plugin->config.amplitude); break; - case RESET_PHASE : phase->update(plugin->config.phase); + case RESET_PHASE : + phase_text->update(plugin->config.phase); + phase_slider->update(plugin->config.phase); break; - case RESET_WAVELENGTH : wavelength->update(plugin->config.wavelength); + case RESET_WAVELENGTH : + wavelength_text->update(plugin->config.wavelength); + wavelength_slider->update(plugin->config.wavelength); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: - amplitude->update(plugin->config.amplitude); - phase->update(plugin->config.phase); - wavelength->update(plugin->config.wavelength); + amplitude_text->update(plugin->config.amplitude); + amplitude_slider->update(plugin->config.amplitude); + phase_text->update(plugin->config.phase); + phase_slider->update(plugin->config.phase); + wavelength_text->update(plugin->config.wavelength); + wavelength_slider->update(plugin->config.wavelength); break; } } @@ -388,9 +416,12 @@ void WaveEffect::update_gui() load_configuration(); ((WaveWindow*)thread->window)->update_mode(); // thread->window->reflective->update(config.reflective); - ((WaveWindow*)thread->window)->amplitude->update(config.amplitude); - ((WaveWindow*)thread->window)->phase->update(config.phase); - ((WaveWindow*)thread->window)->wavelength->update(config.wavelength); + ((WaveWindow*)thread->window)->amplitude_text->update(config.amplitude); + ((WaveWindow*)thread->window)->amplitude_slider->update(config.amplitude); + ((WaveWindow*)thread->window)->phase_text->update(config.phase); + ((WaveWindow*)thread->window)->phase_slider->update(config.phase); + ((WaveWindow*)thread->window)->wavelength_text->update(config.wavelength); + ((WaveWindow*)thread->window)->wavelength_slider->update(config.wavelength); thread->window->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/wave/wave.h b/cinelerra-5.1/plugins/wave/wave.h index e8ba8d0a..37a080b1 100644 --- a/cinelerra-5.1/plugins/wave/wave.h +++ b/cinelerra-5.1/plugins/wave/wave.h @@ -51,11 +51,20 @@ #define RESET_PHASE 2 #define RESET_WAVELENGTH 3 +#define AMPLITUDE_MIN 0.00 +#define AMPLITUDE_MAX 100.00 +#define PHASE_MIN 0.00 +#define PHASE_MAX 360.00 +#define WAVELENGTH_MIN 0.00 +#define WAVELENGTH_MAX 50.00 + class WaveEffect; class WaveWindow; +class WaveFText; +class WaveFSlider; class WaveReset; class WaveDefaultSettings; -class WaveSliderClr; +class WaveClr; class WaveConfig { @@ -104,28 +113,32 @@ public: WaveEffect *plugin; }; -class WaveAmplitude : public BC_FSlider -{ -public: - WaveAmplitude(WaveEffect *plugin, int x, int y); - int handle_event(); - WaveEffect *plugin; -}; -class WavePhase : public BC_FSlider +class WaveFText : public BC_TumbleTextBox { public: - WavePhase(WaveEffect *plugin, int x, int y); + WaveFText(WaveWindow *gui, WaveEffect *plugin, + WaveFSlider *slider, float *output, int x, int y, float min, float max); + ~WaveFText(); int handle_event(); + WaveWindow *gui; WaveEffect *plugin; + WaveFSlider *slider; + float *output; + float min, max; }; -class WaveLength : public BC_FSlider +class WaveFSlider : public BC_FSlider { public: - WaveLength(WaveEffect *plugin, int x, int y); + WaveFSlider(WaveEffect *plugin, + WaveFText *text, float *output, int x, int y, + float min, float max); + ~WaveFSlider(); int handle_event(); WaveEffect *plugin; + WaveFText *text; + float *output; }; class WaveReset : public BC_GenericButton @@ -148,11 +161,11 @@ public: WaveWindow *gui; }; -class WaveSliderClr : public BC_Button +class WaveClr : public BC_Button { public: - WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear); - ~WaveSliderClr(); + WaveClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int clear); + ~WaveClr(); int handle_event(); WaveEffect *plugin; WaveWindow *gui; @@ -176,14 +189,21 @@ public: // WaveSmear *smear; // WaveBlacken *blacken; // WaveReflective *reflective; - WaveAmplitude *amplitude; - WavePhase *phase; - WaveLength *wavelength; + + WaveFText *amplitude_text; + WaveFSlider *amplitude_slider; + WaveClr *amplitude_Clr; + + WaveFText *phase_text; + WaveFSlider *phase_slider; + WaveClr *phase_Clr; + + WaveFText *wavelength_text; + WaveFSlider *wavelength_slider; + WaveClr *wavelength_Clr; + WaveReset *reset; WaveDefaultSettings *default_settings; - WaveSliderClr *amplitudeClr; - WaveSliderClr *phaseClr; - WaveSliderClr *wavelengthClr; }; diff --git a/cinelerra-5.1/plugins/whirl/whirl.C b/cinelerra-5.1/plugins/whirl/whirl.C index ac598991..a5137e0e 100644 --- a/cinelerra-5.1/plugins/whirl/whirl.C +++ b/cinelerra-5.1/plugins/whirl/whirl.C @@ -39,9 +39,11 @@ class WhirlEffect; class WhirlWindow; class WhirlEngine; +class WhirlFText; +class WhirlFSlider; class WhirlReset; class WhirlDefaultSettings; -class WhirlSliderClr; +class WhirlClr; #define MAXRADIUS 100 #define MAXPINCH 100 @@ -52,6 +54,14 @@ class WhirlSliderClr; #define RESET_PINCH 2 #define RESET_ANGLE 3 +#define RADIUS_MIN 0.00 +#define RADIUS_MAX 100.00 +#define PINCH_MIN 0.00 +#define PINCH_MAX 100.00 +#define ANGLE_MIN 0.00 +#define ANGLE_MAX 360.00 + + class WhirlConfig { @@ -73,32 +83,32 @@ public: }; -class WhirlAngle : public BC_FSlider +class WhirlFText : public BC_TumbleTextBox { public: - WhirlAngle(WhirlEffect *plugin, int x, int y); + WhirlFText(WhirlWindow *window, WhirlEffect *plugin, + WhirlFSlider *slider, float *output, int x, int y, float min, float max); + ~WhirlFText(); int handle_event(); + WhirlWindow *window; WhirlEffect *plugin; + WhirlFSlider *slider; + float *output; + float min, max; }; - -class WhirlPinch : public BC_FSlider +class WhirlFSlider : public BC_FSlider { public: - WhirlPinch(WhirlEffect *plugin, int x, int y); - int handle_event(); - WhirlEffect *plugin; -}; - - - -class WhirlRadius : public BC_FSlider -{ -public: - WhirlRadius(WhirlEffect *plugin, int x, int y); + WhirlFSlider(WhirlEffect *plugin, + WhirlFText *text, float *output, int x, int y, + float min, float max); + ~WhirlFSlider(); int handle_event(); WhirlEffect *plugin; + WhirlFText *text; + float *output; }; @@ -122,11 +132,11 @@ public: WhirlWindow *window; }; -class WhirlSliderClr : public BC_Button +class WhirlClr : public BC_Button { public: - WhirlSliderClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w, int clear); - ~WhirlSliderClr(); + WhirlClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int clear); + ~WhirlClr(); int handle_event(); WhirlEffect *plugin; WhirlWindow *window; @@ -142,12 +152,21 @@ public: void create_objects(); void update_gui(int clear); WhirlEffect *plugin; - WhirlRadius *radius; - WhirlPinch *pinch; - WhirlAngle *angle; + + WhirlFText *radius_text; + WhirlFSlider *radius_slider; + WhirlClr *radius_Clr; + + WhirlFText *pinch_text; + WhirlFSlider *pinch_slider; + WhirlClr *pinch_Clr; + + WhirlFText *angle_text; + WhirlFSlider *angle_slider; + WhirlClr *angle_Clr; + WhirlReset *reset; WhirlDefaultSettings *default_settings; - WhirlSliderClr *radiusClr, *pinchClr, *angleClr; }; @@ -289,7 +308,7 @@ void WhirlConfig::interpolate(WhirlConfig &prev, WhirlWindow::WhirlWindow(WhirlEffect *plugin) - : PluginClientWindow(plugin, xS(280), yS(195), xS(280), yS(195), 0) + : PluginClientWindow(plugin, xS(420), yS(160), xS(420), yS(160), 0) { this->plugin = plugin; } @@ -298,34 +317,57 @@ WhirlWindow::WhirlWindow(WhirlEffect *plugin) void WhirlWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100); - int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys35 = yS(35); + int xs10 = xS(10), xs100 = xS(100); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); int x = xs10, y = ys10; - int x1 = 0; int clrBtn_w = xs50; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; - add_subwindow(new BC_Title(x, y, _("Radius"))); - y += ys20; - add_subwindow(radius = new WhirlRadius(plugin, x, y)); - x1 = x + radius->get_w() + xs10; - add_subwindow(radiusClr = new WhirlSliderClr(plugin, this, x1, y, clrBtn_w, RESET_RADIUS)); - + BC_Bar *bar; + + y += ys10; + add_subwindow(new BC_Title(x, y, _("Radius:"))); + radius_text = new WhirlFText(this, plugin, + 0, &plugin->config.radius, (x + x2), y, RADIUS_MIN, RADIUS_MAX); + radius_text->create_objects(); + radius_slider = new WhirlFSlider(plugin, + radius_text, &plugin->config.radius, x3, y, RADIUS_MIN, RADIUS_MAX); + add_subwindow(radius_slider); + radius_text->slider = radius_slider; + clr_x = x3 + radius_slider->get_w() + x; + add_subwindow(radius_Clr = new WhirlClr(plugin, this, clr_x, y, RESET_RADIUS)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Pinch"))); - y += ys20; - add_subwindow(pinch = new WhirlPinch(plugin, x, y)); - add_subwindow(pinchClr = new WhirlSliderClr(plugin, this, x1, y, clrBtn_w, RESET_PINCH)); + add_subwindow(new BC_Title(x, y, _("Pinch:"))); + pinch_text = new WhirlFText(this, plugin, + 0, &plugin->config.pinch, (x + x2), y, PINCH_MIN, PINCH_MAX); + pinch_text->create_objects(); + pinch_slider = new WhirlFSlider(plugin, + pinch_text, &plugin->config.pinch, x3, y, PINCH_MIN, PINCH_MAX); + add_subwindow(pinch_slider); + pinch_text->slider = pinch_slider; + add_subwindow(pinch_Clr = new WhirlClr(plugin, this, clr_x, y, RESET_PINCH)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Angle"))); - y += ys20; - add_subwindow(angle = new WhirlAngle(plugin, x, y)); - add_subwindow(angleClr = new WhirlSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ANGLE)); - y += ys35; + add_subwindow(new BC_Title(x, y, _("Angle:"))); + angle_text = new WhirlFText(this, plugin, + 0, &plugin->config.angle, (x + x2), y, ANGLE_MIN, ANGLE_MAX); + angle_text->create_objects(); + angle_slider = new WhirlFSlider(plugin, + angle_text, &plugin->config.angle, x3, y, ANGLE_MIN, ANGLE_MAX); + add_subwindow(angle_slider); + angle_text->slider = angle_slider; + add_subwindow(angle_Clr = new WhirlClr(plugin, this, clr_x, y, RESET_ANGLE)); + y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new WhirlReset(plugin, this, x, y)); add_subwindow(default_settings = new WhirlDefaultSettings(plugin, this, - (xS(280) - xs10 - defaultBtn_w), y, defaultBtn_w)); + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); + show_window(); flush(); } @@ -335,18 +377,27 @@ void WhirlWindow::create_objects() void WhirlWindow::update_gui(int clear) { switch(clear) { - case RESET_RADIUS : radius->update(plugin->config.radius); + case RESET_RADIUS : + radius_text->update(plugin->config.radius); + radius_slider->update(plugin->config.radius); break; - case RESET_PINCH : pinch->update(plugin->config.pinch); + case RESET_PINCH : + pinch_text->update(plugin->config.pinch); + pinch_slider->update(plugin->config.pinch); break; - case RESET_ANGLE : angle->update(plugin->config.angle); + case RESET_ANGLE : + angle_text->update(plugin->config.angle); + angle_slider->update(plugin->config.angle); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: - radius->update(plugin->config.radius); - pinch->update(plugin->config.pinch); - angle->update(plugin->config.angle); + radius_text->update(plugin->config.radius); + radius_slider->update(plugin->config.radius); + pinch_text->update(plugin->config.pinch); + pinch_slider->update(plugin->config.pinch); + angle_text->update(plugin->config.angle); + angle_slider->update(plugin->config.angle); break; } } @@ -356,76 +407,58 @@ void WhirlWindow::update_gui(int clear) - - - - - -WhirlAngle::WhirlAngle(WhirlEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)0, - (float)360, - plugin->config.angle) +WhirlFText::WhirlFText(WhirlWindow *window, WhirlEffect *plugin, + WhirlFSlider *slider, float *output, int x, int y, float min, float max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 2) { + this->window = window; this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(0.1); } -int WhirlAngle::handle_event() -{ - plugin->config.angle = get_value(); - plugin->send_configure_change(); - return 1; -} - - - -WhirlPinch::WhirlPinch(WhirlEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)0, - (float)MAXPINCH, - plugin->config.pinch) +WhirlFText::~WhirlFText() { - this->plugin = plugin; } -int WhirlPinch::handle_event() + +int WhirlFText::handle_event() { - plugin->config.pinch = get_value(); + *output = atof(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); plugin->send_configure_change(); return 1; } - - -WhirlRadius::WhirlRadius(WhirlEffect *plugin, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - (float)0, - (float)MAXRADIUS, - plugin->config.radius) +WhirlFSlider::WhirlFSlider(WhirlEffect *plugin, + WhirlFText *text, float *output, int x, int y, float min, float max) + : BC_FSlider(x, y, 0, xS(200), xS(200), min, max, *output) { this->plugin = plugin; + this->output = output; + this->text = text; + enable_show_value(0); // Hide caption } -int WhirlRadius::handle_event() + +WhirlFSlider::~WhirlFSlider() { - plugin->config.radius = get_value(); +} + +int WhirlFSlider::handle_event() +{ + *output = get_value(); + text->update(*output); plugin->send_configure_change(); return 1; } - WhirlReset::WhirlReset(WhirlEffect *plugin, WhirlWindow *window, int x, int y) : BC_GenericButton(x, y, _("Reset")) { @@ -460,17 +493,17 @@ int WhirlDefaultSettings::handle_event() return 1; } -WhirlSliderClr::WhirlSliderClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +WhirlClr::WhirlClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->window = window; this->clear = clear; } -WhirlSliderClr::~WhirlSliderClr() +WhirlClr::~WhirlClr() { } -int WhirlSliderClr::handle_event() +int WhirlClr::handle_event() { // clear==1 ==> Radius slider // clear==2 ==> Pinch slider @@ -520,9 +553,12 @@ void WhirlEffect::update_gui() { load_configuration(); thread->window->lock_window(); - ((WhirlWindow*)thread->window)->angle->update(config.angle); - ((WhirlWindow*)thread->window)->pinch->update(config.pinch); - ((WhirlWindow*)thread->window)->radius->update(config.radius); + ((WhirlWindow*)thread->window)->angle_text->update(config.angle); + ((WhirlWindow*)thread->window)->angle_slider->update(config.angle); + ((WhirlWindow*)thread->window)->pinch_text->update(config.pinch); + ((WhirlWindow*)thread->window)->pinch_slider->update(config.pinch); + ((WhirlWindow*)thread->window)->radius_text->update(config.radius); + ((WhirlWindow*)thread->window)->radius_slider->update(config.radius); thread->window->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/yuv/yuv.C b/cinelerra-5.1/plugins/yuv/yuv.C index 6e6bd86f..275c3394 100644 --- a/cinelerra-5.1/plugins/yuv/yuv.C +++ b/cinelerra-5.1/plugins/yuv/yuv.C @@ -33,6 +33,8 @@ #include #include +#define MAXVALUE 100 + #define RESET_ALL 0 #define RESET_Y_SLIDER 1 #define RESET_U_SLIDER 2 @@ -40,8 +42,10 @@ class YUVEffect; class YUVWindow; +class YUVFText; +class YUVFSlider; class YUVReset; -class YUVSliderClr; +class YUVClr; class YUVConfig @@ -61,15 +65,36 @@ public: float y, u, v; }; -class YUVLevel : public BC_FSlider + + + +class YUVFText : public BC_TumbleTextBox { public: - YUVLevel(YUVEffect *plugin, float *output, int x, int y); + YUVFText(YUVWindow *window, YUVEffect *plugin, + YUVFSlider *slider, float *output, int x, int y, float min, float max); + ~YUVFText(); int handle_event(); + YUVWindow *window; YUVEffect *plugin; + YUVFSlider *slider; float *output; + float min, max; }; + +class YUVFSlider : public BC_FSlider +{ +public: + YUVFSlider(YUVEffect *plugin, YUVFText *text, float *output, int x, int y); + ~YUVFSlider(); + int handle_event(); + YUVEffect *plugin; + YUVFText *text; + float *output; +}; + + class YUVReset : public BC_GenericButton { public: @@ -80,11 +105,11 @@ public: YUVWindow *window; }; -class YUVSliderClr : public BC_Button +class YUVClr : public BC_Button { public: - YUVSliderClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int w, int clear); - ~YUVSliderClr(); + YUVClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int clear); + ~YUVClr(); int handle_event(); YUVEffect *plugin; YUVWindow *window; @@ -97,10 +122,21 @@ public: YUVWindow(YUVEffect *plugin); void create_objects(); void update_gui(int clear); - YUVLevel *y, *u, *v; + + YUVFText *y_text; + YUVFSlider *y_slider; + YUVClr *y_Clr; + + YUVFText *u_text; + YUVFSlider *u_slider; + YUVClr *u_Clr; + + YUVFText *v_text; + YUVFSlider *v_slider; + YUVClr *v_Clr; + YUVEffect *plugin; YUVReset *reset; - YUVSliderClr *yClr, *uClr, *vClr; }; @@ -184,25 +220,54 @@ void YUVConfig::interpolate(YUVConfig &prev, -#define MAXVALUE 100 -YUVLevel::YUVLevel(YUVEffect *plugin, float *output, int x, int y) - : BC_FSlider(x, - y, - 0, - xS(200), - yS(200), - -MAXVALUE, - MAXVALUE, - *output) + +YUVFText::YUVFText(YUVWindow *window, YUVEffect *plugin, + YUVFSlider *slider, float *output, int x, int y, float min, float max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 2) { + this->window = window; this->plugin = plugin; this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(0.1); } -int YUVLevel::handle_event() +YUVFText::~YUVFText() +{ +} + +int YUVFText::handle_event() +{ + *output = atof(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); + plugin->send_configure_change(); + return 1; +} + + +YUVFSlider::YUVFSlider(YUVEffect *plugin, YUVFText *text, float *output, int x, int y) + : BC_FSlider(x, y, 0, xS(200), xS(200), -MAXVALUE, MAXVALUE, *output) +{ + this->plugin = plugin; + this->output = output; + this->text = text; + enable_show_value(0); // Hide caption +} + +YUVFSlider::~YUVFSlider() +{ +} + +int YUVFSlider::handle_event() { *output = get_value(); + text->update(*output); plugin->send_configure_change(); return 1; } @@ -226,17 +291,17 @@ int YUVReset::handle_event() } -YUVSliderClr::YUVSliderClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +YUVClr::YUVClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->window = window; this->clear = clear; } -YUVSliderClr::~YUVSliderClr() +YUVClr::~YUVClr() { } -int YUVSliderClr::handle_event() +int YUVClr::handle_event() { // clear==1 ==> Y slider // clear==2 ==> U slider @@ -249,34 +314,56 @@ int YUVSliderClr::handle_event() YUVWindow::YUVWindow(YUVEffect *plugin) - : PluginClientWindow(plugin, xS(310), yS(135), xS(310), yS(135), 0) + : PluginClientWindow(plugin, xS(420), yS(160), xS(420), yS(160), 0) { this->plugin = plugin; } void YUVWindow::create_objects() { - int xs10 = xS(10), xs40 = xS(40), xs50 = xS(50); - int ys10 = yS(10), ys30 = yS(30), ys35 = yS(35); - int x = xs10, y = ys10, x1 = xs40; - int x2 = 0; int clrBtn_w = xs50; + int xs10 = xS(10); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 - add_subwindow(new BC_Title(x, y, _("Y:"))); - add_subwindow(this->y = new YUVLevel(plugin, &plugin->config.y, x1, y)); - x2 = x1 + this->y->get_w() + xs10; - add_subwindow(yClr = new YUVSliderClr(plugin, this, x2, y, clrBtn_w, RESET_Y_SLIDER)); + BC_Bar *bar; + y += ys10; + add_subwindow(new BC_Title(x, y, _("Y:"))); + y_text = new YUVFText(this, plugin, + 0, &plugin->config.y, (x + x2), y, -MAXVALUE, MAXVALUE); + y_text->create_objects(); + y_slider = new YUVFSlider(plugin, y_text, &plugin->config.y, x3, y); + add_subwindow(y_slider); + y_text->slider = y_slider; + clr_x = x3 + y_slider->get_w() + x; + add_subwindow(y_Clr = new YUVClr(plugin, this, clr_x, y, RESET_Y_SLIDER)); y += ys30; - add_subwindow(new BC_Title(x, y, _("U:"))); - add_subwindow(u = new YUVLevel(plugin, &plugin->config.u, x1, y)); - add_subwindow(uClr = new YUVSliderClr(plugin, this, x2, y, clrBtn_w, RESET_U_SLIDER)); + add_subwindow(new BC_Title(x, y, _("U:"))); + u_text = new YUVFText(this, plugin, + 0, &plugin->config.u, (x + x2), y, -MAXVALUE, MAXVALUE); + u_text->create_objects(); + u_slider = new YUVFSlider(plugin, u_text, &plugin->config.u, x3, y); + add_subwindow(u_slider); + u_text->slider = u_slider; + add_subwindow(u_Clr = new YUVClr(plugin, this, clr_x, y, RESET_U_SLIDER)); y += ys30; - add_subwindow(new BC_Title(x, y, _("V:"))); - add_subwindow(v = new YUVLevel(plugin, &plugin->config.v, x1, y)); - add_subwindow(vClr = new YUVSliderClr(plugin, this, x2, y, clrBtn_w, RESET_V_SLIDER)); - y += ys35; + add_subwindow(new BC_Title(x, y, _("V:"))); + v_text = new YUVFText(this, plugin, + 0, &plugin->config.v, (x + x2), y, -MAXVALUE, MAXVALUE); + v_text->create_objects(); + v_slider = new YUVFSlider(plugin, v_text, &plugin->config.v, x3, y); + add_subwindow(v_slider); + v_text->slider = v_slider; + add_subwindow(v_Clr = new YUVClr(plugin, this, clr_x, y, RESET_V_SLIDER)); + y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new YUVReset(plugin, this, x, y)); show_window(); @@ -288,17 +375,26 @@ void YUVWindow::create_objects() void YUVWindow::update_gui(int clear) { switch(clear) { - case RESET_Y_SLIDER : this->y->update(plugin->config.y); + case RESET_Y_SLIDER : + y_text->update(plugin->config.y); + y_slider->update(plugin->config.y); break; - case RESET_U_SLIDER : u->update(plugin->config.u); + case RESET_U_SLIDER : + u_text->update(plugin->config.u); + u_slider->update(plugin->config.u); break; - case RESET_V_SLIDER : v->update(plugin->config.v); + case RESET_V_SLIDER : + v_text->update(plugin->config.v); + v_slider->update(plugin->config.v); break; case RESET_ALL : default: - this->y->update(plugin->config.y); - u->update(plugin->config.u); - v->update(plugin->config.v); + y_text->update(plugin->config.y); + y_slider->update(plugin->config.y); + u_text->update(plugin->config.u); + u_slider->update(plugin->config.u); + v_text->update(plugin->config.v); + v_slider->update(plugin->config.v); break; } } @@ -331,9 +427,12 @@ void YUVEffect::update_gui() { thread->window->lock_window(); load_configuration(); - ((YUVWindow*)thread->window)->y->update(config.y); - ((YUVWindow*)thread->window)->u->update(config.u); - ((YUVWindow*)thread->window)->v->update(config.v); + ((YUVWindow*)thread->window)->y_text->update(config.y); + ((YUVWindow*)thread->window)->y_slider->update(config.y); + ((YUVWindow*)thread->window)->u_text->update(config.u); + ((YUVWindow*)thread->window)->u_slider->update(config.u); + ((YUVWindow*)thread->window)->v_text->update(config.v); + ((YUVWindow*)thread->window)->v_slider->update(config.v); thread->window->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/yuvshift/yuvshift.C b/cinelerra-5.1/plugins/yuvshift/yuvshift.C index fe5a0c9a..bf6ab68c 100644 --- a/cinelerra-5.1/plugins/yuvshift/yuvshift.C +++ b/cinelerra-5.1/plugins/yuvshift/yuvshift.C @@ -94,18 +94,50 @@ void YUVShiftConfig::interpolate(YUVShiftConfig &prev, -#define MAXVALUE 100 -YUVShiftLevel::YUVShiftLevel(YUVShiftEffect *plugin, int *output, int x, int y) - : BC_ISlider(x, y, 0, xS(200), yS(200), -MAXVALUE, MAXVALUE, *output) + + +YUVShiftIText::YUVShiftIText(YUVShiftWindow *window, YUVShiftEffect *plugin, + YUVShiftISlider *slider, int *output, int x, int y, int min, int max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 0) { + this->window = window; this->plugin = plugin; this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(1); +} + +YUVShiftIText::~YUVShiftIText() +{ } -int YUVShiftLevel::handle_event() +int YUVShiftIText::handle_event() +{ + *output = atoi(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); + plugin->send_configure_change(); + return 1; +} + +YUVShiftISlider::YUVShiftISlider(YUVShiftEffect *plugin, YUVShiftIText *text, int *output, int x, int y) + : BC_ISlider(x, y, 0, xS(200), xS(200), -MAXVALUE, MAXVALUE, *output) +{ + this->plugin = plugin; + this->output = output; + this->text = text; + enable_show_value(0); // Hide caption +} + +int YUVShiftISlider::handle_event() { *output = get_value(); + text->update((int64_t)*output); plugin->send_configure_change(); return 1; } @@ -129,17 +161,17 @@ int YUVShiftReset::handle_event() } -YUVShiftSliderClr::YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +YUVShiftClr::YUVShiftClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->window = window; this->clear = clear; } -YUVShiftSliderClr::~YUVShiftSliderClr() +YUVShiftClr::~YUVShiftClr() { } -int YUVShiftSliderClr::handle_event() +int YUVShiftClr::handle_event() { // clear==1 ==> y_dx slider --- clear==2 ==> y_dy slider // clear==3 ==> u_dx slider --- clear==4 ==> u_dy slider @@ -152,49 +184,92 @@ int YUVShiftSliderClr::handle_event() YUVShiftWindow::YUVShiftWindow(YUVShiftEffect *plugin) - : PluginClientWindow(plugin, xS(320), yS(230), xS(320), yS(230), 0) + : PluginClientWindow(plugin, xS(420), yS(250), xS(420), yS(250), 0) { this->plugin = plugin; } void YUVShiftWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50); + int xs10 = xS(10); int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); - int x = xs10, y = ys10, x1 = xs50; - int x2 = 0; int clrBtn_w = xs50; + int x = xs10, y = ys10; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 - add_subwindow(new BC_Title(x, y, _("Y_dx:"))); - add_subwindow(y_dx = new YUVShiftLevel(plugin, &plugin->config.y_dx, x1, y)); - x2 = x1 + y_dx->get_w() + xs10; - add_subwindow(y_dxClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_Y_DX)); + BC_Bar *bar; + y += ys10; + add_subwindow(new BC_Title(x, y, _("Y_dx:"))); + y_dx_text = new YUVShiftIText(this, plugin, + 0, &plugin->config.y_dx, (x + x2), y, -MAXVALUE, MAXVALUE); + y_dx_text->create_objects(); + y_dx_slider = new YUVShiftISlider(plugin, + y_dx_text, &plugin->config.y_dx, x3, y); + add_subwindow(y_dx_slider); + y_dx_text->slider = y_dx_slider; + clr_x = x3 + y_dx_slider->get_w() + x; + add_subwindow(y_dx_Clr = new YUVShiftClr(plugin, this, clr_x, y, RESET_Y_DX)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Y_dy:"))); - add_subwindow(y_dy = new YUVShiftLevel(plugin, &plugin->config.y_dy, x1, y)); - add_subwindow(y_dyClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_Y_DY)); + add_subwindow(new BC_Title(x, y, _("Y_dy:"))); + y_dy_text = new YUVShiftIText(this, plugin, + 0, &plugin->config.y_dy, (x + x2), y, -MAXVALUE, MAXVALUE); + y_dy_text->create_objects(); + y_dy_slider = new YUVShiftISlider(plugin, + y_dy_text, &plugin->config.y_dy, x3, y); + add_subwindow(y_dy_slider); + y_dy_text->slider = y_dy_slider; + add_subwindow(y_dy_Clr = new YUVShiftClr(plugin, this, clr_x, y, RESET_Y_DY)); y += ys30; - add_subwindow(new BC_Title(x, y, _("U_dx:"))); - add_subwindow(u_dx = new YUVShiftLevel(plugin, &plugin->config.u_dx, x1, y)); - add_subwindow(u_dxClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_U_DX)); + add_subwindow(new BC_Title(x, y, _("U_dx:"))); + u_dx_text = new YUVShiftIText(this, plugin, + 0, &plugin->config.u_dx, (x + x2), y, -MAXVALUE, MAXVALUE); + u_dx_text->create_objects(); + u_dx_slider = new YUVShiftISlider(plugin, + u_dx_text, &plugin->config.u_dx, x3, y); + add_subwindow(u_dx_slider); + u_dx_text->slider = u_dx_slider; + add_subwindow(u_dx_Clr = new YUVShiftClr(plugin, this, clr_x, y, RESET_U_DX)); y += ys30; - add_subwindow(new BC_Title(x, y, _("U_dy:"))); - add_subwindow(u_dy = new YUVShiftLevel(plugin, &plugin->config.u_dy, x1, y)); - add_subwindow(u_dyClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_U_DY)); + add_subwindow(new BC_Title(x, y, _("U_dy:"))); + u_dy_text = new YUVShiftIText(this, plugin, + 0, &plugin->config.u_dy, (x + x2), y, -MAXVALUE, MAXVALUE); + u_dy_text->create_objects(); + u_dy_slider = new YUVShiftISlider(plugin, + u_dy_text, &plugin->config.u_dy, x3, y); + add_subwindow(u_dy_slider); + u_dy_text->slider = u_dy_slider; + add_subwindow(u_dy_Clr = new YUVShiftClr(plugin, this, clr_x, y, RESET_U_DY)); y += ys30; - add_subwindow(new BC_Title(x, y, _("V_dx:"))); - add_subwindow(v_dx = new YUVShiftLevel(plugin, &plugin->config.v_dx, x1, y)); - add_subwindow(v_dxClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_V_DX)); + add_subwindow(new BC_Title(x, y, _("V_dx:"))); + v_dx_text = new YUVShiftIText(this, plugin, + 0, &plugin->config.v_dx, (x + x2), y, -MAXVALUE, MAXVALUE); + v_dx_text->create_objects(); + v_dx_slider = new YUVShiftISlider(plugin, + v_dx_text, &plugin->config.v_dx, x3, y); + add_subwindow(v_dx_slider); + v_dx_text->slider = v_dx_slider; + add_subwindow(v_dx_Clr = new YUVShiftClr(plugin, this, clr_x, y, RESET_V_DX)); y += ys30; - add_subwindow(new BC_Title(x, y, _("V_dy:"))); - add_subwindow(v_dy = new YUVShiftLevel(plugin, &plugin->config.v_dy, x1, y)); - add_subwindow(v_dyClr = new YUVShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_V_DY)); + add_subwindow(new BC_Title(x, y, _("V_dy:"))); + v_dy_text = new YUVShiftIText(this, plugin, + 0, &plugin->config.v_dy, (x + x2), y, -MAXVALUE, MAXVALUE); + v_dy_text->create_objects(); + v_dy_slider = new YUVShiftISlider(plugin, + v_dy_text, &plugin->config.v_dy, x3, y); + add_subwindow(v_dy_slider); + v_dy_text->slider = v_dy_slider; + add_subwindow(v_dy_Clr = new YUVShiftClr(plugin, this, clr_x, y, RESET_V_DY)); y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new YUVShiftReset(plugin, this, x, y)); show_window(); @@ -206,26 +281,44 @@ void YUVShiftWindow::create_objects() void YUVShiftWindow::update_gui(int clear) { switch(clear) { - case RESET_Y_DX : y_dx->update(plugin->config.y_dx); + case RESET_Y_DX : + y_dx_text->update((int64_t)plugin->config.y_dx); + y_dx_slider->update(plugin->config.y_dx); break; - case RESET_Y_DY : y_dy->update(plugin->config.y_dy); + case RESET_Y_DY : + y_dy_text->update((int64_t)plugin->config.y_dy); + y_dy_slider->update(plugin->config.y_dy); break; - case RESET_U_DX : u_dx->update(plugin->config.u_dx); + case RESET_U_DX : + u_dx_text->update((int64_t)plugin->config.u_dx); + u_dx_slider->update(plugin->config.u_dx); break; - case RESET_U_DY : u_dy->update(plugin->config.u_dy); + case RESET_U_DY : + u_dy_text->update((int64_t)plugin->config.u_dy); + u_dy_slider->update(plugin->config.u_dy); break; - case RESET_V_DX : v_dx->update(plugin->config.v_dx); + case RESET_V_DX : + v_dx_text->update((int64_t)plugin->config.v_dx); + v_dx_slider->update(plugin->config.v_dx); break; - case RESET_V_DY : v_dy->update(plugin->config.v_dy); + case RESET_V_DY : + v_dy_text->update((int64_t)plugin->config.v_dy); + v_dy_slider->update(plugin->config.v_dy); break; case RESET_ALL : default: - y_dx->update(plugin->config.y_dx); - y_dy->update(plugin->config.y_dy); - u_dx->update(plugin->config.u_dx); - u_dy->update(plugin->config.u_dy); - v_dx->update(plugin->config.v_dx); - v_dy->update(plugin->config.v_dy); + y_dx_text->update((int64_t)plugin->config.y_dx); + y_dx_slider->update(plugin->config.y_dx); + y_dy_text->update((int64_t)plugin->config.y_dy); + y_dy_slider->update(plugin->config.y_dy); + u_dx_text->update((int64_t)plugin->config.u_dx); + u_dx_slider->update(plugin->config.u_dx); + u_dy_text->update((int64_t)plugin->config.u_dy); + u_dy_slider->update(plugin->config.u_dy); + v_dx_text->update((int64_t)plugin->config.v_dx); + v_dx_slider->update(plugin->config.v_dx); + v_dy_text->update((int64_t)plugin->config.v_dy); + v_dy_slider->update(plugin->config.v_dy); break; } } @@ -259,12 +352,18 @@ void YUVShiftEffect::update_gui() YUVShiftWindow *yuv_wdw = (YUVShiftWindow*)thread->window; yuv_wdw->lock_window("YUVShiftEffect::update_gui"); load_configuration(); - yuv_wdw->y_dx->update(config.y_dx); - yuv_wdw->y_dy->update(config.y_dy); - yuv_wdw->u_dx->update(config.u_dx); - yuv_wdw->u_dy->update(config.u_dy); - yuv_wdw->v_dx->update(config.v_dx); - yuv_wdw->v_dy->update(config.v_dy); + yuv_wdw->y_dx_text->update((int64_t)config.y_dx); + yuv_wdw->y_dx_slider->update(config.y_dx); + yuv_wdw->y_dy_text->update((int64_t)config.y_dy); + yuv_wdw->y_dy_slider->update(config.y_dy); + yuv_wdw->u_dx_text->update((int64_t)config.u_dx); + yuv_wdw->u_dx_slider->update(config.u_dx); + yuv_wdw->u_dy_text->update((int64_t)config.u_dy); + yuv_wdw->u_dy_slider->update(config.u_dy); + yuv_wdw->v_dx_text->update((int64_t)config.v_dx); + yuv_wdw->v_dx_slider->update(config.v_dx); + yuv_wdw->v_dy_text->update((int64_t)config.v_dy); + yuv_wdw->v_dy_slider->update(config.v_dy); yuv_wdw->unlock_window(); } } diff --git a/cinelerra-5.1/plugins/yuvshift/yuvshift.h b/cinelerra-5.1/plugins/yuvshift/yuvshift.h index b6dfae8b..6beac1a5 100644 --- a/cinelerra-5.1/plugins/yuvshift/yuvshift.h +++ b/cinelerra-5.1/plugins/yuvshift/yuvshift.h @@ -36,6 +36,8 @@ #include #include +#define MAXVALUE 100 + #define RESET_ALL 0 #define RESET_Y_DX 1 #define RESET_Y_DY 2 @@ -46,8 +48,10 @@ class YUVShiftEffect; class YUVShiftWindow; +class YUVShiftIText; +class YUVShiftISlider; class YUVShiftReset; -class YUVShiftSliderClr; +class YUVShiftClr; class YUVShiftConfig @@ -67,12 +71,27 @@ public: int y_dx, y_dy, u_dx, u_dy, v_dx, v_dy; }; -class YUVShiftLevel : public BC_ISlider +class YUVShiftIText : public BC_TumbleTextBox { public: - YUVShiftLevel(YUVShiftEffect *plugin, int *output, int x, int y); + YUVShiftIText(YUVShiftWindow *window, YUVShiftEffect *plugin, + YUVShiftISlider *slider, int *output, int x, int y, int min, int max); + ~YUVShiftIText(); int handle_event(); + YUVShiftWindow *window; YUVShiftEffect *plugin; + YUVShiftISlider *slider; + int *output; + int min, max; +}; + +class YUVShiftISlider : public BC_ISlider +{ +public: + YUVShiftISlider(YUVShiftEffect *plugin, YUVShiftIText *text, int *output, int x, int y); + int handle_event(); + YUVShiftEffect *plugin; + YUVShiftIText *text; int *output; }; @@ -86,11 +105,11 @@ public: YUVShiftWindow *window; }; -class YUVShiftSliderClr : public BC_Button +class YUVShiftClr : public BC_Button { public: - YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear); - ~YUVShiftSliderClr(); + YUVShiftClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int clear); + ~YUVShiftClr(); int handle_event(); YUVShiftEffect *plugin; YUVShiftWindow *window; @@ -103,12 +122,30 @@ public: YUVShiftWindow(YUVShiftEffect *plugin); void create_objects(); void update_gui(int clear); - YUVShiftLevel *y_dx, *y_dy, *u_dx, *u_dy, *v_dx, *v_dy; + + YUVShiftIText *y_dx_text; + YUVShiftISlider *y_dx_slider; + YUVShiftClr *y_dx_Clr; + YUVShiftIText *y_dy_text; + YUVShiftISlider *y_dy_slider; + YUVShiftClr *y_dy_Clr; + + YUVShiftIText *u_dx_text; + YUVShiftISlider *u_dx_slider; + YUVShiftClr *u_dx_Clr; + YUVShiftIText *u_dy_text; + YUVShiftISlider *u_dy_slider; + YUVShiftClr *u_dy_Clr; + + YUVShiftIText *v_dx_text; + YUVShiftISlider *v_dx_slider; + YUVShiftClr *v_dx_Clr; + YUVShiftIText *v_dy_text; + YUVShiftISlider *v_dy_slider; + YUVShiftClr *v_dy_Clr; + YUVShiftEffect *plugin; YUVShiftReset *reset; - YUVShiftSliderClr *y_dxClr, *y_dyClr; - YUVShiftSliderClr *u_dxClr, *u_dyClr; - YUVShiftSliderClr *v_dxClr, *v_dyClr; }; diff --git a/cinelerra-5.1/plugins/zoomblur/zoomblur.C b/cinelerra-5.1/plugins/zoomblur/zoomblur.C index e93c100c..1c64d7bc 100644 --- a/cinelerra-5.1/plugins/zoomblur/zoomblur.C +++ b/cinelerra-5.1/plugins/zoomblur/zoomblur.C @@ -37,8 +37,8 @@ void ZoomBlurConfig::reset(int clear) { switch(clear) { case RESET_ALL : - x = xS(50); - y = yS(50); + x = 50; + y = 50; radius = 0; steps = 1; r = 1; @@ -46,9 +46,9 @@ void ZoomBlurConfig::reset(int clear) b = 1; a = 1; break; - case RESET_XSLIDER : x = xS(50); + case RESET_XSLIDER : x = 50; break; - case RESET_YSLIDER : y = yS(50); + case RESET_YSLIDER : y = 50; break; case RESET_RADIUS : radius = 0; break; @@ -56,8 +56,8 @@ void ZoomBlurConfig::reset(int clear) break; case RESET_DEFAULT_SETTINGS : default: - x = xS(50); - y = yS(50); + x = 50; + y = 50; radius = 10; steps = 10; r = 1; @@ -124,10 +124,10 @@ void ZoomBlurConfig::interpolate(ZoomBlurConfig &prev, ZoomBlurWindow::ZoomBlurWindow(ZoomBlurMain *plugin) : PluginClientWindow(plugin, - xS(280), - yS(370), - xS(280), - yS(370), + xS(420), + yS(230), + xS(420), + yS(230), 0) { this->plugin = plugin; @@ -139,48 +139,80 @@ ZoomBlurWindow::~ZoomBlurWindow() void ZoomBlurWindow::create_objects() { - int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100); - int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(40); + int xs10 = xS(10), xs100 = xS(100), xs200 = xS(200); + int ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); int x = xs10, y = ys10; - int x1 = 0; int clrBtn_w = xs50; + int x2 = xS(80), x3 = xS(180); + int clr_x = get_w()-x - xS(22); // note: clrBtn_w = 22 int defaultBtn_w = xs100; - add_subwindow(new BC_Title(x, y, _("X:"))); - y += ys20; - add_subwindow(this->x = new ZoomBlurSize(plugin, x, y, &plugin->config.x, 0, 100)); - x1 = x + this->x->get_w() + xs10; - add_subwindow(xClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_XSLIDER)); + BC_Bar *bar; + y += ys10; + add_subwindow(new BC_Title(x, y, _("X:"))); + x_text = new ZoomBlurIText(this, plugin, + 0, &plugin->config.x, (x + x2), y, XY_MIN, XY_MAX); + x_text->create_objects(); + x_slider = new ZoomBlurISlider(plugin, + x_text, &plugin->config.x, x3, y, XY_MIN, XY_MAX, xs200); + add_subwindow(x_slider); + x_text->slider = x_slider; + clr_x = x3 + x_slider->get_w() + x; + add_subwindow(x_Clr = new ZoomBlurClr(plugin, this, clr_x, y, RESET_XSLIDER)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Y:"))); - y += ys20; - add_subwindow(this->y = new ZoomBlurSize(plugin, x, y, &plugin->config.y, 0, 100)); - add_subwindow(yClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_YSLIDER)); + add_subwindow(new BC_Title(x, y, _("Y:"))); + y_text = new ZoomBlurIText(this, plugin, + 0, &plugin->config.y, (x + x2), y, XY_MIN, XY_MAX); + y_text->create_objects(); + y_slider = new ZoomBlurISlider(plugin, + y_text, &plugin->config.y, x3, y, XY_MIN, XY_MAX, xs200); + add_subwindow(y_slider); + y_text->slider = y_slider; + add_subwindow(y_Clr = new ZoomBlurClr(plugin, this, clr_x, y, RESET_YSLIDER)); y += ys30; - add_subwindow(new BC_Title(x, y, _("Radius:"))); - y += ys20; - add_subwindow(radius = new ZoomBlurSize(plugin, x, y, &plugin->config.radius, -100, 100)); - add_subwindow(radiusClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_RADIUS)); + add_subwindow(new BC_Title(x, y, _("Radius:"))); + radius_text = new ZoomBlurIText(this, plugin, + 0, &plugin->config.radius, (x + x2), y, -RADIUS_MAX, RADIUS_MAX); + radius_text->create_objects(); + radius_slider = new ZoomBlurISlider(plugin, + radius_text, &plugin->config.radius, x3, y, -RADIUS_MAX, RADIUS_MAX, xs200); + add_subwindow(radius_slider); + radius_text->slider = radius_slider; + add_subwindow(radius_Clr = new ZoomBlurClr(plugin, this, clr_x, y, RESET_RADIUS)); y += ys30; + add_subwindow(new BC_Title(x, y, _("Steps:"))); - y += ys20; - add_subwindow(steps = new ZoomBlurSize(plugin, x, y, &plugin->config.steps, 1, 100)); - add_subwindow(stepsClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_STEPS)); + steps_text = new ZoomBlurIText(this, plugin, + 0, &plugin->config.steps, (x + x2), y, STEPS_MIN, STEPS_MAX); + steps_text->create_objects(); + steps_slider = new ZoomBlurISlider(plugin, + steps_text, &plugin->config.steps, x3, y, STEPS_MIN, STEPS_MAX, xs200); + add_subwindow(steps_slider); + steps_text->slider = steps_slider; + add_subwindow(steps_Clr = new ZoomBlurClr(plugin, this, clr_x, y, RESET_STEPS)); + y += ys40; + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; + int x1 = x; + int toggle_w = (get_w()-2*x) / 4; + add_subwindow(r = new ZoomBlurToggle(plugin, x1, y, &plugin->config.r, _("Red"))); + x1 += toggle_w; + add_subwindow(g = new ZoomBlurToggle(plugin, x1, y, &plugin->config.g, _("Green"))); + x1 += toggle_w; + add_subwindow(b = new ZoomBlurToggle(plugin, x1, y, &plugin->config.b, _("Blue"))); + x1 += toggle_w; + add_subwindow(a = new ZoomBlurToggle(plugin, x1, y, &plugin->config.a, _("Alpha"))); y += ys30; - add_subwindow(r = new ZoomBlurToggle(plugin, x, y, &plugin->config.r, _("Red"))); - y += ys30; - add_subwindow(g = new ZoomBlurToggle(plugin, x, y, &plugin->config.g, _("Green"))); - y += ys30; - add_subwindow(b = new ZoomBlurToggle(plugin, x, y, &plugin->config.b, _("Blue"))); - y += ys30; - add_subwindow(a = new ZoomBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha"))); - y += ys40; + +// Reset section + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += ys10; add_subwindow(reset = new ZoomBlurReset(plugin, this, x, y)); add_subwindow(default_settings = new ZoomBlurDefaultSettings(plugin, this, - (xS(280) - xS(10) - defaultBtn_w), y, defaultBtn_w)); + (get_w() - xs10 - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); @@ -190,21 +222,33 @@ void ZoomBlurWindow::create_objects() void ZoomBlurWindow::update_gui(int clear) { switch(clear) { - case RESET_XSLIDER : this->x->update(plugin->config.x); + case RESET_XSLIDER : + x_text->update((int64_t)plugin->config.x); + x_slider->update(plugin->config.x); break; - case RESET_YSLIDER : this->y->update(plugin->config.y); + case RESET_YSLIDER : + y_text->update((int64_t)plugin->config.y); + y_slider->update(plugin->config.y); break; - case RESET_RADIUS : radius->update(plugin->config.radius); + case RESET_RADIUS : + radius_text->update((int64_t)plugin->config.radius); + radius_slider->update(plugin->config.radius); break; - case RESET_STEPS : steps->update(plugin->config.steps); + case RESET_STEPS : + steps_text->update((int64_t)plugin->config.steps); + steps_slider->update(plugin->config.steps); break; case RESET_ALL : case RESET_DEFAULT_SETTINGS : default: - this->x->update(plugin->config.x); - this->y->update(plugin->config.x); - radius->update(plugin->config.radius); - steps->update(plugin->config.steps); + x_text->update((int64_t)plugin->config.x); + x_slider->update(plugin->config.x); + y_text->update((int64_t)plugin->config.y); + y_slider->update(plugin->config.y); + radius_text->update((int64_t)plugin->config.radius); + radius_slider->update(plugin->config.radius); + steps_text->update((int64_t)plugin->config.steps); + steps_slider->update(plugin->config.steps); r->update(plugin->config.r); g->update(plugin->config.g); b->update(plugin->config.b); @@ -241,25 +285,53 @@ int ZoomBlurToggle::handle_event() } +ZoomBlurIText::ZoomBlurIText(ZoomBlurWindow *window, ZoomBlurMain *plugin, + ZoomBlurISlider *slider, int *output, int x, int y, int min, int max) + : BC_TumbleTextBox(window, *output, + min, max, x, y, xS(60), 0) +{ + this->window = window; + this->plugin = plugin; + this->output = output; + this->slider = slider; + this->min = min; + this->max = max; + set_increment(1); +} +ZoomBlurIText::~ZoomBlurIText() +{ +} +int ZoomBlurIText::handle_event() +{ + *output = atoi(get_text()); + if(*output > max) *output = max; + if(*output < min) *output = min; + slider->update(*output); + plugin->send_configure_change(); + return 1; +} - -ZoomBlurSize::ZoomBlurSize(ZoomBlurMain *plugin, - int x, - int y, - int *output, - int min, - int max) - : BC_ISlider(x, y, 0, xS(200), yS(200), min, max, *output) +ZoomBlurISlider::ZoomBlurISlider(ZoomBlurMain *plugin, + ZoomBlurIText *text, int *output, int x, int y, int min, int max, int w) + : BC_ISlider(x, y, 0, w, w, min, max, *output) { this->plugin = plugin; this->output = output; + this->text = text; + enable_show_value(0); // Hide caption } -int ZoomBlurSize::handle_event() + +ZoomBlurISlider::~ZoomBlurISlider() +{ +} + +int ZoomBlurISlider::handle_event() { *output = get_value(); + text->update((int64_t)*output); plugin->send_configure_change(); return 1; } @@ -301,17 +373,17 @@ int ZoomBlurDefaultSettings::handle_event() } -ZoomBlurSliderClr::ZoomBlurSliderClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w, int clear) - : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +ZoomBlurClr::ZoomBlurClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int clear) + : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button")) { this->plugin = plugin; this->window = window; this->clear = clear; } -ZoomBlurSliderClr::~ZoomBlurSliderClr() +ZoomBlurClr::~ZoomBlurClr() { } -int ZoomBlurSliderClr::handle_event() +int ZoomBlurClr::handle_event() { // clear==1 ==> X slider // clear==2 ==> Y slider @@ -537,10 +609,14 @@ void ZoomBlurMain::update_gui() { load_configuration(); thread->window->lock_window(); - ((ZoomBlurWindow*)thread->window)->x->update(config.x); - ((ZoomBlurWindow*)thread->window)->y->update(config.y); - ((ZoomBlurWindow*)thread->window)->radius->update(config.radius); - ((ZoomBlurWindow*)thread->window)->steps->update(config.steps); + ((ZoomBlurWindow*)thread->window)->x_text->update((int64_t)config.x); + ((ZoomBlurWindow*)thread->window)->x_slider->update(config.x); + ((ZoomBlurWindow*)thread->window)->y_text->update((int64_t)config.y); + ((ZoomBlurWindow*)thread->window)->y_slider->update(config.y); + ((ZoomBlurWindow*)thread->window)->radius_text->update((int64_t)config.radius); + ((ZoomBlurWindow*)thread->window)->radius_slider->update(config.radius); + ((ZoomBlurWindow*)thread->window)->steps_text->update((int64_t)config.steps); + ((ZoomBlurWindow*)thread->window)->steps_slider->update(config.steps); ((ZoomBlurWindow*)thread->window)->r->update(config.r); ((ZoomBlurWindow*)thread->window)->g->update(config.g); ((ZoomBlurWindow*)thread->window)->b->update(config.b); diff --git a/cinelerra-5.1/plugins/zoomblur/zoomblur.h b/cinelerra-5.1/plugins/zoomblur/zoomblur.h index cd78677f..6338f5c0 100644 --- a/cinelerra-5.1/plugins/zoomblur/zoomblur.h +++ b/cinelerra-5.1/plugins/zoomblur/zoomblur.h @@ -42,12 +42,21 @@ #define RESET_RADIUS 3 #define RESET_STEPS 4 +#define XY_MIN 0 +#define XY_MAX 100 +#define RADIUS_MAX 100 +#define STEPS_MIN 1 +#define STEPS_MAX 100 + class ZoomBlurMain; class ZoomBlurWindow; class ZoomBlurEngine; +class ZoomBlurIText; +class ZoomBlurISlider; +class ZoomBlurToggle; class ZoomBlurReset; class ZoomBlurDefaultSettings; -class ZoomBlurSliderClr; +class ZoomBlurClr; @@ -77,17 +86,31 @@ public: -class ZoomBlurSize : public BC_ISlider + +class ZoomBlurIText : public BC_TumbleTextBox { public: - ZoomBlurSize(ZoomBlurMain *plugin, - int x, - int y, - int *output, - int min, - int max); + ZoomBlurIText(ZoomBlurWindow *window, ZoomBlurMain *plugin, + ZoomBlurISlider *slider, int *output, int x, int y, int min, int max); + ~ZoomBlurIText(); int handle_event(); + ZoomBlurWindow *window; ZoomBlurMain *plugin; + ZoomBlurISlider *slider; + int *output; + int min, max; +}; + +class ZoomBlurISlider : public BC_ISlider +{ +public: + ZoomBlurISlider(ZoomBlurMain *plugin, + ZoomBlurIText *text, int *output, int x, int y, + int min, int max, int w); + ~ZoomBlurISlider(); + int handle_event(); + ZoomBlurMain *plugin; + ZoomBlurIText *text; int *output; }; @@ -113,12 +136,26 @@ public: void create_objects(); void update_gui(int clear); - ZoomBlurSize *x, *y, *radius, *steps; + ZoomBlurIText *x_text; + ZoomBlurISlider *x_slider; + ZoomBlurClr *x_Clr; + + ZoomBlurIText *y_text; + ZoomBlurISlider *y_slider; + ZoomBlurClr *y_Clr; + + ZoomBlurIText *radius_text; + ZoomBlurISlider *radius_slider; + ZoomBlurClr *radius_Clr; + + ZoomBlurIText *steps_text; + ZoomBlurISlider *steps_slider; + ZoomBlurClr *steps_Clr; + ZoomBlurToggle *r, *g, *b, *a; ZoomBlurMain *plugin; ZoomBlurReset *reset; ZoomBlurDefaultSettings *default_settings; - ZoomBlurSliderClr *xClr, *yClr, *radiusClr, *stepsClr; }; class ZoomBlurReset : public BC_GenericButton @@ -142,11 +179,11 @@ public: }; -class ZoomBlurSliderClr : public BC_Button +class ZoomBlurClr : public BC_Button { public: - ZoomBlurSliderClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w, int clear); - ~ZoomBlurSliderClr(); + ZoomBlurClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int clear); + ~ZoomBlurClr(); int handle_event(); ZoomBlurMain *plugin; ZoomBlurWindow *window; -- 2.26.2