r620: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 9 Mar 2001 02:40:17 +0000 (02:40 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 9 Mar 2001 02:40:17 +0000 (02:40 +0000)
msvc/ctsimtext/ctsimtext.dsp
src/backgroundmgr.cpp
src/backgroundmgr.h
src/backgroundsupr.cpp
src/backgroundsupr.h
src/threadraster.cpp

index f220e5119d86ef68a3fe65413d07d570daa4c815..cf6f9f723af69c12bbc7b0adcfa0cf5df18b90ae 100644 (file)
@@ -50,7 +50,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.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 /nologo /subsystem:console /machine:I386
-# ADD LINK32 wx.lib libctsim.lib zlib.lib comctl32.lib wsock32.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 tiff.lib jpeg.lib png.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Release\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Release\RFFTW2st.lib xpm.lib /nologo /subsystem:console /machine:I386 /libpath:"\wx2.2.5\lib" /libpath:"..\libctsim\Release"
+# ADD LINK32 wx.lib libctsim.lib zlib.lib wsock32.lib tiff.lib jpeg.lib png.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Release\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Release\RFFTW2st.lib xpm.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 ctn_lib.lib /nologo /subsystem:console /machine:I386 /libpath:"..\libctsim\Release" /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Release"
 
 !ELSEIF  "$(CFG)" == "ctsimtext - Win32 Debug"
 
@@ -74,7 +74,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 comctl32.lib winmm.lib rpcrt4.lib ws2_32.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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pngd.lib zlibd.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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"\wx2.2.5\lib"
+# ADD LINK32 winmm.lib rpcrt4.lib ws2_32.lib pngd.lib zlibd.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 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 ctn_lib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug"
 # SUBTRACT LINK32 /verbose /incremental:no /nodefaultlib
 
 !ENDIF 
index 2d7714570bb5515d6db2f7092c49b8e09453e86c..b9ae21216bc6f188bc1f1bf54a0cdb8d43d6f1f2 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.cpp,v 1.12 2001/03/05 20:29:23 kevin Exp $
+**  $Id: backgroundmgr.cpp,v 1.13 2001/03/09 02:40:17 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
@@ -51,8 +51,9 @@ EVT_CLOSE(BackgroundManager::OnCloseWindow)
 EVT_COMMAND_RANGE(0, 1000, wxEVT_COMMAND_BUTTON_CLICKED, BackgroundManager::OnCancelButton)
 END_EVENT_TABLE()
 
+
 BackgroundManager::BackgroundManager ()
-  : wxMiniFrame (theApp->getMainFrame(), -1, _T("Background Tasks"), wxPoint(0,0), wxSize(210, 50)) //, wxTHICK_FRAME)
+  : wxMiniFrame (theApp->getMainFrame(), -1, _T("Background Tasks"), wxPoint(0,0), wxSize(210, 50))
 {
   m_iNumTasks = 0;
   m_pCanvas = new BackgroundManagerCanvas (this);
@@ -108,13 +109,12 @@ BackgroundManager::OnAddTask (wxCommandEvent& event)
   int iNumTasks = m_vecpBackgroundTasks.size();
   std::vector<bool> vecPositionUsed (iNumTasks);
   int i;
-  for (i = 0; i < iNumTasks; i++)
-    vecPositionUsed[i] = false;
-
   for (i = 0; i < iNumTasks; i++) {
     int iPosUsed = m_vecpPositions[i];
     if (iPosUsed < iNumTasks)
       vecPositionUsed[iPosUsed] = true;
+    else
+      vecPositionUsed[i] = false;
   }
 
   int iFirstUnusedPos = iNumTasks;  // default is just past current number of tasks
@@ -129,11 +129,12 @@ BackgroundManager::OnAddTask (wxCommandEvent& event)
   wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, posGauge, m_sizeGauge);
   wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, pszTaskName, posLabel, m_sizeLabel);
   //  wxPoint posButton (m_sizeBorder.x + m_sizeGauge.x + m_sizeLabel.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
-//  wxButton* pCancelButton = new wxButton (m_pCanvas, iFirstUnusedPos, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT);
+  //  wxButton* pCancelButton = new wxButton (m_pCanvas, iFirstUnusedPos, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT);
+  std::string* pstrTaskName = new std::string (pszTaskName);
 
   m_vecpBackgroundTasks.push_back (pTask);
   m_vecpGauges.push_back (pGauge);
-  m_vecpNames.push_back (new std::string (pszTaskName));
+  m_vecpNames.push_back (pstrTaskName);
   m_vecpPositions.push_back (iFirstUnusedPos);
   m_vecpLabels.push_back (pLabel);
   //m_vecpCancelButtons.push_back (pCancelButton);
@@ -164,16 +165,16 @@ BackgroundManager::OnRemoveTask (wxCommandEvent& event)
   //ButtonContainer::iterator iCancelButton = m_vecpCancelButtons.begin();
   for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
     if (*iTask == pTask) {
-      delete *iName;
-      delete *iGauge;
-      delete *iLabel;
-      //delete *iCancelButton;
       m_vecpBackgroundTasks.erase (iTask);
       m_vecpGauges.erase (iGauge);
       m_vecpNames.erase (iName);
       m_vecpPositions.erase (iPosition);
       m_vecpLabels.erase (iLabel);
       //m_vecpCancelButtons.erase (iCancelButton);
+      delete *iName;
+      delete *iGauge;
+      delete *iLabel;
+      //delete *iCancelButton;
       m_iNumTasks--;
       break;
     }
@@ -238,14 +239,5 @@ BackgroundManagerCanvas::BackgroundManagerCanvas (BackgroundManager* pMgr)
 {
 }
 
-#if 0
-void
-BackgroundManagerCanvas::OnPaint (wxPaintEvent& event)
-{
-  wxPaintDC dc (this);
-//  dc.DrawLine (0, 0, 30, 30);
-//  dc.DrawLine (30,0, 0, 30);
-}
-#endif
 
 #endif // HAVE_WXTHREADS
index a900f72941b1476b3582115f873e4718de68dcf6..76a848fa72781e0871424026053ce4a819564d21 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.h,v 1.8 2001/03/05 20:29:23 kevin Exp $
+**  $Id: backgroundmgr.h,v 1.9 2001/03/09 02:40:17 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
@@ -109,9 +109,7 @@ private:
 
 public:
   BackgroundManagerCanvas (BackgroundManager* pBkgdMgr = NULL);
-#if 0
-  void OnPaint (wxPaintEvent& event);
-#endif
+
   DECLARE_EVENT_TABLE()
 };
 
index 3ed8d99c678b4afc10f45f32641c2f3d7dc95e7e..18dde621d4dc40c94643e3f33681d88a67d2ddf4 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundsupr.cpp,v 1.16 2001/03/05 20:47:10 kevin Exp $
+**  $Id: backgroundsupr.cpp,v 1.17 2001/03/09 02:40:17 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
@@ -89,14 +89,12 @@ BackgroundSupervisor::deleteWorkers()
     return;
 
   for (int i = 0; i < m_iNumThreads; i++) 
-    if (m_vecpThreads[i]) {
-      m_vecpThreads[i]->Delete(); // sends Destroy message to workers
-  }
+    if (m_vecpThreads[i]) 
+      m_vecpThreads[i]->Delete(); // send Destroy message to workers
 
-  while (m_iRunning > 0) {
+  while (m_iRunning > 0) 
     m_pMyThread->Sleep(50);
-  }
-  m_iRunning = 0;
+  
   m_bWorkersDeleted = true;
 }
 
@@ -180,7 +178,6 @@ BackgroundSupervisor::onWorkerDone (int iThread)
        critsectDone.Enter();
 
   m_iRunning--;
-  wxASSERT (m_iRunning >= 0);
 
 #ifdef DEBUG
   if (theApp->getVerboseLogging()) {
index ada1550f8c4e6ca85d314c75907ca2de55b4815a..87ffbf79711530b7320aba19c305afcdfebd3617 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundsupr.h,v 1.9 2001/03/05 17:26:46 kevin Exp $
+**  $Id: backgroundsupr.h,v 1.10 2001/03/09 02:40:17 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
@@ -46,8 +46,7 @@ public:
 };
 
 
-// Pure virtual class for BackgroundSupervisor that can communication
-// with BackgroundManager via messages
+// Pure virtual class for BackgroundSupervisor that can communication with BackgroundManager via messages
 class BackgroundWorkerThread;
 class BackgroundProcessingDocument;
 
@@ -62,20 +61,19 @@ private:
   
   const unsigned int m_iTotalUnits;
   int m_iNumThreads;
-  bool m_bDone;
+  volatile bool m_bDone;
   volatile bool m_bFail;
   std::string m_strFailMessage;
-  bool m_bCancelled;
+  volatile bool m_bCancelled;
   volatile int m_iRunning;
-  unsigned int m_iUnitsDone;
+  volatile unsigned int m_iUnitsDone;
   Timer* m_pTimer;
-  bool m_bWorkersDeleted;
+  volatile bool m_bWorkersDeleted;
 
   typedef std::vector<BackgroundWorkerThread*> ThreadContainer;
   ThreadContainer m_vecpThreads;
   wxCriticalSection m_critsectThreads;
 
-
 public:
   enum {
     MSG_BACKGROUND_SUPERVISOR_ADD = 7500, // sends to BackgroundManager and Document
index b45875dbe71e1afb0c38ca3ebc4f9df5be316bb8..fd03a65e906d8b04367e4ce2f34186a821a8f2ca 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadraster.cpp,v 1.12 2001/03/07 21:18:50 kevin Exp $
+**  $Id: threadraster.cpp,v 1.13 2001/03/09 02:40:17 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
@@ -208,8 +208,7 @@ RasterizerWorker::Entry ()
       break;
     }
     rPhantom.convertToImagefile (*m_pImageFile, m_iNX, m_dViewRatio, m_iNSample, Trace::TRACE_NONE, iUnit + m_iStartUnit, 1, iUnit);
-
-       m_pSupervisor->onWorkerUnitTick();
+         m_pSupervisor->onWorkerUnitTick();
   }
 
   m_pSupervisor->onWorkerDone (m_iThread);