64b2c5bd9ab0e2bd59360c39298ae54e97615407
kate
  Thu Sep 26 13:30:43 2019 -0700
Add UI control to hide empty subtracks. refs #23365

diff --git src/hg/inc/hui.h src/hg/inc/hui.h
index 702a003..8ea6f48 100644
--- src/hg/inc/hui.h
+++ src/hg/inc/hui.h
@@ -140,30 +140,33 @@
 #define MICROARRAY_CLICK_LIMIT 200
 
 /* itemImagePath trackDb variable names */
 #define ITEM_IMAGE_PATH "itemImagePath"
 #define ITEM_BIG_IMAGE_PATH "itemBigImagePath"
 
 /* SwitchGear TSS default filter. */
 #define SWITCHDBTSS_FILTER 10
 
 /* Subtrack color support in UI */
 #define SUBTRACK_COLOR_PATCH    "showSubtrackColorOnUi"
 // for use with subGroup and sortOrder settings
 // ie. subGroup1 subtrackColor Color; sortOrder subtrackColor=+ cellType=+
 #define SUBTRACK_COLOR_SUBGROUP "subtrackColor"
 
+// trackDb setting and cart/cgi var
+#define SUBTRACK_HIDE_EMPTIES   "hideEmptySubtracks"
+
 void netUi(struct trackDb *tdb);
 
 struct controlGrid
 /* Keep track of a control grid (table) */
     {
     int columns;	/* How many columns in grid. */
     int columnIx;	/* Index (0 based) of current column. */
     char *align;	/* Which way to align. */
     boolean rowOpen;	/* True if have opened a row. */
     };
 
 struct controlGrid *startControlGrid(int columns, char *align);
 /* Start up a control grid. */
 
 void controlGridStartCell(struct controlGrid *cg);
@@ -962,30 +965,37 @@
  * non-NULL, don't allow it to be cleared and only offer subtracks
  * that have the same type.  If fakeSubmit is non-NULL, add a hidden
  * var with that name so it looks like it was pressed. */
 
 char *compositeGroupLabel(struct trackDb *childTdb, char *group, char *id);
 /* Given ID from group, return corresponding label,  looking through parent's subGroupN's */
 
 char *compositeGroupId(struct trackDb *tdb, char *group, char *id);
 /* Given label, return id,  looking through parent's subGroupN's */
 
 char *compositeLabelWithVocabLink(char *db,struct trackDb *parentTdb, struct trackDb *childTdb,
 	char *vocabType, char *label);
 /* If the parentTdb has an ENCODE controlledVocabulary setting and the vocabType is found,
    then label will be wrapped with the link to display it.  Return string is cloned. */
 
+boolean compositeHideEmptySubtracks(struct cart *cart, struct trackDb *tdb,
+                                        char **retMutiBedFile, char **retSubtrackIdFile);
+/* Parse hideEmptySubtracks setting and check cart
+ * Return TRUE if we should hide empties
+ */
+
+
 char *wgEncodeVocabLink(char *file,char *term,char *value,char *title, char *label,char *suffix);
 // returns allocated string of HTML link to ENCODE controlled vocabulary term
 
 char *metadataAsHtmlTable(char *db,struct trackDb *tdb,boolean
         showLongLabel,boolean showShortLabel);
 /* If metadata from metaDb exists, return string of html with table definition */
 
 boolean compositeMetadataToggle(char *db,struct trackDb *tdb,char *title,
         boolean embeddedInText,boolean showLongLabel);
 /* If metadata from metaTbl exists, create a link that will allow toggling it's display */
 
 boolean superTrackDropDownWithExtra(struct cart *cart, struct trackDb *tdb,
                                     int visibleChild, struct slPair *events);
 /* Displays hide/show dropdown for supertrack.
  * Set visibleChild to indicate whether 'show' should be grayed