14cca8e7fd32f8f6b2d8f887ee9e49d522aa57ec jcasper Fri Feb 7 11:37:22 2014 -0800 Revised logic for cytoBandIdeo parentheses per code review, refs #12614 diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 9aa1218..fd48b94 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -661,37 +661,34 @@ if (psOutput) { trashDirFile(ideoTn, "hgtIdeo", "hgtIdeo", ".ps"); hvg = hvGfxOpenPostScript(ideoWidth, ideoHeight, ideoTn->forCgi); } else { trashDirFile(ideoTn, "hgtIdeo", "hgtIdeo", ".png"); hvg = hvGfxOpenPng(ideoWidth, ideoHeight, ideoTn->forCgi, FALSE); } hvg->rc = revCmplDisp; initColors(hvg); ideoTrack->ixColor = hvGfxFindRgb(hvg, &ideoTrack->color); ideoTrack->ixAltColor = hvGfxFindRgb(hvg, &ideoTrack->altColor); hvGfxSetClip(hvg, 0, gfxBorder, ideoWidth, ideoTrack->height); - if (sameString(startBand, endBand)) - { - if (startBand[0] == '\0') + if (isEmpty(startBand)) safef(title, sizeof(title), "%s", chromName); - else + else if (sameString(startBand, endBand)) safef(title, sizeof(title), "%s (%s)", chromName, startBand); - } else safef(title, sizeof(title), "%s (%s-%s)", chromName, startBand, endBand); textWidth = mgFontStringWidth(font, title); hvGfxTextCentered(hvg, 2, gfxBorder, textWidth, ideoTrack->height, MG_BLACK, font, title); ideoTrack->drawItems(ideoTrack, winStart, winEnd, hvg, textWidth+4, gfxBorder, ideoWidth-textWidth-4, font, ideoTrack->ixColor, ideoTrack->limitedVis); hvGfxUnclip(hvg); /* Save out picture and tell html file about it. */ hvGfxClose(&hvg); /* Finish map. */ if (!psOutput) hPrintf("</MAP>\n"); } hPrintf("<TABLE BORDER=0 CELLPADDING=0>"); if (doIdeo && !psOutput)