147794f00a80409a41e2fee989218a97bb67b99a
angie
  Fri Apr 1 11:11:29 2011 -0700
Bugs #3475, #3476 (hgTracks map links messed up for SNPs, omimGene):These were side-effects of my commit a8d97808 Mar. 11, in which I
enabled next-prev-exon for all simple beds (which, because they don't
have exons/blocks, just means zap-to-edge), instead of only for dbVar
where it was requested.  It turns out that way too many bed-based
tracks with custom drawItems and/or drawItemAt methods are missing
something necessary for the nextItem stuff to work.  In this fix,
instead of hooking up zap-to-edge for all simple bed, I hook it up
only to GVF (dbVar/ISCA).

diff --git src/hg/hgTracks/bedTrack.c src/hg/hgTracks/bedTrack.c
index fc49253..78d5061 100644
--- src/hg/hgTracks/bedTrack.c
+++ src/hg/hgTracks/bedTrack.c
@@ -593,31 +593,32 @@
 
 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)
+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)
     {
@@ -631,31 +632,34 @@
     }
 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;
+// Adding "tg->nextPrevExon = simpleBedNextPrevEdge;" opened a can of worms: too many
+// bed-based tracks have their own drawItems methods that don't hook into nextItem stuff,
+// or drawItemAt methods that draw mapboxes but tg->mapsSelf is not set...
+// So, set tg->nextPrevExon = simpleBedNextPrevEdge case-by-case.
 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);