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
25 #include "awindowgui.h"
28 #include "editpopup.h"
30 #include "edlsession.h"
34 #include "localsession.h"
35 #include "mainerror.h"
36 #include "mainsession.h"
38 #include "mwindowgui.h"
39 #include "plugindialog.h"
40 #include "resizetrackthread.h"
43 #include "trackcanvas.h"
47 EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui)
48 : BC_PopupMenu(0, 0, 0, "", 0)
50 this->mwindow = mwindow;
60 EditPopup::~EditPopup()
64 void EditPopup::create_objects()
66 add_item(new EditPopupClearSelect(mwindow, this));
67 add_item(new EditPopupCopy(mwindow, this));
68 add_item(new EditPopupCut(mwindow, this));
69 add_item(new EditPopupMute(mwindow, this));
70 add_item(new EditPopupCopyPack(mwindow, this));
71 add_item(new EditPopupCutPack(mwindow, this));
72 add_item(new EditPopupMutePack(mwindow, this));
73 add_item(new EditPopupPaste(mwindow, this));
74 add_item(new EditPopupOverwrite(mwindow, this));
75 add_item(new EditPopupOverwritePlugins(mwindow, this));
78 int EditPopup::activate_menu(Track *track, Edit *edit,
79 PluginSet *pluginset, Plugin *plugin, double position)
83 this->pluginset = pluginset;
84 this->plugin = plugin;
85 this->position = position;
86 return BC_PopupMenu::activate_menu();
89 EditPopupClearSelect::EditPopupClearSelect(MWindow *mwindow, EditPopup *popup)
90 : BC_MenuItem(_("Clear Select"),_("Ctrl-Shift-A"),'A')
92 this->mwindow = mwindow;
98 int EditPopupClearSelect::handle_event()
100 mwindow->edl->tracks->clear_selected_edits();
101 popup->gui->draw_overlays(1);
105 EditPopupCopy::EditPopupCopy(MWindow *mwindow, EditPopup *popup)
106 : BC_MenuItem(_("Copy"),_("Ctrl-c"),'c')
108 this->mwindow = mwindow;
113 int EditPopupCopy::handle_event()
115 mwindow->selected_edits_to_clipboard(0);
119 EditPopupCopyPack::EditPopupCopyPack(MWindow *mwindow, EditPopup *popup)
120 : BC_MenuItem(_("Copy pack"),_("Ctrl-Shift-C"),'C')
122 this->mwindow = mwindow;
128 int EditPopupCopyPack::handle_event()
130 mwindow->selected_edits_to_clipboard(1);
134 EditPopupCut::EditPopupCut(MWindow *mwindow, EditPopup *popup)
135 : BC_MenuItem(_("Cut"),_("Ctrl-x"),'x')
137 this->mwindow = mwindow;
142 int EditPopupCut::handle_event()
144 mwindow->cut_selected_edits(1, 0);
148 EditPopupCutPack::EditPopupCutPack(MWindow *mwindow, EditPopup *popup)
149 : BC_MenuItem(_("Cut pack"),_("Ctrl-z"),'z')
151 this->mwindow = mwindow;
156 int EditPopupCutPack::handle_event()
158 mwindow->cut_selected_edits(1, 1);
162 EditPopupMute::EditPopupMute(MWindow *mwindow, EditPopup *popup)
163 : BC_MenuItem(_("Mute"),_("Ctrl-m"),'m')
165 this->mwindow = mwindow;
170 int EditPopupMute::handle_event()
172 mwindow->cut_selected_edits(0, 0);
176 EditPopupMutePack::EditPopupMutePack(MWindow *mwindow, EditPopup *popup)
177 : BC_MenuItem(_("Mute pack"),_("Ctrl-Shift-M"),'M')
179 this->mwindow = mwindow;
185 int EditPopupMutePack::handle_event()
187 mwindow->cut_selected_edits(0, 1);
191 EditPopupPaste::EditPopupPaste(MWindow *mwindow, EditPopup *popup)
192 : BC_MenuItem(_("Paste"),_("Ctrl-v"),'v')
194 this->mwindow = mwindow;
199 int EditPopupPaste::handle_event()
201 mwindow->paste(popup->position, popup->track, 0, 0);
202 mwindow->edl->tracks->clear_selected_edits();
203 popup->gui->draw_overlays(1);
204 if( mwindow->session->current_operation == DROP_TARGETING ) {
205 mwindow->session->current_operation = NO_OPERATION;
206 popup->gui->update_cursor();
211 EditPopupOverwrite::EditPopupOverwrite(MWindow *mwindow, EditPopup *popup)
212 : BC_MenuItem(_("Overwrite"),_("Ctrl-b"),'b')
214 this->mwindow = mwindow;
219 int EditPopupOverwrite::handle_event()
221 mwindow->paste(popup->position, popup->track, 0, -1);
222 mwindow->edl->tracks->clear_selected_edits();
223 popup->gui->draw_overlays(1);
224 if( mwindow->session->current_operation == DROP_TARGETING ) {
225 mwindow->session->current_operation = NO_OPERATION;
226 popup->gui->update_cursor();
231 EditPopupOverwritePlugins::EditPopupOverwritePlugins(MWindow *mwindow, EditPopup *popup)
232 : BC_MenuItem(_("Overwrite Plugins"),_("Ctrl-Shift-P"),'P')
234 this->mwindow = mwindow;
240 int EditPopupOverwritePlugins::handle_event()
242 mwindow->paste_clipboard(popup->track, popup->position, 1, 0,
243 mwindow->edl->session->labels_follow_edits,
244 mwindow->edl->session->autos_follow_edits,
245 mwindow->edl->session->plugins_follow_edits);
246 mwindow->edl->tracks->clear_selected_edits();
247 if( mwindow->session->current_operation == DROP_TARGETING ) {
248 mwindow->session->current_operation = NO_OPERATION;
249 popup->gui->update_cursor();