Changeset 3315 in orxonox.OLD for orxonox/branches/updater
- Timestamp:
- Jan 3, 2005, 12:13:38 PM (20 years ago)
- Location:
- orxonox/branches/updater/src/gui
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/updater/src/gui/orxonox_gui.cc
r3313 r3315 45 45 int verbose = 4; 46 46 47 int main( int argc, char *argv[])47 int main(int argc, char *argv[]) 48 48 { 49 49 OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); … … 56 56 \brief Initializes the Gui 57 57 */ 58 OrxonoxGui::OrxonoxGui 58 OrxonoxGui::OrxonoxGui(int argc, char *argv[]) 59 59 { 60 60 initGUI(argc, argv); … … 67 67 windowBox->fill (banner->getWidget()); 68 68 69 Box* optionBox = new Box 69 Box* optionBox = new Box('v'); 70 70 71 Box* avBox = new Box 71 Box* avBox = new Box('h'); 72 72 73 video = new OrxonoxGuiVideo 74 avBox->fill (video->getWidget());75 audio = new OrxonoxGuiAudio 76 avBox->fill (audio->getWidget());73 video = new OrxonoxGuiVideo(); 74 avBox->fill(video->getWidget()); 75 audio = new OrxonoxGuiAudio(); 76 avBox->fill(audio->getWidget()); 77 77 78 optionBox->fill 78 optionBox->fill(avBox); 79 79 80 keys = new OrxonoxGuiKeys 81 optionBox->fill (keys->getWidget());80 keys = new OrxonoxGuiKeys(); 81 optionBox->fill(keys->getWidget()); 82 82 83 exec = new OrxonoxGuiExec (orxonoxGUI);84 optionBox->fill (exec->getWidget());83 exec = new OrxonoxGuiExec(); 84 optionBox->fill(exec->getWidget()); 85 85 86 flags = new OrxonoxGuiFlags (orxonoxGUI);86 flags = new OrxonoxGuiFlags(); 87 87 88 optionBox->fill (flags->getWidget());89 windowBox->fill 88 optionBox->fill(flags->getWidget()); 89 windowBox->fill(optionBox); 90 90 91 update = new OrxonoxGuiUpdate 91 update = new OrxonoxGuiUpdate(); 92 92 optionBox->fill(update->getWidget()); 93 93 94 orxonoxGUI->fill 95 flags->setTextFromFlags 94 orxonoxGUI->fill(windowBox); 95 flags->setTextFromFlags(orxonoxGUI); 96 96 97 97 // Reading Values from File 98 exec->setFilename 99 exec->readFromFile 98 exec->setFilename("~/.orxonox.conf"); 99 exec->readFromFile(orxonoxGUI); 100 100 // Merging changes to the Options from appended flags. 101 101 for (int optCount = 1; optCount < argc; optCount++) … … 103 103 104 104 105 orxonoxGUI->showall 105 orxonoxGUI->showall(); 106 106 107 107 //// Handling special Cases. /// … … 124 124 125 125 } 126 127 128 /** 129 \breif Destructor. 130 */ 131 OrxonoxGui::~OrxonoxGui(void) 132 { 133 134 } -
orxonox/branches/updater/src/gui/orxonox_gui.h
r3300 r3315 25 25 { 26 26 public: 27 OrxonoxGui 28 ~OrxonoxGui ();27 OrxonoxGui(int argc, char *argv[]); 28 ~OrxonoxGui(void); 29 29 30 30 }; -
orxonox/branches/updater/src/gui/orxonox_gui_audio.cc
r3288 r3315 29 29 \brief Creates an Audio-Frame 30 30 */ 31 OrxonoxGuiAudio::OrxonoxGuiAudio ()31 OrxonoxGuiAudio::OrxonoxGuiAudio(void) 32 32 { 33 audioFrame = new Frame("Audio-Options:");34 audioBox = new Box('v');35 audioFrame->setGroupName("audio");33 this->audioFrame = new Frame("Audio-Options:"); 34 this->audioBox = new Box('v'); 35 this->audioFrame->setGroupName("audio"); 36 36 37 enableSound = new CheckButton("Disable Sound");38 enableSound->setFlagName ("no-sound", 0);39 enableSound->saveability();40 audioBox->fill (enableSound);41 Label* musicVolumeLabel = new Label 42 audioBox->fill(musicVolumeLabel);43 musicVolume = new Slider("Music Volume", 0, 100);44 musicVolume->setFlagName("music-volume", "m", 80);45 musicVolume->saveability();46 audioBox->fill (musicVolume);37 this->enableSound = new CheckButton("Disable Sound"); 38 this->enableSound->setFlagName ("no-sound", 0); 39 this->enableSound->saveability(); 40 this->audioBox->fill(this->enableSound); 41 Label* musicVolumeLabel = new Label("Music Volume"); 42 this->audioBox->fill(musicVolumeLabel); 43 this->musicVolume = new Slider("Music Volume", 0, 100); 44 this->musicVolume->setFlagName("music-volume", "m", 80); 45 this->musicVolume->saveability(); 46 this->audioBox->fill (this->musicVolume); 47 47 Label* effectsVolumeLabel = new Label ("Effects Volume"); 48 audioBox->fill (effectsVolumeLabel);49 effectsVolume = new Slider ("Effects Volume", 0, 100);50 effectsVolume->setFlagName ("effects-volume", "e", 80);51 effectsVolume->saveability();52 audioBox->fill (effectsVolume);48 this->audioBox->fill (effectsVolumeLabel); 49 this->effectsVolume = new Slider ("Effects Volume", 0, 100); 50 this->effectsVolume->setFlagName ("effects-volume", "e", 80); 51 this->effectsVolume->saveability(); 52 this->audioBox->fill (this->effectsVolume); 53 53 54 audioFrame->fill (audioBox);54 this->audioFrame->fill (this->audioBox); 55 55 } 56 56 … … 59 59 \return Returns the Audio-frame 60 60 */ 61 Widget* OrxonoxGuiAudio::getWidget ()61 Widget* OrxonoxGuiAudio::getWidget(void) 62 62 { 63 return audioFrame;63 return this->audioFrame; 64 64 } -
orxonox/branches/updater/src/gui/orxonox_gui_audio.h
r3187 r3315 19 19 Slider* effectsVolume; //!< A Slider for effects volume. 20 20 public: 21 OrxonoxGuiAudio ();22 ~OrxonoxGuiAudio ();21 OrxonoxGuiAudio(void); 22 ~OrxonoxGuiAudio(void); 23 23 24 Widget* getWidget ();24 Widget* getWidget(void); 25 25 }; 26 26 #endif /* _ORXONOX_GUI_AUDIO_H */ -
orxonox/branches/updater/src/gui/orxonox_gui_banner.cc
r3287 r3315 29 29 \brief Creates a new BannerEventBox and its content. 30 30 */ 31 OrxonoxGuiBanner::OrxonoxGuiBanner ()31 OrxonoxGuiBanner::OrxonoxGuiBanner(void) 32 32 { 33 33 // Banner Itself // 34 bannerEventBox = new EventBox("BannerEventBox");35 bannerImage = new Image("banner.xpm");36 bannerEventBox->fill(bannerImage);34 this->bannerEventBox = new EventBox("BannerEventBox"); 35 this->bannerImage = new Image("banner.xpm"); 36 this->bannerEventBox->fill(this->bannerImage); 37 37 38 38 // Banner Window // 39 logoWindow = new Window("Logo");39 this->logoWindow = new Window("Logo"); 40 40 41 41 #ifdef HAVE_GTK2 42 bannerEventBox->connectSignal ("button_press_event",logoWindow, Window::windowOpen);42 this->bannerEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowOpen); 43 43 44 logoWindow->connectSignal("destroy",logoWindow, Window::windowClose);45 logoWindow->connectSignal("delete_event",logoWindow, Window::windowClose);44 this->logoWindow->connectSignal("destroy", this->logoWindow, Window::windowClose); 45 this->logoWindow->connectSignal("delete_event", this->logoWindow, Window::windowClose); 46 46 #endif /* HAVE_GTK2 */ 47 logoEventBox = new EventBox();48 logoBox = new Box('v');49 logoLabel = new Label("OrxOnoX, Version: " PACKAGE_VERSION);50 logoImage = new Image("banner.xpm");51 logoEventBox->fill(logoImage);47 this->logoEventBox = new EventBox(); 48 this->logoBox = new Box('v'); 49 this->logoLabel = new Label("OrxOnoX, Version: " PACKAGE_VERSION); 50 this->logoImage = new Image("banner.xpm"); 51 this->logoEventBox->fill(this->logoImage); 52 52 53 logoBox->fill(logoLabel);54 logoBox->fill(logoEventBox);53 this->logoBox->fill(this->logoLabel); 54 this->logoBox->fill(this->logoEventBox); 55 55 #ifdef HAVE_GTK2 56 logoEventBox->connectSignal("button_press_event",logoWindow, Window::windowClose);56 this->logoEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowClose); 57 57 #endif /* HAVE_GTK2 */ 58 58 59 logoWindow->fill (logoBox);59 this->logoWindow->fill(this->logoBox); 60 60 61 Window::addWindow (logoWindow);61 Window::addWindow(this->logoWindow); 62 62 } 63 63 … … 65 65 \brief Destructs it. 66 66 */ 67 OrxonoxGuiBanner::~OrxonoxGuiBanner ()67 OrxonoxGuiBanner::~OrxonoxGuiBanner(void) 68 68 { 69 69 } … … 73 73 \return The EventBox, that holds the Banner. 74 74 */ 75 Widget* OrxonoxGuiBanner::getWidget ()75 Widget* OrxonoxGuiBanner::getWidget(void) 76 76 { 77 return bannerEventBox;77 return this->bannerEventBox; 78 78 } 79 79 -
orxonox/branches/updater/src/gui/orxonox_gui_banner.h
r3187 r3315 29 29 30 30 public: 31 OrxonoxGuiBanner ();32 ~OrxonoxGuiBanner ();31 OrxonoxGuiBanner(void); 32 ~OrxonoxGuiBanner(void); 33 33 34 Widget* getWidget ();34 Widget* getWidget(void); 35 35 36 36 }; -
orxonox/branches/updater/src/gui/orxonox_gui_exec.cc
r3301 r3315 34 34 \param orxonoxGUI ExecFrame needs to know where to get the Options from 35 35 */ 36 OrxonoxGuiExec::OrxonoxGuiExec (Window* orxonoxGUI)37 { 38 configFile = (char*)malloc (512*sizeof(char));39 40 execFrame = new Frame("Execute-Tags:");41 execBox = new Box('v');42 execFrame->setGroupName("misc");36 OrxonoxGuiExec::OrxonoxGuiExec(void) 37 { 38 configFile =(char*)malloc(512*sizeof(char)); 39 40 this->execFrame = new Frame("Execute-Tags:"); 41 this->execBox = new Box('v'); 42 this->execFrame->setGroupName("misc"); 43 43 44 start = new Button("Start");44 this->start = new Button("Start"); 45 45 #ifdef HAVE_GTK2 46 start->connectSignal("clicked", this, startOrxonox);46 this->start->connectSignal("clicked", this, startOrxonox); 47 47 #endif /* HAVE_GTK2 */ 48 execBox->fill(start);49 saveSettings = new CheckButton("Save Settings");50 saveSettings->value = 1;51 saveSettings->saveability();52 execBox->fill (saveSettings);53 verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem");54 verboseMode->setFlagName("verbose", "v", 0);55 verboseMode->saveability();56 execBox->fill (verboseMode);57 alwaysShow = new CheckButton("Always Show this Menu");58 alwaysShow->setFlagName("gui", "g", 0);59 alwaysShow->saveability();60 execBox->fill (alwaysShow);61 quit = new Button("Quit");48 this->execBox->fill(start); 49 this->saveSettings = new CheckButton("Save Settings"); 50 this->saveSettings->value = 1; 51 this->saveSettings->saveability(); 52 this->execBox->fill(this->saveSettings); 53 this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem"); 54 this->verboseMode->setFlagName("verbose", "v", 0); 55 this->verboseMode->saveability(); 56 this->execBox->fill(this->verboseMode); 57 this->alwaysShow = new CheckButton("Always Show this Menu"); 58 this->alwaysShow->setFlagName("gui", "g", 0); 59 this->alwaysShow->saveability(); 60 this->execBox->fill(this->alwaysShow); 61 this->quit = new Button("Quit"); 62 62 #ifdef HAVE_GTK2 63 quit->connectSignal("clicked", this, OrxonoxGuiExec::quitOrxonox);64 orxonoxGUI->connectSignal("destroy", this, OrxonoxGuiExec::quitOrxonox);65 //! orxonoxGUI->connectSignal 63 this->quit->connectSignal("clicked", this, OrxonoxGuiExec::quitOrxonox); 64 Window::mainWindow->connectSignal("destroy", this, OrxonoxGuiExec::quitOrxonox); 65 //! orxonoxGUI->connectSignal("delete_event", this, OrxonoxGuiExec::quitOrxonox); \todo fix this to work. 66 66 #endif /* HAVE_GTK2 */ 67 execBox->fill (quit);68 69 execFrame->fill (execBox);67 this->execBox->fill(this->quit); 68 69 this->execFrame->fill(this->execBox); 70 70 } 71 71 … … 74 74 \return Returns the Exec-frame 75 75 */ 76 Widget* OrxonoxGuiExec::getWidget ()76 Widget* OrxonoxGuiExec::getWidget(void) 77 77 { 78 78 return execFrame; … … 85 85 \param filename the location of the configFile 86 86 87 \todo: memory allocation could be better. 88 87 89 The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows 88 90 */ 89 void OrxonoxGuiExec::setFilename 90 { 91 char* buffer = (char*) malloc (512*sizeof(buffer));92 sprintf 93 if (!strncmp(buffer, "~/", 2))91 void OrxonoxGuiExec::setFilename(char* filename) 92 { 93 char* buffer = (char*)malloc(2048*sizeof(char)); 94 sprintf(buffer, "%s", filename); 95 if(!strncmp(buffer, "~/", 2)) 94 96 { 95 97 #ifdef __WIN32__ 96 sprintf (configFile, "%s/%s", getenv("USERPROFILE"), buffer+2);98 sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2); 97 99 #else 98 sprintf (configFile, "%s/%s", getenv("HOME"), buffer+2);100 sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2); 99 101 #endif 100 102 } 101 else if 102 s printf(configFile, "%s", buffer);103 delete buffer;103 else if(buffer) 104 strcpy(this->configFile, buffer); 105 free (buffer); 104 106 } 105 107 … … 109 111 char* OrxonoxGuiExec::getConfigFile(void) 110 112 { 111 return configFile;113 return this->configFile; 112 114 } 113 115 … … 116 118 \return 1 if it should 0 if not/ 117 119 */ 118 int OrxonoxGuiExec::shouldsave 119 { 120 return (static_cast<Option*>(saveSettings)->value);120 int OrxonoxGuiExec::shouldsave() 121 { 122 return(static_cast<Option*>(this->saveSettings)->value); 121 123 } 122 124 … … 125 127 \param widget from which Widget on should be saved. 126 128 127 this Function only opens and closes the file, in between OrxonoxGuiExec::writeFileText 128 */ 129 void OrxonoxGuiExec::writeToFile 130 { 131 CONFIG_FILE = fopen(configFile, "w");132 if (CONFIG_FILE)133 writeFileText(widget, 0);134 fclose (CONFIG_FILE);129 this Function only opens and closes the file, in between OrxonoxGuiExec::writeFileText(Widget* widget) will execute the real writing process. 130 */ 131 void OrxonoxGuiExec::writeToFile(Widget* widget) 132 { 133 this->CONFIG_FILE = fopen(configFile, "w"); 134 if(this->CONFIG_FILE) 135 this->writeFileText(widget, 0); 136 fclose(this->CONFIG_FILE); 135 137 } 136 138 … … 140 142 \param depth initially "0", and grows higher, while new Groups are bundeled. 141 143 */ 142 void OrxonoxGuiExec::writeFileText 144 void OrxonoxGuiExec::writeFileText(Widget* widget, int depth) 143 145 { 144 146 int counter = 0; 145 while (counter < depth &&((widget->isOption>0146 && 147 || 147 while(counter < depth &&((widget->isOption>0 148 &&(static_cast<Option*>(widget)->isSaveable()) ) 149 ||(widget->isOption<0 148 150 && static_cast<Packer*>(widget)->getGroupName()))) 149 151 { 150 fprintf (CONFIG_FILE, " ", depth);152 fprintf(this->CONFIG_FILE, " ", depth); 151 153 counter++; 152 154 } 153 155 154 156 // check if it is a Packer, and if it is, check if it has a name and if there is something in it. 155 if 156 { 157 if 158 { 159 fprintf 160 writeFileText(static_cast<Packer*>(widget)->down, depth+1);157 if(widget->isOption <0) 158 { 159 if(static_cast<Packer*>(widget)->getGroupName()) 160 { 161 fprintf(CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName()); 162 this->writeFileText(static_cast<Packer*>(widget)->down, depth+1); 161 163 fprintf(CONFIG_FILE, "\n"); 162 164 } 163 165 else 164 166 { 165 writeFileText(static_cast<Packer*>(widget)->down, depth);167 this->writeFileText(static_cast<Packer*>(widget)->down, depth); 166 168 } 167 169 } 168 // if 169 // printf 170 if 171 if 170 // if(widget->isOption == 0) 171 // printf("%s\n",widget->title); 172 if(widget->isOption >= 1) 173 if (static_cast<Option*>(widget)->isSaveable()) 172 174 { 173 175 char Buffer[256]; 174 176 char* space2under; 175 strcpy 176 if (strchr(Buffer, '_'))177 strcpy(Buffer, static_cast<Option*>(widget)->title); 178 if(strchr(Buffer, '_')) 177 179 cout << "Warning Optionname" << Buffer << " is not Valid for Saving, because it includes an underscore" << endl; 178 while 180 while(space2under = strchr(Buffer, ' ')) 179 181 { 180 182 space2under[0] = '_'; 181 183 } 182 if 183 fprintf 184 else if 185 fprintf 184 if(widget->isOption <=3) 185 fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value); 186 else if(widget->isOption == 5) 187 fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue); 186 188 } 187 189 188 if 189 writeFileText(widget->next, depth);190 if(widget->next != NULL) 191 this->writeFileText(widget->next, depth); 190 192 } 191 193 … … 194 196 \param widget from which Widget on should be saved. 195 197 */ 196 void OrxonoxGuiExec::readFromFile 197 { 198 CONFIG_FILE = fopen(configFile, "r");198 void OrxonoxGuiExec::readFromFile(Widget* widget) 199 { 200 this->CONFIG_FILE = fopen(configFile, "r"); 199 201 VarInfo varInfo; 200 if (CONFIG_FILE)202 if(this->CONFIG_FILE) 201 203 { 202 204 Widget* groupWidget = widget; … … 204 206 char Variable[256]= ""; 205 207 char* Value; 206 while (fscanf (CONFIG_FILE, "%s", Buffer) != EOF)208 while(fscanf(this->CONFIG_FILE, "%s", Buffer) != EOF) 207 209 { 208 210 // group-search // 209 if (!strncmp(Buffer, "[", 1))211 if(!strncmp(Buffer, "[", 1)) 210 212 { 211 if ((groupWidget = locateGroup(widget, Buffer, 1))==NULL)213 if((groupWidget = locateGroup(widget, Buffer, 1))==NULL) 212 214 { 213 215 cout << "!!There is no group called " << Buffer << " in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n"; … … 216 218 } 217 219 // option-setting // 218 if (!strcmp(Buffer, "="))220 if(!strcmp(Buffer, "=")) 219 221 { 220 222 char* under2space; 221 while 223 while(under2space = strchr(Variable, '_')) 222 224 { 223 sprintf 225 sprintf(under2space, " %s", under2space+1); 224 226 } 225 227 226 fscanf (CONFIG_FILE, "%s", Buffer);228 fscanf(this->CONFIG_FILE, "%s", Buffer); 227 229 varInfo.variableName = Variable; 228 230 varInfo.variableValue = Buffer; 229 groupWidget->walkThrough( readFileText, &varInfo, 0);230 sprintf 231 groupWidget->walkThrough(this->readFileText, &varInfo, 0); 232 sprintf(Variable, ""); 231 233 } 232 sprintf 234 sprintf(Variable, "%s", Buffer); 233 235 } 234 236 widget->walkThrough(widget->setOptions, 0); … … 240 242 \param varInfo Information about the Variable to read 241 243 */ 242 void OrxonoxGuiExec::readFileText 243 { 244 VarInfo* info = 245 246 if 247 { 248 if (!strcmp(static_cast<Option*>(widget)->title, info->variableName))244 void OrxonoxGuiExec::readFileText(Widget* widget, void* varInfo) 245 { 246 VarInfo* info =(VarInfo*)varInfo; 247 248 if(widget->isOption >= 1 && widget->isOption <= 3) 249 { 250 if(!strcmp(static_cast<Option*>(widget)->title, info->variableName)) 249 251 static_cast<Option*>(widget)->value = atoi(info->variableValue); 250 252 } 251 else if 252 { 253 if (!strcmp(static_cast<Option*>(widget)->title, info->variableName))253 else if(widget->isOption == 5) 254 { 255 if(!strcmp(static_cast<Option*>(widget)->title, info->variableName)) 254 256 static_cast<OptionLabel*>(widget)->setValue(info->variableValue); 255 257 } … … 262 264 \param depth The Depth of the search seen from the first widget we searched from. 263 265 \returns The Widget that holds the Group, or the NULL if the Group wasn't found. 266 267 \todo do this in gui-gtk. 264 268 */ 265 269 Widget* OrxonoxGuiExec::locateGroup(Widget* widget, char* groupName, int depth) … … 268 272 269 273 // removes the trailing and ending [ ]. 270 if (!strncmp(groupName, "[", 1))274 if(!strncmp(groupName, "[", 1)) 271 275 { 272 276 groupName = groupName+1; … … 274 278 } 275 279 276 if 277 { 278 if 280 if(widget->isOption < 0) 281 { 282 if(static_cast<Packer*>(widget)->getGroupName() && !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 279 283 { 280 284 return widget; … … 282 286 else 283 287 { 284 if ((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL)288 if((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL) 285 289 return tmp; 286 290 } 287 291 } 288 292 289 if 290 { 291 if ((tmp = locateGroup(widget->next, groupName, depth)) != NULL)293 if(widget->next != NULL && depth != 0) 294 { 295 if((tmp = locateGroup(widget->next, groupName, depth)) != NULL) 292 296 return tmp; 293 297 } … … 297 301 #ifdef HAVE_GTK2 298 302 /** 299 \brief Starts ORXONOX. 303 \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n 300 304 \param widget the widget that executed the start command 301 305 \param data additional data … … 303 307 This is a Signal and can be executed through Widget::signal_connect 304 308 */ 305 int OrxonoxGuiExec::startOrxonox 306 { 307 OrxonoxGuiExec* exec = 308 if 309 exec->writeToFile 309 int OrxonoxGuiExec::startOrxonox(GtkWidget* widget, void* data) 310 { 311 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 312 if(exec->shouldsave()) 313 exec->writeToFile(Window::mainWindow); 310 314 cout << "Starting Orxonox" <<endl; 311 315 gtk_main_quit(); 312 system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real 313 } 314 315 /** 316 \brief Starts ORXONOX. 316 system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real(coded not over the shell) 317 } 318 319 /** 320 \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n 317 321 \param widget the widget that executed the start command 318 322 \param data additional data … … 320 324 This is a Signal and can be executed through Widget::signal_connect 321 325 */ 322 int OrxonoxGuiExec::quitOrxonox 323 { 324 OrxonoxGuiExec* exec = 326 int OrxonoxGuiExec::quitOrxonox(GtkWidget* widget, void* data) 327 { 328 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 325 329 PRINT(3)( "Quitting Orxonox %p\n", exec); 326 if 327 exec->writeToFile 330 if(exec->shouldsave()) 331 exec->writeToFile(Window::mainWindow); 328 332 gtk_main_quit(); 329 333 } 330 334 #else /* HAVE_GTK2 */ 331 335 /** 332 \brief Starts ORXONOX. 336 \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n 333 337 \param widget the widget that executed the start command 334 338 \param data additional data 335 339 */ 336 int OrxonoxGuiExec::startOrxonox 337 { 338 OrxonoxGuiExec* exec = 340 int OrxonoxGuiExec::startOrxonox(void* widget, void* data) 341 { 342 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 339 343 PRINT(3)("Starting Orxonox\n"); 340 if 341 exec->writeToFile 342 system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real 344 if(exec->shouldsave()) 345 exec->writeToFile(Window::mainWindow); 346 system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real(coded not over the shell) 343 347 } 344 348 /** … … 349 353 This is a Signal and can be executed through Widget::signal_connect 350 354 */ 351 int OrxonoxGuiExec::quitOrxonox 352 { 353 OrxonoxGuiExec* exec = 355 int OrxonoxGuiExec::quitOrxonox(void* widget, void* data) 356 { 357 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 354 358 PRINT(3)("Quiting Orxonox"); 355 if 356 exec->writeToFile 359 if(exec->shouldsave()) 360 exec->writeToFile(Window::mainWindow); 357 361 } 358 362 -
orxonox/branches/updater/src/gui/orxonox_gui_exec.h
r3300 r3315 33 33 34 34 public: 35 OrxonoxGuiExec (Window* orxonoxGUI);36 ~OrxonoxGuiExec ();35 OrxonoxGuiExec(void); 36 ~OrxonoxGuiExec(void); 37 37 38 Widget* getWidget ();38 Widget* getWidget(void); 39 39 40 void setFilename 40 void setFilename(char* filename); 41 41 char* getConfigFile(void); 42 int shouldsave( );43 void writeToFile 44 void writeFileText 45 void readFromFile 46 static void readFileText 42 int shouldsave(void); 43 void writeToFile(Widget* widget); 44 void writeFileText(Widget* widget, int depth); 45 void readFromFile(Widget* widget); 46 static void readFileText(Widget* widget, void* varInfo); 47 47 Widget* locateGroup(Widget* widget, char* groupName, int depth); 48 48 49 49 #ifdef HAVE_GTK2 50 static int startOrxonox 51 static int quitOrxonox 50 static int startOrxonox(GtkWidget *widget, void* data); 51 static int quitOrxonox(GtkWidget *widget, void* data); 52 52 #else /* HAVE_GTK2 */ 53 static int startOrxonox 54 static int quitOrxonox 53 static int startOrxonox(void* widget, void* data); 54 static int quitOrxonox(void* widget, void* data); 55 55 #endif /* HAVE_GTK2 */ 56 56 }; -
orxonox/branches/updater/src/gui/orxonox_gui_flags.cc
r3300 r3315 30 30 \param widget The Widget from which the data will be parsed 31 31 */ 32 OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)32 OrxonoxGuiFlags::OrxonoxGuiFlags(void) 33 33 { 34 this->flagsFrame = new Frame 35 this->flagsBox = new Box 34 this->flagsFrame = new Frame("Orxonox-Startup-Flags:"); 35 this->flagsBox = new Box('v'); 36 36 37 this->flagsLabel = new Label 38 this->flagsLabel->setSize 39 this->flagsBox->fill 40 this->shortFlags = new CheckButton 41 this->flagsBox->fill 37 this->flagsLabel = new Label(); 38 this->flagsLabel->setSize(260,60); 39 this->flagsBox->fill(flagsLabel); 40 this->shortFlags = new CheckButton("shortFlags"); 41 this->flagsBox->fill(shortFlags); 42 42 43 this->flagsFrame->fill 43 this->flagsFrame->fill(flagsBox); 44 44 } 45 45 … … 48 48 \returns Frame that holds the Flagtext. 49 49 */ 50 Widget* OrxonoxGuiFlags::getWidget ()50 Widget* OrxonoxGuiFlags::getWidget(void) 51 51 { 52 52 return this->flagsFrame; … … 57 57 \param widget the Widget from which on to scan for deeper Options and their settings. 58 58 */ 59 void OrxonoxGuiFlags::setTextFromFlags 59 void OrxonoxGuiFlags::setTextFromFlags(Widget* widget) 60 60 { 61 61 FlagInfo flagInfo; … … 76 76 void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo) 77 77 { 78 FlagInfo* info = 79 if 80 if 78 FlagInfo* info =(FlagInfo*)flagInfo; 79 if(widget->isOption >= 1) 80 if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue ) 81 81 { 82 if 82 if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort) 83 83 { 84 84 info->flagsLabel->appendText(" -"); 85 85 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort); 86 86 } 87 else if 87 else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName) 88 88 { 89 89 info->flagsLabel->appendText(" --"); … … 91 91 } 92 92 93 if 93 if(static_cast<Option*>(widget)->isOption == 2) 94 94 { 95 95 info->flagsLabel->appendText("="); -
orxonox/branches/updater/src/gui/orxonox_gui_flags.h
r3299 r3315 19 19 20 20 public: 21 OrxonoxGuiFlags (Widget* widget);22 ~OrxonoxGuiFlags ();21 OrxonoxGuiFlags(void); 22 ~OrxonoxGuiFlags(void); 23 23 24 void setTextFromFlags 24 void setTextFromFlags(Widget* widget); 25 25 static void flagsText(Widget* widget, void* flagInfo); 26 26 … … 30 30 Label* flagsLabel; 31 31 }; 32 Widget* getWidget ();32 Widget* getWidget(void); 33 33 }; 34 34 #endif /* _ORXONOX_GUI_FLAGS_H */ -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
r3313 r3315 50 50 gdk_threads_init(); 51 51 #endif /* HAVE_GTHREAD */ 52 gtk_init 52 gtk_init(&argc, &argv); 53 53 gtk_rc_parse( "rc" ); 54 54 #endif /* HAVE_GTK2 */ … … 138 138 This is still pretty crappy. 139 139 */ 140 Widget::~Widget( )140 Widget::~Widget(void) 141 141 { 142 142 this->destroy(); … … 147 147 Initializes the next Pointer and the other Widget-specific Defaults. 148 148 */ 149 void Widget::init( )149 void Widget::init(void) 150 150 { 151 151 next = NULL; … … 181 181 \brief makes the widget visible. 182 182 */ 183 void Widget::show( )184 { 185 #ifdef HAVE_GTK2 186 gtk_widget_show 183 void Widget::show(void) 184 { 185 #ifdef HAVE_GTK2 186 gtk_widget_show(this->widget); 187 187 #endif /* HAVE_GTK2 */ 188 188 } … … 191 191 \brief hides the widget. 192 192 */ 193 void Widget::hide( )194 { 195 #ifdef HAVE_GTK2 196 gtk_widget_hide 193 void Widget::hide(void) 194 { 195 #ifdef HAVE_GTK2 196 gtk_widget_hide(this->widget); 197 197 #endif /* HAVE_GTK2 */ 198 198 } … … 206 206 { 207 207 #ifdef HAVE_GTK2 208 gtk_widget_set_usize 208 gtk_widget_set_usize(this->widget, width, height); 209 209 #endif /* HAVE_GTK2 */ 210 210 } … … 237 237 \param depth the current depth. if > 0 then the next Widget will also be walked through. 238 238 */ 239 void Widget::walkThrough (void(*function)(Widget*), unsigned int depth)239 void Widget::walkThrough(void(*function)(Widget*), unsigned int depth) 240 240 { 241 241 function(this); 242 242 if (this->isOption < 0) 243 243 { 244 static_cast<Packer*>(this)->down->walkThrough 244 static_cast<Packer*>(this)->down->walkThrough(function, depth+1); 245 245 } 246 246 … … 255 255 \param depth the current depth. if > 0 then the next Widget will also be walked through. 256 256 */ 257 void Widget::walkThrough (void(*function)(Widget*, void*), void* data, unsigned int depth)257 void Widget::walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth) 258 258 { 259 259 function(this, data); … … 270 270 \param widget specifies the widget that should be listed 271 271 */ 272 void Widget::listOptionsAndGroups 272 void Widget::listOptionsAndGroups(Widget* widget) 273 273 { 274 274 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) … … 284 284 \param widget specifies the widget that should be listed 285 285 */ 286 void Widget::listOptions 286 void Widget::listOptions(Widget* widget) 287 287 { 288 288 if (widget->isOption >= 1 && widget->isOption <= 3) … … 297 297 \param data A Counter, that always knows how many Options have been found yet. 298 298 */ 299 void Widget::listOptions 299 void Widget::listOptions(Widget* widget, void* data) 300 300 { 301 301 302 302 if (widget->isOption >= 1 && widget->isOption <= 3) 303 303 { 304 int* count = 304 int* count =(int*)data; 305 305 *count = *count +1; 306 306 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; … … 308 308 else if (widget->isOption == 5) 309 309 { 310 int* count = 310 int* count =(int*)data; 311 311 *count = *count +1; 312 312 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; … … 315 315 316 316 /** 317 \brief Finds an Option by a given number 318 \param number The Count of options to wait 317 \brief Finds an Option by a given number(the n'th option found away from this Widget) 318 \param number The Count of options to wait(by reference) 319 319 \param depth The depth of the sarch. if 0 it will not search next pointer 320 320 … … 349 349 void Widget::listGroups(Widget* widget) 350 350 { 351 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)351 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 352 352 cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n"; 353 353 } … … 356 356 \brief This is for listing the Groups of "widget". It also displays the n'th number found. 357 357 \param widget specifies the widget that should be listed 358 \param data the Counter, that will show the number 358 \param data the Counter, that will show the number(this function will raise it by one if a Group is fount. 359 359 */ 360 360 void Widget::listGroups(Widget* widget, void* data) 361 361 { 362 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)363 { 364 int* count = 362 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 363 { 364 int* count =(int*)data; 365 365 *count = *count +1; 366 366 cout << *count <<": [" << static_cast<Packer*>(widget)->groupName << "]\n"; … … 369 369 370 370 /** 371 \brief Finds a Group by a given number 372 \param number The Count of options to wait 371 \brief Finds a Group by a given number(the n'th Group found away from this Widget) 372 \param number The Count of options to wait(by reference) 373 373 \param depth The depth of the sarch. if 0 it will not search next pointer 374 374 */ … … 399 399 \param widget specifies the widget that should be set. 400 400 */ 401 void Widget::setOptions 401 void Widget::setOptions(Widget* widget) 402 402 { 403 403 if (widget->isOption >= 1) … … 412 412 if (widget->isOption>=1) 413 413 { 414 Option* option = 415 char* name = 414 Option* option =(Option*)widget; 415 char* name =(char*)flagName; 416 416 char* value = NULL; 417 417 bool found = false; 418 418 // check if long flag matches 419 if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) && 419 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] == '=') )) 420 420 { 421 421 found = true; … … 425 425 } 426 426 } 427 else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&& 427 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 428 428 { 429 429 found = true; … … 456 456 \brief Connect any signal to any given Sub-widget 457 457 */ 458 gulong Widget::connectSignal (char* event, gint(*signal)(GtkWidget*, GdkEvent*, void *))459 { 460 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK(signal), NULL);458 gulong Widget::connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void *)) 459 { 460 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), NULL); 461 461 } 462 462 … … 464 464 \brief Connect a signal with additionally passing the whole Object 465 465 */ 466 gulong Widget::connectSignal (char* event, gint(*signal)( GtkWidget*, Widget *))467 { 468 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK(signal), this);466 gulong Widget::connectSignal(char* event, gint(*signal)( GtkWidget*, Widget *)) 467 { 468 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), this); 469 469 } 470 470 … … 472 472 \brief Connect a signal with additionally passing a whole external Object 473 473 */ 474 gulong Widget::connectSignal (char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void *))475 { 476 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK(signal), extObj);474 gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void *)) 475 { 476 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj); 477 477 } 478 478 … … 480 480 \brief Connect a signal with additionally passing a whole external Object 481 481 */ 482 gulong Widget::connectSignal (char* event, void* extObj, gint(*signal)(GtkWidget*, void *))483 { 484 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK(signal), extObj);482 gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void *)) 483 { 484 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj); 485 485 } 486 486 … … 488 488 \brief Connect a signal with additionally passing a whole external Object 489 489 */ 490 gulong Widget::connectSignal (char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void *))491 { 492 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK(signal), extObj);493 } 494 495 void Widget::disconnectSignal 496 { 497 g_signal_handler_disconnect (G_OBJECT(this->widget), signalID);490 gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void *)) 491 { 492 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj); 493 } 494 495 void Widget::disconnectSignal(gulong signalID) 496 { 497 g_signal_handler_disconnect(G_OBJECT(this->widget), signalID); 498 498 } 499 499 … … 504 504 \param nothing nothin. 505 505 */ 506 gint Widget::doNothingSignal 506 gint Widget::doNothingSignal(GtkWidget *widget, GdkEvent* event, void* nothing) 507 507 { 508 508 } … … 519 519 Sets the down-pinter to NULL and other PackerSpecific-values to their defaults. 520 520 */ 521 void Packer::init 522 { 523 down = NULL;524 groupName = NULL;521 void Packer::init(void) 522 { 523 this->down = NULL; 524 this->groupName = NULL; 525 525 526 526 … … 536 536 PRINTF(4)("deleting the Packer part.\n"); 537 537 538 if ( groupName)539 delete [] groupName;538 if (this->groupName) 539 delete []this->groupName; 540 540 541 541 //deleting recursively. … … 551 551 \param name The name of the group. 552 552 */ 553 void Packer::setGroupName 554 { 555 if ( groupName)556 delete groupName;557 groupName = new char[strlen(name)+1];558 strcpy( groupName, name);553 void Packer::setGroupName(char* name) 554 { 555 if (this->groupName) 556 delete []this->groupName; 557 this->groupName = new char[strlen(name)+1]; 558 strcpy(this->groupName, name); 559 559 } 560 560 … … 563 563 \returns name The name of the group. 564 564 */ 565 char* Packer::getGroupName 566 { 567 return groupName;565 char* Packer::getGroupName(void) 566 { 567 return this->groupName; 568 568 } 569 569 … … 575 575 sets the Container-Specific defaults. 576 576 */ 577 void Container::init 578 { 579 isOption = -1;577 void Container::init(void) 578 { 579 this->isOption = -1; 580 580 581 581 static_cast<Packer*>(this)->init(); … … 600 600 It does this by filling up the down pointer only if down points to NULL. 601 601 */ 602 void Container::fill 602 void Container::fill(Widget *lowerWidget) 603 603 { 604 604 if (this->down == NULL) 605 605 { 606 606 #ifdef HAVE_GTK2 607 gtk_container_add (GTK_CONTAINER(this->widget), lowerWidget->widget);607 gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget); 608 608 #endif /* HAVE_GTK2 */ 609 609 this->down = lowerWidget; … … 613 613 } 614 614 615 // gtk_container_set_border_width (GTK_CONTAINER(widget), 5);615 // gtk_container_set_border_width(GTK_CONTAINER(widget), 5); 616 616 617 617 /* WINDOW */ … … 622 622 \brief Adds a new Window Windows to the List of Windows. 623 623 \param windowToAdd The Windows that should be added to the List 624 \todo this instead of windowToAdd 624 \todo this instead of windowToAdd(possibly) 625 625 */ 626 626 void Window::addWindow(Window* windowToAdd) … … 633 633 634 634 Widget* tmpWindow = mainWindow; 635 while 635 while(tmpWindow->next) 636 636 tmpWindow = tmpWindow->next; 637 637 tmpWindow->next = windowToAdd; … … 644 644 \brief Creating a new Window without a Name 645 645 */ 646 Window::Window 646 Window::Window(void) 647 647 { 648 648 this->init(); … … 654 654 */ 655 655 656 Window::Window 656 Window::Window(char* windowName) 657 657 { 658 658 this->init(); 659 this->setTitle 659 this->setTitle(windowName); 660 660 } 661 661 … … 671 671 \brief initializes a new Window 672 672 */ 673 void Window::init( )673 void Window::init(void) 674 674 { 675 675 if (!mainWindow) … … 681 681 682 682 #ifdef HAVE_GTK2 683 widget = gtk_window_new 684 gtk_window_set_policy 683 widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); 684 gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE); 685 685 #if !defined(__WIN32__) 686 // gtk_window_set_decorated (GTK_WINDOW(widget), FALSE);686 // gtk_window_set_decorated(GTK_WINDOW(widget), FALSE); 687 687 #endif 688 gtk_container_set_border_width (GTK_CONTAINER(widget), 3);688 gtk_container_set_border_width(GTK_CONTAINER(widget), 3); 689 689 #endif /* HAVE_GTK2 */ 690 690 } … … 708 708 \brief Shows all Widgets that are included within this->widget. 709 709 */ 710 void Window::showall ()711 { 712 if (! isOpen)713 { 714 // printf 715 #ifdef HAVE_GTK2 716 gtk_widget_show_all (widget);710 void Window::showall(void) 711 { 712 if (!this->isOpen) 713 { 714 // printf("showall\n"); 715 #ifdef HAVE_GTK2 716 gtk_widget_show_all(this->widget); 717 717 #endif /* HAVE_GTK2 */ 718 isOpen = true;718 this->isOpen = true; 719 719 } 720 720 else 721 721 { 722 // printf 723 #ifdef HAVE_GTK2 724 gtk_widget_show (widget);722 // printf("showone\n"); 723 #ifdef HAVE_GTK2 724 gtk_widget_show(this->widget); 725 725 #endif /* HAVE_GTK2 */ 726 726 } … … 731 731 \param title title the Window should get. 732 732 */ 733 void Window::setTitle 733 void Window::setTitle(char* title) 734 734 { 735 735 if (this->title) … … 738 738 strcpy(this->title, title); 739 739 #ifdef HAVE_GTK2 740 gtk_window_set_title (GTK_WINDOW(widget), title);740 gtk_window_set_title(GTK_WINDOW(widget), title); 741 741 #endif /* HAVE_GTK2 */ 742 742 } … … 745 745 \brief opens up a Window and fixes the Focus to it 746 746 */ 747 void Window::open( )747 void Window::open(void) 748 748 { 749 749 if (this != mainWindow) … … 751 751 isOpen = true; 752 752 #ifdef HAVE_GTK2 753 gtk_widget_show_all( widget);754 gtk_grab_add( widget);753 gtk_widget_show_all(this->widget); 754 gtk_grab_add(this->widget); 755 755 #endif /* HAVE_GTK2 */ 756 756 } … … 760 760 \brief closes up a Window and removes the Focus from it 761 761 */ 762 void Window::close( )762 void Window::close(void) 763 763 { 764 764 if (this != mainWindow) 765 765 { 766 isOpen = false;767 #ifdef HAVE_GTK2 768 gtk_grab_remove( widget);769 gtk_widget_hide (widget);770 #endif /* HAVE_GTK2 */ 771 } 772 } 773 774 #ifdef HAVE_GTK2 775 /** 776 \brief opens up a window 766 this->isOpen = false; 767 #ifdef HAVE_GTK2 768 gtk_grab_remove(this->widget); 769 gtk_widget_hide(this->widget); 770 #endif /* HAVE_GTK2 */ 771 } 772 } 773 774 #ifdef HAVE_GTK2 775 /** 776 \brief opens up a window(not topmost Window). 777 777 this is the Signal that does it. !!SIGNALS ARE STATIC!! 778 778 \param widget the widget that did it. … … 780 780 \param window the Window that should be opened 781 781 */ 782 gint Window::windowOpen 782 gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window) 783 783 { 784 784 static_cast<Window*>(window)->open(); … … 786 786 787 787 /** 788 \brief closes a window 788 \brief closes a window(not topmost Window). 789 789 this is the Signal that does it. !!SIGNALS ARE STATIC!! 790 790 \param widget the widget that did it! … … 792 792 \param window the Window that should be closed 793 793 */ 794 gint Window::windowClose 794 gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window) 795 795 { 796 796 static_cast<Window*>(window)->close(); … … 805 805 \brief Creates a new Frame without a name 806 806 */ 807 Frame::Frame 807 Frame::Frame(void) 808 808 { 809 809 this->init(); … … 813 813 \brief Creates a new Frame with name title 814 814 */ 815 Frame::Frame 815 Frame::Frame(char* title) 816 816 { 817 817 this->init(); … … 822 822 \brief destrcucts a Frame 823 823 */ 824 Frame::~Frame( )824 Frame::~Frame(void) 825 825 { 826 826 this->destroy(); … … 830 830 \brief Initializes a new Frame with default settings 831 831 */ 832 void Frame::init( )832 void Frame::init(void) 833 833 { 834 834 static_cast<Container*>(this)->init(); 835 835 836 836 #ifdef HAVE_GTK2 837 widget = gtk_frame_new("");838 gtk_container_set_border_width (GTK_CONTAINER (widget), 3);837 this->widget = gtk_frame_new(""); 838 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 839 839 #endif /* HAVE_GTK2 */ 840 840 } … … 857 857 \param title The title the Frame should get. 858 858 */ 859 void Frame::setTitle 859 void Frame::setTitle(char* title) 860 860 { 861 861 if (this->title) … … 864 864 strcpy(this->title, title); 865 865 #ifdef HAVE_GTK2 866 gtk_frame_set_label (GTK_FRAME(widget), title);866 gtk_frame_set_label(GTK_FRAME(widget), title); 867 867 #endif /* HAVE_GTK2 */ 868 868 } … … 873 873 \brief Creates a new EventBox with default settings. 874 874 */ 875 EventBox::EventBox 875 EventBox::EventBox(void) 876 876 { 877 877 this->init(); … … 880 880 /** 881 881 \brief Creates a new EventBox with name title 882 \param title title the Eventbox should get 883 */ 884 EventBox::EventBox 882 \param title title the Eventbox should get(only data-structure-internal) 883 */ 884 EventBox::EventBox(char* title) 885 885 { 886 886 this->init(); … … 902 902 void EventBox::init(void) 903 903 { 904 isOption = -1;904 this->isOption = -1; 905 905 906 906 static_cast<Container*>(this)->init(); 907 907 908 908 #ifdef HAVE_GTK2 909 widget = gtk_event_box_new();910 gtk_container_set_border_width (GTK_CONTAINER (widget), 3);909 this->widget = gtk_event_box_new(); 910 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 911 911 #endif /* HAVE_GTK2 */ 912 912 } … … 926 926 927 927 /** 928 \brief Sets the Title of the EventBox 929 \param title Name the EventBox should get 930 */ 931 void EventBox::setTitle 928 \brief Sets the Title of the EventBox(not implemented) 929 \param title Name the EventBox should get(only datastructure-internal). 930 */ 931 void EventBox::setTitle(char* title) 932 932 { 933 933 if (this->title) … … 942 942 \brief Creates a new horizontal Box 943 943 */ 944 Box::Box 944 Box::Box(void) 945 945 { 946 946 this->init('h'); … … 951 951 \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally 952 952 */ 953 Box::Box 953 Box::Box(char boxtype) 954 954 { 955 955 this->init(boxtype); … … 970 970 void Box::init(char boxtype) 971 971 { 972 isOption = -2;972 this->isOption = -2; 973 973 974 974 static_cast<Packer*>(this)->init(); … … 976 976 if (boxtype == 'v') 977 977 { 978 widget = gtk_vbox_new(FALSE, 0);978 this->widget = gtk_vbox_new(FALSE, 0); 979 979 } 980 980 else 981 981 { 982 widget = gtk_hbox_new(FALSE, 0);982 this->widget = gtk_hbox_new(FALSE, 0); 983 983 } 984 984 #endif /* HAVE_GTK2 */ … … 1004 1004 It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next 1005 1005 */ 1006 void Box::fill (Widget *lowerWidget)1007 { 1008 #ifdef HAVE_GTK2 1009 gtk_box_pack_start (GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0);1006 void Box::fill(Widget* lowerWidget) 1007 { 1008 #ifdef HAVE_GTK2 1009 gtk_box_pack_start(GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0); 1010 1010 #endif /* HAVE_GTK2 */ 1011 1011 if (this->down == NULL) … … 1015 1015 Widget* tmp; 1016 1016 tmp = this->down; 1017 while 1017 while(tmp->next != NULL) 1018 1018 { 1019 1019 tmp = tmp->next; … … 1041 1041 sets all Option-Specific-Values to their defaults. 1042 1042 */ 1043 void Option::init( )1044 { 1045 value = 0;1046 flagName = NULL;1047 flagNameShort = NULL;1048 saveable = false;1049 defaultValue = 0;1043 void Option::init(void) 1044 { 1045 this->value = 0; 1046 this->flagName = NULL; 1047 this->flagNameShort = NULL; 1048 this->saveable = false; 1049 this->defaultValue = 0; 1050 1050 1051 1051 static_cast<Widget*>(this)->init(); … … 1060 1060 { 1061 1061 PRINTF(4)("deleting the Option Part.\n"); 1062 if ( flagName)1063 delete [] flagName;1064 if ( flagNameShort)1065 delete [] flagNameShort;1062 if (this->flagName) 1063 delete []this->flagName; 1064 if (this->flagNameShort) 1065 delete []this->flagNameShort; 1066 1066 1067 1067 static_cast<Widget*>(this)->destroy(); … … 1072 1072 !! Options will be saved if flagname is different from NULL !! 1073 1073 \param flagname the Name that will be displayed in the output 1074 \param defaultvalue the default Value for this Option 1075 */ 1076 void Option::setFlagName 1077 { 1078 if ( flagName)1079 delete flagName;1080 flagName = new char [strlen(flagname)+1];1081 strcpy( flagName, flagname);1082 defaultValue = defaultvalue;1074 \param defaultvalue the default Value for this Option(see definition of defaultvalue 1075 */ 1076 void Option::setFlagName(char* flagname, int defaultvalue) 1077 { 1078 if (this->flagName) 1079 delete this->flagName; 1080 this->flagName = new char [strlen(flagname)+1]; 1081 strcpy(this->flagName, flagname); 1082 this->defaultValue = defaultvalue; 1083 1083 1084 1084 // cout << "Set Flagname of " << this->title << " to " << flagname << endl; … … 1086 1086 1087 1087 /** 1088 \brief see Option::setFlagName 1088 \brief see Option::setFlagName(char* flagname, int defaultvalue) 1089 1089 \param flagname the Name that will be displayed in the output 1090 \param defaultvalue the default Value for this Option 1090 \param defaultvalue the default Value for this Option(see definition of defaultvalue 1091 1091 \param flagnameshort a short flagname to be displayed in the output 1092 1092 */ 1093 void Option::setFlagName 1094 { 1095 if ( flagName)1096 delete flagName;1097 flagName = new char [strlen(flagname)+1];1098 strcpy( flagName, flagname);1099 1100 if ( flagNameShort)1101 delete flagNameShort;1102 flagNameShort = new char [strlen(flagnameshort)+1];1103 strcpy( flagNameShort, flagnameshort);1104 defaultValue = defaultvalue;1093 void Option::setFlagName(char* flagname, char* flagnameshort, int defaultvalue) 1094 { 1095 if (this->flagName) 1096 delete []this->flagName; 1097 this->flagName = new char [strlen(flagname)+1]; 1098 strcpy(this->flagName, flagname); 1099 1100 if (this->flagNameShort) 1101 delete []this->flagNameShort; 1102 this->flagNameShort = new char [strlen(flagnameshort)+1]; 1103 strcpy(this->flagNameShort, flagnameshort); 1104 this->defaultValue = defaultvalue; 1105 1105 // cout << "Set Flagname of " << this->title << " to " << flagname << endl; 1106 1106 } … … 1137 1137 \param slider the Slider-Object that should receive the change. 1138 1138 */ 1139 gint Option::OptionChange 1139 gint Option::OptionChange(GtkWidget *widget, Widget* option) 1140 1140 { 1141 1141 static_cast<Option*>(option)->changeOption(); 1142 flags->setTextFromFlags( orxonoxGUI); //// must be different !!!1142 flags->setTextFromFlags(Window::mainWindow); //// must be different !!! 1143 1143 } 1144 1144 #endif /* HAVE_GTK2 */ … … 1175 1175 1176 1176 #ifdef HAVE_GTK2 1177 widget = gtk_button_new_with_label 1177 widget = gtk_button_new_with_label(""); 1178 1178 #endif /* HAVE_GTK2 */ 1179 1179 } … … 1196 1196 \param title The name the Button should get 1197 1197 */ 1198 void Button::setTitle 1198 void Button::setTitle(char *title) 1199 1199 { 1200 1200 if (this->title) … … 1203 1203 strcpy(this->title, title); 1204 1204 #ifdef HAVE_GTK2 1205 gtk_button_set_label 1205 gtk_button_set_label(GTK_BUTTON(widget), title); 1206 1206 #endif /* HAVE_GTK2 */ 1207 1207 } … … 1211 1211 not implemented yet 1212 1212 */ 1213 void Button::redraw 1213 void Button::redraw(void) 1214 1214 { 1215 1215 } … … 1217 1217 /** 1218 1218 \brief Button can not be changed, optionChange is empty) 1219 1220 \todo Actions for non-GTK-mode 1219 1221 */ 1220 1222 void Button::changeOption(void) … … 1229 1231 \param buttonname The name the CheckButton should display. 1230 1232 */ 1231 CheckButton::CheckButton 1233 CheckButton::CheckButton(char* buttonname) 1232 1234 { 1233 1235 this->init(); … … 1235 1237 1236 1238 #ifdef HAVE_GTK2 1237 this->connectSignal 1239 this->connectSignal("clicked", this->OptionChange); 1238 1240 #endif /* HAVE_GTK2 */ 1239 1241 } … … 1252 1254 void CheckButton::init(void) 1253 1255 { 1254 isOption = 1;1256 this->isOption = 1; 1255 1257 1256 1258 static_cast<Option*>(this)->init(); 1257 1259 1258 1260 #ifdef HAVE_GTK2 1259 widget = gtk_check_button_new_with_label("");1261 this->widget = gtk_check_button_new_with_label(""); 1260 1262 #endif /* HAVE_GTK2 */ 1261 1263 } … … 1289 1291 } 1290 1292 1291 bool CheckButton::isActive( )1293 bool CheckButton::isActive(void) 1292 1294 { 1293 1295 #ifdef HAVE_GTK2 … … 1299 1301 \brief Changed the Option, call this Function 1300 1302 */ 1301 void CheckButton::changeOption( )1302 { 1303 #ifdef HAVE_GTK2 1304 this->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(this->widget));1303 void CheckButton::changeOption(void) 1304 { 1305 #ifdef HAVE_GTK2 1306 this->value =(int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(this->widget)); 1305 1307 #else /* HAVE_GTK2 */ 1306 1308 char tmpChar[20]; … … 1316 1318 1317 1319 /** 1318 \brief Redraws the CheckButton 1320 \brief Redraws the CheckButton(if option has changed). 1319 1321 Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change 1320 1322 */ 1321 void CheckButton::redraw ()1322 { 1323 #ifdef HAVE_GTK2 1324 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);1323 void CheckButton::redraw(void) 1324 { 1325 #ifdef HAVE_GTK2 1326 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(this->widget), value); 1325 1327 #endif /* HAVE_GTK2 */ 1326 1328 } … … 1334 1336 \param end The maximal Value of the slider. 1335 1337 */ 1336 Slider::Slider 1338 Slider::Slider(char* slidername, int start, int end) 1337 1339 { 1338 1340 this->init(start, end); … … 1340 1342 this->setTitle(slidername); 1341 1343 #ifdef HAVE_GTK2 1342 this->connectSignal 1344 this->connectSignal("value_changed", this->OptionChange); 1343 1345 #endif /* HAVE_GTK2 */ 1344 1346 } … … 1354 1356 /** 1355 1357 \brief Initializes a Slider with start and end Values 1356 params: see Slider::Slider 1358 params: see Slider::Slider(char* slidername, int start, int end) 1357 1359 */ 1358 1360 void Slider::init(int start, int end) 1359 1361 { 1360 isOption = 2;1362 this->isOption = 2; 1361 1363 1362 1364 static_cast<Option*>(this)->init(); … … 1365 1367 this->end = end; 1366 1368 #ifdef HAVE_GTK2 1367 widget = gtk_hscale_new_with_range (start,end, 5);1369 widget = gtk_hscale_new_with_range(this->start, this->end, 5); 1368 1370 #endif /* HAVE_GTK2 */ 1369 1371 } … … 1406 1408 /** 1407 1409 \brief Redraws the widget 1408 Example: see void CheckButton::redraw ()1409 */ 1410 void Slider::redraw ()1411 { 1412 #ifdef HAVE_GTK2 1413 gtk_range_set_value (GTK_RANGE (widget), value);1410 Example: see void CheckButton::redraw(void) 1411 */ 1412 void Slider::redraw(void) 1413 { 1414 #ifdef HAVE_GTK2 1415 gtk_range_set_value(GTK_RANGE(this->widget), value); 1414 1416 #endif /* HAVE_GTK2 */ 1415 1417 } … … 1418 1420 \brief Changed the Option, call this Function 1419 1421 */ 1420 void Slider::changeOption( )1421 { 1422 #ifdef HAVE_GTK2 1423 this->value = 1422 void Slider::changeOption(void) 1423 { 1424 #ifdef HAVE_GTK2 1425 this->value =(int)gtk_range_get_value(GTK_RANGE(this->widget)); 1424 1426 #else /* HAVE_GTK2 */ 1425 1427 char tmpChar[20]; … … 1443 1445 \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!! 1444 1446 */ 1445 Menu::Menu 1447 Menu::Menu(char* menuname, ...) 1446 1448 { 1447 1449 this->init(); … … 1451 1453 1452 1454 #ifdef HAVE_GTK2 /////////////////////// REINPLEMENT 1453 va_start 1454 while (strcmp (itemName = va_arg(itemlist, char*), "lastItem"))1455 va_start(itemlist, menuname); 1456 while(strcmp(itemName = va_arg(itemlist, char*), "lastItem")) 1455 1457 { 1456 1458 this->addItem(itemName); … … 1460 1462 1461 1463 #ifdef HAVE_GTK2 1462 gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu);1463 this->connectSignal 1464 gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu); 1465 this->connectSignal("changed", this->OptionChange); 1464 1466 #endif /* HAVE_GTK2 */ 1465 1467 } … … 1478 1480 void Menu::init(void) 1479 1481 { 1480 isOption = 2;1482 this->isOption = 2; 1481 1483 1482 1484 static_cast<Option*>(this)->init(); 1483 1485 1484 1486 #ifdef HAVE_GTK2 1485 widget = gtk_option_menu_new();1486 menu = gtk_menu_new();1487 this->widget = gtk_option_menu_new(); 1488 this->menu = gtk_menu_new(); 1487 1489 #endif /* HAVE_GTK2 */ 1488 1490 … … 1519 1521 \brief appends a new Item to the Menu-List. 1520 1522 \param itemName the itemName to be appendet. 1521 */ 1522 void Menu::addItem (char* itemName) 1523 { 1524 #ifdef HAVE_GTK2 1525 item = gtk_menu_item_new_with_label (itemName); 1526 gtk_menu_shell_append(GTK_MENU_SHELL (menu), item); 1523 1524 \todo make the item-list readable without GTK 1525 */ 1526 void Menu::addItem(char* itemName) 1527 { 1528 #ifdef HAVE_GTK2 1529 this->item = gtk_menu_item_new_with_label(itemName); 1530 gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item); 1527 1531 #endif /* HAVE_GTK2 */ 1528 1532 } … … 1530 1534 /** 1531 1535 \brief Redraws the widget 1532 Example: see void CheckButton::redraw ()1533 */ 1534 void Menu::redraw ()1535 { 1536 #ifdef HAVE_GTK2 1537 gtk_option_menu_set_history (GTK_OPTION_MENU (widget),value);1536 Example: see void CheckButton::redraw(void) 1537 */ 1538 void Menu::redraw(void) 1539 { 1540 #ifdef HAVE_GTK2 1541 gtk_option_menu_set_history(GTK_OPTION_MENU(this->widget), this->value); 1538 1542 #endif /* HAVE_GTK2 */ 1539 1543 } … … 1542 1546 \brief Changed the Option, call this Function 1543 1547 */ 1544 void Menu::changeOption( )1545 { 1546 #ifdef HAVE_GTK2 1547 this->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU(this->widget));1548 void Menu::changeOption(void) 1549 { 1550 #ifdef HAVE_GTK2 1551 this->value =(int)gtk_option_menu_get_history(GTK_OPTION_MENU(this->widget)); 1548 1552 #else /* HAVE_GTK2 */ 1549 1553 char tmpChar[20]; 1550 cout << "\nPlease give me a new value for " << this->title << " 1554 cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): "; 1551 1555 cin >> tmpChar; 1552 1556 this->value = atoi(tmpChar); … … 1561 1565 \brief Creates a new OptionLabel with a LabelName and a Value. 1562 1566 \param label The name of the OptionLabel. 1563 \param value The Value of the OptionLabel 1567 \param value The Value of the OptionLabel(what will be displayed). 1564 1568 */ 1565 1569 OptionLabel::OptionLabel(char* label, char* value) 1566 1570 { 1567 init();1568 setTitle(label);1569 setValue(value);1571 this->init(); 1572 this->setTitle(label); 1573 this->setValue(value); 1570 1574 } 1571 1575 … … 1583 1587 void OptionLabel::init(void) 1584 1588 { 1589 this->isOption = 5; 1585 1590 static_cast<Option*>(this)->init(); 1586 isOption = 5; 1591 1587 1592 cValue = NULL; 1588 1593 1589 1594 #ifdef HAVE_GTK2 1590 widget = gtk_label_new("");1595 this->widget = gtk_label_new(""); 1591 1596 #endif /* HAVE_GTK2 */ 1592 1597 } … … 1601 1606 else 1602 1607 PRINTF(3)("deleting the OptionLabel.\n"); 1603 if ( cValue)1604 delete [] cValue;1608 if (this->cValue) 1609 delete []this->cValue; 1605 1610 1606 1611 static_cast<Option*>(this)->destroy(); … … 1614 1619 void OptionLabel::setValue(char* newValue) 1615 1620 { 1616 if ( cValue)1617 delete cValue;1618 cValue = new char [strlen(newValue)+1];1619 strcpy( cValue, newValue);1620 #ifdef HAVE_GTK2 1621 gtk_label_set_text (GTK_LABEL (widget),cValue);1621 if (this->cValue) 1622 delete []this->cValue; 1623 this->cValue = new char [strlen(newValue)+1]; 1624 strcpy(this->cValue, newValue); 1625 #ifdef HAVE_GTK2 1626 gtk_label_set_text(GTK_LABEL(this->widget), this->cValue); 1622 1627 #endif /* HAVE_GTK2 */ 1623 1628 } … … 1633 1638 this->title = new char [strlen(title)+1]; 1634 1639 strcpy(this->title, title); 1635 #ifdef HAVE_GTK2 1636 gtk_label_set_text (GTK_LABEL(widget), title); 1637 #endif /* HAVE_GTK2 */ 1638 } 1639 1640 /** 1641 \brief Redraws an OptionLabel (not implemented yet, but it works). 1640 this->redraw(); 1641 } 1642 1643 /** 1644 \brief Redraws an OptionLabel(not implemented yet, but it works). 1642 1645 */ 1643 1646 void OptionLabel::redraw(void) 1644 1647 { 1645 1648 #ifdef HAVE_GTK2 1649 gtk_label_set_text(GTK_LABEL(widget), title); 1650 #endif /* HAVE_GTK2 */ 1646 1651 } 1647 1652 … … 1649 1654 \brief Changed the Option, call this Function 1650 1655 */ 1651 void OptionLabel::changeOption( )1652 { 1653 #ifdef HAVE_GTK2 1654 this->cValue = (char*)gtk_label_get_text(GTK_LABEL(this->widget));1656 void OptionLabel::changeOption(void) 1657 { 1658 #ifdef HAVE_GTK2 1659 this->cValue =(char*)gtk_label_get_text(GTK_LABEL(this->widget)); 1655 1660 #else /* HAVE_GTK2 */ 1656 1661 cout << "\nPlease give me a new input for " << this->title << ": "; … … 1665 1670 You migth consider adding Label::setTitle with this. 1666 1671 */ 1667 Label::Label ()1672 Label::Label(void) 1668 1673 { 1669 1674 this->init(); … … 1674 1679 \param text The text to be displayed. 1675 1680 */ 1676 Label:: Label 1681 Label:: Label(char* text) 1677 1682 { 1678 1683 this->init(); … … 1693 1698 void Label::init(void) 1694 1699 { 1695 isOption = 0;1700 this->isOption = 0; 1696 1701 1697 1702 static_cast<Widget*>(this)->init(); 1698 1703 1699 1704 #ifdef HAVE_GTK2 1700 widget = gtk_label_new("");1701 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE);1705 this->widget = gtk_label_new(""); 1706 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE); 1702 1707 #endif /* HAVE_GTK2 */ 1703 1708 } … … 1727 1732 strcpy(this->title, text); 1728 1733 #ifdef HAVE_GTK2 1729 gtk_label_set_text (GTK_LABEL (this->widget), text);1734 gtk_label_set_text(GTK_LABEL(this->widget), this->title); 1730 1735 #endif /* HAVE_GTK2 */ 1731 1736 } … … 1759 1764 1760 1765 #ifdef HAVE_GTK2 1761 gtk_label_set_text (GTK_LABEL(this->widget), title);1766 gtk_label_set_text(GTK_LABEL(this->widget), title); 1762 1767 #endif /* HAVE_GTK2 */ 1763 1768 } … … 1771 1776 void Label::appendInt(int intToAppend) 1772 1777 { 1773 char append [ 20];1778 char append [32]; 1774 1779 sprintf(append, "%d", intToAppend); 1775 1780 this->appendText(append); … … 1781 1786 \return The Text the Label holds. 1782 1787 */ 1783 char* Label::getText ()1788 char* Label::getText(void) 1784 1789 { 1785 1790 return this->title; … … 1789 1794 \brief Creates a new ProgressBar. 1790 1795 */ 1791 ProgressBar::ProgressBar 1792 { 1793 this->init 1796 ProgressBar::ProgressBar(void) 1797 { 1798 this->init(); 1794 1799 } 1795 1800 … … 1798 1803 \param label The name you want to get the ProgressBar. 1799 1804 */ 1800 ProgressBar::ProgressBar 1805 ProgressBar::ProgressBar(char* label) 1801 1806 { 1802 1807 this->init(); 1803 this->setTitle 1808 this->setTitle(label); 1804 1809 } 1805 1810 … … 1807 1812 \brief destructs a ProgressBar 1808 1813 */ 1809 ProgressBar::~ProgressBar ()1814 ProgressBar::~ProgressBar(void) 1810 1815 { 1811 1816 this->destroy(); … … 1815 1820 \brief Initializes a ProgressBar 1816 1821 */ 1817 void ProgressBar::init 1818 { 1819 isOption = 0;1820 progress = 0.0;1821 t otalSize = 0.0;1822 void ProgressBar::init(void) 1823 { 1824 this->isOption = 0; 1825 this->progress = 0.0; 1826 this->totalSize = 0.0; 1822 1827 1823 1828 static_cast<Widget*>(this)->init(); 1824 1829 #ifdef HAVE_GTK2 1825 adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);1826 widget = gtk_progress_bar_new_with_adjustment(adjustment);1830 this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0); 1831 this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment); 1827 1832 #endif /* HAVE_GTK2 */ 1828 1833 } … … 1854 1859 1855 1860 /** 1856 \brief Sets the Total size of the Bar. 1857 */ 1858 void ProgressBar::setTotalSize 1861 \brief Sets the Total size of the Bar.(ex. The maximum one can download) 1862 */ 1863 void ProgressBar::setTotalSize(double totalSize) 1859 1864 { 1860 1865 this->totalSize = totalSize; … … 1864 1869 \brief Sets the progress maximum is this->totalSize 1865 1870 */ 1866 void ProgressBar::setProgress 1871 void ProgressBar::setProgress(double progress) 1867 1872 { 1868 1873 this->progress = progress; … … 1874 1879 gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize); 1875 1880 #endif /* HAVE_GTK2 */ 1876 PRINTF(3)("Progress: %f\n", progress*100.0/totalSize);1881 PRINTF(3)("Progress: %f\n", this->progress*100.0/this->totalSize); 1877 1882 } 1878 1883 … … 1880 1885 \brief returns the Progress Status 1881 1886 */ 1882 double ProgressBar::getProgress 1887 double ProgressBar::getProgress(void) 1883 1888 { 1884 1889 return this->progress; … … 1891 1896 \param imagename the location of the Image on the Hard Disc 1892 1897 */ 1893 Image::Image 1898 Image::Image(char* imagename) 1894 1899 { 1895 1900 this->init(); … … 1900 1905 1901 1906 #ifdef HAVE_GTK2 1902 widget = gtk_image_new_from_file 1907 widget = gtk_image_new_from_file(imagename); 1903 1908 #endif /* HAVE_GTK2 */ 1904 1909 } … … 1915 1920 \brief Initializes a new Image 1916 1921 */ 1917 void Image::init( )1922 void Image::init(void) 1918 1923 { 1919 1924 isOption = 0; -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.h
r3312 r3315 42 42 43 43 public: 44 virtual ~Widget ();45 void init(void); 46 void destroy(void); 47 48 void show ();49 void hide ();44 virtual ~Widget(void); 45 void init(void); 46 void destroy(void); 47 48 void show(void); 49 void hide(void); 50 50 void setSize(int width, int height); 51 51 virtual void setTitle(char* title) = 0; //!< An abstract Function, that sets the title of Widgets. 52 52 53 53 Widget* findWidgetByName(char* name, unsigned int depth); 54 void walkThrough (void(*function)(Widget*), unsigned int depth);55 void walkThrough (void(*function)(Widget*, void*), void* data, unsigned int depth);54 void walkThrough(void(*function)(Widget*), unsigned int depth); 55 void walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth); 56 56 static void listOptionsAndGroups(Widget* widget); 57 57 static void listOptions(Widget* widget); … … 67 67 // Connection - Functions 68 68 69 gulong connectSignal (char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* ));70 gulong connectSignal (char* event, gint(*signal)(GtkWidget*, Widget* ));71 gulong connectSignal (char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void* ));72 gulong connectSignal (char* event, void* extObj, gint(*signal)(GtkWidget*, void* ));73 gulong connectSignal (char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* ));74 void disconnectSignal 69 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 70 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* )); 71 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 72 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void* )); 73 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* )); 74 void disconnectSignal(gulong signalID); 75 75 76 76 // Signals 77 static gint doNothingSignal 77 static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing); 78 78 #endif /* HAVE_GTK2 */ 79 79 … … 99 99 void destroy(void); 100 100 101 void setGroupName 102 char* getGroupName 103 104 virtual void fill 101 void setGroupName(char* name); 102 char* getGroupName(void); 103 104 virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers. 105 105 }; 106 106 … … 121 121 void destroy(void); 122 122 123 // void setBorderWidth 124 // virtual void setTitle 125 void fill 123 // void setBorderWidth(int borderwidth); 124 // virtual void setTitle(char* title) = 0; 125 void fill(Widget* lowerWidget); 126 126 }; 127 127 … … 142 142 Window(char* windowName); 143 143 ~Window(void); 144 void init( );144 void init(void); 145 145 void destroy(void); 146 146 … … 166 166 public: 167 167 Frame(void); 168 Frame 168 Frame(char* frameName); 169 169 ~Frame(void); 170 170 void init(void); … … 181 181 { 182 182 public: 183 EventBox 184 EventBox 183 EventBox(void); 184 EventBox(char* eventBoxName); 185 185 ~EventBox(void); 186 186 void init(void); … … 194 194 A Box can Contain multiple Widgets, that are ordered either horizontally or vertically 195 195 I defined the standartbox to be horizontally. 196 A Box is always filled left->right (horizontally) or up->down(vertically)196 A Box is always filled left->right(horizontally) or up->down(vertically) 197 197 */ 198 198 class Box : public Packer 199 199 { 200 200 public: 201 Box 202 Box 201 Box(void); 202 Box(char boxtype); 203 203 ~Box(void); 204 204 void init(char boxtype); 205 205 void destroy(void); 206 206 207 void fill 207 void fill(Widget* lowerWidget); 208 208 209 209 void setTitle(char* title); … … 223 223 void destroy(void); 224 224 225 int value; //!< every option has a value either true or false 225 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 226 226 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 227 227 char* flagNameShort; //!< like flag_name but shorter 228 int defaultValue; //!< A default value is good, for hiding a option if it is not needed. 228 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 229 229 230 230 void saveability(void); 231 231 void saveability(bool isSaveable); 232 232 bool isSaveable(void); 233 void setFlagName 234 void setFlagName 235 virtual void redraw 233 void setFlagName(char* flagname, int defaultvalue); 234 void setFlagName(char* flagname, char* flagnameshort, int defaultvalue); 235 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 236 236 virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself. 237 237 #ifdef HAVE_GTK2 238 238 // Signals 239 static gint OptionChange 239 static gint OptionChange(GtkWidget* widget, Widget* option); //!< Signal for Options that change. 240 240 #endif /* HAVE_GTK2 */ 241 241 }; … … 248 248 { 249 249 public: 250 Button 250 Button(char* buttonname); 251 251 ~Button(void); 252 252 void init(void); … … 254 254 255 255 void setTitle(char* title); 256 void redraw( );256 void redraw(void); 257 257 void changeOption(void); 258 258 }; … … 264 264 { 265 265 public: 266 CheckButton 266 CheckButton(char* buttonname); 267 267 ~CheckButton(void); 268 268 void init(void); … … 270 270 271 271 void setTitle(char* title); 272 bool isActive( ); //!< a Bool value to see, if this CheckButton is active.273 void redraw ();272 bool isActive(void); //!< a Bool value to see, if this CheckButton is active. 273 void redraw(void); 274 274 void changeOption(void); 275 275 }; … … 307 307 308 308 public: 309 Menu 309 Menu(char* menuname, ...); 310 310 ~Menu(void); 311 311 void init(void); … … 332 332 void setValue(char* newValue); 333 333 void setTitle(char* title); 334 void redraw( );335 void changeOption( );334 void redraw(void); 335 void changeOption(void); 336 336 337 337 char* cValue; //!< The Value the Label will have. \todo make private … … 343 343 { 344 344 public: 345 Label 346 Label 345 Label(void); 346 Label(char* text); 347 347 ~Label(void); 348 348 void init(void); … … 353 353 void appendText(char* textToAppend); 354 354 void appendInt(int intToAppend); 355 char* getText ();355 char* getText(void); 356 356 }; 357 357 … … 360 360 { 361 361 public: 362 ProgressBar 363 ProgressBar 364 ~ProgressBar 365 void init(void); 366 void destroy(void); 367 368 void setTitle(char* title); 369 void setProgress 370 void setTotalSize 371 double getProgress 362 ProgressBar(void); 363 ProgressBar(char* label); 364 ~ProgressBar(void); 365 void init(void); 366 void destroy(void); 367 368 void setTitle(char* title); 369 void setProgress(double progress); 370 void setTotalSize(double totalSize); 371 double getProgress(void); 372 372 373 373 private: … … 387 387 { 388 388 public: 389 Image 389 Image(char* imgaename); 390 390 ~Image(void); 391 391 void init(void); … … 395 395 }; 396 396 397 //gint orxonox_gui_quit 397 //gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data); 398 398 399 399 #endif /* _ORXONOX_GUI_GTK_H */ -
orxonox/branches/updater/src/gui/orxonox_gui_keys.cc
r3288 r3315 29 29 \brief Creates an Keyboard-Frame 30 30 */ 31 OrxonoxGuiKeys::OrxonoxGuiKeys ()32 { 33 keysFrame = new Frame("Keyboard-Options:");31 OrxonoxGuiKeys::OrxonoxGuiKeys(void) 32 { 33 this->keysFrame = new Frame("Keyboard-Options:"); 34 34 // keysFrame->setGroupName("Keyboard"); 35 keysBox = new Box('h');36 player1 = new Player("player1");37 player2 = new Player("player2");38 39 keysBox->fill(player1->getOpenButton());40 keysBox->fill(player2->getOpenButton());41 42 keysFrame->fill (keysBox);35 this->keysBox = new Box('h'); 36 this->player1 = new Player("player1"); 37 this->player2 = new Player("player2"); 38 39 this->keysBox->fill(this->player1->getOpenButton()); 40 this->keysBox->fill(this->player2->getOpenButton()); 41 42 this->keysFrame->fill(this->keysBox); 43 43 } 44 44 … … 47 47 \return Returns the Audio-frame 48 48 */ 49 Widget* OrxonoxGuiKeys::getWidget ()50 { 51 return keysFrame;49 Widget* OrxonoxGuiKeys::getWidget(void) 50 { 51 return this->keysFrame; 52 52 } 53 53 … … 60 60 Player::Player(char* player) 61 61 { 62 char windowName[100] = "Keyboard settings of "; 63 strcat (windowName, player); 64 pKeyWindow = new Window(windowName); 65 pKeyFrame = new Frame (windowName); 66 pKeysBox = new Box('v'); 67 pKeysBox->setGroupName (player); 68 pKeysBox->fill(addKey(UP, "up")); 69 pKeysBox->fill(addKey(DOWN, "down")); 70 pKeysBox->fill(addKey(LEFT, "left")); 71 pKeysBox->fill(addKey(RIGHT, "right")); 72 pKeysBox->fill(addKey(SHOOT, "shoot")); 73 62 char* windowName = new char[strlen(player)+25]; 63 strcpy(windowName, "Keyboard settings of "); 64 strcat(windowName, player); 65 this->pKeyWindow = new Window(windowName); 66 this->pKeyFrame = new Frame(windowName); 67 this->pKeysBox = new Box('v'); 68 this->pKeysBox->setGroupName(player); 69 this->pKeysBox->fill(addKey(UP, "up")); 70 this->pKeysBox->fill(addKey(DOWN, "down")); 71 this->pKeysBox->fill(addKey(LEFT, "left")); 72 this->pKeysBox->fill(addKey(RIGHT, "right")); 73 this->pKeysBox->fill(addKey(SHOOT, "shoot")); 74 delete windowName; 74 75 closeButton = new Button("close"); 75 76 #ifdef HAVE_GTK2 76 closeButton->connectSignal("button_press_event",pKeyWindow, Window::windowClose);77 #endif /* HAVE_GTK2 */ 78 79 pKeysBox->fill(closeButton);80 pKeyFrame->fill(pKeysBox);81 pKeyWindow->fill(pKeyFrame);82 Window::addWindow( pKeyWindow);83 #ifdef HAVE_GTK2 84 pKeyWindow->connectSignal("destroy",pKeyWindow, Window::windowClose);85 pKeyWindow->connectSignal("delete_event",pKeyWindow, Window::windowClose);86 #endif /* HAVE_GTK2 */ 87 88 openButton = new Button(player);89 #ifdef HAVE_GTK2 90 openButton->connectSignal("button_press_event",pKeyWindow, Window::windowOpen);91 #endif /* HAVE_GTK2 */ 92 93 inputWindow = new Window("inputWindow");94 95 inputButton = new Button("test");96 inputWindow->fill(inputButton);97 #ifdef HAVE_GTK2 98 inputWindow->connectSignal("destroy", Widget::doNothingSignal);99 inputWindow->connectSignal("delete_event", Widget::doNothingSignal);77 this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose); 78 #endif /* HAVE_GTK2 */ 79 80 this->pKeysBox->fill(this->closeButton); 81 this->pKeyFrame->fill(this->pKeysBox); 82 this->pKeyWindow->fill(this->pKeyFrame); 83 Window::addWindow(this->pKeyWindow); 84 #ifdef HAVE_GTK2 85 this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose); 86 this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose); 87 #endif /* HAVE_GTK2 */ 88 89 this->openButton = new Button(player); 90 #ifdef HAVE_GTK2 91 this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen); 92 #endif /* HAVE_GTK2 */ 93 94 this->inputWindow = new Window("inputWindow"); 95 96 this->inputButton = new Button("test"); 97 this->inputWindow->fill(inputButton); 98 #ifdef HAVE_GTK2 99 this->inputWindow->connectSignal("destroy", Widget::doNothingSignal); 100 this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal); 100 101 #endif /* HAVE_GTK2 */ 101 102 … … 108 109 \returns A widget that has the Key-Box 109 110 */ 110 Widget* Player::addKey 111 { 112 inputKey[key] = new InputKey;113 inputKey[key]->pKeyBox = new Box();114 inputKey[key]->pKeyButton = new Button(name);115 inputKey[key]->pKeyOLabel = new OptionLabel(name, name);116 inputKey[key]->pKeyOLabel->saveability();111 Widget* Player::addKey(KEYS key, char* name) 112 { 113 this->inputKey[key] = new InputKey; 114 this->inputKey[key]->pKeyBox = new Box(); 115 this->inputKey[key]->pKeyButton = new Button(name); 116 this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name); 117 this->inputKey[key]->pKeyOLabel->saveability(); 117 118 118 119 #ifdef HAVE_GTK2 119 120 //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb); 120 inputKey[key]->pKeyButton->connectSignal("button_press_event",inputKey[key], inputWindowEvent);121 #endif /* HAVE_GTK2 */ 122 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyButton);123 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyOLabel);124 return inputKey[key]->pKeyBox;121 this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent); 122 #endif /* HAVE_GTK2 */ 123 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton); 124 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel); 125 return this->inputKey[key]->pKeyBox; 125 126 } 126 127 … … 128 129 \returns the OpenButton of a Player 129 130 */ 130 Button* Player::getOpenButton( )131 { 132 return openButton;133 } 134 135 /** 136 \brief sets a new Key 131 Button* Player::getOpenButton(void) 132 { 133 return this->openButton; 134 } 135 136 /** 137 \brief sets a new Key(only output) 137 138 \param key the new Key. 138 139 */ … … 163 164 gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey) 164 165 { 165 InputKey* inputkey = 166 InputKey* inputkey =(InputKey*) inputKey; 166 167 char title [20]; 167 168 … … 256 257 char* tmp; 257 258 sprintf(tmp, "%c", event->keyval); 258 printf 259 printf("other key %s \n", tmp); 259 260 strcpy(title, tmp); 260 261 break; 261 262 } 262 263 263 inputkey->pKeyOLabel->setValue 264 inputkey->pKeyOLabel->setValue(title); 264 265 inputButton->disconnectSignal(keySignal); 265 266 inputWindow->close(); -
orxonox/branches/updater/src/gui/orxonox_gui_keys.h
r3187 r3315 15 15 \brief defines the Possible Player Keys 16 16 */ 17 enum KEYS { UP, DOWN, LEFT, RIGHT, SHOOT};17 enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT}; 18 18 19 19 class Player; … … 29 29 30 30 public: 31 OrxonoxGuiKeys ();32 ~OrxonoxGuiKeys ();31 OrxonoxGuiKeys(void); 32 ~OrxonoxGuiKeys(void); 33 33 34 Widget* getWidget ();34 Widget* getWidget(void); 35 35 }; 36 36 … … 64 64 Player(char* player); 65 65 66 Widget* addKey 66 Widget* addKey(KEYS key, char* name); 67 67 68 Button* getOpenButton( );68 Button* getOpenButton(void); 69 69 70 70 #ifdef HAVE_GTK2 -
orxonox/branches/updater/src/gui/orxonox_gui_update.cc
r3303 r3315 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 4 3 Copyright (C) 2004 orx 5 4 … … 37 36 \brief Creates an Audio-Frame 38 37 */ 39 OrxonoxGuiUpdate::OrxonoxGuiUpdate ()38 OrxonoxGuiUpdate::OrxonoxGuiUpdate(void) 40 39 { 41 40 this->getSystemInfo(); 42 41 43 this->updateFrame = new Frame 44 this->updateFrame->setGroupName 45 this->updateBox = new Box 42 this->updateFrame = new Frame("Update-Options:"); 43 this->updateFrame->setGroupName("update"); 44 this->updateBox = new Box('v'); 46 45 #ifdef HAVE_CURL 47 46 48 47 // the Button for autoUpdating 49 this->autoUpdate = new CheckButton 48 this->autoUpdate = new CheckButton("auto update"); 50 49 this->updateBox->fill(this->autoUpdate); 51 this->autoUpdate->setFlagName 50 this->autoUpdate->setFlagName("update", "u", 0); 52 51 this->autoUpdate->saveability(); 53 52 54 this->updateSourceWindowCreate 53 this->updateSourceWindowCreate(); 55 54 this->updateBox->fill(this->updateSourceWindowGetButton()); 56 55 57 this->updateDataWindowCreate 56 this->updateDataWindowCreate(); 58 57 this->updateBox->fill(this->updateDataWindowGetButton()); 59 58 … … 70 69 \return Returns the Audio-frame 71 70 */ 72 Widget* OrxonoxGuiUpdate::getWidget ()73 { 74 return updateFrame;71 Widget* OrxonoxGuiUpdate::getWidget(void) 72 { 73 return this->updateFrame; 75 74 } 76 75 … … 81 80 { 82 81 PRINTF(3)("Grabbing system information\n"); 83 t mpDir = getenv("TMPDIR");84 if 85 t mpDir = "/tmp";86 PRINTF(4)("Temporary directory is: %s\n", t mpDir);82 this->tmpDir = getenv("TMPDIR"); 83 if(!tmpDir) 84 this->tmpDir = "/tmp"; 85 PRINTF(4)("Temporary directory is: %s\n", this->tmpDir); 87 86 88 87 #ifdef __WIN32__ 89 homeDir = getenv("USERPROFILE");88 this->homeDir = getenv("USERPROFILE"); 90 89 #else 91 homeDir = getenv("HOME");90 this->homeDir = getenv("HOME"); 92 91 #endif 93 92 PRINTF(4)("Home directory is %s\n", homeDir); 94 93 95 installDataDir = "/usr/share/games/orxonox";96 PRINTF(4)("Installation of orxonox-data will go to this directory: %s\n", installDataDir);97 98 installSourceDir = "/usr/games/bin";99 PRINTF(4)("Installation of orxonox-source will go to this directory: %s\n", installSourceDir);100 101 userName = getenv("USER");102 PRINTF(4)("Logged in username is: %s\n", userName);94 this->installDataDir = "/usr/share/games/orxonox"; 95 PRINTF(4)("Installation of orxonox-data will go to this directory: %s\n", this->installDataDir); 96 97 this->installSourceDir = "/usr/games/bin"; 98 PRINTF(4)("Installation of orxonox-source will go to this directory: %s\n", this->installSourceDir); 99 100 this->userName = getenv("USER"); 101 PRINTF(4)("Logged in username is: %s\n", this->userName); 103 102 } 104 103 … … 119 118 \brief Creates a window, and all it contains for the Data-update. 120 119 */ 121 void OrxonoxGuiUpdate::updateDataWindowCreate 122 { 123 updateDataWindow = new Window("update orxonox::Data");124 updateDataBox = new Box('v');120 void OrxonoxGuiUpdate::updateDataWindowCreate(void) 121 { 122 this->updateDataWindow = new Window("update orxonox::Data"); 123 this->updateDataBox = new Box('v'); 125 124 126 125 // the close-Button of the Update Window. 127 // updateWindowClose = new Button 126 // updateWindowClose = new Button("close"); 128 127 #ifdef HAVE_GTK2 129 128 // updateWindowClose->connectSignal("button_press_event", updateWindow, Window::windowClose); … … 131 130 // updateWindowBox->fill(updateWindowClose); 132 131 133 updateDataBar = new ProgressBar();134 updateDataBox->fill(updateDataBar);132 this->updateDataBar = new ProgressBar(); 133 this->updateDataBox->fill(this->updateDataBar); 135 134 136 135 FileInfo* dataInfo = new FileInfo; 137 dataInfo->bar = updateDataBar;138 139 updateDataBegin = new Button("begin.");140 dataInfo->stateButton = updateDataBegin;141 #ifdef HAVE_GTK2 142 dataInfo->buttonSignal = updateDataBegin->connectSignal 143 #endif /* HAVE_GTK2 */ 144 updateDataBox->fill(updateDataBegin);145 146 updateDataWindow->fill (updateDataBox);147 148 updateDataWindowButton = new Button("update orxonox::Data");149 #ifdef HAVE_GTK2 150 updateDataWindowButton->connectSignal("button_press_event",updateDataWindow, Window::windowOpen);151 updateDataWindow->connectSignal("destroy",updateDataWindow, Window::windowClose);152 updateDataWindow->connectSignal("delete_event",updateDataWindow, Window::windowClose);136 dataInfo->bar = this->updateDataBar; 137 138 this->updateDataBegin = new Button("begin."); 139 dataInfo->stateButton = this->updateDataBegin; 140 #ifdef HAVE_GTK2 141 dataInfo->buttonSignal = updateDataBegin->connectSignal("button_press_event", dataInfo, updateDataFunc); 142 #endif /* HAVE_GTK2 */ 143 this->updateDataBox->fill(this->updateDataBegin); 144 145 this->updateDataWindow->fill(this->updateDataBox); 146 147 this->updateDataWindowButton = new Button("update orxonox::Data"); 148 #ifdef HAVE_GTK2 149 this->updateDataWindowButton->connectSignal("button_press_event", this->updateDataWindow, Window::windowOpen); 150 this->updateDataWindow->connectSignal("destroy", this->updateDataWindow, Window::windowClose); 151 this->updateDataWindow->connectSignal("delete_event", this->updateDataWindow, Window::windowClose); 153 152 #endif /* HAVE_GTK2 */ 154 153 … … 160 159 Button* OrxonoxGuiUpdate::updateDataWindowGetButton(void) 161 160 { 162 return updateDataWindowButton;161 return this->updateDataWindowButton; 163 162 } 164 163 … … 166 165 \brief Creates a window, and all it contains for the Source-update. 167 166 */ 168 void OrxonoxGuiUpdate::updateSourceWindowCreate 167 void OrxonoxGuiUpdate::updateSourceWindowCreate(void) 169 168 { 170 169 // the button, that opens this Window. 171 updateSourceWindowButton = new Button("update orxonox::Source");170 this->updateSourceWindowButton = new Button("update orxonox::Source"); 172 171 173 172 // the Window itself 174 updateSourceWindow = new Window("update orxonox::Source");175 176 updateSourceBox = new Box();177 178 updateSourceBar = new ProgressBar();179 updateSourceBox->fill(updateSourceBar);180 test = new Button 173 this->updateSourceWindow = new Window("update orxonox::Source"); 174 175 this->updateSourceBox = new Box(); 176 177 this->updateSourceBar = new ProgressBar(); 178 this->updateSourceBox->fill(this->updateSourceBar); 179 test = new Button("increment"); 181 180 182 181 #ifdef HAVE_GTK2 … … 184 183 #endif /* HAVE_GTK2 */ 185 184 186 updateSourceBox->fill(test);187 updateSourceWindow->fill(updateSourceBox);188 #ifdef HAVE_GTK2 189 updateSourceWindowButton->connectSignal("button_press_event",updateSourceWindow, Window::windowOpen);190 updateSourceWindow->connectSignal("destroy",updateSourceWindow, Window::windowClose);191 updateSourceWindow->connectSignal("delete_event",updateSourceWindow, Window::windowClose);185 this->updateSourceBox->fill(test); 186 this->updateSourceWindow->fill(updateSourceBox); 187 #ifdef HAVE_GTK2 188 this->updateSourceWindowButton->connectSignal("button_press_event", this->updateSourceWindow, Window::windowOpen); 189 this->updateSourceWindow->connectSignal("destroy", this->updateSourceWindow, Window::windowClose); 190 this->updateSourceWindow->connectSignal("delete_event", this->updateSourceWindow, Window::windowClose); 192 191 #endif /* HAVE_GTK2 */ 193 192 … … 199 198 Button* OrxonoxGuiUpdate::updateSourceWindowGetButton(void) 200 199 { 201 return updateSourceWindowButton;200 return this->updateSourceWindowButton; 202 201 } 203 202 … … 212 211 gint OrxonoxGuiUpdate::updateDataFunc(GtkWidget* w, GdkEventKey* event, void* info) 213 212 { 214 FileInfo* dataInfo = 213 FileInfo* dataInfo =(FileInfo*)info; 215 214 216 215 dataInfo->fileName = "02%20orxonox%203.mp3"; … … 242 241 \param stream Filehandler to write to. 243 242 */ 244 size_t OrxonoxGuiUpdate::curlWriteFunc 243 size_t OrxonoxGuiUpdate::curlWriteFunc(void* ptr, size_t size, size_t nmemb, FILE* stream) 245 244 { 246 245 return fwrite(ptr, size, nmemb, stream); … … 254 253 \param stream Filehandler to get data from. 255 254 */ 256 size_t OrxonoxGuiUpdate::curlReadFunc 255 size_t OrxonoxGuiUpdate::curlReadFunc(void* ptr, size_t size, size_t nmemb, FILE* stream) 257 256 { 258 257 return fread(ptr, size, nmemb, stream); … … 268 267 \param upProgress not needed 269 268 */ 270 int OrxonoxGuiUpdate::curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress)271 { 272 Bar->setProgress(progress);273 Bar->setTotalSize(totalSize);269 int OrxonoxGuiUpdate::curlProgressFunc(ProgressBar* bar, double totalSize, double progress, double upTotal, double upProgress) 270 { 271 bar->setProgress(progress); 272 bar->setTotalSize(totalSize); 274 273 #ifdef HAVE_GTK2 275 274 #ifndef HAVE_PTHREAD_H … … 281 280 282 281 /** 283 \brief The Curl handle for only one CURL 282 \brief The Curl handle for only one CURL(static). 284 283 */ 285 284 CURL* OrxonoxGuiUpdate::curlHandle = NULL; … … 305 304 bool OrxonoxGuiUpdate::download(void* fileInfo) 306 305 { 307 if 306 if(isDownloading) 308 307 { 309 308 PRINTF(2)("unable to Download. already getting some file\n"); … … 311 310 } 312 311 PRINTF(3)("Downloading.\n"); 313 FileInfo* info = 312 FileInfo* info =(FileInfo*)fileInfo; 314 313 CURLcode res; 315 314 CURL* localCurl; 316 315 localCurl = curl_easy_init(); 317 316 char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+2]; 318 strcpy 319 if 320 strcat 321 strcat 317 strcpy(fileOnNet, info->webRoot); 318 if(fileOnNet[strlen(fileOnNet)] != '/') //!< \todo windows-shit 319 strcat(fileOnNet, "/"); 320 strcat(fileOnNet, info->fileName); 322 321 char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+2]; 323 strcpy 324 if 325 strcat 326 strcat 322 strcpy(fileOnDisk, info->localRoot); 323 if(fileOnDisk[strlen(fileOnDisk)] != '/') //!< \todo windows-shit 324 strcat(fileOnDisk, "/"); 325 strcat(fileOnDisk, info->fileName); 327 326 328 327 if(localCurl) … … 340 339 341 340 curl_easy_cleanup(localCurl); 342 fclose 341 fclose(info->fileHandle); 343 342 } 344 343 } … … 353 352 bool OrxonoxGuiUpdate::downloadWithStyle(void* fileInfo) 354 353 { 355 if 354 if(isDownloading) 356 355 { 357 356 PRINTF(2)("unable to Download. already getting some file\n"); … … 359 358 } 360 359 PRINTF(3)("Downloading.\n"); 361 FileInfo* info = 360 FileInfo* info =(FileInfo*)fileInfo; 362 361 CURLcode res; 363 362 curlHandle = curl_easy_init(); 364 363 char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+1]; 365 strcpy 366 strcat 364 strcpy(fileOnNet, info->webRoot); 365 strcat(fileOnNet, info->fileName); 367 366 char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+1]; 368 strcpy 369 strcat 367 strcpy(fileOnDisk, info->localRoot); 368 strcat(fileOnDisk, info->fileName); 370 369 371 370 if(curlHandle) … … 382 381 curl_easy_setopt(curlHandle, CURLOPT_PROGRESSDATA, info->bar); 383 382 384 if 383 if(!isDownloading) 385 384 { 386 385 #ifdef HAVE_PTHREAD_H … … 418 417 419 418 /** 420 \brief The downloading process 419 \brief The downloading process(either threaded or not). 421 420 \param fileInfo the FileInfo. 422 421 … … 435 434 void* OrxonoxGuiUpdate::downloadThreadFinished(void* fileInfo) 436 435 { 437 FileInfo* info = 438 #ifdef HAVE_PTHREAD_H 439 pthread_join 436 FileInfo* info =(FileInfo*)fileInfo; 437 #ifdef HAVE_PTHREAD_H 438 pthread_join(*downloadThreadID, NULL); 440 439 #ifdef HAVE_GTK2 441 440 gdk_threads_enter(); 442 441 #endif /* HAVE_GTK2 */ 443 442 #endif /* HAVE_PTHREAD_H */ 444 if 443 if(curlHandle) 445 444 curl_easy_cleanup(curlHandle); 446 445 … … 448 447 fclose(info->fileHandle); 449 448 450 if 449 if(isDownloading) 451 450 info->stateButton->setTitle("go on"); 452 451 // else -
orxonox/branches/updater/src/gui/orxonox_gui_update.h
r3298 r3315 31 31 char* userName; //!< The user logged in. 32 32 33 bool getSystemInfo( );33 bool getSystemInfo(void); 34 34 35 35 // Window creation. … … 53 53 54 54 #ifdef HAVE_GTK2 55 static gint updateDataFunc 56 static gint updateSourceFunc 55 static gint updateDataFunc(GtkWidget* w, GdkEventKey* event, void* info); 56 static gint updateSourceFunc(GtkWidget* w, GdkEventKey* event, void* info); 57 57 #endif /* HAVE_GTK2 */ 58 58 … … 71 71 }; 72 72 73 static size_t curlWriteFunc 74 static size_t curlReadFunc 75 static int curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress);73 static size_t curlWriteFunc(void* ptr, size_t size, size_t nmemb, FILE* stream); 74 static size_t curlReadFunc(void* ptr, size_t size, size_t nmemb, FILE* stream); 75 static int curlProgressFunc(ProgressBar* bar, double totalSize, double progress, double upTotal, double upProgress); 76 76 77 77 static CURL* curlHandle; … … 85 85 static bool isDownloading; 86 86 87 static bool download 88 static bool downloadWithStyle 89 static void* downloadThread 87 static bool download(void* fileInfo); 88 static bool downloadWithStyle(void* fileInfo); 89 static void* downloadThread(void* fileInfo); 90 90 static void* downloadThreadFinished(void* fileInfo); 91 91 … … 94 94 95 95 public: 96 OrxonoxGuiUpdate ();97 ~OrxonoxGuiUpdate ();96 OrxonoxGuiUpdate(void); 97 ~OrxonoxGuiUpdate(void); 98 98 99 Widget* getWidget ();99 Widget* getWidget(void); 100 100 #ifdef HAVE_CURL 101 void updateDataWindowCreate 101 void updateDataWindowCreate(void); 102 102 Button* updateDataWindowGetButton(void); 103 103 104 void updateSourceWindowCreate 104 void updateSourceWindowCreate(void); 105 105 Button* updateSourceWindowGetButton(void); 106 106 107 bool* checkForUpdates( );107 bool* checkForUpdates(void); 108 108 109 109 #endif /* HAVE_CURL */ -
orxonox/branches/updater/src/gui/orxonox_gui_video.cc
r3288 r3315 30 30 \brief Creates the Video-Option-Frame 31 31 */ 32 OrxonoxGuiVideo::OrxonoxGuiVideo ()32 OrxonoxGuiVideo::OrxonoxGuiVideo(void) 33 33 { 34 videoFrame = new Frame("Video-Options:");35 videoBox = new Box('v');36 videoFrame->setGroupName("video");34 this->videoFrame = new Frame("Video-Options:"); 35 this->videoBox = new Box('v'); 36 this->videoFrame->setGroupName("video"); 37 37 38 fullscreen = new CheckButton("Fullscreen-mode");39 fullscreen->setFlagName("windowed", "q", 1);40 fullscreen->saveability();41 videoBox->fill(fullscreen);42 wireframe = new CheckButton("WireFrame-mode");43 wireframe->setFlagName("wireframe", "w", 0);44 wireframe->saveability();45 videoBox->fill(wireframe);38 this->fullscreen = new CheckButton("Fullscreen-mode"); 39 this->fullscreen->setFlagName("windowed", "q", 1); 40 this->fullscreen->saveability(); 41 this->videoBox->fill(fullscreen); 42 this->wireframe = new CheckButton("WireFrame-mode"); 43 this->wireframe->setFlagName("wireframe", "w", 0); 44 this->wireframe->saveability(); 45 this->videoBox->fill(wireframe); 46 46 47 videoFrame->fill(videoBox);47 this->videoFrame->fill(videoBox); 48 48 } 49 49 … … 51 51 \return Returns the Video-frame 52 52 */ 53 Widget* OrxonoxGuiVideo::getWidget ()53 Widget* OrxonoxGuiVideo::getWidget(void) 54 54 { 55 return videoFrame;55 return this->videoFrame; 56 56 } -
orxonox/branches/updater/src/gui/orxonox_gui_video.h
r3187 r3315 17 17 CheckButton* wireframe; //!< CheckButton for wireframe Mode. 18 18 public: 19 OrxonoxGuiVideo ();20 ~OrxonoxGuiVideo ();19 OrxonoxGuiVideo(void); 20 ~OrxonoxGuiVideo(void); 21 21 22 Widget* getWidget ();22 Widget* getWidget(void); 23 23 }; 24 24 #endif /* _ORXONOX_GUI_VIDEO_H */
Note: See TracChangeset
for help on using the changeset viewer.