Index: src/hg/lib/hui.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hui.c,v
retrieving revision 1.289
retrieving revision 1.290
diff -b -B -U 4 -r1.289 -r1.290
--- src/hg/lib/hui.c	18 May 2010 06:31:44 -0000	1.289
+++ src/hg/lib/hui.c	20 May 2010 03:17:21 -0000	1.290
@@ -85,9 +85,10 @@
     }
 return FALSE;
 }
 
-static boolean metadataToggle(char *db,struct trackDb *tdb,char *title,boolean embeddedInText,boolean showLongLabel)
+boolean compositeMetadataToggle(char *db,struct trackDb *tdb,char *title,
+	boolean embeddedInText,boolean showLongLabel)
 /* If metadata from metaTbl if it exists, create a link that will allow toggling it's display */
 {
 const struct mdbObj *safeObj = metadataForTable(db,tdb,NULL);
 if(safeObj == NULL || safeObj->vars == NULL)
@@ -156,9 +157,9 @@
     if(metadataLink)
         printf(",");
     }
 if (metadataLink)
-    metadataToggle(db,tdb,"metadata", TRUE, TRUE);
+    compositeMetadataToggle(db,tdb,"metadata", TRUE, TRUE);
 
 if(moreThanOne)
     printf("</td></tr></table>");
 puts("</P>");
@@ -1679,9 +1680,9 @@
     {
     struct trackDb *tdb = trackEl->val;
     char *dupe = cloneString(tdb->type);
     char *type = firstWordInLine(dupe);
-    if ((sameString(type, "genePred")) && (!sameString(tdb->track, "tigrGeneIndex") && !tdbIsComposite(tdb)))
+    if ((sameString(type, "genePred")) && (!sameString(tdb->table, "tigrGeneIndex") && !tdbIsComposite(tdb)))
 	{
 	AllocVar(name);
 	name->name = tdb->track;
 	name->label = tdb->shortLabel;
@@ -3609,8 +3610,9 @@
                  boolean selectedOnly, char *primarySubtrack)
 /* Display list of subtracks and descriptions with checkboxes to control visibility and possibly other
  * nice things including links to schema and metadata and a release date. */
 {
+boolean doColorPatch = trackDbSettingOn(parentTdb, "showSubtrackColorOnUi");
 struct trackDb *subtrack;
 char *primaryType = getPrimaryType(primarySubtrack, parentTdb);
 char htmlIdentifier[SMALLBUF];
 struct dyString *dyHtml = newDyString(SMALLBUF);
@@ -3674,12 +3676,17 @@
             break;
             }
         }
 
+    int colspan = 3;
+    if (sortOrder != NULL)
+        colspan = sortOrder->count+2;
+    if (doColorPatch)
+        colspan += 1;
     printf("<TR");
     if(useDragAndDrop)
         printf(" id=\"noDrag\" class='nodrop nodrag'");
-    printf("><TD colspan='%d'><B>List subtracks:&nbsp;",(sortOrder != NULL?sortOrder->count+2:3));
+    printf("><TD colspan='%d'><B>List subtracks:&nbsp;", colspan);
     safef(javascript, sizeof(javascript), "onclick=\"showOrHideSelectedSubtracks(true);\"");
     cgiMakeOnClickRadioButton("displaySubtracks", "selected", !displayAll,javascript);
     puts("only selected/visible &nbsp;&nbsp;");
     safef(javascript, sizeof(javascript), "onclick=\"showOrHideSelectedSubtracks(false);\"");
@@ -3800,8 +3807,14 @@
                 float priority = (float)cartUsualDouble(cart, htmlIdentifier, subtrack->priority);
                 printf("<INPUT TYPE=HIDDEN NAME='%s' id='%s' VALUE=\"%.0f\">", htmlIdentifier, htmlIdentifier, priority); // keeing track of priority
                 }
 
+	    if (doColorPatch)
+		{
+		printf("<TD BGCOLOR='#");
+		printf("%2X%2X%2X", subtrack->colorR, subtrack->colorG, subtrack->colorB);
+		printf("'>&nbsp;&nbsp;&nbsp;&nbsp;</TD>");
+		}
             if(sortOrder != NULL)
                 {
                 int sIx=0;
                 for(sIx=0;sIx<sortOrder->count;sIx++)
@@ -3835,9 +3848,9 @@
                 }
             printf ("<TD nowrap='true' title='select to copy' onmouseover=\"this.style.cursor='text';\"><div>&nbsp;%s", subtrack->longLabel);
             if(trackDbSetting(parentTdb, "wgEncode") && trackDbSetting(subtrack, "accession"))
                 printf (" [GEO:%s]", trackDbSetting(subtrack, "accession"));
-            metadataToggle(db,subtrack,"...",TRUE,FALSE);
+            compositeMetadataToggle(db,subtrack,"...",TRUE,FALSE);
             printf("</div>");
 
             if(cType != cfgNone)
                 {

