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));
78 BlurRadius::BlurRadius(BlurMain *client, BlurWindow *gui, int x, int y)
81 client->config.radius,
85 this->client = client;
88 BlurRadius::~BlurRadius()
91 int BlurRadius::handle_event()
93 client->config.radius = get_value();
94 gui->radius_text->update((int64_t)client->config.radius);
95 client->send_configure_change();
102 BlurRadiusText::BlurRadiusText(BlurMain *client, BlurWindow *gui, int x, int y, int w)
107 client->config.radius)
109 this->client = client;
113 int BlurRadiusText::handle_event()
115 client->config.radius = atoi(get_text());
116 gui->radius->update((int64_t)client->config.radius);
117 client->send_configure_change();
124 BlurVertical::BlurVertical(BlurMain *client, BlurWindow *window, int x, int y)
127 client->config.vertical,
130 this->client = client;
131 this->window = window;
133 BlurVertical::~BlurVertical()
136 int BlurVertical::handle_event()
138 client->config.vertical = get_value();
139 client->send_configure_change();
143 BlurHorizontal::BlurHorizontal(BlurMain *client, BlurWindow *window, int x, int y)
146 client->config.horizontal,
149 this->client = client;
150 this->window = window;
152 BlurHorizontal::~BlurHorizontal()
155 int BlurHorizontal::handle_event()
157 client->config.horizontal = get_value();
158 client->send_configure_change();
165 BlurA::BlurA(BlurMain *client, int x, int y)
166 : BC_CheckBox(x, y, client->config.a, _("Blur alpha"))
168 this->client = client;
170 int BlurA::handle_event()
172 client->config.a = get_value();
173 client->send_configure_change();
180 BlurAKey::BlurAKey(BlurMain *client, int x, int y)
181 : BC_CheckBox(x, y, client->config.a_key, _("Alpha determines radius"))
183 this->client = client;
185 int BlurAKey::handle_event()
187 client->config.a_key = get_value();
188 client->send_configure_change();
192 BlurR::BlurR(BlurMain *client, int x, int y)
193 : BC_CheckBox(x, y, client->config.r, _("Blur red"))
195 this->client = client;
197 int BlurR::handle_event()
199 client->config.r = get_value();
200 client->send_configure_change();
204 BlurG::BlurG(BlurMain *client, int x, int y)
205 : BC_CheckBox(x, y, client->config.g, _("Blur green"))
207 this->client = client;
209 int BlurG::handle_event()
211 client->config.g = get_value();
212 client->send_configure_change();
216 BlurB::BlurB(BlurMain *client, int x, int y)
217 : BC_CheckBox(x, y, client->config.b, _("Blur blue"))
219 this->client = client;
221 int BlurB::handle_event()
223 client->config.b = get_value();
224 client->send_configure_change();