/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ### File Specific: main-programmer: Benjamin Grauer */ #include "orxonox_gui_flags.h" #include /** \brief Creates the Flags-Frame \param widget The Widget from which the data will be parsed */ OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget) { flagText = (char*) malloc (1024); flagsFrame = new Frame ("Orxonox-Startup-Flags:"); flagsBox = new Box ('v'); flagsLabel = new Label (); flagsLabel->setSize (260,60); flagsBox->fill (flagsLabel); shortFlags = new CheckButton ("shortFlags"); flagsBox->fill (shortFlags); flagsFrame->fill (flagsBox); } /** \brief Function to return the Frame that holds the Flagtext. \returns Frame that holds the Flagtext. */ Widget* OrxonoxGuiFlags::getWidget () { return flagsFrame; } /** \brief Sets the Flags from widget downwards. \param widget the Widget from which on to scan for deeper Options and their settings. */ void OrxonoxGuiFlags::setTextFromFlags (Widget* widget) { sprintf (flagText, ""); strcat (flagText, "orxonox"); FlagsText (widget); flagsLabel->setText (flagText); } /** \brief this actually sets the flagtext, and appends it to flagText \param widget like OrxonoxGuiFlags::setTextFromFlags(widget) */ void OrxonoxGuiFlags::FlagsText(Widget* widget) { if (widget->is_option >= 1) if (static_cast(widget)->value != static_cast(widget)->default_value && (strcmp (static_cast(widget)->flag_name, "") || strcmp (static_cast(widget)->flag_name_short, ""))) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(shortFlags->widget))) { strcat (flagText, " -"); strcat (flagText, static_cast(widget)->flag_name_short); } else { strcat (flagText, " --"); strcat (flagText, static_cast(widget)->flag_name); } if (static_cast(widget)->is_option == 2) { sprintf (flagText, "%s=%i", flagText, static_cast(widget)->value); } } switch (widget->is_option) { case -1: FlagsText (static_cast(widget)->down); break; case -2: FlagsText (static_cast(widget)->down); break; } if (widget->next != NULL) FlagsText (widget->next); }