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("
");
hPrintf("move start "); -#ifdef USE_NAVIGATION_LINKS - hPrintf("<\n"); - hTextVar("dinkL", cartUsualString(cart, "dinkL", "2.0"), 3); - hPrintf(">\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(" | ");
hPrintf("\n"); +#endif//ndef USE_NAVIGATION_LINKS hPrintf(" | "); // 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(" | "); +#ifndef USE_NAVIGATION_LINKS hPrintf("\n"); hPrintf(" | ");
hPrintf("move end "); -#ifdef USE_NAVIGATION_LINKS - hPrintf("<\n"); - hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3); - hPrintf(">\n"); -#else//ifndef USE_NAVIGATION_LINKS hButton("hgt.dinkRL", " < "); hTextVar("dinkR", cartUsualString(cart, "dinkR", "2.0"), 3); - hButton("hgt.dinkRR", " > "); + hButton("hgt.dinkRR", " > | ");
#endif//ndef USE_NAVIGATION_LINKS
- hPrintf("