r105: This commit was manufactured by cvs2svn to create tag
[cinelerra_cv/mob.git] / hvirtual / cinelerra / pluginpopup.C
blobeab7b2baae43ae3b297f0b95f9187112b9757d1d
1 #include "mainundo.h"
2 #include "mwindow.h"
3 #include "mwindowgui.h"
4 #include "plugin.h"
5 #include "plugindialog.h"
6 #include "pluginpopup.h"
7 #include "track.h"
9 #include <libintl.h>
10 #define _(String) gettext(String)
11 #define gettext_noop(String) String
12 #define N_(String) gettext_noop (String)
15 PluginPopup::PluginPopup(MWindow *mwindow, MWindowGUI *gui)
16  : BC_PopupMenu(0, 
17                 0, 
18                 0, 
19                 "", 
20                 0)
22         this->mwindow = mwindow;
23         this->gui = gui;
26 PluginPopup::~PluginPopup()
30 void PluginPopup::create_objects()
32         add_item(attach = new PluginPopupAttach(mwindow, this));
33         add_item(detach = new PluginPopupDetach(mwindow, this));
34 //      add_item(in = new PluginPopupIn(mwindow, this));
35 //      add_item(out = new PluginPopupOut(mwindow, this));
36         add_item(show = new PluginPopupShow(mwindow, this));
37         add_item(on = new PluginPopupOn(mwindow, this));
38         add_item(new PluginPopupUp(mwindow, this));
39         add_item(new PluginPopupDown(mwindow, this));
42 int PluginPopup::update(Plugin *plugin)
44 //printf("PluginPopup::update %p\n", plugin);
45         on->set_checked(plugin->on);
46 //      in->set_checked(plugin->in);
47 //      out->set_checked(plugin->out);
48         show->set_checked(plugin->show);
49         this->plugin = plugin;
50         return 0;
61 PluginPopupAttach::PluginPopupAttach(MWindow *mwindow, PluginPopup *popup)
62  : BC_MenuItem(_("Attach..."))
64         this->mwindow = mwindow;
65         this->popup = popup;
66         dialog_thread = new PluginDialogThread(mwindow);
69 PluginPopupAttach::~PluginPopupAttach()
71         delete dialog_thread;
74 int PluginPopupAttach::handle_event()
76         dialog_thread->start_window(popup->plugin->track,
77                 popup->plugin, 
78                 PROGRAM_NAME ": Attach Effect");
87 PluginPopupDetach::PluginPopupDetach(MWindow *mwindow, PluginPopup *popup)
88  : BC_MenuItem(_("Detach"))
90         this->mwindow = mwindow;
91         this->popup = popup;
94 PluginPopupDetach::~PluginPopupDetach()
98 int PluginPopupDetach::handle_event()
100         mwindow->hide_plugin(popup->plugin, 1);
101         mwindow->undo->update_undo_before(_("detach effect"), LOAD_ALL);
102         popup->plugin->track->detach_effect(popup->plugin);
103         mwindow->save_backup();
104         mwindow->undo->update_undo_after();
105         mwindow->gui->update(0,
106                 1,
107                 0,
108                 0,
109                 0, 
110                 0,
111                 0);
112         mwindow->restart_brender();
113         mwindow->sync_parameters(CHANGE_EDL);
114         return 1;
123 PluginPopupIn::PluginPopupIn(MWindow *mwindow, PluginPopup *popup)
124  : BC_MenuItem(_("Send"))
126         this->mwindow = mwindow;
127         this->popup = popup;
130 PluginPopupIn::~PluginPopupIn()
134 int PluginPopupIn::handle_event()
136         popup->plugin->in = !get_checked();
137         mwindow->sync_parameters(CHANGE_EDL);
138         return 1;
145 PluginPopupOut::PluginPopupOut(MWindow *mwindow, PluginPopup *popup)
146  : BC_MenuItem(_("Receive"))
148         this->mwindow = mwindow;
149         this->popup = popup;
152 PluginPopupOut::~PluginPopupOut()
156 int PluginPopupOut::handle_event()
158         popup->plugin->out = !get_checked();
159         mwindow->sync_parameters(CHANGE_EDL);
160         return 1;
167 PluginPopupShow::PluginPopupShow(MWindow *mwindow, PluginPopup *popup)
168  : BC_MenuItem(_("Show"))
170         this->mwindow = mwindow;
171         this->popup = popup;
174 PluginPopupShow::~PluginPopupShow()
178 int PluginPopupShow::handle_event()
180         mwindow->show_plugin(popup->plugin);
181         return 1;
187 PluginPopupOn::PluginPopupOn(MWindow *mwindow, PluginPopup *popup)
188  : BC_MenuItem(_("On"))
190         this->mwindow = mwindow;
191         this->popup = popup;
194 PluginPopupOn::~PluginPopupOn()
198 int PluginPopupOn::handle_event()
200         popup->plugin->on = !get_checked();
201         mwindow->restart_brender();
202         mwindow->sync_parameters(CHANGE_EDL);
203         return 1;
207 PluginPopupUp::PluginPopupUp(MWindow *mwindow, PluginPopup *popup)
208  : BC_MenuItem(_("Move up"))
210         this->mwindow = mwindow;
211         this->popup = popup;
214 int PluginPopupUp::handle_event()
216         mwindow->move_plugins_up(popup->plugin->plugin_set);
217         return 1;
222 PluginPopupDown::PluginPopupDown(MWindow *mwindow, PluginPopup *popup)
223  : BC_MenuItem(_("Move down"))
225         this->mwindow = mwindow;
226         this->popup = popup;
229 int PluginPopupDown::handle_event()
231         mwindow->move_plugins_down(popup->plugin->plugin_set);
232         return 1;