77dc06c4bdc5e10f5d2705a51300ec028a7d785f
tdreszer
  Fri Oct 1 10:51:48 2010 -0700
FindTracks now finds superTracks (Advanced only) and hgTrackUi now does superTrack reshaping when children have vis changed
diff --git src/hg/hgTracks/hgTracks.patch src/hg/hgTracks/hgTracks.patch
new file mode 100644
index 0000000..0879e97
--- /dev/null
+++ src/hg/hgTracks/hgTracks.patch
@@ -0,0 +1,131 @@
+1 hgTracks.c
+diff --git a/src/hg/hgTracks/hgTracks.c b/src/hg/hgTracks/hgTracks.c
+index 49022dd..c3a4724 100644
+--- a/src/hg/hgTracks/hgTracks.c
++++ b/src/hg/hgTracks/hgTracks.c
+@@ -1266,0 +1267,16 @@ static void doLabelNextItemButtons(struct track *track, struct track *parentTrac
++        // FIXME: 3x scrolling here!!
++int portWidth = insideWidth;
++int portX = insideX;
++#ifdef IMAGEv2_DRAG_SCROLL
++// If a portal was established, then set the portal dimensions
++int portalStart,chromStart;
++double basesPerPixel;
++if(imgBoxPortalDimensions(theImgBox,&chromStart,NULL,NULL,NULL,&portalStart,NULL,&portWidth,&basesPerPixel))
++    {
++    portX = (int)((portalStart - chromStart) / basesPerPixel);
++    portX += gfxBorder;
++    if (withLeftLabels)
++        portX += tl.leftLabelWidth + gfxBorder;
++    portWidth = portWidth-gfxBorder-insideX;
++    }
++#endif//def IMAGEv2_DRAG_SCROLL
+@@ -1269 +1285 @@ int arrowButtonWidth = arrowWidth + 2 * NEXT_ITEM_ARROW_BUFFER;
+-int rightButtonX = insideX + insideWidth - arrowButtonWidth - 1;
++int rightButtonX = portX + portWidth - arrowButtonWidth - 1;
+@@ -1274 +1290 @@ hvGfxNextItemButton(hvg, rightButtonX + NEXT_ITEM_ARROW_BUFFER, y, arrowWidth, a
+-hvGfxNextItemButton(hvg, insideX + NEXT_ITEM_ARROW_BUFFER, y, arrowWidth, arrowWidth, labelColor, fillColor, FALSE);
++hvGfxNextItemButton(hvg, portX + NEXT_ITEM_ARROW_BUFFER, y, arrowWidth, arrowWidth, labelColor, fillColor, FALSE);
+@@ -1276 +1292 @@ safef(buttonText, ArraySize(buttonText), "hgt.prevItem=%s", track->track);
+-mapBoxReinvoke(hvg, insideX, y + 1, arrowButtonWidth, insideHeight, NULL,
++mapBoxReinvoke(hvg, portX, y + 1, arrowButtonWidth, insideHeight, NULL,
+@@ -1278 +1294 @@ mapBoxReinvoke(hvg, insideX, y + 1, arrowButtonWidth, insideHeight, NULL,
+-mapBoxToggleVis(hvg, insideX + arrowButtonWidth, y + 1, insideWidth - (2 * arrowButtonWidth),
++mapBoxToggleVis(hvg, portX + arrowButtonWidth, y + 1, portWidth - (2 * arrowButtonWidth),
+@@ -1281 +1297 @@ safef(buttonText, ArraySize(buttonText), "hgt.nextItem=%s", track->track);
+-mapBoxReinvoke(hvg, insideX + insideWidth - arrowButtonWidth, y + 1, arrowButtonWidth, insideHeight, NULL,
++mapBoxReinvoke(hvg, portX + portWidth - arrowButtonWidth, y + 1, arrowButtonWidth, insideHeight, NULL,
+@@ -1555,0 +1572,21 @@ enum trackVisibility limitedVisFromComposite(struct track *subtrack)
++#ifdef SUBTRACKS_HAVE_VIS
++char *var = cartOptionalString(cart, subtrack->track);
++if (var)
++    {
++    subtrack->visibility = hTvFromString(var);
++
++    if (subtrack->limitedVisSet)
++        subtrack->limitedVis = tvMin(subtrack->visibility,subtrack->limitedVis);
++    else
++        {
++        if (subtrack->visibility != tvHide && slCount(subtrack->items) == 0)
++            subtrack->loadItems(subtrack);
++
++        limitVisibility(subtrack);
++        //warnWithBackTrace("overrideComposite: %s - %s limit:%s  height:%d",subtrack->track,var,hStringFromTv(subtrack->limitedVis),subtrack->height);
++        }
++
++    return hTvFromString(var);
++    }
++#endif///def SUBTRACKS_HAVE_VIS
++
+@@ -1969,0 +2007 @@ for (track = trackList; track != NULL; track = track->next)
++#ifndef SUBTRACKS_HAVE_VIS
+@@ -1970,0 +2009 @@ for (track = trackList; track != NULL; track = track->next)
++#endif///ndef SUBTRACKS_HAVE_VIS
+@@ -1980,6 +2019 @@ for (track = trackList; track != NULL; track = track->next)
+-                if (!subtrack->limitedVisSet)
+-                    {
+-                    subtrack->visibility = track->visibility;
+-                    subtrack->limitedVis = track->limitedVis;
+-                    subtrack->limitedVisSet = TRUE;
+-                    }
++
+@@ -2000,0 +2035,7 @@ for (track = trackList; track != NULL; track = track->next)
++                if (!subtrack->limitedVisSet && track->limitedVisSet)
++                    {
++                    subtrack->visibility = track->visibility;
++                    subtrack->limitedVis = track->limitedVis;
++                    subtrack->limitedVisSet = track->limitedVisSet;
++                    }
++
+@@ -2001,0 +2043,4 @@ for (track = trackList; track != NULL; track = track->next)
++                #ifdef SUBTRACKS_HAVE_VIS
++                if (subtrack->limitedVis != tvHide)
++                #endif///def SUBTRACKS_HAVE_VIS
++                    {
+@@ -2004,0 +2050,3 @@ for (track = trackList; track != NULL; track = track->next)
++                    //if(sameString("wgEncodeOpenChromChipGm12878CmycPk",subtrack->track))
++                    //    warn("subtrack:%s  hasUi:%s  pixHeight:%d  total:%d",subtrack->track, subtrack->hasUi?"true":"false", trackPlusLabelHeight(subtrack, fontHeight),pixHeight);
++                    }
+@@ -2009,0 +2058,3 @@ for (track = trackList; track != NULL; track = track->next)
++            #ifdef SUBTRACKS_HAVE_VIS
++            if (track->limitedVis != tvHide)
++            #endif///def SUBTRACKS_HAVE_VIS
+@@ -2105,0 +2157,4 @@ if(theImgBox)
++            #ifdef SUBTRACKS_HAVE_VIS
++            if(track->labelColor == track->ixColor && track->ixColor == 0)
++                track->ixColor = hvGfxFindRgb(hvg, &track->color);
++            #endif//def SUBTRACKS_HAVE_VIS
+@@ -4595,2 +4649,0 @@ makeChromIdeoImage(&trackList, psOutput, ideoTn);
+-    hPrintf("<td width='80' align='left'><a href='?hgt.in3=1' title='zoom in 10x'>&gt;&gt;&gt;&nbsp;&lt;&lt;&lt;</a>\n");
+-    hPrintf("<td width='60' align='left'><a href='?hgt.in2=1' title='zoom in 3x'>&gt;&gt;&nbsp;&lt;&lt;</a>\n");
+@@ -4598 +4651,3 @@ makeChromIdeoImage(&trackList, psOutput, ideoTn);
+-    hPrintf("<td width='40' align='left'><a href='?hgt.inBase=1' title='zoom in to base range'><i>base</i></a>\n");
++    hPrintf("<td width='60' align='left'><a href='?hgt.in2=1' title='zoom in 3x'>&gt;&gt;&nbsp;&lt;&lt;</a>\n");
++    hPrintf("<td width='80' align='left'><a href='?hgt.in3=1' title='zoom in 10x'>&gt;&gt;&gt;&nbsp;&lt;&lt;&lt;</a>\n");
++    hPrintf("<td width='40' align='left'><a href='?hgt.inBase=1' title='zoom in to base range'>&gt;<i>base</i>&lt;</a>\n");
+@@ -4630,0 +4686 @@ if (!hideControls)
++#ifndef USE_NAVIGATION_LINKS
+@@ -4633,5 +4688,0 @@ if (!hideControls)
+-#ifdef USE_NAVIGATION_LINKS
+-    hPrintf("<a href='?hgt.dinkLL=1' title='move window start position to the left'>&lt;</a>\n");
+-    hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3);
+-    hPrintf("<a href='?hgt.dinkLR=1' title='move window start position to the right'>&gt;</a>\n");
+-#else//ifndef USE_NAVIGATION_LINKS
+@@ -4641 +4691,0 @@ if (!hideControls)
+-#endif//ndef USE_NAVIGATION_LINKS
+@@ -4643,0 +4694 @@ if (!hideControls)
++#endif//ndef USE_NAVIGATION_LINKS
+@@ -4657,0 +4709 @@ if (!hideControls)
++#ifndef USE_NAVIGATION_LINKS
+@@ -4661,5 +4712,0 @@ if (!hideControls)
+-#ifdef USE_NAVIGATION_LINKS
+-    hPrintf("<a href='?hgt.dinkRL=1' title='move window end position to the left'>&lt;</a>\n");
+-    hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3);
+-    hPrintf("<a href='?hgt.dinkRR=1' title='move window end position to the right'>&gt;</a>\n");
+-#else//ifndef USE_NAVIGATION_LINKS
+@@ -4668 +4715 @@ if (!hideControls)
+-    hButton("hgt.dinkRR", " > ");
++    hButton("hgt.dinkRR", " ></TD> ");
+@@ -4670 +4717 @@ if (!hideControls)
+-    hPrintf("</TD></TR></TABLE>\n");
++    hPrintf("</TR></TABLE>\n");