/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ### File Specific: main-programmer: Benjamin Grauer */ #include #include "orxonox_gui.h" #include "orxonox_gui_video.h" #include "orxonox_gui_audio.h" #include "orxonox_gui_exec.h" #include "orxonox_gui_flags.h" #include "orxonox_gui_banner.h" #include "orxonox_gui_keys.h" #include "orxonox_gui_update.h" Window* orxonoxGUI; OrxonoxGuiVideo* video; OrxonoxGuiAudio* audio; OrxonoxGuiExec* exec; OrxonoxGuiFlags* flags; OrxonoxGuiBanner* banner; OrxonoxGuiKeys* keys; OrxonoxGuiUpdate* update; int verbose = 4; int main( int argc, char *argv[] ) { OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); return 0; } /* ORXONOXGUI */ /** \brief Initializes the Gui */ OrxonoxGui::OrxonoxGui (int argc, char *argv[]) { initGUI(argc, argv); orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION); Box* windowBox = new Box ('h'); banner = new OrxonoxGuiBanner(); windowBox->fill (banner->getWidget()); Box* optionBox = new Box ('v'); Box* avBox = new Box ('h'); video = new OrxonoxGuiVideo (); avBox->fill (video->getWidget ()); audio = new OrxonoxGuiAudio (); avBox->fill (audio->getWidget ()); optionBox->fill (avBox); keys = new OrxonoxGuiKeys (); optionBox->fill (keys->getWidget ()); exec = new OrxonoxGuiExec (orxonoxGUI); optionBox->fill (exec->getWidget ()); flags = new OrxonoxGuiFlags (orxonoxGUI); optionBox->fill (flags->getWidget ()); windowBox->fill (optionBox); update = new OrxonoxGuiUpdate (); optionBox->fill(update->getWidget()); orxonoxGUI->fill (windowBox); flags->setTextFromFlags (orxonoxGUI); // Reading Values from File exec->setFilename ("~/.orxonox.conf"); exec->readFromFile (orxonoxGUI); // Merging changes to the Options from appended flags. for (int optCount = 1; optCount < argc; optCount++) orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0); orxonoxGUI->showall (); //// Handling special Cases. /// // case update // #ifdef HAVE_CURL if (static_cast(orxonoxGUI->findWidgetByName("auto update", 0))->value == 1) { update->checkForUpdates(); } #endif /* HAVE_CURL */ // case start-with-gui. if (!access(exec->getConfigFile(), F_OK) && static_cast(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0) OrxonoxGuiExec::startOrxonox(NULL, exec); else { #ifdef HAVE_GTK2 mainloopGUI(); #else /* HAVE_GTK2 */ char boolAns = 'y'; char ans[10]; while(true) { PRINT(0)(" Listing all the Orxonox Options: \n"); PRINT(0)(" #############################\n"); Window::mainWindow->walkThrough(Widget::listOptionsAndGroups, 1); PRINT(0)("\nDo you want change any of the above values now? [Yn] "); cin >>boolAns ; if (boolAns =='n' || boolAns=='N') break; PRINT(0)("\n Listing all groups\n"); PRINT(0)(" #################\n"); int groupCount = 0; Window::mainWindow->walkThrough(Widget::listGroups, &groupCount, 1); PRINT(0)("\nIn which Group? [1-%d] ", groupCount); Packer* group; while(true) { cin >> ans; int ansIp = atoi(ans); if (ansIp <= groupCount) { group = static_cast(Window::mainWindow->findGroupByNumber(&ansIp, 1)); break; } else PRINT(0)("\nChoose a smaler Number please: [1-%d] ", groupCount); } PRINT(0)("\n\nGroup: [%s]\n\n", group->groupName); int optionCount = 0; group->walkThrough(Widget::listOptions, &optionCount, 0); PRINT(0)("\nWhich Option? [1-%d] ", optionCount); Option* option; while(true) { cin >> ans; int ansIp = atoi(ans); if (ansIp <= groupCount) { option = static_cast(group->findOptionByNumber(&ansIp, 0)); break; } else PRINT(0)("\nChoose a smaler Number please: [1-%d] ", optionCount); } PRINT(0)("\n\n:: %s ::\n", option->title); option->changeOption(); // here follows the rest.... this will be nasty. //! \todo move this into the gui-gtk-file //! \todo finish it. } } #endif /* HAVE_GTK2 */ }