r447: Fixed document closing when cancelling dialog during reconstruction/projectsions
[ctsim.git] / src / views.cpp
index 4e4313d8b98ec5bbf53a6ed67d38c23ffeb1ce66..be956dbfc79e536805bcd0725b9004a8f730e7b7 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.77 2001/01/27 02:01:41 kevin Exp $
+**  $Id: views.cpp,v 1.79 2001/01/27 03:39:53 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
@@ -358,7 +358,7 @@ ImageFileView::OnCompare (wxCommandEvent& event)
         
         differenceImage.setArraySize (rIF.nx(), rIF.ny());
         if (! rIF.subtractImages (rCompareIF, differenceImage)) {
-          pDifferenceDoc->DeleteAllViews();
+          pDifferenceDoc->getView()->getFrame()->Close(true);
           return;
         }
         
@@ -1808,14 +1808,12 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
       if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
         ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(getFrameForChild()));
         for (int iView = 0; iView < rProj.nView(); iView++) {
-          ::wxYield();
           ::wxYield();
           if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) {
-            pProjectionDoc->DeleteAllViews();
+          pProjectionDoc->getView()->getFrame()->Close(true);
             return;
           }
           ::wxYield();
-          ::wxYield();
           while (dialogProjections.isPaused()) {
             ::wxYield();
             ::wxUsleep(50);
@@ -1826,7 +1824,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
         for (int i = 0; i < rProj.nView(); i++) {
           theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace);
           if (! dlgProgress.Update (i+1)) {
-            pProjectionDoc->DeleteAllViews();
+            pProjectionDoc->getView()->getFrame()->Close(true);
             return;
           }
         }
@@ -1888,7 +1886,8 @@ PhantomFileView::OnRasterize (wxCommandEvent& event)
       for (unsigned int i = 0; i < imageFile.nx(); i++) {
         rPhantom.convertToImagefile (imageFile, m_iDefaultRasterNSamples, Trace::TRACE_NONE, i, 1, true);
         if (! dlgProgress.Update(i+1)) {
-          pRasterDoc->DeleteAllViews();
+          pRasterDoc->Close();
+          pRasterDoc->getView()->getFrame()->Close(true);
           return;
         }
       }
@@ -2036,7 +2035,7 @@ PhantomFileView::OnClose (bool deleteWindow)
   if (m_pCanvas) {
     m_pCanvas->Clear();
     m_pCanvas->setView(NULL);
-       m_pCanvas->Show(false);
+       m_pCanvas->Show(false);
     m_pCanvas = NULL;
   }
   wxString s(wxTheApp->GetAppName());
@@ -2274,7 +2273,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
           if (pDlgReconstruct->isCancelled() || ! pDlgReconstruct->reconstructView (iView)) {
             delete pDlgReconstruct;
             delete pReconstruct;
-            pReconDoc->DeleteAllViews();
+            pReconDoc->getView()->getFrame()->Close(true);
             return;
           }
           ::wxYield();
@@ -2291,7 +2290,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
           pReconstruct->reconstructView (i, 1);
           if (! dlgProgress.Update(i + 1)) {
             delete pReconstruct;
-            pReconDoc->DeleteAllViews();
+            pReconDoc->getView()->getFrame()->Close(true);
             return;
           }
         }