From: Kevin M. Rosenberg Date: Fri, 9 Mar 2001 21:31:51 +0000 (+0000) Subject: r624: no message X-Git-Tag: debian-4.5.3-3~393 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=841cd96a9faa03494c7841877a7f008c019fed9e r624: no message --- diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 6337e71..267fcbb 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,13 +6,13 @@ --------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1681.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.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"ctsim.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"D:\ctsim\src\backgroundmgr.cpp" +/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\backgroundmgr.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1681.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1682.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP46.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 @@ -39,7 +39,7 @@ 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\RSP1682.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP46.tmp"

Output Window

Compiling... backgroundmgr.cpp diff --git a/src/backgroundmgr.cpp b/src/backgroundmgr.cpp index ad92028..6d4a50c 100644 --- a/src/backgroundmgr.cpp +++ b/src/backgroundmgr.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundmgr.cpp,v 1.14 2001/03/09 18:50:46 kevin Exp $ +** $Id: backgroundmgr.cpp,v 1.15 2001/03/09 21:31:51 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 @@ -40,6 +40,7 @@ #ifdef HAVE_WXTHREADS +int BackgroundManager::s_iNextButtonID = 0; IMPLEMENT_DYNAMIC_CLASS(BackgroundManager, wxMiniFrame) BEGIN_EVENT_TABLE(BackgroundManager, wxMiniFrame) @@ -47,7 +48,7 @@ EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_ADD, BackgroundManager: EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_REMOVE, BackgroundManager::OnRemoveTask) EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_UNIT_TICK, BackgroundManager::OnUnitTick) EVT_CLOSE(BackgroundManager::OnCloseWindow) -EVT_COMMAND_RANGE(0, 1000, wxEVT_COMMAND_BUTTON_CLICKED, BackgroundManager::OnCancelButton) +EVT_COMMAND_RANGE(0, 30000, wxEVT_COMMAND_BUTTON_CLICKED, BackgroundManager::OnCancelButton) END_EVENT_TABLE() @@ -63,7 +64,6 @@ BackgroundManager::BackgroundManager () m_sizeBorder.Set (4, 4); m_sizeCellSpacing.Set (3, 3); m_sizeButton.Set (70, 20); - m_sizeButton.Set (0, 0); m_sizeCell.Set (m_sizeGauge.x + m_sizeLabel.x + m_sizeCellSpacing.x + m_sizeButton.x, 25); @@ -139,12 +139,14 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) wxPoint posButton (m_sizeBorder.x + m_sizeGauge.x + m_sizeLabel.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y); wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, posGauge, m_sizeGauge); wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, pszTaskName, posLabel, m_sizeLabel); - wxButton* pButton = NULL; // new wxButton (m_pCanvas, reinterpret_cast(pSupervisor), _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT); + wxButton* pButton = new wxButton (m_pCanvas, s_iNextButtonID, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT); - BackgroundManagerTask* pTask = new BackgroundManagerTask (pSupervisor, pszTaskName, iFirstUnusedPos, pGauge, pLabel, pButton); + BackgroundManagerTask* pTask = new BackgroundManagerTask (pSupervisor, pszTaskName, + iFirstUnusedPos, pGauge, pLabel, pButton, s_iNextButtonID); m_vecpTasks.push_back (pTask); m_iNumTasks++; + s_iNextButtonID++; resizeWindow(); if (m_iNumTasks == 1) { @@ -168,19 +170,21 @@ BackgroundManager::OnRemoveTask (wxCommandEvent& event) bool bFound = false; for (TaskContainer::iterator iTask = m_vecpTasks.begin(); iTask != m_vecpTasks.end(); iTask++) { if ((*iTask)->supervisor() == pSupervisor) { - delete (*iTask)->gauge(); - delete (*iTask)->label(); - delete (*iTask)->button(); + delete (*iTask)->gauge(); + delete (*iTask)->label(); + delete (*iTask)->button(); delete *iTask; m_vecpTasks.erase (iTask); m_iNumTasks--; - bFound = true; + bFound = true; break; } } - if (! bFound) + if (! bFound) { sys_error (ERR_SEVERE, "Unable to find supervisor [BackgroundManager::OnRemoveTask]"); - + return; + } + pSupervisor->ackRemoveBackgroundManager(); resizeWindow(); if (m_iNumTasks <= 0) Show(false); @@ -189,6 +193,13 @@ BackgroundManager::OnRemoveTask (wxCommandEvent& event) void BackgroundManager::OnCancelButton (wxCommandEvent& event) { + BackgroundManagerTask* pTask = lookupTask (event.GetId()); + if (! pTask) { + sys_error (ERR_SEVERE, "Unable to lookup task for button"); + return; + } + + pTask->supervisor()->onCancel(); } BackgroundManagerTask* @@ -207,6 +218,22 @@ BackgroundManager::lookupTask (BackgroundSupervisor* pSupervisor) return pTask; } +BackgroundManagerTask* +BackgroundManager::lookupTask (int iButtonID) +{ + BackgroundManagerTask* pTask = NULL; + + wxCriticalSectionLocker locker (m_criticalSection); + for (TaskContainer::iterator iTask = m_vecpTasks.begin(); iTask != m_vecpTasks.end(); iTask++) { + if ((*iTask)->buttonID() == iButtonID) { + pTask = *iTask; + break; + } + } + + return pTask; +} + void BackgroundManager::resizeWindow() { diff --git a/src/backgroundmgr.h b/src/backgroundmgr.h index 8aa1859..1c126c3 100644 --- a/src/backgroundmgr.h +++ b/src/backgroundmgr.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundmgr.h,v 1.10 2001/03/09 18:50:46 kevin Exp $ +** $Id: backgroundmgr.h,v 1.11 2001/03/09 21:31:51 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,6 +65,9 @@ private: void resizeWindow(); BackgroundManagerTask* lookupTask (BackgroundSupervisor* pSupervisor); + BackgroundManagerTask* lookupTask (int iButtonID); + + static int s_iNextButtonID; wxSize m_sizeGauge; wxSize m_sizeLabel; @@ -72,7 +75,7 @@ private: wxSize m_sizeBorder; wxSize m_sizeCellSpacing; wxSize m_sizeButton; - + public: BackgroundManager (); ~BackgroundManager(); @@ -90,26 +93,29 @@ public: class BackgroundSupervisor; class BackgroundManagerTask { private: - const BackgroundSupervisor* m_pSupervisor; + BackgroundSupervisor* m_pSupervisor; const std::string m_strName; const int m_iPosition; wxGauge* m_pGauge; wxStaticText* m_pLabel; wxButton* m_pButton; + const int m_iButtonID; public: BackgroundManagerTask (BackgroundSupervisor* pSupervisor, const char* const pszName, int iPos, - wxGauge* pGauge, wxStaticText* pLabel, wxButton* pButton) - : m_pSupervisor(pSupervisor), m_strName(pszName), m_iPosition(iPos), m_pGauge(pGauge), m_pLabel(pLabel), m_pButton(pButton) + wxGauge* pGauge, wxStaticText* pLabel, wxButton* pButton, int iButtonID) + : m_pSupervisor(pSupervisor), m_strName(pszName), m_iPosition(iPos), m_pGauge(pGauge), + m_pLabel(pLabel), m_pButton(pButton), m_iButtonID(iButtonID) {} int position() const {return m_iPosition;} const std::string& name() const {return m_strName;} - const BackgroundSupervisor* supervisor() const {return m_pSupervisor;} + BackgroundSupervisor* supervisor() {return m_pSupervisor;} wxGauge* gauge() {return m_pGauge;} wxStaticText* label() {return m_pLabel;} wxButton* button() {return m_pButton;} + int buttonID() const {return m_iButtonID;} }; diff --git a/src/backgroundsupr.cpp b/src/backgroundsupr.cpp index 18dde62..13c1e32 100644 --- a/src/backgroundsupr.cpp +++ b/src/backgroundsupr.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundsupr.cpp,v 1.17 2001/03/09 02:40:17 kevin Exp $ +** $Id: backgroundsupr.cpp,v 1.18 2001/03/09 21:31:51 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 @@ -57,7 +57,7 @@ END_EVENT_TABLE() BackgroundSupervisor::BackgroundSupervisor (SupervisorThread* pMyThread, wxFrame* pParentFrame, BackgroundProcessingDocument* pDocument, const char* const pszProcessTitle, int iTotalUnits) : 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_bWorkersDeleted(false) + m_pTimer(NULL), m_bWorkersDeleted(false), m_bBackgroundManagerAdded(false) { m_iNumThreads = theApp->getNumberCPU(); // ++m_iNumThreads; @@ -70,12 +70,6 @@ BackgroundSupervisor::BackgroundSupervisor (SupervisorThread* pMyThread, wxFrame BackgroundSupervisor::~BackgroundSupervisor() { -#ifdef USE_BKGMGR - wxCommandEvent doneEvent (wxEVT_COMMAND_MENU_SELECTED, MSG_BACKGROUND_SUPERVISOR_REMOVE); - doneEvent.SetClientData (this); - wxPostEvent (theApp->getBackgroundManager(), doneEvent); -#endif - m_pDocument->removeBackgroundSupervisor (this); delete m_pTimer; @@ -92,12 +86,24 @@ BackgroundSupervisor::deleteWorkers() if (m_vecpThreads[i]) m_vecpThreads[i]->Delete(); // send Destroy message to workers - while (m_iRunning > 0) +#ifdef USE_BKGMGR + wxCommandEvent doneEvent (wxEVT_COMMAND_MENU_SELECTED, MSG_BACKGROUND_SUPERVISOR_REMOVE); + doneEvent.SetClientData (this); + wxPostEvent (theApp->getBackgroundManager(), doneEvent); +#endif + + while (m_iRunning > 0 || m_bBackgroundManagerAdded) m_pMyThread->Sleep(50); m_bWorkersDeleted = true; } +void +BackgroundSupervisor::ackRemoveBackgroundManager() +{ + m_bBackgroundManagerAdded = false; +} + bool BackgroundSupervisor::start() { @@ -140,7 +146,8 @@ BackgroundSupervisor::start() #endif m_pDocument->addBackgroundSupervisor (this); - + m_bBackgroundManagerAdded = true; + m_iRunning = m_iNumThreads; m_iUnitsDone = 0; diff --git a/src/backgroundsupr.h b/src/backgroundsupr.h index 87ffbf7..d4daa3e 100644 --- a/src/backgroundsupr.h +++ b/src/backgroundsupr.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundsupr.h,v 1.10 2001/03/09 02:40:17 kevin Exp $ +** $Id: backgroundsupr.h,v 1.11 2001/03/09 21:31:51 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 @@ -53,7 +53,7 @@ class BackgroundProcessingDocument; class BackgroundSupervisor : public wxEvtHandler { private: DECLARE_DYNAMIC_CLASS(BackgroundSupervisor) - + SupervisorThread* m_pMyThread; wxFrame* m_pParentFrame; BackgroundProcessingDocument* m_pDocument; @@ -69,6 +69,7 @@ private: volatile unsigned int m_iUnitsDone; Timer* m_pTimer; volatile bool m_bWorkersDeleted; + volatile bool m_bBackgroundManagerAdded; typedef std::vector ThreadContainer; ThreadContainer m_vecpThreads; @@ -109,6 +110,7 @@ public: virtual void onWorkerDone(int iThread); void deleteWorkers(); + void ackRemoveBackgroundManager(); bool workersDone() const { return m_iRunning == 0; } bool workersDeleted() const { return m_bWorkersDeleted; } bool isDone() const {return m_bDone;}