6c1f41fb7917a57861810431337b400d21714c25 galt Thu Jan 30 18:17:24 2020 -0800 Initial check-in for a new top-bar showing the selected facets and their values for easily seeing what has been selected, and de-selecting is easy by clicking there if you want to. Also added an explicit button for clearing the Restrictions, i.e. cdwFile_filter cart var filter. diff --git src/hg/lib/facetField.c src/hg/lib/facetField.c index 2b441d2..e0d3c42 100644 --- src/hg/lib/facetField.c +++ src/hg/lib/facetField.c @@ -24,30 +24,55 @@ /* Compare two facetVal so as to sort them based on useCount with most used first */ { struct facetVal *a = *((struct facetVal **)va); struct facetVal *b = *((struct facetVal **)vb); return b->useCount - a->useCount; } int facetValCmp(const void *va, const void *vb) /* Compare two facetVal alphabetically by val */ { struct facetVal *a = *((struct facetVal **)va); struct facetVal *b = *((struct facetVal **)vb); return strcasecmp(a->val, b->val); } +struct facetVal *facetsClone(struct facetVal *origList) +/* Copy the facet vals list */ +{ + +struct facetVal *newList = NULL; +struct facetVal *o; // original element +for (o = origList; o != NULL; o = o->next) + { + + struct facetVal *n; // new element + AllocVar(n); + n->val = o->val; + n->useCount = o->useCount; + n->selected = o->selected; + n->selectCount = o->selectCount; + + slAddHead(&newList, n); + } + +/* Restore reversed order and return result */ +slReverse(&newList); + +return newList; +} + static struct facetVal *facetValNew(char *val, int useCount) /* Create new facetVal structure */ { struct facetVal *facetVal; AllocVar(facetVal); facetVal->val = val; facetVal->useCount = useCount; return facetVal; } static void facetFieldAdd(struct facetField *facetField, char *tagVal, boolean selecting) /* Add information about tag to facetField */ { if (!selecting)