r470: Fixed shutdown error, take 3
[ctsim.git] / src / views.cpp
index 713733b88383e3c5013972cc075e2b30acdc8f72..2e0f78ab58480ada03cb6be7484eeff75a3d4c7c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.89 2001/01/30 01:21:37 kevin Exp $
+**  $Id: views.cpp,v 1.90 2001/01/30 02:20:50 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
@@ -1008,7 +1008,7 @@ ImageFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 bool 
 ImageFileView::OnClose (bool deleteWindow)
 {
-  GetDocumentManager()->ActivateView (this, false, true);
+  //GetDocumentManager()->ActivateView (this, false, true);
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
   
@@ -1026,8 +1026,10 @@ ImageFileView::OnClose (bool deleteWindow)
   if (deleteWindow) {
     m_pFrame->Destroy();
     m_pFrame = NULL;
+    if (GetDocument() && GetDocument()->getBadFileOpen())
+      ::wxYield();  // wxWindows bug workaround
   }
-
+  
   return true;
 }
 
@@ -2070,7 +2072,7 @@ PhantomFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 bool 
 PhantomFileView::OnClose (bool deleteWindow)
 {
-  GetDocumentManager()->ActivateView (this, false, true);
+  //GetDocumentManager()->ActivateView (this, false, true);
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
   
@@ -2088,8 +2090,9 @@ PhantomFileView::OnClose (bool deleteWindow)
   if (deleteWindow) {
     m_pFrame->Destroy();
     m_pFrame = NULL;
+    if (GetDocument() && GetDocument()->getBadFileOpen())
+      ::wxYield();  // wxWindows bug workaround
   }
-//  ::wxYield();
   
   return true;
 }
@@ -2547,7 +2550,7 @@ ProjectionFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)
 bool 
 ProjectionFileView::OnClose (bool deleteWindow)
 {
-  GetDocumentManager()->ActivateView (this, false, true);
+  //GetDocumentManager()->ActivateView (this, false, true);
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
   
@@ -2565,6 +2568,8 @@ ProjectionFileView::OnClose (bool deleteWindow)
   if (deleteWindow) {
     m_pFrame->Destroy();
     m_pFrame = NULL;
+    if (GetDocument() && GetDocument()->getBadFileOpen())
+      ::wxYield();  // wxWindows bug workaround
   }
 
   return true;
@@ -2875,7 +2880,7 @@ PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 bool 
 PlotFileView::OnClose (bool deleteWindow)
 {
-  GetDocumentManager()->ActivateView (this, false, true);
+  //GetDocumentManager()->ActivateView (this, false, true);
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
   
@@ -2893,7 +2898,9 @@ PlotFileView::OnClose (bool deleteWindow)
   if (deleteWindow) {
     m_pFrame->Destroy();
     m_pFrame = NULL;
-  }
+    if (GetDocument() && GetDocument()->getBadFileOpen())
+      ::wxYield();  // wxWindows bug workaround
+ }
 
   return true;
 }
@@ -2949,7 +2956,7 @@ TextFileView::OnClose (bool deleteWindow)
   // if (m_pFrame && m_pFrame->GetTitle() == "Log")
   return false;
   
-  GetDocumentManager()->ActivateView (this, false, true);
+  //GetDocumentManager()->ActivateView (this, false, true);
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
   
@@ -2959,7 +2966,8 @@ TextFileView::OnClose (bool deleteWindow)
   if (deleteWindow) {
     m_pFrame->Destroy();
     m_pFrame = NULL;
-    
+    if (GetDocument() && GetDocument()->getBadFileOpen())
+      ::wxYield();  // wxWindows bug workaround
   }
 
   return TRUE;