a8d978089e1aaa0b754f1c7860b0e790dde3eb6c angie Fri Mar 11 13:03:25 2011 -0800 Track #34 (dbVar for human): Hooked up next/prev exon methodfor simple bed tracks, which simply hops to right edge/left edge of items hanging off the end of the window. diff --git src/hg/hgTracks/bedTrack.c src/hg/hgTracks/bedTrack.c index 2457f4c..fc49253 100644 --- src/hg/hgTracks/bedTrack.c +++ src/hg/hgTracks/bedTrack.c @@ -593,41 +593,69 @@ int bedItemEnd(struct track *tg, void *item) /* Return end position of item. */ { struct bed *bed = item; return bed->chromEnd; } void freeSimpleBed(struct track *tg) /* Free the beds in a track group that has beds as its items. */ { bedFreeList(((struct bed **)(&tg->items))); } +static void simpleBedNextPrevEdge(struct track *tg, struct hvGfx *hvg, void *item, int x, int y, int w, int h, boolean next) +/* Like linkedFeaturesNextPrevItem, but for simple bed which has no block structure so + * this simply zaps us to the right/left edge of the feature. Arrows have already been + * drawn; here we figure out coords and draw a mapBox. */ +{ +struct bed4 *bed = item; +char *mouseOverText = NULL; +if (next) + mouseOverText = trackDbSettingClosestToHomeOrDefault(tg->tdb, "nextExonText", "Right Edge"); +else + mouseOverText = trackDbSettingClosestToHomeOrDefault(tg->tdb, "prevExonText", "Left Edge"); +int winSize = winEnd - winStart; +int bufferToEdge = 0.05 * winSize; +int newWinStart, newWinEnd; +if (next) + { + newWinEnd = bed->chromEnd + bufferToEdge; + newWinStart = newWinEnd - winSize; + } +else + { + newWinStart = bed->chromStart - bufferToEdge; + newWinEnd = newWinStart + winSize; + } +mapBoxJumpTo(hvg, x, y, w, h, tg, chromName, newWinStart, newWinEnd, mouseOverText); +} + void bedMethods(struct track *tg) /* Fill in methods for (simple) bed tracks. */ { tg->drawItems = bedDrawSimple; tg->drawItemAt = bedDrawSimpleAt; tg->itemName = bedName; tg->mapItemName = bedName; tg->totalHeight = tgFixedTotalHeightNoOverflow; tg->itemHeight = tgFixedItemHeight; tg->itemStart = bedItemStart; tg->itemEnd = bedItemEnd; +tg->nextPrevExon = simpleBedNextPrevEdge; tg->nextPrevItem = linkedFeaturesLabelNextPrevItem; tg->freeItems = freeSimpleBed; } void addSimpleFeatures(struct simpleFeature **pSfList, int start, int end, int qStart, boolean everyBase) /* Add simple features from start to end to the list. * qStart is the offset in the query. * If everyBase is TRUE then add a simpleFeature for every base in the start,end region */ { int s; struct simpleFeature *sf; int stepSize = everyBase ? 1 : end - start; for (s = start ; s < end ; s += stepSize) { AllocVar(sf);