cposer/viewer btn1/2/3 fwd/rev/frm playback, misc fixes, leaks, cleanup
authorGood Guy <good1.2guy@gmail.com>
Tue, 6 Feb 2018 18:02:40 +0000 (11:02 -0700)
committerGood Guy <good1.2guy@gmail.com>
Tue, 6 Feb 2018 18:02:40 +0000 (11:02 -0700)
12 files changed:
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/editpanel.C
cinelerra-5.1/cinelerra/new.C
cinelerra-5.1/cinelerra/recordaudio.C
cinelerra-5.1/cinelerra/recordgui.C
cinelerra-5.1/cinelerra/recordmonitor.C
cinelerra-5.1/cinelerra/tracks.C
cinelerra-5.1/cinelerra/vtimebar.C
cinelerra-5.1/cinelerra/vtimebar.h
cinelerra-5.1/cinelerra/vwindowgui.C
cinelerra-5.1/guicast/bclistbox.C
cinelerra-5.1/guicast/bclistbox.h

index da38d010ef2d36baea86effe871926a2d64d371f..11114bc91223807af309babfeac40c86c77db88a 100644 (file)
@@ -296,6 +296,31 @@ int CWindowGUI::resize_event(int w, int h)
 
 int CWindowGUI::button_press_event()
 {
+       if( current_operation == CWINDOW_NONE &&
+           mwindow->edl != 0 && canvas->get_canvas() &&
+           canvas->get_canvas()->get_cursor_over_window() ) {
+               switch( get_buttonpress() ) {
+               case LEFT_BUTTON:
+                       if( !cwindow->playback_engine->is_playing_back ) {
+                               double length = mwindow->edl->tracks->total_playable_length();
+                               double position = cwindow->playback_engine->get_tracking_position();
+                               if( position >= length ) transport->goto_start();
+                       }
+                       return transport->forward_play->handle_event();
+               case MIDDLE_BUTTON:
+                       if( !cwindow->playback_engine->is_playing_back ) {
+                               double position = cwindow->playback_engine->get_tracking_position();
+                               if( position <= 0 ) transport->goto_end();
+                       }
+                       return transport->reverse_play->handle_event();
+               case RIGHT_BUTTON:  // activates popup
+                       break;
+               case WHEEL_UP:
+                       return transport->frame_forward_play->handle_event();
+               case WHEEL_DOWN:
+                       return transport->frame_reverse_play->handle_event();
+               }
+       }
        if(canvas->get_canvas())
                return canvas->button_press_event_base(canvas->get_canvas());
        return 0;
@@ -3187,7 +3212,8 @@ int CWindowCanvas::button_press_event()
        gui->y_offset = get_y_offset(mwindow->edl, 0, zoom_y, conformed_w, conformed_h);
 
 // Scroll view
-       if(get_buttonpress() == 2)
+       if( mwindow->edl->session->cwindow_operation != CWINDOW_PROTECT &&
+           get_buttonpress() == 2 )
        {
                gui->current_operation = CWINDOW_SCROLL;
                result = 1;
index 9714c4beafa65ac072a8bdd3aca29281693f1f55..379291413d0eb57561d359bb398aa7e68c4fca97 100644 (file)
@@ -620,7 +620,7 @@ EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
 {
        this->mwindow = mwindow;
        this->panel = panel;
-       set_tooltip(_("In point ( [ )"));
+       set_tooltip(_("In point ( [ or < )"));
 }
 EditInPoint::~EditInPoint()
 {
@@ -650,7 +650,7 @@ EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
 {
        this->mwindow = mwindow;
        this->panel = panel;
-       set_tooltip(_("Out point ( ] )"));
+       set_tooltip(_("Out point ( ] or > )"));
 }
 EditOutPoint::~EditOutPoint()
 {
index 1fa0f15e6d03e55c960c2079fa0d1334713c4cb9..c7c9ba31cfb7154c0caa2a891dac690b8f5e8b27 100644 (file)
@@ -41,6 +41,8 @@
 #include "preferences.h"
 #include "theme.h"
 #include "transportque.h"
+#include "track.h"
+#include "tracks.h"
 #include "videowindow.h"
 #include "vplayback.h"
 #include "vwindow.h"
@@ -97,7 +99,21 @@ int New::create_new_project(int load_mode)
                sizeof(new_edl->session->achannel_positions));
        new_edl->session->boundaries();
        new_edl->create_default_tracks();
-
+       if( load_mode == LOADMODE_NEW_TRACKS ) {
+               Tracks *tracks =  mwindow->edl->tracks;
+               int vindex = tracks->total_video_tracks();
+               int aindex = tracks->total_audio_tracks();
+               for( Track *track=new_edl->tracks->first; track; track=track->next ) {
+                       switch( track->data_type ) {
+                       case TRACK_AUDIO:
+                               sprintf(track->title, _("Audio %d"), ++aindex);
+                               break;
+                       case TRACK_VIDEO:
+                               sprintf(track->title, _("Video %d"), ++vindex);
+                               break;
+                       }
+               }
+       }
        mwindow->undo->update_undo_before();
        mwindow->set_filename("");
        ArrayList<EDL *>new_edls;
index c46f88f7dd7898c8b3f800b8d793c28a090659f1..cb8ed6d59f14d27ef2652828b2ee4656d0d6b59d 100644 (file)
@@ -61,6 +61,8 @@ RecordAudio::~RecordAudio()
 {
        delete_buffer();
        delete trigger_lock;
+       delete pause_record_lock;
+       delete record_paused_lock;
 }
 
 void RecordAudio::reset_parameters()
index 0b3810d861adb483028ae103f2ec09b9e3a60d0e..6c508a51556f2defe022d69f5e63177e6759b3f0 100644 (file)
@@ -117,6 +117,7 @@ RecordGUI::RecordGUI(MWindow *mwindow, Record *record)
 RecordGUI::~RecordGUI()
 {
        delete status_thread;
+       delete record_transport;
        delete batch_source;
        delete batch_mode;
        delete batch_flash;
@@ -1382,6 +1383,7 @@ RecordStatusThread::~RecordStatusThread()
                input_lock->unlock();
        }
        Thread::join();
+       delete input_lock;
 }
 
 void RecordStatusThread::reset_video()
index b04587a7cb348a953a4f68879d9a09855a39b0ec..16a4da866deca509bbd550dd5fd23dd9b0234301 100644 (file)
@@ -277,6 +277,7 @@ RecordMonitorGUI::~RecordMonitorGUI()
        delete avc1394_transport;
        delete avc1394transport_title;
 #endif
+       delete meters;
        unlock_window();
 }
 
index 1eec0d4179c1dcae49829432aa7027c5c4666e6a..4df744922f1d50941a8081c007f6333c596df37f 100644 (file)
@@ -287,83 +287,39 @@ Track* Tracks::add_audio_track(int above, Track *dst_track)
 
 Track* Tracks::add_video_track(int above, Track *dst_track)
 {
-const int debug = 0;
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
        VTrack* new_track = new VTrack(edl, this);
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
        if(!dst_track)
                dst_track = (above ? first : last);
-
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
        if(above)
-       {
                insert_before(dst_track, (Track*)new_track);
-       }
        else
-       {
                insert_after(dst_track, (Track*)new_track);
-       }
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
-
 
-
-// Shift effects referenced below the new track
-       for(Track *track = last;
-               track && track != new_track;
-               track = track->previous)
-       {
+       for(Track *track = last; track && track != new_track; track = track->previous)
                change_modules(number_of(track) - 1, number_of(track), 0);
-       }
-
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
-
 
        new_track->create_objects();
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
        new_track->set_default_title();
-if(debug) printf("Tracks::add_video_track %d\n", __LINE__);
        return new_track;
 }
 
 
 Track* Tracks::add_subttl_track(int above, Track *dst_track)
 {
-const int debug = 0;
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
        STrack* new_track = new STrack(edl, this);
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
        if(!dst_track)
                dst_track = (above ? first : last);
 
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
        if(above)
-       {
                insert_before(dst_track, (Track*)new_track);
-       }
        else
-       {
                insert_after(dst_track, (Track*)new_track);
-       }
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
 
-
-
-// Shift effects referenced below the new track
-       for(Track *track = last;
-               track && track != new_track;
-               track = track->previous)
-       {
+       for(Track *track = last; track && track != new_track; track = track->previous)
                change_modules(number_of(track) - 1, number_of(track), 0);
-       }
-
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
-
 
        new_track->create_objects();
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
        new_track->set_default_title();
-if(debug) printf("Tracks::add_subttl_track %d\n", __LINE__);
-
 //     new_track->paste_silence(0,total_length(),0);
        return new_track;
 }
index b61f25f63f1710fe226bdf5855161ba3b4aa7cec..4c9ca74e7fa2d96ae3294a63f056284f758189c7 100644 (file)
@@ -124,4 +124,8 @@ void VTimeBar::update_cursor()
        update(1);
 }
 
+double VTimeBar::test_highlight()
+{
+       return gui->edit_panel->get_position();
+}
 
index 95f11bd17b126eb814fd644a9c8fc9aeaeb7fab9..9247274bdabb9b79533353f307df6d7b5a02a3bc 100644 (file)
@@ -44,6 +44,7 @@ public:
        double pixel_to_position(int pixel);
        void update_cursor();
        int has_preview() { return 1; }
+       double test_highlight();
 
        VWindowGUI *gui;
 };
index 4458eb764c80ba1bf608fd1e25f80f5284a1c9c4..e5275cbc1c68900a90dc0a7bb51645d2842c5ada 100644 (file)
@@ -348,7 +348,8 @@ int VWindowGUI::keypress_event()
                        break;
        }
        if(!result) result = transport->keypress_event();
-
+       if( result && !vwindow->playback_engine->is_playing_back )
+               timebar->update(1);
        return result;
 }
 
@@ -363,15 +364,29 @@ void VWindowGUI::stop_transport(const char *lock_msg)
 
 int VWindowGUI::button_press_event()
 {
-       if( get_buttonpress() == LEFT_BUTTON && canvas->get_canvas() &&
+       if( vwindow->get_edl() != 0 && canvas->get_canvas() &&
            canvas->get_canvas()->get_cursor_over_window() ) {
-               PlaybackEngine *playback_engine = vwindow->playback_engine;
-               if( !playback_engine->is_playing_back && vwindow->get_edl() != 0 ) {
-                       double length = vwindow->get_edl()->tracks->total_playable_length();
-                       double position = playback_engine->get_tracking_position();
-                       if( position >= length ) transport->goto_start();
+               switch( get_buttonpress() ) {
+               case LEFT_BUTTON:
+                       if( !vwindow->playback_engine->is_playing_back ) {
+                               double length = vwindow->get_edl()->tracks->total_playable_length();
+                               double position = vwindow->playback_engine->get_tracking_position();
+                               if( position >= length ) transport->goto_start();
+                       }
+                       return transport->forward_play->handle_event();
+               case MIDDLE_BUTTON:
+                       if( !vwindow->playback_engine->is_playing_back ) {
+                               double position = vwindow->playback_engine->get_tracking_position();
+                               if( position <= 0 ) transport->goto_end();
+                       }
+                       return transport->reverse_play->handle_event();
+               case RIGHT_BUTTON:  // activates popup
+                       break;
+               case WHEEL_UP:
+                       return transport->frame_forward_play->handle_event();
+               case WHEEL_DOWN:
+                       return transport->frame_reverse_play->handle_event();
                }
-               return transport->forward_play->handle_event();
        }
        if(canvas->get_canvas())
                return canvas->button_press_event_base(canvas->get_canvas());
index 4a7d7543212c3ff0eb2b53b6240b7fd59d0773fa..0cea9d626cb9275cd7e21e5332d86b2d53873563 100644 (file)
@@ -311,6 +311,7 @@ BC_ListBox::BC_ListBox(int x, int y, int w, int h,
        list_highlighted = 0;
        disabled = 0;
 
+       scroll_repeat = 0;
        allow_drag_scroll = 1;
        process_drag = 1;
 
@@ -744,6 +745,19 @@ void BC_ListBox::set_is_suggestions(int value)
 {
        this->is_suggestions = value;
 }
+void BC_ListBox::set_scroll_repeat()
+{
+       if( scroll_repeat ) return;
+       scroll_repeat = 1;
+       set_repeat(get_resources()->scroll_repeat);
+}
+
+void BC_ListBox::unset_scroll_repeat()
+{
+       if( !scroll_repeat ) return;
+       scroll_repeat = 0;
+       unset_repeat(get_resources()->scroll_repeat);
+}
 
 void BC_ListBox::set_use_button(int value)
 {
@@ -2635,6 +2649,7 @@ int BC_ListBox::button_release_event()
        int cursor_x, cursor_y;
        int do_event = 0;
        new_value = 0;
+       unset_scroll_repeat();
 
 //printf("BC_ListBox::button_release_event 1 %d\n", current_operation);
        switch( current_operation ) {
@@ -2652,7 +2667,6 @@ int BC_ListBox::button_release_event()
        case BUTTON_DOWN_SELECT:
        case SELECT:
 //printf("BC_ListBox::button_release_event 10\n");
-               unset_repeat(get_resources()->scroll_repeat);
                current_operation = NO_OPERATION;
                if( gui ) {
                        translate_coordinates(top_level->event_win, gui->win,
@@ -2687,7 +2701,6 @@ int BC_ListBox::button_release_event()
 
 
        case SELECT_RECT:
-               unset_repeat(get_resources()->scroll_repeat);
                if( data ) {
 // Demote selections from rectangle selection
                        promote_selections(data, 2, 1);
@@ -2885,9 +2898,8 @@ int BC_ListBox::cursor_motion_event()
                break; }
 
        case SELECT_RECT: {
-               if( test_drag_scroll(get_cursor_x(), get_cursor_y()) ) {
-                       set_repeat(get_resources()->scroll_repeat);
-               }
+               if( test_drag_scroll(get_cursor_x(), get_cursor_y()) )
+                       set_scroll_repeat();
 
                int old_x1 = MIN(rect_x1, rect_x2);
                int old_x2 = MAX(rect_x1, rect_x2);
@@ -2938,11 +2950,8 @@ int BC_ListBox::cursor_motion_event()
        case SELECT: {
                int old_highlighted_item = highlighted_item;
 
-               if( test_drag_scroll(get_cursor_x(),
-                       get_cursor_y()) ) {
-                       set_repeat(get_resources()->scroll_repeat);
-               }
-
+               if( test_drag_scroll(get_cursor_x(), get_cursor_y()) )
+                       set_scroll_repeat();
 
                highlighted_item = selection_number = get_cursor_item(data,
                        get_cursor_x(), get_cursor_y(), &highlighted_ptr);
@@ -3149,7 +3158,7 @@ int BC_ListBox::drag_start_event()
                                current_operation = DRAG_ITEM;
 // require shift down for scrolling
                                if( allow_drag < 0 && shift_down() )
-                                       set_repeat(get_resources()->scroll_repeat);
+                                       set_scroll_repeat();
                                return 1;
                        }
                }
@@ -3217,9 +3226,9 @@ int BC_ListBox::drag_motion_event()
 int BC_ListBox::drag_stop_event()
 {
        int result = 0;
+       unset_scroll_repeat();
        switch( current_operation ) {
        case DRAG_ITEM:
-               unset_repeat(get_resources()->scroll_repeat);
 // Inside window boundary
                if( top_level->cursor_x > 0 &&
                    top_level->cursor_x < gui->get_w() - drag_popup->get_w() / 2 &&
index 8d42508047682efc035c12280cea6b39d0f1bdec..365ec488bb07119df32f8b4d705fe4834de0b27f 100644 (file)
@@ -197,7 +197,9 @@ public:
 // Must be called in the constructor.
        void set_use_button(int value);
        void set_is_suggestions(int value);
-
+       void set_scroll_repeat();
+       void unset_scroll_repeat();
+       int scroll_repeat;
 
 // change the contents
        int update(ArrayList<BC_ListBoxItem*> *data,