7b475d1ee80e5e8725e2caf2b227e81abb413021
braney
  Fri Mar 15 13:54:33 2024 -0700
make maxItemsPossible an hg.conf variable

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 1e0a82f..ca1883e 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -171,31 +171,30 @@
 int maxRGBShade = EXPR_DATA_SHADES - 1;
 
 Color scafColor[SCAF_COLORS+1];
 /* declare colors for scaffold coloring, +1 for unused scaffold 0 color */
 
 Color chromColor[CHROM_COLORS+1];
 /* Declare colors for chromosome coloring, +1 for unused chrom 0 color */
 
 /* Have the 3 shades of 8 chromosome colors been allocated? */
 boolean chromosomeColorsMade = FALSE;
 boolean doPliColors = FALSE;
 /* have the 10 scaffold colors been allocated */
 static boolean scafColorsMade = FALSE;
 
 int maxItemsInFullTrack = 1000;  /* Maximum number of items displayed in full */
-int maxItemsPossible = 100000;   /* Maximum possible value for maxItems */
 int maxItemsToUseOverflowDefault = 10000; /* # of items to allow overflow mode*/
 
 /* These variables persist from one incarnation of this program to the
  * next - living mostly in the cart. */
 
 // multi-window variables global to hgTracks
 struct window *windows = NULL;  // list of windows in image
 struct window *currentWindow = NULL;
 bool trackLoadingInProgress;  // flag to delay ss layout until all windows are ready.
 int fullInsideX;      // full-image insideX
 int fullInsideWidth;  // full-image insideWidth
 
 struct virtRegion *virtRegionList = NULL;     // list of regions in virtual chrom
 struct virtChromRegionPos *virtChrom = NULL;  // virtual chrom array of positions and regions
 int virtRegionCount = 0;  // number of regions in virtual chromosome
@@ -801,30 +800,39 @@
  * function pointers with if we have nothing to do. */
 void tgLoadNothing(struct track *tg){}
 void tgFreeNothing(struct track *tg){}
 int tgItemNoStart(struct track *tg, void *item) {return -1;}
 int tgItemNoEnd(struct track *tg, void *item) {return -1;}
 
 int tgFixedItemHeight(struct track *tg, void *item)
 /* Return item height for fixed height track. */
 {
 return tg->lineHeight;
 }
 
 int maximumTrackItems(struct track *tg)
 /* Return the maximum number of items allowed in track. */
 {
+static boolean set = FALSE;
+static unsigned maxItemsPossible = 0;
+
+if (!set)
+    {
+    char *maxItemsPossibleStr = cfgOptionDefault("maxItemsPossible", "100000");
+    maxItemsPossible = sqlUnsigned(maxItemsPossibleStr);
+    }
+
 unsigned int maxItems = trackDbFloatSettingOrDefault(tg->tdb, "maxItems", maxItemsInFullTrack);
 
 if (maxItems > maxItemsPossible)
     maxItems = maxItemsPossible;
 
 return maxItems;
 }
 
 int maximumTrackHeight(struct track *tg)
 /* Return the maximum track height allowed in pixels. */
 {
 int maxItems = maximumTrackItems(tg);
 return maxItems * tl.fontHeight;
 }