Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2614 in orxonox.OLD


Ignore:
Timestamp:
Oct 22, 2004, 12:52:33 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: added simple config-file stuffing. (only save needs it now, load still has to do it)

Location:
orxonox/trunk/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/gui/orxonox_gui.cc

    r2613 r2614  
    236236}
    237237
     238/**
     239   \brief Sets the group name under which all the lower widgets of this will be saved.
     240   \param name The name of the group.
     241*/
     242void Packer::setGroupName (char* name)
     243{
     244  groupName = name;
     245}
     246
     247/**
     248   \brief Retrieves the group name under which all the lower widgets of this will be saved.
     249   \returns name The name of the group.
     250*/
     251char* Packer::getGroupName (void)
     252{
     253  return groupName;
     254}
     255
    238256/* CONTAINERS */
    239257
     
    293311  is_option = -1;
    294312  label = "";
     313  this->setGroupName ("");
    295314  next = NULL;
    296315  down = NULL;
     
    365384  is_option = -1;
    366385  label = "";
     386  this->setGroupName("");
    367387  next = NULL;
    368388  down = NULL;
     
    408428  is_option = -1;
    409429  label = "eventBox";
     430  this->setGroupName("");
    410431  next = NULL;
    411432  down = NULL;
     
    451472  is_option = -2;
    452473  label = "box";
     474  this->setGroupName("");
    453475  next = NULL;
    454476  down = NULL;
  • orxonox/trunk/gui/orxonox_gui.h

    r2605 r2614  
    6868 public:
    6969  Widget* down; //!< this points to the Widget below this.
    70 
    71   void init(void);
     70  char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved.
     71
     72  void init(void);
     73  void setGroupName (char* name);
     74  char* getGroupName (void);
    7275};
    7376
  • orxonox/trunk/gui/orxonox_gui_audio.cc

    r2595 r2614  
    3333  audioFrame = new Frame ("Audio-Options:");
    3434  audioBox = new Box ('v');
     35  audioFrame->setGroupName ("audio");
    3536 
    3637  enableSound = new CheckButton ("Disable Sound");
  • orxonox/trunk/gui/orxonox_gui_exec.cc

    r2605 r2614  
    3838  execFrame = new Frame ("Execute-Tags:");
    3939  execBox = new Box ('v');
     40  execFrame->setGroupName ("misc");
    4041 
    4142  start = new Button ("Start");
     
    119120void OrxonoxGuiExec::writeFileText (Widget* widget)
    120121{
     122  if (widget->is_option <0)
     123    if (strcmp (static_cast<Packer*>(widget)->getGroupName(), ""))
     124      fprintf (CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName());
     125
    121126  if (widget->is_option >= 1)
    122127    if  (strcmp (static_cast<Option*>(widget)->flag_name, "") || strcmp (static_cast<Option*>(widget)->flag_name_short, ""))
     
    126131        sprintf (Buffer, "%s", static_cast<Option*>(widget)->label);
    127132        if (strchr (Buffer, '_'))
    128           cout << "Warning Optionname" << Buffer << " is not Valid for Saving, because it includes an underscore" << endl; 
     133          cout << "Warning Optionname" << Buffer << " is not Valid for Saving, because it includes an underscore" << endl;
    129134        while (space2under = strchr(Buffer, ' '))
    130135          {
     
    133138        fprintf (CONFIG_FILE, "%s = %i\n", Buffer, static_cast<Option*>(widget)->value);
    134139      }
    135   switch (widget->is_option)
     140  if (widget->is_option<0)
    136141    {
    137     case -1:
    138       writeFileText (static_cast<Container*>(widget)->down);
    139       break;
    140     case -2:
    141       writeFileText (static_cast<Box*>(widget)->down);
    142       break;
     142      writeFileText (static_cast<Packer*>(widget)->down);
    143143    }
    144144 
  • orxonox/trunk/gui/orxonox_gui_video.cc

    r2595 r2614  
    3232  videoFrame = new Frame ("Video-Options:");
    3333  videoBox = new Box ('v');
     34  videoFrame->setGroupName("video");
    3435 
    3536  fullscreen = new CheckButton ("Fullscreen-mode");
Note: See TracChangeset for help on using the changeset viewer.