Changeset 3161 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Dec 13, 2004, 2:10:38 AM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui.cc
r3152 r3161 26 26 curl interface to Download cool stuff 27 27 28 make Windows grab Focus if it is open and release it when closed (only child-windows)29 28 chain all the windows when starting the GUI (DANGER: performance!!) 30 29 31 widgets save themselve 30 widgets save themselves 32 31 good way to step through all the Widgets 33 32 ... many more ... 33 label -> protected : getlabel function 34 34 35 */ 35 36 -
orxonox/trunk/gui/orxonox_gui_exec.cc
r3147 r3161 128 128 && (static_cast<Option*>(widget)->saveable) ) 129 129 || (widget->isOption<0 130 && st rcmp (static_cast<Packer*>(widget)->getGroupName(), ""))))130 && static_cast<Packer*>(widget)->getGroupName()))) 131 131 { 132 132 fprintf (CONFIG_FILE, " ", depth); … … 137 137 if (widget->isOption <0) 138 138 { 139 if (st rcmp (static_cast<Packer*>(widget)->getGroupName(), ""))139 if (static_cast<Packer*>(widget)->getGroupName()) 140 140 { 141 141 fprintf (CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName()); … … 155 155 char Buffer[256]; 156 156 char* space2under; 157 s printf (Buffer, "%s", static_cast<Option*>(widget)->label);157 strcpy (Buffer, static_cast<Option*>(widget)->label); 158 158 if (strchr (Buffer, '_')) 159 159 cout << "Warning Optionname" << Buffer << " is not Valid for Saving, because it includes an underscore" << endl; 160 160 while (space2under = strchr(Buffer, ' ')) 161 161 { 162 sp rintf (space2under, "_%s", space2under+1);162 space2under[0] = '_'; 163 163 } 164 fprintf (CONFIG_FILE, "%s = %i\n", Buffer, static_cast<Option*>(widget)->value); 164 if (widget->isOption <=3) 165 fprintf (CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value); 166 else if (widget->isOption == 5) 167 fprintf (CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue); 165 168 } 166 169 … … 184 187 while (fscanf (CONFIG_FILE, "%s", Buffer) != EOF) 185 188 { 189 // group-search // 186 190 if (!strncmp (Buffer, "[", 1)) 187 191 { … … 192 196 } 193 197 } 198 // option-setting // 194 199 if (!strcmp (Buffer, "=")) 195 200 { … … 248 253 if (widget->isOption < 0) 249 254 { 250 if ( !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName()))255 if (static_cast<Packer*>(widget)->getGroupName() && !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 251 256 { 252 257 return widget; -
orxonox/trunk/gui/orxonox_gui_gtk.cc
r3160 r3161 188 188 { 189 189 down = NULL; 190 this->setGroupName ("");190 groupName = NULL; 191 191 192 192 … … 201 201 void Packer::setGroupName (char* name) 202 202 { 203 groupName = name; 203 if (groupName) 204 delete groupName; 205 groupName = new char [strlen(name)+1]; 206 strcpy(groupName, name); 204 207 } 205 208 … … 398 401 { 399 402 if (exec->shouldsave()) 400 exec->writeToFile ( orxonoxGUI);403 exec->writeToFile (Window::mainWindow); 401 404 402 405 gtk_main_quit(); … … 902 905 } 903 906 904 OptionLabel::OptionLabel(char* text)907 OptionLabel::OptionLabel(char* label, char* value) 905 908 { 906 909 init(); 907 setTitle(text); 910 setTitle(label); 911 setValue(value); 908 912 } 909 913 910 914 void OptionLabel::init(void) 911 915 { 912 isOption = 4;913 914 916 static_cast<Option*>(this)->init(); 917 isOption = 5; 918 cValue = NULL; 915 919 916 920 widget = gtk_label_new (""); 917 921 } 922 void OptionLabel::setValue(char* newValue) 923 { 924 if (cValue) 925 delete cValue; 926 cValue = new char [strlen(newValue)+1]; 927 strcpy(cValue, newValue); 928 gtk_label_set_text (GTK_LABEL (widget), cValue); 929 } 918 930 919 931 void OptionLabel::setTitle(char* title) 920 932 { 933 if (label) 934 delete label; 935 label = new char [strlen(title)+1]; 936 strcpy(label, title); 921 937 gtk_label_set_text (GTK_LABEL (widget), title); 922 938 } -
orxonox/trunk/gui/orxonox_gui_gtk.h
r3158 r3161 32 32 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 33 33 void init(void); 34 int isOption; //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option34 int isOption; //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option 35 35 /** 36 36 \briefdefines isOption states … … 262 262 { 263 263 public: 264 OptionLabel(char* text); 265 void init(void); 266 264 OptionLabel(char* label, char* value); 265 void init(void); 266 267 char* cValue; 268 269 void setValue(char* newValue); 267 270 void setTitle(char* title); 268 271 void redraw(); -
orxonox/trunk/gui/orxonox_gui_keys.cc
r3158 r3161 61 61 pKeyFrame = new Frame ("keys"); 62 62 pKeysBox = new Box('v'); 63 pKeysBox->setGroupName ("player1"); 63 64 pKeysBox->fill(addKey(UP, "up")); 64 65 pKeysBox->fill(addKey(DOWN, "down")); … … 73 74 pKeyFrame->fill(pKeysBox); 74 75 pKeyWindow->fill(pKeyFrame); 75 //Window::addWindow(pKeyWindow);76 Window::addWindow(pKeyWindow); 76 77 pKeyWindow->connectSignal("destroy", pKeyWindow, Window::windowClose); 77 78 pKeyWindow->connectSignal("delete_event", pKeyWindow, Window::windowClose); … … 94 95 inputKey[key]->pKeyBox = new Box(); 95 96 inputKey[key]->pKeyButton = new Button(name); 96 inputKey[key]->pKeyOLabel = new OptionLabel (name );97 inputKey[key]->pKeyOLabel = new OptionLabel (name, name); 97 98 inputKey[key]->pKeyOLabel->saveable = true; 98 99 … … 256 257 } 257 258 258 inputkey->pKeyOLabel->set Title (title);259 inputkey->pKeyOLabel->setValue (title); 259 260 inputButton->disconnectSignal(keySignal); 260 261 inputWindow->close();
Note: See TracChangeset
for help on using the changeset viewer.