Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[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, xS(300), yS(180), xS(300), yS(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 xs10 = xS(10);
43         int ys10 = yS(10), ys30 = yS(30);
44         int x = xs10, y = ys10;
45         BC_Title *title;
46         add_subwindow(title = new BC_Title(x, y + ys10, _("Amplitude:")));
47         add_tool(greycamp_slider = new GreyCAmpSlider(client, &(client->config.amplitude), x+title->get_w(), y));
48
49         y += ys30;
50         add_subwindow(title = new BC_Title(x, y + ys10, _("Sharpness:")));
51         add_tool(greycsharp_slider = new GreyCSharpSlider(client, &(client->config.sharpness), x+title->get_w(), y));
52
53         y += ys30;
54         add_subwindow(title = new BC_Title(x, y + ys10, _("Anisotropy:")));
55         add_tool(greycani_slider = new GreyCAniSlider(client, &(client->config.anisotropy), x+title->get_w(), y));
56
57         y += ys30;
58         add_subwindow(title = new BC_Title(x, y + ys10, _("Noise scale:")));
59         add_tool(greycnoise_slider = new GreyCNoiseSlider(client, &(client->config.noise_scale), x+title->get_w(), y));
60
61
62         show_window();
63         flush();
64 }
65
66 int GreyCStorationWindow::close_event()
67 {
68         set_done(1);
69         return 1;
70 }
71
72
73 // amp slider implementation
74
75 GreyCAmpSlider::GreyCAmpSlider(GreyCStorationMain *client, float *output, int x, int y)
76  : BC_ISlider(x, y, 0, xS(200), yS(200), 0, 255, //MAX
77         (int)*output, 0, 0, 0)
78 {
79         this->client = client;
80         this->output = output;
81 }
82 GreyCAmpSlider::~GreyCAmpSlider()
83 {
84 }
85 int GreyCAmpSlider::handle_event()
86 {
87         *output = get_value();
88         client->send_configure_change();
89         return 1;
90 }
91
92 // sharpslider
93
94
95 GreyCSharpSlider::GreyCSharpSlider(GreyCStorationMain *client, float *output, int x, int y)
96  : BC_FSlider(x, y, 0, xS(200), yS(200), 0.0f, 1.0f, //MAX
97         (float)*output, 0, 0)
98 {
99         this->client = client;
100         this->output = output;
101 }
102
103 GreyCSharpSlider::~GreyCSharpSlider()
104 {
105 }
106
107 int GreyCSharpSlider::handle_event()
108 {
109         *output = get_value();
110         client->send_configure_change();
111         return 1;
112 }
113
114 // anislider
115
116
117 GreyCAniSlider::GreyCAniSlider(GreyCStorationMain *client, float *output, int x, int y)
118  : BC_FSlider(x, y, 0, xS(200), yS(200), 0.0f, 1.0f, //MAX
119         (float)*output, 0, 0)
120 {
121         this->client = client;
122         this->output = output;
123 }
124
125 GreyCAniSlider::~GreyCAniSlider()
126 {
127 }
128
129 int GreyCAniSlider::handle_event()
130 {
131         *output = get_value();
132         client->send_configure_change();
133         return 1;
134 }
135
136
137 // noise scale
138
139 GreyCNoiseSlider::GreyCNoiseSlider(GreyCStorationMain *client, float *output, int x, int y)
140  : BC_FSlider(x, y, 0, xS(200), yS(200), 0.0f, 10.0f, //MAX
141         (float)*output, 0, 0)
142 {
143         this->client = client;
144         this->output = output;
145 }
146
147 GreyCNoiseSlider::~GreyCNoiseSlider()
148 {
149 }
150
151 int GreyCNoiseSlider::handle_event()
152 {
153         *output = get_value();
154         client->send_configure_change();
155         return 1;
156 }