3 * Copyright (C) 2014 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "bcdisplayinfo.h"
25 #include "moveobjwindow.h"
28 MoveObjWindow::MoveObjWindow(MoveObj *plugin)
29 : PluginClientWindow(plugin, 320, 240, 320, 240, 0)
31 this->plugin = plugin;
34 MoveObjWindow::~MoveObjWindow()
38 void MoveObjWindow::create_objects()
41 int margin = plugin->get_theme()->widget_border;
44 add_subwindow(vectors = new MoveObjVectors(this, x, y));
45 y += vectors->get_h() + margin;
46 add_subwindow(do_stabilization = new MoveObjDoStabilization(this,
48 y += do_stabilization->get_h() + margin;
49 add_subwindow(title = new BC_Title(x, y, _("Block size:")));
50 add_subwindow(block_size = new MoveObjBlockSize(this,
51 x + title->get_w() + margin, y));
52 y += block_size->get_h() + margin;
53 add_subwindow(title = new BC_Title(x, y, _("Search radius:")));
54 add_subwindow(search_radius = new MoveObjSearchRadius(this,
55 x + title->get_w() + margin, y));
56 y += search_radius->get_h() + margin;
57 add_subwindow(title = new BC_Title(x, y, _("Settling speed:")));
58 add_subwindow(settling_speed = new MoveObjSettling(this,
59 x + title->get_w() + margin, y));
64 MoveObjVectors::MoveObjVectors(MoveObjWindow *gui, int x, int y)
65 : BC_CheckBox(x, y, gui->plugin->config.draw_vectors, _("Draw vectors"))
70 int MoveObjVectors::handle_event()
72 gui->plugin->config.draw_vectors = get_value();
73 gui->plugin->send_configure_change();
78 MoveObjDoStabilization::MoveObjDoStabilization(MoveObjWindow *gui, int x, int y)
79 : BC_CheckBox(x, y, gui->plugin->config.do_stabilization, _("Do stabilization"))
84 int MoveObjDoStabilization::handle_event()
86 gui->plugin->config.do_stabilization = get_value();
87 gui->plugin->send_configure_change();
92 MoveObjBlockSize::MoveObjBlockSize(MoveObjWindow *gui, int x, int y)
93 : BC_IPot(x, y, (int64_t)gui->plugin->config.block_size, (int64_t)5, (int64_t)100)
98 int MoveObjBlockSize::handle_event()
100 gui->plugin->config.block_size = (int)get_value();
101 gui->plugin->send_configure_change();
106 MoveObjSearchRadius::MoveObjSearchRadius(MoveObjWindow *gui, int x, int y)
107 : BC_IPot(x, y, (int64_t)gui->plugin->config.search_radius, (int64_t)1, (int64_t)100)
112 int MoveObjSearchRadius::handle_event()
114 gui->plugin->config.search_radius = (int)get_value();
115 gui->plugin->send_configure_change();
120 MoveObjSettling::MoveObjSettling(MoveObjWindow *gui, int x, int y)
121 : BC_IPot(x, y, (int64_t)gui->plugin->config.settling_speed, (int64_t)0, (int64_t)100)
126 int MoveObjSettling::handle_event()
128 gui->plugin->config.settling_speed = (int)get_value();
129 gui->plugin->send_configure_change();