5df780d2ecfcf6e4292710fa1a5af810066a0a04 tdreszer Wed Nov 2 16:24:50 2011 -0700 Turned on matrix squeezing. diff --git src/hg/lib/hui.c src/hg/lib/hui.c index d698f84..5f8c4c8 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -6308,31 +6308,31 @@ #define MATRIX_BOTTOM_BUTTONS_AFTER 20 static void buttonsForAll() { printf(PM_BUTTON_UC,"true", "", "", "", "", "", "plus_all", "add_sm.gif"); printf(PM_BUTTON_UC,"false","", "", "", "", "", "minus_all", "remove_sm.gif"); } static void buttonsForOne(char *name,char *class,boolean vertical) { printf(PM_BUTTON_UC, "true", ",'", class, "'", "", "", name, "add_sm.gif"); if (vertical) puts("<BR>"); printf(PM_BUTTON_UC, "false", ",'", class, "'", "", "", name, "remove_sm.gif"); } -//#define MATRIX_SQUEEZE 10 +#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 { 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) @@ -6383,31 +6383,31 @@ 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], #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++; } @@ -6448,31 +6448,31 @@ { 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; printf("<TR ALIGN=CENTER BGCOLOR=\"%s\"><TH ALIGN=CENTER colspan=2><B><EM>%s</EM></B></TH>",COLOR_BG_ALTDEFAULT, dimensionY->groupTitle); 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) @@ -6499,51 +6499,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;