add shuttle dev support, use dflt ff_a/v.png icons, mjpegtools typo patch
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / greycstoration / greycstorationwindow.C
1 /*
2  * GreyCStoration plugin for Cinelerra
3  * Copyright (C) 2013 Slock Ruddy
4  * Copyright (C) 2014-2015 Nicola Ferralis <feranick at hotmail dot com>
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 "greycstorationwindow.h"
24
25 #include "language.h"
26
27
28 // configuration window
29 GreyCStorationWindow::GreyCStorationWindow(GreyCStorationMain *client)
30  : PluginClientWindow(client, 300, 180, 300, 180, 0)
31 {
32         this->client = client;
33 }
34
35 GreyCStorationWindow::~GreyCStorationWindow()
36 {
37 }
38
39 // controls in window
40 void GreyCStorationWindow::create_objects()
41 {
42         int x = 10, y = 10;
43         BC_Title *title;
44         add_subwindow(title = new BC_Title(x, y + 10, _("Amplitude:")));
45         add_tool(greycamp_slider = new GreyCAmpSlider(client, &(client->config.amplitude), x+title->get_w(), y));
46
47         y += 30;
48         add_subwindow(title = new BC_Title(x, y + 10, _("Sharpness:")));
49         add_tool(greycsharp_slider = new GreyCSharpSlider(client, &(client->config.sharpness), x+title->get_w(), y));
50
51         y += 30;
52         add_subwindow(title = new BC_Title(x, y + 10, _("Anisotropy:")));
53         add_tool(greycani_slider = new GreyCAniSlider(client, &(client->config.anisotropy), x+title->get_w(), y));
54
55         y += 30;
56         add_subwindow(title = new BC_Title(x, y + 10, _("Noise scale:")));
57         add_tool(greycnoise_slider = new GreyCNoiseSlider(client, &(client->config.noise_scale), x+title->get_w(), y));
58
59
60         show_window();
61         flush();
62 }
63
64 int GreyCStorationWindow::close_event()
65 {
66         set_done(1);
67         return 1;
68 }
69
70
71 // amp slider implementation
72
73 GreyCAmpSlider::GreyCAmpSlider(GreyCStorationMain *client, float *output, int x, int y)
74  : BC_ISlider(x, y, 0, 200, 200, 0, 255, //MAX
75         (int)*output, 0, 0, 0)
76 {
77         this->client = client;
78         this->output = output;
79 }
80 GreyCAmpSlider::~GreyCAmpSlider()
81 {
82 }
83 int GreyCAmpSlider::handle_event()
84 {
85         *output = get_value();
86         client->send_configure_change();
87         return 1;
88 }
89
90 // sharpslider
91
92
93 GreyCSharpSlider::GreyCSharpSlider(GreyCStorationMain *client, float *output, int x, int y)
94  : BC_FSlider(x, y, 0, 200, 200, 0.0f, 1.0f, //MAX
95         (float)*output, 0, 0)
96 {
97         this->client = client;
98         this->output = output;
99 }
100
101 GreyCSharpSlider::~GreyCSharpSlider()
102 {
103 }
104
105 int GreyCSharpSlider::handle_event()
106 {
107         *output = get_value();
108         client->send_configure_change();
109         return 1;
110 }
111
112 // anislider
113
114
115 GreyCAniSlider::GreyCAniSlider(GreyCStorationMain *client, float *output, int x, int y)
116  : BC_FSlider(x, y, 0, 200, 200, 0.0f, 1.0f, //MAX
117         (float)*output, 0, 0)
118 {
119         this->client = client;
120         this->output = output;
121 }
122
123 GreyCAniSlider::~GreyCAniSlider()
124 {
125 }
126
127 int GreyCAniSlider::handle_event()
128 {
129         *output = get_value();
130         client->send_configure_change();
131         return 1;
132 }
133
134
135 // noise scale
136
137 GreyCNoiseSlider::GreyCNoiseSlider(GreyCStorationMain *client, float *output, int x, int y)
138  : BC_FSlider(x, y, 0, 200, 200, 0.0f, 10.0f, //MAX
139         (float)*output, 0, 0)
140 {
141         this->client = client;
142         this->output = output;
143 }
144
145 GreyCNoiseSlider::~GreyCNoiseSlider()
146 {
147 }
148
149 int GreyCNoiseSlider::handle_event()
150 {
151         *output = get_value();
152         client->send_configure_change();
153         return 1;
154 }