From 62709d0558a8c4366f75ae39f5f98e759e19fcfc Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 13 Mar 2018 11:21:28 -0600 Subject: [PATCH] refresh on forward selection --- cinelerra-5.1/cinelerra/cwindow.C | 37 +++++++----------------- cinelerra-5.1/cinelerra/cwindow.h | 6 ++-- cinelerra-5.1/cinelerra/mwindow.C | 5 ++-- cinelerra-5.1/cinelerra/mwindow.h | 2 +- cinelerra-5.1/cinelerra/playbackengine.C | 10 +++++-- cinelerra-5.1/cinelerra/playbackengine.h | 2 +- cinelerra-5.1/cinelerra/playtransport.C | 1 + cinelerra-5.1/cinelerra/renderengine.C | 2 +- cinelerra-5.1/cinelerra/trackcanvas.C | 20 ++++++++----- cinelerra-5.1/cinelerra/transportque.C | 13 +++++---- cinelerra-5.1/cinelerra/transportque.inc | 1 + cinelerra-5.1/cinelerra/vmodule.C | 5 ++-- cinelerra-5.1/cinelerra/vrender.C | 6 ++-- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/cinelerra-5.1/cinelerra/cwindow.C b/cinelerra-5.1/cinelerra/cwindow.C index 7152f5a6..3a65150d 100644 --- a/cinelerra-5.1/cinelerra/cwindow.C +++ b/cinelerra-5.1/cinelerra/cwindow.C @@ -225,45 +225,28 @@ void CWindow::run() gui->run_window(); } -void CWindow::update(int position, - int overlays, - int tool_window, - int operation, - int timebar) +void CWindow::update(int dir, int overlays, int tool_window, int operation, int timebar) { - if(position) - { - refresh_frame(CHANGE_NONE); - } + if(dir) + refresh_frame(CHANGE_NONE, dir); gui->lock_window("CWindow::update 2"); - - // Create tool window if(operation) - { gui->set_operation(mwindow->edl->session->cwindow_operation); - } - // Updated by video device. - if(overlays && !position) - { + if(overlays && !dir) gui->canvas->draw_refresh(); - } // Update tool parameters // Never updated by someone else - if(tool_window || position) - { + if(tool_window || dir) gui->update_tool(); - } if(timebar) - { gui->timebar->update(1); - } double zoom = !mwindow->edl->session->cwindow_scrollbars ? 0 :mwindow->edl->session->cwindow_zoom; @@ -305,15 +288,15 @@ int CWindow::update_position(double position) return 1; } -void CWindow::refresh_frame(int change_type, EDL *edl) +void CWindow::refresh_frame(int change_type, EDL *edl, int dir) { - mwindow->refresh_mixers(); - playback_engine->refresh_frame(change_type, edl); + mwindow->refresh_mixers(dir); + playback_engine->refresh_frame(change_type, edl, dir); } -void CWindow::refresh_frame(int change_type) +void CWindow::refresh_frame(int change_type, int dir) { - refresh_frame(change_type, mwindow->edl); + refresh_frame(change_type, mwindow->edl, dir); } CWindowRemoteHandler:: diff --git a/cinelerra-5.1/cinelerra/cwindow.h b/cinelerra-5.1/cinelerra/cwindow.h index 04845095..28bfa978 100644 --- a/cinelerra-5.1/cinelerra/cwindow.h +++ b/cinelerra-5.1/cinelerra/cwindow.h @@ -42,7 +42,7 @@ public: void create_objects(); // Position is inclusive of the other 2 - void update(int position, + void update(int dir, int overlays, int tool_window, int operation = 0, @@ -71,8 +71,8 @@ public: void hide_window(); int update_position(double position); void stop_playback(int wait); - void refresh_frame(int change_type); - void refresh_frame(int change_type, EDL *edl); + void refresh_frame(int change_type, int dir=1); + void refresh_frame(int change_type, EDL *edl, int dir=1); int destination; MWindow *mwindow; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index de11d94e..4245e872 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -1254,9 +1254,10 @@ void MWindow::queue_mixers(EDL *edl, int command, int wait_tracking, zwindows_lock->unlock(); } -void MWindow::refresh_mixers() +void MWindow::refresh_mixers(int dir) { - queue_mixers(edl,CURRENT_FRAME,0,0,1,0,0); + int command = dir >= 0 ? CURRENT_FRAME : LAST_FRAME; + queue_mixers(edl,command,0,0,1,0,0); } void MWindow::stop_mixers() diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 8482dc06..69781804 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -205,7 +205,7 @@ public: void queue_mixers(EDL *edl, int command, int wait_tracking, int use_inout, int update_refresh, int toggle_audio, int loop_play); void create_mixers(); - void refresh_mixers(); + void refresh_mixers(int dir=1); void stop_mixers(); void close_mixers(); void open_mixers(); diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index b0c9fe3e..71cd3911 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -390,6 +390,7 @@ void PlaybackEngine::run() break; case CURRENT_FRAME: + case LAST_FRAME: last_command = command->command; perform_change(); arm_render_engine(); @@ -457,6 +458,8 @@ void PlaybackEngine::issue_command(EDL *edl, int command, int wait_tracking, case SLOW_FWD: case NORMAL_FWD: case FAST_FWD: + case CURRENT_FRAME: + case LAST_FRAME: if( !prev_single_frame && prev_command == command && cur_audio == prev_audio ) { @@ -475,6 +478,8 @@ void PlaybackEngine::issue_command(EDL *edl, int command, int wait_tracking, case COMMAND_NONE: case SINGLE_FRAME_FWD: case SINGLE_FRAME_REWIND: + case CURRENT_FRAME: + case LAST_FRAME: // Start from scratch que->send_command(command, CHANGE_NONE, edl, 1, resume, use_inout, toggle_audio, loop_play, @@ -497,8 +502,9 @@ void PlaybackEngine::issue_command(EDL *edl, int command, int wait_tracking, } } -void PlaybackEngine::refresh_frame(int change_type, EDL *edl) +void PlaybackEngine::refresh_frame(int change_type, EDL *edl, int dir) { - que->send_command(CURRENT_FRAME, change_type, edl, 1); + que->send_command(dir >= 0 ? CURRENT_FRAME : LAST_FRAME, + change_type, edl, 1); } diff --git a/cinelerra-5.1/cinelerra/playbackengine.h b/cinelerra-5.1/cinelerra/playbackengine.h index f4ce0157..936657a0 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.h +++ b/cinelerra-5.1/cinelerra/playbackengine.h @@ -84,7 +84,7 @@ public: void stop_playback(int wait); void issue_command(EDL *edl, int command, int wait_tracking, int use_inout, int update_refresh, int toggle_audio, int loop_play); - void refresh_frame(int change_type, EDL *edl); + void refresh_frame(int change_type, EDL *edl, int dir=1); // Maintain caches through console changes CICache *audio_cache, *video_cache; diff --git a/cinelerra-5.1/cinelerra/playtransport.C b/cinelerra-5.1/cinelerra/playtransport.C index 966d299d..1cec6c9f 100644 --- a/cinelerra-5.1/cinelerra/playtransport.C +++ b/cinelerra-5.1/cinelerra/playtransport.C @@ -226,6 +226,7 @@ int PlayTransport::do_keypress(int key) switch( prev_command ) { case COMMAND_NONE: case CURRENT_FRAME: + case LAST_FRAME: case PAUSE: case STOP: command = NORMAL_FWD; diff --git a/cinelerra-5.1/cinelerra/renderengine.C b/cinelerra-5.1/cinelerra/renderengine.C index 6bba1270..3c73709a 100644 --- a/cinelerra-5.1/cinelerra/renderengine.C +++ b/cinelerra-5.1/cinelerra/renderengine.C @@ -516,7 +516,7 @@ void RenderEngine::run() // Fix the tracking position if(playback_engine) { - if(command->command == CURRENT_FRAME) + if(command->command == CURRENT_FRAME || command->command == LAST_FRAME) { //printf("RenderEngine::run 4.1 %d\n", playback_engine->tracking_position); playback_engine->tracking_position = command->playbackstart; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 35c773b0..6a34b7f1 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -4027,22 +4027,26 @@ int TrackCanvas::cursor_motion_event() position = mwindow->edl->align_to_frame(position, 0); position = MAX(position, 0); + double start = mwindow->edl->local_session->get_selectionstart(1); + double end = mwindow->edl->local_session->get_selectionend(1); if(position < selection_midpoint) { mwindow->edl->local_session->set_selectionend(selection_midpoint); mwindow->edl->local_session->set_selectionstart(position); - // Que the CWindow - gui->unlock_window(); - mwindow->cwindow->update(1, 0, 0, 0, 1); - gui->lock_window("TrackCanvas::cursor_motion_event 1"); - // Update the faders - mwindow->update_plugin_guis(); - gui->update_patchbay(); } else { mwindow->edl->local_session->set_selectionstart(selection_midpoint); mwindow->edl->local_session->set_selectionend(position); - // Don't que the CWindow } + // Que the CWindow + gui->unlock_window(); + int dir = + start != mwindow->edl->local_session->get_selectionstart(1) ? 1 : + end != mwindow->edl->local_session->get_selectionend(1) ? -1 : 0; + mwindow->cwindow->update(dir, 0, 0, 0, 1); + gui->lock_window("TrackCanvas::cursor_motion_event 1"); + // Update the faders + mwindow->update_plugin_guis(); + gui->update_patchbay(); timebar_position = mwindow->edl->local_session->get_selectionend(1); diff --git a/cinelerra-5.1/cinelerra/transportque.C b/cinelerra-5.1/cinelerra/transportque.C index 816e81a4..35d6f1f3 100644 --- a/cinelerra-5.1/cinelerra/transportque.C +++ b/cinelerra-5.1/cinelerra/transportque.C @@ -101,9 +101,8 @@ TransportCommand& TransportCommand::operator=(TransportCommand &command) int TransportCommand::single_frame(int command) { - return (command == SINGLE_FRAME_FWD || - command == SINGLE_FRAME_REWIND || - command == CURRENT_FRAME); + return (command == SINGLE_FRAME_FWD || command == SINGLE_FRAME_REWIND || + command == CURRENT_FRAME || command == LAST_FRAME); } int TransportCommand::single_frame() { @@ -125,6 +124,7 @@ int TransportCommand::get_direction(int command) case NORMAL_REWIND: case FAST_REWIND: case SLOW_REWIND: + case LAST_FRAME: return PLAY_REVERSE; default: @@ -149,6 +149,7 @@ float TransportCommand::get_speed(int command) case SINGLE_FRAME_FWD: case SINGLE_FRAME_REWIND: case CURRENT_FRAME: + case LAST_FRAME: return 1.; case FAST_FWD: @@ -210,6 +211,7 @@ void TransportCommand::set_playback_range(EDL *edl, break; case CURRENT_FRAME: + case LAST_FRAME: case SINGLE_FRAME_FWD: end_position = start_position + frame_period; break; @@ -219,8 +221,9 @@ void TransportCommand::set_playback_range(EDL *edl, break; } - if( use_displacement && command != CURRENT_FRAME && - get_direction() == PLAY_FORWARD ) { + if( use_displacement && ( + (command != CURRENT_FRAME && get_direction() == PLAY_FORWARD ) || + (command != LAST_FRAME && get_direction() == PLAY_REVERSE ) ) ) { start_position += frame_period; end_position += frame_period; displacement = 1; diff --git a/cinelerra-5.1/cinelerra/transportque.inc b/cinelerra-5.1/cinelerra/transportque.inc index 3ce2f20e..c59fddc6 100644 --- a/cinelerra-5.1/cinelerra/transportque.inc +++ b/cinelerra-5.1/cinelerra/transportque.inc @@ -44,6 +44,7 @@ #define REWIND 11 #define GOTO_END 12 #define CURRENT_FRAME 13 +#define LAST_FRAME 14 // Level of change. Changes have to be inclusive of all the lesser changes. // Delete cache diff --git a/cinelerra-5.1/cinelerra/vmodule.C b/cinelerra-5.1/cinelerra/vmodule.C index 5019c86b..1958ef78 100644 --- a/cinelerra-5.1/cinelerra/vmodule.C +++ b/cinelerra-5.1/cinelerra/vmodule.C @@ -159,9 +159,10 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, __LINE__, nested_edl, current_edit->nested_edl); // Convert requested direction to command - if(renderengine->command->command == CURRENT_FRAME) + if( renderengine->command->command == CURRENT_FRAME || + renderengine->command->command == LAST_FRAME ) { - command = CURRENT_FRAME; + command = renderengine->command->command; } else if(direction == PLAY_REVERSE) diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index 7a4323bd..42f83ef8 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -462,9 +462,9 @@ void VRender::run() __LINE__, current_position, done); // Update tracking. - if(renderengine->command->realtime && - renderengine->playback_engine && - renderengine->command->command != CURRENT_FRAME) + if(renderengine->command->realtime && renderengine->playback_engine && + renderengine->command->command != CURRENT_FRAME && + renderengine->command->command != LAST_FRAME) { renderengine->playback_engine->update_tracking(fromunits(current_position)); } -- 2.26.2