3bdd753973190ec7e64d85a90ab912b9a7c37489 angie Fri Sep 4 13:45:27 2020 -0700 Move leftLabelWidth parameters out of hgTracks global variables into trackLayout lib (for use by hgPhyloPlace). refs #25943 diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index e265869c..85cadb2 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -226,33 +226,30 @@ char *virtModeType = "default"; /* virtual chrom mode type */ char *lastVirtModeType = "default"; char *virtModeShortDescr = ""; /* short description of virt mode */ char *virtModeExtraState = ""; /* Other settings that affect the virtMode state such as padding or some parameter */ char *lastVirtModeExtraState = ""; struct cart *lastDbPosCart = NULL; /* store settings for use in lastDbPos and hgTracks.js setupHistory */ char *organism; /* Name of organism we're working on. */ char *database; /* Name of database we're using. */ char *chromName; /* Name of chromosome sequence . */ int winStart; /* Start of window in sequence. */ int winEnd; /* End of window in sequence. */ char *position = NULL; /* Name of position. */ -int trackTabWidth = 11; -int leftLabelWidthDefaultChars = 20; /* default number of characters allowed for left label */ -int leftLabelWidthChars = 20; /* number of characters allowed for left label */ 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. */ float basesPerPixel = 0; /* bases covered by a pixel; a measure of zoom */ boolean zoomedToBaseLevel; /* TRUE if zoomed so we can draw bases. */ boolean zoomedToCodonLevel; /* TRUE if zoomed so we can print codons text in genePreds*/ boolean zoomedToCdsColorLevel; /* TRUE if zoomed so we can color each codon*/ boolean withLeftLabels = TRUE; /* Display left labels? */ boolean withIndividualLabels = TRUE; /* print labels on item-by-item basis (false to skip) */ boolean withCenterLabels = TRUE; /* Display center labels? */ boolean withGuidelines = TRUE; /* Display guidelines? */ boolean withNextExonArrows = FALSE; /* Display next exon navigation buttons near center labels? */ boolean withExonNumbers = FALSE; /* Display exon and intron numbers in mouseOver instead of item name */ @@ -276,42 +273,30 @@ Color shadesOfSea[10+1]; /* Ten sea shades. */ struct rgbColor darkSeaColor = {0, 60, 120}; struct rgbColor lightSeaColor = {200, 220, 255}; struct hash *hgFindMatches; /* The matches found by hgFind that should be highlighted. */ struct trackLayout tl; void initTl() /* 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 + 3; -int maxLabelWidth = 0.5*tl.picWidth; -if (tl.leftLabelWidth > maxLabelWidth) - { - // overflow, force to 1/2 width - leftLabelWidthChars = maxLabelWidth/tl.nWidth; - tl.leftLabelWidth = leftLabelWidthChars * tl.nWidth; - } } static boolean isTooLightForTextOnWhite(struct hvGfx *hvg, Color color) /* Return TRUE if text in this color would probably be invisible on a white background. */ { struct rgbColor rgbColor = hvGfxColorIxToRgb(hvg, color); int colorTotal = rgbColor.r + 2*rgbColor.g + rgbColor.b; return colorTotal >= 512; } Color darkerColor(struct hvGfx *hvg, Color color) /* Get darker shade of a color - half way between this color and black */ { struct rgbColor rgbColor = hvGfxColorIxToRgb(hvg, color); rgbColor.r = ((int)rgbColor.r)/2;