X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fbackgroundmgr.cpp;h=5ba1b786d08e99104791d1caad4f922c716820a5;hp=52ee7965cf1fc8f8af3fd3e6f501930f7f94446c;hb=f7ee98f7d964ed361068179f0e7ea4475ed1abdf;hpb=999a754d1519a49ca062ee87b22bf601c1ee9f21 diff --git a/src/backgroundmgr.cpp b/src/backgroundmgr.cpp index 52ee796..5ba1b78 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.16 2001/03/11 06:34:37 kevin Exp $ +** $Id$ ** ** 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,7 +89,7 @@ void BackgroundManager::OnUnitTick (wxCommandEvent& event) { int iUnits = event.GetInt(); - + BackgroundSupervisor* pSupervisor = reinterpret_cast(event.GetClientData()); if (pSupervisor == NULL) { sys_error (ERR_SEVERE, "Received NULL task [BackgroundManager::OnUnitTick]"); @@ -98,8 +98,8 @@ BackgroundManager::OnUnitTick (wxCommandEvent& event) BackgroundManagerTask* pTask = lookupTask (pSupervisor); if (pTask == NULL) { - sys_error (ERR_SEVERE, "Error looking up task [BackgroundManager::OnUnitTick]"); - return; + sys_error (ERR_SEVERE, "Error looking up task [BackgroundManager::OnUnitTick]"); + return; } pTask->gauge()->SetValue (iUnits); } @@ -108,7 +108,7 @@ void BackgroundManager::OnAddTask (wxCommandEvent& event) { int iNumUnits = event.GetInt(); - const char* const pszTaskName = event.GetString().c_str(); + const char* const pszTaskName = event.GetString().mb_str(wxConvUTF8); BackgroundSupervisor* pSupervisor = reinterpret_cast(event.GetClientData()); if (pSupervisor == NULL) { sys_error (ERR_SEVERE, "Received NULL supervisor [BackgroundManager::OnAddTask]"); @@ -118,7 +118,7 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) wxCriticalSectionLocker locker (m_criticalSection); int iNumTasks = m_vecpTasks.size(); - std::vector vecPositionUsed (iNumTasks); //vector of used table positions + std::vector vecPositionUsed (iNumTasks); //vector of used table positions for (int iP = 0; iP < iNumTasks; iP++) vecPositionUsed[iP] = false; @@ -134,15 +134,15 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) 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); + wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, wxConvUTF8.cMB2WX(pszTaskName), posLabel, m_sizeLabel); wxButton* pButton = new wxButton (m_pCanvas, s_iNextButtonID, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT); - BackgroundManagerTask* pTask = new BackgroundManagerTask (pSupervisor, pszTaskName, + BackgroundManagerTask* pTask = new BackgroundManagerTask (pSupervisor, pszTaskName, iFirstUnusedPos, pGauge, pLabel, pButton, s_iNextButtonID); m_vecpTasks.push_back (pTask); @@ -151,9 +151,8 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) resizeWindow(); if (m_iNumTasks == 1) { - theApp->getMainFrame()->SetFocus(); - Show(true); - theApp->getMainFrame()->SetFocus(); + m_pCanvas->SetFocus(); + Show(true); } } @@ -171,26 +170,25 @@ 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) { - sys_error (ERR_SEVERE, "Unable to find supervisor [BackgroundManager::OnRemoveTask]"); + sys_error (ERR_SEVERE, "Unable to find supervisor [BackgroundManager::OnRemoveTask]"); return; } pSupervisor->ackRemoveBackgroundManager(); resizeWindow(); if (m_iNumTasks <= 0) { - theApp->getMainFrame()->SetFocus(); + m_pCanvas->SetFocus(); Show(false); - theApp->getMainFrame()->SetFocus(); } }