b038f3dafce99493b0ca00305538c6a3dd6f041a
jcasper
  Tue Sep 26 15:58:44 2023 -0700
Initial commit of track decorators, refs #30237

diff --git src/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h
index 62bb7a3..17581af 100644
--- src/hg/hgTracks/hgTracks.h
+++ src/hg/hgTracks/hgTracks.h
@@ -59,59 +59,61 @@
 #define MAXPIXELS 14000
 #endif
 
 #define BIGBEDMAXIMUMITEMS 1000000
 
 #define MULTI_REGION_VIRTUAL_CHROM_NAME "multi"
 // original name was 'virt'
 
 #define MULTI_REGION_CFG_BUTTON_TOP     "multiRegionButtonTop"
 
 /* for botDelay call, 10 second for warning, 20 second for immediate exit */
 #define delayFraction   0.25
 extern long enteredMainTime;
 
 #include "lolly.h"
+#include "spaceSaver.h"
 
 struct track
 /* Structure that displays of tracks. The central data structure
  * of the graphical genome browser. */
     {
     struct track *next;   /* Next on list. */
     char *track;             /* Track symbolic name. Name on image map etc. Same as tdb->track. */
     char *table;             /* Table symbolic name. Name of database table. Same as tdb->table.*/
     enum trackVisibility visibility; /* How much of this want to see. */
     enum trackVisibility limitedVis; /* How much of this actually see. */
     boolean limitedVisSet;	     /* Is limited visibility set? */
 
     char *longLabel;           /* Long label to put in center. */
     char *shortLabel;          /* Short label to put on side. */
 
     bool mapsSelf;          /* True if system doesn't need to do map box. */
     bool drawName;          /* True if BED wants name drawn in box. */
 
     Color *colorShades;	       /* Color scale (if any) to use. */
     struct rgbColor color;     /* Main color. */
     Color ixColor;             /* Index of main color. */
     Color *altColorShades;     /* optional alternate color scale */
     struct rgbColor altColor;  /* Secondary color. */
     Color ixAltColor;
 
     void (*loadItems)(struct track *tg);
     /* loadItems loads up items for the chromosome range indicated.   */
 
     void *items;               /* Some type of slList of items. */
+    struct decoratorGroup *decoratorGroup;   /* Some type of slList of decoration sets for items. */
 
     char *(*itemName)(struct track *tg, void *item);
     /* Return name of one of an item to display on left side. */
 
     char *(*mapItemName)(struct track *tg, void *item);
     /* Return name to associate on map. */
 
     int (*totalHeight)(struct track *tg, enum trackVisibility vis);
 	/* Return total height. Called before and after drawItems.
 	 * Must set the following variables. */
     int height;                /* Total height - must be set by above call. */
     int lineHeight;            /* Height per item line including border. */
     int heightPer;             /* Height per item line minus border. */
 
     int (*itemHeight)(struct track *tg, void *item);
@@ -128,30 +130,42 @@
 	MgFont *font, Color color, enum trackVisibility vis);
     /* Do PreDraw item list, one per track. */
 
     void (*drawItems)(struct track *tg, int seqStart, int seqEnd,
 	struct hvGfx *hvg, int xOff, int yOff, int width,
 	MgFont *font, Color color, enum trackVisibility vis);
     /* Draw item list, one per track. */
 
     void (*drawItemAt)(struct track *tg, void *item, struct hvGfx *hvg,
         int xOff, int yOff, double scale,
 	MgFont *font, Color color, enum trackVisibility vis);
     /* Draw a single item.  This is optional, but if it's here
      * then you can plug in genericDrawItems into the drawItems,
      * which takes care of all sorts of things including packing. */
 
+    void (*drawItemLabel)(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);
+    /* Draw the label for an item */
+
+    void (*doItemMapAndArrows)(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);
+    /* Handle item map and exon arrows for an item */
+
     int (*itemStart)(struct track *tg, void *item);
     /* Return start of item in base pairs. */
 
     int (*itemEnd)(struct track *tg, void *item);
     /* Return end of item in base pairs. */
 
     void (*freeItems)(struct track *tg);
     /* Free item list. */
 
     struct hash *attrTable;
     /* Persistent table to speed up lookup of attributes in secondary tables (optional). */
 
     Color (*itemColor)(struct track *tg, void *item, struct hvGfx *hvg);
     /* Get color of item (optional). */
 
@@ -799,32 +813,31 @@
 /* Most fixed height track groups will use this to figure out the height
  * they use. */
 
 int tgFixedTotalHeightNoOverflow(struct track *tg, enum trackVisibility vis);
 /* Most fixed height track groups will use this to figure out the height
  * they use. */
 
 void changeTrackVis(struct group *groupList, char *groupTarget, int changeVis);
 /* Change track visibilities. If groupTarget is
  * NULL then set visibility for tracks in all groups.  Otherwise,
  * just set it for the given group.  If vis is -2, then visibility is
  * unchanged.  If -1 then set visibility to default, otherwise it should
  * be tvHide, tvDense, etc.
  */
 
-void genericDrawItems(struct track *tg,
-                      int seqStart, int seqEnd,
+void genericDrawItems(struct track *tg, int seqStart, int seqEnd,
                       struct hvGfx *hvg, int xOff, int yOff, int width,
                       MgFont *font, Color color, enum trackVisibility vis);
 /* Draw generic item list.  Features must be fixed height
  * and tg->drawItemAt has to be filled in. */
 
 void bedDrawSimpleAt(struct track *tg, void *item,
                      struct hvGfx *hvg, int xOff, int y,
                      double scale, MgFont *font, Color color, enum trackVisibility vis);
 /* Draw a single simple bed item at position. */
 
 void bedDrawSimple(struct track *tg, int seqStart, int seqEnd,
         struct hvGfx *hvg, int xOff, int yOff, int width,
         MgFont *font, Color color, enum trackVisibility vis);
 /* Draw simple Bed items. */