From: Good Guy Date: Thu, 5 Mar 2020 02:26:30 +0000 (-0700) Subject: add auto next/prev tab (alt-a), update shortcuts, fix keyframe paste track tabbing... X-Git-Tag: 2020-03~19 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=b32cf83f55420546cdab0ee4b30a7a5638f63f33;p=goodguy%2Fcinelerra.git add auto next/prev tab (alt-a), update shortcuts, fix keyframe paste track tabbing, dont dblclk select_region if no labels --- diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 32f3d246..ac5d71a3 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -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 diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 0fde87ab..a9e93c64 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/mwindowmove.C b/cinelerra-5.1/cinelerra/mwindowmove.C index c76b9b74..dedf96e8 100644 --- a/cinelerra-5.1/cinelerra/mwindowmove.C +++ b/cinelerra-5.1/cinelerra/mwindowmove.C @@ -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; iplugin_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; iautomation->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(); diff --git a/cinelerra-5.1/cinelerra/pluginset.C b/cinelerra-5.1/cinelerra/pluginset.C index 86bb4b66..575f0465 100644 --- a/cinelerra-5.1/cinelerra/pluginset.C +++ b/cinelerra-5.1/cinelerra/pluginset.C @@ -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 ? diff --git a/cinelerra-5.1/cinelerra/timebar.C b/cinelerra-5.1/cinelerra/timebar.C index 222c6eff..79c99ed0 100644 --- a/cinelerra-5.1/cinelerra/timebar.C +++ b/cinelerra-5.1/cinelerra/timebar.C @@ -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; } diff --git a/cinelerra-5.1/doc/shortcuts.html b/cinelerra-5.1/doc/shortcuts.html index a4d84fea..ba6987e2 100644 --- a/cinelerra-5.1/doc/shortcuts.html +++ b/cinelerra-5.1/doc/shortcuts.html @@ -1041,9 +1041,33 @@
Prev kf select - 'Ctrl-shift-K’ + 'Ctrl-Shift-K’ Select from cursor to previous keyframe + +
+ Next auto + 'Alt-a’ + Move to next auto + + +
+ Prev auto + 'Ctrl-Alt-a’ + Move to previous auto + + +
+ Next auto select + 'Alt-Shift-A’ + Select from cursor to next auto + + +
+ Prev auto select + 'Ctrl-Alt-Shf-A’ + Select from cursor to previous auto + Previous edit @@ -1564,7 +1588,7 @@

Double MMB - On fade/speed, select keyframe position + On auto or keyframe, select that position