src/hg/hgTracks/wigTrack.c 1.107

1.107 2010/05/07 22:30:14 kent
Separating out multiWigs into a separate module from container.
Index: src/hg/hgTracks/wigTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/wigTrack.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -b -B -U 4 -r1.106 -r1.107
--- src/hg/hgTracks/wigTrack.c	27 Apr 2010 23:31:41 -0000	1.106
+++ src/hg/hgTracks/wigTrack.c	7 May 2010 22:30:14 -0000	1.107
@@ -1363,13 +1363,14 @@
 freeMem(preDrawContainer);
 freeMem(preDraw);
 }	/*	wigDrawItems()	*/
 
-void wigLeftLabels(struct track *tg, int seqStart, int seqEnd,
+void wigLeftAxisLabels(struct track *tg, int seqStart, int seqEnd,
 	struct hvGfx *hvg, int xOff, int yOff, int width, int height,
 	boolean withCenterLabels, MgFont *font, Color color,
-	enum trackVisibility vis)
-/*	drawing left labels	*/
+	enum trackVisibility vis, char *shortLabel, 
+	double graphUpperLimit, double graphLowerLimit, boolean showNumbers)
+/* Draw labels on left for a wiggle-type track. */
 {
 int fontHeight = tl.fontHeight+1;
 int centerOffset = 0;
 double lines[2];	/*	lines to label	*/
@@ -1389,24 +1390,22 @@
 /*	We only do Dense and Full	*/
 if (tg->limitedVis == tvDense)
     {
     hvGfxTextRight(hvg, xOff, yOff+centerOffset, width - 1, height-centerOffset,
-	tg->ixColor, font, tg->shortLabel);
+	tg->ixColor, font, shortLabel);
     }
 else if (tg->limitedVis == tvFull)
     {
     int centerLabel = (height/2)-(fontHeight/2);
-    int labelWidth = 0;
+    int labelWidth = mgFontStringWidth(font, shortLabel);
 
     /* track label is centered in the whole region */
-    hvGfxText(hvg, xOff, yOff+centerLabel, tg->ixColor, font, tg->shortLabel);
-    labelWidth = mgFontStringWidth(font,tg->shortLabel);
+    hvGfxText(hvg, xOff, yOff+centerLabel, tg->ixColor, font, shortLabel);
+
     /*	Is there room left to draw the min, max ?	*/
-    if (height >= (3 * fontHeight))
+    if (showNumbers && height >= (3 * fontHeight))
 	{
 	boolean zeroOK = TRUE;
-	double graphUpperLimit = tg->graphUpperLimit;
-	double graphLowerLimit = tg->graphLowerLimit;
 	char upper[SMALLBUF];
 	char lower[SMALLBUF];
 	char upperTic = '-';	/* as close as we can get with ASCII */
 			/* the ideal here would be to draw tic marks in
@@ -1497,9 +1496,19 @@
 		}	/*	drawing a zero label	*/
 	    }	/*	drawing 0.0 and perhaps yLineMark	*/
 	}	/* if (height >= (3 * fontHeight))	*/
     }	/*	if (tg->visibility == tvFull)	*/
-}	/* wigLeftLabels */
+} /* wigAxisLeftLabels */
+
+void wigLeftLabels(struct track *tg, int seqStart, int seqEnd,
+	struct hvGfx *hvg, int xOff, int yOff, int width, int height,
+	boolean withCenterLabels, MgFont *font, Color color,
+	enum trackVisibility vis)
+/*	drawing left labels	*/
+{
+wigLeftAxisLabels(tg, seqStart, seqEnd, hvg, xOff, yOff, width, height, withCenterLabels, 
+	font, color, vis, tg->shortLabel, tg->graphUpperLimit, tg->graphLowerLimit, TRUE);
+}	
 
 
 struct wigCartOptions *wigCartOptionsNew(struct cart *cart, struct trackDb *tdb, int wordCount, char *words[])
 /* Create a wigCartOptions from cart contents and tdb. */