Revision: 8841
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8841&view=rev
Author:   natepak
Date:     2010-07-30 15:16:51 +0000 (Fri, 30 Jul 2010)

Log Message:
-----------
Added more menu items

Modified Paths:
--------------
    code/gazebo/branches/wx/server/wx/RenderPanel.cc
    code/gazebo/branches/wx/server/wx/RenderPanel.hh
    code/gazebo/branches/wx/server/wx/SimulationFrame.cc
    code/gazebo/branches/wx/server/wx/SimulationFrame.hh

Modified: code/gazebo/branches/wx/server/wx/RenderPanel.cc
===================================================================
--- code/gazebo/branches/wx/server/wx/RenderPanel.cc    2010-07-29 14:44:49 UTC 
(rev 8840)
+++ code/gazebo/branches/wx/server/wx/RenderPanel.cc    2010-07-30 15:16:51 UTC 
(rev 8841)
@@ -43,6 +43,8 @@
   Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( RenderPanel::OnMouseEvent ), 
NULL, this );
   Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( RenderPanel::OnMouseEvent 
), NULL, this );
 
+  Connect( wxEVT_KEY_UP, wxKeyEventHandler(RenderPanel::OnCharEvent), NULL, 
this);
+
   Events::ConnectCreateEntitySignal( boost::bind(&RenderPanel::CreateEntity, 
this, _1) );
 }
 
@@ -94,6 +96,15 @@
   return handle;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// On char event
+void RenderPanel::OnCharEvent( wxKeyEvent &event)
+{
+  printf("Key Event\n");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// On mouse event callback
 void RenderPanel::OnMouseEvent( wxMouseEvent &event)
 {
   this->mouseEvent.pos.Set( event.GetX(), event.GetY() );
@@ -138,6 +149,8 @@
   this->mouseEvent.prevPos = this->mouseEvent.pos;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Reparent the window
 bool RenderPanel::Reparent(wxWindowBase* new_parent)
 {
   bool ret = true;

Modified: code/gazebo/branches/wx/server/wx/RenderPanel.hh
===================================================================
--- code/gazebo/branches/wx/server/wx/RenderPanel.hh    2010-07-29 14:44:49 UTC 
(rev 8840)
+++ code/gazebo/branches/wx/server/wx/RenderPanel.hh    2010-07-30 15:16:51 UTC 
(rev 8841)
@@ -36,6 +36,8 @@
 
     public: void OnMouseEvent( wxMouseEvent &event);
 
+    public: void OnCharEvent( wxKeyEvent &event);
+
     public: void Init();
 
     /// \brief Create the camera

Modified: code/gazebo/branches/wx/server/wx/SimulationFrame.cc
===================================================================
--- code/gazebo/branches/wx/server/wx/SimulationFrame.cc        2010-07-29 
14:44:49 UTC (rev 8840)
+++ code/gazebo/branches/wx/server/wx/SimulationFrame.cc        2010-07-30 
15:16:51 UTC (rev 8841)
@@ -36,6 +36,7 @@
 
   wxMenuBar *menuBar = new wxMenuBar;
   wxMenu *fileMenu = new wxMenu;
+  wxMenu *viewMenu = new wxMenu;
 
   wxMenuItem *openItem = fileMenu->Append(ID_OPEN, wxT("&Open\tCtrl-O") );
   Connect(openItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnOpen), NULL, this);
@@ -49,7 +50,33 @@
   wxMenuItem *quitItem = fileMenu->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q") );
   Connect(quitItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnQuit), NULL, this);
 
+
+
+
+  wxMenuItem *wireItem = viewMenu->AppendCheckItem(ID_WIREFRAME, 
wxT("Wireframe"));
+  Connect(wireItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnWireframe), NULL, this);
+
+  wxMenuItem *showPhysicsItem= viewMenu->AppendCheckItem(ID_PHYSICS, wxT("Show 
Physics"));
+  Connect(showPhysicsItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnShowPhysics), NULL, this);
+
+  wxMenuItem *showBoundingBoxesItem= viewMenu->AppendCheckItem(ID_BOUNDING, 
wxT("Show Bounding Boxes"));
+  Connect(showBoundingBoxesItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnShowBoundingBoxes), NULL, this);
+
+  wxMenuItem *showJointsItem= viewMenu->AppendCheckItem(ID_JOINTS, wxT("Show 
Joints"));
+  Connect(showJointsItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnShowJoints), NULL, this);
+
+  wxMenuItem *showContactsItem= viewMenu->AppendCheckItem(ID_CONTACTS, 
wxT("Show Contacts"));
+  Connect(showContactsItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnShowContacts), NULL, this);
+
+  wxMenuItem *showLightsItem= viewMenu->AppendCheckItem(ID_LIGHTS, wxT("Show 
Lights"));
+  Connect(showLightsItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnShowLights), NULL, this);
+
+  wxMenuItem *showCamerasItem= viewMenu->AppendCheckItem(ID_CAMERAS, wxT("Show 
Cameras"));
+  Connect(showCamerasItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
wxCommandEventHandler(SimulationFrame::OnShowCameras), NULL, this);
+
+
   menuBar->Append( fileMenu, _("&File") );
+  menuBar->Append( viewMenu, _("&View") );
   SetMenuBar( menuBar );
 
   this->toolbar = NULL;
@@ -228,7 +255,7 @@
       gzthrow("The XML config file can not be loaded, please make sure is a 
correct file\n" << e); 
     }
 
-    XMLConfigNode *rootNode(xmlFile->GetRootNode());
+    //XMLConfigNode *rootNode(xmlFile->GetRootNode());
     //Create the world
     try
     {
@@ -273,6 +300,48 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnWireframe(wxCommandEvent &event)
+{
+  World::Instance()->SetWireframe( !World::Instance()->GetWireframe() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnShowPhysics(wxCommandEvent &event)
+{
+  World::Instance()->SetShowPhysics( !World::Instance()->GetShowPhysics() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnShowBoundingBoxes(wxCommandEvent &event)
+{
+  World::Instance()->SetShowBoundingBoxes( 
!World::Instance()->GetShowBoundingBoxes() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnShowJoints(wxCommandEvent &event)
+{
+  World::Instance()->SetShowJoints( !World::Instance()->GetShowJoints() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnShowContacts(wxCommandEvent &event)
+{
+  World::Instance()->SetShowContacts( !World::Instance()->GetShowContacts() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnShowLights(wxCommandEvent &event)
+{
+  World::Instance()->SetShowLights( !World::Instance()->GetShowLights() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimulationFrame::OnShowCameras(wxCommandEvent &event)
+{
+  World::Instance()->SetShowCameras( !World::Instance()->GetShowCameras() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void SimulationFrame::OnToolClicked( wxCommandEvent &event )
 {
   int id = event.GetId();

Modified: code/gazebo/branches/wx/server/wx/SimulationFrame.hh
===================================================================
--- code/gazebo/branches/wx/server/wx/SimulationFrame.hh        2010-07-29 
14:44:49 UTC (rev 8840)
+++ code/gazebo/branches/wx/server/wx/SimulationFrame.hh        2010-07-30 
15:16:51 UTC (rev 8841)
@@ -15,7 +15,7 @@
   class SimulationFrame : public wxFrame
   {
     enum ToolbarButtons {PLAY, PAUSE, STEP, BOX, SPHERE, CYLINDER, 
DIRECTIONAL, POINT, SPOT, CURSOR};
-    enum MenuIds {ID_OPEN, ID_SAVE, ID_RESET};
+    enum MenuIds {ID_OPEN, ID_SAVE, ID_RESET, ID_WIREFRAME, ID_PHYSICS, 
ID_BOUNDING, ID_JOINTS, ID_CONTACTS, ID_LIGHTS, ID_CAMERAS};
 
     public: SimulationFrame(wxWindow *parent);
 
@@ -35,6 +35,14 @@
     private: void OnSave(wxCommandEvent &event);
     private: void OnReset(wxCommandEvent &event);
 
+    private: void OnWireframe(wxCommandEvent &event);
+    private: void OnShowPhysics(wxCommandEvent &event);
+    private: void OnShowBoundingBoxes(wxCommandEvent &event);
+    private: void OnShowJoints(wxCommandEvent &event);
+    private: void OnShowContacts(wxCommandEvent &event);
+    private: void OnShowLights(wxCommandEvent &event);
+    private: void OnShowCameras(wxCommandEvent &event);
+
     private: void OnToolClicked( wxCommandEvent &event );
 
     private: void OnPaneClosed(wxAuiManagerEvent &event);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to