src/hg/hgTracks/hgTracks.c 1.1594

1.1594 2009/08/25 05:58:18 angie
Fixed maxWindowToDraw-handling to support the setting at both composite track and subtrack level. Unfortunately, view-level does not yet work because limitedVisFromComposite overrides the dense limitedVis, so if view default vis is pack then the message is not displayed (clipped, 0 items = 0 height).
Index: src/hg/hgTracks/hgTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/hgTracks.c,v
retrieving revision 1.1593
retrieving revision 1.1594
diff -b -B -U 4 -r1.1593 -r1.1594
--- src/hg/hgTracks/hgTracks.c	20 Aug 2009 20:34:57 -0000	1.1593
+++ src/hg/hgTracks/hgTracks.c	25 Aug 2009 05:58:18 -0000	1.1594
@@ -3812,9 +3812,8 @@
 				 enum trackVisibility vis)
 /* This is a stub drawItems handler to be swapped in for the usual drawItems when the window
  * size is larger than the threshold specified by trackDb setting maxWindowToDraw. */
 {
-// draw no-data-yellow single-height box
 int maxWinToDraw = getMaxWindowToDraw(tg->tdb);
 char commafied[256];
 sprintLongWithCommas(commafied, maxWinToDraw);
 char message[512];
@@ -3823,33 +3822,43 @@
 hvGfxBox(hvg, xOff, yOff, width, tg->heightPer, yellow);
 hvGfxTextCentered(hvg, xOff, yOff, width, tg->heightPer, MG_BLACK, font, message);
 }
 
-static boolean maxWindowSizeExceeded(struct track *tg)
+static void dontLoadItems(struct track *tg)
+/* No-op loadItems when we aren't going to try. */
+{
+}
+
+static void checkMaxWindowToDraw(struct track *tg)
 /* If (winEnd - winStart) > trackDb setting maxWindowToDraw, force track to a dense line
  * that will ask the user to zoom in closer to see track items and return TRUE so caller
  * can skip loading items. */
 {
 int maxWinToDraw = getMaxWindowToDraw(tg->tdb);
-if (maxWinToDraw > 1 && (winEnd - winStart) > maxWinToDraw)
-    {
-    if (tdbIsComposite(tg->tdb))
+if (tdbIsComposite(tg->tdb))
 	{
 	struct track *subtrack;
 	for (subtrack = tg->subtracks;  subtrack != NULL;  subtrack = subtrack->next)
 	    {
+	if (!isSubtrackVisible(subtrack))
+	    continue;
+	maxWinToDraw = getMaxWindowToDraw(subtrack->tdb);
+	if (maxWinToDraw > 1 && (winEnd - winStart) > maxWinToDraw)
+	    {
+	    subtrack->loadItems = dontLoadItems;
 	    subtrack->drawItems = drawMaxWindowWarning;
 	    subtrack->limitedVis = tvDense;
 	    subtrack->limitedVisSet = TRUE;
 	    }
 	}
-    else
+    }
+else if (maxWinToDraw > 1 && (winEnd - winStart) > maxWinToDraw)
+    {
+    tg->loadItems = dontLoadItems;
 	tg->drawItems = drawMaxWindowWarning;
     tg->limitedVis = tvDense;
     tg->limitedVisSet = TRUE;
-    return TRUE;
     }
-return FALSE;
 }
 
 void doTrackForm(char *psOutput, struct tempName *ideoTn)
 /* Make the tracks display form with the zoom/scroll buttons and the active
@@ -3948,9 +3957,9 @@
     else if (track->visibility != tvHide)
 	{
 	if (measureTiming)
 	    lastTime = clock1000();
-	if (! maxWindowSizeExceeded(track))
+	checkMaxWindowToDraw(track);
 	    track->loadItems(track);
 
 	if (measureTiming)
 	    {