X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fbackgroundmgr.cpp;h=b9ae21216bc6f188bc1f1bf54a0cdb8d43d6f1f2;hb=de6d2bb3861af7568006e1a02d5dddc730644b01;hp=ff22e58352a70a0747fc34d462bec7a49c35f98a;hpb=793b8154fdc069e43a939852657e89847d01ee77;p=ctsim.git diff --git a/src/backgroundmgr.cpp b/src/backgroundmgr.cpp index ff22e58..b9ae212 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.10 2001/03/05 15:16:25 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 @@ -39,9 +39,7 @@ #include "backgroundmgr.h" -#if defined(HAVE_CONFIG_H) -#include "config.h" -#endif +#ifdef HAVE_WXTHREADS IMPLEMENT_DYNAMIC_CLASS(BackgroundManager, wxMiniFrame) @@ -53,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); @@ -110,13 +109,12 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) int iNumTasks = m_vecpBackgroundTasks.size(); std::vector 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 @@ -131,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); @@ -166,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; } @@ -236,16 +235,9 @@ BEGIN_EVENT_TABLE(BackgroundManagerCanvas, wxPanel) END_EVENT_TABLE() BackgroundManagerCanvas::BackgroundManagerCanvas (BackgroundManager* pMgr) -: m_pBackgroundManager(pMgr), wxPanel (pMgr) +: wxPanel (pMgr), m_pBackgroundManager(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