r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / pluginpopup.C
blob637a07659031f11cbcd845157194ba679a2e932c
1 #include "language.h"
2 #include "mainundo.h"
3 #include "mwindow.h"
4 #include "mwindowgui.h"
5 #include "plugin.h"
6 #include "plugindialog.h"
7 #include "pluginpopup.h"
8 #include "track.h"
12 PluginPopup::PluginPopup(MWindow *mwindow, MWindowGUI *gui)
13  : BC_PopupMenu(0, 
14                 0, 
15                 0, 
16                 "", 
17                 0)
19         this->mwindow = mwindow;
20         this->gui = gui;
23 PluginPopup::~PluginPopup()
27 void PluginPopup::create_objects()
29         add_item(change = new PluginPopupChange(mwindow, this));
30         add_item(detach = new PluginPopupDetach(mwindow, this));
31 //      add_item(in = new PluginPopupIn(mwindow, this));
32 //      add_item(out = new PluginPopupOut(mwindow, this));
33         add_item(show = new PluginPopupShow(mwindow, this));
34         add_item(on = new PluginPopupOn(mwindow, this));
35         add_item(new PluginPopupUp(mwindow, this));
36         add_item(new PluginPopupDown(mwindow, this));
39 int PluginPopup::update(Plugin *plugin)
41 //printf("PluginPopup::update %p\n", plugin);
42         on->set_checked(plugin->on);
43 //      in->set_checked(plugin->in);
44 //      out->set_checked(plugin->out);
45         show->set_checked(plugin->show);
46         this->plugin = plugin;
47         return 0;
58 PluginPopupChange::PluginPopupChange(MWindow *mwindow, PluginPopup
59 *popup)
60  : BC_MenuItem(_("Change..."))
62         this->mwindow = mwindow;
63         this->popup = popup;
64         dialog_thread = new PluginDialogThread(mwindow);
67 PluginPopupChange::~PluginPopupChange()
69         delete dialog_thread;
72 int PluginPopupChange::handle_event()
74         dialog_thread->start_window(popup->plugin->track,
75                 popup->plugin,
76                 PROGRAM_NAME ": Change Effect");
86 PluginPopupDetach::PluginPopupDetach(MWindow *mwindow, PluginPopup *popup)
87  : BC_MenuItem(_("Detach"))
89         this->mwindow = mwindow;
90         this->popup = popup;
93 PluginPopupDetach::~PluginPopupDetach()
97 int PluginPopupDetach::handle_event()
99         mwindow->hide_plugin(popup->plugin, 1);
100         popup->plugin->track->detach_effect(popup->plugin);
101         mwindow->save_backup();
102         mwindow->undo->update_undo(_("detach effect"), LOAD_ALL);
103         mwindow->gui->update(0,
104                 1,
105                 0,
106                 0,
107                 0, 
108                 0,
109                 0);
110         mwindow->restart_brender();
111         mwindow->sync_parameters(CHANGE_EDL);
112         return 1;
121 PluginPopupIn::PluginPopupIn(MWindow *mwindow, PluginPopup *popup)
122  : BC_MenuItem(_("Send"))
124         this->mwindow = mwindow;
125         this->popup = popup;
128 PluginPopupIn::~PluginPopupIn()
132 int PluginPopupIn::handle_event()
134         popup->plugin->in = !get_checked();
135         mwindow->sync_parameters(CHANGE_EDL);
136         return 1;
143 PluginPopupOut::PluginPopupOut(MWindow *mwindow, PluginPopup *popup)
144  : BC_MenuItem(_("Receive"))
146         this->mwindow = mwindow;
147         this->popup = popup;
150 PluginPopupOut::~PluginPopupOut()
154 int PluginPopupOut::handle_event()
156         popup->plugin->out = !get_checked();
157         mwindow->sync_parameters(CHANGE_EDL);
158         return 1;
165 PluginPopupShow::PluginPopupShow(MWindow *mwindow, PluginPopup *popup)
166  : BC_MenuItem(_("Show"))
168         this->mwindow = mwindow;
169         this->popup = popup;
172 PluginPopupShow::~PluginPopupShow()
176 int PluginPopupShow::handle_event()
178         mwindow->show_plugin(popup->plugin);
179         return 1;
185 PluginPopupOn::PluginPopupOn(MWindow *mwindow, PluginPopup *popup)
186  : BC_MenuItem(_("On"))
188         this->mwindow = mwindow;
189         this->popup = popup;
192 PluginPopupOn::~PluginPopupOn()
196 int PluginPopupOn::handle_event()
198         popup->plugin->on = !get_checked();
199         mwindow->gui->update(0, 1, 0, 0, 0, 0, 0);
200         mwindow->restart_brender();
201         mwindow->sync_parameters(CHANGE_EDL);
202         return 1;
206 PluginPopupUp::PluginPopupUp(MWindow *mwindow, PluginPopup *popup)
207  : BC_MenuItem(_("Move up"))
209         this->mwindow = mwindow;
210         this->popup = popup;
213 int PluginPopupUp::handle_event()
215         mwindow->move_plugins_up(popup->plugin->plugin_set);
216         return 1;
221 PluginPopupDown::PluginPopupDown(MWindow *mwindow, PluginPopup *popup)
222  : BC_MenuItem(_("Move down"))
224         this->mwindow = mwindow;
225         this->popup = popup;
228 int PluginPopupDown::handle_event()
230         mwindow->move_plugins_down(popup->plugin->plugin_set);
231         return 1;