86187fe54ae2265b2b6e77e7dd7c7077224d7f4a
[goodguy/history.git] / cinelerra-5.1 / plugins / unsharp / unsharpwindow.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 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 "language.h"
24 #include "unsharp.h"
25 #include "unsharpwindow.h"
26
27
28
29
30
31
32
33
34
35
36 UnsharpWindow::UnsharpWindow(UnsharpMain *plugin)
37  : PluginClientWindow(plugin,
38         200, 
39         160, 
40         200, 
41         160, 
42         0)
43 {
44         this->plugin = plugin; 
45 }
46
47 UnsharpWindow::~UnsharpWindow()
48 {
49 }
50
51 void UnsharpWindow::create_objects()
52 {
53         int x = 10, y = 10;
54         BC_Title *title;
55
56         add_subwindow(title = new BC_Title(x, y + 10, _("Radius:")));
57         add_subwindow(radius = new UnsharpRadius(plugin, 
58                 x + title->get_w() + 10, 
59                 y));
60
61         y += 40;
62         add_subwindow(title = new BC_Title(x, y + 10, _("Amount:")));
63         add_subwindow(amount = new UnsharpAmount(plugin, 
64                 x + title->get_w() + 10, 
65                 y));
66
67         y += 40;
68         add_subwindow(title = new BC_Title(x, y + 10, _("Threshold:")));
69         add_subwindow(threshold = new UnsharpThreshold(plugin, 
70                 x + title->get_w() + 10, 
71                 y));
72
73         show_window();
74         flush();
75 }
76
77
78 void UnsharpWindow::update()
79 {
80         radius->update(plugin->config.radius);
81         amount->update(plugin->config.amount);
82         threshold->update(plugin->config.threshold);
83 }
84
85
86
87
88
89
90
91
92
93
94 UnsharpRadius::UnsharpRadius(UnsharpMain *plugin, int x, int y)
95  : BC_FPot(x, y, plugin->config.radius, 0.1, 120)
96 {
97         this->plugin = plugin;
98 }
99 int UnsharpRadius::handle_event()
100 {
101         plugin->config.radius = get_value();
102         plugin->send_configure_change();
103         return 1;
104 }
105
106 UnsharpAmount::UnsharpAmount(UnsharpMain *plugin, int x, int y)
107  : BC_FPot(x, y, plugin->config.amount, 0, 5)
108 {
109         this->plugin = plugin;
110 }
111 int UnsharpAmount::handle_event()
112 {
113         plugin->config.amount = get_value();
114         plugin->send_configure_change();
115         return 1;
116 }
117
118 UnsharpThreshold::UnsharpThreshold(UnsharpMain *plugin, int x, int y)
119  : BC_IPot(x, y, plugin->config.threshold, 0, 255)
120 {
121         this->plugin = plugin;
122 }
123 int UnsharpThreshold::handle_event()
124 {
125         plugin->config.threshold = get_value();
126         plugin->send_configure_change();
127         return 1;
128 }
129
130
131
132