rework set default transtion, nested proxy edl fixes, doubleclick proxy media fix...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / pluginpopup.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "language.h"
23 #include "mainundo.h"
24 #include "mwindow.h"
25 #include "mwindowgui.h"
26 #include "plugin.h"
27 #include "plugindialog.h"
28 #include "pluginpopup.h"
29 //#include "presets.h"
30 //#include "presetsgui.h"
31 #include "track.h"
32
33
34
35 PluginPopup::PluginPopup(MWindow *mwindow, MWindowGUI *gui)
36  : BC_PopupMenu(0,
37                 0,
38                 0,
39                 "",
40                 0)
41 {
42         this->mwindow = mwindow;
43         this->gui = gui;
44         show = 0;
45         presets = 0;
46 #if 0
47         thread = new PresetsThread(mwindow);
48 #endif
49 }
50
51 PluginPopup::~PluginPopup()
52 {
53 }
54
55 void PluginPopup::create_objects()
56 {
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));
62 }
63
64 int PluginPopup::update(Plugin *plugin)
65 {
66         if(show) remove_item(show);
67         if(presets) remove_item(presets);
68         show = 0;
69         presets = 0;
70
71         if(plugin->plugin_type == PLUGIN_STANDALONE)
72         {
73                 add_item(show = new PluginPopupShow(mwindow, this));
74                 add_item(presets = new PluginPresets(mwindow, this));
75                 show->set_checked(plugin->show);
76         }
77
78         on->set_checked(plugin->on);
79         this->plugin = plugin;
80         return 0;
81 }
82
83
84
85
86
87
88
89
90
91 PluginPopupChange::PluginPopupChange(MWindow *mwindow, PluginPopup *popup)
92  : BC_MenuItem(_("Change..."))
93 {
94         this->mwindow = mwindow;
95         this->popup = popup;
96         dialog_thread = new PluginDialogThread(mwindow);
97 }
98
99 PluginPopupChange::~PluginPopupChange()
100 {
101         delete dialog_thread;
102 }
103
104 int PluginPopupChange::handle_event()
105 {
106         dialog_thread->start_window(popup->plugin->track,
107                 popup->plugin,
108                 _(PROGRAM_NAME ": Change Effect"),
109                 0,
110                 popup->plugin->track->data_type);
111         return 1;
112 }
113
114
115
116
117
118
119
120
121 PluginPopupDetach::PluginPopupDetach(MWindow *mwindow, PluginPopup *popup)
122  : BC_MenuItem(_("Detach"))
123 {
124         this->mwindow = mwindow;
125         this->popup = popup;
126 }
127
128 PluginPopupDetach::~PluginPopupDetach()
129 {
130 }
131
132 int PluginPopupDetach::handle_event()
133 {
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);
140
141
142         mwindow->gui->lock_window("PluginPopupDetach::handle_event");
143         mwindow->gui->update(0,
144                 1,
145                 0,
146                 0,
147                 0,
148                 0,
149                 0);
150         mwindow->gui->unlock_window();
151         mwindow->restart_brender();
152         mwindow->sync_parameters(CHANGE_EDL);
153         return 1;
154 }
155
156
157
158
159
160
161
162 PluginPopupIn::PluginPopupIn(MWindow *mwindow, PluginPopup *popup)
163  : BC_MenuItem(_("Send"))
164 {
165         this->mwindow = mwindow;
166         this->popup = popup;
167 }
168
169 PluginPopupIn::~PluginPopupIn()
170 {
171 }
172
173 int PluginPopupIn::handle_event()
174 {
175         popup->plugin->in = !get_checked();
176         mwindow->sync_parameters(CHANGE_EDL);
177         return 1;
178 }
179
180
181
182
183
184 PluginPopupOut::PluginPopupOut(MWindow *mwindow, PluginPopup *popup)
185  : BC_MenuItem(_("Receive"))
186 {
187         this->mwindow = mwindow;
188         this->popup = popup;
189 }
190
191 PluginPopupOut::~PluginPopupOut()
192 {
193 }
194
195 int PluginPopupOut::handle_event()
196 {
197         popup->plugin->out = !get_checked();
198         mwindow->sync_parameters(CHANGE_EDL);
199         return 1;
200 }
201
202
203
204
205
206 PluginPopupShow::PluginPopupShow(MWindow *mwindow, PluginPopup *popup)
207  : BC_MenuItem(_("Show"))
208 {
209         this->mwindow = mwindow;
210         this->popup = popup;
211 }
212
213 PluginPopupShow::~PluginPopupShow()
214 {
215 }
216
217 int PluginPopupShow::handle_event()
218 {
219         mwindow->show_plugin(popup->plugin);
220         mwindow->gui->update(0, 1, 0, 0, 0, 0, 0);
221         return 1;
222 }
223
224
225
226
227 PluginPopupOn::PluginPopupOn(MWindow *mwindow, PluginPopup *popup)
228  : BC_MenuItem(_("On"))
229 {
230         this->mwindow = mwindow;
231         this->popup = popup;
232 }
233
234 PluginPopupOn::~PluginPopupOn()
235 {
236 }
237
238 int PluginPopupOn::handle_event()
239 {
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);
244         return 1;
245 }
246
247
248 PluginPopupUp::PluginPopupUp(MWindow *mwindow, PluginPopup *popup)
249  : BC_MenuItem(_("Move up"))
250 {
251         this->mwindow = mwindow;
252         this->popup = popup;
253 }
254
255 int PluginPopupUp::handle_event()
256 {
257         mwindow->move_plugins_up(popup->plugin->plugin_set);
258         return 1;
259 }
260
261
262
263 PluginPopupDown::PluginPopupDown(MWindow *mwindow, PluginPopup *popup)
264  : BC_MenuItem(_("Move down"))
265 {
266         this->mwindow = mwindow;
267         this->popup = popup;
268 }
269
270 int PluginPopupDown::handle_event()
271 {
272         mwindow->move_plugins_down(popup->plugin->plugin_set);
273         return 1;
274 }
275
276
277
278 PluginPresets::PluginPresets(MWindow *mwindow, PluginPopup *popup)
279  : BC_MenuItem(_("Presets..."))
280 {
281         this->mwindow = mwindow;
282         this->popup = popup;
283 }
284
285 int PluginPresets::handle_event()
286 {
287         mwindow->show_keyframe_gui(popup->plugin);
288 #if 0
289         popup->thread->start_window(popup->plugin);
290 #endif
291         return 1;
292 }
293