4 * Copyright (C) 2010 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 "blurwindow.h"
32 BlurWindow::BlurWindow(BlurMain *client)
33 : PluginClientWindow(client,
40 this->client = client;
43 BlurWindow::~BlurWindow()
45 //printf("BlurWindow::~BlurWindow 1\n");
48 void BlurWindow::create_objects()
51 int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys35 = yS(35), ys40 = yS(40);
52 int x = xs10, y = ys10;
55 add_subwindow(new BC_Title(x, y, _("Blur")));
57 add_subwindow(horizontal = new BlurHorizontal(client, this, x, y));
59 add_subwindow(vertical = new BlurVertical(client, this, x, y));
61 add_subwindow(title = new BC_Title(x, y, _("Radius:")));
62 y += title->get_h() + ys10;
63 add_subwindow(radius = new BlurRadius(client, this, x, y));
64 add_subwindow(radius_text = new BlurRadiusText(client, this, x + radius->get_w() + xs10, y, 100));
65 y += radius->get_h() + ys10;
66 add_subwindow(a_key = new BlurAKey(client, x, y));
68 add_subwindow(a = new BlurA(client, x, y));
70 add_subwindow(r = new BlurR(client, x, y));
72 add_subwindow(g = new BlurG(client, x, y));
74 add_subwindow(b = new BlurB(client, x, y));
76 add_subwindow(reset = new BlurReset(client, this, x, y));
83 void BlurWindow::update()
85 horizontal->update(client->config.horizontal);
86 vertical->update(client->config.vertical);
87 radius->update(client->config.radius);
88 radius_text->update((int64_t)client->config.radius);
89 a_key->update(client->config.a_key);
90 a->update(client->config.a);
91 r->update(client->config.r);
92 g->update(client->config.g);
93 b->update(client->config.b);
97 BlurRadius::BlurRadius(BlurMain *client, BlurWindow *gui, int x, int y)
100 client->config.radius,
104 this->client = client;
107 BlurRadius::~BlurRadius()
110 int BlurRadius::handle_event()
112 client->config.radius = get_value();
113 gui->radius_text->update((int64_t)client->config.radius);
114 client->send_configure_change();
121 BlurRadiusText::BlurRadiusText(BlurMain *client, BlurWindow *gui, int x, int y, int w)
126 client->config.radius)
128 this->client = client;
132 int BlurRadiusText::handle_event()
134 client->config.radius = atoi(get_text());
135 gui->radius->update((int64_t)client->config.radius);
136 client->send_configure_change();
143 BlurVertical::BlurVertical(BlurMain *client, BlurWindow *window, int x, int y)
146 client->config.vertical,
149 this->client = client;
150 this->window = window;
152 BlurVertical::~BlurVertical()
155 int BlurVertical::handle_event()
157 client->config.vertical = get_value();
158 client->send_configure_change();
162 BlurHorizontal::BlurHorizontal(BlurMain *client, BlurWindow *window, int x, int y)
165 client->config.horizontal,
168 this->client = client;
169 this->window = window;
171 BlurHorizontal::~BlurHorizontal()
174 int BlurHorizontal::handle_event()
176 client->config.horizontal = get_value();
177 client->send_configure_change();
184 BlurA::BlurA(BlurMain *client, int x, int y)
185 : BC_CheckBox(x, y, client->config.a, _("Blur alpha"))
187 this->client = client;
189 int BlurA::handle_event()
191 client->config.a = get_value();
192 client->send_configure_change();
199 BlurAKey::BlurAKey(BlurMain *client, int x, int y)
200 : BC_CheckBox(x, y, client->config.a_key, _("Alpha determines radius"))
202 this->client = client;
204 int BlurAKey::handle_event()
206 client->config.a_key = get_value();
207 client->send_configure_change();
211 BlurR::BlurR(BlurMain *client, int x, int y)
212 : BC_CheckBox(x, y, client->config.r, _("Blur red"))
214 this->client = client;
216 int BlurR::handle_event()
218 client->config.r = get_value();
219 client->send_configure_change();
223 BlurG::BlurG(BlurMain *client, int x, int y)
224 : BC_CheckBox(x, y, client->config.g, _("Blur green"))
226 this->client = client;
228 int BlurG::handle_event()
230 client->config.g = get_value();
231 client->send_configure_change();
235 BlurB::BlurB(BlurMain *client, int x, int y)
236 : BC_CheckBox(x, y, client->config.b, _("Blur blue"))
238 this->client = client;
240 int BlurB::handle_event()
242 client->config.b = get_value();
243 client->send_configure_change();
247 BlurReset::BlurReset(BlurMain *client, BlurWindow *window, int x, int y)
248 : BC_GenericButton(x, y, _("Reset"))
250 this->client = client;
251 this->window = window;
253 BlurReset::~BlurReset()
256 int BlurReset::handle_event()
258 client->config.reset();
260 client->send_configure_change();