0a80449f4b81955b313a3ec01aa2b42c235c3948
braney
  Sun Aug 16 16:25:44 2015 -0700
implement the suggestion in note-18 of #6551.    Default track visibilities
are now stored in the cart.  The defaults are reloaded from trackDb on a
new cart, when the assembly is changed, or when "default tracks" is
pressed.

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index befec83..4fc0083 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -734,30 +734,35 @@
 #endif /* GBROWSE */
 
 if (newDatabase != NULL)
     {
     cartSetString(cart,"db", newDatabase);
     // this is some magic to use the defaultPosition */
     cartSetString(cart,"position", "genome");
     }
 
 if (exclude != NULL)
     {
     while ((ex = *exclude++))
 	cartExclude(cart, ex);
     }
 
+// if user has clicked "default tracks" or changed assembly, reset visibilities from trackDb
+boolean defaultTracks = cgiVarExists("hgt.reset");
+if (defaultTracks || (oldVars != NULL && cartValueHasChanged(cart,  oldVars, "db" , FALSE, FALSE)))
+    cartRemove(cart, CART_HAS_DEFAULT_VISIBILITY);
+
 cartDefaultDisconnector(&conn);
 return cart;
 }
 
 
 
 static void updateOne(struct sqlConnection *conn,
 	char *table, struct cartDb *cdb, char *contents, int contentSize)
 /* Update cdb in database. */
 {
 struct dyString *dy = newDyString(4096);
 sqlDyStringPrintf(dy, "UPDATE %s SET contents='", table);
 sqlDyAppendEscaped(dy, contents);
 sqlDyStringPrintf(dy, "',lastUse=now(),useCount=%d ", cdb->useCount+1);
 sqlDyStringPrintf(dy, " where id=%u", cdb->id);