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 "polarwindow.h"
26 PLUGIN_THREAD_OBJECT(PolarMain, PolarThread, PolarWindow)
34 PolarWindow::PolarWindow(PolarMain *client)
43 !client->show_initially)
45 this->client = client;
48 PolarWindow::~PolarWindow()
56 int PolarWindow::create_objects()
59 add_tool(new BC_Title(x, y, _("Depth")));
60 add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
62 add_tool(depth_slider = new DepthSlider(client, x, y));
64 add_tool(new BC_Title(x, y, _("Angle")));
65 add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
67 add_tool(angle_slider = new AngleSlider(client, x, y));
70 int PolarWindow::close_event()
72 client->save_defaults();
74 client->send_hide_gui();
78 DepthSlider::DepthSlider(PolarMain *client, int x, int y)
79 : BC_ISlider(x, y, 190, 30, 200, client->depth, 0, MAXDEPTH, DKGREY, BLACK, 1)
81 this->client = client;
83 DepthSlider::~DepthSlider()
86 int DepthSlider::handle_event()
88 client->depth = get_value();
89 client->send_configure_change();
93 AngleSlider::AngleSlider(PolarMain *client, int x, int y)
94 : BC_ISlider(x, y, 190, 30, 200, client->angle, 0, MAXANGLE, DKGREY, BLACK, 1)
96 this->client = client;
98 AngleSlider::~AngleSlider()
101 int AngleSlider::handle_event()
103 client->angle = get_value();
104 client->send_configure_change();
108 AutomatedFn::AutomatedFn(PolarMain *client, PolarWindow *window, int x, int y, int number)
109 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
111 this->client = client;
112 this->window = window;
113 this->number = number;
116 AutomatedFn::~AutomatedFn()
120 int AutomatedFn::handle_event()
122 for(int i = 0; i < 2; i++)
124 if(i != number) window->automation[i]->update(0);
127 client->automated_function = number;
128 client->send_configure_change();