inter-view map only if armed track, copy/paste behavior rework
authorGood Guy <good1.2guy@gmail.com>
Fri, 14 Dec 2018 02:32:54 +0000 (19:32 -0700)
committerGood Guy <good1.2guy@gmail.com>
Fri, 14 Dec 2018 02:32:54 +0000 (19:32 -0700)
12 files changed:
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/editpopup.C
cinelerra-5.1/cinelerra/editpopup.h
cinelerra-5.1/cinelerra/editpopup.inc
cinelerra-5.1/cinelerra/mainsession.inc
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/mwindowgui.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/trackcanvas.h
cinelerra-5.1/cinelerra/trackpopup.C
cinelerra-5.1/cinelerra/trackpopup.h

index 384090a..a5e4007 100644 (file)
@@ -514,6 +514,7 @@ void AssetViewPopup::draw_vframe(VFrame *vframe)
        double total_length = edl->tracks->total_length();
        if( !total_length ) total_length = 1;
        for( Track *track=edl->tracks->first; track!=0; track=track->next ) {
+               if( !track->record ) continue;
                for( Edit *edit=track->edits->first; edit!=0; edit=edit->next ) {
                        Indexable *indexable = (Indexable *)edit->asset;
                        if( !indexable ) indexable = (Indexable *)edit->nested_edl;
index 14a85cf..b12c5d0 100644 (file)
@@ -49,6 +49,12 @@ EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui)
 {
        this->mwindow = mwindow;
        this->gui = gui;
+
+       track = 0;
+       edit = 0;
+       plugin = 0;
+       pluginset = 0;
+       position = 0;
 }
 
 EditPopup::~EditPopup()
@@ -57,63 +63,73 @@ EditPopup::~EditPopup()
 
 void EditPopup::create_objects()
 {
-       add_item(new EditPopupClear(mwindow, this));
-       add_item(new EditPopupDelete(mwindow, this));
+       add_item(new EditPopupClearSelect(mwindow, this));
        add_item(new EditPopupCopy(mwindow, this));
        add_item(new EditPopupCut(mwindow, this));
-       add_item(new EditPopupCopyCut(mwindow, this));
+       add_item(new EditPopupMute(mwindow, this));
+       add_item(new EditPopupCopyPack(mwindow, this));
+       add_item(new EditPopupCutPack(mwindow, this));
+       add_item(new EditPopupMutePack(mwindow, this));
        add_item(new EditPopupPaste(mwindow, this));
+       add_item(new EditPopupOverwrite(mwindow, this));
        add_item(new EditPopupFindAsset(mwindow, this));
        add_item(new EditPopupTitle(mwindow, this));
        add_item(new EditPopupShow(mwindow, this));
 }
 
-int EditPopup::update(Edit *edit)
+int EditPopup::activate_menu(Track *track, Edit *edit,
+               PluginSet *pluginset, Plugin *plugin, double position)
 {
+       this->track = track;
        this->edit = edit;
-       return 0;
+       this->pluginset = pluginset;
+       this->plugin = plugin;
+       this->position = position;
+       return BC_PopupMenu::activate_menu();
 }
 
-
-EditPopupClear::EditPopupClear(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Clear"),_("Ctrl-m"),'m')
+EditPopupClearSelect::EditPopupClearSelect(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Clear Select"),_("Ctrl-A"),'A')
 {
        this->mwindow = mwindow;
        this->popup = popup;
        set_ctrl(1);
+       set_shift(1);
 }
 
-int EditPopupClear::handle_event()
+int EditPopupClearSelect::handle_event()
 {
-       mwindow->delete_edits(0);
+       mwindow->edl->tracks->clear_selected_edits();
+       popup->gui->draw_overlays(1);
        return 1;
 }
 
-EditPopupDelete::EditPopupDelete(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Delete"),_("Ctrl-DEL"),DELETE)
+EditPopupCopy::EditPopupCopy(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Copy"),_("Ctrl-c"),'c')
 {
        this->mwindow = mwindow;
        this->popup = popup;
        set_ctrl(1);
 }
 
-int EditPopupDelete::handle_event()
+int EditPopupCopy::handle_event()
 {
-       mwindow->delete_edits(1);
+       mwindow->selected_to_clipboard(0);
        return 1;
 }
 
-EditPopupCopy::EditPopupCopy(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Copy"),_("Ctrl-c"),'c')
+EditPopupCopyPack::EditPopupCopyPack(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Copy pack"),_("Ctrl-C"),'C')
 {
        this->mwindow = mwindow;
        this->popup = popup;
        set_ctrl(1);
+       set_shift(1);
 }
 
-int EditPopupCopy::handle_event()
+int EditPopupCopyPack::handle_event()
 {
-       mwindow->selected_to_clipboard();
+       mwindow->selected_to_clipboard(1);
        return 1;
 }
 
@@ -127,21 +143,50 @@ EditPopupCut::EditPopupCut(MWindow *mwindow, EditPopup *popup)
 
 int EditPopupCut::handle_event()
 {
-       mwindow->cut_selected_edits(1);
+       mwindow->cut_selected_edits(1, 0);
+       return 1;
+}
+
+EditPopupCutPack::EditPopupCutPack(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Cut pack"),_("Ctrl-z"),'z')
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       set_ctrl(1);
+}
+
+int EditPopupCutPack::handle_event()
+{
+       mwindow->cut_selected_edits(1, 1);
+       return 1;
+}
+
+EditPopupMute::EditPopupMute(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Mute"),_("Ctrl-m"),'m')
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       set_ctrl(1);
+}
+
+int EditPopupMute::handle_event()
+{
+       mwindow->cut_selected_edits(0, 0);
        return 1;
 }
 
-EditPopupCopyCut::EditPopupCopyCut(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Copy cut"),_("Ctrl-z"),'z')
+EditPopupMutePack::EditPopupMutePack(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Mute pack"),_("Ctrl-M"),'M')
 {
        this->mwindow = mwindow;
        this->popup = popup;
        set_ctrl(1);
+       set_shift(1);
 }
 
-int EditPopupCopyCut::handle_event()
+int EditPopupMutePack::handle_event()
 {
-       mwindow->cut_selected_edits(0);
+       mwindow->cut_selected_edits(0, 1);
        return 1;
 }
 
@@ -155,7 +200,29 @@ EditPopupPaste::EditPopupPaste(MWindow *mwindow, EditPopup *popup)
 
 int EditPopupPaste::handle_event()
 {
-       mwindow->paste();
+       mwindow->paste(popup->position, popup->track, 0, 0);
+       if( mwindow->session->current_operation == DROP_TARGETING ) {
+               mwindow->session->current_operation = NO_OPERATION;
+               popup->gui->update_cursor();
+       }
+       return 1;
+}
+
+EditPopupOverwrite::EditPopupOverwrite(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Overwrite"),_("Ctrl-b"),'b')
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       set_ctrl(1);
+}
+
+int EditPopupOverwrite::handle_event()
+{
+       mwindow->paste(popup->position, popup->track, 0, -1);
+       if( mwindow->session->current_operation == DROP_TARGETING ) {
+               mwindow->session->current_operation = NO_OPERATION;
+               popup->gui->update_cursor();
+       }
        return 1;
 }
 
index 488bf4f..13951ae 100644 (file)
 #include "editpopup.inc"
 #include "mwindow.inc"
 #include "mwindowgui.inc"
+#include "plugin.inc"
+#include "pluginset.inc"
 #include "plugindialog.inc"
 #include "resizetrackthread.inc"
+#include "track.inc"
 
 class EditPopup : public BC_PopupMenu
 {
@@ -37,38 +40,42 @@ public:
        ~EditPopup();
 
        void create_objects();
-       int update(Edit *edit);
+       int activate_menu(Track *track, Edit *edit,
+               PluginSet *pluginset, Plugin *plugin, double position);
 
        MWindow *mwindow;
        MWindowGUI *gui;
+       Track *track;
        Edit *edit;
+       Plugin *plugin;
+       PluginSet *pluginset;
+       double position;
 };
 
-
-class EditPopupClear : public BC_MenuItem
+class EditPopupClearSelect : public BC_MenuItem
 {
 public:
-       EditPopupClear(MWindow *mwindow, EditPopup *popup);
+       EditPopupClearSelect(MWindow *mwindow, EditPopup *popup);
        int handle_event();
 
        MWindow *mwindow;
        EditPopup *popup;
 };
 
-class EditPopupDelete : public BC_MenuItem
+class EditPopupCopy : public BC_MenuItem
 {
 public:
-       EditPopupDelete(MWindow *mwindow, EditPopup *popup);
+       EditPopupCopy(MWindow *mwindow, EditPopup *popup);
        int handle_event();
 
        MWindow *mwindow;
        EditPopup *popup;
 };
 
-class EditPopupCopy : public BC_MenuItem
+class EditPopupCopyPack : public BC_MenuItem
 {
 public:
-       EditPopupCopy(MWindow *mwindow, EditPopup *popup);
+       EditPopupCopyPack(MWindow *mwindow, EditPopup *popup);
        int handle_event();
 
        MWindow *mwindow;
@@ -85,10 +92,30 @@ public:
        EditPopup *popup;
 };
 
-class EditPopupCopyCut : public BC_MenuItem
+class EditPopupCutPack : public BC_MenuItem
 {
 public:
-       EditPopupCopyCut(MWindow *mwindow, EditPopup *popup);
+       EditPopupCutPack(MWindow *mwindow, EditPopup *popup);
+       int handle_event();
+
+       MWindow *mwindow;
+       EditPopup *popup;
+};
+
+class EditPopupMute : public BC_MenuItem
+{
+public:
+       EditPopupMute(MWindow *mwindow, EditPopup *popup);
+       int handle_event();
+
+       MWindow *mwindow;
+       EditPopup *popup;
+};
+
+class EditPopupMutePack : public BC_MenuItem
+{
+public:
+       EditPopupMutePack(MWindow *mwindow, EditPopup *popup);
        int handle_event();
 
        MWindow *mwindow;
@@ -105,6 +132,16 @@ public:
        EditPopup *popup;
 };
 
+class EditPopupOverwrite : public BC_MenuItem
+{
+public:
+       EditPopupOverwrite(MWindow *mwindow, EditPopup *popup);
+       int handle_event();
+
+       MWindow *mwindow;
+       EditPopup *popup;
+};
+
 class EditPopupFindAsset : public BC_MenuItem
 {
 public:
index 37574b1..c1257ea 100644 (file)
 #define __EDITPOPUP_INC__
 
 class EditPopup;
-class EditClear;
-class EditDelete;
-class EditCopy;
-class EditCut;
-class EditCopyCut;
-class EditPaste;
+class EditPopupClearSelect;
+class EditPopupCopy;
+class EditPopupCopyPack;
+class EditPopupCut;
+class EditPopupCutPack;
+class EditPopupMute;
+class EditPopupMutePack;
+class EditPopupPaste;
+class EditPopupOverwrite;
 class EditPopupFindAsset;
 class EditPopupTitle;
 class EditTitleDialogThread;
index 52a0220..32c4748 100644 (file)
@@ -61,7 +61,8 @@ enum
        DRAG_PLUGINKEY,
        DRAG_PLUGINHANDLE1,        // Waiting to move out of drag threshold
        DRAG_PLUGINHANDLE2,         // Dragging outside drag threshold
-       DRAG_SPEED
+       DRAG_SPEED,
+       DROP_TARGETING,
 };
 
 
index 79bbb5c..71d2356 100644 (file)
@@ -182,7 +182,7 @@ public:
        void update_vwindow();
 // Fit selected time to horizontal display range
        void fit_selection();
-       void selected_to_clipboard();
+       void selected_to_clipboard(int packed);
 // Fit selected autos to the vertical display range
        void fit_autos(int doall);
        void change_currentautorange(int autogrouptype, int increment, int changemax);
@@ -364,17 +364,13 @@ public:
        int feather_edits(int64_t feather_samples, int audio, int video);
        int64_t get_feather(int audio, int video);
        float get_aspect_ratio();
-       void insert(double position,
-               FileXML *file,
-               int edit_labels,
-               int edit_plugins,
-               int edit_autos,
-               EDL *parent_edl /* = 0 */);
+       void insert(double position, FileXML *file,
+               int edit_labels, int edit_plugins, int edit_autos,
+               EDL *parent_edl, Track *first_track, int overwrite);
 
 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
 // into pluginset_highlighted.
-       void insert_effects_canvas(double start,
-               double length);
+       void insert_effects_canvas(double start, double length);
 
 // CWindow calls this to insert multiple effects from
 // the drag_pluginservers array.
@@ -385,37 +381,27 @@ public:
 // other tracks
        void insert_effect(char *title,
                SharedLocation *shared_location,
-               int data_type,
-               int plugin_type,
-               int single_standalone);
+               int data_type, int plugin_type, int single_standalone);
 
 // This is called multiple times by the above functions.
 // It can't sync parameters.
        void insert_effect(char *title,
                SharedLocation *shared_location,
-               Track *track,
-               PluginSet *plugin_set,
-               double start,
-               double length,
-               int plugin_type);
+               Track *track, PluginSet *plugin_set,
+               double start, double length, int plugin_type);
 
        void match_output_size(Track *track);
        void delete_edit(Edit *edit, const char *msg, int collapse=0);
        void delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse=0);
        void delete_edits(int collapse=0);
-       void cut_selected_edits(int collapse=0);
+       void cut_selected_edits(int collapse, int packed);
 // Move edit to new position
-       void move_edits(ArrayList<Edit*> *edits,
-               Track *track,
-               double position,
-               int behaviour);       // behaviour: 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
+       void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
+// 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
+               int behaviour);
 // Move effect to position
-       void move_effect(Plugin *plugin,
-               Track *track,
-               int64_t position);
-       void move_effect(Plugin *plugin,
-               PluginSet *plugin_set,
-               int64_t position);
+       void move_effect(Plugin *plugin, Track *track, int64_t position);
+       void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
        void move_plugins_up(PluginSet *plugin_set);
        void move_plugins_down(PluginSet *plugin_set);
        void move_track_down(Track *track);
@@ -427,11 +413,13 @@ public:
        void delete_folder(char *folder);
 // For clipboard commands
        void paste();
+       void paste(double start, Track *first_track, int clear_selection, int overwrite);
 // For splice and overwrite
        void overwrite(EDL *source, int all);
        void splice(EDL *source, int all);
        int paste(double start, double end, FileXML *file,
-               int edit_labels, int edit_plugins, int edit_autos);
+               int edit_labels, int edit_plugins, int edit_autos,
+               Track *first_track, int overwrite);
        int paste_output(int64_t startproject, int64_t endproject,
                int64_t startsource_sample, int64_t endsource_sample,
                int64_t startsource_frame, int64_t endsource_frame,
index 3e6c899..a86b031 100644 (file)
@@ -672,7 +672,7 @@ void MWindow::delete_track(Track *track)
 // Insert data from clipboard
 void MWindow::insert(double position, FileXML *file,
        int edit_labels, int edit_plugins, int edit_autos,
-       EDL *parent_edl)
+       EDL *parent_edl, Track *first_track, int overwrite)
 {
 // For clipboard pasting make the new edl use a separate session
 // from the master EDL.  Then it can be resampled to the master rates.
@@ -699,8 +699,8 @@ void MWindow::insert(double position, FileXML *file,
 
 
 
-       paste_edls(&new_edls, LOADMODE_PASTE, 0, position,
-               edit_labels, edit_plugins, edit_autos, 0); // overwrite
+       paste_edls(&new_edls, LOADMODE_PASTE, first_track, position,
+               edit_labels, edit_plugins, edit_autos, overwrite);
 // if( vwindow->edl )
 // printf("MWindow::insert 5 %f %f\n",
 // vwindow->edl->local_session->in_point,
@@ -903,7 +903,7 @@ void MWindow::match_output_size(Track *track)
 }
 
 
-void MWindow::selected_to_clipboard()
+void MWindow::selected_to_clipboard(int packed)
 {
        EDL *new_edl = new EDL();
        new_edl->create_objects();
@@ -915,10 +915,29 @@ void MWindow::selected_to_clipboard()
        new_edl->session->video_tracks = 0;
        new_edl->session->audio_tracks = 0;
        for( Track *track=edl->tracks->first; track; track=track->next ) {
-               int64_t startproject = 0;
+               if( !track->record ) continue;
                Track *new_track = 0;
+               if( !packed ) {
+                       switch( track->data_type ) {
+                       case TRACK_VIDEO:
+                               ++new_edl->session->video_tracks;
+                               new_track = new_edl->tracks->add_video_track(0, 0);
+                               break;
+                       case TRACK_AUDIO:
+                               ++new_edl->session->audio_tracks;
+                               new_track = new_edl->tracks->add_audio_track(0, 0);
+                               break;
+                       case TRACK_SUBTITLE:
+                               new_track = new_edl->tracks->add_subttl_track(0, 0);
+                               break;
+                       }
+               }
+               int64_t startproject = 0, last_startproject = 0;
                for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
-                       if( !edit->is_selected ) continue;
+                       if( !edit->is_selected || edit->silence() ) {
+                               if( !packed ) startproject += edit->length;
+                               continue;
+                       }
                        if( !new_track ) {
                                switch( track->data_type ) {
                                case TRACK_VIDEO:
@@ -935,17 +954,25 @@ void MWindow::selected_to_clipboard()
                                }
                        }
                        if( new_track ) {
+                               if( !packed && last_startproject > 0 &&
+                                   startproject > last_startproject ) {
+                                       Edit *silence = new Edit(new_edl, new_track);
+                                       silence->startproject = last_startproject;
+                                       silence->length = startproject - last_startproject;
+                                       new_track->edits->append(silence);
+                               }
                                Edit *clip_edit = new Edit(new_edl, new_track);
                                clip_edit->copy_from(edit);
                                clip_edit->startproject = startproject;
                                startproject += clip_edit->length;
+                               last_startproject = startproject;
                                new_track->edits->append(clip_edit);
                        }
                }
        }
        double length = new_edl->tracks->total_length();
        FileXML file;
-       new_edl->copy(0, length, 0, &file, "", 1);
+       new_edl->copy(0, length, 1, &file, "", 1);
        const char *file_string = file.string();
        long file_length = strlen(file_string);
        gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
@@ -992,9 +1019,11 @@ void MWindow::delete_edits(int collapse)
        delete_edits(&edits,_("del edit"), collapse);
 }
 
-void MWindow::cut_selected_edits(int collapse)
+// collapse - delete from timeline, not collapse replace with silence
+// packed - omit unselected from selection, unpacked - replace unselected with silence
+void MWindow::cut_selected_edits(int collapse, int packed)
 {
-       selected_to_clipboard();
+       selected_to_clipboard(packed);
        ArrayList<Edit*> edits;
        edl->tracks->get_selected_edits(&edits);
        delete_edits(&edits, _("cut edit"), collapse);
@@ -1187,8 +1216,7 @@ void MWindow::overwrite(EDL *source, int all)
                edl->local_session->get_outpoint() < 0 )
                edl->clear(dst_start, dst_start + overwrite_len, 0, 0, 0);
 
-       paste(dst_start, dst_start + overwrite_len,
-               &file, 0, 0, 0);
+       paste(dst_start, dst_start + overwrite_len, &file, 0, 0, 0, 0, 0);
 
        edl->local_session->set_selectionstart(dst_start + overwrite_len);
        edl->local_session->set_selectionend(dst_start + overwrite_len);
@@ -1203,19 +1231,16 @@ void MWindow::overwrite(EDL *source, int all)
 }
 
 // For splice and overwrite
-int MWindow::paste(double start,
-       double end,
-       FileXML *file,
-       int edit_labels,
-       int edit_plugins,
-       int edit_autos)
+int MWindow::paste(double start, double end, FileXML *file,
+       int edit_labels, int edit_plugins, int edit_autos,
+       Track *first_track, int overwrite)
 {
        clear(0);
 
 // Want to insert with assets shared with the master EDL.
        insert(start, file,
                edit_labels, edit_plugins, edit_autos,
-               edl);
+               edl, first_track, overwrite);
 
        return 0;
 }
@@ -1223,7 +1248,11 @@ int MWindow::paste(double start,
 // For editing using insertion point
 void MWindow::paste()
 {
-       double start = edl->local_session->get_selectionstart();
+       paste(edl->local_session->get_selectionstart(), 0, 1, 0);
+}
+
+void MWindow::paste(double start, Track *first_track, int clear_selection, int overwrite)
+{
        //double end = edl->local_session->get_selectionend();
        int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
 
@@ -1233,13 +1262,13 @@ void MWindow::paste()
                gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
                FileXML file;
                file.read_from_string(string);
-               clear(0);
+               if( clear_selection ) clear(0);
 
                insert(start, &file,
                        edl->session->labels_follow_edits,
                        edl->session->plugins_follow_edits,
                        edl->session->autos_follow_edits,
-                       0);
+                       0, first_track, overwrite);
 
                edl->optimize();
                delete [] string;
@@ -1579,7 +1608,7 @@ int MWindow::paste_edls(ArrayList<EDL*> *new_edls, int load_mode,
                                        edl_length,
                                        edit_labels);
 //PRINT_TRACE
-
+                       double total_length = new_edl->tracks->total_length();
                        for( Track *new_track=new_edl->tracks->first;
                             new_track; new_track=new_track->next ) {
 // Get destination track of same type as new_track
@@ -1618,8 +1647,10 @@ int MWindow::paste_edls(ArrayList<EDL*> *new_edls, int load_mode,
                                                break;
                                        }
                                        if( overwrite ) {
+                                               double length = overwrite >= 0 ?
+                                                       new_track->get_length() : total_length;
                                                track->clear(current_position,
-                                                       current_position + new_track->get_length(),
+                                                       current_position + length,
                                                        1, // edit edits
                                                        edit_labels, edit_plugins, edit_autos,
                                                        1, // convert units
@@ -2104,7 +2135,8 @@ void MWindow::splice(EDL *source, int all)
        paste(start, start, &file,
                edl->session->labels_follow_edits,
                edl->session->plugins_follow_edits,
-               edl->session->autos_follow_edits);
+               edl->session->autos_follow_edits,
+               0, 0);
 
 // Position at end of clip
        edl->local_session->set_selectionstart(start + source_end - source_start);
index 89ddbcc..d66cf3b 100644 (file)
@@ -1170,9 +1170,17 @@ int MWindowGUI::keypress_event()
        int result = mbuttons->keypress_event();
        if( result ) return result;
 
-       Track *this_track = 0;
-
-       switch(get_keypress()) {
+       Track *this_track = 0, *first_track = 0;
+       int collapse = 0, packed = 0, overwrite = 0;
+       double position = 0;
+
+       switch( get_keypress() ) {
+       case 'A':
+               if( !ctrl_down() || !shift_down() || alt_down() ) break;
+               mwindow->edl->tracks->clear_selected_edits();
+               draw_overlays(1);
+               result = 1;
+               break;
        case 'e':
                mwindow->toggle_editing_mode();
                result = 1;
@@ -1186,23 +1194,48 @@ int MWindowGUI::keypress_event()
                result = 1;
                break;
 
+       case 'C':
+               packed = 1;
        case 'c':
                if( !ctrl_down() || alt_down() ) break;
-               mwindow->selected_to_clipboard();
+               mwindow->selected_to_clipboard(packed);
+               result = 1;
                break;
+       case 'b':
+               overwrite = -1; // fall thru
        case 'v':
                if( !ctrl_down() || alt_down() ) break;
-               mwindow->paste();
+               if( mwindow->session->current_operation == DROP_TARGETING ) {
+                       mwindow->session->current_operation = NO_OPERATION;
+                       mwindow->gui->set_editing_mode(1);
+                       int pane_no = 0;
+                       for( ; pane_no<TOTAL_PANES; ++pane_no  ) {
+                               if( !pane[pane_no] ) continue;
+                               first_track = pane[pane_no]->over_track();
+                               if( first_track ) break;
+                       }
+                       if( first_track ) {
+                               int cursor_x = pane[pane_no]->canvas->get_relative_cursor_x();
+                               position = mwindow->edl->get_cursor_position(cursor_x, pane_no);
+                       }
+               }
+               else
+                       position = mwindow->edl->local_session->get_selectionstart();
+               mwindow->paste(position, first_track, 0, overwrite);
+               result = 1;
+               break;
+       case 'M':
+               collapse = 1;
+       case 'm':
+               mwindow->cut_selected_edits(0, collapse);
+               result = 1;
                break;
        case 'z':
+               collapse = 1;
        case 'x':
                if( !ctrl_down() || alt_down() ) break;
-               mwindow->cut_selected_edits(get_keypress()=='x' ? 1 : 0);
-               break;
-       case 'm':
-       case DELETE:
-               if( !ctrl_down() || alt_down() ) break;
-               mwindow->delete_edits(get_keypress()==DELETE ? 1 : 0);
+               mwindow->cut_selected_edits(1, collapse);
+               result = 1;
                break;
 
        case '1': case '2': case '3': case '4':
index f2b7dd0..9d020d4 100644 (file)
@@ -184,17 +184,27 @@ int TrackCanvas::drag_motion_event()
        return gui->drag_motion();
 }
 
-int TrackCanvas::drag_motion(Track **over_track,
-       Edit **over_edit,
-       PluginSet **over_pluginset,
-       Plugin **over_plugin)
+int TrackCanvas::drag_motion(
+               Track **over_track, Edit **over_edit,
+               PluginSet **over_pluginset, Plugin **over_plugin)
 {
        int cursor_x = get_relative_cursor_x();
        int cursor_y = get_relative_cursor_y();
+       if( get_cursor_over_window() ) {
+               drag_cursor_motion(cursor_x, cursor_y,
+                       over_track, over_edit, over_pluginset, over_plugin);
+       }
+        if( over_track && !*over_track )
+               *over_track = pane->over_patchbay();
+       return 0;
+}
 
-       if( get_cursor_over_window() &&
-               cursor_x >= 0 && cursor_y >= 0 &&
-               cursor_x < get_w() && cursor_y < get_h() )
+int TrackCanvas::drag_cursor_motion(int cursor_x, int cursor_y,
+               Track **over_track, Edit **over_edit,
+               PluginSet **over_pluginset, Plugin **over_plugin)
+{
+       if( cursor_x >= 0 && cursor_y >= 0 &&
+           cursor_x < get_w() && cursor_y < get_h() )
        {
 //printf("TrackCanvas::drag_motion %d %d\n", __LINE__, pane->number);
 // Find the edit and track the cursor is over
@@ -260,9 +270,6 @@ int TrackCanvas::drag_motion(Track **over_track,
                }
        }
 
-        if( !*over_track )
-               *over_track = pane->over_patchbay();
-
        return 0;
 }
 
@@ -4193,6 +4200,10 @@ int TrackCanvas::cursor_update(int in_motion)
                        }
                        break;
 
+               case DROP_TARGETING:
+                       new_cursor = GRABBED_CURSOR;
+                       break;
+
                default:
                        if(is_event_win() && cursor_inside()) {
 // Update clocks
@@ -4457,6 +4468,17 @@ int TrackCanvas::button_release_event()
 // Trap in drag stop
                        break;
 
+               case DROP_TARGETING: {
+                       int cursor_x = get_cursor_x(), cursor_y = get_cursor_y();
+                       Track *track=0;  Edit *edit=0;  PluginSet *pluginset=0;  Plugin *plugin=0;
+                       drag_cursor_motion(cursor_x, cursor_y,
+                               &track, &edit, &pluginset, &plugin);
+                       double position =
+                               mwindow->edl->get_cursor_position(cursor_x, pane->number);
+                       gui->edit_menu->activate_menu(track, edit, pluginset, plugin, position);
+                       mwindow->session->current_operation = NO_OPERATION;
+                       result = 1;
+                       break; }
 
                default:
                        if(mwindow->session->current_operation) {
@@ -4680,25 +4702,24 @@ int TrackCanvas::do_tracks(int cursor_x, int cursor_y, int button_press)
 {
        int result = 0;
 
-       for(Track *track = mwindow->edl->tracks->first;
-               track && !result;
-               track = track->next) {
-               int64_t track_x, track_y, track_w, track_h;
-               track_dimensions(track, track_x, track_y, track_w, track_h);
-
-               if( button_press && cursor_y >= track_y && cursor_y < track_y + track_h ) {
-                       double pos = mwindow->edl->get_cursor_position(cursor_x, pane->number);
-                       int64_t position = track->to_units(pos, 0);
-                       if( get_buttonpress() == RIGHT_BUTTON ) {
-                               gui->track_menu->update(track);
-                               gui->track_menu->activate_menu();
-                               result = 1;
-                       }
-                       else if( get_buttonpress() == MIDDLE_BUTTON ) {
-                               gui->edit_menu->update(track->edits->editof(position, PLAY_FORWARD, 0));
-                               gui->edit_menu->activate_menu();
-                               result = 1;
-                       }
+       Track *track=0;  Edit *edit=0;  PluginSet *pluginset=0;  Plugin *plugin=0;
+       drag_cursor_motion(cursor_x, cursor_y,
+               &track, &edit, &pluginset, &plugin);
+
+       if( button_press && track ) {
+               switch( get_buttonpress() ) {
+               case RIGHT_BUTTON: {
+                       double position =
+                               mwindow->edl->get_cursor_position(cursor_x, pane->number);
+                       gui->track_menu->activate_menu(track, edit, pluginset, plugin, position);
+                       mwindow->session->current_operation = NO_OPERATION;
+                       result = 1;
+                       break; }
+               case MIDDLE_BUTTON:
+                       set_cursor(GRABBED_CURSOR, 0, 1);
+                       mwindow->session->current_operation = DROP_TARGETING;
+                       result = 1;
+                       break;
                }
        }
 
index d678799..a0c12a2 100644 (file)
@@ -334,10 +334,11 @@ public:
        int start_selection(double position);
        int drag_motion_event();
        int drag_stop_event();
-       int drag_motion(Track **over_track,
-               Edit **over_edit,
-               PluginSet **over_pluginset,
-               Plugin **over_plugin);
+       int drag_motion(Track **over_track, Edit **over_edit,
+               PluginSet **over_pluginset, Plugin **over_plugin);
+       int drag_cursor_motion(int cursor_x, int cursor_y,
+               Track **over_track, Edit **over_edit,
+               PluginSet **over_pluginset, Plugin **over_plugin);
        int drag_stop(int *redraw);
        int64_t drop_edit_position (int *is_insertion, Edit *moved_edit, int64_t moved_edit_length);
        int64_t drop_plugin_position(PluginSet *plugin_set, Plugin *moved_plugin);
index 0b12088..e1b55db 100644 (file)
@@ -47,6 +47,11 @@ TrackPopup::TrackPopup(MWindow *mwindow, MWindowGUI *gui)
 {
        this->mwindow = mwindow;
        this->gui = gui;
+       track = 0;
+       edit = 0;
+       pluginset = 0;
+       plugin = 0;
+       position = 0;
 }
 
 TrackPopup::~TrackPopup()
@@ -64,22 +69,25 @@ void TrackPopup::create_objects()
        matchsize_option = 0;
 }
 
-int TrackPopup::update(Track *track)
+int TrackPopup::activate_menu(Track *track, Edit *edit,
+               PluginSet *pluginset, Plugin *plugin, double position)
 {
        this->track = track;
+       this->edit = edit;
+       this->pluginset = pluginset;
+       this->plugin = plugin;
+       this->position = position;
 
-       if(track->data_type == TRACK_VIDEO && !resize_option)
-       {
+       if( track->data_type == TRACK_VIDEO && !resize_option ) {
                add_item(resize_option = new TrackPopupResize(mwindow, this));
                add_item(matchsize_option = new TrackPopupMatchSize(mwindow, this));
        }
-       else
-       if(track->data_type == TRACK_AUDIO && resize_option)
-       {
+       else if( track->data_type == TRACK_AUDIO && resize_option ) {
                del_item(resize_option);     resize_option = 0;
                del_item(matchsize_option);  matchsize_option = 0;
        }
-       return 0;
+
+       return BC_PopupMenu::activate_menu();
 }
 
 
index de6dd16..539385e 100644 (file)
@@ -38,13 +38,19 @@ public:
        ~TrackPopup();
 
        void create_objects();
-       int update(Track *track);
+       int activate_menu(Track *track, Edit *edit,
+               PluginSet *pluginset, Plugin *plugin, double position);
 
        MWindow *mwindow;
        MWindowGUI *gui;
-       Track *track;
        TrackPopupResize *resize_option;
        TrackPopupMatchSize *matchsize_option;
+
+       Track *track;
+       Edit *edit;
+       Plugin *plugin;
+       PluginSet *pluginset;
+       double position;
 };
 
 class TrackPopupMatchSize : public BC_MenuItem