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 "mwindowgui.h"
27 #include "plugindialog.h"
28 #include "pluginpopup.h"
29 //#include "presets.h"
30 //#include "presetsgui.h"
35 PluginPopup::PluginPopup(MWindow *mwindow, MWindowGUI *gui)
42 this->mwindow = mwindow;
47 thread = new PresetsThread(mwindow);
51 PluginPopup::~PluginPopup()
55 void PluginPopup::create_objects()
57 add_item(change = new PluginPopupChange(mwindow, this));
58 add_item(detach = new PluginPopupDetach(mwindow, this));
59 add_item(new PluginPopupUp(mwindow, this));
60 add_item(new PluginPopupDown(mwindow, this));
61 add_item(on = new PluginPopupOn(mwindow, this));
64 int PluginPopup::update(Plugin *plugin)
66 if(show) remove_item(show);
67 if(presets) remove_item(presets);
71 if(plugin->plugin_type == PLUGIN_STANDALONE)
73 add_item(show = new PluginPopupShow(mwindow, this));
74 add_item(presets = new PluginPresets(mwindow, this));
75 show->set_checked(plugin->show);
78 on->set_checked(plugin->on);
79 this->plugin = plugin;
91 PluginPopupChange::PluginPopupChange(MWindow *mwindow, PluginPopup *popup)
92 : BC_MenuItem(_("Change..."))
94 this->mwindow = mwindow;
96 dialog_thread = new PluginDialogThread(mwindow);
99 PluginPopupChange::~PluginPopupChange()
101 delete dialog_thread;
104 int PluginPopupChange::handle_event()
106 dialog_thread->start_window(popup->plugin->track,
108 _(PROGRAM_NAME ": Change Effect"),
110 popup->plugin->track->data_type);
121 PluginPopupDetach::PluginPopupDetach(MWindow *mwindow, PluginPopup *popup)
122 : BC_MenuItem(_("Detach"))
124 this->mwindow = mwindow;
128 PluginPopupDetach::~PluginPopupDetach()
132 int PluginPopupDetach::handle_event()
134 mwindow->undo->update_undo_before();
135 mwindow->hide_plugin(popup->plugin, 1);
136 mwindow->hide_keyframe_gui(popup->plugin);
137 popup->plugin->track->detach_effect(popup->plugin);
138 mwindow->save_backup();
139 mwindow->undo->update_undo_after(_("detach effect"), LOAD_ALL);
142 mwindow->gui->lock_window("PluginPopupDetach::handle_event");
143 mwindow->gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
144 mwindow->gui->unlock_window();
145 mwindow->restart_brender();
146 mwindow->sync_parameters(CHANGE_EDL);
156 PluginPopupIn::PluginPopupIn(MWindow *mwindow, PluginPopup *popup)
157 : BC_MenuItem(_("Send"))
159 this->mwindow = mwindow;
163 PluginPopupIn::~PluginPopupIn()
167 int PluginPopupIn::handle_event()
169 popup->plugin->in = !get_checked();
170 mwindow->sync_parameters(CHANGE_EDL);
178 PluginPopupOut::PluginPopupOut(MWindow *mwindow, PluginPopup *popup)
179 : BC_MenuItem(_("Receive"))
181 this->mwindow = mwindow;
185 PluginPopupOut::~PluginPopupOut()
189 int PluginPopupOut::handle_event()
191 popup->plugin->out = !get_checked();
192 mwindow->sync_parameters(CHANGE_EDL);
200 PluginPopupShow::PluginPopupShow(MWindow *mwindow, PluginPopup *popup)
201 : BC_MenuItem(_("Show"))
203 this->mwindow = mwindow;
207 PluginPopupShow::~PluginPopupShow()
211 int PluginPopupShow::handle_event()
213 mwindow->show_plugin(popup->plugin);
214 mwindow->gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
221 PluginPopupOn::PluginPopupOn(MWindow *mwindow, PluginPopup *popup)
222 : BC_MenuItem(_("On"))
224 this->mwindow = mwindow;
228 PluginPopupOn::~PluginPopupOn()
232 int PluginPopupOn::handle_event()
234 popup->plugin->on = !get_checked();
235 mwindow->gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
236 mwindow->restart_brender();
237 mwindow->sync_parameters(CHANGE_EDL);
242 PluginPopupUp::PluginPopupUp(MWindow *mwindow, PluginPopup *popup)
243 : BC_MenuItem(_("Move up"))
245 this->mwindow = mwindow;
249 int PluginPopupUp::handle_event()
251 mwindow->move_plugins_up(popup->plugin->plugin_set);
257 PluginPopupDown::PluginPopupDown(MWindow *mwindow, PluginPopup *popup)
258 : BC_MenuItem(_("Move down"))
260 this->mwindow = mwindow;
264 int PluginPopupDown::handle_event()
266 mwindow->move_plugins_down(popup->plugin->plugin_set);
272 PluginPresets::PluginPresets(MWindow *mwindow, PluginPopup *popup)
273 : BC_MenuItem(_("Presets..."))
275 this->mwindow = mwindow;
279 int PluginPresets::handle_event()
281 mwindow->show_keyframe_gui(popup->plugin);
283 popup->thread->start_window(popup->plugin);