Changeset 2615 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Oct 22, 2004, 1:30:23 AM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui_exec.cc
r2614 r2615 110 110 CONFIG_FILE = fopen (configFile, "w"); 111 111 if (CONFIG_FILE) 112 writeFileText (widget );112 writeFileText (widget, 0); 113 113 fclose (CONFIG_FILE); 114 114 } … … 117 117 \brief Actually writes into the configuration file to the disk. 118 118 \param widget from which Widget on should be saved. 119 */ 120 void OrxonoxGuiExec::writeFileText (Widget* widget) 121 { 119 \param depth initially "0", and grows higher, while new Groups are bundeled. 120 */ 121 void OrxonoxGuiExec::writeFileText (Widget* widget, int depth) 122 { 123 int counter = 0; 124 while (counter < depth && ((widget->is_option>0 125 && (strcmp (static_cast<Option*>(widget)->flag_name, "") 126 || strcmp (static_cast<Option*>(widget)->flag_name_short, "")) ) 127 || (widget->is_option<0 128 && strcmp (static_cast<Packer*>(widget)->getGroupName(), "")))) 129 { 130 fprintf (CONFIG_FILE, " ", depth); 131 counter++; 132 } 133 134 // check if it is a Packer, and if it is, check if it has a name and if there is something in it. 122 135 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 136 { 137 if (strcmp (static_cast<Packer*>(widget)->getGroupName(), "")) 138 { 139 fprintf (CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName()); 140 writeFileText (static_cast<Packer*>(widget)->down, depth+1); 141 } 142 else 143 { 144 writeFileText (static_cast<Packer*>(widget)->down, depth); 145 } 146 } 147 126 148 if (widget->is_option >= 1) 127 149 if (strcmp (static_cast<Option*>(widget)->flag_name, "") || strcmp (static_cast<Option*>(widget)->flag_name_short, "")) … … 138 160 fprintf (CONFIG_FILE, "%s = %i\n", Buffer, static_cast<Option*>(widget)->value); 139 161 } 140 if (widget->is_option<0) 141 { 142 writeFileText (static_cast<Packer*>(widget)->down); 143 } 144 162 145 163 if (widget->next != NULL) 146 writeFileText (widget->next );164 writeFileText (widget->next, depth); 147 165 } 148 166 -
orxonox/trunk/gui/orxonox_gui_exec.h
r2595 r2615 33 33 int shouldsave (); 34 34 void writeToFile (Widget* widget); 35 void writeFileText (Widget* widget );35 void writeFileText (Widget* widget, int depth); 36 36 void readFromFile (Widget* widget); 37 37 void readFileText (Widget* widget, char* variableName, int variableValue);
Note: See TracChangeset
for help on using the changeset viewer.