4c18b3b304307799d2875220deff659b2ee0f292
jcasper
  Sun Oct 1 21:36:37 2023 -0700
Missed a few pathways for creating tracks; the generic label and map functions
need to be available for all the tracks they were already a part of.  refs #32303, #30237

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 0c9a6b5..c727904 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -4407,42 +4407,40 @@
     char nameBuff[SMALLBUF];
     safef(nameBuff, sizeof(nameBuff), "Last Row: %d", overflowCount);
     mgFontStringWidth(font, nameBuff);
     hvGfxTextRight(hvgSide, leftLabelX, y, leftLabelWidth-1, tg->lineHeight,
                    color, font, nameBuff);
     hvGfxUnclip(hvgSide);
     hvGfxSetClip(hvgSide, insideX, yOff, insideWidth, tg->height);
     }
 /* restore state */
 tg->limitedVis = origVis;
 tg->heightPer = origHeightPer;
 tg->lineHeight = origLineHeight;
 }
 
 
-static void genericDrawItemLabel(struct track *tg, struct spaceNode *sn,
+void genericDrawItemLabel(struct track *tg, struct spaceNode *sn,
                                  struct hvGfx *hvg, int xOff, int y, int width,
                                  MgFont *font, Color color, Color labelColor, enum trackVisibility vis,
                                  double scale, boolean withLeftLabels)
+/* Generic function for writing out an item label */
 {
 struct slList *item = sn->val;
 int s = tg->itemStart(tg, item);
-//int e = tg->itemEnd(tg, item);
 int sClp = (s < winStart) ? winStart : s;
-//int eClp = (e > winEnd)   ? winEnd   : e;
 int x1 = round((sClp - winStart)*scale) + xOff;
-//int x2 = round((eClp - winStart)*scale) + xOff;
 int textX = x1;
 
 if (tg->drawLabelInBox)
     withLeftLabels = FALSE;
 
 if (tg->itemNameColor != NULL)
     {
     color = tg->itemNameColor(tg, item, hvg);
     labelColor = color;
     if (withLeftLabels && isTooLightForTextOnWhite(hvg, color))
 	labelColor = somewhatDarkerColor(hvg, color);
     }
 
 /* pgSnpDrawAt may change withIndividualLabels between items */
 boolean withLabels = (withLeftLabels && withIndividualLabels && ((vis == tvPack) || (vis == tvFull && isTypeBedLike(tg))) && (!sn->noLabel) && !tg->drawName);
@@ -4497,34 +4495,35 @@
         if(drawNameInverted)
             {
             hvGfxBox(hvg, textX - 1, y, nameWidth+1, tg->heightPer-1, color);
             hvGfxTextRight(hvg, textX, y, nameWidth, tg->heightPer, MG_WHITE, font, name);
             }
         else
             // usual labeling
             hvGfxTextRight(hvg, textX, y, nameWidth, tg->heightPer, labelColor, font, name);
         hvGfxUnclip(hvg);
         hvGfxSetClip(hvgSide, prevX, prevY, prevWidth, prevHeight);
         }
     }
 withIndividualLabels = TRUE; /* reset in case done with pgSnp */
 }
 
-static void genericItemMapAndArrows(struct track *tg, struct spaceNode *sn,
+void genericItemMapAndArrows(struct track *tg, struct spaceNode *sn,
                                     struct hvGfx *hvg, int xOff, int y, int width,
                                     MgFont *font, Color color, Color labelColor, enum trackVisibility vis,
                                     double scale, boolean withLeftLabels)
+/* Generic function for putting down a mapbox with a label and drawing exon arrows */
 {
 struct slList *item = sn->val;
 int s = tg->itemStart(tg, item);
 int e = tg->itemEnd(tg, item);
 int sClp = (s < winStart) ? winStart : s;
 int eClp = (e > winEnd)   ? winEnd   : e;
 int x1 = round((sClp - winStart)*scale) + xOff;
 int x2 = round((eClp - winStart)*scale) + xOff;
 int textX = x1;
 
 
 if (!tg->mapsSelf)
     {
     int w = x2-textX;
     /* Arrows? */
@@ -5217,30 +5216,32 @@
 }
 
 int linkedFeaturesFixedTotalHeightNoOverflow(struct track *tg, enum trackVisibility vis)
 {
 return tgFixedTotalHeightOptionalOverflow(tg,vis, tl.fontHeight+1, tl.fontHeight, FALSE);
 }
 
 
 void linkedFeaturesMethods(struct track *tg)
 /* Fill in track methods for linked features. */
 {
 tg->freeItems = linkedFeaturesFreeItems;
 tg->drawItems = linkedFeaturesDraw;
 tg->drawItemAt = linkedFeaturesDrawAt;
 tg->itemName = linkedFeaturesName;
+tg->drawItemLabel = genericDrawItemLabel;
+tg->doItemMapAndArrows = genericItemMapAndArrows;
 tg->mapItemName = linkedFeaturesName;
 tg->mapItem = linkedFeaturesMapItem;
 //tg->totalHeight = tgFixedTotalHeightNoOverflow;
 tg->totalHeight = linkedFeaturesFixedTotalHeightNoOverflow;
 tg->itemHeight = tgFixedItemHeight;
 tg->itemStart = linkedFeaturesItemStart;
 tg->itemEnd = linkedFeaturesItemEnd;
 tg->itemNameColor = linkedFeaturesNameColor;
 tg->nextPrevExon = linkedFeaturesNextPrevItem;
 tg->nextPrevItem = linkedFeaturesLabelNextPrevItem;
 
 if (trackDbSettingClosestToHomeOn(tg->tdb, "linkIdInName"))
     {
     tg->mapItemName = linkedFeaturesNameField1;
     tg->itemName = linkedFeaturesNameNotField1;