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 "
" \ "%s
\n" printf(SUBTRACK_CFG_VIS,subtrack->track,classList,subtrack->track,hStringFromTv(vis)); if (cType != cfgNone) // make a wrench { #define SUBTRACK_CFG_WRENCH "\n" printf(SUBTRACK_CFG_WRENCH,(visibleCB ? "":" disabled"),subtrack->track); } } printf(""); - // A color patch which helps distinguish subtracks in some types of composites - if (settings->colorPatch) - { - printf("    ", - 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 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(" ", subtrack->track,sortOrder->column[sIx],membership->membership[ix]); printf("%s",titleRoot); puts(""); 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("    ", + 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(" "); hierarchy_t *hierarchy = hierarchySettingGet(parentTdb); indentIfNeeded(hierarchy,membership); hierarchyFree(&hierarchy); printf("%s",subtrack->shortLabel); puts(""); } // The long label column (note that it may have a metadata dropdown) printf(" %s", subtrack->longLabel); if (trackDbSetting(parentTdb, "wgEncode") && trackDbSetting(subtrack, "accession"))