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"
24 #include "sharpenwindow.h"
35 SharpenWindow::SharpenWindow(SharpenMain *client)
36 : PluginClientWindow(client, xS(280), yS(190), xS(280), yS(190), 0) //195 was 150
38 this->client = client;
41 SharpenWindow::~SharpenWindow()
45 void SharpenWindow::create_objects()
47 int xs10 = xS(10), xs50 = xS(50), xs100 = xS(100);
48 int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(40);
49 int x = xs10, y = ys10;
50 int x1 = 0; int clrBtn_w = xs50;
51 int defaultBtn_w = xs100;
53 add_tool(new BC_Title(x, y, _("Sharpness")));
55 add_tool(sharpen_slider = new SharpenSlider(client, &(client->config.sharpness), x, y));
56 x1 = x + sharpen_slider->get_w() + xs10;
57 add_subwindow(sharpen_sliderClr = new SharpenSliderClr(client, this, x1, y, clrBtn_w));
60 add_tool(sharpen_interlace = new SharpenInterlace(client, x, y));
62 add_tool(sharpen_horizontal = new SharpenHorizontal(client, x, y));
64 add_tool(sharpen_luminance = new SharpenLuminance(client, x, y));
66 add_tool(reset = new SharpenReset(client, this, x, y));
67 add_subwindow(default_settings = new SharpenDefaultSettings(client, this,
68 (xS(280) - xs10 - defaultBtn_w), y, defaultBtn_w));
74 void SharpenWindow::update_gui(int clear)
77 case RESET_SHARPEN_SLIDER :
78 sharpen_slider->update(client->config.sharpness);
81 case RESET_DEFAULT_SETTINGS :
83 sharpen_slider->update(client->config.sharpness);
84 sharpen_interlace->update(client->config.interlace);
85 sharpen_horizontal->update(client->config.horizontal);
86 sharpen_luminance->update(client->config.luminance);
91 SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y)
104 this->client = client;
105 this->output = output;
107 SharpenSlider::~SharpenSlider()
110 int SharpenSlider::handle_event()
112 *output = get_value();
113 client->send_configure_change();
118 SharpenInterlace::SharpenInterlace(SharpenMain *client, int x, int y)
119 : BC_CheckBox(x, y, client->config.interlace, _("Interlace"))
121 this->client = client;
123 SharpenInterlace::~SharpenInterlace()
126 int SharpenInterlace::handle_event()
128 client->config.interlace = get_value();
129 client->send_configure_change();
134 SharpenHorizontal::SharpenHorizontal(SharpenMain *client, int x, int y)
135 : BC_CheckBox(x, y, client->config.horizontal, _("Horizontal only"))
137 this->client = client;
139 SharpenHorizontal::~SharpenHorizontal()
142 int SharpenHorizontal::handle_event()
144 client->config.horizontal = get_value();
145 client->send_configure_change();
150 SharpenLuminance::SharpenLuminance(SharpenMain *client, int x, int y)
151 : BC_CheckBox(x, y, client->config.luminance, _("Luminance only"))
153 this->client = client;
155 SharpenLuminance::~SharpenLuminance()
158 int SharpenLuminance::handle_event()
160 client->config.luminance = get_value();
161 client->send_configure_change();
166 SharpenReset::SharpenReset(SharpenMain *client, SharpenWindow *gui, int x, int y)
167 : BC_GenericButton(x, y, _("Reset"))
169 this->client = client;
172 SharpenReset::~SharpenReset()
175 int SharpenReset::handle_event()
177 client->config.reset(RESET_ALL);
178 gui->update_gui(RESET_ALL);
179 client->send_configure_change();
184 SharpenDefaultSettings::SharpenDefaultSettings(SharpenMain *client, SharpenWindow *gui, int x, int y, int w)
185 : BC_GenericButton(x, y, w, _("Default"))
187 this->client = client;
190 SharpenDefaultSettings::~SharpenDefaultSettings()
193 int SharpenDefaultSettings::handle_event()
195 client->config.reset(RESET_DEFAULT_SETTINGS);
196 gui->update_gui(RESET_DEFAULT_SETTINGS);
197 client->send_configure_change();
202 SharpenSliderClr::SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w)
203 : BC_Button(x, y, w, client->get_theme()->get_image_set("reset_button"))
205 this->client = client;
208 SharpenSliderClr::~SharpenSliderClr()
211 int SharpenSliderClr::handle_event()
213 client->config.reset(RESET_SHARPEN_SLIDER);
214 gui->update_gui(RESET_SHARPEN_SLIDER);
215 client->send_configure_change();