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