3f7e545d773a6d91bdfb66799ebdd8de22283bbf tdreszer Mon Nov 15 09:06:59 2010 -0800 Fixed part of redmine 1071.35 where subtrack not selected is made visible. Also half of fix where selecting both composite and subtrack simultaneously will do composite cleanup but not subtrack shaping. That is, composite vis will override selected subtrack vis. diff --git src/hg/lib/cart.c src/hg/lib/cart.c index 49218e3..441b055 100644 --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@ -2235,59 +2235,49 @@ countVisChanged++; if (visOrig == tvHide && tdbIsSuperTrackChild(parent)) cartTdbOverrideSuperTracks(cart,parent,FALSE); // deal with superTrack vis! cleanup } // Now set all subtracks that inherit vis back to visOrig for(subtrack = parent->subtracks;subtrack != NULL;subtrack = subtrack->next) { int fourState = subtrackFourStateChecked(subtrack,cart); if (!fourStateChecked(fourState)) cartRemove(cart,subtrack->track); // Remove subtrack level vis if it isn't even checked just in case else // subtrack is checked (should include subtrack level vis) { if (!hashFindVal(subVisHash, subtrack->track)) // if the subtrack doesn't have individual vis AND... { - if (reshapeFully || visMax == tvHide) + if (reshapeFully || visOrig == tvHide) { subtrackFourStateCheckedSet(subtrack, cart,FALSE,fourStateEnabled(fourState)); // uncheck cartRemove(cart,subtrack->track); // Remove it if it exists, just in case countUnchecked++; } else if (visOrig != tvHide) { if (tdbIsMultiTrack(parent)) cartRemove(cart,subtrack->track); // MultiTrack vis is ALWAYS inherited else cartSetString(cart,subtrack->track,hStringFromTv(visOrig)); countVisChanged++; } } else if (tdbIsMultiTrack(parent)) cartRemove(cart,subtrack->track); // MultiTrack vis is ALWAYS inherited vis and non-selected should not have vis } } - - // OUCH! This cannot be until all the views are dealt with! - //if (tdbIsCompositeView(parent)) - // { - // visOrig = tdbVisLimitedByAncestry(cart, parent->parent, FALSE); - // cartSetString(cart,parent->parent->track,"full"); // Now set composite to full. - // if (visOrig == tvHide && tdbIsSuperTrackChild(parent->parent)) - // cartTdbOverrideSuperTracks(cart,parent->parent,FALSE); // deal with superTrack vis! cleanup - // } - } else if (tdbIsMultiTrack(parent)) { // MultiTrack vis is ALWAYS inherited vis so remove any subtrack specific vis struct hashCookie brownie = hashFirst(subVisHash); struct hashEl* cartVar = NULL; while ((cartVar = hashNext(&brownie)) != NULL) { if (!endsWith(cartVar->name,"_sel")) cartRemove(cart,cartVar->name); } } if (countUnchecked + countVisChanged) WARN("%s visOrig:%s visMax:%s unchecked:%d Vis changed:%d",parent->track,hStringFromTv(visOrig),hStringFromTv(visMax),countUnchecked,countVisChanged); @@ -2382,52 +2372,63 @@ #endif///ndef COMPOSITE_VIS_SHAPING_PLAN_B WARN("reshape: %s",reshapeFully?"Fully":"Incrementally"); // Now shape views and composite to match subtrack specific visibility int count = 0; if (hasViews) { for(tdbView = tdbContainer->subtracks;tdbView != NULL; tdbView = tdbView->next ) { char *view = NULL; if (tdbIsView(tdbView,&view) ) count += cartTdbParentShapeVis(cart,tdbView,view,subVisHash,reshapeFully); } if (count > 0) { + // At least on view was shaped, so all views will get explicit vis. This means composite must be set to full enum trackVisibility visOrig = tdbVisLimitedByAncestry(cart, tdbContainer, FALSE); cartSetString(cart,tdbContainer->track,"full"); // Now set composite to full. if (visOrig == tvHide && tdbIsSuperTrackChild(tdbContainer)) cartTdbOverrideSuperTracks(cart,tdbContainer,FALSE); // deal with superTrack vis! cleanup } } else // If no views then composite is not set to fuul but to max of subtracks count = cartTdbParentShapeVis(cart,tdbContainer,NULL,subVisHash,reshapeFully); hashFree(&subVisHash); + +// If reshaped, be sure to set flag to stop composite cleanup +#define RESHAPED_COMPOSITE "reshaped" +if (count > 0) + tdbExtrasAddOrUpdate(tdbContainer,RESHAPED_COMPOSITE,(void *)(long)TRUE); // Exists for the life of the cgi only + return TRUE; #endif/// defined(COMPOSITE_VIS_SHAPING_PLAN_A) || defined(COMPOSITE_VIS_SHAPING_PLAN_B) } boolean cartTdbTreeCleanupOverrides(struct trackDb *tdb,struct cart *newCart,struct hash *oldVars) /* When container or composite/view settings changes, remove subtrack specific settings Returns TRUE if any cart vars are removed */ { boolean anythingChanged = cartTdbOverrideSuperTracks(newCart,tdb,TRUE); if (!tdbIsContainer(tdb)) return anythingChanged; +// If composite has been reshaped then don't clean it up +if ((boolean)(long)tdbExtrasGetOrDefault(tdb,RESHAPED_COMPOSITE,(void *)(long)FALSE)) + return anythingChanged; + // vis is a special additive case! composite or view level changes then remove subtrack vis boolean containerVisChanged = cartValueHasChanged(newCart,oldVars,tdb->track,TRUE,FALSE); if (containerVisChanged) { // If just created and if vis is the same as tdb default then vis has not changed char *cartVis = cartOptionalString(newCart,tdb->track); char *oldValue = hashFindVal(oldVars,tdb->track); if (cartVis && oldValue == NULL && hTvFromString(cartVis) == tdb->visibility) containerVisChanged = FALSE; } struct trackDb *tdbView = NULL; struct slPair *oneName = NULL; char *suffix = NULL; int clensed = 0;