add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / moveobj / moveobjwindow.C
1 /*
2  * CINELERRA
3  * Copyright (C) 2014 Adam Williams <broadcast at earthling dot net>
4  * 
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.
9  * 
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.
14  * 
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
18  * 
19  */
20
21 #include "bcdisplayinfo.h"
22 #include "clip.h"
23 #include "language.h"
24 #include "moveobj.h"
25 #include "moveobjwindow.h"
26 #include "theme.h"
27
28 MoveObjWindow::MoveObjWindow(MoveObj *plugin)
29  : PluginClientWindow(plugin, 320, 240, 320, 240, 0)
30 {
31         this->plugin = plugin; 
32 }
33
34 MoveObjWindow::~MoveObjWindow()
35 {
36 }
37
38 void MoveObjWindow::create_objects()
39 {
40         int x = 10, y = 10;
41         int margin = plugin->get_theme()->widget_border;
42         BC_Title *title;
43
44         add_subwindow(vectors = new MoveObjVectors(this, x, y));
45         y += vectors->get_h() + margin;
46         add_subwindow(do_stabilization = new MoveObjDoStabilization(this,
47                 x, y));
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));
60
61         show_window(1);
62 }
63
64 MoveObjVectors::MoveObjVectors(MoveObjWindow *gui, int x, int y)
65  : BC_CheckBox(x, y, gui->plugin->config.draw_vectors, _("Draw vectors"))
66 {
67         this->gui = gui;
68 }
69
70 int MoveObjVectors::handle_event()
71 {
72         gui->plugin->config.draw_vectors = get_value();
73         gui->plugin->send_configure_change();
74         return 1;
75 }
76
77
78 MoveObjDoStabilization::MoveObjDoStabilization(MoveObjWindow *gui, int x, int y)
79  : BC_CheckBox(x, y, gui->plugin->config.do_stabilization, _("Do stabilization"))
80 {
81         this->gui = gui;
82 }
83
84 int MoveObjDoStabilization::handle_event()
85 {
86         gui->plugin->config.do_stabilization = get_value();
87         gui->plugin->send_configure_change();
88         return 1;
89 }
90
91
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)
94 {
95         this->gui = gui;
96 }
97
98 int MoveObjBlockSize::handle_event()
99 {
100         gui->plugin->config.block_size = (int)get_value();
101         gui->plugin->send_configure_change();
102         return 1;
103 }
104
105
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)
108 {
109         this->gui = gui;
110 }
111
112 int MoveObjSearchRadius::handle_event()
113 {
114         gui->plugin->config.search_radius = (int)get_value();
115         gui->plugin->send_configure_change();
116         return 1;
117 }
118
119
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)
122 {
123         this->gui = gui;
124 }
125
126 int MoveObjSettling::handle_event()
127 {
128         gui->plugin->config.settling_speed = (int)get_value();
129         gui->plugin->send_configure_change();
130         return 1;
131 }
132