From bf055865d682c7ff942b36315985711a2c5e5793 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Fri, 9 Mar 2001 18:50:46 +0000 Subject: [PATCH] r623: no message --- msvc/ctsim/ctsim.plg | 61 +++----------------- src/backgroundmgr.cpp | 130 ++++++++++++++++++++---------------------- src/backgroundmgr.h | 65 ++++++++++++--------- 3 files changed, 109 insertions(+), 147 deletions(-) diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 243eeda..6337e71 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -3,61 +3,16 @@
 

Build Log

---------------------Configuration: libctsim - Win32 Debug-------------------- +--------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP25.tmp" with contents -[ -/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /I "\dicom\ctn\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "HAVE_CTN_DICOM" /D VERSION=\"3.1.0\" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\ctsim\libctsim\ctndicom.cpp" -] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP25.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP26.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1681.tmp" with contents [ -/nologo /out:"Debug\libctsim.lib" -.\Debug\array2dfile.obj -.\Debug\backprojectors.obj -.\Debug\clip.obj -.\Debug\consoleio.obj -.\Debug\ctndicom.obj -.\Debug\dlgezplot.obj -.\Debug\ezplot.obj -.\Debug\ezset.obj -.\Debug\ezsupport.obj -.\Debug\filter.obj -.\Debug\fnetorderstream.obj -.\Debug\fourier.obj -.\Debug\getopt.obj -.\Debug\getopt1.obj -.\Debug\globalvars.obj -.\Debug\hashtable.obj -.\Debug\imagefile.obj -.\Debug\interpolator.obj -.\Debug\mathfuncs.obj -.\Debug\phantom.obj -.\Debug\plotfile.obj -.\Debug\pol.obj -.\Debug\procsignal.obj -.\Debug\projections.obj -.\Debug\reconstruct.obj -.\Debug\scanner.obj -.\Debug\sgp.obj -.\Debug\strfuncs.obj -.\Debug\syserror.obj -.\Debug\trace.obj -.\Debug\transformmatrix.obj -.\Debug\xform.obj +/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" ] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP26.tmp" -

Output Window

-Compiling... -ctndicom.cpp -Creating library... -

---------------------Configuration: ctsim - Win32 Debug-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP27.tmp" with contents +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 [ 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 @@ -84,8 +39,10 @@ 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\RSP27.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1682.tmp"

Output Window

+Compiling... +backgroundmgr.cpp Linking... diff --git a/src/backgroundmgr.cpp b/src/backgroundmgr.cpp index b9ae212..ad92028 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.13 2001/03/09 02:40:17 kevin Exp $ +** $Id: backgroundmgr.cpp,v 1.14 2001/03/09 18:50:46 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 @@ -38,7 +38,6 @@ #include "backgroundsupr.h" #include "backgroundmgr.h" - #ifdef HAVE_WXTHREADS @@ -63,7 +62,7 @@ BackgroundManager::BackgroundManager () m_sizeLabel.Set (140, 20); m_sizeBorder.Set (4, 4); m_sizeCellSpacing.Set (3, 3); - //m_sizeButton.Set (70, 20); + 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); @@ -72,6 +71,10 @@ BackgroundManager::BackgroundManager () } +BackgroundManager::~BackgroundManager() +{ +} + void BackgroundManager::OnCloseWindow (wxCloseEvent& event) { @@ -85,13 +88,19 @@ void BackgroundManager::OnUnitTick (wxCommandEvent& event) { int iUnits = event.GetInt(); - BackgroundSupervisor* pTask = reinterpret_cast(event.GetClientData()); - if (pTask == NULL) { - sys_error (ERR_SEVERE, "Received NULL task [BackgroundManager::OnAddTask]"); + + BackgroundSupervisor* pSupervisor = reinterpret_cast(event.GetClientData()); + if (pSupervisor == NULL) { + sys_error (ERR_SEVERE, "Received NULL task [BackgroundManager::OnUnitTick]"); return; } - if (wxGauge* pGauge = lookupGauge (pTask)) - pGauge->SetValue (iUnits); + + BackgroundManagerTask* pTask = lookupTask (pSupervisor); + if (pTask == NULL) { + sys_error (ERR_SEVERE, "Error looking up task [BackgroundManager::OnUnitTick]"); + return; + } + pTask->gauge()->SetValue (iUnits); } void @@ -99,49 +108,47 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) { int iNumUnits = event.GetInt(); const char* const pszTaskName = event.GetString().c_str(); - BackgroundSupervisor* pTask = reinterpret_cast(event.GetClientData()); - if (pTask == NULL) { - sys_error (ERR_SEVERE, "Received NULL task [BackgroundManager::OnAddTask]"); + BackgroundSupervisor* pSupervisor = reinterpret_cast(event.GetClientData()); + if (pSupervisor == NULL) { + sys_error (ERR_SEVERE, "Received NULL supervisor [BackgroundManager::OnAddTask]"); return; } wxCriticalSectionLocker locker (m_criticalSection); - int iNumTasks = m_vecpBackgroundTasks.size(); - std::vector vecPositionUsed (iNumTasks); - int i; - for (i = 0; i < iNumTasks; i++) { - int iPosUsed = m_vecpPositions[i]; + + int iNumTasks = m_vecpTasks.size(); + std::vector vecPositionUsed (iNumTasks); //vector of used table positions + for (int iP = 0; iP < iNumTasks; iP++) + vecPositionUsed[iP] = false; + + for (TaskContainer::iterator iT = m_vecpTasks.begin(); iT != m_vecpTasks.end(); iT++) { + int iPosUsed = (*iT)->position(); if (iPosUsed < iNumTasks) vecPositionUsed[iPosUsed] = true; - else - vecPositionUsed[i] = false; } int iFirstUnusedPos = iNumTasks; // default is just past current number of tasks - for (i = 0; i < iNumTasks; i++) + for (int i = 0; i < iNumTasks; i++) if (! vecPositionUsed[i]) { iFirstUnusedPos = i; break; } - + wxPoint posGauge (m_sizeBorder.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y); wxPoint posLabel (m_sizeBorder.x + m_sizeGauge.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y); + 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); - // 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); - std::string* pstrTaskName = new std::string (pszTaskName); - - m_vecpBackgroundTasks.push_back (pTask); - m_vecpGauges.push_back (pGauge); - m_vecpNames.push_back (pstrTaskName); - m_vecpPositions.push_back (iFirstUnusedPos); - m_vecpLabels.push_back (pLabel); - //m_vecpCancelButtons.push_back (pCancelButton); + wxButton* pButton = NULL; // new wxButton (m_pCanvas, reinterpret_cast(pSupervisor), _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT); + + BackgroundManagerTask* pTask = new BackgroundManagerTask (pSupervisor, pszTaskName, iFirstUnusedPos, pGauge, pLabel, pButton); + + m_vecpTasks.push_back (pTask); m_iNumTasks++; resizeWindow(); if (m_iNumTasks == 1) { + SetFocus(); Show(true); theApp->getMainFrame()->SetFocus(); // necessary to keep wxWindows from crashing } @@ -150,40 +157,29 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) void BackgroundManager::OnRemoveTask (wxCommandEvent& event) { - BackgroundSupervisor* pTask = reinterpret_cast(event.GetClientData()); - if (pTask == NULL) { - sys_error (ERR_SEVERE, "Received NULL task [BackgroundManager::OnAddTask]"); + BackgroundSupervisor* pSupervisor = reinterpret_cast(event.GetClientData()); + if (pSupervisor == NULL) { + sys_error (ERR_SEVERE, "Received NULL task [BackgroundManager::OnRemoveTask]"); return; } wxCriticalSectionLocker locker (m_criticalSection); - StringContainer::iterator iName = m_vecpNames.begin(); - GaugeContainer::iterator iGauge = m_vecpGauges.begin(); - PositionContainer::iterator iPosition = m_vecpPositions.begin(); - LabelContainer::iterator iLabel = m_vecpLabels.begin(); - //ButtonContainer::iterator iCancelButton = m_vecpCancelButtons.begin(); - for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) { - if (*iTask == pTask) { - 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; + 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; + m_vecpTasks.erase (iTask); m_iNumTasks--; + bFound = true; break; } - iName++; - iGauge++; - iPosition++; - iLabel++; - //iCancelButton++; } + if (! bFound) + sys_error (ERR_SEVERE, "Unable to find supervisor [BackgroundManager::OnRemoveTask]"); resizeWindow(); if (m_iNumTasks <= 0) @@ -195,22 +191,20 @@ BackgroundManager::OnCancelButton (wxCommandEvent& event) { } -wxGauge* -BackgroundManager::lookupGauge (BackgroundSupervisor* pTask) +BackgroundManagerTask* +BackgroundManager::lookupTask (BackgroundSupervisor* pSupervisor) { - wxGauge* pGauge = NULL; - int i = 0; + BackgroundManagerTask* pTask = NULL; wxCriticalSectionLocker locker (m_criticalSection); - for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) { - if (*iTask == pTask) { - pGauge = m_vecpGauges[i]; + for (TaskContainer::iterator iTask = m_vecpTasks.begin(); iTask != m_vecpTasks.end(); iTask++) { + if ((*iTask)->supervisor() == pSupervisor) { + pTask = *iTask; break; } - i++; } - return pGauge; + return pTask; } void @@ -218,9 +212,10 @@ BackgroundManager::resizeWindow() { int iHighestPosition = -1; - for (unsigned int i = 0; i < m_vecpPositions.size(); i++) - if (iHighestPosition < m_vecpPositions[i]) - iHighestPosition = m_vecpPositions[i]; + wxCriticalSectionLocker lock (m_criticalSection); + for (TaskContainer::iterator i = m_vecpTasks.begin(); i != m_vecpTasks.end(); i++) + if (iHighestPosition < (*i)->position()) + iHighestPosition = (*i)->position(); wxSize sizeWindow (m_sizeCell.x, m_sizeCell.y * (iHighestPosition + 1)); SetClientSize (sizeWindow); @@ -231,7 +226,6 @@ BackgroundManager::resizeWindow() IMPLEMENT_DYNAMIC_CLASS(BackgroundManagerCanvas, wxPanel) BEGIN_EVENT_TABLE(BackgroundManagerCanvas, wxPanel) -//EVT_PAINT(BackgroundManagerCanvas::OnPaint) END_EVENT_TABLE() BackgroundManagerCanvas::BackgroundManagerCanvas (BackgroundManager* pMgr) diff --git a/src/backgroundmgr.h b/src/backgroundmgr.h index 76a848f..8aa1859 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.9 2001/03/09 02:40:17 kevin Exp $ +** $Id: backgroundmgr.h,v 1.10 2001/03/09 18:50:46 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 @@ -42,36 +42,30 @@ #include "views.h" #include "threadrecon.h" -#include +#include #ifdef HAVE_WXTHREADS class BackgroundManagerCanvas; +class BackgroundManagerTask; + -#if CTSIM_MDI -//class BackgroundManager : public wxMDIChildFrame -#endif class BackgroundManager : public wxMiniFrame { private: + DECLARE_DYNAMIC_CLASS(BackgroundManager) wxCriticalSection m_criticalSection; BackgroundManagerCanvas* m_pCanvas; int m_iNumTasks; - typedef std::vector TaskContainer; - typedef std::vector GaugeContainer; - typedef std::vector StringContainer; - typedef std::vector PositionContainer; - typedef std::vector LabelContainer; - typedef std::vector ButtonContainer; - TaskContainer m_vecpBackgroundTasks; - GaugeContainer m_vecpGauges; - StringContainer m_vecpNames; - PositionContainer m_vecpPositions; - LabelContainer m_vecpLabels; - ButtonContainer m_vecpCancelButtons; + typedef std::list TaskContainer; + TaskContainer m_vecpTasks; + + void resizeWindow(); + BackgroundManagerTask* lookupTask (BackgroundSupervisor* pSupervisor); + wxSize m_sizeGauge; wxSize m_sizeLabel; wxSize m_sizeCell; @@ -79,18 +73,9 @@ private: wxSize m_sizeCellSpacing; wxSize m_sizeButton; - void resizeWindow(); - wxGauge* lookupGauge(BackgroundSupervisor* pTask); - public: BackgroundManager (); - - TaskContainer& getTasks() { return m_vecpBackgroundTasks;} - GaugeContainer& getGauges() { return m_vecpGauges;} - StringContainer& getNames() { return m_vecpNames;} - PositionContainer& getPositions() { return m_vecpPositions;} - LabelContainer& getLabels() { return m_vecpLabels;} - ButtonContainer& getCancelButtons() { return m_vecpCancelButtons;} + ~BackgroundManager(); void OnAddTask (wxCommandEvent& event); void OnRemoveTask (wxCommandEvent& event); @@ -102,6 +87,32 @@ public: }; +class BackgroundSupervisor; +class BackgroundManagerTask { +private: + const BackgroundSupervisor* m_pSupervisor; + const std::string m_strName; + const int m_iPosition; + wxGauge* m_pGauge; + wxStaticText* m_pLabel; + wxButton* m_pButton; + +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) + {} + + int position() const {return m_iPosition;} + const std::string& name() const {return m_strName;} + const BackgroundSupervisor* supervisor() const {return m_pSupervisor;} + + wxGauge* gauge() {return m_pGauge;} + wxStaticText* label() {return m_pLabel;} + wxButton* button() {return m_pButton;} +}; + + class BackgroundManagerCanvas : public wxPanel { private: DECLARE_DYNAMIC_CLASS(BackgroundManagerCanvas) -- 2.34.1