13a39c5b03f9aac48599051755f541590eeb6547
larrym
  Mon Jul 25 14:06:39 2011 -0700
fix right click track config for bigWigs not retaining vertical viewing max (redmine #4402)
diff --git src/hg/lib/wiggleCart.c src/hg/lib/wiggleCart.c
index 2459adf..5546ba9 100644
--- src/hg/lib/wiggleCart.c
+++ src/hg/lib/wiggleCart.c
@@ -178,40 +178,43 @@
 	missingAbsMax = TRUE;
     if (wordCount >= 2)
 	absMin = atof(words[1]);
     else
 	missingAbsMin = TRUE;
     }
 correctOrder(absMin, absMax);
 
 // Determine current minY,maxY.
 // Precedence:  1. cart;  2. defaultViewLimits;  3. viewLimits;
 //              4. absolute [which may need to default to #2 or #3!]
 boolean compositeLevel = isNameAtCompositeLevel(tdb, name);
 char *cartMinStr = cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, MIN_Y);
 char *cartMaxStr = cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, MAX_Y);
 double cartMin = 0.0, cartMax = 0.0;
-if (cartMinStr && cartMaxStr)
-    {
+
+if(cartMinStr)
     *retMin = atof(cartMinStr);
+if(cartMaxStr)
     *retMax = atof(cartMaxStr);
+if (cartMinStr && cartMaxStr)
     correctOrder(*retMin, *retMax);
     // If it weren't for the the allowance for missing data range values,
     // we could set retAbs* and be done here.
+if(cartMinStr)
     cartMin = *retMin;
+if(cartMaxStr)
     cartMax = *retMax;
-    }
 
 // Get trackDb defaults, and resolve missing wiggle data range if necessary.
 char *defaultViewLimits = trackDbSettingClosestToHomeOrDefault(tdb, DEFAULTVIEWLIMITS, NULL);
 if (defaultViewLimits == NULL)
     defaultViewLimits = trackDbSettingClosestToHomeOrDefault(tdb, VIEWLIMITS, NULL);
 if (defaultViewLimits != NULL)
     {
     double viewLimitMin = 0.0, viewLimitMax = 0.0;
     parseColonRange(defaultViewLimits, &viewLimitMin, &viewLimitMax);
     *retMin = viewLimitMin;
     *retMax = viewLimitMax;
     if (missingAbsMax)
 	absMax = viewLimitMax;
     if (missingAbsMin)
 	absMin = viewLimitMin;
@@ -242,35 +245,34 @@
 else
     {
     *retMin = absMin;
     *retMax = absMax;
     }
 
 if (retAbsMin)
     *retAbsMin = absMin;
 if (retAbsMax)
     *retAbsMax = absMax;
 // After the dust settles from tdb's trackDb settings, now see if composite view
 // settings from tdb's parents override that stuff anyway:
 viewLimitsCompositeOverride(tdb, name, retMin, retMax, retAbsMin, retAbsMax);
 
 // And as the final word after composite override, reset retMin and retMax if from cart:
-if (cartMinStr && cartMaxStr)
-    {
+if (cartMinStr)
     *retMin = cartMin;
+if (cartMaxStr)
     *retMax = cartMax;
-    }
 }	/*	void wigFetchMinMaxYWithCart()	*/
 
 void wigFetchMinMaxPixelsWithCart(struct cart *theCart, struct trackDb *tdb, char *name,int *Min, int *Max, int *Default)
 /*	Min, Max, Default Pixel height of track
  *	Limits may be defined in trackDb with the maxHeightPixels string,
  *	Or user requested limits are defined in the cart.
  *	And default opening display limits may optionally be defined with the
  *		maxHeightPixels declaration from trackDb
  *****************************************************************************/
 {
 boolean compositeLevel = isNameAtCompositeLevel(tdb,name);
 char *heightPer = NULL; /*	string from cart	*/
 int maxHeightPixels = atoi(DEFAULT_HEIGHT_PER);
 int defaultHeightPixels = maxHeightPixels;
 int defaultHeight;      /*      truncated by limits     */