fixes and upgrades to guicast
[goodguy/history.git] / cinelerra-5.0 / plugins / quark / quarkwindow.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 "sharpenwindow.h"
25
26
27 SharpenThread::SharpenThread(SharpenMain *client)
28  : Thread()
29 {
30         this->client = client;
31         set_synchronous(0);
32         gui_started.lock();
33         completion.lock();
34 }
35
36 SharpenThread::~SharpenThread()
37 {
38 // Window always deleted here
39         delete window;
40 }
41         
42 void SharpenThread::run()
43 {
44         BC_DisplayInfo info;
45         window = new SharpenWindow(client, 
46                 info.get_abs_cursor_x() - 105, 
47                 info.get_abs_cursor_y() - 60);
48         window->create_objects();
49         gui_started.unlock();
50         int result = window->run_window();
51         completion.unlock();
52 // Last command executed in thread
53         if(result) client->client_side_close();
54 }
55
56
57
58
59
60
61 SharpenWindow::SharpenWindow(SharpenMain *client, int x, int y)
62  : BC_Window(client->gui_string, 
63         x,
64         y,
65         210, 
66         120, 
67         210, 
68         120, 
69         0, 
70         0,
71         1)
72
73         this->client = client; 
74 }
75
76 SharpenWindow::~SharpenWindow()
77 {
78 }
79
80 int SharpenWindow::create_objects()
81 {
82         int x = 10, y = 10;
83         add_tool(new BC_Title(x, y, _("Sharpness")));
84         y += 20;
85         add_tool(sharpen_slider = new SharpenSlider(client, &(client->sharpness), x, y));
86         y += 30;
87         add_tool(sharpen_interlace = new SharpenInterlace(client, x, y));
88         y += 30;
89         add_tool(sharpen_horizontal = new SharpenHorizontal(client, x, y));
90         y += 30;
91         add_tool(sharpen_luminance = new SharpenLuminance(client, x, y));
92         show_window();
93         flush();
94         return 0;
95 }
96
97 int SharpenWindow::close_event()
98 {
99 // Set result to 1 to indicate a client side close
100         set_done(1);
101         return 1;
102 }
103
104 SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y)
105  : BC_ISlider(x, 
106         y, 
107         0,
108         200, 
109         200,
110         0, 
111         MAXSHARPNESS, 
112         (int)*output, 
113         0, 
114         0, 
115         0)
116 {
117         this->client = client;
118         this->output = output;
119 }
120 SharpenSlider::~SharpenSlider()
121 {
122 }
123 int SharpenSlider::handle_event()
124 {
125         *output = get_value();
126         client->send_configure_change();
127         return 1;
128 }
129
130
131
132
133 SharpenInterlace::SharpenInterlace(SharpenMain *client, int x, int y)
134  : BC_CheckBox(x, y, client->interlace, _("Interlace"))
135 {
136         this->client = client;
137 }
138 SharpenInterlace::~SharpenInterlace()
139 {
140 }
141 int SharpenInterlace::handle_event()
142 {
143         client->interlace = get_value();
144         client->send_configure_change();
145         return 1;
146 }
147
148
149
150
151 SharpenHorizontal::SharpenHorizontal(SharpenMain *client, int x, int y)
152  : BC_CheckBox(x, y, client->horizontal, _("Horizontal only"))
153 {
154         this->client = client;
155 }
156 SharpenHorizontal::~SharpenHorizontal()
157 {
158 }
159 int SharpenHorizontal::handle_event()
160 {
161         client->horizontal = get_value();
162         client->send_configure_change();
163         return 1;
164 }
165
166
167
168 SharpenLuminance::SharpenLuminance(SharpenMain *client, int x, int y)
169  : BC_CheckBox(x, y, client->luminance, _("Luminance only"))
170 {
171         this->client = client;
172 }
173 SharpenLuminance::~SharpenLuminance()
174 {
175 }
176 int SharpenLuminance::handle_event()
177 {
178         client->luminance = get_value();
179         client->send_configure_change();
180         return 1;
181 }
182