repair a/v patchgui widget placement
[goodguy/history.git] / cinelerra-5.1 / cinelerra / apatchgui.C
index 824e7a868db5cf7f6f2a7322692186212405c972..abfe57cd963998384c462cdc45bd11bee559a070 100644 (file)
@@ -93,8 +93,9 @@ int APatchGUI::update(int x, int y)
        int x1 = 0;
        int y1 = PatchGUI::update(x, y);
 
+       int y2 = y1 + mwindow->theme->fade_h;
        if( fade ) {
-               if( h - y1 < mwindow->theme->fade_h ) {
+               if( h < y2 ) {
                        delete fade;
                        fade = 0;
                }
@@ -110,26 +111,26 @@ int APatchGUI::update(int x, int y)
                                     mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE]);
                }
        }
-       else
-       if( h - y1 >= mwindow->theme->fade_h ) {
+       else if( h >= y2 ) {
                patchbay->add_subwindow(fade = new AFadePatch(mwindow, this, x1+x, y1+y,
                        patchbay->get_w() - 10));
        }
-       y1 += mwindow->theme->fade_h;
+       y1 = y2;
 
+       y2 = y1 + mwindow->theme->meter_h;
        if( meter ) {
-               if( h - y1 < mwindow->theme->meter_h ) {
+               if( h < y2 ) {
                        delete meter;  meter = 0;
                }
        }
-       else
-       if( h - y1 >= mwindow->theme->meter_h ) {
+       else if( h >= y2 ) {
                patchbay->add_subwindow(meter = new AMeterPatch(mwindow, this, x1+x, y1+y));
        }
-       y1 += mwindow->theme->meter_h;
+       y1 = y2;
 
+       y2 = y1 + mwindow->theme->pan_h;
        if( pan ) {
-               if( h - y1 < mwindow->theme->pan_h ) {
+               if( h < y2 ) {
                        delete mix;    mix = 0;
                        delete pan;    pan = 0;
                        delete nudge;  nudge = 0;
@@ -157,8 +158,7 @@ int APatchGUI::update(int x, int y)
                        nudge->update();
                }
        }
-       else
-       if( h - y1 >= mwindow->theme->pan_h ) {
+       else if( h >= y2 ) {
                patchbay->add_subwindow(mix = new AMixPatch(mwindow, this, x1+x, y1+y+5));
                x1 += mix->get_w() + 10;
                patchbay->add_subwindow(pan = new APanPatch(mwindow, this, x1+x, y1+y));
@@ -166,7 +166,7 @@ int APatchGUI::update(int x, int y)
                patchbay->add_subwindow(nudge = new NudgePatch(mwindow, this, x1+x, y1+y,
                                patchbay->get_w() - x1-x - 10));
        }
-       y1 += mwindow->theme->pan_h;
+       y1 = y2;
 
        return y1;
 }