Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3300 in orxonox.OLD for orxonox/branches/updater/src


Ignore:
Timestamp:
Dec 27, 2004, 4:14:47 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/updater: implemented a new SignalHandler, signals for starting and quiting the Gui are now located in OrxonoxGuiExec.
Now thinking about a way to pass options to Orxonox (so the GUI really makes sense)

Location:
orxonox/branches/updater/src/gui
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui.cc

    r3298 r3300  
    6363
    6464  orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION);
    65 #ifdef HAVE_GTK2
    66   orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit);
    67   orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit);
    68 #endif /* HAVE_GTK2 */
    6965 
    7066  Box* windowBox = new Box ('h');
     
    108104    orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0);
    109105
     106
    110107  orxonoxGUI->showall ();
    111108
  • orxonox/branches/updater/src/gui/orxonox_gui.h

    r3299 r3300  
    2828  ~OrxonoxGui ();
    2929
    30   void copyOptionsToGameStruct();
    3130};
    3231
    33 
    3432#endif /* _ORXONOX_GUI_H */
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.cc

    r3297 r3300  
    2727#include <iostream>
    2828#include <string>
     29
     30HashTable* orxonoxFlagHash;
    2931
    3032/**
     
    4244  start = new Button ("Start");
    4345#ifdef HAVE_GTK2
    44   start->connectSignal ("clicked", startOrxonox);
     46  start->connectSignal ("clicked", this, startOrxonox);
    4547#endif /* HAVE_GTK2 */
    4648  execBox->fill (start);
     
    5961  quit = new Button ("Quit");
    6062#ifdef HAVE_GTK2
    61   quit->connectSignal ("clicked", orxonoxGUI->orxonox_gui_quit);
     63  quit->connectSignal ("clicked", this, OrxonoxGuiExec::quitOrxonox);
     64  orxonoxGUI->connectSignal ("destroy", this, OrxonoxGuiExec::quitOrxonox);
     65  //! orxonoxGUI->connectSignal ("delete_event", this, OrxonoxGuiExec::quitOrxonox); \todo fix this to work.
    6266#endif /* HAVE_GTK2 */
    6367  execBox->fill (quit);
     
    294298/**
    295299   \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
    296    This is a Signal and can be executed through Widget::signal_connect
    297300   \param widget the widget that executed the start command
    298301   \param data additional data
    299 */
    300 int OrxonoxGuiExec::startOrxonox (GtkWidget* widget, Widget* data)
    301 {
     302
     303   This is a Signal and can be executed through Widget::signal_connect
     304*/
     305int OrxonoxGuiExec::startOrxonox (GtkWidget* widget, void* data)
     306{
     307  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     308  if (exec->shouldsave())
     309    exec->writeToFile (Window::mainWindow);
    302310  cout << "Starting Orxonox" <<endl;
    303 }
    304 #else /* HAVE_GTK2 */
     311  gtk_main_quit();
     312  system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real (coded not over the shell)
     313}
     314
    305315/**
    306316   \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
    307    This is a Signal and can be executed through Widget::signal_connect
    308317   \param widget the widget that executed the start command
    309318   \param data additional data
    310 */
    311 int OrxonoxGuiExec::startOrxonox (void* widget, Widget* data)
    312 {
    313   cout << "Starting Orxonox" <<endl;
     319
     320   This is a Signal and can be executed through Widget::signal_connect
     321*/
     322int OrxonoxGuiExec::quitOrxonox (GtkWidget* widget, void* data)
     323{
     324  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     325  PRINT(3)( "Quitting Orxonox %p\n", exec);
     326  if (exec->shouldsave())
     327    exec->writeToFile (Window::mainWindow);
     328  gtk_main_quit();
     329}
     330#else /* HAVE_GTK2 */
     331/**
     332   \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
     333   \param widget the widget that executed the start command
     334   \param data additional data
     335*/
     336int OrxonoxGuiExec::startOrxonox (void* widget, void* data)
     337{
     338  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     339  COUT(3) << "Starting Orxonox" <<endl;
     340  if (exec->shouldsave())
     341    exec->writeToFile (Window::mainWindow);
     342}
     343/**
     344   \brief Quits ORXONOX.
     345   \param widget the widget that executed the Quit command
     346   \param data additional data
     347
     348   This is a Signal and can be executed through Widget::signal_connect
     349*/
     350int OrxonoxGuiExec::quitOrxonox (void* widget, void* data)
     351{
     352  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     353  COUT(3) << "Quiting Orxonox" <<endl;
     354  if (exec->shouldsave())
     355    exec->writeToFile (Window::mainWindow);
    314356}
    315357
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.h

    r3297 r3300  
    4848
    4949#ifdef HAVE_GTK2
    50   static int startOrxonox (GtkWidget *widget, Widget* data);
     50  static int startOrxonox (GtkWidget *widget, void* data);
     51  static int quitOrxonox (GtkWidget *widget, void* data);
    5152#else /* HAVE_GTK2 */
    52   static int startOrxonox (void* widget, Widget* data);
     53  static int startOrxonox (void* widget, void* data);
     54  static int quitOrxonox (void* widget, void* data);
    5355#endif /* HAVE_GTK2 */
    5456};
     57
     58
     59struct HashTable
     60{
     61  char* name;
     62  char* value;
     63  HashTable* next;
     64};
     65
     66
    5567#endif /* _ORXONOX_GUI_EXEC_H */
  • orxonox/branches/updater/src/gui/orxonox_gui_flags.cc

    r3299 r3300  
    7272    \brief this actually sets the flagtext, and appends it to flagText
    7373    \param widget like OrxonoxGuiFlags::setTextFromFlags(widget)
     74    \param flagInfo Information aboout the Flag that should be updated.
    7475*/
    7576void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo)
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc

    r3299 r3300  
    3434// temporarily.
    3535#include "orxonox_gui_flags.h"
    36 #include "orxonox_gui_exec.h"
    3736extern Window* orxonoxGUI;
    3837extern OrxonoxGuiFlags* flags;
    39 extern OrxonoxGuiExec* exec;
    4038
    4139#ifdef HAVE_GTK2
     
    306304   \brief Connect a signal with additionally passing a whole external Object
    307305*/
     306gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, void *))
     307{
     308  return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
     309}
     310
     311/**
     312   \brief Connect a signal with additionally passing a whole external Object
     313*/
    308314gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *))
    309315{
     
    615621}
    616622
    617 /**
    618  * Quits the orxonox_GUI.
    619  * This can be called as a Signal and is therefor static
    620  \param widget The widget that called this function
    621  \param event the event that happened to execute this function
    622  \param data some data passed with the Signal
    623  */
    624 gint Window::orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data)
    625 {
    626   if (exec->shouldsave())
    627     exec->writeToFile (Window::mainWindow);
    628 
    629   gtk_main_quit();
    630   return FALSE;
    631 }
    632623#endif /* HAVE_GTK2 */
    633624
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.h

    r3299 r3300  
    6666  gulong connectSignal (char* event, gint (*signal)(GtkWidget*, Widget* ));
    6767  gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void* ));
     68  gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, void* ));
    6869  gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void* ));
    6970  void disconnectSignal (gulong signalID);
     
    149150  static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window);
    150151  static gint windowClose(GtkWidget* widget, GdkEvent* event, void* window);
    151   static gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data);
    152152#endif /* HAVE_GTK2 */
    153153};
Note: See TracChangeset for help on using the changeset viewer.