From 5a7faba81bcd03755bfe651bacbc5980171fe9de Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sun, 4 Sep 2016 15:15:41 -0600 Subject: [PATCH] fixup vwindow running status checks --- cinelerra-5.1/cinelerra/awindowgui.C | 39 ++++++++++----------- cinelerra-5.1/cinelerra/mwindowgui.C | 3 +- cinelerra-5.1/cinelerra/new.C | 9 +++-- cinelerra-5.1/cinelerra/preferencesthread.C | 4 +-- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 57d93569..221912da 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -1586,28 +1586,25 @@ int AWindowAssets::button_release_event() int AWindowAssets::handle_event() { //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0)); - if(get_selection(0, 0)) - { - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) {} - else if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) {} - else if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) {} - else if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) {} - else if(mwindow->vwindows.size()) { + AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0); + if( !asset_picon ) return 0; + const char *folder = mwindow->edl->session->current_folder; + if( !strcasecmp(folder, AEFFECT_FOLDER) ) return 1; + if( !strcasecmp(folder, VEFFECT_FOLDER) ) return 1; + if( !strcasecmp(folder, ATRANSITION_FOLDER) ) return 1; + if( !strcasecmp(folder, VTRANSITION_FOLDER) ) return 1; + VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ? + mwindow->vwindows.get(DEFAULT_VWINDOW) : 0; + if( !vwindow || !vwindow->is_running() ) return 1; //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0)); - mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event"); - - if(((AssetPicon*)get_selection(0, 0))->indexable) - mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable); - else - if(((AssetPicon*)get_selection(0, 0))->edl) - mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl); - mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window(); - } - return 1; - } - - return 0; + vwindow->gui->lock_window("AWindowAssets::handle_event"); + if( asset_picon->indexable ) + vwindow->change_source(asset_picon->indexable); + else if( asset_picon->edl ) + vwindow->change_source(asset_picon->edl); + vwindow->gui->unlock_window(); + return 1; } int AWindowAssets::selection_changed() @@ -1735,6 +1732,7 @@ int AWindowAssets::drag_motion_event() for(int i = 0; i < mwindow->vwindows.size(); i++) { VWindow *vwindow = mwindow->vwindows.get(i); + if( !vwindow->is_running() ) continue; vwindow->gui->lock_window("AWindowAssets::drag_motion_event"); vwindow->gui->drag_motion(); vwindow->gui->unlock_window(); @@ -1768,6 +1766,7 @@ int AWindowAssets::drag_stop_event() for(int i = 0; i < mwindow->vwindows.size(); i++) { VWindow *vwindow = mwindow->vwindows.get(i); + if( !vwindow->is_running() ) continue; vwindow->gui->lock_window("AWindowAssets::drag_stop_event"); result = vwindow->gui->drag_stop(); vwindow->gui->unlock_window(); diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 4f602a5d..1a1c3bfe 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -1054,7 +1054,8 @@ void MWindowGUI::default_positions() { //printf("MWindowGUI::default_positions 1\n"); VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ? - mwindow->vwindows.get(0) : 0; + mwindow->vwindows.get(DEFAULT_VWINDOW) : 0; + if( vwindow && !vwindow->is_running() ) vwindow = 0; if( vwindow ) vwindow->gui->lock_window("MWindowGUI::default_positions"); mwindow->cwindow->gui->lock_window("MWindowGUI::default_positions"); mwindow->awindow->gui->lock_window("MWindowGUI::default_positions"); diff --git a/cinelerra-5.1/cinelerra/new.C b/cinelerra-5.1/cinelerra/new.C index e12e60cc..cb2516ec 100644 --- a/cinelerra-5.1/cinelerra/new.C +++ b/cinelerra-5.1/cinelerra/new.C @@ -104,11 +104,10 @@ int New::create_new_project() for(int i = 0; i < mwindow->vwindows.size(); i++) { - mwindow->vwindows.get(i)->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); - mwindow->vwindows.get(i)->playback_engine->interrupt_playback(0); + VWindow *vwindow = mwindow->vwindows.get(i); + if( !vwindow->is_running() ) continue; + vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0); + vwindow->playback_engine->interrupt_playback(0); } mwindow->cwindow->playback_engine->interrupt_playback(0); diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index 50dfc6cf..8d8e22c7 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -244,9 +244,9 @@ int PreferencesThread::apply_settings() - for(int i = 0; i < mwindow->vwindows.size(); i++) - { + for(int i = 0; i < mwindow->vwindows.size(); i++) { VWindow *vwindow = mwindow->vwindows.get(i); + if( !vwindow->is_running() ) continue; vwindow->gui->lock_window("PreferencesThread::apply_settings"); vwindow->gui->meters->change_format(edl->session->meter_format, edl->session->min_meter_db, -- 2.26.2