ZoomBlurWindow::ZoomBlurWindow(ZoomBlurMain *plugin)
: PluginClientWindow(plugin,
- 280,
- 370,
- 280,
- 370,
+ xS(420),
+ yS(230),
+ xS(420),
+ yS(230),
0)
{
this->plugin = plugin;
void ZoomBlurWindow::create_objects()
{
- int x = 10, y = 10;
- int x1 = 0; int clrBtn_w = 50;
- int defaultBtn_w = 100;
+ 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_Bar *bar;
+
+ y += ys10;
add_subwindow(new BC_Title(x, y, _("X:")));
- y += 20;
- add_subwindow(this->x = new ZoomBlurSize(plugin, x, y, &plugin->config.x, 0, 100));
- x1 = x + this->x->get_w() + 10;
- add_subwindow(xClr = new ZoomBlurSliderClr(plugin, this, x1, y, clrBtn_w, RESET_XSLIDER));
+ 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;
- y += 30;
add_subwindow(new BC_Title(x, y, _("Y:")));
- y += 20;
- 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));
+ 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;
- y += 30;
add_subwindow(new BC_Title(x, y, _("Radius:")));
- y += 20;
- 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));
+ 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;
- y += 30;
add_subwindow(new BC_Title(x, y, _("Steps:")));
- y += 20;
- 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));
-
- y += 30;
- add_subwindow(r = new ZoomBlurToggle(plugin, x, y, &plugin->config.r, _("Red")));
- y += 30;
- add_subwindow(g = new ZoomBlurToggle(plugin, x, y, &plugin->config.g, _("Green")));
- y += 30;
- add_subwindow(b = new ZoomBlurToggle(plugin, x, y, &plugin->config.b, _("Blue")));
- y += 30;
- add_subwindow(a = new ZoomBlurToggle(plugin, x, y, &plugin->config.a, _("Alpha")));
- y += 40;
+ 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;
+
+// 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,
- (280 - 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, 200, 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_GenericButton(x, y, w, _("⌂"))
+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);