1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | This program is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with this program; if not, write to the Free Software Foundation, |
---|
18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
19 | |
---|
20 | |
---|
21 | ### File Specific: |
---|
22 | main-programmer: Benjamin Grauer |
---|
23 | |
---|
24 | ToDO: |
---|
25 | way to start gui without GTK (textmode) |
---|
26 | curl interface to Download cool stuff |
---|
27 | |
---|
28 | chain all the windows when starting the GUI (DANGER: performance!!) |
---|
29 | |
---|
30 | widgets save themselves |
---|
31 | good way to step through all the Widgets |
---|
32 | ... many more ... |
---|
33 | label -> protected : getlabel function |
---|
34 | |
---|
35 | */ |
---|
36 | |
---|
37 | #include "orxonox_gui.h" |
---|
38 | #include "orxonox_gui_video.h" |
---|
39 | #include "orxonox_gui_audio.h" |
---|
40 | #include "orxonox_gui_exec.h" |
---|
41 | #include "orxonox_gui_flags.h" |
---|
42 | #include "orxonox_gui_banner.h" |
---|
43 | #include "orxonox_gui_keys.h" |
---|
44 | |
---|
45 | Window* orxonoxGUI; |
---|
46 | OrxonoxGuiVideo* video; |
---|
47 | OrxonoxGuiAudio* audio; |
---|
48 | OrxonoxGuiExec* exec; |
---|
49 | OrxonoxGuiFlags* flags; |
---|
50 | OrxonoxGuiBanner* banner; |
---|
51 | OrxonoxGuiKeys* keys; |
---|
52 | |
---|
53 | int main( int argc, char *argv[] ) |
---|
54 | { |
---|
55 | OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); |
---|
56 | return 0; |
---|
57 | } |
---|
58 | |
---|
59 | /* ORXONOXGUI */ |
---|
60 | |
---|
61 | /** |
---|
62 | \brief Initializes the Gui |
---|
63 | */ |
---|
64 | OrxonoxGui::OrxonoxGui (int argc, char *argv[]) |
---|
65 | { |
---|
66 | #ifdef HAVE_GTK2 |
---|
67 | initGTK(argc, argv); |
---|
68 | #endif /* HAVE_GTK2 */ |
---|
69 | orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION); |
---|
70 | #ifdef HAVE_GTK2 |
---|
71 | orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); |
---|
72 | orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); |
---|
73 | #endif /* HAVE_GTK2 */ |
---|
74 | |
---|
75 | Box* windowBox = new Box ('h'); |
---|
76 | |
---|
77 | banner = new OrxonoxGuiBanner(); |
---|
78 | windowBox->fill (banner->getWidget()); |
---|
79 | |
---|
80 | Box* optionBox = new Box ('v'); |
---|
81 | |
---|
82 | Box* avBox = new Box ('h'); |
---|
83 | |
---|
84 | video = new OrxonoxGuiVideo (); |
---|
85 | avBox->fill (video->getWidget ()); |
---|
86 | audio = new OrxonoxGuiAudio (); |
---|
87 | avBox->fill (audio->getWidget ()); |
---|
88 | |
---|
89 | optionBox->fill (avBox); |
---|
90 | |
---|
91 | keys = new OrxonoxGuiKeys (); |
---|
92 | optionBox->fill (keys->getWidget ()); |
---|
93 | |
---|
94 | exec = new OrxonoxGuiExec (orxonoxGUI); |
---|
95 | optionBox->fill (exec->getWidget ()); |
---|
96 | |
---|
97 | flags = new OrxonoxGuiFlags (orxonoxGUI); |
---|
98 | |
---|
99 | |
---|
100 | optionBox->fill (flags->getWidget ()); |
---|
101 | windowBox->fill (optionBox); |
---|
102 | |
---|
103 | orxonoxGUI->fill (windowBox); |
---|
104 | flags->setTextFromFlags (orxonoxGUI); |
---|
105 | |
---|
106 | exec->setFilename ("~/.orxonox.conf"); |
---|
107 | exec->readFromFile (orxonoxGUI); |
---|
108 | // orxonoxGUI->walkThrough(orxonoxGUI->listOptions); |
---|
109 | |
---|
110 | orxonoxGUI->showall (); |
---|
111 | |
---|
112 | |
---|
113 | #ifdef HAVE_GTK2 |
---|
114 | mainloopGTK(); |
---|
115 | #else /* HAVE_GTK2 */ |
---|
116 | cout << " Listing all the Orxonox Options: \n"; |
---|
117 | cout << " #############################\n"; |
---|
118 | orxonoxGUI->walkThrough(orxonoxGUI->listOptions); |
---|
119 | |
---|
120 | cout << "\nDo you want me to save the the above values now? [Yn] "; |
---|
121 | char c = getchar(); |
---|
122 | if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave()) |
---|
123 | exec->writeToFile (Window::mainWindow); |
---|
124 | |
---|
125 | #endif /* HAVE_GTK2 */ |
---|
126 | |
---|
127 | } |
---|