r598: no message
[ctsim.git] / src / threadproj.cpp
index c4fa9aeabdbad87ae5b86a1c03bc09b4f90abd7c..64216562ab82c04d1c5ec401ee30471db3067313 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadproj.cpp,v 1.6 2001/03/01 07:30:49 kevin Exp $
+**  $Id: threadproj.cpp,v 1.7 2001/03/02 21:11: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
 #include "wx/wx.h"
 #endif
 
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
 #include "ct.h"
 #include "ctsim.h"
 #include "docs.h"
@@ -39,9 +43,8 @@
 #include "backgroundmgr.h"
 #include "backgroundsupr.h"
 
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
+#ifdef HAVE_WXTHREADS
+
 
 
 
@@ -150,16 +153,15 @@ ProjectorSupervisor::onDone()
   wxCriticalSection doneSection;
   wxCriticalSectionLocker critsect (doneSection);
 
+  Projections* pProjections = getProjections();
+
+  wxMutexGuiEnter();
   ProjectionFileDocument* pProjDoc = theApp->newProjectionDoc();
   if (! pProjDoc) {
     sys_error (ERR_SEVERE, "Unable to create projection file");
     return;
-  }
-    
-  Projections* pProjections = getProjections();
+  }  
   pProjDoc->setProjections (pProjections);
-  if (theApp->getAskDeleteNewDocs())
-    pProjDoc->Modify (true);
   pProjDoc->UpdateAllViews (NULL);
   if (ProjectionFileView* projView = pProjDoc->getView()) {
     projView->OnUpdate (projView, NULL);
@@ -167,6 +169,10 @@ ProjectorSupervisor::onDone()
     projView->getFrame()->Show(true);
   }
   *theApp->getLog() << m_pszLabel << "\n";
+  wxMutexGuiLeave();
+
+  if (theApp->getAskDeleteNewDocs())
+    pProjDoc->Modify (true);
   pProjections->setRemark (m_pszLabel);
   pProjections->setCalcTime (getTimerEnd());
 
@@ -274,3 +280,5 @@ void
 ProjectorWorker::OnExit ()
 {
 }
+
+#endif // HAVE_WXTHREADS