[Gcblue-commits] gcb_wx/src/graphics tc3DModel.cpp,1.32,1.33 tc3DWindow.cpp,1.28,1.29 tcContainerGui
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-12-18 18:48:28
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17709/src/graphics Modified Files: tc3DModel.cpp tc3DWindow.cpp tcContainerGui.cpp tcFlightPortGui.cpp tcMapView.cpp Log Message: mission editor mode changes Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tcMapView.cpp 18 Dec 2005 04:10:33 -0000 1.39 --- tcMapView.cpp 18 Dec 2005 18:48:17 -0000 1.40 *************** *** 25,31 **** #ifndef WX_PRECOMP #include "wx/wx.h" - #ifdef WIN32 - #include "wx/msw/private.h" // for MS Windows specific definitions - #endif #endif --- 25,28 ---- *************** *** 40,43 **** --- 37,41 ---- #include "tcMapObject.h" #include "tcMapOverlay.h" + #include "tcDragStatus.h" #include <osg/Image> *************** *** 1966,1970 **** --- 1964,1976 ---- } + void tcTacticalMapView::ClearHook() + { + wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_NEWHOOK) ; + command.SetEventObject(this); + command.m_extraLong = -1; + AddPendingEvent(command); + hookedId.clear(); + } /** *************** *** 1972,1975 **** --- 1978,1982 ---- * Hooks a single object closest to pscreen * Modified so that hook is not cleared if no object is close to click point + * Use double click or escape key to clear hook */ long tcTacticalMapView::Hook(wxPoint pscreen) *************** *** 1988,2001 **** long nMinID = GetClosest(pscreen); ! /* added quick workaround so that hook can be cleared with two clicks ! ** that don't hook a new unit. Allows access to main popup menu ! */ ! static long lastMinID = 0; ! if ((nMinID == -1)&&(lastMinID != -1)) { - lastMinID = nMinID; return -1; } - lastMinID = nMinID; if (nMinID != currentHook) --- 1995,2002 ---- long nMinID = GetClosest(pscreen); ! if (nMinID == -1) { return -1; } if (nMinID != currentHook) *************** *** 2329,2333 **** void tcTacticalMapView::OnChar(wxKeyEvent& event) { ! event.Skip(); } --- 2330,2345 ---- void tcTacticalMapView::OnChar(wxKeyEvent& event) { ! int nChar = event.GetKeyCode(); ! ! if (nChar == WXK_ESCAPE) ! { ! if (GetHookCount() > 0) ! { ! ClearHook(); ! return; ! } ! } ! ! event.Skip(); } *************** *** 2373,2376 **** --- 2385,2393 ---- } + void tcTacticalMapView::OnLButtonDClick(wxMouseEvent& event) + { + ClearHook(); + } + /** * Check if button is down near a nav waypoint-- if so, start edit *************** *** 2401,2406 **** --- 2418,2427 ---- void tcTacticalMapView::OnLButtonUp(wxMouseEvent& event) { + // a hack to stop incomplete drags when the user lets go of the mouse button + tcDragStatus::Get()->StopDrag(); + if (!isLButtonDown) return; + wxPoint buttonUpPoint = event.GetPosition(); Index: tcFlightPortGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcFlightPortGui.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcFlightPortGui.cpp 7 Jul 2005 01:13:43 -0000 1.3 --- tcFlightPortGui.cpp 18 Dec 2005 18:48:17 -0000 1.4 *************** *** 324,332 **** /** ! * If right button is clicked on launch spot, launch the entity item in spot ! * Otherwise open a platform gui for the entity */ ! void tcFlightPortGui::OnRButtonDown(wxMouseEvent& event) { tcFlightPort* flightPort = GetFlightPort(); if (flightPort == 0) return; --- 324,333 ---- /** ! * Launch clicked entity if in launch spot */ ! void tcFlightPortGui::OnLButtonDClick(wxMouseEvent& event) { + tcContainerGui::OnLButtonDClick(event); + tcFlightPort* flightPort = GetFlightPort(); if (flightPort == 0) return; *************** *** 348,352 **** } ! for (size_t n=readyOffset; n<nSlots; n++) { tcContainerSlot& slot = slots[n]; --- 349,370 ---- } ! } ! ! /** ! * Open a platform gui for the clicked entity ! */ ! void tcFlightPortGui::OnRButtonDown(wxMouseEvent& event) ! { ! tcFlightPort* flightPort = GetFlightPort(); ! if (flightPort == 0) return; ! ! wxPoint point = event.GetPosition(); ! ! float x = (float)point.x; ! float y = (float)point.y; ! ! size_t nSlots = slots.size(); ! ! for (size_t n=launchOffset; n<nSlots; n++) { tcContainerSlot& slot = slots[n]; Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tc3DWindow.cpp 12 Dec 2005 02:37:01 -0000 1.28 --- tc3DWindow.cpp 18 Dec 2005 18:48:17 -0000 1.29 *************** *** 61,64 **** --- 61,65 ---- EVT_MOVE(tc3DWindow::OnMove) EVT_LEFT_DOWN(tc3DWindow::OnLButtonDown) + EVT_LEFT_DCLICK(tc3DWindow::OnLButtonDClick) EVT_LEFT_UP(tc3DWindow::OnLButtonUp) EVT_RIGHT_DOWN(tc3DWindow::OnRButtonDown) *************** *** 155,158 **** --- 156,164 ---- } + void tc3DWindow::OnLButtonDClick(wxMouseEvent& event) + { + SkipMouseEvent(event); + } + void tc3DWindow::OnLButtonUp(wxMouseEvent& event) { Index: tcContainerGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcContainerGui.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcContainerGui.cpp 14 Jul 2005 23:42:22 -0000 1.3 --- tcContainerGui.cpp 18 Dec 2005 18:48:17 -0000 1.4 *************** *** 251,254 **** --- 251,266 ---- float y = (float)point.y; + + isLButtonDown = true; + if ((point.y <= 10) || (point.y >= mnHeight)) + { + windowDragOn = true; + // position in parent's frame of mouse pointer + windowDragPoint = wxPoint(mrectWindow.GetLeft() + point.x, mrectWindow.GetBottom() + point.y); + + CaptureMouse(); + return; + } + dragIsArmed = false; dragSlotIdx = 999; *************** *** 270,275 **** --- 282,298 ---- } + void tcContainerGui::OnLButtonDClick(wxMouseEvent& event) + { + dragIsArmed = false; + dragSlotIdx = 999; + } + void tcContainerGui::OnLButtonUp(wxMouseEvent& event) { + isLButtonDown = false; + windowDragOn = false; + ReleaseMouse(); + + dragIsArmed = false; *************** *** 321,324 **** --- 344,349 ---- wxPoint point = event.GetPosition(); + UpdateWindowDrag(point); + // update mouseover status of all slots float x = (float)point.x; *************** *** 357,360 **** --- 382,402 ---- } + void tcContainerGui::UpdateWindowDrag(const wxPoint& pos) + { + if (!windowDragOn) return; + + + // position in parent's frame of mouse pointer + wxPoint current = wxPoint(mrectWindow.GetLeft() + pos.x, mrectWindow.GetBottom() + pos.y); + if (current != windowDragPoint) + { + wxPoint delta = current - windowDragPoint; + int xmove = mrectWindow.GetLeft() + delta.x; + int ymove = mrectWindow.GetTop() + delta.y; + tc3DWindow::MoveWindow(xmove, ymove); + windowDragPoint = current; + } + } + void tcContainerGui::SetParentItem(tcContainerItem* item) { *************** *** 370,374 **** drawCount(0), dragIsArmed(false), ! parentItem(0) { SetBaseRenderBin(parent->GetBaseRenderBin() + 10); --- 412,418 ---- drawCount(0), dragIsArmed(false), ! parentItem(0), ! isLButtonDown(false), ! windowDragOn(false) { SetBaseRenderBin(parent->GetBaseRenderBin() + 10); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tc3DModel.cpp 27 Nov 2005 22:21:29 -0000 1.32 --- tc3DModel.cpp 18 Dec 2005 18:48:17 -0000 1.33 *************** *** 416,422 **** /** * Retrieves launcher info for launcher <idx> ! * Zero is used as default if idx out of range */ ! void tc3DModel::GetLauncherInfo(unsigned int idx, osg::Vec3& pos, float& az) { if (idx >= launcherInfo.size()) --- 416,422 ---- /** * Retrieves launcher info for launcher <idx> ! * Zeros are used as default if idx out of range (xml file missing launcher info) */ ! void tc3DModel::GetLauncherInfo(unsigned int idx, osg::Vec3& pos, float& az, float& el) const { if (idx >= launcherInfo.size()) *************** *** 424,427 **** --- 424,428 ---- pos.set(0, 0, 0); az = 0; + el = 0; return; } *************** *** 429,432 **** --- 430,434 ---- pos = launcherInfo[idx].position; az = launcherInfo[idx].pointingAzimuth; + el = launcherInfo[idx].pointingElevation; } *************** *** 713,724 **** double z = 0; double az = 0; ! elt->Attribute("X", &x); elt->Attribute("Y", &y); elt->Attribute("Z", &z); elt->Attribute("Az", &az); info.position.set(x, y, z); info.pointingAzimuth = az; launcherInfo.push_back(info); --- 715,728 ---- double z = 0; double az = 0; ! double el = 0; elt->Attribute("X", &x); elt->Attribute("Y", &y); elt->Attribute("Z", &z); elt->Attribute("Az", &az); + elt->Attribute("El", &el); info.position.set(x, y, z); info.pointingAzimuth = az; + info.pointingElevation = el; launcherInfo.push_back(info); |