310128f8dd3d86bb6a301535e2902df959c58c8c
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / sharpen / sharpenwindow.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
28
29
30
31
32
33
34
35 SharpenWindow::SharpenWindow(SharpenMain *client)
36  : PluginClientWindow(client, 230, 195, 230, 195, 0) //195 was 150
37 {
38         this->client = client;
39 }
40
41 SharpenWindow::~SharpenWindow()
42 {
43 }
44
45 void SharpenWindow::create_objects()
46 {
47         int x = 10, y = 10;
48         add_tool(new BC_Title(x, y, _("Sharpness")));
49         y += 20;
50         add_tool(sharpen_slider = new SharpenSlider(client, &(client->config.sharpness), x, y));
51         y += 30;
52         add_tool(sharpen_interlace = new SharpenInterlace(client, x, y));
53         y += 30;
54         add_tool(sharpen_horizontal = new SharpenHorizontal(client, x, y));
55         y += 30;
56         add_tool(sharpen_luminance = new SharpenLuminance(client, x, y));
57         y += 40;
58         add_tool(reset = new SharpenReset(client, this, x, y));
59         show_window();
60         flush();
61 }
62
63 void SharpenWindow::update()
64 {
65         sharpen_slider->update(client->config.sharpness);
66         sharpen_interlace->update(client->config.interlace);
67         sharpen_horizontal->update(client->config.horizontal);
68         sharpen_luminance->update(client->config.luminance);
69 }
70
71 SharpenSlider::SharpenSlider(SharpenMain *client, float *output, int x, int y)
72  : BC_ISlider(x,
73         y,
74         0,
75         200,
76         200,
77         0,
78         MAXSHARPNESS,
79         (int)*output,
80         0,
81         0,
82         0)
83 {
84         this->client = client;
85         this->output = output;
86 }
87 SharpenSlider::~SharpenSlider()
88 {
89 }
90 int SharpenSlider::handle_event()
91 {
92         *output = get_value();
93         client->send_configure_change();
94         return 1;
95 }
96
97
98 SharpenInterlace::SharpenInterlace(SharpenMain *client, int x, int y)
99  : BC_CheckBox(x, y, client->config.interlace, _("Interlace"))
100 {
101         this->client = client;
102 }
103 SharpenInterlace::~SharpenInterlace()
104 {
105 }
106 int SharpenInterlace::handle_event()
107 {
108         client->config.interlace = get_value();
109         client->send_configure_change();
110         return 1;
111 }
112
113
114 SharpenHorizontal::SharpenHorizontal(SharpenMain *client, int x, int y)
115  : BC_CheckBox(x, y, client->config.horizontal, _("Horizontal only"))
116 {
117         this->client = client;
118 }
119 SharpenHorizontal::~SharpenHorizontal()
120 {
121 }
122 int SharpenHorizontal::handle_event()
123 {
124         client->config.horizontal = get_value();
125         client->send_configure_change();
126         return 1;
127 }
128
129
130 SharpenLuminance::SharpenLuminance(SharpenMain *client, int x, int y)
131  : BC_CheckBox(x, y, client->config.luminance, _("Luminance only"))
132 {
133         this->client = client;
134 }
135 SharpenLuminance::~SharpenLuminance()
136 {
137 }
138 int SharpenLuminance::handle_event()
139 {
140         client->config.luminance = get_value();
141         client->send_configure_change();
142         return 1;
143 }
144
145
146 SharpenReset::SharpenReset(SharpenMain *client, SharpenWindow *gui, int x, int y)
147  : BC_GenericButton(x, y, _("Reset"))
148 {
149         this->client = client;
150         this->gui = gui;
151 }
152 SharpenReset::~SharpenReset()
153 {
154 }
155 int SharpenReset::handle_event()
156 {
157         client->config.reset();
158         gui->update();
159         client->send_configure_change();
160         return 1;
161 }
162