Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 27, 2004, 2:02:11 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: flags now working perfectly. not the fastest way to implement this, but still….

File:
1 edited

Legend:

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

    r3287 r3299  
    3232OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)
    3333{
    34   flagText = (char*) malloc (1024);
     34  this->flagsFrame = new Frame ("Orxonox-Startup-Flags:");
     35  this->flagsBox = new Box ('v');
    3536
    36   flagsFrame = new Frame ("Orxonox-Startup-Flags:");
    37   flagsBox = new Box ('v');
     37  this->flagsLabel = new Label ();
     38  this->flagsLabel->setSize (260,60);
     39  this->flagsBox->fill (flagsLabel);
     40  this->shortFlags = new CheckButton ("shortFlags");
     41  this->flagsBox->fill (shortFlags);
    3842
    39   flagsLabel = new Label ();
    40   flagsLabel->setSize (260,60);
    41   flagsBox->fill (flagsLabel);
    42   shortFlags = new CheckButton ("shortFlags");
    43   flagsBox->fill (shortFlags);
    44 
    45   flagsFrame->fill (flagsBox);
     43  this->flagsFrame->fill (flagsBox);
    4644}
    4745
     
    5250Widget* OrxonoxGuiFlags::getWidget ()
    5351{
    54   return flagsFrame;
     52  return this->flagsFrame;
    5553}
    5654
     
    6159void OrxonoxGuiFlags::setTextFromFlags (Widget* widget)
    6260{
    63   sprintf (flagText, "");
    64   strcat (flagText, "orxonox");
    65   FlagsText (widget);
    66   flagsLabel->setTitle(flagText);
     61  FlagInfo flagInfo;
     62  flagInfo.shortFlags = this->shortFlags;
     63  flagInfo.flagsLabel = this->flagsLabel;
     64
     65  this->flagsLabel->ereaseText();
     66  this->flagsLabel->appendText("orxonox");
     67  widget->walkThrough(OrxonoxGuiFlags::flagsText, &flagInfo, 0);
     68  //  flagsLabel->setTitle(flagText);
    6769}
    6870
     
    7173    \param widget like OrxonoxGuiFlags::setTextFromFlags(widget)
    7274*/
    73 void OrxonoxGuiFlags::FlagsText(Widget* widget)
     75void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo)
    7476{
     77  FlagInfo* info = (FlagInfo*)flagInfo;
    7578  if (widget->isOption >= 1)
    76     if  (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue && (static_cast<Option*>(widget)->flagName || static_cast<Option*>(widget)->flagNameShort ))
     79    if  (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
    7780      {
    78         if (shortFlags->isActive())
     81        if (info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort)
    7982          {
    80             strcat (flagText, " -");
    81             strcat (flagText, static_cast<Option*>(widget)->flagNameShort);
     83            info->flagsLabel->appendText(" -");
     84            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort);
    8285          }
    83         else
     86        else if (!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName)
    8487          {
    85             strcat (flagText, " --");
    86             strcat (flagText, static_cast<Option*>(widget)->flagName);
     88            info->flagsLabel->appendText(" --");
     89            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName);
    8790          }
     91
    8892        if (static_cast<Option*>(widget)->isOption == 2)
    8993          {
    90             sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value);
     94            info->flagsLabel->appendText("=");
     95            info->flagsLabel->appendInt(static_cast<Option*>(widget)->value);
    9196          }
    9297      }
    93   switch (widget->isOption)
    94     {
    95     case -1:
    96       FlagsText (static_cast<Container*>(widget)->down);
    97       break;
    98     case -2:
    99       FlagsText (static_cast<Box*>(widget)->down);
    100       break;
    101     }
    102  
    103   if (widget->next != NULL)
    104     FlagsText (widget->next);
    10598}
Note: See TracChangeset for help on using the changeset viewer.