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
22 #include "bcsignals.h"
26 #include "mwindowgui.h"
28 #include "plugindialog.h"
29 #include "pluginpopup.h"
31 #include "presetsgui.h"
36 PluginPopup::PluginPopup(MWindow *mwindow, MWindowGUI *gui)
43 this->mwindow = mwindow;
48 thread = new PresetsThread(mwindow);
52 PluginPopup::~PluginPopup()
56 void PluginPopup::create_objects()
58 add_item(change = new PluginPopupChange(mwindow, this));
59 add_item(detach = new PluginPopupDetach(mwindow, this));
60 add_item(new PluginPopupUp(mwindow, this));
61 add_item(new PluginPopupDown(mwindow, this));
62 add_item(on = new PluginPopupOn(mwindow, this));
65 int PluginPopup::update(Plugin *plugin)
67 if(show) remove_item(show);
68 if(presets) remove_item(presets);
72 if(plugin->plugin_type == PLUGIN_STANDALONE)
74 add_item(show = new PluginPopupShow(mwindow, this));
75 add_item(presets = new PluginPresets(mwindow, this));
76 show->set_checked(plugin->show);
79 on->set_checked(plugin->on);
80 this->plugin = plugin;
92 PluginPopupChange::PluginPopupChange(MWindow *mwindow, PluginPopup *popup)
93 : BC_MenuItem(_("Change..."))
95 this->mwindow = mwindow;
97 dialog_thread = new PluginDialogThread(mwindow);
100 PluginPopupChange::~PluginPopupChange()
102 delete dialog_thread;
105 int PluginPopupChange::handle_event()
107 dialog_thread->start_window(popup->plugin->track,
109 _(PROGRAM_NAME ": Change Effect"),
111 popup->plugin->track->data_type);
122 PluginPopupDetach::PluginPopupDetach(MWindow *mwindow, PluginPopup *popup)
123 : BC_MenuItem(_("Detach"))
125 this->mwindow = mwindow;
129 PluginPopupDetach::~PluginPopupDetach()
133 int PluginPopupDetach::handle_event()
135 mwindow->undo->update_undo_before();
136 mwindow->hide_plugin(popup->plugin, 1);
137 mwindow->hide_keyframe_gui(popup->plugin);
138 popup->plugin->track->detach_effect(popup->plugin);
139 mwindow->save_backup();
140 mwindow->undo->update_undo_after(_("detach effect"), LOAD_ALL);
143 mwindow->gui->lock_window("PluginPopupDetach::handle_event");
144 mwindow->gui->update(0,
151 mwindow->gui->unlock_window();
152 mwindow->restart_brender();
153 mwindow->sync_parameters(CHANGE_EDL);
163 PluginPopupIn::PluginPopupIn(MWindow *mwindow, PluginPopup *popup)
164 : BC_MenuItem(_("Send"))
166 this->mwindow = mwindow;
170 PluginPopupIn::~PluginPopupIn()
174 int PluginPopupIn::handle_event()
176 popup->plugin->in = !get_checked();
177 mwindow->sync_parameters(CHANGE_EDL);
185 PluginPopupOut::PluginPopupOut(MWindow *mwindow, PluginPopup *popup)
186 : BC_MenuItem(_("Receive"))
188 this->mwindow = mwindow;
192 PluginPopupOut::~PluginPopupOut()
196 int PluginPopupOut::handle_event()
198 popup->plugin->out = !get_checked();
199 mwindow->sync_parameters(CHANGE_EDL);
207 PluginPopupShow::PluginPopupShow(MWindow *mwindow, PluginPopup *popup)
208 : BC_MenuItem(_("Show"))
210 this->mwindow = mwindow;
214 PluginPopupShow::~PluginPopupShow()
218 int PluginPopupShow::handle_event()
220 mwindow->show_plugin(popup->plugin);
221 mwindow->gui->update(0, 1, 0, 0, 0, 0, 0);
228 PluginPopupOn::PluginPopupOn(MWindow *mwindow, PluginPopup *popup)
229 : BC_MenuItem(_("On"))
231 this->mwindow = mwindow;
235 PluginPopupOn::~PluginPopupOn()
239 int PluginPopupOn::handle_event()
241 popup->plugin->on = !get_checked();
242 mwindow->gui->update(0, 1, 0, 0, 0, 0, 0);
243 mwindow->restart_brender();
244 mwindow->sync_parameters(CHANGE_EDL);
249 PluginPopupUp::PluginPopupUp(MWindow *mwindow, PluginPopup *popup)
250 : BC_MenuItem(_("Move up"))
252 this->mwindow = mwindow;
256 int PluginPopupUp::handle_event()
258 mwindow->move_plugins_up(popup->plugin->plugin_set);
264 PluginPopupDown::PluginPopupDown(MWindow *mwindow, PluginPopup *popup)
265 : BC_MenuItem(_("Move down"))
267 this->mwindow = mwindow;
271 int PluginPopupDown::handle_event()
273 mwindow->move_plugins_down(popup->plugin->plugin_set);
279 PluginPresets::PluginPresets(MWindow *mwindow, PluginPopup *popup)
280 : BC_MenuItem(_("Presets..."))
282 this->mwindow = mwindow;
286 int PluginPresets::handle_event()
288 mwindow->show_keyframe_gui(popup->plugin);
290 popup->thread->start_window(popup->plugin);