add BC_SCALE env var for hi def monitors, cleanup theme data
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / oilpainting / oilwindow.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 "language.h"
23 #include "oilwindow.h"
24
25 OilThread::OilThread(OilMain *client)
26  : Thread()
27 {
28         this->client = client;
29         synchronous = 1; // make thread wait for join
30         gui_started.lock();
31 }
32
33 OilThread::~OilThread()
34 {
35 }
36
37 void OilThread::run()
38 {
39         window = new OilWindow(client);
40         window->create_objects();
41         gui_started.unlock();
42         window->run_window();
43         delete window;
44 }
45
46
47
48
49
50
51 OilWindow::OilWindow(OilMain *client)
52  : BC_Window("", MEGREY, client->gui_string, 150, 130, 150, 130, 0, !client->show_initially)
53 { this->client = client; }
54
55 OilWindow::~OilWindow()
56 {
57         delete radius;
58 }
59
60 int OilWindow::create_objects()
61 {
62         int xs10 = xS(10), xs50 = xS(50);
63         int ys10 = yS(10), ys20 = yS(20), ys50 = yS(50);
64         int x = xs10, y = ys10;
65         add_tool(new BC_Title(x, y, _("Oil Painting")));
66         y += ys20;
67         add_tool(radius = new OilRadius(client, x, y));
68         x += xs50;
69         add_tool(new BC_Title(x, y, _("Radius")));
70         y += ys50;
71         x = xs10;
72         add_tool(use_intensity = new OilIntensity(client, x, y));
73 }
74
75 int OilWindow::close_event()
76 {
77         hide_window();
78         client->send_hide_gui();
79 }
80
81 OilRadius::OilRadius(OilMain *client, int x, int y)
82  : BC_IPot(x, y, 35, 35, client->radius, 1, 45, DKGREY, BLACK)
83 {
84         this->client = client;
85 }
86 OilRadius::~OilRadius()
87 {
88 }
89 int OilRadius::handle_event()
90 {
91         client->radius = get_value();
92         client->send_configure_change();
93 }
94
95
96 OilIntensity::OilIntensity(OilMain *client, int x, int y)
97  : BC_CheckBox(x, y, 16, 16, client->use_intensity, _("Use Intensity"))
98 {
99         this->client = client;
100 }
101 OilIntensity::~OilIntensity()
102 {
103 }
104 int OilIntensity::handle_event()
105 {
106         client->use_intensity = get_value();
107         client->send_configure_change();
108 }
109
110
111