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, 280, 190, 280, 190, 0) //195 was 150
38 this->client = client;
41 SharpenWindow::~SharpenWindow()
45 void SharpenWindow::create_objects()
48 int x1 = 0; int clrBtn_w = 50;
49 int defaultBtn_w = 100;
51 add_tool(new BC_Title(x, y, _("Sharpness")));
53 add_tool(sharpen_slider = new SharpenSlider(client, &(client->config.sharpness), x, y));
54 x1 = x + sharpen_slider->get_w() + 10;
55 add_subwindow(sharpen_sliderClr = new SharpenSliderClr(client, this, x1, y, clrBtn_w));
58 add_tool(sharpen_interlace = new SharpenInterlace(client, x, y));
60 add_tool(sharpen_horizontal = new SharpenHorizontal(client, x, y));
62 add_tool(sharpen_luminance = new SharpenLuminance(client, x, y));
64 add_tool(reset = new SharpenReset(client, this, x, y));
65 add_subwindow(default_settings = new SharpenDefaultSettings(client, this,
66 (280 - 10 - defaultBtn_w), y, defaultBtn_w));
72 void SharpenWindow::update_gui(int clear)
75 case RESET_SHARPEN_SLIDER :
76 sharpen_slider->update(client->config.sharpness);
79 case RESET_DEFAULT_SETTINGS :
81 sharpen_slider->update(client->config.sharpness);
82 sharpen_interlace->update(client->config.interlace);
83 sharpen_horizontal->update(client->config.horizontal);
84 sharpen_luminance->update(client->config.luminance);
89 SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y)
102 this->client = client;
103 this->output = output;
105 SharpenSlider::~SharpenSlider()
108 int SharpenSlider::handle_event()
110 *output = get_value();
111 client->send_configure_change();
116 SharpenInterlace::SharpenInterlace(SharpenMain *client, int x, int y)
117 : BC_CheckBox(x, y, client->config.interlace, _("Interlace"))
119 this->client = client;
121 SharpenInterlace::~SharpenInterlace()
124 int SharpenInterlace::handle_event()
126 client->config.interlace = get_value();
127 client->send_configure_change();
132 SharpenHorizontal::SharpenHorizontal(SharpenMain *client, int x, int y)
133 : BC_CheckBox(x, y, client->config.horizontal, _("Horizontal only"))
135 this->client = client;
137 SharpenHorizontal::~SharpenHorizontal()
140 int SharpenHorizontal::handle_event()
142 client->config.horizontal = get_value();
143 client->send_configure_change();
148 SharpenLuminance::SharpenLuminance(SharpenMain *client, int x, int y)
149 : BC_CheckBox(x, y, client->config.luminance, _("Luminance only"))
151 this->client = client;
153 SharpenLuminance::~SharpenLuminance()
156 int SharpenLuminance::handle_event()
158 client->config.luminance = get_value();
159 client->send_configure_change();
164 SharpenReset::SharpenReset(SharpenMain *client, SharpenWindow *gui, int x, int y)
165 : BC_GenericButton(x, y, _("Reset"))
167 this->client = client;
170 SharpenReset::~SharpenReset()
173 int SharpenReset::handle_event()
175 client->config.reset(RESET_ALL);
176 gui->update_gui(RESET_ALL);
177 client->send_configure_change();
182 SharpenDefaultSettings::SharpenDefaultSettings(SharpenMain *client, SharpenWindow *gui, int x, int y, int w)
183 : BC_GenericButton(x, y, w, _("Default"))
185 this->client = client;
188 SharpenDefaultSettings::~SharpenDefaultSettings()
191 int SharpenDefaultSettings::handle_event()
193 client->config.reset(RESET_DEFAULT_SETTINGS);
194 gui->update_gui(RESET_DEFAULT_SETTINGS);
195 client->send_configure_change();
200 SharpenSliderClr::SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w)
201 : BC_Button(x, y, w, client->get_theme()->get_image_set("reset_button"))
203 this->client = client;
206 SharpenSliderClr::~SharpenSliderClr()
209 int SharpenSliderClr::handle_event()
211 client->config.reset(RESET_SHARPEN_SLIDER);
212 gui->update_gui(RESET_SHARPEN_SLIDER);
213 client->send_configure_change();