r604: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 4 Mar 2001 22:30:20 +0000 (22:30 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 4 Mar 2001 22:30:20 +0000 (22:30 +0000)
msvc/ctsim/ctsim.plg
src/backgroundsupr.cpp
src/backgroundsupr.h
src/ctsim.cpp
src/docs.cpp
src/threadproj.cpp
src/threadraster.cpp
src/threadrecon.cpp
src/views.cpp

index 74fb0311be2536f65c0f0aa530ae21feb908ce89..5062e260d13aa460e88d4e5ef12a9138d9bb4c5d 100644 (file)
@@ -6,15 +6,15 @@
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPDD.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP14D5.tmp" with contents
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
-"C:\ctsim\src\threadproj.cpp"
-"C:\ctsim\src\threadraster.cpp"
-"C:\ctsim\src\threadrecon.cpp"
+"D:\ctsim\src\backgroundsupr.cpp"
+"D:\ctsim\src\threadproj.cpp"
+"D:\ctsim\src\threadrecon.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPDD.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPDE.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP14D5.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP14D6.tmp" with contents
 [
 winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib ctn_lib.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug" 
 .\Debug\backgroundmgr.obj
@@ -41,11 +41,11 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..
 \wx2.2.5\lib\zlibd.lib
 \wx2.2.5\lib\tiffd.lib
 ]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPDE.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP14D6.tmp"
 <h3>Output Window</h3>
 Compiling...
+backgroundsupr.cpp
 threadproj.cpp
-threadraster.cpp
 threadrecon.cpp
 Linking...
 
index 129b38fa642482f11ed518daf37e06ef45f7caf2..9eb806fda46d69f13f538ad5159222cdfed51f68 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundsupr.cpp,v 1.11 2001/03/04 03:14:47 kevin Exp $
+**  $Id: backgroundsupr.cpp,v 1.12 2001/03/04 22:30:19 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
 
 IMPLEMENT_DYNAMIC_CLASS(BackgroundSupervisor, wxEvtHandler)
 BEGIN_EVENT_TABLE(BackgroundSupervisor, BackgroundSupervisor)
-EVT_MENU(MSG_BACKGROUND_SUPERVISOR_CANCEL, BackgroundSupervisor::OnCancel)
-EVT_MENU(MSG_WORKER_THREAD_FAIL, BackgroundSupervisor::OnWorkerFail)
-EVT_MENU(MSG_WORKER_THREAD_DONE, BackgroundSupervisor::OnWorkerDone)
-EVT_MENU(MSG_WORKER_THREAD_UNIT_TICK, BackgroundSupervisor::OnWorkerUnitTick)
-EVT_MENU(MSG_DOCUMENT_ACK_REMOVE, BackgroundSupervisor::OnAckDocumentRemove)
 END_EVENT_TABLE()
 
-// Static function
-void 
-BackgroundSupervisor::cancelSupervisor (BackgroundSupervisor* pSupervisor)
-{
-  wxCommandEvent cancelEvent (wxEVT_COMMAND_MENU_SELECTED, MSG_BACKGROUND_SUPERVISOR_CANCEL);
-  wxPostEvent (pSupervisor, cancelEvent);
-}
 
 
 BackgroundSupervisor::BackgroundSupervisor (SupervisorThread* pMyThread, wxFrame* pParentFrame, wxDocument* pDocument, const char* const pszProcessTitle, int iTotalUnits)
-    : m_pMyThread(pMyThread), m_pParentFrame(pParentFrame), m_pDocument(pDocument), m_strProcessTitle(pszProcessTitle), 
-    m_iTotalUnits(iTotalUnits), m_iNumThreads(0), m_bDone(false), m_bFail(false), m_bCancelled(false), 
-    m_pTimer(NULL), m_bBackgroundTaskAdded(false), m_bWorkersDeleted(false),
-    wxEvtHandler()
+    : wxEvtHandler(), m_pMyThread(pMyThread), m_pParentFrame(pParentFrame), m_pDocument(pDocument), m_strProcessTitle(pszProcessTitle), 
+    m_iTotalUnits(iTotalUnits), m_iNumThreads(0), m_bDone(false), m_bFail(false), m_bCancelled(false), m_iRunning(0),
+    m_pTimer(NULL), m_bBackgroundTaskAdded(false), m_bWorkersDeleted(false)
 {
   m_iNumThreads = theApp->getNumberCPU();
   //   ++m_iNumThreads;
@@ -90,7 +77,6 @@ BackgroundSupervisor::~BackgroundSupervisor()
 
   while (m_bBackgroundTaskAdded) {
     m_pMyThread->Sleep(50);
-    ProcessPendingEvents();
   }
 
   delete m_pTimer;
@@ -110,7 +96,6 @@ BackgroundSupervisor::deleteWorkers()
 
   while (m_iRunning > 0) {
     m_pMyThread->Sleep(50);
-    ProcessPendingEvents();
   }
   m_iRunning = 0;
   m_bWorkersDeleted = true;
@@ -166,21 +151,21 @@ BackgroundSupervisor::start()
 }
 
 void
-BackgroundSupervisor::OnCancel(wxCommandEvent& event)
+BackgroundSupervisor::onCancel()
 {
   m_bCancelled = true;
   m_bDone = true;
-  deleteWorkers();
 }
 
 void
-BackgroundSupervisor::OnAckDocumentRemove(wxCommandEvent& event)
+BackgroundSupervisor::onAckDocumentRemove()
 {
   m_bBackgroundTaskAdded = false;
 }
 
+
 void
-BackgroundSupervisor::OnWorkerUnitTick (wxCommandEvent& event)
+BackgroundSupervisor::onWorkerUnitTick ()
 {
     ++m_iUnitsDone;
     
@@ -196,8 +181,11 @@ BackgroundSupervisor::OnWorkerUnitTick (wxCommandEvent& event)
 }
 
 void
-BackgroundSupervisor::OnWorkerDone (wxCommandEvent& event)
+BackgroundSupervisor::onWorkerDone (int iThread)
 {
+       wxCriticalSection critsectDone;
+       critsectDone.Enter();
+
   m_iRunning--;
   wxASSERT (m_iRunning >= 0);
 
@@ -210,22 +198,19 @@ BackgroundSupervisor::OnWorkerDone (wxCommandEvent& event)
     wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
   }
 #endif
-  if (m_iRunning <= 0 && ! m_bCancelled) {
-    deleteWorkers();
-    onDone();
-  }
+
+  critsectDone.Leave();
 }
 
 void
-BackgroundSupervisor::OnWorkerFail (wxCommandEvent& event)
+BackgroundSupervisor::onWorkerFail (int iThread, std::string strFailMessage)
 {
   m_iRunning--;
   wxCommandEvent eventLog( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
-  eventLog.SetString( event.GetString() );
+  eventLog.SetString( strFailMessage.c_str() );
   wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
 
-  wxCommandEvent dummy;
-  OnCancel(dummy);
+  onCancel();
 }
 
 #endif // HAVE_WXTHREADS
index dac77cc60106204195a22f3262e328062c2fd12a..2ee7db6662ebd652b49a5cf94f9dd2c94be5af2a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundsupr.h,v 1.7 2001/03/04 03:14:47 kevin Exp $
+**  $Id: backgroundsupr.h,v 1.8 2001/03/04 22:30:19 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
@@ -59,14 +59,14 @@ private:
   wxDocument* m_pDocument;
   const std::string m_strProcessTitle;
   
+  const unsigned int m_iTotalUnits;
+  int m_iNumThreads;
+  bool m_bDone;
   volatile bool m_bFail;
   std::string m_strFailMessage;
-  int m_iNumThreads;
+  bool m_bCancelled;
   volatile int m_iRunning;
   unsigned int m_iUnitsDone;
-  const unsigned int m_iTotalUnits;
-  bool m_bCancelled;
-  bool m_bDone;
   Timer* m_pTimer;
   bool m_bBackgroundTaskAdded;
   bool m_bWorkersDeleted;
@@ -104,24 +104,25 @@ public:
   bool start();
   virtual void onDone() {};
   
-  virtual void OnWorkerFail(wxCommandEvent& event);
-  virtual void OnWorkerUnitTick(wxCommandEvent& event);
-  virtual void OnWorkerDone(wxCommandEvent& event);
-  virtual void OnCancel(wxCommandEvent& event);
-  virtual void OnAckDocumentRemove(wxCommandEvent& event);
+  virtual void onCancel();
+  virtual void onAckDocumentRemove();
+
+  virtual void onWorkerFail(int iThread, std::string strFailMessage);
+  virtual void onWorkerUnitTick();
+  virtual void onWorkerDone(int iThread);
 
   void deleteWorkers();
+  bool workersDone() const { return m_iRunning == 0; }
   bool workersDeleted() const { return m_bWorkersDeleted; }
   bool isDone() const {return m_bDone;}
   void setDone() { m_bDone = true; }
   bool fail() const {return m_bFail;}
   const std::string& getFailMessage() const { return m_strFailMessage; }
+  bool cancelled() const {return m_bCancelled;}
 
   int getNumWorkers() const { return m_iNumThreads; }
   double getTimerEnd() { return m_pTimer->timerEnd(); }
 
-  static void cancelSupervisor (BackgroundSupervisor* pSupervisor);
-
   DECLARE_EVENT_TABLE()
 };
 
index 5bd53127267ae3bd857d87017cc6c28c38e4cf40..713065af8a92d5de18e19ae56cb263a509181b31 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.93 2001/03/04 03:14:47 kevin Exp $
+**  $Id: ctsim.cpp,v 1.94 2001/03/04 22:30:19 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
@@ -69,7 +69,7 @@
 #endif
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.93 2001/03/04 03:14:47 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.94 2001/03/04 22:30:19 kevin Exp $";
 
 struct option CTSimApp::ctsimOptions[] = 
 {
@@ -402,7 +402,7 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   file_menu->Append(wxID_OPEN, "&Open...\tCtrl-O");
   
   file_menu->AppendSeparator();
-  file_menu->Append (MAINMENU_IMPORT, "&Import...\tCtrl-I");
+  file_menu->Append (MAINMENU_IMPORT, "&Import...\tCtrl-M");
   file_menu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
   file_menu->Append(MAINMENU_FILE_EXIT, "E&xit");
   
@@ -459,7 +459,7 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('O'), wxID_OPEN);
   accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('P'), MAINMENU_FILE_CREATE_PHANTOM);
   accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('F'), MAINMENU_FILE_CREATE_FILTER);
-  accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('I'), MAINMENU_IMPORT);
+  accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('M'), MAINMENU_IMPORT);
   accelEntries[4].Set (wxACCEL_NORMAL, WXK_F1, MAINMENU_HELP_CONTENTS);
 #ifndef CTSIM_MDI
   for (i = 0; i < 10; i++)
index 96f7ee3c2ae793d842e34f91a0fce7abdb99b47f..337d6737e5086c95aafb4bdbd920fd3df5e1ce52 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: docs.cpp,v 1.30 2001/02/25 16:21:36 kevin Exp $
+**  $Id: docs.cpp,v 1.31 2001/03/04 22:30:19 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
@@ -166,8 +166,7 @@ BackgroundProcessingDocument::OnRemoveBackground (wxCommandEvent& event)
   if (! bFound) 
      sys_error (ERR_SEVERE, "Could not find background task [OnRemoveBackground]");
   
-  wxCommandEvent ackEvent (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_DOCUMENT_ACK_REMOVE);
-  wxPostEvent (pSupervisor, ackEvent);
+  pSupervisor->onAckDocumentRemove();
 }
 
 void
@@ -176,7 +175,7 @@ BackgroundProcessingDocument::cancelRunningTasks()
   m_criticalSection.Enter();
   for (BackgroundContainer::iterator i = m_vecpBackgroundSupervisors.begin(); 
         i != m_vecpBackgroundSupervisors.end(); i++)
-          BackgroundSupervisor::cancelSupervisor(*i);
+          (*i)->onCancel();
   m_criticalSection.Leave();
 
   while (m_vecpBackgroundSupervisors.size() > 0) {
index b2d169f11ef77c5964f772fb801879a6d6e0d1f1..9927d0be17411c0aa429111c6b0497ef7a379b90 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadproj.cpp,v 1.12 2001/03/04 04:30:45 kevin Exp $
+**  $Id: threadproj.cpp,v 1.13 2001/03/04 22:30:20 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
@@ -70,9 +70,8 @@ ProjectorSupervisorThread::Entry()
    m_strGeometry.c_str(), m_iNSample, m_dRotation, m_dFocalLength, m_dCenterDetectorLength, m_dViewRatio, m_dScanRatio, m_strLabel.c_str());
 
   projSupervisor.start();
-  while (! projSupervisor.isDone() && ! projSupervisor.fail()) {
+  while (! projSupervisor.workersDone() && ! projSupervisor.fail() && ! projSupervisor.cancelled()) {
     Sleep(100);
-    Yield();
   }
   if (projSupervisor.fail())
   {
@@ -84,9 +83,12 @@ ProjectorSupervisorThread::Entry()
     wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
   }
 
+  if (! projSupervisor.cancelled())
+         projSupervisor.onDone();
+  projSupervisor.deleteWorkers();
+
   while (! projSupervisor.workersDeleted()) {
     Sleep(50);
-    projSupervisor.ProcessPendingEvents();
   }
 
   return reinterpret_cast<wxThread::ExitCode>(0);
@@ -220,12 +222,12 @@ ProjectorWorker::Entry ()
 {
   const Phantom& rPhantom = m_pPhantomView->GetDocument()->getPhantom();
   bool bFail = m_pScanner->fail();
-  wxString failMsg;
+  std::string failMsg;
   if (bFail) {
       failMsg = "Unable to make Projector: ";
       failMsg += m_pScanner->failMessage().c_str();  
       wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
-      event.SetString( failMsg );
+      event.SetString( failMsg.c_str() );
       wxPostEvent( theApp->getMainFrame(), event );
   }
   else
@@ -245,19 +247,14 @@ ProjectorWorker::Entry ()
         break;
       }
       m_pScanner->collectProjections (*m_pProjections, rPhantom, iUnit + m_iStartUnit, 1, iUnit, Trace::TRACE_NONE);
-      wxPostEvent (m_pSupervisor, eventProgress);
+      m_pSupervisor->onWorkerUnitTick();
     }
   }
 
   if (bFail) {
-    wxCommandEvent eventFail (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_FAIL);
-    eventFail.SetInt (m_iThread); // Send back thread# that has finished
-    eventFail.SetString (failMsg);
-    wxPostEvent (m_pSupervisor, eventFail);
+    m_pSupervisor->onWorkerFail (m_iThread, failMsg);
   } else {
-    wxCommandEvent eventDone (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_DONE);
-    eventDone.SetInt (m_iThread); // Send back thread# that has finished
-    wxPostEvent (m_pSupervisor, eventDone);
+    m_pSupervisor->onWorkerDone (m_iThread);
   }
 
   while (! TestDestroy())
index 9853117a3755abaf40efc92ca3000b0e7bf43f9f..3b90791c4b2275bfd6c4910b103fdb5f97c540c6 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadraster.cpp,v 1.7 2001/03/04 04:30:45 kevin Exp $
+**  $Id: threadraster.cpp,v 1.8 2001/03/04 22:30:20 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
@@ -65,27 +65,31 @@ RasterizerSupervisorThread::RasterizerSupervisorThread (PhantomFileView* pProjVi
 wxThread::ExitCode
 RasterizerSupervisorThread::Entry()
 {
-  RasterizerSupervisor rasterSupervisor (this, m_pPhantomView, m_iNX, m_iNY, m_iNSample, m_dViewRatio, m_strLabel.c_str());
+  RasterizerSupervisor* pRasterSupervisor = new RasterizerSupervisor (this, m_pPhantomView, m_iNX, m_iNY, m_iNSample, m_dViewRatio, m_strLabel.c_str());
 
-  rasterSupervisor.start();
-  while (! rasterSupervisor.isDone() && ! rasterSupervisor.fail()) {
+  pRasterSupervisor->start();
+
+  while (! pRasterSupervisor->workersDone() && ! pRasterSupervisor->fail() && ! pRasterSupervisor->cancelled()) {
     Sleep(100);
-    Yield();
   }
-  if (rasterSupervisor.fail())
+
+  if (pRasterSupervisor->fail())
   {
     wxString msg ("Error starting Rasterizer supervisor: ");
-    msg += rasterSupervisor.getFailMessage().c_str();
+    msg += pRasterSupervisor->getFailMessage().c_str();
     msg += "\n";
     wxCommandEvent eventLog (wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
     eventLog.SetString( msg );
     wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
   }
 
-  while (! rasterSupervisor.workersDeleted()) {
+  if (! pRasterSupervisor->cancelled())
+    pRasterSupervisor->onDone();
+  pRasterSupervisor->deleteWorkers();
+  while (! pRasterSupervisor->workersDeleted()) {
     Sleep(50);
-    rasterSupervisor.ProcessPendingEvents();
   }
+  delete pRasterSupervisor;
 
   return reinterpret_cast<wxThread::ExitCode>(0);
 }
@@ -112,9 +116,6 @@ RasterizerSupervisor::RasterizerSupervisor (SupervisorThread* pThread, PhantomFi
   for (int iThread = 0; iThread < getNumWorkers(); iThread++) {
     m_vecpChildImageFiles[iThread] = new ImageFile;
   }
-
-
-
 }
 
 RasterizerSupervisor::~RasterizerSupervisor()
@@ -210,13 +211,12 @@ RasterizerWorker::Entry ()
 #endif
       break;
     }
-    rPhantom.convertToImagefile (*m_pImageFile, m_iNX, m_dViewRatio, m_iNSample, Trace::TRACE_NONE, 
-      iUnit + m_iStartUnit, 1, iUnit);
-    wxPostEvent (m_pSupervisor, eventProgress);
+    rPhantom.convertToImagefile (*m_pImageFile, m_iNX, m_dViewRatio, m_iNSample, Trace::TRACE_NONE, iUnit + m_iStartUnit, 1, iUnit);
+
+       m_pSupervisor->onWorkerUnitTick();
   }
-  wxCommandEvent eventDone (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_DONE);
-  eventDone.SetInt (m_iThread); // Send back thread# that has finished
-  wxPostEvent (m_pSupervisor, eventDone);
+
+  m_pSupervisor->onWorkerDone (m_iThread);
 
   while (! TestDestroy())
     Sleep(100);
index 4ece6ed3e0f03b784ce34315976c16c2b1c62122..0ec059bbcb2293be950c8731d8b29878deafe068 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.cpp,v 1.19 2001/03/04 04:30:45 kevin Exp $
+**  $Id: threadrecon.cpp,v 1.20 2001/03/04 22:30:20 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
@@ -70,9 +70,8 @@ ReconstructorSupervisorThread::Entry()
    m_strInterpName.c_str(), m_iInterpParam, m_strBackprojectName.c_str(), m_strLabel.c_str());
 
   reconSupervisor.start();
-  while (! reconSupervisor.isDone() && ! reconSupervisor.fail()) {
+  while (! reconSupervisor.workersDone() && ! reconSupervisor.fail() && ! reconSupervisor.cancelled()) {
     Sleep(100);
-    Yield();
   }
   if (reconSupervisor.fail())
   {
@@ -83,10 +82,12 @@ ReconstructorSupervisorThread::Entry()
     eventLog.SetString( msg );
     wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
   }
+  if (! reconSupervisor.cancelled())
+         reconSupervisor.onDone();
+  reconSupervisor.deleteWorkers();
 
   while (! reconSupervisor.workersDeleted()) {
     Sleep(50);
-    reconSupervisor.ProcessPendingEvents();
   }
 
   return reinterpret_cast<wxThread::ExitCode>(0);
@@ -216,12 +217,12 @@ ReconstructorWorker::Entry ()
     m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE);
 
   bool bFail = pReconstructor->fail();
-  wxString failMsg;
+  std::string failMsg;
   if (bFail) {
       failMsg = "Unable to make reconstructor: ";
       failMsg += pReconstructor->failMessage().c_str();  
       wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
-      event.SetString( failMsg );
+      event.SetString( failMsg.c_str() );
       wxPostEvent( theApp->getMainFrame(), event );
   }
   else
@@ -241,21 +242,16 @@ ReconstructorWorker::Entry ()
         break;
       }
       pReconstructor->reconstructView (iUnit + m_iStartUnit, 1);
-      m_pSupervisor->AddPendingEvent (eventProgress);
+      m_pSupervisor->onWorkerUnitTick();
     }
     pReconstructor->postProcessing();
   }
   delete pReconstructor;
 
   if (bFail) {
-    wxCommandEvent eventFail (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_FAIL);
-    eventFail.SetInt (m_iThread); // Send back thread# that has finished
-    eventFail.SetString (failMsg);
-    wxPostEvent (m_pSupervisor, eventFail);
+       m_pSupervisor->onWorkerFail (m_iThread, failMsg);
   } else {
-    wxCommandEvent eventDone (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_DONE);
-    eventDone.SetInt (m_iThread); // Send back thread# that has finished
-    wxPostEvent (m_pSupervisor, eventDone);
+       m_pSupervisor->onWorkerDone (m_iThread);
   }
 
   while (! TestDestroy())
index 5a802c459aecb011e94b9c8fb33a1043f16c8ce9..13774796c6d2206876a141250ae99c566dbb8ac6 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.125 2001/03/02 21:11:50 kevin Exp $
+**  $Id: views.cpp,v 1.126 2001/03/04 22:30:20 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
@@ -841,7 +841,7 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Preview");
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -2119,7 +2119,7 @@ PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -2572,7 +2572,7 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -2904,7 +2904,7 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -3159,7 +3159,7 @@ TextFileView::CreateChildFrame (wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");