Changeset 5014 in orxonox.OLD for orxonox/trunk/src/lib/gui
- Timestamp:
- Aug 14, 2005, 4:29:29 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/gui/gui_exec.cc
r4836 r5014 27 27 28 28 #include "resource_manager.h" 29 #include "ini_parser.h" 29 30 30 31 #include <string.h> … … 32 33 #include <sys/stat.h> 33 34 #include <sys/types.h> 35 34 36 35 37 #ifdef __WIN32__ … … 263 265 void GuiExec::readFromFile(Widget* widget) 264 266 { 265 this->CONFIG_FILE = fopen(this->confFile, "r"); 266 VarInfo varInfo; 267 if(this->CONFIG_FILE) 268 { 269 Widget* groupWidget = widget; 270 char Buffer[256] = ""; 271 char Variable[256]= ""; 272 char* Value; 273 while(fscanf(this->CONFIG_FILE, "%s", Buffer) != EOF) 274 { 275 // group-search // 276 if(!strncmp(Buffer, "[", 1)) 277 { 278 if((groupWidget = locateGroup(widget, Buffer, 1))==NULL) 279 { 280 PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", Buffer); 281 groupWidget = widget; 282 } 283 else 284 PRINT(5)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName); 285 } 286 // option-setting // 287 if(!strcmp(Buffer, "=")) 288 { 289 char* under2space; 290 while(under2space = strchr(Variable, '_')) 291 { 292 sprintf(under2space, " %s", under2space+1); 293 } 294 295 fscanf(this->CONFIG_FILE, "%s", Buffer); 296 varInfo.variableName = Variable; 297 varInfo.variableValue = Buffer; 298 groupWidget->walkThrough(this->readFileText, &varInfo, 0); 299 sprintf(Variable, ""); 300 } 301 sprintf(Variable, "%s", Buffer); 302 } 303 widget->walkThrough(widget->setOptions, 0); 304 } 305 fclose(this->CONFIG_FILE); 267 IniParser iniParser(this->confFile); 268 if (!iniParser.isOpen()) 269 return; 270 271 // const char* name; 272 // while (name = iniParser.nextSection()) 273 // printf("%s\n", name); 274 // 275 // 276 // this->CONFIG_FILE = fopen(this->confFile, "r"); 277 // VarInfo varInfo; 278 // if(this->CONFIG_FILE) 279 // { 280 // Widget* groupWidget = widget; 281 // char Buffer[256] = ""; 282 // char Variable[256]= ""; 283 // char* Value; 284 // while(fscanf(this->CONFIG_FILE, "%s", Buffer) != EOF) 285 // { 286 // // group-search // 287 // if(!strncmp(Buffer, "[", 1)) 288 // { 289 // if((groupWidget = locateGroup(widget, Buffer, 1))==NULL) 290 // { 291 // PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", Buffer); 292 // groupWidget = widget; 293 // } 294 // else 295 // PRINT(5)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName); 296 // } 297 // // option-setting // 298 // if(!strcmp(Buffer, "=")) 299 // { 300 // char* under2space; 301 // while(under2space = strchr(Variable, '_')) 302 // { 303 // sprintf(under2space, " %s", under2space+1); 304 // } 305 // 306 // fscanf(this->CONFIG_FILE, "%s", Buffer); 307 // varInfo.variableName = Variable; 308 // varInfo.variableValue = Buffer; 309 // groupWidget->walkThrough(this->readFileText, &varInfo, 0); 310 // sprintf(Variable, ""); 311 // } 312 // sprintf(Variable, "%s", Buffer); 313 // } 314 // widget->walkThrough(widget->setOptions, 0); 315 // } 316 // fclose(this->CONFIG_FILE); 306 317 } 307 318
Note: See TracChangeset
for help on using the changeset viewer.