#include <string.h>
#include "alpha.h"
+#include "theme.h"
#include "filexml.h"
#include "keyframe.h"
#include "language.h"
AlphaConfig::AlphaConfig()
+{
+ reset();
+}
+
+void AlphaConfig::reset()
{
a = 1.;
}
}
+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()
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)
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);
}
#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"
{
public:
AlphaConfig();
+ void reset();
int equivalent(AlphaConfig &that);
void copy_from(AlphaConfig &that);
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:
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
{
void update();
AlphaMain *plugin;
+ AlphaText *alpha_text;
AlphaSlider *alpha_slider;
+ AlphaClr *alpha_clr;
};
class AlphaMain : public PluginVClient
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();
}
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;
}
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();
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)
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;
}
#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
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];
BrightnessLuma(BrightnessMain *client, int x, int y);
~BrightnessLuma();
int handle_event();
-
BrightnessMain *client;
};
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
+/* 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;
}
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;
}
}
-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();
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();
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;
}
}
{
((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();
}
}
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
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];
};
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;
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;
};
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;
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();
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);
+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,
}
-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
{
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);
#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;
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:
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;
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;
};
#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
-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:
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;
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;
};
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;
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();
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;
}
}
-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"))
{
}
-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
{
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();
}
}
{
switch(clear) {
case RESET_ALL :
- x = xS(50);
- y = yS(50);
+ x = 50;
+ y = 50;
angle = 0;
steps = 1;
r = 1;
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;
break;
case RESET_DEFAULT_SETTINGS :
default:
- x = xS(50);
- y = yS(50);
+ x = 50;
+ y = 50;
angle = 33;
steps = 10;
r = 1;
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;
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();
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);
}
+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"))
{
}
-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
{
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);
#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;
+
};
+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;
};
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;
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;
};
-#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;
}
}
-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
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();
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;
}
}
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();
}
}
#include <stdint.h>
#include <string.h>
+#define MAXVALUE 100
+
#define RESET_ALL 0
#define RESET_R_DX 1
#define RESET_R_DY 2
class RGBShiftEffect;
class RGBShiftWindow;
+class RGBShiftIText;
+class RGBShiftISlider;
class RGBShiftReset;
-class RGBShiftSliderClr;
+class RGBShiftClr;
class RGBShiftConfig
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;
};
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;
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;
};
horizontal = 0;
luminance = 0;
break;
- case RESET_SHARPEN_SLIDER : sharpness = 0;
+ case RESET_SHARPEN : sharpness = 0;
break;
case RESET_DEFAULT_SETTINGS :
default:
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;
}
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));
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();
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);
}
}
-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;
}
}
-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;
}
#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
{
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
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;
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;
}
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();
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;
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;
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
#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:
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
}
-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"))
{
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
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;
}
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;
// 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();
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;
}
}
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();
}
}
#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
{
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
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;
// 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;
};
class WhirlEffect;
class WhirlWindow;
class WhirlEngine;
+class WhirlFText;
+class WhirlFSlider;
class WhirlReset;
class WhirlDefaultSettings;
-class WhirlSliderClr;
+class WhirlClr;
#define MAXRADIUS 100
#define MAXPINCH 100
#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
{
};
-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;
};
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;
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;
};
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;
}
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();
}
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;
}
}
-
-
-
-
-
-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"))
{
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
{
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();
}
}
#include <stdint.h>
#include <string.h>
+#define MAXVALUE 100
+
#define RESET_ALL 0
#define RESET_Y_SLIDER 1
#define RESET_U_SLIDER 2
class YUVEffect;
class YUVWindow;
+class YUVFText;
+class YUVFSlider;
class YUVReset;
-class YUVSliderClr;
+class YUVClr;
class YUVConfig
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:
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;
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;
};
-#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;
}
}
-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
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();
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;
}
}
{
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();
}
}
-#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;
}
}
-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
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();
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;
}
}
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();
}
}
#include <stdint.h>
#include <string.h>
+#define MAXVALUE 100
+
#define RESET_ALL 0
#define RESET_Y_DX 1
#define RESET_Y_DY 2
class YUVShiftEffect;
class YUVShiftWindow;
+class YUVShiftIText;
+class YUVShiftISlider;
class YUVShiftReset;
-class YUVShiftSliderClr;
+class YUVShiftClr;
class YUVShiftConfig
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;
};
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;
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;
};
{
switch(clear) {
case RESET_ALL :
- x = xS(50);
- y = yS(50);
+ x = 50;
+ y = 50;
radius = 0;
steps = 1;
r = 1;
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;
break;
case RESET_DEFAULT_SETTINGS :
default:
- x = xS(50);
- y = yS(50);
+ x = 50;
+ y = 50;
radius = 10;
steps = 10;
r = 1;
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;
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();
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);
}
+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;
}
}
-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
{
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);
#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;
-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;
};
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
};
-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;