fixup vwindow running status checks
authorGood Guy <[email protected]>
Sun, 4 Sep 2016 21:15:41 +0000 (15:15 -0600)
committerGood Guy <[email protected]>
Sun, 4 Sep 2016 21:15:41 +0000 (15:15 -0600)
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/mwindowgui.C
cinelerra-5.1/cinelerra/new.C
cinelerra-5.1/cinelerra/preferencesthread.C

index 57d9356923a60b18ca011ba48d7d6ed9fe4a004a..221912da8fda10c9802f8f193a544d3f0fa28fa0 100644 (file)
@@ -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();
index 4f602a5dd48dd92d8b19b688be3e04bc78df05e5..1a1c3bfe2dd9589f18d140cd8052ac36d0c8df5f 100644 (file)
@@ -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");
index e12e60cca194fedd8d4a42bc1e47cc3679379a4a..cb2516ec469ac2f9a87fe2f0397a6f703208b03a 100644 (file)
@@ -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);
index 50dfc6cfde6664a34d02a4594eb0aff0bf68ef97..8d8e22c79bc2aafe8e16d177ad1b113c21ccf660 100644 (file)
@@ -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,