Index: trunk/psModules/src/objects/pmSourceVisual.c
===================================================================
--- trunk/psModules/src/objects/pmSourceVisual.c	(revision 23241)
+++ trunk/psModules/src/objects/pmSourceVisual.c	(revision 23242)
@@ -9,20 +9,22 @@
 #if (HAVE_KAPA)
 #include <kapa.h>
+#include "pmVisual.h"
 
 // functions used to visualize the analysis as it goes
 // these are invoked by the -visual options
 
-static bool isVisual = false;
 static int kapa1 = -1;
+static bool plotPSF = true;
 // static int kapa2 = -1;
 // static int kapa3 = -1;
 
+bool pmSourceVisualClose() {
+    if (kapa1 != -1)
+        KiiClose(kapa1);
+    return true;
+}
+
 bool pmSourcePlotPoints3D (int myKapa, Graphdata *graphdata, psVector *xn, psVector *yn, psVector *zn, float theta, float phi);
 
-bool pmSourceSetVisual (bool mode) {
-
-    isVisual = mode;
-    return true;
-}
 
 bool pmSourceVisualPSFModelResid (pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask) {
@@ -32,5 +34,5 @@
     Graphdata graphdata;
 
-    if (!isVisual) return true;
+    if (!pmVisualIsVisual() || !plotPSF) return true;
 
     if (kapa1 == -1) {
@@ -38,5 +40,5 @@
         if (kapa1 == -1) {
             fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-            isVisual = false;
+            pmVisualSetVisual(false);
             return false;
         }
@@ -152,9 +154,6 @@
     // pause and wait for user input:
     // continue, save (provide name), ??
-    char key[10];
-    fprintf (stdout, "[c]ontinue? ");
-    if (!fgets(key, 8, stdin)) {
-        psWarning("Unable to read option");
-    }
+    pmVisualAskUser(&plotPSF);
+
     return true;
 }
Index: trunk/psModules/src/objects/pmSourceVisual.h
===================================================================
--- trunk/psModules/src/objects/pmSourceVisual.h	(revision 23241)
+++ trunk/psModules/src/objects/pmSourceVisual.h	(revision 23242)
@@ -1,9 +1,9 @@
 /* @file  pmKapaPlots.h
- * @brief functions to make plots with the external program 'kapa' 
+ * @brief functions to make plots with the external program 'kapa'
  *
  * @author EAM, IfA
  *
- * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2008-11-08 01:52:34 $
+ * @version $Revision: 1.1.16.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2009-02-19 17:59:50 $
  * Copyright 2006 Institute for Astronomy, University of Hawaii
  */
@@ -12,8 +12,9 @@
 #define PM_SOURCE_VISUAL_H
 
+bool pmSourceVisualClose(void);
+
 /// @addtogroup Extras Miscellaneous Funtions
 /// @{
 
-bool pmSourceSetVisual (bool mode);
 bool pmSourceVisualPSFModelResid (pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask);
 
