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"
26 #define _(String) gettext(String)
27 #define gettext_noop(String) String
28 #define N_(String) gettext_noop (String)
31 // configuration window
32 GreyCStorationWindow::GreyCStorationWindow(GreyCStorationMain *client)
33 : PluginClientWindow(client, 300, 180, 300, 180, 0)
35 this->client = client;
38 GreyCStorationWindow::~GreyCStorationWindow()
43 void GreyCStorationWindow::create_objects()
47 add_subwindow(title = new BC_Title(x, y + 10, _("Amplitude:")));
48 add_tool(greycamp_slider = new GreyCAmpSlider(client, &(client->config.amplitude), x+title->get_w(), y));
51 add_subwindow(title = new BC_Title(x, y + 10, _("Sharpness:")));
52 add_tool(greycsharp_slider = new GreyCSharpSlider(client, &(client->config.sharpness), x+title->get_w(), y));
55 add_subwindow(title = new BC_Title(x, y + 10, _("Anisotropy:")));
56 add_tool(greycani_slider = new GreyCAniSlider(client, &(client->config.anisotropy), x+title->get_w(), y));
59 add_subwindow(title = new BC_Title(x, y + 10, _("Noise scale:")));
60 add_tool(greycnoise_slider = new GreyCNoiseSlider(client, &(client->config.noise_scale), x+title->get_w(), y));
67 int GreyCStorationWindow::close_event()
74 // amp slider implementation
76 GreyCAmpSlider::GreyCAmpSlider(GreyCStorationMain *client, float *output, int x, int y)
77 : BC_ISlider(x, y, 0, 200, 200, 0, 255, //MAX
78 (int)*output, 0, 0, 0)
80 this->client = client;
81 this->output = output;
83 GreyCAmpSlider::~GreyCAmpSlider()
86 int GreyCAmpSlider::handle_event()
88 *output = get_value();
89 client->send_configure_change();
96 GreyCSharpSlider::GreyCSharpSlider(GreyCStorationMain *client, float *output, int x, int y)
97 : BC_FSlider(x, y, 0, 200, 200, 0.0f, 1.0f, //MAX
100 this->client = client;
101 this->output = output;
104 GreyCSharpSlider::~GreyCSharpSlider()
108 int GreyCSharpSlider::handle_event()
110 *output = get_value();
111 client->send_configure_change();
118 GreyCAniSlider::GreyCAniSlider(GreyCStorationMain *client, float *output, int x, int y)
119 : BC_FSlider(x, y, 0, 200, 200, 0.0f, 1.0f, //MAX
120 (float)*output, 0, 0)
122 this->client = client;
123 this->output = output;
126 GreyCAniSlider::~GreyCAniSlider()
130 int GreyCAniSlider::handle_event()
132 *output = get_value();
133 client->send_configure_change();
140 GreyCNoiseSlider::GreyCNoiseSlider(GreyCStorationMain *client, float *output, int x, int y)
141 : BC_FSlider(x, y, 0, 200, 200, 0.0f, 10.0f, //MAX
142 (float)*output, 0, 0)
144 this->client = client;
145 this->output = output;
148 GreyCNoiseSlider::~GreyCNoiseSlider()
152 int GreyCNoiseSlider::handle_event()
154 *output = get_value();
155 client->send_configure_change();