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()
53 add_subwindow(new BC_Title(x, y, _("Blur")));
55 add_subwindow(horizontal = new BlurHorizontal(client, this, x, y));
57 add_subwindow(vertical = new BlurVertical(client, this, x, y));
59 add_subwindow(title = new BC_Title(x, y, _("Radius:")));
60 y += title->get_h() + 10;
61 add_subwindow(radius = new BlurRadius(client, this, x, y));
62 add_subwindow(radius_text = new BlurRadiusText(client, this, x + radius->get_w() + 10, y, 100));
63 y += radius->get_h() + 10;
64 add_subwindow(a_key = new BlurAKey(client, x, y));
66 add_subwindow(a = new BlurA(client, x, y));
68 add_subwindow(r = new BlurR(client, x, y));
70 add_subwindow(g = new BlurG(client, x, y));
72 add_subwindow(b = new BlurB(client, x, y));
74 add_subwindow(reset = new BlurReset(client, this, x, y));
81 void BlurWindow::update()
83 horizontal->update(client->config.horizontal);
84 vertical->update(client->config.vertical);
85 radius->update(client->config.radius);
86 radius_text->update((int64_t)client->config.radius);
87 a_key->update(client->config.a_key);
88 a->update(client->config.a);
89 r->update(client->config.r);
90 g->update(client->config.g);
91 b->update(client->config.b);
95 BlurRadius::BlurRadius(BlurMain *client, BlurWindow *gui, int x, int y)
98 client->config.radius,
102 this->client = client;
105 BlurRadius::~BlurRadius()
108 int BlurRadius::handle_event()
110 client->config.radius = get_value();
111 gui->radius_text->update((int64_t)client->config.radius);
112 client->send_configure_change();
119 BlurRadiusText::BlurRadiusText(BlurMain *client, BlurWindow *gui, int x, int y, int w)
124 client->config.radius)
126 this->client = client;
130 int BlurRadiusText::handle_event()
132 client->config.radius = atoi(get_text());
133 gui->radius->update((int64_t)client->config.radius);
134 client->send_configure_change();
141 BlurVertical::BlurVertical(BlurMain *client, BlurWindow *window, int x, int y)
144 client->config.vertical,
147 this->client = client;
148 this->window = window;
150 BlurVertical::~BlurVertical()
153 int BlurVertical::handle_event()
155 client->config.vertical = get_value();
156 client->send_configure_change();
160 BlurHorizontal::BlurHorizontal(BlurMain *client, BlurWindow *window, int x, int y)
163 client->config.horizontal,
166 this->client = client;
167 this->window = window;
169 BlurHorizontal::~BlurHorizontal()
172 int BlurHorizontal::handle_event()
174 client->config.horizontal = get_value();
175 client->send_configure_change();
182 BlurA::BlurA(BlurMain *client, int x, int y)
183 : BC_CheckBox(x, y, client->config.a, _("Blur alpha"))
185 this->client = client;
187 int BlurA::handle_event()
189 client->config.a = get_value();
190 client->send_configure_change();
197 BlurAKey::BlurAKey(BlurMain *client, int x, int y)
198 : BC_CheckBox(x, y, client->config.a_key, _("Alpha determines radius"))
200 this->client = client;
202 int BlurAKey::handle_event()
204 client->config.a_key = get_value();
205 client->send_configure_change();
209 BlurR::BlurR(BlurMain *client, int x, int y)
210 : BC_CheckBox(x, y, client->config.r, _("Blur red"))
212 this->client = client;
214 int BlurR::handle_event()
216 client->config.r = get_value();
217 client->send_configure_change();
221 BlurG::BlurG(BlurMain *client, int x, int y)
222 : BC_CheckBox(x, y, client->config.g, _("Blur green"))
224 this->client = client;
226 int BlurG::handle_event()
228 client->config.g = get_value();
229 client->send_configure_change();
233 BlurB::BlurB(BlurMain *client, int x, int y)
234 : BC_CheckBox(x, y, client->config.b, _("Blur blue"))
236 this->client = client;
238 int BlurB::handle_event()
240 client->config.b = get_value();
241 client->send_configure_change();
245 BlurReset::BlurReset(BlurMain *client, BlurWindow *window, int x, int y)
246 : BC_GenericButton(x, y, _("Reset"))
248 this->client = client;
249 this->window = window;
251 BlurReset::~BlurReset()
254 int BlurReset::handle_event()
256 client->config.reset();
258 client->send_configure_change();