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