r521: no message
[ctsim.git] / src / views.cpp
index ce66ec1eac16c8e9bdba27e70a98209e4171b107..2743605f22dc2be82f6d1349a21062766f7b4de2 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.102 2001/02/11 04:56:38 kevin Exp $
+**  $Id: views.cpp,v 1.103 2001/02/11 21:57:08 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -398,7 +398,8 @@ ImageFileView::OnCompare (wxCommandEvent& event)
           << " and " << pCompareDoc->GetFirstView()->GetFrame()->GetTitle().c_str() << ": "
           << os.str().c_str();
         pDifferenceImage->labelAdd (os.str().c_str());
-        pDifferenceDoc->Modify (true);
+        if (theApp->getAskDeleteNewDocs())
+          pDifferenceDoc->Modify (true);
         pDifferenceDoc->UpdateAllViews (this);
         pDifferenceDoc->getView()->OnUpdate (this, NULL);
         pDifferenceDoc->getView()->getFrame()->Show(true);
@@ -414,7 +415,8 @@ ImageFileView::OnInvertValues (wxCommandEvent& event)
   ImageFile& rIF = GetDocument()->getImageFile();
   rIF.invertPixelValues (rIF);
   rIF.labelAdd ("Invert Pixel Values");
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+          GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -424,7 +426,8 @@ ImageFileView::OnSquare (wxCommandEvent& event)
   ImageFile& rIF = GetDocument()->getImageFile();
   rIF.square (rIF);
   rIF.labelAdd ("Square Pixel Values");
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -434,7 +437,8 @@ ImageFileView::OnSquareRoot (wxCommandEvent& event)
   ImageFile& rIF = GetDocument()->getImageFile();
   rIF.sqrt (rIF);
   rIF.labelAdd ("Square-root Pixel Values");
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -444,7 +448,8 @@ ImageFileView::OnLog (wxCommandEvent& event)
   ImageFile& rIF = GetDocument()->getImageFile();
   rIF.log (rIF);
   rIF.labelAdd ("Logrithm base-e Pixel Values");
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -454,7 +459,8 @@ ImageFileView::OnExp (wxCommandEvent& event)
   ImageFile& rIF = GetDocument()->getImageFile();
   rIF.exp (rIF);
   rIF.labelAdd ("Exponent base-e Pixel Values");
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -490,7 +496,8 @@ ImageFileView::OnAdd (wxCommandEvent& event)
       newImage.labelsCopy (rRHSIF, s.c_str());
       newImage.labelAdd (os.str().c_str());
       *theApp->getLog() << os.str().c_str() << "\n";
-      pNewDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
       pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
@@ -530,7 +537,8 @@ ImageFileView::OnSubtract (wxCommandEvent& event)
       newImage.labelsCopy (rRHSIF, s.c_str());
       newImage.labelAdd (os.str().c_str());
       *theApp->getLog() << os.str().c_str() << "\n";
-      pNewDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
       pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
@@ -570,7 +578,8 @@ ImageFileView::OnMultiply (wxCommandEvent& event)
       newImage.labelsCopy (rRHSIF, s.c_str());
       newImage.labelAdd (os.str().c_str());
       *theApp->getLog() << os.str().c_str() << "\n";
-      pNewDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
       pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
@@ -610,7 +619,8 @@ ImageFileView::OnDivide (wxCommandEvent& event)
       newImage.labelsCopy (rRHSIF, s.c_str());
       newImage.labelAdd (os.str().c_str());
       *theApp->getLog() << os.str().c_str() << "\n";
-      pNewDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
       pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
@@ -628,7 +638,8 @@ ImageFileView::OnFFT (wxCommandEvent& event)
   rIF.labelAdd ("FFT Image");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -640,7 +651,8 @@ ImageFileView::OnIFFT (wxCommandEvent& event)
   rIF.labelAdd ("IFFT Image");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -652,7 +664,8 @@ ImageFileView::OnFFTRows (wxCommandEvent& event)
   rIF.labelAdd ("FFT Rows");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -664,7 +677,8 @@ ImageFileView::OnIFFTRows (wxCommandEvent& event)
   rIF.labelAdd ("IFFT Rows");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -676,7 +690,8 @@ ImageFileView::OnFFTCols (wxCommandEvent& event)
   rIF.labelAdd ("FFT Columns");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -688,7 +703,8 @@ ImageFileView::OnIFFTCols (wxCommandEvent& event)
   rIF.labelAdd ("IFFT Columns");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 #endif
@@ -702,7 +718,8 @@ ImageFileView::OnFourier (wxCommandEvent& event)
   rIF.labelAdd ("Fourier Image");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -715,7 +732,8 @@ ImageFileView::OnInverseFourier (wxCommandEvent& event)
   rIF.labelAdd ("Inverse Fourier Image");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -727,7 +745,8 @@ ImageFileView::OnShuffleNaturalToFourierOrder (wxCommandEvent& event)
   rIF.labelAdd ("Shuffle Natural To Fourier Order");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -739,7 +758,8 @@ ImageFileView::OnShuffleFourierToNaturalOrder (wxCommandEvent& event)
   rIF.labelAdd ("Shuffle Fourier To Natural Order");
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
-  GetDocument()->Modify (true);
+  if (theApp->getAskDeleteNewDocs())
+     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
 }
 
@@ -752,7 +772,8 @@ ImageFileView::OnMagnitude (wxCommandEvent& event)
     rIF.labelAdd ("Magnitude of complex-image");
     m_bMinSpecified = false;
     m_bMaxSpecified = false;
-    GetDocument()->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       GetDocument()->Modify (true);
     GetDocument()->UpdateAllViews (this);
   }
 }
@@ -766,7 +787,8 @@ ImageFileView::OnPhase (wxCommandEvent& event)
     rIF.labelAdd ("Phase of complex-image");
     m_bMinSpecified = false;
     m_bMaxSpecified = false;
-    GetDocument()->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       GetDocument()->Modify (true);
     GetDocument()->UpdateAllViews (this);
   }
 }
@@ -1110,7 +1132,8 @@ ImageFileView::OnScaleSize (wxCommandEvent& event)
     rScaledIF.labelAdd (os.str().c_str());
     rIF.scaleImage (rScaledIF);
     *theApp->getLog() << os.str().c_str() << "\n";
-    pScaledDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       pScaledDoc->Modify (true);
     pScaledDoc->UpdateAllViews (this);
     pScaledDoc->getView()->OnUpdate (this, NULL);
     pScaledDoc->getView()->getFrame()->Show(true);
@@ -1213,7 +1236,8 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
       delete pYImag;
       delete pYMag;
     }
-    pPlotDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       pPlotDoc->Modify (true);
     pPlotDoc->UpdateAllViews ();
     pPlotDoc->getView()->OnUpdate (this, NULL);
     pPlotDoc->getView()->getFrame()->Show(true);
@@ -1298,7 +1322,8 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
       delete pYImag;
       delete pYMag;
     }
-    pPlotDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       pPlotDoc->Modify (true);
     pPlotDoc->UpdateAllViews ();
     pPlotDoc->getView()->OnUpdate (this, NULL);
     pPlotDoc->getView()->getFrame()->Show(true);
@@ -1392,7 +1417,8 @@ ImageFileView::OnPlotFFTRow (wxCommandEvent& event)
     delete pYMag;
     delete [] pcIn;
     
-    pPlotDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       pPlotDoc->Modify (true);
     pPlotDoc->UpdateAllViews ();
     pPlotDoc->getView()->OnUpdate (this, NULL);
     pPlotDoc->getView()->getFrame()->Show(true);
@@ -1492,7 +1518,8 @@ ImageFileView::OnPlotFFTCol (wxCommandEvent& event)
     delete pdTemp;
     delete [] pcIn;
     
-    pPlotDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+       pPlotDoc->Modify (true);
     pPlotDoc->UpdateAllViews ();
     pPlotDoc->getView()->OnUpdate (this, NULL);
     pPlotDoc->getView()->getFrame()->Show(true);
@@ -1582,7 +1609,8 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
       delete pX;
       delete pY1;
       delete pY2;
-      pPlotDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pPlotDoc->Modify (true);
       pPlotDoc->UpdateAllViews ();
       pPlotDoc->getView()->OnUpdate (this, NULL);
       pPlotDoc->getView()->getFrame()->Show(true);
@@ -1673,7 +1701,8 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
       delete pX;
       delete pY1;
       delete pY2;
-      pPlotDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pPlotDoc->Modify (true);
       pPlotDoc->UpdateAllViews ();
       pPlotDoc->getView()->OnUpdate (this, NULL);
       pPlotDoc->getView()->getFrame()->Show(true);
@@ -1739,7 +1768,8 @@ ImageFileView::OnPlotHistogram (wxCommandEvent& event)
       rPlotFile.addDescription (os.str().c_str());
       delete pX;
       delete pY;
-      pPlotDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pPlotDoc->Modify (true);
       pPlotDoc->UpdateAllViews ();
       pPlotDoc->getView()->OnUpdate (this, NULL);
       pPlotDoc->getView()->getFrame()->Show(true);
@@ -1937,7 +1967,8 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
         GetDocumentManager()->ActivateView (projView, true, false);
       }
       ::wxYield();
-      pProjectionDoc-> Modify(true);
+      if (theApp->getAskDeleteNewDocs())
+        pProjectionDoc-> Modify(true);
       pProjectionDoc->UpdateAllViews (this);
     }
   }
@@ -1984,7 +2015,8 @@ PhantomFileView::OnRasterize (wxCommandEvent& event)
       }
       pRasterDoc->setImageFile (pImageFile);
 
-      pRasterDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pRasterDoc->Modify (true);
       pRasterDoc->UpdateAllViews (this);
       pRasterDoc->getView()->getFrame()->Show(true);
       std::ostringstream os;
@@ -2277,7 +2309,8 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event)
       << strInterpolation.c_str();
     *theApp->getLog() << os.str().c_str() << "\n";
     rIF.labelAdd (os.str().c_str());
-    pPolarDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+      pPolarDoc->Modify (true);
     pPolarDoc->UpdateAllViews ();
     pPolarDoc->getView()->OnUpdate (this, NULL);
     pPolarDoc->getView()->getFrame()->Show(true);
@@ -2311,7 +2344,8 @@ ProjectionFileView::OnConvertFFTPolar (wxCommandEvent& event)
       << strInterpolation.c_str() << ", zeropad=" << m_iDefaultPolarZeropad;
     *theApp->getLog() << os.str().c_str() << "\n";
     rIF.labelAdd (os.str().c_str());
-    pPolarDoc->Modify (true);
+    if (theApp->getAskDeleteNewDocs())
+      pPolarDoc->Modify (true);
     pPolarDoc->UpdateAllViews ();
     pPolarDoc->getView()->OnUpdate (this, NULL);
     pPolarDoc->getView()->getFrame()->Show(true);
@@ -2394,7 +2428,8 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
         return;
       }
       pReconDoc->setImageFile (pImageFile);
-      pReconDoc->Modify (true);
+      if (theApp->getAskDeleteNewDocs())
+        pReconDoc->Modify (true);
       pReconDoc->UpdateAllViews (this);
       if (ImageFileView* rasterView = pReconDoc->getView()) {
         rasterView->OnUpdate (rasterView, NULL);