444f75d5725c842f5235448f0d0c352ec74ee80b aamp Sun Feb 13 15:13:28 2011 -0800 Slight code changes to allow a trackDb setting-controlled mouseover text for next-exon buttons diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index defe097..087b709 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -1714,36 +1714,48 @@ /* A function used by linkedFeaturesNextPrevItem to make that function */ /* easy to read. Move the window so that the end of the exon in question */ /* is near the end of the browser window. */ { *pNewWinEnd = exonEnd + bufferToEdge; *pNewWinStart = *pNewWinEnd - newWinSize; } void linkedFeaturesNextPrevItem(struct track *tg, struct hvGfx *hvg, void *item, int x, int y, int w, int h, boolean next) /* Draw a mapBox over the arrow-button on an *item already in the window*. */ /* Clicking this will do one of several things: */ { struct linkedFeatures *lf = item; struct simpleFeature *exons = lf->components; struct simpleFeature *exon = exons; +char *nextExonText; +char *prevExonText; int newWinSize = winEnd - winStart; int bufferToEdge = 0.05 * newWinSize; int newWinStart, newWinEnd; int numExons = 0; int exonIx = 0; struct slRef *exonList = NULL, *ref; +if (startsWith("chain", tg->tdb->type)) + { + nextExonText = trackDbSettingClosestToHomeOrDefault(tg->tdb, "nextExonText", "Next Block"); + prevExonText = trackDbSettingClosestToHomeOrDefault(tg->tdb, "prevExonText", "Prev Block"); + } +else + { + nextExonText = trackDbSettingClosestToHomeOrDefault(tg->tdb, "nextExonText", "Next Exon"); + prevExonText = trackDbSettingClosestToHomeOrDefault(tg->tdb, "prevExonText", "Prev Exon"); + } while (exon != NULL) /* Make a stupid list of exons separate from what's given. */ /* It seems like lf->components isn't necessarily sorted. */ { refAdd(&exonList, exon); exon = exon->next; } /* Now sort it. */ if (next) slSort(&exonList, exonSlRefCmp); else slSort(&exonList, exonSlRefReverseCmp); numExons = slCount(exonList); for (ref = exonList; ref != NULL; ref = ref->next, exonIx++) { @@ -1757,55 +1769,55 @@ /* right overhang (but left side of screen in reserve-strand-display) */ { if (exon->start < winEnd) { /* not an intron hanging over edge. */ if ((lf->tallEnd > winEnd) && (lf->tallEnd < exon->end) && (lf->tallEnd > exon->start)) linkedFeaturesMoveWinEnd(lf->tallEnd, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); else linkedFeaturesMoveWinEnd(exon->end, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); } else if (bigExon) linkedFeaturesMoveWinStart(exon->start, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); else linkedFeaturesMoveWinEnd(exon->end, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); if (!revStrand) - safef(mouseOverText, sizeof(mouseOverText), "Next Exon (%d/%d)", exonIx+1, numExons); + safef(mouseOverText, sizeof(mouseOverText), "%s (%d/%d)", nextExonText, exonIx+1, numExons); else - safef(mouseOverText, sizeof(mouseOverText), "Prev Exon (%d/%d)", numExons-exonIx, numExons); + safef(mouseOverText, sizeof(mouseOverText), "%s (%d/%d)", prevExonText, numExons-exonIx, numExons); mapBoxJumpTo(hvg, x, y, w, h, tg, chromName, newWinStart, newWinEnd, mouseOverText); break; } else if (!next && (exon->start < winStart)) /* left overhang */ { if (exon->end > winStart) { /* not an inron hanging over the edge. */ if ((lf->tallStart < winStart) && (lf->tallStart > exon->start) && (lf->tallStart < exon->end)) linkedFeaturesMoveWinStart(lf->tallStart, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); else linkedFeaturesMoveWinStart(exon->start, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); } else if (bigExon) linkedFeaturesMoveWinEnd(exon->end, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); else linkedFeaturesMoveWinStart(exon->start, bufferToEdge, newWinSize, &newWinStart, &newWinEnd); if (!revStrand) - safef(mouseOverText, sizeof(mouseOverText), "Prev Exon (%d/%d)", numExons-exonIx, numExons); + safef(mouseOverText, sizeof(mouseOverText), "%s (%d/%d)", prevExonText, numExons-exonIx, numExons); else - safef(mouseOverText, sizeof(mouseOverText), "Next Exon (%d/%d)", exonIx+1, numExons); + safef(mouseOverText, sizeof(mouseOverText), "%s (%d/%d)", nextExonText, exonIx+1, numExons); mapBoxJumpTo(hvg, x, y, w, h, tg, chromName, newWinStart, newWinEnd, mouseOverText); break; } } slFreeList(&exonList); } void linkedFeaturesLabelNextPrevItem(struct track *tg, boolean next) /* Default next-gene function for linkedFeatures. Changes winStart/winEnd * and updates position in cart. */ { int start = winStart; int end = winEnd; int size = winBaseCount; int sizeWanted = size;