Changeset 4051 in orxonox.OLD for orxonox/branches/guiMerge/src/lib
- Timestamp:
- May 5, 2005, 1:02:24 AM (20 years ago)
- Location:
- orxonox/branches/guiMerge/src/lib/gui/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/guiMerge/src/lib/gui/gui/gui.cc
r4047 r4051 95 95 } 96 96 // Reading Values from File 97 exec->setConfFile(ORXONOX_GUI_DEFAULT_CONFIG_FILE); 97 exec->setConfDir(GUI_DEFAULT_CONF_DIR); 98 exec->setConfFile(GUI_DEFAULT_CONF_FILE); 98 99 exec->readFromFile(Window::mainWindow); 99 100 // Merging changes to the Options from appended flags. … … 125 126 } 126 127 128 bool OrxonoxGui::startOrxonox = false; 127 129 128 130 /** -
orxonox/branches/guiMerge/src/lib/gui/gui/gui.h
r4049 r4051 16 16 using namespace std; 17 17 18 #define ORXONOX_GUI_DEFAULT_CONFIG_FILE "~/.orxonox/orxonox.conf" 18 #define GUI_DEFAULT_CONF_DIR "~/.orxonox" 19 #define GUI_DEFAULT_CONF_FILE "orxonox.conf" 19 20 20 21 class OrxonoxGuiElement; … … 26 27 OrxonoxGui(int argc, char *argv[]); 27 28 ~OrxonoxGui(void); 29 30 static bool startOrxonox; 28 31 }; 29 32 -
orxonox/branches/guiMerge/src/lib/gui/gui/gui_banner.cc
r4050 r4051 59 59 } 60 60 // Banner Window // 61 logoWindow = new Window( "Logo");61 logoWindow = new Window(PACKAGE_NAME " is:"); 62 62 { 63 63 EventBox* logoEventBox; //!< The EventBox that holds the Orxonox-CrewLogo. it has to be an eventbox, because Images can not receive clicks. … … 70 70 logoEventBox = new EventBox(); 71 71 logoBox = new Box('v'); 72 logoLabel = new Label( "orxonox, version:" PACKAGE_VERSION);72 logoLabel = new Label(PACKAGE_NAME " v." PACKAGE_VERSION); 73 73 logoBox->fill(logoLabel); 74 74 logoImage = new Image(logo_xpm); … … 76 76 77 77 //! \todo add the names of all the guys working on orxonox 78 orxIsLabel = new Label( "orxonoxis:\nPatrick Boenzli - main Developer\nBenjamin Grauer - right Hand\n....");78 orxIsLabel = new Label(PACKAGE_NAME " is:\nPatrick Boenzli - main Developer\nBenjamin Grauer - right Hand\n...."); 79 79 logoBox->fill(orxIsLabel); 80 80 logoEventBox->fill(logoBox); -
orxonox/branches/guiMerge/src/lib/gui/gui/gui_exec.cc
r4049 r4051 26 26 #include "gui_exec.h" 27 27 28 #include "resource_manager.h" 28 29 29 30 #include <string.h> … … 32 33 #include <sys/types.h> 33 34 34 35 35 HashTable* orxonoxFlagHash; 36 36 … … 40 40 OrxonoxGuiExec::OrxonoxGuiExec(void) 41 41 { 42 configFile = new char[512]; 43 44 this->execFrame = new Frame("Execute-Tags:"); 45 this->execBox = new Box('v'); 46 this->execFrame->setGroupName("misc"); 47 48 this->start = new Button("Start"); 49 #ifdef HAVE_GTK2 50 this->start->connectSignal("clicked", this, startOrxonox); 51 #endif /* HAVE_GTK2 */ 52 this->execBox->fill(start); 53 this->saveSettings = new CheckButton("Save Settings"); 54 this->saveSettings->value = 1; 55 this->saveSettings->saveability(); 56 this->execBox->fill(this->saveSettings); 57 this->verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem"); 58 this->verboseMode->setFlagName("verbose", "v", 0); 59 this->verboseMode->saveability(); 60 this->execBox->fill(this->verboseMode); 61 this->alwaysShow = new CheckButton("Always Show this Menu"); 62 this->alwaysShow->setFlagName("gui", "g", 0); 63 this->alwaysShow->saveability(); 64 this->execBox->fill(this->alwaysShow); 65 this->quit = new Button("Quit"); 66 #ifdef HAVE_GTK2 67 this->quit->connectSignal("clicked", this, OrxonoxGuiExec::quitGui); 68 // Window::mainWindow->connectSignal("remove", this, OrxonoxGuiExec::quitGui); 69 Window::mainWindow->connectSignal("destroy", this, OrxonoxGuiExec::quitGui); 70 #endif /* HAVE_GTK2 */ 71 this->execBox->fill(this->quit); 72 73 this->execFrame->fill(this->execBox); 74 75 this->setMainWidget(execFrame); 42 Frame* execFrame; //!< The Frame that holds the ExecutionOptions. 43 44 this->confFile = NULL; 45 this->confDir = NULL; 46 47 execFrame = new Frame("Execute-Tags:"); 48 { 49 Box* execBox; //!< The Box that holds the ExecutionOptions. 50 51 execBox = new Box('v'); 52 execFrame->setGroupName("misc"); 53 { 54 Button* start; //!< The start Button of orxonox. 55 Menu* verboseMode; //!< A Menu for setting the verbose-Mode. \todo setting up a verbose-class. 56 CheckButton* alwaysShow; //!< A CheckButton, for if orxonox should start with or without gui. 57 Button* quit; //!< A Button to quit the Gui without starting orxonox. 58 59 start = new Button("Start"); 60 #ifdef HAVE_GTK2 61 start->connectSignal("clicked", this, startOrxonox); 62 #endif /* HAVE_GTK2 */ 63 execBox->fill(start); 64 this->saveSettings = new CheckButton("Save Settings"); 65 this->saveSettings->value = 1; 66 this->saveSettings->saveability(); 67 execBox->fill(this->saveSettings); 68 verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem"); 69 verboseMode->setFlagName("verbose", "v", 0); 70 verboseMode->saveability(); 71 execBox->fill(verboseMode); 72 alwaysShow = new CheckButton("Always Show this Menu"); 73 alwaysShow->setFlagName("gui", "g", 0); 74 alwaysShow->saveability(); 75 execBox->fill(alwaysShow); 76 quit = new Button("Quit"); 77 #ifdef HAVE_GTK2 78 quit->connectSignal("clicked", this, OrxonoxGuiExec::quitGui); 79 // Window::mainWindow->connectSignal("remove", this, OrxonoxGuiExec::quitGui); 80 Window::mainWindow->connectSignal("destroy", this, OrxonoxGuiExec::quitGui); 81 #endif /* HAVE_GTK2 */ 82 execBox->fill(quit); 83 } 84 execFrame->fill(execBox); 85 } 86 setMainWidget(execFrame); 76 87 } 77 88 … … 81 92 OrxonoxGuiExec::~OrxonoxGuiExec(void) 82 93 { 83 if(this->configFile) 84 delete []this->configFile; 94 if(this->confFile) 95 delete []this->confFile; 96 if(this->confDir) 97 delete []this->confDir; 85 98 } 86 99 87 100 /* FILE HANDLING */ 88 89 /**90 \brief sets the confDir and File-name out of an input-string91 */92 void OrxonoxGuiExec::setConfFile(char* confFile)93 {94 char splitter =95 #ifdef __WIN32__96 '\\';97 #else98 '/';99 #endif100 char* tmpConfFile = new char[strlen(confFile)+1];101 strcpy(tmpConfFile, confFile);102 char* tmp = strrchr(tmpConfFile, splitter);103 if (tmp)104 {105 tmp[0] = '\0';106 this->setConfDir(tmpConfFile);107 this->setFileName(tmp+1);108 }109 else110 {111 this->setConfDir("~/");112 this->setFileName(tmpConfFile);113 }114 delete []tmp;115 delete []tmpConfFile;116 }117 101 118 102 /** … … 120 104 \param confDir the Directory for the configuration files 121 105 */ 122 void OrxonoxGuiExec::setConfDir(char* confDir) 123 { 124 if (!strncmp(confDir, "~/", 2)) 125 { 126 char tmp[500]; 127 #ifdef __WIN32__ 128 strcpy(tmp, getenv("USERPROFILE")); 129 #else 130 strcpy(tmp, getenv("HOME")); 131 #endif 132 this->confDir = new char[strlen(tmp)+strlen(confDir)]; 133 sprintf(this->confDir, "%s%s", tmp, confDir+1); 134 } 135 else 136 { 137 this->confDir = new char[strlen(confDir)+1]; 138 strcpy(this->confDir, confDir); 139 } 106 void OrxonoxGuiExec::setConfDir(const char* confDir) 107 { 108 this->confDir = ResourceManager::homeDirCheck(confDir); 109 140 110 PRINTF(3)("Config Directory is: %s.\n", this->confDir); 111 //! \todo F** Windows-support 141 112 mkdir(this->confDir, 0755); 142 113 } … … 146 117 \param fileName the location of the configFile 147 118 148 \todo: memory allocation could be better.149 150 119 The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows 151 120 */ 152 void OrxonoxGuiExec::set FileName(char* fileName)121 void OrxonoxGuiExec::setConfFile(const char* fileName) 153 122 { 154 123 if (!this->confDir) 155 124 this->setConfDir("~/"); 156 this->conf igFile = new char[strlen(this->confDir)+strlen(fileName)+2];157 sprintf(this->conf igFile, "%s/%s", this->confDir, fileName);158 PRINTF(3)("ConfigurationFile is %s.\n", this->conf igFile);125 this->confFile = new char[strlen(this->confDir)+strlen(fileName)+2]; 126 sprintf(this->confFile, "%s/%s", this->confDir, fileName); 127 PRINTF(3)("ConfigurationFile is %s.\n", this->confFile); 159 128 } 160 129 … … 162 131 \returns The name of the Configuration-File 163 132 */ 164 c har* OrxonoxGuiExec::getConfigFile(void) const165 { 166 return this->conf igFile;133 const char* OrxonoxGuiExec::getConfigFile(void) const 134 { 135 return this->confFile; 167 136 } 168 137 … … 184 153 void OrxonoxGuiExec::writeToFile(Widget* widget) 185 154 { 186 this->CONFIG_FILE = fopen( configFile, "w");155 this->CONFIG_FILE = fopen(this->confFile, "w"); 187 156 if(this->CONFIG_FILE) 188 157 this->writeFileText(widget, 0); … … 248 217 void OrxonoxGuiExec::readFromFile(Widget* widget) 249 218 { 250 this->CONFIG_FILE = fopen( configFile, "r");219 this->CONFIG_FILE = fopen(this->confFile, "r"); 251 220 VarInfo varInfo; 252 221 if(this->CONFIG_FILE) … … 302 271 PRINT(5)("Located Option %s.\n", widget->title); 303 272 if(widget->isOption >= 1) 304 273 static_cast<Option*>(widget)->load(info->variableValue); 305 274 } 306 275 } … … 328 297 if(widget->isOption < 0) 329 298 { 330 if(static_cast<Packer*>(widget)->getGroupName() && !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 299 if(static_cast<Packer*>(widget)->getGroupName() && 300 !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 331 301 { 332 302 return widget; … … 369 339 370 340 PRINT(3)("Starting Orxonox\n"); 341 OrxonoxGui::startOrxonox = true; 371 342 } 372 343 -
orxonox/branches/guiMerge/src/lib/gui/gui/gui_exec.h
r4049 r4051 9 9 #include "gui.h" 10 10 #include "gui_element.h" 11 #include "gui_gtk.h" 11 12 12 #include "gui_gtk.h" 13 class Widget; 14 class CheckButton; 13 15 using namespace std; 14 16 … … 17 19 { 18 20 private: 19 Frame* execFrame; //!< The Frame that holds the ExecutionOptions.20 Box* execBox; //!< The Box that holds the ExecutionOptions.21 Button* start; //!< The start Button of orxonox.22 21 CheckButton* saveSettings; //!< A CheckBox for if the Options should be saved. 23 Menu* verboseMode; //!< A Menu for setting the verbose-Mode. \todo setting up a verbose-class. 24 CheckButton* alwaysShow; //!< A CheckButton, for if orxonox should start with or without gui. 25 Button* quit; //!< A Button to quit the Gui without starting orxonox. 22 26 23 char* confDir; //!< The directory of the orxonox-configuration-files. 27 char* conf igFile;//!< The name of the .orxonox.conf(ig)-file.24 char* confFile; //!< The name of the .orxonox.conf(ig)-file. 28 25 FILE* CONFIG_FILE; //!< Filehandler for reading and writing. 29 26 30 27 //! A struct that holds informations about variables. 31 28 struct VarInfo … … 39 36 ~OrxonoxGuiExec(void); 40 37 41 void setConfFile(char* confFile); 42 void setConfDir(char* confDir); 43 void setFileName(char* fileName); 44 char* getConfigFile(void) const; 38 void setConfDir(const char* confDir); 39 void setConfFile(const char* confFile); 40 const char* getConfigFile(void) const; 45 41 int shouldsave(void); 46 42 void writeToFile(Widget* widget);
Note: See TracChangeset
for help on using the changeset viewer.