88454ed252052c312a2751c9470b87e1b286a6dd kate Mon Jan 12 15:29:41 2015 -0800 Add ability to sort subtracks by color to hgTrackUi. refs #14353. diff --git src/hg/lib/hui.c src/hg/lib/hui.c index a33907f..a344d4e 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -4342,60 +4342,64 @@ (visibleCB ? "":" disabled")); #define SUBTRACK_CFG_VIS "<div id= '%s_faux' class='%s' style='width:65px;' " \ "onclick='return subCfg.replaceWithVis(this,\"%s\",true);'>" \ "%s</div>\n" printf(SUBTRACK_CFG_VIS,subtrack->track,classList,subtrack->track,hStringFromTv(vis)); if (cType != cfgNone) // make a wrench { #define SUBTRACK_CFG_WRENCH "<span class='clickable%s' onclick='return " \ "subCfg.cfgToggle(this,\"%s\");' title='Configure this " \ "subtrack'><img src='../images/wrench.png'></span>\n" printf(SUBTRACK_CFG_WRENCH,(visibleCB ? "":" disabled"),subtrack->track); } } printf("</TD>"); - // A color patch which helps distinguish subtracks in some types of composites - if (settings->colorPatch) - { - printf("<TD BGCOLOR='#%02X%02X%02X'> </TD>", - subtrack->colorR, subtrack->colorG, subtrack->colorB); - } - // If sortable, then there must be a column per sortable dimension if (sortOrder != NULL) { int sIx=0; for (sIx=0; sIx <sortOrder->count; sIx++) { ix = stringArrayIx(sortOrder->column[sIx], membership->subgroups, membership->count); // TODO: Sort needs to expand from subGroups to labels as well if (ix >= 0) { char *titleRoot=NULL; if (cvTermIsEmpty(sortOrder->column[sIx],membership->titles[ix])) titleRoot = cloneString(" "); else titleRoot = labelRoot(membership->titles[ix],NULL); // Each sortable column requires hidden goop (in the "abbr" field currently) // which is the actual sort on value printf("<TD id='%s_%s' abbr='%s' align='left'> ", subtrack->track,sortOrder->column[sIx],membership->membership[ix]); printf("%s",titleRoot); puts("</TD>"); freeMem(titleRoot); } + else if (settings->colorPatch && sIx == 0) + { + struct rgbColor rgbColor; + rgbColor.r = subtrack->colorR; + rgbColor.g = subtrack->colorG; + rgbColor.b = subtrack->colorB; + struct hslColor hslColor = mgRgbToHsl(rgbColor); + int hue = hslColor.h * 10; + printf("<TD id='%s_%s' abbr='%04d' bgcolor='#%02X%02X%02X'> </TD>", + subtrack->track, sortOrder->column[sIx], hue, rgbColor.r, rgbColor.g, rgbColor.b); + } } } else // Non-sortable tables do not have sort by columns but will display a short label { // (which may be a configurable link) printf("<TD> "); hierarchy_t *hierarchy = hierarchySettingGet(parentTdb); indentIfNeeded(hierarchy,membership); hierarchyFree(&hierarchy); printf("%s",subtrack->shortLabel); puts("</TD>"); } // The long label column (note that it may have a metadata dropdown) printf("<TD title='select to copy'> %s", subtrack->longLabel); if (trackDbSetting(parentTdb, "wgEncode") && trackDbSetting(subtrack, "accession"))