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
25 #include "plugintoggles.h"
30 PluginOn::PluginOn(MWindow *mwindow, int x, int y, Plugin *plugin)
31 : BC_Toggle(x, y, mwindow->theme->get_image_set("plugin_on"), plugin->on)
33 this->mwindow = mwindow;
34 this->plugin = plugin;
36 set_tooltip(plugin->on ? _("Turn Off") : _("Turn On"));
39 int PluginOn::calculate_w(MWindow *mwindow)
41 return mwindow->theme->get_image_set("plugin_on")[0]->get_w();
44 void PluginOn::update(int x, int y, Plugin *plugin)
46 BC_Toggle::set_value(plugin->on, 0);
47 set_tooltip(plugin->on ? _("Turn Off") : _("Turn On"));
48 reposition_window(x, y);
49 this->plugin = plugin;
53 int PluginOn::handle_event()
55 plugin->on = get_value();
56 set_tooltip(plugin->on ? _("Turn Off") : _("Turn On"));
58 mwindow->restart_brender();
59 mwindow->sync_parameters(CHANGE_EDL);
60 lock_window("PluginOn::handle_event");
67 PluginShow::PluginShow(MWindow *mwindow, int x, int y, Plugin *plugin)
70 mwindow->theme->get_image_set("plugin_show"),
73 this->mwindow = mwindow;
74 this->plugin = plugin;
76 set_tooltip(_("Show controls"));
79 int PluginShow::calculate_w(MWindow *mwindow)
81 return mwindow->theme->get_image_set("plugin_show")[0]->get_w();
84 void PluginShow::update(int x, int y, Plugin *plugin)
86 BC_Toggle::set_value(plugin->show, 0);
87 reposition_window(x, y);
88 this->plugin = plugin;
92 int PluginShow::handle_event()
96 mwindow->show_plugin(plugin);
98 mwindow->hide_plugin(plugin, 1);
99 lock_window("PluginShow::handle_event");
103 PluginPresetEdit::PluginPresetEdit(MWindow *mwindow, int x, int y, Plugin *plugin)
104 : BC_Button(x, y, mwindow->theme->get_image_set("preset_edit"))
106 this->mwindow = mwindow;
107 this->plugin = plugin;
109 set_tooltip(_("Preset Edit"));
112 int PluginPresetEdit::handle_event()
114 mwindow->show_keyframe_gui(plugin);
118 int PluginPresetEdit::calculate_w(MWindow *mwindow)
120 VFrame **images = mwindow->theme->get_image_set("preset_edit");
121 return images[0]->get_w();
124 void PluginPresetEdit::update(int x, int y, Plugin *plugin)
126 reposition_window(x, y);
127 this->plugin = plugin;