Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3295 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Dec 26, 2004, 8:06:06 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/updater: parsing argv's works now. But no events can be handled, like gui-quit, autoupdate and so on.

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

Legend:

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

    r3292 r3295  
    101101  exec->setFilename ("~/.orxonox.conf");
    102102  exec->readFromFile (orxonoxGUI);
     103  for (int optCount = 1; optCount < argc; optCount++)
     104    orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0);
    103105
    104106  orxonoxGUI->showall ();
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc

    r3294 r3295  
    207207  if (widget->isOption >= 1)
    208208    static_cast<Option*>(widget)->redraw();
     209}
     210
     211/**
     212   \brief Walks through all the Flags given at startuptime.
     213*/
     214void Widget::flagCheck(Widget* widget, void* flagName)
     215{
     216  if (widget->isOption>=1)
     217    {     
     218      Option* option = (Option*)widget;
     219      char* name = (char*)flagName;
     220      char* value = NULL;
     221      bool found = false;
     222      // check if long flag matches
     223      if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) && (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
     224        {
     225          found = true;
     226          if (name[strlen(option->flagName)+2] == '=')
     227            {
     228              value = name+strlen(option->flagName)+3;
     229            }
     230        }
     231      else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&& (name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches
     232        {
     233          found = true;
     234          if (name[strlen(option->flagNameShort)+1] == '=')
     235            {
     236              value = name+strlen(option->flagNameShort)+2;
     237            }     
     238        }
     239
     240      if (found)
     241        {
     242          PRINT(3)("found matching Flag %s\n", name);
     243          if (value)
     244            {
     245              PRINT(3)("with Value %s\n", value);
     246              option->value = atoi(value);
     247            }
     248          else
     249            {
     250              option->value = !option->defaultValue;
     251            }
     252          option->redraw();
     253        }
     254
     255    }
    209256}
    210257
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.h

    r3292 r3295  
    5555  void walkThrough (void (*function)(Widget*), unsigned int depth);
    5656  void walkThrough (void (*function)(Widget*, void*), void* data, unsigned int depth);
    57   static void listOptions (Widget* widget);
    58   static void setOptions (Widget* widget);
     57  static void listOptions(Widget* widget);
     58  static void setOptions(Widget* widget);
     59  static void flagCheck(Widget* widget, void* flagName);
    5960 
    6061#ifdef HAVE_GTK2
Note: See TracChangeset for help on using the changeset viewer.