69e8424f77f7d2513fcf8082aea972d539665540 tdreszer Fri Nov 18 13:14:56 2011 -0800 More touches on BUTTONS_BY_CSS diff --git src/hg/lib/hui.c src/hg/lib/hui.c index f77cdc5..958e2e8 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -31,44 +31,44 @@ #include "regexHelper.h" #include "vcfUi.h" #include "vcf.h" #include "errCatch.h" #include "samAlignment.h" #include "makeItemsItem.h" #include "bedDetail.h" #include "pgSnp.h" #define SMALLBUF 128 #define MAX_SUBGROUP 9 #define ADD_BUTTON_LABEL "add" #define CLEAR_BUTTON_LABEL "clear" #define JBUFSIZE 2048 -#ifdef SUBTRACK_CFG -#define BUTTON_PM "%s" +#ifdef BUTTONS_BY_CSS +#define BUTTON_PM "%c" #define BUTTON_DEF "default" + "setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s');\" style='width:56px;font-weight:normal; font-family:default;'>default" #define DEFAULT_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_DEF,(nameOrId), (beg),(contains),(nameOrId),(beg),(contains)) -#define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"true", (beg),(contains),"+") -#define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"false",(beg),(contains),"-") -#else///ifndef SUBTRACK_CFG +#define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"true", (beg),(contains),'+') +#define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"false",(beg),(contains),'-') +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON "\"%s\"\n" #define DEF_BUTTON "\"%s\"\n" #define DEFAULT_BUTTON(nameOrId,anc,beg,contains) printf(DEF_BUTTON,(nameOrId), (beg),(contains),(nameOrId),(beg),(contains),(anc),"defaults_sm.png","default") #define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(PM_BUTTON, (nameOrId),"true", (beg),(contains),(anc),"add_sm.gif", "+") #define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(PM_BUTTON, (nameOrId),"false",(beg),(contains),(anc),"remove_sm.gif","-") -#endif///ndef SUBTRACK_CFG +#endif///ndef BUTTONS_BY_CSS struct trackDb *wgEncodeDownloadDirKeeper(char *db, struct trackDb *tdb, struct hash *trackHash) /* Look up through self and parents, looking for someone responsible for handling * where the downloads are. */ { if (!tdbIsDownloadsOnly(tdb) && !sameString(tdb->table, tdb->track) && trackHash) { tdb = hashFindVal(trackHash, tdb->table); if (tdb == NULL) errAbort("Can't find track for table %s in wgEncodeDownloadDirKeeper", tdb->table); } return trackDbTopLevelSelfOrParent(tdb); } static char *htmlStringForDownloadsLink(char *database, struct trackDb *tdb,char *name,boolean nameIsFile, @@ -6327,56 +6327,56 @@ char * cvSetting = words[ix] + strlen(words[ix]) + 1; const char * cvTerm = metadataFindValue(childTdb,cvSetting); if(cvTerm != NULL) { char *link = controlledVocabLink(words[0],(sameWord(cvSetting,"antibody")?"target":"term"),(char *)cvTerm,(char *)cvTerm,rootLabel,suffix); return link; } } } } freeMem(words[0]); freeMem(rootLabel); return cloneString(label); } -#ifdef SUBTRACK_CFG -#define BUTTON_MAT "%s" -#else///ifndef SUBTRACK_CFG +#ifdef BUTTONS_BY_CSS +#define BUTTON_MAT "%c" +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON_UC "" -#endif///def SUBTRACK_CFG +#endif///def BUTTONS_BY_CSS #define MATRIX_RIGHT_BUTTONS_AFTER 8 #define MATRIX_BOTTOM_BUTTONS_AFTER 20 static void buttonsForAll() { #ifdef SUBTRACK_CFG -printf(BUTTON_MAT,"true", "", "", "", "+"); -printf(BUTTON_MAT,"false","", "", "", "-"); +printf(BUTTON_MAT,"true", "", "", "", '+'); +printf(BUTTON_MAT,"false","", "", "", '-'); #else///ifndef SUBTRACK_CFG printf(PM_BUTTON_UC,"true", "", "", "", "", "", "plus_all", "add_sm.gif"); printf(PM_BUTTON_UC,"false","", "", "", "", "", "minus_all", "remove_sm.gif"); #endif///ndef SUBTRACK_CFG } static void buttonsForOne(char *name,char *class,boolean vertical) { #ifdef SUBTRACK_CFG -printf(BUTTON_MAT, "true", ",'", class, "'", "+"); +printf(BUTTON_MAT, "true", ",'", class, "'", '+'); if (vertical) puts("
"); -printf(BUTTON_MAT, "false", ",'", class, "'", "-"); +printf(BUTTON_MAT, "false", ",'", class, "'", '-'); #else///ifndef SUBTRACK_CFG printf(PM_BUTTON_UC, "true", ",'", class, "'", "", "", name, "add_sm.gif"); if (vertical) puts("
"); printf(PM_BUTTON_UC, "false", ",'", class, "'", "", "", name, "remove_sm.gif"); #endif///ndef SUBTRACK_CFG } #define MATRIX_SQUEEZE 10 #ifdef MATRIX_SQUEEZE static int matrixSqueeze(membersForAll_t* membersForAll) // Returns non-zero if the matrix will be squeezed. Non-zero is actually squeezedLabelHeight { char *browserVersion; if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '9') @@ -6734,39 +6734,41 @@ { webIncludeResourceFile("ui.dropdownchecklist.css"); jsIncludeFile("ui.dropdownchecklist.js",NULL); jsIncludeFile("ddcl.js",NULL); } cgiDown(0.7); printf("Filter subtracks %sby: (select multiple %sitems - %s)
\n", (membersForAll->members[dimX] != NULL || membersForAll->members[dimY] != NULL ? "further ":""), (membersForAll->dimMax == dimA?"":"categories and "),FILTERBY_HELP_LINK); printf("\n"); // Do All [+][-] buttons if(membersForAll->members[dimX] == NULL && membersForAll->members[dimY] == NULL) // No matrix { -#ifdef SUBTRACK_CFG + printf("\n"); } // Now make a filterComp box for each ABC dimension int dimIx=dimA; for(dimIx=dimA;dimIxdimMax;dimIx++) { //printf("
All:
"); +#ifdef BUTTONS_BY_CSS // TODO: Test when a real world case actually calls this. Currently no trackDb.ra cases exist - #define PM_BUTTON_FILTER_COMP "" -#else///ifndef SUBTRACK_CFG + #define BUTTON_FILTER_COMP "%c" + printf(BUTTON_FILTER_COMP,"true", '+'); + printf(BUTTON_FILTER_COMP,"false",'-'); +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON_FILTER_COMP "" -#endif///ndef SUBTRACK_CFG - printf("
All:
"); printf(PM_BUTTON_FILTER_COMP,"true", "plus_fc",'+'); printf(PM_BUTTON_FILTER_COMP,"false","minus_fc",'-'); +#endif///ndef BUTTONS_BY_CSS printf("
%s:\n",labelWithVocabLinkForMultiples(db,parentTdb,membersForAll->members[dimIx])); printf("%s:
\n",labelWithVocabLinkForMultiples(db,parentTdb,membersForAll->members[dimIx])); #ifdef FILTER_COMPOSITE_OPEN_SIZE int fullSize = membersForAll->members[dimIx]->count; #ifdef FILTER_COMPOSITE_ONLYONE if(membersForAll->members[dimIx]->fcType != fctOneOnly) #endif///def FILTER_COMPOSITE_ONLYONE @@ -7024,39 +7026,39 @@ // If any filter additional filter composites, they can be added at the end. compositeUiByFilter(db, cart, parentTdb, formName); return TRUE; } static boolean compositeUiAllButtons(char *db, struct cart *cart, struct trackDb *parentTdb, char *formName) /* UI for composite tracks: all/none buttons only (as opposed to matrix or lots of buttons */ { if (trackDbCountDescendantLeaves(parentTdb) <= 1) return FALSE; if(dimensionsExist(parentTdb)) return FALSE; -#ifdef SUBTRACK_CFG -#define BUTTON_ALL "%s" -#define BUTTON_PLUS_ALL_GLOBAL() printf(BUTTON_ALL,"true", "+") -#define BUTTON_MINUS_ALL_GLOBAL() printf(BUTTON_ALL,"false","-") -#else///ifndef SUBTRACK_CFG +#ifdef BUTTONS_BY_CSS +#define BUTTON_ALL "%c" +#define BUTTON_PLUS_ALL_GLOBAL() printf(BUTTON_ALL,"true", '+') +#define BUTTON_MINUS_ALL_GLOBAL() printf(BUTTON_ALL,"false",'-') +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON_GLOBAL "" #define BUTTON_PLUS_ALL_GLOBAL() printf(PM_BUTTON_GLOBAL,"true", "plus_all", "add_sm.gif") #define BUTTON_MINUS_ALL_GLOBAL() printf(PM_BUTTON_GLOBAL,"false","minus_all","remove_sm.gif") -#endif///ndef SUBTRACK_CFG +#endif///ndef BUTTONS_BY_CSS BUTTON_PLUS_ALL_GLOBAL(); BUTTON_MINUS_ALL_GLOBAL(); puts(" Select all subtracks
"); return TRUE; } static boolean compositeUiNoMatrix(char *db, struct cart *cart, struct trackDb *parentTdb, char *primarySubtrack, char *formName) /* UI for composite tracks: subtrack selection. This is the default UI without matrix controls. */ { int i, j, k; char *words[SMALLBUF]; char option[SMALLBUF]; int wordCnt;