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 "flowobjwindow.h"
28 FlowObjWindow::FlowObjWindow(FlowObj *plugin)
29 : PluginClientWindow(plugin, 320, 240, 320, 240, 0)
31 this->plugin = plugin;
34 FlowObjWindow::~FlowObjWindow()
38 void FlowObjWindow::create_objects()
41 int margin = plugin->get_theme()->widget_border;
44 add_subwindow(vectors = new FlowObjVectors(this, x, y));
45 y += vectors->get_h() + margin;
46 add_subwindow(do_stabilization = new FlowObjDoStabilization(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 FlowObjBlockSize(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 FlowObjSearchRadius(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 FlowObjSettling(this,
59 x + title->get_w() + margin, y));
64 FlowObjVectors::FlowObjVectors(FlowObjWindow *gui, int x, int y)
65 : BC_CheckBox(x, y, gui->plugin->config.draw_vectors, _("Draw vectors"))
70 int FlowObjVectors::handle_event()
72 gui->plugin->config.draw_vectors = get_value();
73 gui->plugin->send_configure_change();
78 FlowObjDoStabilization::FlowObjDoStabilization(FlowObjWindow *gui, int x, int y)
79 : BC_CheckBox(x, y, gui->plugin->config.do_stabilization, _("Do stabilization"))
84 int FlowObjDoStabilization::handle_event()
86 gui->plugin->config.do_stabilization = get_value();
87 gui->plugin->send_configure_change();
92 FlowObjBlockSize::FlowObjBlockSize(FlowObjWindow *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 FlowObjBlockSize::handle_event()
100 gui->plugin->config.block_size = (int)get_value();
101 gui->plugin->send_configure_change();
106 FlowObjSearchRadius::FlowObjSearchRadius(FlowObjWindow *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 FlowObjSearchRadius::handle_event()
114 gui->plugin->config.search_radius = (int)get_value();
115 gui->plugin->send_configure_change();
120 FlowObjSettling::FlowObjSettling(FlowObjWindow *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 FlowObjSettling::handle_event()
128 gui->plugin->config.settling_speed = (int)get_value();
129 gui->plugin->send_configure_change();