8083235171a7227233b561a87d4950a3640ef232 tdreszer Thu Nov 11 09:57:45 2010 -0800 Added support for pennantIcon as requested by b0b. First use flagging hg18 to hg19 liftOver tracks. diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index e7afbb5..88c4493 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -1548,100 +1548,40 @@ { scaleBases = 2 * pow(10, numFigs); scaleBasesTextNum = 2 * pow(10, numFigs % 3); } if ((numFigs >= 3) && (numFigs < 6)) baseWord = "kb"; else if ((numFigs >= 6) && (numFigs < 9)) baseWord = "Mb"; safef(scaleText, scaleTextSize, "%d %s", scaleBasesTextNum, baseWord); return scaleBases; } enum trackVisibility limitedVisFromComposite(struct track *subtrack) /* returns the subtrack visibility which may be limited by composite with multi-view dropdowns. */ { -#ifdef SUBTRACKS_HAVE_VIS +enum trackVisibility vis = subtrack->limitedVisSet ? tvMin(subtrack->visibility,subtrack->limitedVis) : subtrack->visibility; if (tdbIsCompositeChild(subtrack->tdb)) { - if (fourStateVisible(subtrackFourStateChecked(subtrack->tdb,cart))) // Don't need all 4 states here. Visible=checked&&enabled - { - char *var = cartOptionalString(cart, subtrack->track); - if (var) - { - subtrack->visibility = hTvFromString(var); - - if (subtrack->limitedVisSet) - subtrack->limitedVis = tvMin(subtrack->visibility,subtrack->limitedVis); - else - { - //#ifdef OMIT - // Not sure this is needed at all! OMITting because of the recursive loop that wigMafs fell into on rightClick - if (subtrack->visibility != tvHide && slCount(subtrack->items) == 0) - { - // wigMaf legitimately has no items even after loadItems, as it triggers a loop to ->loadItems() ! - // Really should protect against infinite loops better than this! - if (!startsWith("wigMaf", subtrack->tdb->type) && !startsWith("maf", subtrack->tdb->type)) - { - subtrack->loadItems(subtrack); - } - } - //#endif///def OMIT - limitVisibility(subtrack); - } - return hTvFromString(var); - } - } - else - return tvHide; - } -#endif///def SUBTRACKS_HAVE_VIS - -enum trackVisibility vis = subtrack->limitedVis == tvHide ? - subtrack->visibility : - tvMin(subtrack->visibility,subtrack->limitedVis); -struct trackDb *tdb = subtrack->tdb; -if(tdbIsCompositeChild(tdb)) - { if (!subtrack->limitedVisSet) { subtrack->visibility = tdbVisLimitedByAncestors(cart, subtrack->tdb, TRUE, TRUE); limitVisibility(subtrack); return vis; } return subtrack->limitedVis; - /* - struct trackDb *parentTdb = tdbGetComposite(tdb); - assert(parentTdb != NULL); - - char *viewName = NULL; - if (subgroupFind(tdb,"view",&viewName)) - { - int len = strlen(parentTdb->track) + strlen(viewName) + 10; - - // Create the view dropdown var name. This needs to have the view name surrounded by dots - // in the middle for the javascript to work. - char ddName[len]; - safef(ddName,len,"%s.%s.vis", parentTdb->track,viewName); - char * fromParent = cartOptionalString(cart, ddName); - if(fromParent) - vis = tvMin(vis,hTvFromString(fromParent)); - else - vis = tvMin(vis,visCompositeViewDefault(parentTdb,viewName)); - subgroupFree(&viewName); - } - */ } return vis; } static int makeRulerZoomBoxes(struct hvGfx *hvg, struct cart *cart, int winStart,int winEnd, int insideWidth,int seqBaseCount,int rulerClickY,int rulerClickHeight) /* Make hit boxes that will zoom program around ruler. */ { int boxes = 30; int winWidth = winEnd - winStart; int newWinWidth = winWidth; int i, ws, we = 0, ps, pe = 0; int mid, ns, ne; double wScale = (double)winWidth/boxes; double pScale = (double)insideWidth/boxes; @@ -4290,30 +4230,31 @@ else warn("Unrecognized jsCommand %s", command); } #ifdef SUBTRACKS_HAVE_VIS void parentChildCartCleanup(struct track *trackList,struct cart *newCart,struct hash *oldVars) /* When composite/view settings changes, remove subtrack specific vis When superTrackChild is found and selected, shape superTrack to match. */ { struct track *track = trackList; for (;track != NULL; track = track->next) { boolean shapedByubtrackOverride = FALSE; boolean cleanedByContainerSettings = FALSE; + // Top-down 'cleanup' (CleanupOverrides) must be before bottom-up 'Reshaping' (MatchSubtrackVis) cleanedByContainerSettings = cartTdbTreeCleanupOverrides(track->tdb,newCart,oldVars); if (tdbIsContainer(track->tdb)) { shapedByubtrackOverride = cartTdbTreeMatchSubtrackVis(cart,track->tdb); if(shapedByubtrackOverride) track->visibility = tdbVisLimitedByAncestors(cart,track->tdb,TRUE,TRUE); } if ((shapedByubtrackOverride || cleanedByContainerSettings) && tdbIsSuperTrackChild(track->tdb)) // Either cleanup may require supertrack intervention { // Need to update track visibility // Unfortunately, since supertracks are not in trackList, this occurs on superChildren, // So now we need to find the supertrack and take changed cart values of its children struct slRef *childRef; for(childRef = track->tdb->parent->children;childRef != NULL;childRef = childRef->next) @@ -4851,33 +4792,35 @@ * determine if they have visible member tracks */ groupTrackListAddSuper(cart, group); /* Display track controls */ for (tr = group->trackList; tr != NULL; tr = tr->next) { struct track *track = tr->track; if (tdbIsSuperTrackChild(track->tdb)) /* don't display supertrack members */ continue; myControlGridStartCell(cg, isOpen, group->name); if (track->hasUi) { char *url = trackUrl(track->track, chromName); char *longLabel = replaceChars(track->longLabel, "\"", """); - if(trackDbSetting(track->tdb, "wgEncode") != NULL) - hPrintf("\n"); + hPrintPennantIcon(track->tdb); + + // Print an icon before the title when one is defined hPrintf("", url, longLabel); + freeMem(url); freeMem(longLabel); } hPrintf(" %s", track->shortLabel); if (tdbIsSuper(track->tdb)) hPrintf("..."); hPrintf("
"); if (track->hasUi) hPrintf("
"); if (hTrackOnChrom(track->tdb, chromName)) { if (tdbIsSuper(track->tdb)) superTrackDropDown(cart, track->tdb, superTrackHasVisibleMembers(track->tdb));