re/open mixer window fixes
authorGood Guy <good1.2guy@gmail.com>
Sun, 21 Jun 2020 02:11:07 +0000 (20:11 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 21 Jun 2020 02:11:07 +0000 (20:11 -0600)
cinelerra-5.1/cinelerra/mainmenu.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/zwindow.C

index f616d26a12819b6bf650ddf79c4ae2c06949d457..6fc329b618840c16a4aa4d92c8c494a8364b2c5b 100644 (file)
@@ -1674,7 +1674,9 @@ int MixerItem::handle_event()
        MWindow *mwindow = mixer_items->mwindow;
        Mixer *mixer = mwindow->edl->mixers.get_mixer(idx);
        if( !mixer ) return 0;
-        ZWindow *zwindow = mwindow->get_mixer(mixer);
+       ZWindow *zwindow = mwindow->get_mixer(idx);
+       if( !zwindow )
+               zwindow = mwindow->get_mixer(mixer);
        if( !zwindow->zgui ) {
                zwindow->set_title(mixer->title);
                zwindow->start();
index 0fe6752f3598394b1fe16e6d1900e18a6c0631ba..7f502d10de5b430e42ad77c45693491ffca78dc8 100644 (file)
@@ -1210,6 +1210,20 @@ ZWindow *MWindow::get_mixer(Mixer *&mixer)
        return zwindow;
 }
 
+ZWindow *MWindow::get_mixer(int idx)
+{
+       ZWindow *zwindow = 0;
+       zwindows_lock->lock("MWindow::get_mixer");
+       for( int i=0; !zwindow && i<zwindows.size(); ++i ) {
+               ZWindow *zwdw = zwindows[i];
+               if( !zwdw->running() ) continue;
+               if( zwdw->idx != idx ) continue;
+               zwindow = zwindows[i];
+       }
+       zwindows_lock->unlock();
+       return zwindow;
+}
+
 void MWindow::close_mixer(ZWindow *zwindow)
 {
        zwindows_lock->lock("MWindow::close_mixer 0");
index c7076099ce7bae36dacaec3571a912eadf8a4447..13544431ea22b75a4010e846f690c74bae46f238 100644 (file)
@@ -274,6 +274,7 @@ public:
        void close_mixers(int result=1);
        void open_mixers();
        ZWindow *get_mixer(Mixer *&mixer);
+       ZWindow *get_mixer(int idx);
        void close_mixer(ZWindow *zwindow);
        int mixer_track_active(Track *track);
        void update_mixer_tracks();
index 7a01982f002aefedca928d81ba7dcfcee89a63a2..af7b6cdb5b37788ab0ad335bda6d391ddbe0f49b 100644 (file)
@@ -1853,7 +1853,7 @@ void Track::set_camera(float x, float y, float z)
 
 int Track::index_in(Mixer *mixer)
 {
-       if( !mixer || mixer_id ) return -1;
+       if( !mixer || mixer_id < 0 ) return -1;
        int k = mixer->mixer_ids.size();
        while( --k >= 0 && mixer_id != mixer->mixer_ids[k] );
        return k;
index da28e0136170a4f0598b2b29cd27ed55e4da8d26..37dd6feb530e721e2116444ac2e42b1e1e1ff281 100644 (file)
@@ -174,6 +174,7 @@ void Mixer::copy_from(Mixer &that)
        mixer_ids.remove_all();
        strncpy(title, that.title, sizeof(title));
        title[sizeof(title)-1] = 0;
+       show = that.show;
        x = that.x;  y = that.y;
        w = that.w;  h = that.h;
        for( int i=0; i<that.mixer_ids.size(); ++i )