342d115a7dc40c60c0489fbe90dd078d6f055292
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / blur / blurwindow.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "bcdisplayinfo.h"
23 #include "blur.h"
24 #include "blurwindow.h"
25 #include "language.h"
26
27
28
29
30
31
32 BlurWindow::BlurWindow(BlurMain *client)
33  : PluginClientWindow(client,
34         200,
35         330,
36         200,
37         330,
38         0)
39 {
40         this->client = client;
41 }
42
43 BlurWindow::~BlurWindow()
44 {
45 //printf("BlurWindow::~BlurWindow 1\n");
46 }
47
48 void BlurWindow::create_objects()
49 {
50         int x = 10, y = 10;
51         BC_Title *title;
52
53         add_subwindow(new BC_Title(x, y, _("Blur")));
54         y += 20;
55         add_subwindow(horizontal = new BlurHorizontal(client, this, x, y));
56         y += 30;
57         add_subwindow(vertical = new BlurVertical(client, this, x, y));
58         y += 35;
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));
65         y += 30;
66         add_subwindow(a = new BlurA(client, x, y));
67         y += 30;
68         add_subwindow(r = new BlurR(client, x, y));
69         y += 30;
70         add_subwindow(g = new BlurG(client, x, y));
71         y += 30;
72         add_subwindow(b = new BlurB(client, x, y));
73
74         show_window();
75         flush();
76 }
77
78 BlurRadius::BlurRadius(BlurMain *client, BlurWindow *gui, int x, int y)
79  : BC_IPot(x,
80         y,
81         client->config.radius,
82         0,
83         MAXRADIUS)
84 {
85         this->client = client;
86         this->gui = gui;
87 }
88 BlurRadius::~BlurRadius()
89 {
90 }
91 int BlurRadius::handle_event()
92 {
93         client->config.radius = get_value();
94         gui->radius_text->update((int64_t)client->config.radius);
95         client->send_configure_change();
96         return 1;
97 }
98
99
100
101
102 BlurRadiusText::BlurRadiusText(BlurMain *client, BlurWindow *gui, int x, int y, int w)
103  : BC_TextBox(x,
104         y,
105         w,
106         1,
107         client->config.radius)
108 {
109         this->client = client;
110         this->gui = gui;
111 }
112
113 int BlurRadiusText::handle_event()
114 {
115         client->config.radius = atoi(get_text());
116         gui->radius->update((int64_t)client->config.radius);
117         client->send_configure_change();
118         return 1;
119 }
120
121
122
123
124 BlurVertical::BlurVertical(BlurMain *client, BlurWindow *window, int x, int y)
125  : BC_CheckBox(x,
126         y,
127         client->config.vertical,
128         _("Vertical"))
129 {
130         this->client = client;
131         this->window = window;
132 }
133 BlurVertical::~BlurVertical()
134 {
135 }
136 int BlurVertical::handle_event()
137 {
138         client->config.vertical = get_value();
139         client->send_configure_change();
140         return 1;
141 }
142
143 BlurHorizontal::BlurHorizontal(BlurMain *client, BlurWindow *window, int x, int y)
144  : BC_CheckBox(x,
145         y,
146         client->config.horizontal,
147         _("Horizontal"))
148 {
149         this->client = client;
150         this->window = window;
151 }
152 BlurHorizontal::~BlurHorizontal()
153 {
154 }
155 int BlurHorizontal::handle_event()
156 {
157         client->config.horizontal = get_value();
158         client->send_configure_change();
159         return 1;
160 }
161
162
163
164
165 BlurA::BlurA(BlurMain *client, int x, int y)
166  : BC_CheckBox(x, y, client->config.a, _("Blur alpha"))
167 {
168         this->client = client;
169 }
170 int BlurA::handle_event()
171 {
172         client->config.a = get_value();
173         client->send_configure_change();
174         return 1;
175 }
176
177
178
179
180 BlurAKey::BlurAKey(BlurMain *client, int x, int y)
181  : BC_CheckBox(x, y, client->config.a_key, _("Alpha determines radius"))
182 {
183         this->client = client;
184 }
185 int BlurAKey::handle_event()
186 {
187         client->config.a_key = get_value();
188         client->send_configure_change();
189         return 1;
190 }
191
192 BlurR::BlurR(BlurMain *client, int x, int y)
193  : BC_CheckBox(x, y, client->config.r, _("Blur red"))
194 {
195         this->client = client;
196 }
197 int BlurR::handle_event()
198 {
199         client->config.r = get_value();
200         client->send_configure_change();
201         return 1;
202 }
203
204 BlurG::BlurG(BlurMain *client, int x, int y)
205  : BC_CheckBox(x, y, client->config.g, _("Blur green"))
206 {
207         this->client = client;
208 }
209 int BlurG::handle_event()
210 {
211         client->config.g = get_value();
212         client->send_configure_change();
213         return 1;
214 }
215
216 BlurB::BlurB(BlurMain *client, int x, int y)
217  : BC_CheckBox(x, y, client->config.b, _("Blur blue"))
218 {
219         this->client = client;
220 }
221 int BlurB::handle_event()
222 {
223         client->config.b = get_value();
224         client->send_configure_change();
225         return 1;
226 }
227
228