src/hg/hgTracks/simpleTracks.c 1.119

1.119 2010/01/07 23:49:29 markd
added configuration option for the width of the label area
Index: src/hg/hgTracks/simpleTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/simpleTracks.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -b -B -U 4 -r1.118 -r1.119
--- src/hg/hgTracks/simpleTracks.c	4 Jan 2010 19:12:26 -0000	1.118
+++ src/hg/hgTracks/simpleTracks.c	7 Jan 2010 23:49:29 -0000	1.119
@@ -172,9 +172,14 @@
 int winEnd;			/* End of window in sequence. */
 char *position = NULL; 		/* Name of position. */
 
 int trackTabWidth = 11;
+int leftLabelWidthDefaultChars = 17;   /* default number of characters allowed for left label */
+#if 0
 int leftLabelWidthChars = 17;   /* number of characters allowed for left label */
+#else
+int leftLabelWidthChars = 22;   /* number of characters allowed for left label */
+#endif
 int insideX;			/* Start of area to draw track in in pixels. */
 int insideWidth;		/* Width of area to draw tracks in in pixels. */
 int leftLabelX;			/* Start of area to draw left labels on. */
 int leftLabelWidth;		/* Width of area to draw left labels on. */
@@ -218,9 +223,19 @@
 /* Initialize layout around small font and a picture about 600 pixels
  * wide. */
 {
 trackLayoutInit(&tl, cart);
+
+// label width, but don't exceed 1/2 of image
+leftLabelWidthChars = cartUsualInt(cart, "hgt.labelWidth", leftLabelWidthDefaultChars);
+if (leftLabelWidthChars < 2)
+    leftLabelWidthChars = leftLabelWidthDefaultChars;
 tl.leftLabelWidth = leftLabelWidthChars*tl.nWidth + trackTabWidth;
+if (tl.leftLabelWidth > 0.5*tl.picWidth)
+    {
+    leftLabelWidthChars = leftLabelWidthDefaultChars;
+    tl.leftLabelWidth = leftLabelWidthChars*tl.nWidth + trackTabWidth;
+    }
 }
 
 Color lighterColor(struct hvGfx *hvg, Color color)
 /* Get lighter shade of a color - half way between this color and white */