[Gcblue-commits] gcb_wx/src/graphics tcChatBox.cpp, 1.5, 1.6 tcDatabaseInfoWindow.cpp, 1.9, 1.10 tc
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-12-02 02:23:51
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14318/src/graphics Modified Files: tcChatBox.cpp tcDatabaseInfoWindow.cpp tcOOBView.cpp tcXmlWindow.cpp Log Message: Index: tcXmlWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcXmlWindow.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcXmlWindow.cpp 6 Sep 2006 01:28:20 -0000 1.10 --- tcXmlWindow.cpp 2 Dec 2006 02:23:48 -0000 1.11 *************** *** 118,121 **** --- 118,149 ---- } + + /** + * Use this method to safely destroy the windw + */ + void tcXmlWindow::DestroyWindow() + { + destroy = true; + } + + /** + * If destroy is queued, destroy window and return true, + * otherwise do nothing and return false + */ + bool tcXmlWindow::FinishDestroy() + { + if (destroy) + { + ClearDrawObjects(); + Destroy(); + return true; + } + else + { + return false; + } + } + + /** * Intended to be overrided to intercept command events from GUI *************** *** 135,138 **** --- 163,203 ---- } + void tcXmlWindow::OnLButtonDown(wxMouseEvent& event) + { + /* check if cursor is over a non-empty slot, if so + ** arm drag with slot idx */ + wxPoint point = event.GetPosition(); + + float x = (float)point.x; + float y = (float)point.y; + + isLButtonDown = true; + if (isDragable && ((point.y <= 20) || (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; + } + + } + + void tcXmlWindow::OnLButtonUp(wxMouseEvent& event) + { + isLButtonDown = false; + windowDragOn = false; + ReleaseMouse(); + } + + + void tcXmlWindow::OnMouseMove(wxMouseEvent& event) + { + wxPoint point = event.GetPosition(); + + UpdateWindowDrag(point); + } + void tcXmlWindow::SetButtonDisable(long command, bool state) *************** *** 188,191 **** --- 253,262 ---- } + void tcXmlWindow::SetDragable(bool state) + { + isDragable = state; + } + + /** * Finds first radio button with command matching radioCommand and sets *************** *** 209,217 **** tcXmlWindow::tcXmlWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& configFile, const wxString& name, tc3DWindow* graphicsHost) ! : tc3DWindow(parent, pos, size, name, graphicsHost) { if (configFile.length() > 2) --- 280,309 ---- + void tcXmlWindow::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; + } + } + + tcXmlWindow::tcXmlWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& configFile, const wxString& name, tc3DWindow* graphicsHost) ! : tc3DWindow(parent, pos, size, name, graphicsHost) , ! destroy(false), ! isDragable(false), ! windowDragOn(false), ! isLButtonDown(false) { if (configFile.length() > 2) Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcDatabaseInfoWindow.cpp 20 Nov 2006 00:17:42 -0000 1.9 --- tcDatabaseInfoWindow.cpp 2 Dec 2006 02:23:48 -0000 1.10 *************** *** 62,74 **** - /** - * Use this method to safely destroy the windw - */ - void tcDatabaseInfoWindow::DestroyWindow() - { - destroy = true; - } - - void tcDatabaseInfoWindow::Draw() { --- 62,65 ---- *************** *** 215,236 **** - /** - * If destroy is queued, destroy window and return true, - * otherwise do nothing and return false - */ - bool tcDatabaseInfoWindow::FinishDestroy() - { - if (destroy) - { - ClearDrawObjects(); - this->Destroy(); - return true; - } - else - { - return false; - } - } - --- 206,209 ---- *************** *** 306,328 **** void tcDatabaseInfoWindow::OnLButtonDown(wxMouseEvent& event) { ! /* check if cursor is over a non-empty slot, if so ! ** arm drag with slot idx */ ! wxPoint point = event.GetPosition(); ! ! float x = (float)point.x; ! float y = (float)point.y; ! ! ! isLButtonDown = true; ! if (isDragable && ((point.y <= 20) || (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; ! } ! } --- 279,283 ---- void tcDatabaseInfoWindow::OnLButtonDown(wxMouseEvent& event) { ! tcXmlWindow::OnLButtonDown(event); } *************** *** 331,338 **** void tcDatabaseInfoWindow::OnLButtonUp(wxMouseEvent& event) { ! isLButtonDown = false; ! windowDragOn = false; ! ReleaseMouse(); ! } --- 286,290 ---- void tcDatabaseInfoWindow::OnLButtonUp(wxMouseEvent& event) { ! tcXmlWindow::OnLButtonUp(event); } *************** *** 347,358 **** void tcDatabaseInfoWindow::OnMouseMove(wxMouseEvent& event) { ! wxPoint point = event.GetPosition(); ! ! UpdateWindowDrag(point); ! ! // update mouseover status of all slots ! float x = (float)point.x; ! float y = (float)point.y; ! } --- 299,303 ---- void tcDatabaseInfoWindow::OnMouseMove(wxMouseEvent& event) { ! tcXmlWindow::OnMouseMove(event); } *************** *** 379,404 **** } - void tcDatabaseInfoWindow::SetDragable(bool state) - { - isDragable = state; - } - - - void tcDatabaseInfoWindow::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; - } - } --- 324,327 ---- *************** *** 408,416 **** tcDatabaseInfoWindow::tcDatabaseInfoWindow(const wxPoint& pos, const wxString& configFile, const wxString& name, tc3DWindow* hostParent) : tcXmlWindow(hostParent, pos, wxSize(10, 10), configFile, name, hostParent), - destroy(false), drawCount(0), - isLButtonDown(false), - windowDragOn(false), - isDragable(true), objId(-1), databaseClassName(""), --- 331,335 ---- Index: tcChatBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcChatBox.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcChatBox.cpp 23 Mar 2006 01:11:02 -0000 1.5 --- tcChatBox.cpp 2 Dec 2006 02:23:48 -0000 1.6 *************** *** 39,42 **** --- 39,43 ---- BEGIN_EVENT_TABLE(tcChatBox, tcXmlWindow) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcChatBox::SendChatText) + EVT_COMMAND(86, wxEVT_COMMAND_BUTTON_CLICKED, tcChatBox::OnCloseCommand) END_EVENT_TABLE() *************** *** 49,52 **** --- 50,55 ---- void tcChatBox::Draw() { + if (FinishDestroy()) return; + if (!IsBackgroundEnabled()) { *************** *** 66,69 **** --- 69,80 ---- } + /** + * Close and destroy window at next safe opportunity + */ + void tcChatBox::OnCloseCommand(wxCommandEvent& event) + { + SetActive(false); + } + void tcChatBox::OnKeyDown(wxKeyEvent& event) { *************** *** 73,76 **** --- 84,93 ---- void tcChatBox::OnLButtonDown(wxMouseEvent& event) { + tcXmlWindow::OnLButtonDown(event); + } + + void tcChatBox::OnRButtonDown(wxMouseEvent& event) + { + // event stops here } Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcOOBView.cpp 17 Aug 2006 01:28:04 -0000 1.15 --- tcOOBView.cpp 2 Dec 2006 02:23:48 -0000 1.16 *************** *** 101,105 **** wxASSERT(mpSimState); ! unsigned nCount = mpSimState->GetAlliancePlatforms(objKeys, MAX_OOB_OBJECTS, mnAlliance); for (unsigned n = 0; n < nCount; n++) --- 101,107 ---- wxASSERT(mpSimState); ! int alliance = (int)tcUserInfo::Get()->GetOwnAlliance(); ! ! unsigned nCount = mpSimState->GetAlliancePlatforms(objKeys, MAX_OOB_OBJECTS, alliance); for (unsigned n = 0; n < nCount; n++) *************** *** 173,176 **** --- 175,180 ---- void tcOOBView::UpdateTrackData() { + int alliance = (int)tcUserInfo::Get()->GetOwnAlliance(); + surfaceTracks.clear(); subTracks.clear(); *************** *** 182,186 **** region.Set(-C_PI, C_PIM, -C_PIOVER2, C_PIOVER2); // all earth ! tcSensorTrackIterator iter(mnAlliance, 0xFFFF, region); for (iter.First();iter.NotDone();iter.Next()) --- 186,190 ---- region.Set(-C_PI, C_PIM, -C_PIOVER2, C_PIOVER2); // all earth ! tcSensorTrackIterator iter(alliance, 0xFFFF, region); for (iter.First();iter.NotDone();iter.Next()) *************** *** 809,813 **** tcXmlWindow(parent, pos, size, "xml/oobview.xml", name, graphicsHost), mpMapView(0), - mnAlliance(0), mnSelectedKey(NULL_INDEX), mbMouseDrag(false), --- 813,816 ---- |