Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3296 in orxonox.OLD


Ignore:
Timestamp:
Dec 26, 2004, 11:07:25 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: now the GUI just opens the first time, and the seccond time only if requested by —gui.

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

Legend:

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

    r3295 r3296  
    2323
    2424*/
     25
     26#include <unistd.h>
    2527
    2628#include "orxonox_gui.h"
     
    99101  flags->setTextFromFlags (orxonoxGUI);
    100102
     103  // Reading Values from File
    101104  exec->setFilename ("~/.orxonox.conf");
    102105  exec->readFromFile (orxonoxGUI);
     106  // Merging changes to the Options from appended flags.
    103107  for (int optCount = 1; optCount < argc; optCount++)
    104108    orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0);
     
    106110  orxonoxGUI->showall ();
    107111
    108  
     112  // Handling special Cases.
     113  if (!access(exec->getConfigFile(), F_OK) && static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0)
     114    OrxonoxGuiExec::startOrxonox(NULL, NULL);
     115  else
     116    {
    109117#ifdef HAVE_GTK2
    110118  mainloopGTK();
     
    118126  if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave())
    119127    exec->writeToFile (Window::mainWindow);
    120  
     128    
    121129#endif /* HAVE_GTK2 */
    122 
     130    }
    123131}
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.cc

    r3294 r3296  
    7878
    7979/**
    80    \brief Sets the location of the configuration File.\n
    81    * The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows
     80   \brief Sets the location of the configuration File.
    8281   \param filename the location of the configFile
     82
     83   The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows
    8384*/
    8485void OrxonoxGuiExec::setFilename (char* filename)
     
    9798    sprintf(configFile, "%s", buffer);
    9899  delete buffer;
     100}
     101
     102/**
     103   \returns The name of the Configuration-File
     104*/
     105char* OrxonoxGuiExec::getConfigFile(void)
     106{
     107  return configFile;
    99108}
    100109
     
    289298   \param data additional data
    290299*/
    291 gint startOrxonox (GtkWidget *widget, Widget* data)
     300gint OrxonoxGuiExec::startOrxonox (GtkWidget *widget, Widget* data)
    292301{
    293302  cout << "Starting Orxonox" <<endl;
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.h

    r3292 r3296  
    3939 
    4040  void setFilename (char* filename);
    41   int shouldsave ();
     41  char* getConfigFile(void);
     42  int shouldsave();
    4243  void writeToFile (Widget* widget);
    4344  void writeFileText (Widget* widget, int depth);
     
    4647  Widget* locateGroup(Widget* widget, char* groupName, int depth);
    4748
     49#ifdef HAVE_GTK2
     50  static gint startOrxonox (GtkWidget *widget, Widget* data);
     51#endif /* HAVE_GTK2 */
    4852};
    49 #ifdef HAVE_GTK2
    50   gint startOrxonox (GtkWidget *widget, Widget* data);
    51 #endif /* HAVE_GTK2 */
    5253#endif /* _ORXONOX_GUI_EXEC_H */
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc

    r3295 r3296  
    149149  gtk_widget_set_usize (this->widget, width, height);
    150150#endif /* HAVE_GTK2 */
     151}
     152
     153/**
     154   \brief searches through widgets for a Name.
     155*/
     156Widget* Widget::findWidgetByName(char* name, unsigned int depth)
     157{
     158  Widget* tmp = NULL;
     159  if (this->title && !strcmp(this->title, name))
     160    return this;
     161
     162  if (this->isOption < 0 && static_cast<Packer*>(this)->down)
     163    tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1);
     164  if (tmp)
     165    return tmp;
     166
     167 
     168  if (depth>0 && this->next)
     169    return this->next->findWidgetByName(name, depth);
     170
     171  return NULL;
    151172}
    152173
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.h

    r3295 r3296  
    5353  virtual void setTitle(char* title) = 0;  //!< An abstract Function, that sets the title of Widgets.
    5454
     55  Widget* findWidgetByName(char* name, unsigned int depth);
    5556  void walkThrough (void (*function)(Widget*), unsigned int depth);
    5657  void walkThrough (void (*function)(Widget*, void*), void* data, unsigned int depth);
Note: See TracChangeset for help on using the changeset viewer.