4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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
23 #include "whirlwindow.h"
33 WhirlWindow::WhirlWindow(WhirlMain *client)
34 : PluginClientWindow(client, xS(210), yS(170), xS(200), yS(170), 0)
35 { this->client = client; }
37 WhirlWindow::~WhirlWindow()
47 void WhirlWindow::create_objects()
49 int xs10 = xS(10), xs80 = xS(80);
50 int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys35 = yS(35);
51 int x = xs10, y = ys10;
52 add_tool(new BC_Title(x, y, _("Angle")));
53 add_tool(automation[0] = new AutomatedFn(client, this, x + xs80, y, 0));
55 add_tool(angle_slider = new AngleSlider(client, x, y));
57 add_tool(new BC_Title(x, y, _("Pinch")));
58 add_tool(automation[1] = new AutomatedFn(client, this, x + xs80, y, 1));
60 add_tool(pinch_slider = new PinchSlider(client, x, y));
62 add_tool(new BC_Title(x, y, _("Radius")));
63 add_tool(automation[2] = new AutomatedFn(client, this, x + xs80, y, 2));
65 add_tool(radius_slider = new RadiusSlider(client, x, y));
69 AngleSlider::AngleSlider(WhirlMain *client, int x, int y)
70 : BC_ISlider(x, y, xS(190), yS(30), xS(200), client->angle, -MAXANGLE, MAXANGLE, DKGREY, BLACK, 1)
72 this->client = client;
74 AngleSlider::~AngleSlider()
77 int AngleSlider::handle_event()
79 client->angle = get_value();
80 client->send_configure_change();
84 PinchSlider::PinchSlider(WhirlMain *client, int x, int y)
85 : BC_ISlider(x, y, xS(190), yS(30), xS(200), client->pinch, -MAXPINCH, MAXPINCH, DKGREY, BLACK, 1)
86 this->client = client;
88 PinchSlider::~PinchSlider()
91 int PinchSlider::handle_event()
93 client->pinch = get_value();
94 client->send_configure_change();
98 RadiusSlider::RadiusSlider(WhirlMain *client, int x, int y)
99 : BC_ISlider(x, y, xS(190), yS(30), xS(200), client->radius, 0, MAXRADIUS, DKGREY, BLACK, 1)
101 this->client = client;
103 RadiusSlider::~RadiusSlider()
106 int RadiusSlider::handle_event()
108 client->radius = get_value();
109 client->send_configure_change();
113 AutomatedFn::AutomatedFn(WhirlMain *client, WhirlWindow *window, int x, int y, int number)
114 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
116 this->client = client;
117 this->window = window;
118 this->number = number;
121 AutomatedFn::~AutomatedFn()
125 int AutomatedFn::handle_event()
127 for(int i = 0; i < 3; i++)
129 if(i != number) window->automation[i]->update(0);
132 client->automated_function = number;
133 client->send_configure_change();