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,
150 mwindow->gui->unlock_window();
151 mwindow->restart_brender();
152 mwindow->sync_parameters(CHANGE_EDL);
162 PluginPopupIn::PluginPopupIn(MWindow *mwindow, PluginPopup *popup)
163 : BC_MenuItem(_("Send"))
165 this->mwindow = mwindow;
169 PluginPopupIn::~PluginPopupIn()
173 int PluginPopupIn::handle_event()
175 popup->plugin->in = !get_checked();
176 mwindow->sync_parameters(CHANGE_EDL);
184 PluginPopupOut::PluginPopupOut(MWindow *mwindow, PluginPopup *popup)
185 : BC_MenuItem(_("Receive"))
187 this->mwindow = mwindow;
191 PluginPopupOut::~PluginPopupOut()
195 int PluginPopupOut::handle_event()
197 popup->plugin->out = !get_checked();
198 mwindow->sync_parameters(CHANGE_EDL);
206 PluginPopupShow::PluginPopupShow(MWindow *mwindow, PluginPopup *popup)
207 : BC_MenuItem(_("Show"))
209 this->mwindow = mwindow;
213 PluginPopupShow::~PluginPopupShow()
217 int PluginPopupShow::handle_event()
219 mwindow->show_plugin(popup->plugin);
220 mwindow->gui->update(0, 1, 0, 0, 0, 0, 0);
227 PluginPopupOn::PluginPopupOn(MWindow *mwindow, PluginPopup *popup)
228 : BC_MenuItem(_("On"))
230 this->mwindow = mwindow;
234 PluginPopupOn::~PluginPopupOn()
238 int PluginPopupOn::handle_event()
240 popup->plugin->on = !get_checked();
241 mwindow->gui->update(0, 1, 0, 0, 0, 0, 0);
242 mwindow->restart_brender();
243 mwindow->sync_parameters(CHANGE_EDL);
248 PluginPopupUp::PluginPopupUp(MWindow *mwindow, PluginPopup *popup)
249 : BC_MenuItem(_("Move up"))
251 this->mwindow = mwindow;
255 int PluginPopupUp::handle_event()
257 mwindow->move_plugins_up(popup->plugin->plugin_set);
263 PluginPopupDown::PluginPopupDown(MWindow *mwindow, PluginPopup *popup)
264 : BC_MenuItem(_("Move down"))
266 this->mwindow = mwindow;
270 int PluginPopupDown::handle_event()
272 mwindow->move_plugins_down(popup->plugin->plugin_set);
278 PluginPresets::PluginPresets(MWindow *mwindow, PluginPopup *popup)
279 : BC_MenuItem(_("Presets..."))
281 this->mwindow = mwindow;
285 int PluginPresets::handle_event()
287 mwindow->show_keyframe_gui(popup->plugin);
289 popup->thread->start_window(popup->plugin);