2 * GreyCStoration plugin for Cinelerra
3 * Copyright (C) 2013 Slock Ruddy
4 * Copyright (C) 2014-2015 Nicola Ferralis <feranick at hotmail dot com>
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.
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.
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
22 #include "bcdisplayinfo.h"
23 #include "greycstorationwindow.h"
28 // configuration window
29 GreyCStorationWindow::GreyCStorationWindow(GreyCStorationMain *client)
30 : PluginClientWindow(client, xS(300), yS(180), xS(300), yS(180), 0)
32 this->client = client;
35 GreyCStorationWindow::~GreyCStorationWindow()
40 void GreyCStorationWindow::create_objects()
43 int ys10 = yS(10), ys30 = yS(30);
44 int x = xs10, y = ys10;
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));
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));
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));
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));
66 int GreyCStorationWindow::close_event()
73 // amp slider implementation
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)
79 this->client = client;
80 this->output = output;
82 GreyCAmpSlider::~GreyCAmpSlider()
85 int GreyCAmpSlider::handle_event()
87 *output = get_value();
88 client->send_configure_change();
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
99 this->client = client;
100 this->output = output;
103 GreyCSharpSlider::~GreyCSharpSlider()
107 int GreyCSharpSlider::handle_event()
109 *output = get_value();
110 client->send_configure_change();
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)
121 this->client = client;
122 this->output = output;
125 GreyCAniSlider::~GreyCAniSlider()
129 int GreyCAniSlider::handle_event()
131 *output = get_value();
132 client->send_configure_change();
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)
143 this->client = client;
144 this->output = output;
147 GreyCNoiseSlider::~GreyCNoiseSlider()
151 int GreyCNoiseSlider::handle_event()
153 *output = get_value();
154 client->send_configure_change();