6629bda6c730982c3e4602ec78ff3b0cbf701c61
braney
  Tue May 25 17:31:38 2021 -0700
implement cart editing.  Needs doc.  ;-)

diff --git src/hg/lib/trackDbCustom.c src/hg/lib/trackDbCustom.c
index c7ce5ee..f5617bb 100644
--- src/hg/lib/trackDbCustom.c
+++ src/hg/lib/trackDbCustom.c
@@ -11,30 +11,39 @@
 #include "jksql.h"
 #include "trackDb.h"
 #include "hdb.h"
 #include "hui.h"
 #include "ra.h"
 #include "hash.h"
 #include "net.h"
 #include "sqlNum.h"
 #include "obscure.h"
 #include "hgMaf.h"
 #include "customTrack.h"
 #include "regexHelper.h"
 #include "fieldedTable.h"
 #include "tagRepo.h"
 
+static int cartVersion = 0;
+
+int trackDbGetCartVersion()
+/* Get the highest cart version that a set of trackDb entries has specified. */
+{
+return cartVersion;
+}
+
+
 struct trackDb *trackDbNew()
 /* Allocate a new trackDb with just very minimal stuff filled in. */
 {
 struct trackDb *tdb;
 AllocVar(tdb);
 tdb->canPack = 2;	/* Unknown value. */
 return tdb;
 }
 
 int trackDbCmp(const void *va, const void *vb)
 /* Compare to sort based on priority; use shortLabel as secondary sort key.
  * Note: parallel code to hgTracks.c:tgCmpPriority */
 {
 const struct trackDb *a = *((struct trackDb **)va);
 const struct trackDb *b = *((struct trackDb **)vb);
@@ -123,30 +132,37 @@
 if (bt->viewHash == NULL)
     bt->viewHash = hashNew(7);
 char *storeValue = cloneString(value);
 
 // squirrel away views
 if (startsWith("subGroup", var))
     {
     char *ptr = strchr(value, ' ');
     if (ptr)
         *ptr = 0;
     hashAdd(bt->viewHash, value, storeValue);
     if (ptr)
         *ptr = ' ';
     }
 
+if (startsWith("cartVersion", var))
+    {
+    unsigned thisCartVersion = sqlUnsigned(value);
+    if (thisCartVersion > cartVersion)
+        cartVersion = thisCartVersion;
+    }
+
 hashAdd(bt->settingsHash, var, storeValue);
 
 if (bt->overrides != NULL)
     hashAdd(bt->overrides, var, NULL);
 }
 
 //not needed?
 int bedDetailSizeFromType(char *type)
 /* parse bedSize from type line for bedDetail, assume 4 if none */
 {
 int ret = 4;  /* minimal expected */
 char *words[3];
 int wordCount = chopLine(cloneString(type), words);
 if (wordCount > 1)
     ret = atoi(words[1]) - 2; /* trackDb has field count, we want bedSize */