Thread: [Gcblue-commits] gcb_wx/src/graphics tc3DModel.cpp,1.23,1.24 tc3DWindow.cpp,1.16,1.17 tcLauncherPopu
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-03-04 00:47:01
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11821/src/graphics Modified Files: tc3DModel.cpp tc3DWindow.cpp tcLauncherPopup.cpp tcMessageChannel.cpp tcNumberWidget.cpp Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tc3DModel.cpp 21 Feb 2005 18:26:09 -0000 1.23 --- tc3DModel.cpp 4 Mar 2005 00:46:16 -0000 1.24 *************** *** 653,657 **** if (tcPlatformObject *plat = dynamic_cast<tcPlatformObject*>(obj)) { ! if (info.param >= (int)plat->mapSensorState.size()) { std::cerr << "sensor animation param out of range\n"; --- 653,657 ---- if (tcPlatformObject *plat = dynamic_cast<tcPlatformObject*>(obj)) { ! if (info.param >= (int)plat->GetSensorCount()) { std::cerr << "sensor animation param out of range\n"; *************** *** 659,664 **** return; } ! info.switchVariable = &plat->mapSensorState[info.param]->mbActive; ! float tscan = plat->mapSensorState[info.param]->mfCurrentScanPeriod_s; info.omega = (tscan) ? C_TWOPI/tscan : 0; } --- 659,666 ---- return; } ! ! tcSensorState* sensor = plat->GetSensorMutable(info.param); ! info.switchVariable = &sensor->mbActive; ! float tscan = (sensor != 0) ? sensor->mfCurrentScanPeriod_s : 1.0f; info.omega = (tscan) ? C_TWOPI/tscan : 0; } Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tc3DWindow.cpp 2 Mar 2005 22:28:42 -0000 1.16 --- tc3DWindow.cpp 4 Mar 2005 00:46:17 -0000 1.17 *************** *** 156,160 **** void tc3DWindow::OnLeaveWindow(wxMouseEvent& event) { - event.Skip(); } --- 156,159 ---- *************** *** 403,406 **** --- 402,407 ---- void tc3DWindow::SetActive(bool abActive) { + UpdateChildren(); // complete pending removes before accessing children + size_t nChildren = children.size(); for(size_t n=0;n<nChildren;n++) Index: tcMessageChannel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMessageChannel.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcMessageChannel.cpp 23 Nov 2004 23:30:56 -0000 1.2 --- tcMessageChannel.cpp 4 Mar 2005 00:46:17 -0000 1.3 *************** *** 181,185 **** * */ ! tcMessageChannel::tcMessageChannel(std::string name) : channelName(name), isActive(false), --- 181,185 ---- * */ ! tcMessageChannel::tcMessageChannel(const std::string& name) : channelName(name), isActive(false), Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcLauncherPopup.cpp 10 Jan 2005 00:30:54 -0000 1.4 --- tcLauncherPopup.cpp 4 Mar 2005 00:46:17 -0000 1.5 *************** *** 131,136 **** else { ! launchButton->SetFillColors(osg::Vec4(0.5, 0.2, 0.2, 1.0), osg::Vec4(0.5, 0.2, 0.2, 1.0), ! osg::Vec4(0.5, 0.2, 0.2, 1.0)); } --- 131,136 ---- else { ! launchButton->SetFillColors(osg::Vec4(0.5, 0.2, 0.2, 1.0), osg::Vec4(1.0, 0.4, 0.4, 1.0), ! osg::Vec4(1.0, 0.4, 0.4, 1.0)); } *************** *** 164,172 **** void tcLauncherPopup::InitTorpedoControls() { ! const int widgetWidth = 40; ! const int widgetHeight = 12; ! const float widgetFontSize = 12.0; const float widgetAlpha = 1.0f; ! int x = 80; int y = 20; --- 164,172 ---- void tcLauncherPopup::InitTorpedoControls() { ! const int widgetWidth = 44; ! const int widgetHeight = 14; ! const float widgetFontSize = 14.0; const float widgetAlpha = 1.0f; ! int x = 90; int y = 20; *************** *** 175,179 **** if (!launcher) return; ! launchButton = new tcButton(this, wxPoint(mnWidth - 40, 5), wxSize(widgetHeight, widgetHeight)); launchButton->SetActive(true); --- 175,179 ---- if (!launcher) return; ! launchButton = new tcButton(this, wxPoint(mnWidth - 40, 20), wxSize(widgetHeight, widgetHeight)); launchButton->SetActive(true); *************** *** 181,188 **** launchButton->SetCaption("L"); launchButton->SetCommand(LP_LAUNCH); ! launchButton->SetFontSize(11.0); launchButton->SetSendRedraw(true); ! selectDatumButton = new tcButton(this, wxPoint(mnWidth - 55, 5), wxSize(widgetHeight, widgetHeight)); selectDatumButton->SetActive(true); --- 181,189 ---- launchButton->SetCaption("L"); launchButton->SetCommand(LP_LAUNCH); ! launchButton->SetFontSize(12.0); launchButton->SetSendRedraw(true); ! ! selectDatumButton = new tcButton(this, wxPoint(mnWidth - 55, 20), wxSize(widgetHeight, widgetHeight)); selectDatumButton->SetActive(true); *************** *** 190,196 **** selectDatumButton->SetCaption("D"); selectDatumButton->SetCommand(LP_SETDATUM); ! selectDatumButton->SetFontSize(11.0); selectDatumButton->SetSendRedraw(true); runToEnableAdjust = new tcNumberWidget(runToEnable, this, wxPoint(x, y), wxSize(widgetWidth, widgetHeight)); --- 191,198 ---- selectDatumButton->SetCaption("D"); selectDatumButton->SetCommand(LP_SETDATUM); ! selectDatumButton->SetFontSize(12.0); selectDatumButton->SetSendRedraw(true); + runToEnableAdjust = new tcNumberWidget(runToEnable, this, wxPoint(x, y), wxSize(widgetWidth, widgetHeight)); *************** *** 263,266 **** --- 265,284 ---- } + void tcLauncherPopup::OnChar(wxKeyEvent& event) + { + int nChar = event.GetKeyCode(); + + + switch(nChar) + { + case WXK_ESCAPE: + destroy = true; + break; + default: + event.Skip(); + break; + } + } + /** * Intended to be overrided to intercept command events from GUI *************** *** 363,366 **** --- 381,389 ---- + void tcLauncherPopup::OnRButtonDown(wxMouseEvent& event) + { + // do nothing, but keep event from getting passed upward + } + /** * @param id Id of platform with launcher to control Index: tcNumberWidget.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNumberWidget.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcNumberWidget.cpp 2 Mar 2005 22:28:43 -0000 1.3 --- tcNumberWidget.cpp 4 Mar 2005 00:46:17 -0000 1.4 *************** *** 56,64 **** UpdateAutoChange(); // non-image drawing osg::Vec4 backgroundColor; osg::Vec4 textColor; ! if (isMouseOver) { backgroundColor.set(0.1, 0.1, 0.1, backgroundAlpha); --- 56,80 ---- UpdateAutoChange(); + // clear keyboardWait if timeout reached + if (keyboardWait) + { + unsigned t = tcTime::Get()->Get30HzCount(); + unsigned dt = t - lastKeypressTime; + if (dt >= keyboardTimeout) + { + keyboardWait = false; + } + } + // non-image drawing osg::Vec4 backgroundColor; osg::Vec4 textColor; ! if (keyboardWait) ! { ! backgroundColor.set(0.1, 0.5, 0.1, backgroundAlpha); ! textColor.set(1, 1, 1, 1); ! } ! else if (isMouseOver) { backgroundColor.set(0.1, 0.1, 0.1, backgroundAlpha); *************** *** 89,92 **** --- 105,145 ---- + void tcNumberWidget::OnChar(wxKeyEvent& event) + { + int nChar = event.GetKeyCode(); + + unsigned t = tcTime::Get()->Get30HzCount(); + unsigned dt = t - lastKeypressTime; + + bool addDigit = (keyboardWait && (dt < keyboardTimeout)); + keyboardWait = true; + lastKeypressTime = t; + + + const int val0 = '0'; + const int val9 = '9'; + + if (nChar == WXK_RETURN) + { + keyboardWait = false; + tcSound::Get()->PlayEffect("MutedBeep"); + } + else if ((nChar >= val0) && (nChar <= val9)) + { + if (addDigit) + { + val = 10.0f * val + (nChar - val0); + } + else + { + val = (nChar - val0); + } + tcSound::Get()->PlayEffect("MutedBeep"); + } + else + { + event.Skip(); + } + } /** *************** *** 106,109 **** --- 159,164 ---- SendRedraw(); } + + wxWindow::SetFocus(); } *************** *** 123,127 **** // measure could be done once per font size change instead wxSize numberSize; ! MeasureText(defaultFont.get(), fontSize, "8", numberSize); float digitIdx = floorf(float(mnWidth - pos.x - 2.0f) / float(numberSize.GetWidth())); --- 178,182 ---- // measure could be done once per font size change instead wxSize numberSize; ! MeasureText(defaultFont.get(), 1.1f * fontSize, "8", numberSize); float digitIdx = floorf(float(mnWidth - pos.x - 2.0f) / float(numberSize.GetWidth())); *************** *** 185,189 **** void tcNumberWidget::OnRButtonDown(wxMouseEvent& event) { - event.Skip(); } --- 240,243 ---- *************** *** 256,260 **** changeIncrement(0), leftButtonDown(false), ! buttonDownTime(0) { --- 310,315 ---- changeIncrement(0), leftButtonDown(false), ! buttonDownTime(0), ! keyboardTimeout(30) { |