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"
23 #include "sharpenwindow.h"
26 #define _(String) gettext(String)
27 #define gettext_noop(String) String
28 #define N_(String) gettext_noop (String)
31 SharpenThread::SharpenThread(SharpenMain *client)
34 this->client = client;
40 SharpenThread::~SharpenThread()
42 // Window always deleted here
46 void SharpenThread::run()
49 window = new SharpenWindow(client,
50 info.get_abs_cursor_x() - 105,
51 info.get_abs_cursor_y() - 60);
52 window->create_objects();
54 int result = window->run_window();
56 // Last command executed in thread
57 if(result) client->client_side_close();
65 SharpenWindow::SharpenWindow(SharpenMain *client, int x, int y)
66 : BC_Window(client->gui_string,
77 this->client = client;
80 SharpenWindow::~SharpenWindow()
84 int SharpenWindow::create_objects()
87 add_tool(new BC_Title(x, y, _("Sharpness")));
89 add_tool(sharpen_slider = new SharpenSlider(client, &(client->sharpness), x, y));
91 add_tool(sharpen_interlace = new SharpenInterlace(client, x, y));
93 add_tool(sharpen_horizontal = new SharpenHorizontal(client, x, y));
95 add_tool(sharpen_luminance = new SharpenLuminance(client, x, y));
101 int SharpenWindow::close_event()
103 // Set result to 1 to indicate a client side close
108 SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y)
121 this->client = client;
122 this->output = output;
124 SharpenSlider::~SharpenSlider()
127 int SharpenSlider::handle_event()
129 *output = get_value();
130 client->send_configure_change();
137 SharpenInterlace::SharpenInterlace(SharpenMain *client, int x, int y)
138 : BC_CheckBox(x, y, client->interlace, _("Interlace"))
140 this->client = client;
142 SharpenInterlace::~SharpenInterlace()
145 int SharpenInterlace::handle_event()
147 client->interlace = get_value();
148 client->send_configure_change();
155 SharpenHorizontal::SharpenHorizontal(SharpenMain *client, int x, int y)
156 : BC_CheckBox(x, y, client->horizontal, _("Horizontal only"))
158 this->client = client;
160 SharpenHorizontal::~SharpenHorizontal()
163 int SharpenHorizontal::handle_event()
165 client->horizontal = get_value();
166 client->send_configure_change();
172 SharpenLuminance::SharpenLuminance(SharpenMain *client, int x, int y)
173 : BC_CheckBox(x, y, client->luminance, _("Luminance only"))
175 this->client = client;
177 SharpenLuminance::~SharpenLuminance()
180 int SharpenLuminance::handle_event()
182 client->luminance = get_value();
183 client->send_configure_change();