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
22 #include "polarwindow.h"
25 #define _(String) gettext(String)
26 #define gettext_noop(String) String
27 #define N_(String) gettext_noop (String)
30 PLUGIN_THREAD_OBJECT(PolarMain, PolarThread, PolarWindow)
38 PolarWindow::PolarWindow(PolarMain *client)
47 !client->show_initially)
49 this->client = client;
52 PolarWindow::~PolarWindow()
60 int PolarWindow::create_objects()
63 add_tool(new BC_Title(x, y, _("Depth")));
64 add_tool(automation[0] = new AutomatedFn(client, this, x + 80, y, 0));
66 add_tool(depth_slider = new DepthSlider(client, x, y));
68 add_tool(new BC_Title(x, y, _("Angle")));
69 add_tool(automation[1] = new AutomatedFn(client, this, x + 80, y, 1));
71 add_tool(angle_slider = new AngleSlider(client, x, y));
74 int PolarWindow::close_event()
76 client->save_defaults();
78 client->send_hide_gui();
81 DepthSlider::DepthSlider(PolarMain *client, int x, int y)
82 : BC_ISlider(x, y, 190, 30, 200, client->depth, 0, MAXDEPTH, DKGREY, BLACK, 1)
84 this->client = client;
86 DepthSlider::~DepthSlider()
89 int DepthSlider::handle_event()
91 client->depth = get_value();
92 client->send_configure_change();
95 AngleSlider::AngleSlider(PolarMain *client, int x, int y)
96 : BC_ISlider(x, y, 190, 30, 200, client->angle, 0, MAXANGLE, DKGREY, BLACK, 1)
98 this->client = client;
100 AngleSlider::~AngleSlider()
103 int AngleSlider::handle_event()
105 client->angle = get_value();
106 client->send_configure_change();
109 AutomatedFn::AutomatedFn(PolarMain *client, PolarWindow *window, int x, int y, int number)
110 : BC_CheckBox(x, y, 16, 16, client->automated_function == number, _("Automate"))
112 this->client = client;
113 this->window = window;
114 this->number = number;
117 AutomatedFn::~AutomatedFn()
121 int AutomatedFn::handle_event()
123 for(int i = 0; i < 2; i++)
125 if(i != number) window->automation[i]->update(0);
128 client->automated_function = number;
129 client->send_configure_change();