remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / whirl / whirlwindow.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 "whirlwindow.h"
24
25
26
27
28
29
30
31
32
33 WhirlWindow::WhirlWindow(WhirlMain *client)
34  : PluginClientWindow(client, 210, 170, 200, 170, 0)
35 { this->client = client; }
36
37 WhirlWindow::~WhirlWindow()
38 {
39         delete angle_slider;
40         delete pinch_slider;
41         delete radius_slider;
42         delete automation[0];
43         delete automation[1];
44         delete automation[2];
45 }
46
47 void WhirlWindow::create_objects()
48 {
49         int x = 10, y = 10;
50         add_tool(new BC_Title(x, y, _("Angle")));
51         add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
52         y += 20;
53         add_tool(angle_slider = new AngleSlider(client, x, y));
54         y += 35;
55         add_tool(new BC_Title(x, y, _("Pinch")));
56         add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
57         y += 20;
58         add_tool(pinch_slider = new PinchSlider(client, x, y));
59         y += 35;
60         add_tool(new BC_Title(x, y, _("Radius")));
61         add_tool(automation[2] = new AutomatedFn(client, this, x + 80, y, 2));
62         y += 20;
63         add_tool(radius_slider = new RadiusSlider(client, x, y));
64 }
65
66
67 AngleSlider::AngleSlider(WhirlMain *client, int x, int y)
68  : BC_ISlider(x, y, 190, 30, 200, client->angle, -MAXANGLE, MAXANGLE, DKGREY, BLACK, 1)
69 {
70         this->client = client;
71 }
72 AngleSlider::~AngleSlider()
73 {
74 }
75 int AngleSlider::handle_event()
76 {
77         client->angle = get_value();
78         client->send_configure_change();
79 }
80
81 PinchSlider::PinchSlider(WhirlMain *client, int x, int y)
82  : BC_ISlider(x, y, 190, 30, 200, client->pinch, -MAXPINCH, MAXPINCH, DKGREY, BLACK, 1)
83 {
84         this->client = client;
85 }
86 PinchSlider::~PinchSlider()
87 {
88 }
89 int PinchSlider::handle_event()
90 {
91         client->pinch = get_value();
92         client->send_configure_change();
93 }
94
95 RadiusSlider::RadiusSlider(WhirlMain *client, int x, int y)
96  : BC_ISlider(x, y, 190, 30, 200, client->radius, 0, MAXRADIUS, DKGREY, BLACK, 1)
97 {
98         this->client = client;
99 }
100 RadiusSlider::~RadiusSlider()
101 {
102 }
103 int RadiusSlider::handle_event()
104 {
105         client->radius = get_value();
106         client->send_configure_change();
107 }
108
109 AutomatedFn::AutomatedFn(WhirlMain *client, WhirlWindow *window, int x, int y, int number)
110  : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
111 {
112         this->client = client;
113         this->window = window;
114         this->number = number;
115 }
116
117 AutomatedFn::~AutomatedFn()
118 {
119 }
120
121 int AutomatedFn::handle_event()
122 {
123         for(int i = 0; i < 3; i++)
124         {
125                 if(i != number) window->automation[i]->update(0);
126         }
127         update(1);
128         client->automated_function = number;
129         client->send_configure_change();
130 }
131