Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3423 in orxonox.OLD for orxonox/trunk/src/gui/orxonox_gui_flags.cc


Ignore:
Timestamp:
Feb 27, 2005, 7:11:19 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/updater back into the trunk
merged with command: svn merge branches/updater trunk -r 3241:HEAD
resolved conflicts in debug.h in favor of the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/gui/orxonox_gui_flags.cc

    r3158 r3423  
    2828/**
    2929   \brief Creates the Flags-Frame
    30    \param widget The Widget from which the data will be parsed
    3130*/
    32 OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)
     31OrxonoxGuiFlags::OrxonoxGuiFlags(void)
    3332{
    34   flagText = (char*) malloc (1024);
     33  this->flagsFrame = new Frame("Orxonox-Startup-Flags:");
     34  this->flagsBox = new Box('v');
    3535
    36   flagsFrame = new Frame ("Orxonox-Startup-Flags:");
    37   flagsBox = new Box ('v');
     36  this->flagsLabel = new Label();
     37  this->flagsLabel->setSize(260,60);
     38  this->flagsBox->fill(flagsLabel);
     39  this->shortFlags = new CheckButton("shortFlags");
     40  this->flagsBox->fill(shortFlags);
    3841
    39   flagsLabel = new Label ();
    40   flagsLabel->setSize (260,60);
    41   flagsBox->fill (flagsLabel);
    42   shortFlags = new CheckButton ("shortFlags");
    43   flagsBox->fill (shortFlags);
     42  this->flagsFrame->fill(flagsBox);
     43}
    4444
    45   flagsFrame->fill (flagsBox);
     45/**
     46   \brief Destructs the Flags-stuff
     47*/
     48OrxonoxGuiFlags::~OrxonoxGuiFlags(void)
     49{
     50  // nothing to do here
    4651}
    4752
     
    5055   \returns Frame that holds the Flagtext.
    5156*/
    52 Widget* OrxonoxGuiFlags::getWidget ()
     57Widget* OrxonoxGuiFlags::getWidget(void)
    5358{
    54   return flagsFrame;
     59  return this->flagsFrame;
    5560}
    5661
     
    5964   \param widget the Widget from which on to scan for deeper Options and their settings.
    6065*/
    61 void OrxonoxGuiFlags::setTextFromFlags (Widget* widget)
     66void OrxonoxGuiFlags::setTextFromFlags(Widget* widget)
    6267{
    63   sprintf (flagText, "");
    64   strcat (flagText, "orxonox");
    65   FlagsText (widget);
    66   flagsLabel->setText (flagText);
     68  FlagInfo flagInfo;
     69  flagInfo.shortFlags = this->shortFlags;
     70  flagInfo.flagsLabel = this->flagsLabel;
     71
     72  this->flagsLabel->ereaseText();
     73  this->flagsLabel->appendText("orxonox");
     74  widget->walkThrough(OrxonoxGuiFlags::flagsText, &flagInfo, 0);
     75  //  flagsLabel->setTitle(flagText);
    6776}
    6877
     
    7079    \brief this actually sets the flagtext, and appends it to flagText
    7180    \param widget like OrxonoxGuiFlags::setTextFromFlags(widget)
     81    \param flagInfo Information aboout the Flag that should be updated.
    7282*/
    73 void OrxonoxGuiFlags::FlagsText(Widget* widget)
     83void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo)
    7484{
    75   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 ))
     85  FlagInfo* info =(FlagInfo*)flagInfo;
     86  if(widget->isOption >= 1)
     87    if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
    7788      {
    78         if (shortFlags->isActive())
     89        if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort)
    7990          {
    80             strcat (flagText, " -");
    81             strcat (flagText, static_cast<Option*>(widget)->flagNameShort);
     91            info->flagsLabel->appendText(" -");
     92            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort);
    8293          }
    83         else
     94        else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName)
    8495          {
    85             strcat (flagText, " --");
    86             strcat (flagText, static_cast<Option*>(widget)->flagName);
     96            info->flagsLabel->appendText(" --");
     97            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName);
    8798          }
    88         if (static_cast<Option*>(widget)->isOption == 2)
     99
     100        if(static_cast<Option*>(widget)->isOption == 2)
    89101          {
    90             sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value);
     102            info->flagsLabel->appendText("=");
     103            info->flagsLabel->appendInt(static_cast<Option*>(widget)->value);
    91104          }
    92105      }
    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);
    105106}
Note: See TracChangeset for help on using the changeset viewer.