Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / cinelerra / plugintoggles.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #include "language.h"
23 #include "mwindow.h"
24 #include "plugin.h"
25 #include "plugintoggles.h"
26 #include "theme.h"
27
28
29
30 PluginOn::PluginOn(MWindow *mwindow, int x, int y, Plugin *plugin)
31  : BC_Toggle(x, 
32                 y, 
33                 mwindow->theme->get_image_set("plugin_on"),
34                 plugin->on)
35 {
36         this->mwindow = mwindow;
37         this->plugin = plugin;
38         in_use = 1;
39         set_tooltip(_("On"));
40 }
41
42 int PluginOn::calculate_w(MWindow *mwindow)
43 {
44         return mwindow->theme->get_image_set("plugin_on")[0]->get_w();
45 }
46
47 void PluginOn::update(int x, int y, Plugin *plugin)
48 {
49         BC_Toggle::set_value(plugin->on, 0);
50         reposition_window(x, y);
51         this->plugin = plugin;
52         in_use = 1;
53 }
54
55 int PluginOn::handle_event()
56 {
57         plugin->on = get_value();
58         unlock_window();
59         mwindow->restart_brender();
60         mwindow->sync_parameters(CHANGE_EDL);
61         lock_window("PluginOn::handle_event");
62         return 1;
63 }
64
65
66
67
68 PluginShow::PluginShow(MWindow *mwindow, int x, int y, Plugin *plugin)
69  : BC_Toggle(x, 
70                 y, 
71                 mwindow->theme->get_image_set("plugin_show"),
72                 plugin->show)
73 {
74         this->mwindow = mwindow;
75         this->plugin = plugin;
76         in_use = 1;
77         set_tooltip(_("Show controls"));
78 }
79
80 int PluginShow::calculate_w(MWindow *mwindow)
81 {
82         return mwindow->theme->get_image_set("plugin_show")[0]->get_w();
83 }
84
85 void PluginShow::update(int x, int y, Plugin *plugin)
86 {
87         BC_Toggle::set_value(plugin->show, 0);
88         reposition_window(x, y);
89         this->plugin = plugin;
90         in_use = 1;
91 }
92
93 int PluginShow::handle_event()
94 {
95         unlock_window();
96         if(get_value()) 
97                 mwindow->show_plugin(plugin);
98         else
99                 mwindow->hide_plugin(plugin, 1);
100         lock_window("PluginShow::handle_event");
101         return 1;
102 }
103
104
105
106
107