add auto next/prev tab (alt-a), update shortcuts, fix keyframe paste track tabbing...
authorGood Guy <[email protected]>
Thu, 5 Mar 2020 02:26:30 +0000 (19:26 -0700)
committerGood Guy <[email protected]>
Thu, 5 Mar 2020 02:26:30 +0000 (19:26 -0700)
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowgui.C
cinelerra-5.1/cinelerra/mwindowmove.C
cinelerra-5.1/cinelerra/pluginset.C
cinelerra-5.1/cinelerra/timebar.C
cinelerra-5.1/doc/shortcuts.html

index 32f3d24691dbd12f6d2a290a1fb62fd0f462a3aa..ac5d71a32f818f02f4a2a3ce96ae96648fb741ba 100644 (file)
@@ -318,6 +318,7 @@ public:
        int prev_edit_handle(int shift_down);
 // seek to keyframes
        int nearest_plugin_keyframe(int shift_down, int dir);
+       int nearest_auto_keyframe(int shift_down, int dir);
 // offset is pixels to add to track_start
        void trackmovement(int offset, int pane_number);
 // view_start is pixels
index 0fde87abb75419f77ce5abb61908a78b6f3e6b03..a9e93c6419a18f5a3f061358ee6ec94bcd195598 100644 (file)
@@ -1084,11 +1084,21 @@ int MWindowGUI::keypress_event()
 
        switch( get_keypress() ) {
        case 'A':
-               if( !ctrl_down() || !shift_down() || alt_down() ) break;
-               mwindow->edl->tracks->clear_selected_edits();
-               draw_overlays(1);
+               if( !alt_down() ) {
+                       if( !ctrl_down() || !shift_down() ) break;
+                       mwindow->edl->tracks->clear_selected_edits();
+                       draw_overlays(1);
+                       result = 1;
+                       break;
+               } // fall thru
+       case 'a':
+               if( !alt_down() ) break;
+               stop_transport("MWindowGUI::keypress_event 1");
+               mwindow->nearest_auto_keyframe(shift_down(),
+                       !ctrl_down() ? PLAY_FORWARD : PLAY_REVERSE);
                result = 1;
                break;
+
        case 'e':
                mwindow->toggle_editing_mode();
                result = 1;
@@ -1096,7 +1106,7 @@ int MWindowGUI::keypress_event()
 
        case 'k': case 'K':
                if( alt_down() ) break;
-               stop_transport("MWindowGUI::keypress_event 1");
+               stop_transport("MWindowGUI::keypress_event 2");
                mwindow->nearest_plugin_keyframe(shift_down(),
                        !ctrl_down() ? PLAY_FORWARD : PLAY_REVERSE);
                result = 1;
index c76b9b7439cbbd4b340de76ddb9234ca29e27214..dedf96e87671af9b5f7ec099d986cf4a25c58de0 100644 (file)
@@ -644,7 +644,8 @@ int MWindow::nearest_plugin_keyframe(int shift_down, int dir)
        KeyFrame *keyframe = 0;
        double start = edl->local_session->get_selectionstart(1);
        double end = edl->local_session->get_selectionend(1);
-       double position = dir == PLAY_FORWARD ? end : start, new_position = 0;
+       double position = dir == PLAY_FORWARD ? end : start;
+       double new_position = dir == PLAY_FORWARD ? start : end;
        for( Track *track=edl->tracks->first; track; track=track->next ) {
                if( !track->record ) continue;
                for( int i=0; i<track->plugin_set.size(); ++i ) {
@@ -676,6 +677,47 @@ int MWindow::nearest_plugin_keyframe(int shift_down, int dir)
        return find_selection(new_position);
 }
 
+int MWindow::nearest_auto_keyframe(int shift_down, int dir)
+{
+       Auto *keyframe = 0;
+       double start = edl->local_session->get_selectionstart(1);
+       double end = edl->local_session->get_selectionend(1);
+       double position = dir == PLAY_FORWARD ? end : start;
+       double new_position = dir == PLAY_FORWARD ? start : end;
+       for( Track *track=edl->tracks->first; track; track=track->next ) {
+               if( !track->record ) continue;
+               int64_t pos = track->to_units(position, 0);
+               for( int i=0; i<AUTOMATION_TOTAL; ++i ) {
+                       Autos *autos = track->automation->autos[i];
+                       if( !autos ) continue;
+                       Auto *key = dir == PLAY_FORWARD ?
+                                autos->nearest_after(pos) :
+                                autos->nearest_before(pos);
+                       if( !key ) continue;
+                       double key_position = track->from_units(key->position);
+                       if( keyframe && (dir == PLAY_FORWARD ?
+                               key_position >= new_position :
+                               new_position >= key_position ) ) continue;
+                       keyframe = key;  new_position = key_position;
+               }
+       }
+
+       new_position = keyframe ?
+               keyframe->autos->track->from_units(keyframe->position) :
+               dir == PLAY_FORWARD ? edl->tracks->total_length() : 0;
+
+       if( !shift_down )
+               start = end = new_position;
+       else if( dir == PLAY_FORWARD )
+               end = new_position;
+       else
+               start = new_position;
+
+       edl->local_session->set_selectionstart(start);
+       edl->local_session->set_selectionend(end);
+       return find_selection(new_position);
+}
+
 int MWindow::find_selection(double position, int scroll_display)
 {
        update_plugin_guis();
index 86bb4b6687290e24f3904ec637b021481f466cfc..575f04651ce78c10fc33d24958b618ecb4c65ac4 100644 (file)
@@ -160,6 +160,10 @@ Edit* PluginSet::insert_edit_after(Edit *previous_edit)
 
 KeyFrame *PluginSet::nearest_keyframe(int64_t pos, int dir)
 {
+       if( first && pos < first->startproject )
+               pos = first->startproject;
+       else if( last && pos > last->startproject+last->length )
+               pos = last->startproject+last->length;
        Plugin *plugin = (Plugin*)editof(pos, dir, 0);
        if( !plugin ) return 0;
        KeyFrame *keyframe = (KeyFrame *)(dir == PLAY_FORWARD ?
index 222c6effdee124318938f5fe8a4a678a4d82c5a0..79c99ed04ea2a37a61747b4722aea849ede87231 100644 (file)
@@ -746,7 +746,8 @@ int TimeBar::button_press_event()
                        stop_playback();
 
 // Select region between two labels
-                       if( !is_vwindow() && get_double_click() ) {
+                       if( !is_vwindow() && get_double_click() &&
+                           get_edl()->labels->first ) {
                                int x = get_relative_cursor_x();
                                double position = pixel_to_position(x);
 // Test labels
@@ -920,14 +921,14 @@ int TimeBar::select_region(double position)
 // Que the CWindow
        unlock_window();
        mwindow->cwindow->update(1, 0, 0);
-       mwindow->gui->lock_window("TimeBar::select_region");
+       mwindow->gui->lock_window("TimeBar::select_region 3");
        mwindow->gui->hide_cursor(0);
        mwindow->gui->draw_cursor(1);
        mwindow->gui->flash_canvas(0);
        mwindow->gui->activate_timeline();
        mwindow->gui->zoombar->update();
        mwindow->gui->unlock_window();
-       lock_window("TimeBar::select_region");
+       lock_window("TimeBar::select_region 4");
        update_highlights();
        return 0;
 }
index a4d84feab8cbd2a1a85451f64ea4ad098fb5b5de..ba6987e2b7511b2b05990d89feac3bcaef6eae46 100644 (file)
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Prev kf select</font></td>
-               <td align="left"><font face="Liberation Serif" size=4>'Ctrl-shift-K’</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl-Shift-K’</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Select from cursor to previous keyframe</font></td>
        </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Next auto</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Alt-a’</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Move to next auto</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Prev auto</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl-Alt-a’</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Move to previous auto</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Next auto select</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Alt-Shift-A’</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Select from cursor to next auto</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Prev auto select</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl-Alt-Shf-A’</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Select from cursor to previous auto</font></td>
+       </tr>
        <tr>
                <td height="26" align="right"><font face="Liberation Serif" size=4> </font></td>
                <td align="left"><font face="Liberation Serif" size=4>Previous edit</font></td>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Double MMB</font></td>
-               <td align="left"><font face="Liberation Serif" size=4>On fade/speed, select keyframe position</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>On auto or keyframe, select that position</font></td>
        </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>