Index: orxonox/trunk/src/gui/orxonox_gui_flags.cc
===================================================================
--- orxonox/trunk/src/gui/orxonox_gui_flags.cc	(revision 3191)
+++ orxonox/trunk/src/gui/orxonox_gui_flags.cc	(revision 3423)
@@ -28,20 +28,25 @@
 /**
    \brief Creates the Flags-Frame
-   \param widget The Widget from which the data will be parsed
 */
-OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)
+OrxonoxGuiFlags::OrxonoxGuiFlags(void)
 {
-  flagText = (char*) malloc (1024);
+  this->flagsFrame = new Frame("Orxonox-Startup-Flags:");
+  this->flagsBox = new Box('v');
 
-  flagsFrame = new Frame ("Orxonox-Startup-Flags:");
-  flagsBox = new Box ('v');
+  this->flagsLabel = new Label();
+  this->flagsLabel->setSize(260,60);
+  this->flagsBox->fill(flagsLabel);
+  this->shortFlags = new CheckButton("shortFlags");
+  this->flagsBox->fill(shortFlags);
 
-  flagsLabel = new Label ();
-  flagsLabel->setSize (260,60);
-  flagsBox->fill (flagsLabel);
-  shortFlags = new CheckButton ("shortFlags");
-  flagsBox->fill (shortFlags);
+  this->flagsFrame->fill(flagsBox);
+}
 
-  flagsFrame->fill (flagsBox);
+/**
+   \brief Destructs the Flags-stuff
+*/
+OrxonoxGuiFlags::~OrxonoxGuiFlags(void)
+{
+  // nothing to do here
 }
 
@@ -50,7 +55,7 @@
    \returns Frame that holds the Flagtext.
 */
-Widget* OrxonoxGuiFlags::getWidget ()
+Widget* OrxonoxGuiFlags::getWidget(void)
 {
-  return flagsFrame;
+  return this->flagsFrame;
 }
 
@@ -59,10 +64,14 @@
    \param widget the Widget from which on to scan for deeper Options and their settings.
 */
-void OrxonoxGuiFlags::setTextFromFlags (Widget* widget)
+void OrxonoxGuiFlags::setTextFromFlags(Widget* widget)
 {
-  sprintf (flagText, "");
-  strcat (flagText, "orxonox");
-  FlagsText (widget);
-  flagsLabel->setText (flagText);
+  FlagInfo flagInfo;
+  flagInfo.shortFlags = this->shortFlags;
+  flagInfo.flagsLabel = this->flagsLabel;
+
+  this->flagsLabel->ereaseText();
+  this->flagsLabel->appendText("orxonox");
+  widget->walkThrough(OrxonoxGuiFlags::flagsText, &flagInfo, 0);
+  //  flagsLabel->setTitle(flagText);
 }
 
@@ -70,36 +79,28 @@
     \brief this actually sets the flagtext, and appends it to flagText
     \param widget like OrxonoxGuiFlags::setTextFromFlags(widget)
+    \param flagInfo Information aboout the Flag that should be updated.
 */
-void OrxonoxGuiFlags::FlagsText(Widget* widget)
+void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo)
 {
-  if (widget->isOption >= 1)
-    if  (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue && (static_cast<Option*>(widget)->flagName || static_cast<Option*>(widget)->flagNameShort ))
+  FlagInfo* info =(FlagInfo*)flagInfo;
+  if(widget->isOption >= 1)
+    if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
       {
-	if (shortFlags->isActive())
+	if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort)
 	  {
-	    strcat (flagText, " -");
-	    strcat (flagText, static_cast<Option*>(widget)->flagNameShort);
+	    info->flagsLabel->appendText(" -");
+	    info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort);
 	  }
-	else
+	else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName)
 	  {
-	    strcat (flagText, " --");
-	    strcat (flagText, static_cast<Option*>(widget)->flagName);
+	    info->flagsLabel->appendText(" --");
+	    info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName);
 	  }
-	if (static_cast<Option*>(widget)->isOption == 2)
+
+	if(static_cast<Option*>(widget)->isOption == 2)
 	  {
-	    sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value);
+	    info->flagsLabel->appendText("=");
+	    info->flagsLabel->appendInt(static_cast<Option*>(widget)->value);
 	  }
       }
-  switch (widget->isOption)
-    {
-    case -1:
-      FlagsText (static_cast<Container*>(widget)->down);
-      break;
-    case -2:
-      FlagsText (static_cast<Box*>(widget)->down);
-      break;
-    } 
-  
-  if (widget->next != NULL)
-    FlagsText (widget->next);
 }
