Changeset 2634 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Oct 23, 2004, 9:14:22 PM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui_exec.cc
r2625 r2634 175 175 if (CONFIG_FILE) 176 176 { 177 Widget* groupWidget = widget; 177 178 char Buffer[256] = ""; 178 179 char Variable[256]= ""; … … 180 181 while (fscanf (CONFIG_FILE, "%s", Buffer) != EOF) 181 182 { 183 if (!strncmp (Buffer, "[", 1)) 184 { 185 if ((groupWidget = locateGroup (widget, Buffer, 1))==NULL) 186 { 187 cout << "the input " << Buffer << "does not belong to any group\n"; 188 groupWidget = widget; 189 } 190 } 182 191 if (!strcmp (Buffer, "=")) 183 192 { … … 190 199 fscanf (CONFIG_FILE, "%s", Buffer); 191 200 Value = atoi(Buffer); 192 readFileText ( widget, Variable, Value);201 readFileText (groupWidget, Variable, Value, 0); 193 202 sprintf (Variable, ""); 194 203 } … … 198 207 } 199 208 } 200 201 209 /** 202 210 \brief Maps Confugurations to the Options. … … 204 212 \param variableName the name of the Variable that should be set up. 205 213 \param variableValue the Value of the Variable that should be set up 206 */ 207 void OrxonoxGuiExec::readFileText (Widget* widget, char* variableName, int variableValue) 214 \param depth the depth of the local Widget 215 */ 216 void OrxonoxGuiExec::readFileText (Widget* widget, char* variableName, int variableValue, int depth) 208 217 { 209 218 if (widget->is_option >= 1) … … 213 222 if (widget->is_option < 0) 214 223 { 215 216 readFileText (static_cast<Packer*>(widget)->down, variableName, variableValue); 224 readFileText (static_cast<Packer*>(widget)->down, variableName, variableValue, depth+1); 217 225 } 218 226 219 if (widget->next != NULL) 220 readFileText (widget->next, variableName, variableValue); 227 if (widget->next != NULL && depth !=0) 228 readFileText (widget->next, variableName, variableValue, depth); 229 } 230 231 /** 232 \brief locates a Group member 233 */ 234 Widget* OrxonoxGuiExec::locateGroup(Widget* widget, char* groupName, int depth) 235 { 236 Widget* tmp; 237 238 // removes the trailing and ending [ ]. 239 if (!strncmp (groupName, "[", 1)) 240 { 241 groupName = groupName+1; 242 groupName[strlen(groupName)-1] = '\0'; 243 } 244 245 if (widget->is_option < 0) 246 { 247 if (!strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 248 { 249 return widget; 250 } 251 else 252 { 253 if ((tmp = locateGroup (static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL) 254 return tmp; 255 } 256 } 257 258 if (widget->next != NULL && depth != 0) 259 { 260 if ((tmp = locateGroup (widget->next, groupName, depth)) != NULL) 261 return tmp; 262 } 263 return NULL; 221 264 } 222 265 -
orxonox/trunk/gui/orxonox_gui_exec.h
r2615 r2634 35 35 void writeFileText (Widget* widget, int depth); 36 36 void readFromFile (Widget* widget); 37 void readFileText (Widget* widget, char* variableName, int variableValue); 37 void readFileText (Widget* widget, char* variableName, int variableValue, int depth); 38 Widget* locateGroup(Widget* widget, char* groupName, int depth); 38 39 39 40 };
Note: See TracChangeset
for help on using the changeset viewer.