From: Good Guy Date: Tue, 6 Feb 2018 18:02:40 +0000 (-0700) Subject: cposer/viewer btn1/2/3 fwd/rev/frm playback, misc fixes, leaks, cleanup X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=576087eacf577a0fa5d3008d37c4d5b597f0990a;p=goodguy%2Fhistory.git cposer/viewer btn1/2/3 fwd/rev/frm playback, misc fixes, leaks, cleanup --- diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index da38d010..11114bc9 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/editpanel.C b/cinelerra-5.1/cinelerra/editpanel.C index 9714c4be..37929141 100644 --- a/cinelerra-5.1/cinelerra/editpanel.C +++ b/cinelerra-5.1/cinelerra/editpanel.C @@ -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() { diff --git a/cinelerra-5.1/cinelerra/new.C b/cinelerra-5.1/cinelerra/new.C index 1fa0f15e..c7c9ba31 100644 --- a/cinelerra-5.1/cinelerra/new.C +++ b/cinelerra-5.1/cinelerra/new.C @@ -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(""); ArrayListnew_edls; diff --git a/cinelerra-5.1/cinelerra/recordaudio.C b/cinelerra-5.1/cinelerra/recordaudio.C index c46f88f7..cb8ed6d5 100644 --- a/cinelerra-5.1/cinelerra/recordaudio.C +++ b/cinelerra-5.1/cinelerra/recordaudio.C @@ -61,6 +61,8 @@ RecordAudio::~RecordAudio() { delete_buffer(); delete trigger_lock; + delete pause_record_lock; + delete record_paused_lock; } void RecordAudio::reset_parameters() diff --git a/cinelerra-5.1/cinelerra/recordgui.C b/cinelerra-5.1/cinelerra/recordgui.C index 0b3810d8..6c508a51 100644 --- a/cinelerra-5.1/cinelerra/recordgui.C +++ b/cinelerra-5.1/cinelerra/recordgui.C @@ -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() diff --git a/cinelerra-5.1/cinelerra/recordmonitor.C b/cinelerra-5.1/cinelerra/recordmonitor.C index b04587a7..16a4da86 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.C +++ b/cinelerra-5.1/cinelerra/recordmonitor.C @@ -277,6 +277,7 @@ RecordMonitorGUI::~RecordMonitorGUI() delete avc1394_transport; delete avc1394transport_title; #endif + delete meters; unlock_window(); } diff --git a/cinelerra-5.1/cinelerra/tracks.C b/cinelerra-5.1/cinelerra/tracks.C index 1eec0d41..4df74492 100644 --- a/cinelerra-5.1/cinelerra/tracks.C +++ b/cinelerra-5.1/cinelerra/tracks.C @@ -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; } diff --git a/cinelerra-5.1/cinelerra/vtimebar.C b/cinelerra-5.1/cinelerra/vtimebar.C index b61f25f6..4c9ca74e 100644 --- a/cinelerra-5.1/cinelerra/vtimebar.C +++ b/cinelerra-5.1/cinelerra/vtimebar.C @@ -124,4 +124,8 @@ void VTimeBar::update_cursor() update(1); } +double VTimeBar::test_highlight() +{ + return gui->edit_panel->get_position(); +} diff --git a/cinelerra-5.1/cinelerra/vtimebar.h b/cinelerra-5.1/cinelerra/vtimebar.h index 95f11bd1..9247274b 100644 --- a/cinelerra-5.1/cinelerra/vtimebar.h +++ b/cinelerra-5.1/cinelerra/vtimebar.h @@ -44,6 +44,7 @@ public: double pixel_to_position(int pixel); void update_cursor(); int has_preview() { return 1; } + double test_highlight(); VWindowGUI *gui; }; diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 4458eb76..e5275cbc 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -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()); diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 4a7d7543..0cea9d62 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -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 && diff --git a/cinelerra-5.1/guicast/bclistbox.h b/cinelerra-5.1/guicast/bclistbox.h index 8d425080..365ec488 100644 --- a/cinelerra-5.1/guicast/bclistbox.h +++ b/cinelerra-5.1/guicast/bclistbox.h @@ -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 *data,