Revision: 6554
http://playerstage.svn.sourceforge.net/playerstage/?rev=6554&view=rev
Author: natepak
Date: 2008-06-13 13:54:11 -0700 (Fri, 13 Jun 2008)
Log Message:
-----------
Removed bad gui classes
Modified Paths:
--------------
code/gazebo/trunk/server/gui/DummyGui.cc
code/gazebo/trunk/server/gui/GLWindow.cc
code/gazebo/trunk/server/gui/Gui.cc
code/gazebo/trunk/server/gui/Gui.hh
code/gazebo/trunk/server/gui/SConscript
Removed Paths:
-------------
code/gazebo/trunk/server/gui/DummyGui.hh
code/gazebo/trunk/server/gui/GuiFactory.cc
code/gazebo/trunk/server/gui/GuiFactory.hh
Modified: code/gazebo/trunk/server/gui/DummyGui.cc
===================================================================
--- code/gazebo/trunk/server/gui/DummyGui.cc 2008-06-13 18:30:03 UTC (rev
6553)
+++ code/gazebo/trunk/server/gui/DummyGui.cc 2008-06-13 20:54:11 UTC (rev
6554)
@@ -25,13 +25,10 @@
#include "Global.hh"
#include "DummyGui.hh"
-#include "GuiFactory.hh"
#include <time.h>
using namespace gazebo;
-GZ_REGISTER_STATIC_GUI("dummy", DummyGui);
-
////////////////////////////////////////////////////////////////////////////////
/// Constructor: Creates a dummy window necessary to initialize and use GL
rendering system.
/// This window won't appear on the screen and is not used afterward.
Deleted: code/gazebo/trunk/server/gui/DummyGui.hh
===================================================================
--- code/gazebo/trunk/server/gui/DummyGui.hh 2008-06-13 18:30:03 UTC (rev
6553)
+++ code/gazebo/trunk/server/gui/DummyGui.hh 2008-06-13 20:54:11 UTC (rev
6554)
@@ -1,86 +0,0 @@
-/*
- * Gazebo - Outdoor Multi-Robot Simulator
- * Copyright (C) 2003
- * Nate Koenig & Andrew Howard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-/* Desc: FLTK Mainwindow
- * Author: Renaud Barate
- * Date: 16 Feb 2008
- */
-#ifndef DUMMYGUI_HH
-#define DUMMYGUI_HH
-
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <GL/glx.h>
-
-#include "Gui.hh"
-
-namespace gazebo
-{
-
-
- /// \brief Dummy window used to run gazebo without display
- class DummyGui : public Gui
- {
- /// \brief Constructor
- public: DummyGui(int x, int y, int w, int h, const std::string &t);
-
- /// \brief Destructor
- public: virtual ~DummyGui();
-
- public: virtual void Init() {}
- public: virtual void Update();
-
- /// \brief Get the width of the gui's rendering window
- public: unsigned int GetWidth() const { return 1; }
-
- /// \brief Get the height of the gui's rendering window
- public: unsigned int GetHeight() const { return 1; }
-
- /// \brief Handle an event
- public: int handle(int event) { return 0; }
-
- /// \brief Get the id of the window
- public: Window GetWindowId() const;
-
- /// \brief Get the visual info
- public: XVisualInfo *GetVisualInfo() const;
-
- /// \brief Get the display
- public: Display *GetDisplay() const;
-
- /// ID of the window
- protected: Window windowId;
-
- /// Pointer to the Xvisual
- protected: XVisualInfo *visual;
-
- /// pointer to the display
- protected: Display *display;
-
- /// GLX context used to render the scenes
- protected: GLXContext context;
- };
-
-}
-
-#endif
-
-
Modified: code/gazebo/trunk/server/gui/GLWindow.cc
===================================================================
--- code/gazebo/trunk/server/gui/GLWindow.cc 2008-06-13 18:30:03 UTC (rev
6553)
+++ code/gazebo/trunk/server/gui/GLWindow.cc 2008-06-13 20:54:11 UTC (rev
6554)
@@ -25,7 +25,7 @@
*/
#include "CameraSensor.hh"
-#include <X11/keysym.h>
+//#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <FL/Fl_Menu_Item.H>
@@ -64,6 +64,7 @@
this->keys.clear();
+ this->resizable(this);
}
@@ -314,6 +315,12 @@
// Set the type of the event
switch (event)
{
+ // Need FL_FOCUS && FL_UNFOCUS to receive all the KEY_DOWN events
+ case FL_FOCUS:
+ case FL_UNFOCUS:
+ handled = true;
+ break;
+
case FL_ENTER:
case FL_LEAVE:
case FL_DEACTIVATE:
@@ -350,6 +357,9 @@
this->HandleKeyRelease();
handled = true;
break;
+
+ default:
+ break;
}
this->prevMousePos = this->mousePos;
Modified: code/gazebo/trunk/server/gui/Gui.cc
===================================================================
--- code/gazebo/trunk/server/gui/Gui.cc 2008-06-13 18:30:03 UTC (rev 6553)
+++ code/gazebo/trunk/server/gui/Gui.cc 2008-06-13 20:54:11 UTC (rev 6554)
@@ -33,8 +33,6 @@
#include "Global.hh"
#include "Simulator.hh"
-#include "GuiFactory.hh"
-
#include "GLWindow.hh"
#include "MainMenu.hh"
#include "Toolbar.hh"
@@ -43,13 +41,10 @@
using namespace gazebo;
-GZ_REGISTER_STATIC_GUI("fltk", FLTKGui);
-
////////////////////////////////////////////////////////////////////////////////
/// Constructor
-FLTKGui::FLTKGui (int x, int y, int width, int height, const std::string &t)
- : Gui(x,y,width,height, t),
- Fl_Window(x, y, width+200, height+60, t.c_str())
+Gui::Gui (int x, int y, int width, int height, const std::string &t)
+ : Fl_Window(x, y, width+200, height+60, t.c_str())
{
this->windowId = -1;
this->visual = NULL;
@@ -77,7 +72,7 @@
this->visual = this->glWindow->visual;
this->colormap = this->glWindow->colormap;
this->windowId = this->glWindow->windowId;
- this->resizable(this->glWindow);
+ this->resizable(this);
//this->glWindow->UserQuit.connect( &gazebo::Gui::UserQuit);
//this->glWindow->Finished.connect(
boost::bind(&gazebo::Gui::Finished,this));
//MainMenu::Finished.connect( boost::bind(&gazebo::Gui::Finished,this));
@@ -85,7 +80,7 @@
////////////////////////////////////////////////////////////////////////////////
/// Destructor
-FLTKGui::~FLTKGui()
+Gui::~Gui()
{
this->hide();
@@ -97,38 +92,39 @@
////////////////////////////////////////////////////////////////////////////////
/// Initalize the gui
-void FLTKGui::Init()
+void Gui::Init()
{
}
////////////////////////////////////////////////////////////////////////////////
-void FLTKGui::Update()
+void Gui::Update()
{
this->toolbar->Update();
this->statusbar->Update();
this->glWindow->Update();
Fl::check();
- //Fl::wait(0.03);
+ //Fl::wait(0.3);
}
////////////////////////////////////////////////////////////////////////////////
/// Get the width of the gui's rendering window
-unsigned int FLTKGui::GetWidth() const
+unsigned int Gui::GetWidth() const
{
return this->glWindow->w();
}
////////////////////////////////////////////////////////////////////////////////
/// Get the height of the gui's rendering window
-unsigned int FLTKGui::GetHeight() const
+unsigned int Gui::GetHeight() const
{
return this->glWindow->h();
}
////////////////////////////////////////////////////////////////////////////////
/// Handle an event
-int FLTKGui::handle(int event)
+int Gui::handle(int event)
{
+
switch (event)
{
case FL_HIDE:
@@ -141,21 +137,21 @@
////////////////////////////////////////////////////////////////////////////////
/// Get the id of the window
-Window FLTKGui::GetWindowId() const
+Window Gui::GetWindowId() const
{
return this->windowId;
}
////////////////////////////////////////////////////////////////////////////////
/// Get the visual info
-XVisualInfo *FLTKGui::GetVisualInfo() const
+XVisualInfo *Gui::GetVisualInfo() const
{
return this->visual;
}
////////////////////////////////////////////////////////////////////////////////
/// Get the display
-Display *FLTKGui::GetDisplay() const
+Display *Gui::GetDisplay() const
{
return this->display;
}
Modified: code/gazebo/trunk/server/gui/Gui.hh
===================================================================
--- code/gazebo/trunk/server/gui/Gui.hh 2008-06-13 18:30:03 UTC (rev 6553)
+++ code/gazebo/trunk/server/gui/Gui.hh 2008-06-13 20:54:11 UTC (rev 6554)
@@ -38,54 +38,18 @@
namespace gazebo
{
- /// \brief Abstract class describing a generic GUI
- class Gui
- {
-
- /// \brief Constructor
- public: Gui(int x, int y, int w, int h, const std::string &t) { }
-
- /// \brief Destructor
- public: virtual ~Gui() { }
-
- /// \brief Initalize the gui
- public: virtual void Init()=0;
-
- /// \brief Updates the gui
- public: virtual void Update()=0;
-
- /// \brief Get the width of the gui's rendering window
- public: virtual unsigned int GetWidth() const=0;
-
- /// \brief Get the height of the gui's rendering window
- public: virtual unsigned int GetHeight() const=0;
-
- /// \brief Handle an event
- public: virtual int handle(int event)=0;
-
- /// \brief Get the id of the window
- public: virtual Window GetWindowId() const=0;
-
- /// \brief Get the visual info
- public: virtual XVisualInfo *GetVisualInfo() const=0;
-
- /// \brief Get the display
- public: virtual Display *GetDisplay() const=0;
-
- };
-
class GLWindow;
class Toolbar;
class StatusBar;
/// \brief FLTK Main Window
- class FLTKGui : public Gui, public Fl_Window
+ class Gui : public Fl_Window
{
/// \brief Constructor
- public: FLTKGui (int x, int y, int w, int h, const std::string &t);
+ public: Gui (int x, int y, int w, int h, const std::string &t);
/// \brief Destructor
- public: virtual ~FLTKGui();
+ public: virtual ~Gui();
/// \brief Initalize the gui
public: virtual void Init();
Deleted: code/gazebo/trunk/server/gui/GuiFactory.cc
===================================================================
--- code/gazebo/trunk/server/gui/GuiFactory.cc 2008-06-13 18:30:03 UTC (rev
6553)
+++ code/gazebo/trunk/server/gui/GuiFactory.cc 2008-06-13 20:54:11 UTC (rev
6554)
@@ -1,101 +0,0 @@
-/*
- * Gazebo - Outdoor Multi-Robot Simulator
- * Copyright (C) 2003
- * Nate Koenig & Andrew Howard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-/*
- * Desc: Factory for creating guis
- * Author: Nate Koenig
- * Date: 03 Aug 2007
- * SVN info: $Id$
- */
-
-#include "GazeboError.hh"
-#include "GazeboMessage.hh"
-#include "Gui.hh"
-#include "GuiFactory.hh"
-#include "XMLConfig.hh"
-
-using namespace gazebo;
-
-void RegisterFLTKMainWindow();
-
-std::map<std::string, GuiFactoryFn> GuiFactory::guis;
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Register a gui class.
-void GuiFactory::RegisterGui(std::string type, std::string classname,
- GuiFactoryFn factoryfn)
-{
- guis[classname] = factoryfn;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a new instance of a gui.
-Gui *GuiFactory::CreateGui(const std::string &classname, int x, int y, int w,
int h, const std::string &label)
-{
- if (guis[classname])
- {
- return (guis[classname]) (x, y, w, h, label);
- }
- else
- {
- gzthrow("Unable to make a GUI of type " << classname);
- }
-
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Parse the XML config file and load the correct GUI with correct parameters
-Gui* GuiFactory::NewGui(XMLConfigNode *rootNode)
-{
- XMLConfigNode *childNode;
- Gui *gui = NULL;
-
- childNode = rootNode->GetChild("gui");
-
- if (childNode)
- {
- int width = childNode->GetTupleInt("size",0,640);
- int height = childNode->GetTupleInt("size",1,480);
- int x = childNode->GetTupleInt("pos",0,0);
- int y = childNode->GetTupleInt("pos",1,0);
- std::string type = childNode->GetString("type","fltk",1);
-
- gzmsg(1) << "Creating GUI:\n\tType[" << type << "] Pos[" << x << " " << y
<< "] Size[" << width << " " << height << "]\n";
- if (type != "fltk")
- {
- gzthrow("The only GUI available is 'fltk', for no-GUI simulation, delete
the 'gui' tag and its children");
- }
-
- // Create the GUI
- gui = GuiFactory::CreateGui(type, x, y, width, height, type+"::Gazebo");
- }
- else
- {
- // Create a dummy GUI
- gzmsg(1) <<"Creating a dummy GUI";
- gui = GuiFactory::CreateGui(std::string("dummy"), 0, 0, 0, 0,
std::string());
- }
- return gui;
-
-}
-
Deleted: code/gazebo/trunk/server/gui/GuiFactory.hh
===================================================================
--- code/gazebo/trunk/server/gui/GuiFactory.hh 2008-06-13 18:30:03 UTC (rev
6553)
+++ code/gazebo/trunk/server/gui/GuiFactory.hh 2008-06-13 20:54:11 UTC (rev
6554)
@@ -1,81 +0,0 @@
-/*
- * Gazebo - Outdoor Multi-Robot Simulator
- * Copyright (C) 2003
- * Nate Koenig & Andrew Howard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-/*
- * Desc: Factory for creating a gui
- * Author: Andrew Howard
- * Date: 18 May 2003
- * SVN info: $Id$
- */
-
-#ifndef GUIFACTORY_HH
-#define GUIFACTORY_HH
-
-#include <string>
-#include <map>
-#include "StaticPluginRegister.hh"
-
-namespace gazebo
-{
-
- // Forward declarations
- class Gui;
-
- // Prototype for gui factory functions
- typedef Gui* (*GuiFactoryFn) (int x, int y, int w, int h, const std::string
&label);
-
- /// \brief The gui factory
- class GuiFactory
- {
-
- /// \brief Register a gui class (called by gui registration function).
- public: static void RegisterGui(std::string type, std::string classname,
- GuiFactoryFn factoryfn);
-
- /// \brief Create a new instance of a gui.
- public: static Gui *CreateGui(const std::string &classname, int x, int y,
int w, int h, const std::string &label);
-
- /// \brief Read from XML the correct gui configuration and create it
- public: static Gui *NewGui(XMLConfigNode *rootNode);
-
- /// \brief A list of registered classes
- private: static std::map<std::string, GuiFactoryFn> guis;
- };
-
-
- /// \brief Static gui registration macro
- ///
- /// Use this macro to register guis with the server.
- /// \param name Gui type name, as it appears in the world file.
- /// \param classname C++ class name for the gui.
-#define GZ_REGISTER_STATIC_GUI(name, classname) \
- Gui *New##classname(int x, int y, int w, int h, const std::string &label) \
- { \
- return new classname(x, y, w, h, label); \
- } \
- void Register##classname() \
- {\
- GuiFactory::RegisterGui("static", name, New##classname);\
- }\
- StaticPluginRegister Registered##classname (Register##classname);
-
-}
-
-#endif
Modified: code/gazebo/trunk/server/gui/SConscript
===================================================================
--- code/gazebo/trunk/server/gui/SConscript 2008-06-13 18:30:03 UTC (rev
6553)
+++ code/gazebo/trunk/server/gui/SConscript 2008-06-13 20:54:11 UTC (rev
6554)
@@ -6,13 +6,18 @@
#env = Environment()
#conf = Configure(env)
#if conf.CheckCHeader('GL/glx.h'):
-sources = Split('Gui.cc DummyGui.cc GuiFactory.cc GLWindow.cc MainMenu.cc
Toolbar.cc StatusBar.cc')
+sources = ['Gui.cc',
+ 'GLWindow.cc',
+ 'MainMenu.cc',
+ 'Toolbar.cc',
+ 'StatusBar.cc'
+ ]
+
#env = conf.Finish()
headers.append(
- ['server/gui/DummyGui.hh',
+ [
'server/gui/GLWindow.hh',
- 'server/gui/GuiFactory.hh',
'server/gui/Gui.hh',
'server/gui/MainMenu.hh',
'server/gui/StatusBar.hh',
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit