Index: trunk/psModules/src/astrom/pmAstrometryVisual.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryVisual.c	(revision 21422)
+++ trunk/psModules/src/astrom/pmAstrometryVisual.c	(revision 23242)
@@ -23,5 +23,4 @@
 
 //variables to determine when things are plotted
-static bool isVisual             = false;
 static bool plotGridMatch        = true;
 static bool plotTweak            = true;
@@ -48,10 +47,4 @@
 /* Initialization Routines  */
 
-bool pmAstromSetVisual (bool mode) {
-    isVisual = mode;
-    return true;
-}
-
-
 bool pmAstromVisualClose()
 {
@@ -68,9 +61,8 @@
 {
     // make sure we want to plot this
-    if (!plotRawStars || !isVisual) return true;
+    if (!plotRawStars || !pmVisualIsVisual()) return true;
 
     //set up plot region
     if (!pmVisualInitWindow (&kapa, "psastro:plots")){
-        isVisual = false;
         return false;
     }
@@ -222,5 +214,5 @@
 
     // pause and wait for user input:
-    pmVisualAskUser(&plotRawStars, &isVisual);
+    pmVisualAskUser(&plotRawStars);
 
     psFree (xVec);
@@ -234,9 +226,8 @@
 {
     //make sure we want to plot this
-    if (!isVisual || !plotRefStars) return true;
+    if (!pmVisualIsVisual() || !plotRefStars) return true;
 
     //set up plotting variables
     if (!pmVisualInitWindow (&kapa, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -284,5 +275,5 @@
 
     // pause and wait for user input:
-    pmVisualAskUser(&plotRefStars, &isVisual);
+    pmVisualAskUser(&plotRefStars);
 
     psFree (xVec);
@@ -301,9 +292,8 @@
 
     // make sure we want to plot this
-    if ( !isVisual || !plotLumFunc ) return true;
+    if ( !pmVisualIsVisual() || !plotLumFunc ) return true;
 
     //set up plotting variables
     if ( !pmVisualInitWindow (&kapa, "psastro:plots")){
-        isVisual = false;
         return false;
     }
@@ -377,5 +367,5 @@
 
         // pause and wait for user input:
-        pmVisualAskUser (&plotLumFunc, &isVisual);
+        pmVisualAskUser (&plotLumFunc);
     }
     return true;
@@ -391,9 +381,8 @@
 
     //make sure we want to plot this
-    if (!isVisual || !plotRemoveClumps) return true;
+    if (!pmVisualIsVisual() || !plotRemoveClumps) return true;
 
     //set up plot variables
     if ( !pmVisualInitWindow (&kapa, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -480,5 +469,5 @@
 
     //ask for user input and finish
-    pmVisualAskUser (&plotRemoveClumps, &isVisual);
+    pmVisualAskUser (&plotRemoveClumps);
     psFree (xVec);
     psFree (yVec);
@@ -496,9 +485,8 @@
 
     //make sure we want to plot this
-    if (!isVisual || !plotOneChipFit)
+    if (!pmVisualIsVisual() || !plotOneChipFit)
         return true;
 
     if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -511,5 +499,5 @@
 
     //ask for user input and finish
-    pmVisualAskUser(&plotOneChipFit, &isVisual);
+    pmVisualAskUser(&plotOneChipFit);
     return true;
 }
@@ -522,8 +510,7 @@
 {
     //make sure we want to plot this
-    if(!isVisual || !plotFixChips) return true;
+    if(!pmVisualIsVisual() || !plotFixChips) return true;
 
     if(!pmVisualInitWindow(&kapa, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -588,5 +575,5 @@
     KapaPlotVector (kapa, xNew->n, yNew->data.F32, "y");
 
-    pmVisualAskUser(&plotFixChips, &isVisual);
+    pmVisualAskUser(&plotFixChips);
     psFree(xNew);
     psFree(yNew);
@@ -606,9 +593,8 @@
 
     //make sure we want to plot this
-    if (!isVisual || !plotAstromGuessCheck) return true;
+    if (!pmVisualIsVisual() || !plotAstromGuessCheck) return true;
 
     //set up graph window
     if ( !pmVisualInitWindow (&kapa, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -686,5 +672,5 @@
     psFree(xResid);
     psFree(yResid);
-    pmVisualAskUser (&plotAstromGuessCheck, &isVisual);
+    pmVisualAskUser (&plotAstromGuessCheck);
     return true;
 }
@@ -696,8 +682,7 @@
 {
     //make sure we want to plot this
-    if (!isVisual || !plotCommonScale) return true;
+    if (!pmVisualIsVisual() || !plotCommonScale) return true;
 
     if (!pmVisualInitWindow(&kapa, "psastro:plots")){
-        isVisual = false;
         return false;
     }
@@ -736,5 +721,5 @@
     KapaSendLabel (kapa, "Old Pixel Scale of FPA Chips (Not to Scale)", KAPA_LABEL_XP);
 
-    pmVisualAskUser (&plotCommonScale, &isVisual);
+    pmVisualAskUser (&plotCommonScale);
 
     psFree(xVec);
@@ -750,8 +735,7 @@
 
     //make sure we want to plot this
-    if (!isVisual || !plotMosaicOneChip) return true;
+    if (!pmVisualIsVisual() || !plotMosaicOneChip) return true;
 
     if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -759,10 +743,10 @@
     //plot the residuals
     if (!residPlot(rawstars, refstars, match, recipe, "Single Chip Fit Residuals - Mosaic Mode")) {
-        isVisual = false;
+        pmVisualSetVisual(false);
         return false;
     }
 
     //ask for user input and finish
-    pmVisualAskUser(&plotMosaicOneChip, &isVisual);
+    pmVisualAskUser(&plotMosaicOneChip);
 
     return true;
@@ -775,5 +759,5 @@
 {
     //make sure we want to plot this
-    if (!isVisual || !plotMosaicMatches) return true;
+    if (!pmVisualIsVisual() || !plotMosaicMatches) return true;
 
     char title[60];
@@ -782,15 +766,14 @@
 
     if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
 
     if (!residPlot(rawstars, refstars, match, recipe, title)){
-        isVisual = false;
+        pmVisualSetVisual(false);
         return false;
     }
 
     //ask for user input
-    pmVisualAskUser (&plotMosaicMatches, &isVisual);
+    pmVisualAskUser (&plotMosaicMatches);
     return true;
 }
@@ -807,7 +790,6 @@
 {
     //make sure we want to plot this
-    if (!isVisual || !plotGridMatch) return true;
+    if (!pmVisualIsVisual() || !plotGridMatch) return true;
     if (!pmVisualInitWindow(&kapa, "psastro:plots")){
-        isVisual = false;
         return false;
     }
@@ -952,5 +934,5 @@
     KapaPlotVector (kapa, 2, yslice, "y");
 
-    pmVisualAskUser(&plotGridMatch, &isVisual);
+    pmVisualAskUser(&plotGridMatch);
     psFree(dXplot);
     psFree(dYplot);
@@ -966,7 +948,6 @@
 {
     //make sure we want to plot this
-    if (!isVisual || !plotTweak) return true;
+    if (!pmVisualIsVisual() || !plotTweak) return true;
     if (!pmVisualInitWindow(&kapa, "psastro:plots")) {
-        isVisual = false;
         return false;
     }
@@ -1051,5 +1032,5 @@
                    KAPA_LABEL_XP);
 
-    pmVisualAskUser(&plotTweak, &isVisual);
+    pmVisualAskUser(&plotTweak);
 
     psFree(xIndices);
@@ -1341,5 +1322,4 @@
 # else
 
-bool pmAstromSetVisual(bool mode) { return true; }
 bool pmAstromVisualClose() { return true; }
 bool pmAstromVisualPlotGridMatch (const psArray *raw, const psArray *ref, psImage *gridNP, double offsetX, double offsetY, double maxOffpix, double Scale, double Offset) { return true; }
