projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r620: no message
[ctsim.git]
/
src
/
backgroundmgr.cpp
diff --git
a/src/backgroundmgr.cpp
b/src/backgroundmgr.cpp
index 34f568bccbc1e7c2fa12509dc0758ffe5fd3a06c..b9ae21216bc6f188bc1f1bf54a0cdb8d43d6f1f2 100644
(file)
--- 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
**
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundmgr.cpp,v 1.
7 2001/02/25 07:36:26
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
**
** 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"
#include "backgroundmgr.h"
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
+#ifdef HAVE_WXTHREADS
IMPLEMENT_DYNAMIC_CLASS(BackgroundManager, wxMiniFrame)
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()
EVT_COMMAND_RANGE(0, 1000, wxEVT_COMMAND_BUTTON_CLICKED, BackgroundManager::OnCancelButton)
END_EVENT_TABLE()
+
BackgroundManager::BackgroundManager ()
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);
{
m_iNumTasks = 0;
m_pCanvas = new BackgroundManagerCanvas (this);
@@
-64,7
+63,8
@@
BackgroundManager::BackgroundManager ()
m_sizeLabel.Set (140, 20);
m_sizeBorder.Set (4, 4);
m_sizeCellSpacing.Set (3, 3);
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);
m_sizeCell.Set (m_sizeGauge.x + m_sizeLabel.x + m_sizeCellSpacing.x + m_sizeButton.x, 25);
@@
-109,13
+109,12
@@
BackgroundManager::OnAddTask (wxCommandEvent& event)
int iNumTasks = m_vecpBackgroundTasks.size();
std::vector<bool> vecPositionUsed (iNumTasks);
int i;
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;
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
}
int iFirstUnusedPos = iNumTasks; // default is just past current number of tasks
@@
-127,17
+126,18
@@
BackgroundManager::OnAddTask (wxCommandEvent& event)
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 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);
wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, posGauge, m_sizeGauge);
wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, pszTaskName, posLabel, m_sizeLabel);
- wxButton* pCancelButton = new wxButton (m_pCanvas, iFirstUnusedPos, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT);
+ // 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_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_vecpPositions.push_back (iFirstUnusedPos);
m_vecpLabels.push_back (pLabel);
- m_vecpCancelButtons.push_back (pCancelButton);
+
//
m_vecpCancelButtons.push_back (pCancelButton);
m_iNumTasks++;
resizeWindow();
m_iNumTasks++;
resizeWindow();
@@
-162,19
+162,19
@@
BackgroundManager::OnRemoveTask (wxCommandEvent& event)
GaugeContainer::iterator iGauge = m_vecpGauges.begin();
PositionContainer::iterator iPosition = m_vecpPositions.begin();
LabelContainer::iterator iLabel = m_vecpLabels.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();
+
//
ButtonContainer::iterator iCancelButton = m_vecpCancelButtons.begin();
for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
if (*iTask == pTask) {
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_vecpBackgroundTasks.erase (iTask);
m_vecpGauges.erase (iGauge);
m_vecpNames.erase (iName);
m_vecpPositions.erase (iPosition);
m_vecpLabels.erase (iLabel);
- m_vecpCancelButtons.erase (iCancelButton);
+ //m_vecpCancelButtons.erase (iCancelButton);
+ delete *iName;
+ delete *iGauge;
+ delete *iLabel;
+ //delete *iCancelButton;
m_iNumTasks--;
break;
}
m_iNumTasks--;
break;
}
@@
-182,7
+182,7
@@
BackgroundManager::OnRemoveTask (wxCommandEvent& event)
iGauge++;
iPosition++;
iLabel++;
iGauge++;
iPosition++;
iLabel++;
- iCancelButton++;
+
//
iCancelButton++;
}
resizeWindow();
}
resizeWindow();
@@
-218,7
+218,7
@@
BackgroundManager::resizeWindow()
{
int iHighestPosition = -1;
{
int iHighestPosition = -1;
- for (int i = 0; i < m_vecpPositions.size(); i++)
+ for (
unsigned
int i = 0; i < m_vecpPositions.size(); i++)
if (iHighestPosition < m_vecpPositions[i])
iHighestPosition = m_vecpPositions[i];
if (iHighestPosition < m_vecpPositions[i])
iHighestPosition = m_vecpPositions[i];
@@
-235,16
+235,9
@@
BEGIN_EVENT_TABLE(BackgroundManagerCanvas, wxPanel)
END_EVENT_TABLE()
BackgroundManagerCanvas::BackgroundManagerCanvas (BackgroundManager* pMgr)
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
\ No newline at end of file
+
+#endif // HAVE_WXTHREADS