92980f52e3dd7fce1340d85aca94dfb0bafba43f tdreszer Wed Nov 23 11:04:40 2011 -0800 Merging in update to MATRIX_SQUEEZE that was left on branch. diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 231738a..66f3595 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -6155,30 +6155,34 @@ puts("<BR>"); printf(BUTTON_MAT, "false", ",'", class, "'", '-'); #else///ifndef BUTTONS_BY_CSS printf(PM_BUTTON_UC, "true", ",'", class, "'", "", "", name, "add_sm.gif"); if (vertical) puts("<BR>"); printf(PM_BUTTON_UC, "false", ",'", class, "'", "", "", name, "remove_sm.gif"); #endif///def BUTTONS_BY_CSS } #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') + return 0; + boolean labelHeight = 0; members_t *dimensionX = membersForAll->members[dimX]; members_t *dimensionY = membersForAll->members[dimY]; if(dimensionX && dimensionY) { if(dimensionX->count>MATRIX_SQUEEZE) { int ixX,cntX=0; for (ixX = 0; ixX < dimensionX->count; ixX++) { if(dimensionX->subtrackList && dimensionX->subtrackList[ixX] && dimensionX->subtrackList[ixX]->val) { cntX++; char *ptr = dimensionX->titles[ixX]; int ttlLen = strlen(ptr); @@ -6194,69 +6198,73 @@ labelHeight = 0; } } return labelHeight; } #else///ifndef MATRIX_SQUEEZE #define matrixSqueeze(membersForAll) 0 #endif///ndef MATRIX_SQUEEZE static void matrixXheadingsRow1(char *db,struct trackDb *parentTdb,int squeeze, membersForAll_t* membersForAll,boolean top) /* prints the top row of a matrix: 'All' buttons; X titles; buttons 'All' */ { members_t *dimensionX = membersForAll->members[dimX]; members_t *dimensionY = membersForAll->members[dimY]; +#ifdef MATRIX_SQUEEZE +printf("<TR ALIGN=CENTER valign=%s>\n",top?"BOTTOM":"TOP"); +#else///ifndef MATRIX_SQUEEZE printf("<TR ALIGN=CENTER BGCOLOR='%s' valign=%s>\n",COLOR_BG_ALTDEFAULT,top?"BOTTOM":"TOP"); +#endif///ndef MATRIX_SQUEEZE if(dimensionX && dimensionY) { printf("<TH ALIGN=LEFT valign=%s>",top?"TOP":"BOTTOM"); buttonsForAll(); puts(" All</TH>"); } // If there is an X dimension, then titles go across the top if(dimensionX) { int ixX,cntX=0; if(dimensionY) { #ifdef MATRIX_SQUEEZE if(squeeze>0) printf("<TH align=RIGHT style='height:%dpx;'><div class='%s'><B><EM>%s</EM></B></div></TH>", squeeze, (top?"up45":"dn45"), dimensionX->groupTitle); else #endif///def MATRIX_SQUEEZE printf("<TH align=RIGHT><B><EM>%s</EM></B></TH>", dimensionX->groupTitle); } else printf("<TH ALIGN=RIGHT valign=%s> <B><EM>%s</EM></B></TH>",(top?"TOP":"BOTTOM"), dimensionX->groupTitle); for (ixX = 0; ixX < dimensionX->count; ixX++) { if(dimensionX->subtrackList && dimensionX->subtrackList[ixX] && dimensionX->subtrackList[ixX]->val) { #ifdef MATRIX_SQUEEZE if(dimensionY && squeeze>0) - printf("<TH nowrap='' class='%s'><div class='%s'>%s</div></TH>",dimensionX->tags[ixX],(top?"up45":"dn45"), + printf("<TH nowrap='' class='%s'><div class='%s'>%s</div></TH>\n",dimensionX->tags[ixX],(top?"up45":"dn45"), compositeLabelWithVocabLink(db,parentTdb,dimensionX->subtrackList[ixX]->val,dimensionX->groupTag,dimensionX->titles[ixX])); else #endif///def MATRIX_SQUEEZE { char *label =replaceChars(dimensionX->titles[ixX]," (","<BR>("); #ifdef MATRIX_SQUEEZE - printf("<TH WIDTH='60' class='%s'> %s </TH>",dimensionX->tags[ixX], + printf("<TH WIDTH='60' class='matCell %s all'> %s </TH>",dimensionX->tags[ixX], #else///ifndef MATRIX_SQUEEZE printf("<TH WIDTH='60'> %s </TH>", #endif///ndef MATRIX_SQUEEZE compositeLabelWithVocabLink(db,parentTdb,dimensionX->subtrackList[ixX]->val,dimensionX->groupTag,label)); freeMem(label); } cntX++; } } // If dimension is big enough, then add Y buttons to right as well if(cntX>MATRIX_RIGHT_BUTTONS_AFTER) { if(dimensionY) { #ifdef MATRIX_SQUEEZE @@ -6283,38 +6291,42 @@ puts("</TH>"); } puts("</TR>\n"); } static void matrixXheadingsRow2(struct trackDb *parentTdb, int squeeze, membersForAll_t* membersForAll) /* prints the 2nd row of a matrix: Y title; X buttons; title Y */ { members_t *dimensionX = membersForAll->members[dimX]; members_t *dimensionY = membersForAll->members[dimY]; // If there are both X and Y dimensions, then there is a row of buttons in X if(dimensionX && dimensionY) { int ixX,cntX=0; + #ifdef MATRIX_SQUEEZE + printf("<TR ALIGN=CENTER><TH ALIGN=CENTER colspan=2><B><EM>%s</EM></B></TH>",dimensionY->groupTitle); + #else///ifndef MATRIX_SQUEEZE printf("<TR ALIGN=CENTER BGCOLOR=\"%s\"><TH ALIGN=CENTER colspan=2><B><EM>%s</EM></B></TH>",COLOR_BG_ALTDEFAULT, dimensionY->groupTitle); + #endif///ndef MATRIX_SQUEEZE for (ixX = 0; ixX < dimensionX->count; ixX++) // Special row of +- +- +- { if(dimensionX->subtrackList && dimensionX->subtrackList[ixX] && dimensionX->subtrackList[ixX]->val) { char objName[SMALLBUF]; #ifdef MATRIX_SQUEEZE - puts("<TD nowrap>"); + printf("<TD nowrap class='matCell %s all'>\n",dimensionX->tags[ixX]); #else///ifndef MATRIX_SQUEEZE puts("<TD>"); #endif///ndef MATRIX_SQUEEZE safef(objName, sizeof(objName), "plus_%s_all", dimensionX->tags[ixX]); boolean vertical = FALSE; #ifdef MATRIX_SQUEEZE vertical = (squeeze>0); #endif///def MATRIX_SQUEEZE buttonsForOne( objName, dimensionX->tags[ixX], vertical ); puts("</TD>"); cntX++; } } // If dimension is big enough, then add Y buttons to right as well if(cntX>MATRIX_RIGHT_BUTTONS_AFTER) @@ -6341,51 +6353,51 @@ static void matrixYheadings(char *db,struct trackDb *parentTdb, membersForAll_t* membersForAll,int ixY,boolean left) /* prints the column of Y labels and buttons */ { members_t *dimensionX = membersForAll->members[dimX]; members_t *dimensionY = membersForAll->members[dimY]; struct trackDb *childTdb = NULL; if(dimensionY && dimensionY->subtrackList && dimensionY->subtrackList[ixY] && dimensionY->subtrackList[ixY]->val) childTdb = dimensionY->subtrackList[ixY]->val; if(dimensionX && dimensionY && childTdb != NULL) // Both X and Y, then column of buttons { char objName[SMALLBUF]; #ifdef MATRIX_SQUEEZE - printf("<TH class='%s' ALIGN=%s nowrap colspan=2>",dimensionY->tags[ixY],left?"RIGHT":"LEFT"); + printf("<TH class='matCell all %s' ALIGN=%s nowrap colspan=2>",dimensionY->tags[ixY],left?"RIGHT":"LEFT"); #else///ifndef MATRIX_SQUEEZE printf("<TH ALIGN=%s nowrap colspan=2>",left?"RIGHT":"LEFT"); #endif///ndef MATRIX_SQUEEZE if(left) printf("%s ",compositeLabelWithVocabLink(db,parentTdb,childTdb,dimensionY->groupTag,dimensionY->titles[ixY])); safef(objName, sizeof(objName), "plus_all_%s", dimensionY->tags[ixY]); buttonsForOne( objName, dimensionY->tags[ixY], FALSE ); if(!left) printf(" %s",compositeLabelWithVocabLink(db,parentTdb,childTdb,dimensionY->groupTag,dimensionY->titles[ixY])); puts("</TH>"); } else if (dimensionX) { printf("<TH ALIGN=%s>",left?"RIGHT":"LEFT"); buttonsForAll(); puts("</TH>"); } else if (left && dimensionY && childTdb != NULL) #ifdef MATRIX_SQUEEZE - printf("<TH class='%s' ALIGN=RIGHT nowrap>%s</TH>\n",dimensionY->tags[ixY], + printf("<TH class='matCell all %s' ALIGN=RIGHT nowrap>%s</TH>\n",dimensionY->tags[ixY], compositeLabelWithVocabLink(db,parentTdb,childTdb,dimensionY->groupTag,dimensionY->titles[ixY])); #else///ifndef MATRIX_SQUEEZE printf("<TH ALIGN=RIGHT nowrap>%s</TH>\n",compositeLabelWithVocabLink(db,parentTdb,childTdb,dimensionY->groupTag,dimensionY->titles[ixY])); #endif///ndef MATRIX_SQUEEZE } static int displayABCdimensions(char *db,struct cart *cart, struct trackDb *parentTdb, struct slRef *subtrackRefList, membersForAll_t* membersForAll) /* This will walk through all declared nonX&Y dimensions (X and Y is the 2D matrix of CBs. NOTE: ABC dims are only supported if there are X & Y both. Also expected number should be passed in */ { int count=0,ix; for(ix=dimA;ix<membersForAll->dimMax;ix++) { if(membersForAll->members[ix]==NULL) continue; @@ -6672,47 +6684,51 @@ if(!subgroupingExists(parentTdb,"view")) puts("(<A HREF=\"../goldenPath/help/multiView.html\" title='Help on subtrack selection' TARGET=_BLANK>help</A>)\n"); puts("<BR>\n"); if(membersForAll->abcCount > 0 && membersForAll->filters == FALSE) { displayABCdimensions(db,cart,parentTdb,subtrackRefList,membersForAll); } if(dimensionX == NULL && dimensionY == NULL) // Could have been just filterComposite. Must be an X or Y dimension return FALSE; #ifdef MATRIX_SQUEEZE -printf("<TABLE class='greenBox' cellspacing=0 style='background-color:%s;'>\n",COLOR_BG_ALTDEFAULT); +printf("<TABLE class='greenBox matrix' cellspacing=0 style='background-color:%s;'>\n",COLOR_BG_ALTDEFAULT); #else///ifndef MATRIX_SQUEEZE printf("<TABLE class='greenBox' style='background-color:%s;'>\n",COLOR_BG_DEFAULT); #endif///ndef MATRIX_SQUEEZE //int squeeze = matrixXheadings(db,parentTdb,membersForAll,TRUE); // right side labels could be dependent upon squeeze (void)matrixXheadings(db,parentTdb,membersForAll,TRUE); // Now the Y by X matrix int cntX=0,cntY=0; for (ixY = 0; ixY < sizeOfY; ixY++) { if(dimensionY == NULL || (dimensionY->tags[ixY])) { cntY++; assert(!dimensionY || ixY < dimensionY->count); + #ifdef MATRIX_SQUEEZE + printf("<TR ALIGN=CENTER>"); + #else///ifndef MATRIX_SQUEEZE printf("<TR ALIGN=CENTER BGCOLOR='%s'>",COLOR_BG_ALTDEFAULT); + #endif///ndef MATRIX_SQUEEZE matrixYheadings(db,parentTdb, membersForAll,ixY,TRUE); #define MAT_CB_SETUP "<INPUT TYPE=CHECKBOX NAME='%s' VALUE=on %s>" #define MAT_CB(name,js) printf(MAT_CB_SETUP,(name),(js)); for (ixX = 0; ixX < sizeOfX; ixX++) { if(dimensionX == NULL || (dimensionX->tags[ixX])) { assert(!dimensionX || ixX < dimensionX->count); if(cntY==1) // Only do this on the first good Y cntX++; if(dimensionX && ixX == dimensionX->count)