f775312d85bfd7f6d718a0b996c5cee58b49edec tdreszer Wed Jul 7 15:54:48 2010 -0700 Initial support of subtrack vis override of composite->view vis using ifdefs diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 49022dd..b96ed5b 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -1264,21 +1264,36 @@ /* signal the browser to find the next thing on the track before it */ /* does anything else. */ { +int portWidth = insideWidth; +int portX = insideX; +#ifdef IMAGEv2_DRAG_SCROLL +// If a portal was established, then set the portal dimensions +int portalStart,chromStart; +double basesPerPixel; +if (imgBoxPortalDimensions(theImgBox,&chromStart,NULL,NULL,NULL,&portalStart,NULL,&portWidth,&basesPerPixel)) + { + portX = (int)((portalStart - chromStart) / basesPerPixel); + portX += gfxBorder; + if (withLeftLabels) + portX += tl.leftLabelWidth + gfxBorder; + portWidth = portWidth-gfxBorder-insideX; + } +#endif//def IMAGEv2_DRAG_SCROLL int arrowWidth = insideHeight; int arrowButtonWidth = arrowWidth + 2 * NEXT_ITEM_ARROW_BUFFER; -int rightButtonX = insideX + insideWidth - arrowButtonWidth - 1; +int rightButtonX = portX + portWidth - arrowButtonWidth - 1; char buttonText[256]; Color fillColor = lightGrayIndex(); labelColor = blackIndex(); hvGfxNextItemButton(hvg, rightButtonX + NEXT_ITEM_ARROW_BUFFER, y, arrowWidth, arrowWidth, labelColor, fillColor, TRUE); -hvGfxNextItemButton(hvg, insideX + NEXT_ITEM_ARROW_BUFFER, y, arrowWidth, arrowWidth, labelColor, fillColor, FALSE); +hvGfxNextItemButton(hvg, portX + NEXT_ITEM_ARROW_BUFFER, y, arrowWidth, arrowWidth, labelColor, fillColor, FALSE); safef(buttonText, ArraySize(buttonText), "hgt.prevItem=%s", track->track); -mapBoxReinvoke(hvg, insideX, y + 1, arrowButtonWidth, insideHeight, NULL, +mapBoxReinvoke(hvg, portX, y + 1, arrowButtonWidth, insideHeight, NULL, NULL, 0, 0, (revCmplDisp ? "Next item" : "Prev item"), buttonText); -mapBoxToggleVis(hvg, insideX + arrowButtonWidth, y + 1, insideWidth - (2 * arrowButtonWidth), +mapBoxToggleVis(hvg, portX + arrowButtonWidth, y + 1, portWidth - (2 * arrowButtonWidth), insideHeight, (theImgBox ? track : parentTrack)); safef(buttonText, ArraySize(buttonText), "hgt.nextItem=%s", track->track); -mapBoxReinvoke(hvg, insideX + insideWidth - arrowButtonWidth, y + 1, arrowButtonWidth, insideHeight, NULL, +mapBoxReinvoke(hvg, portX + portWidth - arrowButtonWidth, y + 1, arrowButtonWidth, insideHeight, NULL, NULL, 0, 0, (revCmplDisp ? "Prev item" : "Next item"), buttonText); } @@ -1553,6 +1568,27 @@ enum trackVisibility limitedVisFromComposite(struct track *subtrack) /* returns the subtrack visibility which may be limited by composite with multi-view dropdowns. */ { +#ifdef SUBTRACKS_HAVE_VIS +char *var = cartOptionalString(cart, subtrack->track); +if (var) + { + subtrack->visibility = hTvFromString(var); + + if (subtrack->limitedVisSet) + subtrack->limitedVis = tvMin(subtrack->visibility,subtrack->limitedVis); + else + { + if (subtrack->visibility != tvHide && slCount(subtrack->items) == 0) + subtrack->loadItems(subtrack); + + limitVisibility(subtrack); + //warnWithBackTrace("overrideComposite: %s - %s limit:%s height:%d",subtrack->track,var,hStringFromTv(subtrack->limitedVis),subtrack->height); + } + + return hTvFromString(var); + } +#endif///def SUBTRACKS_HAVE_VIS + enum trackVisibility vis = subtrack->limitedVis == tvHide ? subtrack->visibility : tvMin(subtrack->visibility,subtrack->limitedVis); @@ -1967,7 +2003,9 @@ track->limitedVisSet = TRUE; continue; } +#ifndef SUBTRACKS_HAVE_VIS if (track->limitedVis != tvHide) +#endif///ndef SUBTRACKS_HAVE_VIS { if (tdbIsComposite(track->tdb)) { @@ -1977,12 +2015,7 @@ { if (!isSubtrackVisible(subtrack)) continue; - if (!subtrack->limitedVisSet) - { - subtrack->visibility = track->visibility; - subtrack->limitedVis = track->limitedVis; - subtrack->limitedVisSet = TRUE; - } + // If the composite track has "view" based drop downs, set visibility based upon those enum trackVisibility vis = limitedVisFromComposite(subtrack); if(subtrack->visibility != vis) @@ -1998,15 +2031,32 @@ subtrack->limitedVisSet = (subtrack->limitedVis != tvHide && subtrack->visibility != subtrack->limitedVis); } } + if (!subtrack->limitedVisSet && track->limitedVisSet) + { + subtrack->visibility = track->visibility; + subtrack->limitedVis = track->limitedVis; + subtrack->limitedVisSet = track->limitedVisSet; + } + #ifdef FLAT_TRACK_LIST + #ifdef SUBTRACKS_HAVE_VIS + if (subtrack->limitedVis != tvHide) + #endif///def SUBTRACKS_HAVE_VIS + { subtrack->hasUi = track->hasUi; flatTracksAdd(&flatTracks,subtrack,cart); pixHeight += trackPlusLabelHeight(subtrack, fontHeight); + //if(sameString("wgEncodeOpenChromChipGm12878CmycPk",subtrack->track)) + // warn("subtrack:%s hasUi:%s pixHeight:%d total:%d",subtrack->track, subtrack->hasUi?"true":"false", trackPlusLabelHeight(subtrack, fontHeight),pixHeight); + } #endif//def FLAT_TRACK_LIST } } #ifdef FLAT_TRACK_LIST else + #ifdef SUBTRACKS_HAVE_VIS + if (track->limitedVis != tvHide) + #endif///def SUBTRACKS_HAVE_VIS flatTracksAdd(&flatTracks,track,cart); #endif//def FLAT_TRACK_LIST if (maxSafeHeight < (pixHeight+trackPlusLabelHeight(track,fontHeight))) @@ -2103,6 +2153,10 @@ #endif//ndef FLAT_TRACK_LIST if (track->limitedVis != tvHide) { + #ifdef SUBTRACKS_HAVE_VIS + if(track->labelColor == track->ixColor && track->ixColor == 0) + track->ixColor = hvGfxFindRgb(hvg, &track->color); + #endif//def SUBTRACKS_HAVE_VIS #ifdef FLAT_TRACK_LIST int order = flatTrack->order; #else//ifndef FLAT_TRACK_LIST @@ -4592,10 +4646,10 @@ hPrintf("<td width='20' align='left'><a href='?hgt.left1=1' title='move 10% to the left'><</a>\n"); hPrintf("<td> </td>\n"); // Without 'width=' this cell expand to table with, forcing other cells to the sides. - hPrintf("<td width='80' align='left'><a href='?hgt.in3=1' title='zoom in 10x'>>>> <<<</a>\n"); - hPrintf("<td width='60' align='left'><a href='?hgt.in2=1' title='zoom in 3x'>>> <<</a>\n"); hPrintf("<td width='40' align='left'><a href='?hgt.in1=1' title='zoom in 1.5x'>> <</a>\n"); - hPrintf("<td width='40' align='left'><a href='?hgt.inBase=1' title='zoom in to base range'><i>base</i></a>\n"); + hPrintf("<td width='60' align='left'><a href='?hgt.in2=1' title='zoom in 3x'>>> <<</a>\n"); + hPrintf("<td width='80' align='left'><a href='?hgt.in3=1' title='zoom in 10x'>>>> <<<</a>\n"); + hPrintf("<td width='40' align='left'><a href='?hgt.inBase=1' title='zoom in to base range'>><i>base</i><</a>\n"); hPrintf("<td> </td>\n"); // Without 'width=' this cell expand to table with, forcing other cells to the sides. hPrintf("<td width='40' align='right'><a href='?hgt.out1=1' title='zoom out 1.5x'>< ></a>\n"); @@ -4628,19 +4682,15 @@ * go along with this trick */ hPrintf("<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1 WIDTH=%d COLS=%d><TR>\n", tl.picWidth, 27); +#ifndef USE_NAVIGATION_LINKS hPrintf("<TD COLSPAN=6 ALIGN=left NOWRAP>"); hPrintf("move start<BR>"); -#ifdef USE_NAVIGATION_LINKS - hPrintf("<a href='?hgt.dinkLL=1' title='move window start position to the left'><</a>\n"); - hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3); - hPrintf("<a href='?hgt.dinkLR=1' title='move window start position to the right'>></a>\n"); -#else//ifndef USE_NAVIGATION_LINKS hButton("hgt.dinkLL", " < "); hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3); hButton("hgt.dinkLR", " > "); -#endif//ndef USE_NAVIGATION_LINKS hPrintf("</TD>"); hPrintf("<td width='30'> </td>\n"); +#endif//ndef USE_NAVIGATION_LINKS hPrintf("<TD COLSPAN=15 style=\"white-space:normal\">"); // allow this text to wrap hWrites("Click on a feature for details. "); hWrites(dragZooming ? "Click or drag in the base position track to zoom in. " : "Click on base position to zoom in around cursor. "); @@ -4655,19 +4705,15 @@ #endif//def IMAGEv2_DRAG_SCROLL //#if !defined(IMAGEv2_DRAG_SCROLL) && !defined(USE_NAVIGATION_LINKS) hPrintf("</TD>"); +#ifndef USE_NAVIGATION_LINKS hPrintf("<td width='30'> </td>\n"); hPrintf("<TD COLSPAN=6 ALIGN=right NOWRAP>"); hPrintf("move end<BR>"); -#ifdef USE_NAVIGATION_LINKS - hPrintf("<a href='?hgt.dinkRL=1' title='move window end position to the left'><</a>\n"); - hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3); - hPrintf("<a href='?hgt.dinkRR=1' title='move window end position to the right'>></a>\n"); -#else//ifndef USE_NAVIGATION_LINKS hButton("hgt.dinkRL", " < "); hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3); - hButton("hgt.dinkRR", " > "); + hButton("hgt.dinkRR", " ></TD> "); #endif//ndef USE_NAVIGATION_LINKS - hPrintf("</TD></TR></TABLE>\n"); + hPrintf("</TR></TABLE>\n"); // smallBreak(); /* Display bottom control panel. */