r598: no message
[ctsim.git] / src / threadraster.cpp
index 00f89dc103c670901ba203ac60c9b97965407f1a..252d6c592e9026d3bf98d8b6a2a3dbf5d2c7ce94 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadraster.cpp,v 1.1 2001/02/27 03:59:30 kevin Exp $
+**  $Id: threadraster.cpp,v 1.2 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
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
 
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
 #include "wx/wxprec.h"
 
 #ifndef WX_PRECOMP
 #include "ctsim.h"
 #include "docs.h"
 #include "views.h"
+
+
+#ifdef HAVE_WXTHREADS
+
+
 #include "threadraster.h"
 #include "backgroundmgr.h"
 #include "backgroundsupr.h"
 
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
-
-
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -135,16 +140,15 @@ RasterizerSupervisor::onDone()
   wxCriticalSection doneSection;
   wxCriticalSectionLocker critsect (doneSection);
 
+  ImageFile* pImageFile = getImageFile();
+
+  wxMutexGuiEnter();
   ImageFileDocument* pImageDoc = theApp->newImageDoc();
   if (! pImageDoc) {
     sys_error (ERR_SEVERE, "Unable to create image file");
     return;
-  }
-    
-  ImageFile* pImageFile = getImageFile();
+  }  
   pImageDoc->setImageFile (pImageFile);
-  if (theApp->getAskDeleteNewDocs())
-    pImageDoc->Modify (true);
   pImageDoc->UpdateAllViews (NULL);
   if (ImageFileView* imageView = pImageDoc->getView()) {
     imageView->OnUpdate (imageView, NULL);
@@ -152,7 +156,10 @@ RasterizerSupervisor::onDone()
     imageView->getFrame()->Show(true);
   }
   *theApp->getLog() << m_pszLabel << "\n";
+  wxMutexGuiLeave();
   pImageFile->labelAdd (m_pszLabel, getTimerEnd());
+  if (theApp->getAskDeleteNewDocs())
+    pImageDoc->Modify (true);
 
   setDone();
 }
@@ -230,3 +237,5 @@ void
 RasterizerWorker::OnExit ()
 {
 }
+
+#endif // HAVE_WXTHREADS