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