- Timestamp:
- Dec 26, 2004, 8:06:06 PM (20 years ago)
- Location:
- orxonox/branches/updater/src/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/updater/src/gui/orxonox_gui.cc
r3292 r3295 101 101 exec->setFilename ("~/.orxonox.conf"); 102 102 exec->readFromFile (orxonoxGUI); 103 for (int optCount = 1; optCount < argc; optCount++) 104 orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0); 103 105 104 106 orxonoxGUI->showall (); -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
r3294 r3295 207 207 if (widget->isOption >= 1) 208 208 static_cast<Option*>(widget)->redraw(); 209 } 210 211 /** 212 \brief Walks through all the Flags given at startuptime. 213 */ 214 void Widget::flagCheck(Widget* widget, void* flagName) 215 { 216 if (widget->isOption>=1) 217 { 218 Option* option = (Option*)widget; 219 char* name = (char*)flagName; 220 char* value = NULL; 221 bool found = false; 222 // check if long flag matches 223 if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) && (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') )) 224 { 225 found = true; 226 if (name[strlen(option->flagName)+2] == '=') 227 { 228 value = name+strlen(option->flagName)+3; 229 } 230 } 231 else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&& (name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches 232 { 233 found = true; 234 if (name[strlen(option->flagNameShort)+1] == '=') 235 { 236 value = name+strlen(option->flagNameShort)+2; 237 } 238 } 239 240 if (found) 241 { 242 PRINT(3)("found matching Flag %s\n", name); 243 if (value) 244 { 245 PRINT(3)("with Value %s\n", value); 246 option->value = atoi(value); 247 } 248 else 249 { 250 option->value = !option->defaultValue; 251 } 252 option->redraw(); 253 } 254 255 } 209 256 } 210 257 -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.h
r3292 r3295 55 55 void walkThrough (void (*function)(Widget*), unsigned int depth); 56 56 void walkThrough (void (*function)(Widget*, void*), void* data, unsigned int depth); 57 static void listOptions (Widget* widget); 58 static void setOptions (Widget* widget); 57 static void listOptions(Widget* widget); 58 static void setOptions(Widget* widget); 59 static void flagCheck(Widget* widget, void* flagName); 59 60 60 61 #ifdef HAVE_GTK2
Note: See TracChangeset
for help on using the changeset viewer.