refresh on forward selection
authorGood Guy <[email protected]>
Tue, 13 Mar 2018 17:21:28 +0000 (11:21 -0600)
committerGood Guy <[email protected]>
Tue, 13 Mar 2018 17:21:28 +0000 (11:21 -0600)
13 files changed:
cinelerra-5.1/cinelerra/cwindow.C
cinelerra-5.1/cinelerra/cwindow.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/playbackengine.C
cinelerra-5.1/cinelerra/playbackengine.h
cinelerra-5.1/cinelerra/playtransport.C
cinelerra-5.1/cinelerra/renderengine.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/transportque.C
cinelerra-5.1/cinelerra/transportque.inc
cinelerra-5.1/cinelerra/vmodule.C
cinelerra-5.1/cinelerra/vrender.C

index 7152f5a671206b40820044c6afe77d521063ca59..3a65150df6c586664a0ce807ec5afd63c4edb3e0 100644 (file)
@@ -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::
index 04845095438130882669cdce0d70da8092725360..28bfa9780f6afd4a216e2e4d0c24e8e310dfd428 100644 (file)
@@ -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;
index de11d94e0c30ef32a89119b9b012570d5f51b9f6..4245e8725cb4f6ffed21178d9887bf0d478175a5 100644 (file)
@@ -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()
index 8482dc06f16606211503255bed9cf785580975c7..69781804c9830a31730471e4fa9acb3568a7c01f 100644 (file)
@@ -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();
index b0c9fe3e1258bc81eaece7a2b73c7b9a0062cb81..71cd3911c33cba6aaf09419f10c2c333be4febd1 100644 (file)
@@ -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);
 }
 
index f4ce015726e97587694bb513c9b5103fcc3b3cb7..936657a0bc3f43cf403c513b3572a85d3f6248ae 100644 (file)
@@ -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;
index 966d299d9f621aba207e8d1f537f5436bf932659..1cec6c9f44803e824e1192f9d05cd66376258f5b 100644 (file)
@@ -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;
index 6bba1270831170ccf60a0ec3e21a46c42d7f96f3..3c73709af7d1c57db02d7edd5e11bedeb4f40fd2 100644 (file)
@@ -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;
index 35c773b084501bf451c3da5b05dcde58b60efcc2..6a34b7f1d33deff5abd4f5b01ff533358765f743 100644 (file)
@@ -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);
 
index 816e81a41d558f8268d8d08f59492e0f144ea5d1..35d6f1f34205447fa71f673de5478718c03eb9f0 100644 (file)
@@ -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;
index 3ce2f20ef14144a152bab9319c3a78d5f19e4365..c59fddc6c4af9f7aabec10d338ad4888ee95e52e 100644 (file)
@@ -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
index 5019c86bd62769d96f65b4c6eae1134261d461d2..1958ef78222efb1959728f87c265e46d223ba714 100644 (file)
@@ -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)
index 7a4323bd7e1343cdf8f6b5c67d2953273625a2ed..42f83ef87e7d86e57a2c84a8bf7b4781fad41984 100644 (file)
@@ -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));
                }