4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "bcdisplayinfo.h"
25 #include "unsharpwindow.h"
36 UnsharpWindow::UnsharpWindow(UnsharpMain *plugin)
37 : PluginClientWindow(plugin, 285, 170, 285, 170, 0)
39 this->plugin = plugin;
42 UnsharpWindow::~UnsharpWindow()
46 void UnsharpWindow::create_objects()
48 int x = 10, y = 10, x1 = 90;
51 add_subwindow(title = new BC_Title(x, y + 10, _("Radius:")));
52 add_subwindow(radius = new UnsharpRadius(plugin, x + x1, y));
55 add_subwindow(title = new BC_Title(x, y + 10, _("Amount:")));
56 add_subwindow(amount = new UnsharpAmount(plugin, x + x1, y));
59 add_subwindow(title = new BC_Title(x, y + 10, _("Threshold:")));
60 add_subwindow(threshold = new UnsharpThreshold(plugin, x + x1, y));
63 add_subwindow(reset = new UnsharpReset(plugin, this, x, y));
70 void UnsharpWindow::update()
72 radius->update(plugin->config.radius);
73 amount->update(plugin->config.amount);
74 threshold->update(plugin->config.threshold);
86 UnsharpRadius::UnsharpRadius(UnsharpMain *plugin, int x, int y)
87 : BC_FPot(x, y, plugin->config.radius, 0.1, 120)
89 this->plugin = plugin;
91 int UnsharpRadius::handle_event()
93 plugin->config.radius = get_value();
94 plugin->send_configure_change();
98 UnsharpAmount::UnsharpAmount(UnsharpMain *plugin, int x, int y)
99 : BC_FPot(x, y, plugin->config.amount, 0, 5)
101 this->plugin = plugin;
103 int UnsharpAmount::handle_event()
105 plugin->config.amount = get_value();
106 plugin->send_configure_change();
110 UnsharpThreshold::UnsharpThreshold(UnsharpMain *plugin, int x, int y)
111 : BC_IPot(x, y, plugin->config.threshold, 0, 255)
113 this->plugin = plugin;
115 int UnsharpThreshold::handle_event()
117 plugin->config.threshold = get_value();
118 plugin->send_configure_change();
122 UnsharpReset::UnsharpReset(UnsharpMain *plugin, UnsharpWindow *window, int x, int y)
123 : BC_GenericButton(x, y, _("Reset"))
125 this->plugin = plugin;
126 this->window = window;
128 UnsharpReset::~UnsharpReset()
131 int UnsharpReset::handle_event()
133 plugin->config.reset();
135 plugin->send_configure_change();