Index: code/trunk/data/gui/configs/CEGUIConfig.xsd
===================================================================
--- code/trunk/data/gui/configs/CEGUIConfig.xsd	(revision 7913)
+++ code/trunk/data/gui/configs/CEGUIConfig.xsd	(revision 8079)
@@ -2,5 +2,5 @@
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
 
-	<xsd:element name="CEGUIConfig" type="CEGUIConfigType"/>
+    <xsd:element name="CEGUIConfig" type="CEGUIConfigType"/>
 
     <xsd:simpleType name="LogLevel">
@@ -12,16 +12,16 @@
         </xsd:restriction>
     </xsd:simpleType>
-    
-	<xsd:complexType name="CEGUIConfigType">
-		<xsd:attribute name="Logfile" type="xsd:string" use="optional" default=""/>
-		<xsd:attribute name="Scheme" type="xsd:string" use="optional" default=""/>
-		<xsd:attribute name="DefaultFont" type="xsd:string" use="optional" default=""/>
-		<xsd:attribute name="Layout" type="xsd:string" use="optional" default=""/>
-		<xsd:attribute name="InitScript" type="xsd:string" use="optional" default=""/>
-		<xsd:attribute name="TerminateScript" type="xsd:string" use="optional" default=""/>
-		<xsd:attribute name="DefaultResourceGroup" type="xsd:string" use="optional"  default="" />
+
+    <xsd:complexType name="CEGUIConfigType">
+        <xsd:attribute name="Logfile" type="xsd:string" use="optional" default=""/>
+        <xsd:attribute name="Scheme" type="xsd:string" use="optional" default=""/>
+        <xsd:attribute name="DefaultFont" type="xsd:string" use="optional" default=""/>
+        <xsd:attribute name="Layout" type="xsd:string" use="optional" default=""/>
+        <xsd:attribute name="InitScript" type="xsd:string" use="optional" default=""/>
+        <xsd:attribute name="TerminateScript" type="xsd:string" use="optional" default=""/>
+        <xsd:attribute name="DefaultResourceGroup" type="xsd:string" use="optional"  default="" />
         <xsd:attribute name="LoggingLevel" type="LogLevel" use="optional"  default="Standard" />
-	</xsd:complexType>
-	
+    </xsd:complexType>
+
 </xsd:schema>
 
Index: code/trunk/data/gui/layouts/GraphicsMenu.layout
===================================================================
--- code/trunk/data/gui/layouts/GraphicsMenu.layout	(revision 7913)
+++ code/trunk/data/gui/layouts/GraphicsMenu.layout	(revision 8079)
@@ -15,76 +15,194 @@
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="VertFormatting" Value="TopAligned" />
-            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2,0},{0.75,0},{0.6375,0}}" />
-            <Window Type="MenuWidgets/StaticText" Name="orxonox/Resolution" >
-                <Property Name="Text" Value="Resolution" />
-                <Property Name="InheritsAlpha" Value="False" />
-                <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.15,0},{0.75,0},{0.6375,0}}" />
+            <Window Type="MenuWidgets/TabControl" Name="orxonox/GraphicsTabControl" >
+                <Property Name="TabHeight" Value="{0,26.4388}" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.10,0},{0.475,0},{0.65,0}}" />
-                <Window Type="MenuWidgets/Listbox" Name="orxonox/ResolutionListbox" >
+                <Property Name="TabPanePosition" Value="Top" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
+                <Window Type="DefaultWindow" Name="orxonox/Display" >
+                    <Property Name="Text" Value="Display" />
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.2,0},{0.95,0},{0.95,0}}" />
-                    <Event Name="ItemSelectionChanged" Function="GraphicsMenu.GraphicsResolutionListbox_changed"/>
+                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Resolution" >
+                        <Property Name="Text" Value="Resolution" />
+                        <Property Name="HorzFormatting" Value="HorzCentred" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="VertFormatting" Value="TopAligned" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.025,0},{0.035,0},{0.4875,0},{0.96,0}}" />
+                        <Window Type="MenuWidgets/Checkbox" Name="orxonox/Display/Resolution/Fullscreen" >
+                            <Property Name="Text" Value="Fullscreen" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.27,0}}" />
+                            <Event Name="CheckStateChanged" Function="GraphicsMenu.callback_FullscreenCheckbox_CheckStateChanged" />
+                        </Window>
+                        <Window Type="MenuWidgets/Combobox" Name="orxonox/Display/Resolution/Combobox" >
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="ClippedByParent" Value="False" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.3,0},{0.95,0},{1.2,0}}" />
+                            <Property Name="MaxEditTextLength" Value="1073741823" />
+                            <Event Name="ListSelectionAccepted" Function="GraphicsMenu.callback_ResolutionCombobox_ListSelectionAccepted" />
+                        </Window>
+                        <Window Type="MenuWidgets/Editbox" Name="orxonox/Display/Resolution/EditboxWidth" >
+                            <Property Name="MaxTextLength" Value="1073741823" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.45,0},{0.45,0},{0.57,0}}" />
+                            <Event Name="TextChanged" Function="GraphicsMenu.callback_ResolutionEditboxWidth_TextChanged" />
+                        </Window>
+                        <Window Type="MenuWidgets/Editbox" Name="orxonox/Display/Resolution/EditboxHeight" >
+                            <Property Name="MaxTextLength" Value="1073741823" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.45,0},{0.95,0},{0.57,0}}" />
+                            <Event Name="TextChanged" Function="GraphicsMenu.callback_ResolutionEditboxHeight_TextChanged" />
+                        </Window>
+                        <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Resolution/x" >
+                            <Property Name="Text" Value="x" />
+                            <Property Name="FrameEnabled" Value="False" />
+                            <Property Name="HorzFormatting" Value="HorzCentred" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.45,0},{0.45,0},{0.55,0},{0.57,0}}" />
+                            <Property Name="BackgroundEnabled" Value="False" />
+                        </Window>
+                        <Window Type="MenuWidgets/Button" Name="orxonox/Display/Resolution/Apply" >
+                            <Property Name="Text" Value="Apply" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.61,0},{0.75,0},{0.73,0}}" />
+                            <Event Name="Clicked" Function="GraphicsMenu.callback_Apply_Clicked" />
+                        </Window>
+                        <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Resolution/AspectRatioLabel" >
+                            <Property Name="Text" Value="Aspect Ratio" />
+                            <Property Name="FrameEnabled" Value="False" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.825,0},{0.6,0},{0.95,0}}" />
+                            <Property Name="BackgroundEnabled" Value="False" />
+                        </Window>
+                        <Window Type="MenuWidgets/Editbox" Name="orxonox/Display/Resolution/AspectRatio" >
+                            <Property Name="Text" Value="1" />
+                            <Property Name="MaxTextLength" Value="1073741823" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.825,0},{0.95,0},{0.95,0}}" />
+                        </Window>
+                    </Window>
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Theme" >
+                        <Property Name="Text" Value="Theme" />
+                        <Property Name="HorzFormatting" Value="HorzCentred" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="VertFormatting" Value="TopAligned" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.035,0},{0.975,0},{0.32,0}}" />
+                        <Window Type="MenuWidgets/Combobox" Name="orxonox/Display/Theme/Combobox" >
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="ClippedByParent" Value="False" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.5,0},{0.95,0},{1.6,0}}" />
+                            <Property Name="MaxEditTextLength" Value="1073741823" />
+                            <Event Name="ListSelectionAccepted" Function="GraphicsMenu.callback_ThemeCombobox_ListSelectionAccepted" />
+                        </Window>
+                    </Window>
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/More" >
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.37,0},{0.975,0},{0.7,0}}" />
+                        <Window Type="MenuWidgets/Checkbox" Name="orxonox/Display/More/VSync" >
+                            <Property Name="Text" Value="VSync" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.45,0}}" />
+                            <Event Name="CheckStateChanged" Function="GraphicsMenu.callback_VSyncCheckbox_CheckStateChanged" />
+                        </Window>
+                        <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/More/FSAALabel" >
+                            <Property Name="Text" Value="FSAA" />
+                            <Property Name="FrameEnabled" Value="False" />
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.55,0},{0.3,0},{0.9,0}}" />
+                            <Property Name="BackgroundEnabled" Value="False" />
+                        </Window>
+                        <Window Type="MenuWidgets/Combobox" Name="orxonox/Display/More/FSAA" >
+                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                            <Property Name="ClippedByParent" Value="False" />
+                            <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.55,0},{0.95,0},{2.1,0}}" />
+                            <Property Name="MaxEditTextLength" Value="1073741823" />
+                            <Event Name="ListSelectionAccepted" Function="GraphicsMenu.callback_FSAACombobox_ListSelectionAccepted" />
+                        </Window>
+                    </Window>
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Notice" >
+                        <Property Name="Font" Value="BlueHighway-12" />
+                        <Property Name="Text" >Changing the theme, FSAA,
+or VSync requires a restart</Property>
+                        <Property Name="HorzFormatting" Value="HorzCentred" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.75,0},{0.975,0},{0.96,0}}" />
+                    </Window>
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/NoticeRed" >
+                        <Property Name="Font" Value="BlueHighway-12" />
+                        <Property Name="Text" >Restart required</Property>
+                        <Property Name="TextColours" Value="tl:FFFF0000 tr:FFFF8888 bl:FFFF8888 br:FFFFFFFF" />
+                        <Property Name="HorzFormatting" Value="HorzCentred" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.75,0},{0.975,0},{0.96,0}}" />
+                    </Window>
+                </Window>
+                <Window Type="DefaultWindow" Name="orxonox/Settings" >
+                    <Property Name="Text" Value="Settings" />
+                    <Property Name="Visible" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings/FovLabel" >
+                        <Property Name="Text" Value="Vertical field of view (FOV)" />
+                        <Property Name="FrameEnabled" Value="False" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.05,0},{0.5,0},{0.12,0}}" />
+                        <Property Name="BackgroundEnabled" Value="False" />
+                    </Window>
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings/FpsLimitLabel" >
+                        <Property Name="Text" Value="Maximal frame rate" />
+                        <Property Name="FrameEnabled" Value="False" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.18,0},{0.5,0},{0.25,0}}" />
+                        <Property Name="BackgroundEnabled" Value="False" />
+                    </Window>
+                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings/ParticleLodLabel" >
+                        <Property Name="Text" Value="Particle detail level" />
+                        <Property Name="FrameEnabled" Value="False" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.31,0},{0.5,0},{0.38,0}}" />
+                        <Property Name="BackgroundEnabled" Value="False" />
+                    </Window>
+                    <Window Type="MenuWidgets/Editbox" Name="orxonox/Settings/Fov" >
+                        <Property Name="MaxTextLength" Value="1073741823" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.03,0},{0.65,0},{0.14,0}}" />
+                    </Window>
+                    <Window Type="MenuWidgets/Editbox" Name="orxonox/Settings/FpsLimit" >
+                        <Property Name="MaxTextLength" Value="1073741823" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.16,0},{0.65,0},{0.27,0}}" />
+                    </Window>
+                    <Window Type="MenuWidgets/Combobox" Name="orxonox/Settings/ParticleLodCombobox" >
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="ClippedByParent" Value="False" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.29,0},{0.7,0},{0.725,0}}" />
+                        <Property Name="MaxEditTextLength" Value="1073741823" />
+                    </Window>
+                    <Window Type="MenuWidgets/Checkbox" Name="orxonox/Settings/MeshLodCheckbox" >
+                        <Property Name="Text" Value="Enable mesh LOD" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.44,0},{0.5,0},{0.51,0}}" />
+                    </Window>
+                    <Window Type="MenuWidgets/Checkbox" Name="orxonox/Settings/MotionBlurCheckbox" >
+                        <Property Name="Text" Value="Enable motion blur" />
+                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.57,0},{0.5,0},{0.64,0}}" />
+                    </Window>
                 </Window>
             </Window>
-            <Window Type="MenuWidgets/StaticText" Name="orxonox/Themes" >
-                <Property Name="Text" Value="Themes" />
-                <Property Name="InheritsAlpha" Value="False" />
-                <Property Name="HorzFormatting" Value="HorzCentred" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.10,0},{0.95,0},{0.35,0}}" />
-                <Window Type="MenuWidgets/Listbox" Name="orxonox/ThemeDropBox" >
-                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.3,0},{0.95,0},{0.95,0}" />
-                    <Event Name="ItemSelectionChanged" Function="GraphicsMenu.ThemeDropBox_changed"/>
-                </Window>
-            </Window>
-            <Window Type="MenuWidgets/StaticText" Name="orxonox/Brightness" >
-                <Property Name="Text" Value="Brightness" />
-                <Property Name="InheritsAlpha" Value="False" />
-                <Property Name="HorzFormatting" Value="HorzCentred" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.70,0},{0.475,0},{0.85,0}}" />
-                <Window Type="MenuWidgets/HorizontalScrollbar" Name="orxonox/BrightnessScrollbar" >
-                    <Property Name="Disabled" Value="true" />
-                    <Property Name="PageSize" Value="0" />
-                    <Property Name="StepSize" Value="0.1" />
-                    <Property Name="OverlapSize" Value="0" />
-                    <Property Name="DocumentSize" Value="1" />
-                    <Property Name="ScrollPosition" Value="0" />
-                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
-                    <Event Name="ThumbTrackStarted" Function="GraphicsMenu.GraphicsBrightnessScrollbar_started" />
-                    <Event Name="ThumbTrackEnded" Function="GraphicsMenu.GraphicsBrightnessScrollbar_ended" />
-                    <Event Name="ScrollPosChanged" Function="GraphicsMenu.GraphicsBrightnessScrollbar_changed" />
-                </Window>
-            </Window>
-            <Window Type="MenuWidgets/Checkbox" Name="orxonox/FullscreenCheckbox" >
-                <Property Name="Text" Value="Fullscreen" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.35,0},{0.85,0},{0.425,0}}" />
-                <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
-            </Window>
-            <Window Type="MenuWidgets/StaticText" Name="orxonox/GraphicsInfo" >
-                <Property Name="Text" >
-Changes in graphics
-settings require
-a game restart.</Property>
-                <Property Name="TextColours" Value="FFFFFFFF" />
-                <Property Name="InheritsAlpha" Value="False" />
-                <Property Name="HorzFormatting" Value="HorzCentred" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.425,0},{0.95,0},{0.85,0}}" />
-            </Window>
         </Window>
-        <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsBackButton" >
-            <Property Name="Text" Value="Back" />
+        <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsOkButton" >
+            <Property Name="Text" Value="OK" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
-            <Event Name="Clicked" Function="GraphicsMenu.GraphicsBackButton_clicked"/>
+            <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.6625,0},{0.4875,0},{0.7125,0}}" />
+            <Event Name="Clicked" Function="GraphicsMenu.callback_Ok_Clicked" />
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsCancelButton" >
+            <Property Name="Text" Value="Cancel" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.6625,0},{0.7125,0},{0.7125,0}}" />
+            <Event Name="Clicked" Function="GraphicsMenu.callback_Cancel_Clicked" />
         </Window>
     </Window>
Index: code/trunk/data/gui/schemes/GUIScheme.xsd
===================================================================
--- code/trunk/data/gui/schemes/GUIScheme.xsd	(revision 7913)
+++ code/trunk/data/gui/schemes/GUIScheme.xsd	(revision 8079)
@@ -1,53 +1,53 @@
 <?xml version="1.0" ?>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
-	<xsd:element name="GUIScheme" type="SchemeType" />
-	<xsd:complexType name="SchemeType">
+    <xsd:element name="GUIScheme" type="SchemeType" />
+    <xsd:complexType name="SchemeType">
         <xsd:choice minOccurs="0" maxOccurs="unbounded">
-			<xsd:element name="Imageset" type="NamedDataType" />
+            <xsd:element name="Imageset" type="NamedDataType" />
             <xsd:element name="ImagesetFromImage" type="NamedDataType" />
-			<xsd:element name="Font" type="NamedDataType" />
+            <xsd:element name="Font" type="NamedDataType" />
             <xsd:element name="LookNFeel" type="FileDataType" />
-			<xsd:element name="WindowSet" type="WindowSetType" />
-			<xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
-			<xsd:element name="WindowAlias" type="WindowAliasType" />
+            <xsd:element name="WindowSet" type="WindowSetType" />
+            <xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
+            <xsd:element name="WindowAlias" type="WindowAliasType" />
             <xsd:element name="FalagardMapping" type="FalagardMapType" />
-		</xsd:choice>
-		<xsd:attribute name="Name" type="xsd:string" use="required" />
-	</xsd:complexType>
-	<xsd:complexType name="WindowSetType">
-		<xsd:sequence>
+        </xsd:choice>
+        <xsd:attribute name="Name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="WindowSetType">
+        <xsd:sequence>
             <xsd:element name="WindowFactory" type="WindowFactoryType" minOccurs="0" maxOccurs="unbounded" />
-		</xsd:sequence>
-		<xsd:attribute name="Filename" type="xsd:string" use="required" />
-	</xsd:complexType>
-	<xsd:complexType name="WindowRendererSetType">
-		<xsd:sequence>
+        </xsd:sequence>
+        <xsd:attribute name="Filename" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="WindowRendererSetType">
+        <xsd:sequence>
             <xsd:element name="WindowRendererFactory" type="WindowRendererFactoryType" minOccurs="0" maxOccurs="unbounded" />
-		</xsd:sequence>
-		<xsd:attribute name="Filename" type="xsd:string" use="required" />
-	</xsd:complexType>
+        </xsd:sequence>
+        <xsd:attribute name="Filename" type="xsd:string" use="required" />
+    </xsd:complexType>
     <xsd:complexType name="FileDataType">
         <xsd:attribute name="Filename" type="xsd:string" use="required" />
         <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
     </xsd:complexType>
-	<xsd:complexType name="NamedDataType">
-		<xsd:attribute name="Name" type="xsd:string" use="required" />
-		<xsd:attribute name="Filename" type="xsd:string" use="required" />
-		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
-	</xsd:complexType>
-	<xsd:complexType name="WindowFactoryType">
-		<xsd:attribute name="Name" type="xsd:string" use="required" />
-	</xsd:complexType>
-	<xsd:complexType name="WindowRendererFactoryType">
-		<xsd:attribute name="Name" type="xsd:string" use="required" />
-	</xsd:complexType>
-	<xsd:complexType name="WindowAliasType">
-		<xsd:attribute name="Alias" type="xsd:string" use="required" />
-		<xsd:attribute name="Target" type="xsd:string" use="required" />
-	</xsd:complexType>
+    <xsd:complexType name="NamedDataType">
+        <xsd:attribute name="Name" type="xsd:string" use="required" />
+        <xsd:attribute name="Filename" type="xsd:string" use="required" />
+        <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+    </xsd:complexType>
+    <xsd:complexType name="WindowFactoryType">
+        <xsd:attribute name="Name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="WindowRendererFactoryType">
+        <xsd:attribute name="Name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="WindowAliasType">
+        <xsd:attribute name="Alias" type="xsd:string" use="required" />
+        <xsd:attribute name="Target" type="xsd:string" use="required" />
+    </xsd:complexType>
     <xsd:complexType name="FalagardMapType">
         <xsd:attribute name="WindowType" type="xsd:string" use="required" />
         <xsd:attribute name="TargetType" type="xsd:string" use="required" />
-		<xsd:attribute name="Renderer" type="xsd:string" use="required" />
+        <xsd:attribute name="Renderer" type="xsd:string" use="required" />
         <xsd:attribute name="LookNFeel" type="xsd:string" use="required" />
     </xsd:complexType>
Index: code/trunk/data/gui/schemes/OrxonoxLook.scheme
===================================================================
--- code/trunk/data/gui/schemes/OrxonoxLook.scheme	(revision 7913)
+++ code/trunk/data/gui/schemes/OrxonoxLook.scheme	(revision 8079)
@@ -1,7 +1,7 @@
 <?xml version="1.0" ?>
 <GUIScheme Name="OrxonoxLook">
-	<Imageset Name="OrxonoxLook" Filename="OrxonoxLook.imageset" />
-	<LookNFeel Filename="OrxonoxLook.looknfeel" />
-	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+    <Imageset Name="OrxonoxLook" Filename="OrxonoxLook.imageset" />
+    <LookNFeel Filename="OrxonoxLook.looknfeel" />
+    <WindowRendererSet Filename="CEGUIFalagardWRBase" />
 
     <!-- Standard widgets -->
@@ -45,5 +45,5 @@
     <FalagardMapping WindowType="OrxonoxLook/Tooltip"                  TargetType="CEGUI/Tooltip"           Renderer="Falagard/Tooltip"           LookNFeel="OrxonoxLook/Tooltip" />
     <FalagardMapping WindowType="OrxonoxLook/Tree"                     TargetType="CEGUI/Tree"              Renderer="Falagard/Tree"              LookNFeel="OrxonoxLook/Tree" />
-    
+
     <!-- Additional widgets -->
     <FalagardMapping WindowType="OrxonoxLook/AlternateProgressBar"        TargetType="CEGUI/ProgressBar"       Renderer="Falagard/ProgressBar"       LookNFeel="OrxonoxLook/AltProgressBar" />
Index: code/trunk/data/gui/schemes/TaharezGreenLook.scheme
===================================================================
--- code/trunk/data/gui/schemes/TaharezGreenLook.scheme	(revision 7913)
+++ code/trunk/data/gui/schemes/TaharezGreenLook.scheme	(revision 8079)
@@ -1,7 +1,7 @@
 <?xml version="1.0" ?>
 <GUIScheme Name="TaharezGreenLook">
-	<Imageset Name="TaharezGreenLook" Filename="TaharezGreenLook.imageset" />
-	<LookNFeel Filename="TaharezGreenLook.looknfeel" />
-	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+    <Imageset Name="TaharezGreenLook" Filename="TaharezGreenLook.imageset" />
+    <LookNFeel Filename="TaharezGreenLook.looknfeel" />
+    <WindowRendererSet Filename="CEGUIFalagardWRBase" />
 
     <!-- Standard widgets -->
@@ -45,5 +45,5 @@
     <FalagardMapping WindowType="TaharezGreenLook/Tooltip"                  TargetType="CEGUI/Tooltip"           Renderer="Falagard/Tooltip"           LookNFeel="TaharezGreenLook/Tooltip" />
     <FalagardMapping WindowType="TaharezGreenLook/Tree"                     TargetType="CEGUI/Tree"              Renderer="Falagard/Tree"              LookNFeel="TaharezGreenLook/Tree" />
-    
+
     <!-- Additional widgets -->
     <FalagardMapping WindowType="TaharezGreenLook/AlternateProgressBar"        TargetType="CEGUI/ProgressBar"       Renderer="Falagard/ProgressBar"       LookNFeel="TaharezGreenLook/AltProgressBar" />
Index: code/trunk/data/gui/schemes/TaharezLook.scheme
===================================================================
--- code/trunk/data/gui/schemes/TaharezLook.scheme	(revision 7913)
+++ code/trunk/data/gui/schemes/TaharezLook.scheme	(revision 8079)
@@ -1,7 +1,7 @@
 <?xml version="1.0" ?>
 <GUIScheme Name="TaharezLook">
-	<Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
-	<LookNFeel Filename="TaharezLook.looknfeel" />
-	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+    <Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
+    <LookNFeel Filename="TaharezLook.looknfeel" />
+    <WindowRendererSet Filename="CEGUIFalagardWRBase" />
 
     <!-- Standard widgets -->
@@ -45,5 +45,5 @@
     <FalagardMapping WindowType="TaharezLook/Tooltip"                  TargetType="CEGUI/Tooltip"           Renderer="Falagard/Tooltip"           LookNFeel="TaharezLook/Tooltip" />
     <FalagardMapping WindowType="TaharezLook/Tree"                     TargetType="CEGUI/Tree"              Renderer="Falagard/Tree"              LookNFeel="TaharezLook/Tree" />
-    
+
     <!-- Additional widgets -->
     <FalagardMapping WindowType="TaharezLook/AlternateProgressBar"        TargetType="CEGUI/ProgressBar"       Renderer="Falagard/ProgressBar"       LookNFeel="TaharezLook/AltProgressBar" />
Index: code/trunk/data/gui/scripts/AudioMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/AudioMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/AudioMenu.lua	(revision 8079)
@@ -2,11 +2,4 @@
 
 local P = createMenuSheet("AudioMenu")
-
-P.buttonList = {}
-
-function P.onShow()
-    P.oldindex = -2
-    P.index = -1
-end
 
 function P.onLoad()
@@ -50,9 +43,8 @@
     end
 
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/AudioBackButton"),
-            ["function"]  = P.AudioBackButton_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.AudioBackButton_clicked
+    })
 end
 
@@ -185,8 +177,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 1, 1)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/ControlsMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/ControlsMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/ControlsMenu.lua	(revision 8079)
@@ -2,35 +2,24 @@
 
 local P = createMenuSheet("ControlsMenu")
-P.buttonList = {}
 P.loadAlong = { "MouseControlsMenu", "KeyBindMenu" }
 
 function P.onLoad()
-    P.multiplayerMode = "startClient" 
+    P.multiplayerMode = "startClient"
 
     --buttons are arranged in a 3x1 matrix:
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/MouseControlsButton"),
-            ["function"]  = P.ControlsMouseControlsButton_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.ControlsMouseControlsButton_clicked
+    })
 
-    local item = {
+    P:setButton(2, 1, {
             ["button"] = winMgr:getWindow("orxonox/KeybindingsButton"),
-            ["function"]  = P.ControlsKeyboardControlsButton_clicked
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.ControlsKeyboardControlsButton_clicked
+    })
 
-    local item = {
+    P:setButton(3, 1, {
             ["button"] = winMgr:getWindow("orxonox/ControlsBackButton"),
-            ["function"]  = P.ControlsBackButton_clicked
-    }
-    P.buttonList[3] = item
-
-end
-
-function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
+            ["callback"]  = P.ControlsBackButton_clicked
+    })
 end
 
@@ -47,8 +36,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 3, 1)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/CreditsMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/CreditsMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/CreditsMenu.lua	(revision 8079)
@@ -3,20 +3,14 @@
 local P = createMenuSheet("CreditsMenu")
 
-P.buttonList = {}
 P.scrollbarWidth = 13
 
 function P.onLoad()
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/CreditsBackButton"),
-            ["function"]  = P.CreditsBackButton_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.CreditsBackButton_clicked
+    })
 end
 
 function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
-
     local description = winMgr:getWindow("orxonox/CreditsText")
     description:setProperty("HorzFormatting", "WordWrapLeftAligned")
@@ -33,8 +27,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 1, 1)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/DecisionPopup.lua
===================================================================
--- code/trunk/data/gui/scripts/DecisionPopup.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/DecisionPopup.lua	(revision 8079)
@@ -3,27 +3,20 @@
 local P = createMenuSheet("DecisionPopup")
 
-P.buttonList = {}
-
-function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
-end
-
 function P.onLoad()
 
     --button are arranged in a 1x2 matrix
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/DecisionPopup_button_yes"),
-            ["function"]  = P.button_yes
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.button_yes
+    })
 
-    local item = {
+    P:setButton(1, 2, {
             ["button"] = winMgr:getWindow("orxonox/DecisionPopup_button_no"),
-            ["function"]  = P.button_no
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.button_no
+    })
+end
 
+function P.onShow()
+    P:setSelection(1, 1)
 end
 
@@ -51,8 +44,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 1, 2)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/GUISheet.lua
===================================================================
--- code/trunk/data/gui/scripts/GUISheet.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/GUISheet.lua	(revision 8079)
@@ -16,4 +16,24 @@
 end
 
+-- Override this function if you need to do work on show
+function P:onShow()
+end
+
+-- Override this function if you need to do work on hide
+function P:onHide()
+end
+
+-- Override this function if you need to do work on quit
+function P:onQuit()
+end
+
+-- Override this function if you want to react on keystrokes
+function P:onKeyPressed()
+end
+
+-- Override this function if you want to update the gui after the window was resized
+function P:onWindowResized()
+end
+
 -- show function for the GUI
 function P:show()
@@ -21,9 +41,8 @@
     self.bVisible = true
 
+    -- set the selected button's state
+    self:setSelectedButtonsStateToSelected()
+
     self:onShow()
-end
-
--- Override this function if you need to do work on show
-function P:onShow()
 end
 
@@ -36,10 +55,11 @@
 end
 
--- Override this function if you need to do work on hide
-function P:onHide()
-end
-
--- Override this function if you need to do work just after the sheet has been hidden
-function P:afterHide()
+function P:quit()
+    -- reset the selected button
+    if self.buttons then
+        self:resetSelection()
+    end
+
+    self:onQuit()
 end
 
@@ -64,5 +84,314 @@
 end
 
-function P:onKeyPressed(e)
+-- Handles key pressed while the gui sheed is displayed
+function P:keyPressed()
+    if self.buttons then
+        if code == "208" then     -- key down
+            self:moveSelectionRow(1)
+        elseif code == "200" then -- key up
+            self:moveSelectionRow(-1)
+        elseif code == "205" then -- key right
+            self:moveSelectionColumn(1)
+        elseif code == "203" then -- key left
+            self:moveSelectionColumn(-1)
+        elseif code == "28" or code == "156"  then -- key enter or key numpad enter
+            self:pressSelectedButton()
+        end
+    end
+
+    self:onKeyPressed()
+end
+
+function P:windowResized()
+    self:onWindowResized()
+end
+
+
+-------------------------------------------------------------------------------
+-- Keyboard control -----------------------------------------------------------
+-------------------------------------------------------------------------------
+
+-- Initializes the buttons table, used to control the menu with the keyboard
+function P:initButtons(rows, columns)
+    self.rows = rows
+    self.columns = columns
+    self.buttons = {}
+    self.selectedRow = 0
+    self.selectedColumn = 0
+    self.ratio = 1
+end
+
+-- ratio: the button's with divided by the button's height (used to calculate distance between buttons - adjust this until you get the desired behavior)
+function P:setRatio(ratio)
+    self.ratio = ratio
+end
+
+-- Defines the button for a given position in the table. The upper-left button is at position (1, 1)
+function P:setButton(row, column, button)
+    if not self.buttons then
+        -- init the table
+        self:initButtons(row, column)
+    elseif row > self.rows or column > self.columns then
+        -- rearrange the table
+        local maxRows = math.max(self.rows, row)
+        local maxColumns = math.max(self.columns, column)
+
+        for r = self.rows, 1, -1 do
+            for c = self.columns, 1, -1 do
+                local b = self:getButton(r, c)
+                if b then
+                    self.buttons[(r - 1) * self.columns + (c - 1)] = nil
+                    self.buttons[(r - 1) * maxColumns + (c - 1)] = b
+                end
+            end
+        end
+
+        self.rows = maxRows
+        self.columns = maxColumns
+    end
+
+    self.buttons[(row - 1) * self.columns + (column - 1)] = button
+end
+
+-- Returns the button at a given position in the table. The upper-left button is at position (1, 1)
+function P:getButton(row, column)
+    if self.buttons then
+        return self.buttons[(row - 1) * self.columns + (column - 1)]
+    else
+        return nil
+    end
+end
+
+-- Returns the selected button
+function P:getSelectedButton()
+    if self:hasSelection() then
+        return self:getButton(self.selectedRow, self.selectedColumn)
+    else
+        return nil
+    end
+end
+
+-- Presses the selected button if any
+function P:pressSelectedButton()
+    if self:getSelectedButton() then
+        self.pressedEnter = true
+        self:getSelectedButton().callback()
+        self.pressedEnter = false
+    end
+end
+
+-- Sets the selection to a given row and column. The upper-left button is at position (1, 1)
+function P:setSelection(row, column)
+    if not self.buttons then
+        return
+    end
+
+    assert(row > 0 and column > 0 and row <= self.rows and column <= self.columns, "(" .. row .. "/" .. column .. ") is not in the valid bounds of the table (1/1)-(" .. self.rows .. "/" .. self.columns .. ")")
+
+    self:setSelectedButtonsStateToNormal()
+
+    self.selectedRow = row
+    self.selectedColumn = column
+
+    self:setSelectedButtonsStateToSelected()
+end
+
+-- Sets the selection to the button closest to the given row and column. The upper-left button is at position (1, 1)
+function P:setSelectionNear(row, column)
+    if not self.buttons then
+        return
+    end
+
+    assert(row > 0 and column > 0 and row <= self.rows and column <= self.columns, "(" .. row .. "/" .. column .. ") is not in the valid bounds of the table (1/1)-(" .. self.rows .. "/" .. self.columns .. ")")
+
+    if self:getButton(row, column) then
+        self:setSelection(row, column)
+    else
+        local min = 1000000
+        local minRow, minColumn
+
+        for r = 1, self.rows do
+            for c = 1, self.columns do
+                if self:getButton(r, c) then
+                    local distance = math.sqrt((row - r)^2 + ((column - c) * self.ratio)^2)
+                    if distance < min then
+                        min = distance; minRow = r; minColumn = c
+                    end
+                end
+            end
+        end
+
+        if minRow and minColumn then
+            self:setSelection(minRow, minColumn)
+        else
+            self:resetSelection()
+        end
+    end
+end
+
+-- Moves the selection by a given number of rows (a positive value means down, a negative value means up)
+function P:moveSelectionRow(relRow)
+    self:moveSelection(relRow, "selectedRow", "selectedColumn", "rows", "columns", true)
+end
+
+-- Moves the selection by a given number of columns (a positive value means right, a negative value means left)
+function P:moveSelectionColumn(relColumn)
+    self:moveSelection(relColumn, "selectedColumn", "selectedRow", "columns", "rows", false)
+end
+
+-- Generic move function, the values are determined at runtime depending on the arguments
+function P:moveSelection(relMove, selectedThis, selectedOther, limitThis, limitOther, isRow)
+    if not self.buttons then
+        return
+    end
+
+    -- if there's no selection yet, prepare it such that the selection enters the table from the desired side
+    if self.selectedRow > 0 or self.selectedColumn > 0 then
+        self:setSelectedButtonsStateToNormal()
+    else
+        if relMove > 0 then
+            self[selectedThis] = 0
+            self[selectedOther] = 1
+        elseif relMove < 0 then
+            self[selectedThis] = self[limitThis] + 1
+            self[selectedOther] = 1
+        else
+            return
+        end
+    end
+
+    -- move the selection according to the parameters
+    self[selectedThis] = self[selectedThis] + relMove
+
+    -- wrap around on overflow or underflow
+    while self[selectedThis] > self[limitThis] do self[selectedThis] = self[selectedThis] - self[limitThis] end
+    while self[selectedThis] <= 0              do self[selectedThis] = self[selectedThis] + self[limitThis] end
+
+    -- if the button is deactivated, search the button closest to the desired location
+    if self:getSelectedButton() == nil then
+        local min = 1000000
+        local minV1, minV2
+        local limit, step
+
+        if relMove > 0 then
+            limit = self[limitThis]
+            step = 1
+        else
+            limit = 1
+            step = -1
+        end
+
+        for v1 = self[selectedThis], limit, step do
+            for v2 = 1, self[limitOther] do
+                local button
+                if isRow == true then
+                    button = self:getButton(v1, v2)
+                else
+                    button = self:getButton(v2, v1)
+                end
+                if button then
+                    local distance
+                    if isRow == true then
+                        distance = math.sqrt((self[selectedThis] - v1)^2 + ((self[selectedOther] - v2) * self.ratio)^2)
+                    else
+                        distance = math.sqrt(((self[selectedThis] - v1) * self.ratio)^2 + (self[selectedOther] - v2)^2)
+                    end
+                    if distance < min then
+                        min = distance; minV1 = v1; minV2 = v2
+                    end
+                end
+            end
+        end
+
+        if minV1 and minV2 then
+            self[selectedThis] = minV1
+            self[selectedOther] = minV2
+        elseif self:hasButtons() then
+            -- no suitable button found - wrap around and search again
+            if relMove > 0 then
+                self[selectedThis] = 0
+            else
+                self[selectedThis] = self[limitThis] + 1
+            end
+            self:moveSelection(relMove, selectedThis, selectedOther, limitThis, limitOther, isRow)
+        end
+    end
+
+    self:setSelectedButtonsStateToSelected()
+end
+
+-- Resets the selection
+function P:resetSelection()
+    self:setSelectedButtonsStateToNormal()
+
+    self.selectedRow = 0
+    self.selectedColumn = 0
+end
+
+-- Checks if there's at least one button in the table
+function P:hasButtons()
+    local count = 0
+    for r = 1, self.rows do
+        for c = 1, self.columns do
+            if self:getButton(r, c) then
+                count = count + 1
+            end
+        end
+    end
+
+    return (count > 0)
+end
+
+-- Determines if a button is selected
+function P:hasSelection()
+    if self.selectedRow and self.selectedRow > 0 and self.selectedColumn and self.selectedColumn > 0 then
+        return true
+    else
+        return false
+    end
+end
+
+-- Sets the selected button's state to normal
+function P:setSelectedButtonsStateToNormal()
+    self:setSelectedButtonsState("Normal")
+end
+
+-- Sets the selected button's state to selected
+function P:setSelectedButtonsStateToSelected()
+    self:setSelectedButtonsState("Selected")
+end
+
+-- Sets the selected button's state to pushed
+function P:setSelectedButtonsStateToPushed()
+    self:setSelectedButtonsState("Pushed")
+end
+
+-- Sets the selected button's state
+function P:setSelectedButtonsState(state)
+    if self:getSelectedButton() then
+        local element = self:getSelectedButton().button
+        local offset = getElementStateOffset(element)
+
+        if offset then
+            element:setProperty("NormalImageRightEdge",  string.sub(element:getProperty("NormalImageRightEdge"),  1, offset) .. state)
+            element:setProperty("NormalImageLeftEdge",   string.sub(element:getProperty("NormalImageLeftEdge"),   1, offset) .. state)
+            element:setProperty("NormalImageBackground", string.sub(element:getProperty("NormalImageBackground"), 1, offset) .. state)
+        end
+    end
+end
+
+-- Gets the offset of the button's current state
+function getElementStateOffset(element)
+    local property = element:getProperty("NormalImageRightEdge")
+
+    if string.sub(property, string.len(property) - 5, string.len(property)) == "Normal" then
+        return -7
+    elseif string.sub(property, string.len(property) - 7, string.len(property)) == "Selected" then
+        return -9
+    elseif string.sub(property, string.len(property) - 5, string.len(property)) == "Pushed" then
+        return -7
+    else
+        return nil
+    end
 end
 
Index: code/trunk/data/gui/scripts/GUITools.lua
===================================================================
--- code/trunk/data/gui/scripts/GUITools.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/GUITools.lua	(revision 8079)
@@ -54,283 +54,2 @@
     return height
 end
-
---function to iterate through a menu sheet by using arrowkeys
-
---@arguments:
---  list: 2-dimensional table, arguments are items that contain a button and its function
---        !!note: each button can only be in the list once!!
---  code: code of any key on the keyboard
---  P: menusheet
---  n: number of rows of the buttontable
---  m: number of colums of the buttontable
-
-function buttonIteratorHelper(list, code, P, n, m)
-
-    --after a key (down,up,left,right) is pressed the index of the current button has to be updated    
-
-    --key down
-    if code == "208" then
-        if P.index < 0 then     -- initial status
-            P.index = 0
-            P.oldindex = -1
-        else
-            P.oldindex = P.index
-            P.index = (P.index + m) % (m*n)     --modulo operation works as a "wrap around" in the button menu
-                                                
-            while list[P.index+1] == nil do     
-                P.oldindex = P.index
-                P.index = (P.index + m) % (m*n)
-            end
-        end
-
-    --key up
-    elseif code == "200" then
-        if P.index < 0 then
-            P.index = 0
-            P.oldindex = -1
-        elseif(P.index == 0) then
-            P.oldindex = P.index
-            P.index = m*n-m
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = (P.index-m)%(m*n)
-            end
-        else
-            P.oldindex = P.index
-            P.index = (P.index -m) % (m*n)
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = (P.index-m)%(m*n)
-            end
-        end
-
-    --key right
-    elseif code == "205" then
-        if P.index < 0 then
-            P.index = 0
-            P.oldindex = -1
-        elseif (P.index+1) % m == 0 then     -- we are at the right-end of a row
-            P.oldindex = P.index
-            P.index = P.index + 1 -m
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = P.index + 1
-            end
-        else
-            P.oldindex = P.index
-            P.index = P.index + 1
-
-            while list[P.index+1] == nil do
-                if (P.index+1) % m == 0 then     -- we are at the right-end of a row
-                    P.oldindex = P.index
-                    P.index = P.index + 1-m
-
-                else    
-                    P.oldindex = P.index
-                    P.index = P.index + 1
-                end
-            end
-        end    
-
-    --key left
-    elseif code == "203" then
-        if P.index < 0 then
-            P.index = 0
-            P.oldindex = -1
-        elseif P.index % m == 0 then         -- we are at the left-end of a row 
-            P.oldindex = P.index
-            P.index = P.index +m-1
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = P.index -1
-            end
-        else
-            P.oldindex = P.index
-            P.index = P.index -1
-
-            while list[P.index+1] == nil do
-                if P.index % m == 0 then     -- we are at the left-end of a row 
-                    P.oldindex = P.index
-                    P.index = P.index -1 + m
-                else                
-                    P.oldindex = P.index
-                    P.index = P.index -1
-                end
-            end   
-        end
-    end
-       
-    --to update the new current button
-    if (code == "208" or code == "200" or code == "203" or code == "205") and P.oldindex~= P.index then
-
-        local system = CEGUI.System:getSingleton()
-        local window = winMgr:getWindow("orxonox/MainMenuBackground")
-
-        local item = list[P.index+1]
-        local child = item["button"]
-        local s = child:getProperty("NormalImageRightEdge") 
-
-        --teste ob der Button nicht schon gehighlightet ist
-        if string.sub(s,string.len(s)-8,string.len(s)) == "Highlight" then
-            --nop
-        else
-            child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight")
-            child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-7) .. "Highlight")
-            child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-7) .. "Highlight")
-            if P.oldindex >= 0 then
-                if list[P.oldindex+1] ~= nil then
-                    local item = list[P.oldindex+1]
-                    local oldChild = item["button"]
-                    oldChild:setProperty("NormalImageRightEdge", string.sub(oldChild:getProperty("NormalImageRightEdge"),1,-10) .. "Normal")
-                    oldChild:setProperty("NormalImageLeftEdge", string.sub(oldChild:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal")
-                    oldChild:setProperty("NormalImageBackground", string.sub(oldChild:getProperty("NormalImageBackground"),1,-10) .. "Normal")
-                end
-            end
-        end
-
-        --for every highlighted button check if index is on its position. If not, set imageproperty on "normal"
-        local i = 1
-        while i < (n*m) do
-            if i == P.index +1 then 
-                i = i+1
-            else
-                if list[i] ~= nil then 
-                local item = list[i]
-                local child = item["button"]
-                local s = child:getProperty("NormalImageRightEdge")
-                    if string.sub(s,string.len(s)-8,string.len(s)) == "Highlight" then
-                        child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-10) .. "Normal")
-                        child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal")
-                        child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-10) .. "Normal")
-                    end
-                end
-            end
-                i=i+1
-        end
-    end  
-
-    --enter
-    if code == "28" and P.index >= 0 then
-        local item = list[P.index+1]
-        local child = item["button"] 
-        child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-10) .. "Normal")
-        child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal")
-        child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-10) .. "Normal")
-
-        local foo = item["function"]
-        foo()
-    end
-
-end
-
---write index and oldindex on the console
---works like buttonIteratorHelper
-function indexTester(list,code,P,n,m)
-    --key down
-    if code == "208" then
-        if P.index < 0 then     -- initial status
-            P.index = 0
-            P.oldindex = -1
-        else
-            P.oldindex = P.index
-            P.index = (P.index + m) % (m*n)
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = (P.index + m) % (m*n)
-            end
-        end
-
-    --key up
-    elseif code == "200" then
-        if P.index < 0 then
-            P.index = 0
-            P.oldindex = -1
-        elseif(P.index == 0) then
-            P.oldindex = P.index
-            P.index = m*n-m
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = (P.index-m)%(m*n)
-            end
-        else
-            P.oldindex = P.index
-            P.index = (P.index -m) % (m*n)
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = P.index -m
-            end
-        end
-
-    --key right
-    elseif code == "205" then
-        if P.index < 0 then
-            P.index = 0
-            P.oldindex = -1
-        elseif (P.index+1) % m == 0 then     -- we are at the right-end of a row
-            P.oldindex = P.index
-            P.index = P.index + 1 -m
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = P.index + 1
-            end
-        else
-            P.oldindex = P.index
-            P.index = P.index + 1
-
-            while list[P.index+1] == nil do
-                if (P.index+1) % m == 0 then     -- we are at the right-end of a row
-                    P.oldindex = P.index
-                    P.index = P.index + 1-m
-
-                else    
-                    P.oldindex = P.index
-                    P.index = P.index + 1
-                end
-            end
-        end    
-
-    --key left
-    elseif code == "203" then
-        if P.index < 0 then
-            P.index = 0
-            P.oldindex = -1
-        elseif P.index % m == 0 then         -- we are at the left-end of a row 
-            P.oldindex = P.index
-            P.index = P.index +m-1
-
-            while list[P.index+1] == nil do
-                P.oldindex = P.index
-                P.index = P.index -1
-            end
-        else
-            P.oldindex = P.index
-            P.index = P.index -1
-
-            while list[P.index+1] == nil do
-                if P.index % m == 0 then     -- we are at the left-end of a row 
-                    P.oldindex = P.index
-                    P.index = P.index -1 + m
-                else                
-                    P.oldindex = P.index
-                    P.index = P.index -1
-                end
-            end   
-        end
-    end    
-
-    cout(0, P.oldindex)
-    cout(0, P.index)
-
-end
-
-
-
-
Index: code/trunk/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/GraphicsMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/GraphicsMenu.lua	(revision 8079)
@@ -3,236 +3,417 @@
 local P = createMenuSheet("GraphicsMenu")
 
-P.buttonList = {}
+P.resolutionList = {"custom", "640 x 480", "720 x 480", "720 x 576", "800 x 600", "1024 x 600", "1024 x 768", "1152 x 864", "1280 x 720", "1280 x 800", "1280 x 960", "1280 x 1024", "1360 x 768", "1440 x 900", "1600 x 900", "1600 x 1200", "1680 x 1050"}
 P.schemeList = {"TaharezGreen", "Orxonox"}
-
-function P.onShow()
-    --indices to iterate through buttonlist (trivial in this menu sheet)
-    P.oldindex = -2
-    P.index = -1
-end
-
-function P.onLoad()
-    block = true
-    file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
-    search_mode = 0
-    f = io.open(file, "r")
-    firstline = f:read("*line")
-    rendersystem = string.sub(firstline, 15)
-    for line in f:lines() do
-        if search_mode == 0 then
-            if string.find(line, rendersystem) ~= nil then
-                search_mode = 1
-            end
+P.fsaaList = {"0", "2", "4", "8", "8 [Quality]"}
+P.particleLodList = {"None", "Low", "Normal", "High"}
+
+function P:onLoad()
+    -------------------
+    -- Button matrix --
+    -------------------
+
+    P:setButton(1, 1, {
+            ["button"] = winMgr:getWindow("orxonox/GraphicsOkButton"),
+            ["callback"]  = P.callback_Ok_Clicked
+    })
+
+    P:setButton(1, 2, {
+            ["button"] = winMgr:getWindow("orxonox/GraphicsCancelButton"),
+            ["callback"]  = P.callback_Cancel_Clicked
+    })
+
+    -- place apply button at the bottom in the matrix, even though it's in fact at the top, to make the OK button highlighted by default
+    P:setButton(2, 1, {
+            ["button"] = winMgr:getWindow("orxonox/Display/Resolution/Apply"),
+            ["callback"]  = P.callback_Apply_Clicked
+    })
+
+    -----------------
+    -- Combo boxes --
+    -----------------
+
+    -- resolution combobox
+    local resolutionCombobox = winMgr:getWindow("orxonox/Display/Resolution/Combobox")
+    CEGUI.toCombobox(resolutionCombobox):setReadOnly(true)
+
+    for k,v in pairs(P.resolutionList) do
+        local item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+        resolutionCombobox:addItem(item)
+    end
+
+    -- themes combobox
+    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
+    CEGUI.toCombobox(themeCombobox):setReadOnly(true)
+
+    for k,v in pairs(P.schemeList) do
+        local item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+        themeCombobox:addItem(item)
+    end
+
+    -- fsaa combobox
+    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
+    CEGUI.toCombobox(fsaaCombobox):setReadOnly(true)
+
+    for k,v in pairs(P.fsaaList) do
+        local item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+        fsaaCombobox:addItem(item)
+    end
+
+    -- particle lod combobox
+    local particleLodCombobox = winMgr:getWindow("orxonox/Settings/ParticleLodCombobox")
+    CEGUI.toCombobox(particleLodCombobox):setReadOnly(true)
+
+    for k,v in pairs(P.particleLodList) do
+        local item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+        particleLodCombobox:addItem(item)
+    end
+end
+
+function P:onShow()
+    -----------------
+    -- Display tab --
+    -----------------
+
+    -- fullscreen checkbox / resolution combobox / resolution editboxes
+    self:onWindowResized()
+
+    -- apply button
+    self.updateApplyButton()
+
+    -- aspect ratio editbox
+    local aspectRatioEditbox = winMgr:getWindow("orxonox/Display/Resolution/AspectRatio")
+    local currentAspectRatio = orxonox.CommandExecutor:query("getConfig Camera aspectRatio_")
+    aspectRatioEditbox:setText(currentAspectRatio)
+
+    -- themes combobox
+    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
+    local currentTheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
+
+    for i = 0, themeCombobox:getDropList():getItemCount() - 1 do
+        local item = themeCombobox:getListboxItemFromIndex(i)
+        themeCombobox:setItemSelectState(item, (item:getText() == currentTheme))
+    end
+
+    -- vsync checkbox
+    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
+    local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
+    CEGUI.toCheckbox(vsyncCheckbox):setSelected(hasVSync)
+
+    -- fsaa combobox
+    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
+    local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
+
+    for i = 0, fsaaCombobox:getDropList():getItemCount() - 1 do
+        local item = fsaaCombobox:getListboxItemFromIndex(i)
+        fsaaCombobox:setItemSelectState(item, (item:getText() == currentFSAAMode))
+    end
+
+    -- notice
+    self:updateRedLabel()
+
+    ------------------
+    -- Settings tab --
+    ------------------
+
+    -- fov editbox
+    local fovEditbox = winMgr:getWindow("orxonox/Settings/Fov")
+    local currentFov = orxonox.CommandExecutor:query("getConfig Camera fov_")
+    fovEditbox:setText(currentFov)
+
+    -- fps limit editbox
+    local fpsEditbox = winMgr:getWindow("orxonox/Settings/FpsLimit")
+    local currentFpsLimit = orxonox.CommandExecutor:query("getConfig GraphicsSettings fpsLimit")
+    fpsEditbox:setText(currentFpsLimit)
+
+    -- particle lod combobox
+    local particleLodCombobox = winMgr:getWindow("orxonox/Settings/ParticleLodCombobox")
+    local currentParticleLod = orxonox.CommandExecutor:query("getConfig GraphicsSettings particlesDetailLevel")
+
+    if currentParticleLod == "" then
+        particleLodCombobox:disable()
+    else
+        particleLodCombobox:enable()
+
+        for i = 0, particleLodCombobox:getDropList():getItemCount() - 1 do
+            local item = particleLodCombobox:getListboxItemFromIndex(i)
+            particleLodCombobox:setItemSelectState(item, (tostring(i) == currentParticleLod))
         end
-        if search_mode == 1 then
-            if string.sub(line, 1, 11) == "Full Screen" then
-                if string.sub(line, 13) == "Yes" then
-                    fullscreen = true
-                else
-                    fullscreen = false
-                end
-            end
-            if string.sub(line, 1, 10) == "Video Mode" then
-                if string.match(line, "@") == "@" then
-                    resolution = string.sub(line, 12, string.find(line, "@")-2)
-                else
-                    resolution = string.sub(line, 12)
-                end
-                break
-            end
+    end
+
+    -- mesh lod checkbox
+    local meshLodCheckbox = winMgr:getWindow("orxonox/Settings/MeshLodCheckbox")
+    local hasMeshLod = orxonox.CommandExecutor:query("getConfig GraphicsSettings enableMeshLoD")
+    if hasMeshLod == "true" then
+        hasMeshLod = true
+    elseif hasMeshLod == "false" then
+        hasMeshLod = false
+    end
+    CEGUI.toCheckbox(meshLodCheckbox):setSelected(hasMeshLod)
+
+    -- motion blur checkbox
+    local motionBlurCheckbox = winMgr:getWindow("orxonox/Settings/MotionBlurCheckbox")
+    local hasMotionBlur = orxonox.CommandExecutor:query("getConfig GraphicsSettings enableMotionBlur")
+    if hasMotionBlur == "true" then
+        hasMotionBlur = true
+    elseif hasMotionBlur == "false" then
+        hasMotionBlur = false
+    end
+    CEGUI.toCheckbox(motionBlurCheckbox):setSelected(hasMotionBlur)
+end
+
+function P:onWindowResized()
+    -- fullscreen checkbox
+    local fullscreenCheckbox = winMgr:getWindow("orxonox/Display/Resolution/Fullscreen")
+    local isFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
+    CEGUI.toCheckbox(fullscreenCheckbox):setSelected(isFullscreen)
+
+    -- resolution combobox
+    local resolutionCombobox = winMgr:getWindow("orxonox/Display/Resolution/Combobox")
+
+    local currentWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
+    local currentHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
+
+    if P.forceResolutionEditboxes then
+        currentWidth = P.newWidth
+        currentHeight = P.newHeight
+        P.forceResolutionEditboxes = false
+    end
+
+    local currentResolution = currentWidth .. " x " .. currentHeight
+
+    for i = 0, resolutionCombobox:getDropList():getItemCount() - 1 do
+        local item = resolutionCombobox:getListboxItemFromIndex(i)
+        resolutionCombobox:setItemSelectState(item, item:getText() == currentResolution)
+    end
+
+    -- resolution editboxes
+    self.updateResolutionEditboxes()
+end
+
+----------------------
+-- Helper functions --
+----------------------
+
+-- updates the text of the resolution checkboxes and checks if they should be enabled (only if the "custom" resolution was selected)
+function P.updateResolutionEditboxes()
+    -- resolution combobox
+    local resolutionCombobox = winMgr:getWindow("orxonox/Display/Resolution/Combobox")
+
+    local currentWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
+    local currentHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
+
+    -- resolution editboxes
+    local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
+    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
+    widthEditbox:disable()
+    heightEditbox:disable()
+
+    -- selected combobox item
+    local item = resolutionCombobox:getSelectedItem()
+    if item then
+        local itemText = item:getText()
+        if itemText ~= "custom" then
+            currentWidth = string.sub(itemText, 1, string.find(itemText, "x") - 2)
+            currentHeight = string.sub(itemText, string.find(itemText, "x") + 2)
+        else
+            widthEditbox:enable()
+            heightEditbox:enable()
         end
     end
-    f:close()
-    local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox")
-    fullscreenwindow:setSelected(fullscreen)
-    listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox")
-    local resolutionList = {}
-    table.insert(resolutionList, "640 x 480")
-    table.insert(resolutionList, "720 x 480")
-    table.insert(resolutionList, "720 x 576")
-    table.insert(resolutionList, "800 x 480")
-    table.insert(resolutionList, "800 x 600")
-    table.insert(resolutionList, "1024 x 480")
-    table.insert(resolutionList, "1024 x 600")
-    table.insert(resolutionList, "1024 x 768")
-    table.insert(resolutionList, "1152 x 864")
-    table.insert(resolutionList, "1280 x 720")
-    table.insert(resolutionList, "1280 x 768")
-    table.insert(resolutionList, "1440 x 900")
-    for k,v in pairs(resolutionList) do
-        item = CEGUI.createListboxTextItem(v)
-        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
-        CEGUI.toListbox(listboxwindow):addItem(item)
-    end
-    if resolution == "640 x 480" then
-        listboxwindow:setItemSelectState(0,true)
-    elseif resolution == "720 x 480" then
-        listboxwindow:setItemSelectState(1,true)
-    elseif resolution == "720 x 576" then
-        listboxwindow:setItemSelectState(2,true)
-    elseif resolution == "800 x 480" then
-        listboxwindow:setItemSelectState(3,true)
-    elseif resolution == "800 x 600" then
-        listboxwindow:setItemSelectState(4,true)
-    elseif resolution == "1024 x 480" then
-        listboxwindow:setItemSelectState(5,true)
-    elseif resolution == "1024 x 600" then
-        listboxwindow:setItemSelectState(6,true)
-    elseif resolution == "1024 x 768" then
-        listboxwindow:setItemSelectState(7,true)
-    elseif resolution == "1152 x 864" then
-        listboxwindow:setItemSelectState(8,true)
-    elseif resolution == "1280 x 720" then
-        listboxwindow:setItemSelectState(9,true)
-    elseif resolution == "1280 x 768" then
-        listboxwindow:setItemSelectState(10,true)
-    elseif resolution == "1440 x 900" then
-        listboxwindow:setItemSelectState(11,true)
-    end
-    scrollbar_active = false
-    block = false
-
-    local item = {
-            ["button"] = winMgr:getWindow("orxonox/GraphicsBackButton"),
-            ["function"]  = P.GraphicsBackButton_clicked
-    }
-    P.buttonList[1] = item
-
-    local dropbox = winMgr:getWindow("orxonox/ThemeDropBox")
-    local scheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
-    for k,v in pairs(P.schemeList) do
-        local item = CEGUI.createListboxTextItem(P.schemeList[k])
-        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
-        CEGUI.toListbox(dropbox):addItem(item)
-        if v == scheme then
-            dropbox:setItemSelectState(item, true)
-        end
-    end
-
-end
-
-function P.ThemeDropBox_changed(e)
-    local dropbox = winMgr:getWindow("orxonox/ThemeDropBox")
-    local listbox = CEGUI.toListbox(dropbox)
-    local choice = listbox:getFirstSelectedItem()
-    local index = 0
-    if choice ~= nil then
-        index = listbox:getItemIndex(choice)
-    end
-    orxonox.CommandExecutor:execute("config GUIManager guiScheme_ " .. P.schemeList[index+1])
-end
-
-function P.GraphicsResolutionListbox_changed(e)
-    if listboxwindow:isItemSelected(0) then
-        resolution = "640 x 480"
-    elseif listboxwindow:isItemSelected(1) then
-        resolution = "720 x 480"
-    elseif listboxwindow:isItemSelected(2) then
-        resolution = "720 x 576"
-    elseif listboxwindow:isItemSelected(3) then
-        resolution = "800 x 480"
-    elseif listboxwindow:isItemSelected(4) then
-        resolution = "800 x 600"
-    elseif listboxwindow:isItemSelected(5) then
-        resolution = "1024 x 480"
-    elseif listboxwindow:isItemSelected(6) then
-        resolution = "1024 x 600"
-    elseif listboxwindow:isItemSelected(7) then
-        resolution = "1024 x 768"
-    elseif listboxwindow:isItemSelected(8) then
-        resolution = "1152 x 864"
-    elseif listboxwindow:isItemSelected(9) then
-        resolution = "1280 x 720"
-    elseif listboxwindow:isItemSelected(10) then
-        resolution = "1280 x 768"
-    elseif listboxwindow:isItemSelected(11) then
-        resolution = "1440 x 900"
-    end
-    search_mode = 0
-    f = io.open(file, "r")
-    firstline = f:read("*line")
-    text = firstline .. "\n"
-    rendersystem = string.sub(firstline, 15)
-    for line in f:lines() do
-        if search_mode == 0 then
-            if string.find(line, rendersystem) ~= nil then
-                search_mode = 1
-            end
-        end
-        if search_mode == 1 then
-            if string.sub(line, 1, 10) == "Video Mode" then
-                if string.match(line, "@") == "@" then
-                    line = "Video Mode=" .. resolution .. string.sub(line, string.find(line, "@")-1)
-                else
-                    line = "Video Mode=" .. resolution
-                end
-                search_mode = 2
-            end
-        end
-        text = text .. line .. "\n"
-    end
-    f:close()
-    f = io.open(file, "w")
-    f:write(text)
-    f:close()
-end
-
-function P.GraphicsBrightnessScrollbar_changed(e)
-    if scrollbar_active == false then
-        -- brightness
-        logMessage(0, "event: brightness")
-    end
-end
-
-function P.GraphicsBrightnessScrollbar_started(e)
-    scrollbar_active = true
-end
-
-function P.GraphicsBrightnessScrollbar_ended(e)
-    -- brightness
-    logMessage(0, "event: brightness")
-    scrollbar_active = false
-end
-
-function P.GraphicsFullscreenCheckbox_clicked(e)
-    if block == false then
-        search_mode = 0
-        f = io.open(file, "r")
-        firstline = f:read("*line")
-        text = firstline .. "\n"
-        rendersystem = string.sub(firstline, 15)
-        for line in f:lines() do
-            if search_mode == 0 then
-                if string.find(line, rendersystem) ~= nil then
-                    search_mode = 1
-                end
-            end
-            if search_mode == 1 then
-                if string.sub(line, 1, 11) == "Full Screen" then
-                    if fullscreen == true then
-                        line = "Full Screen=No"
-                        fullscreen = false
-                    else
-                        line = "Full Screen=Yes"
-                        fullscreen = true
-                    end
-                    search_mode = 2
-                end
-            end
-            text = text .. line .. "\n"
-        end
-        f:close()
-        f = io.open(file, "w")
-        f:write(text)
-        f:close()
-    end
-end
-
-function P.GraphicsBackButton_clicked(e)
+
+    widthEditbox:setText(currentWidth)
+    heightEditbox:setText(currentHeight)
+end
+
+-- checks if the apply button should be enabled or disabled (only enabled if the current settings are different from the selected values)
+function P.updateApplyButton()
+    -- fullscreen checkbox
+    local fullscreenCheckbox = winMgr:getWindow("orxonox/Display/Resolution/Fullscreen")
+    local isFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
+    local fullscreenChanged = (isFullscreen ~= CEGUI.toCheckbox(fullscreenCheckbox):isSelected())
+
+    -- resolution editboxes
+    local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
+    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
+    local currentWidth = tostring(orxonox.GraphicsManager:getInstance():getWindowWidth())
+    local currentHeight = tostring(orxonox.GraphicsManager:getInstance():getWindowHeight())
+    local widthChanged = (currentWidth ~= widthEditbox:getText())
+    local heightChanged = (currentHeight ~= heightEditbox:getText())
+    local resolutionEditboxesEnabled = not widthEditbox:isDisabled()
+
+    -- apply button
+    local applyButton = winMgr:getWindow("orxonox/Display/Resolution/Apply")
+
+    if fullscreenChanged or widthChanged or heightChanged or resolutionEditboxesEnabled then
+        applyButton:enable()
+    else
+        applyButton:disable()
+    end
+end
+
+function P.updateRedLabel()
+    -- theme
+    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
+    local currentTheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
+    local themeChanged = (currentTheme ~= themeCombobox:getText())
+
+    -- vsync
+    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
+    local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
+    local vsyncChanged = (hasVSync ~= CEGUI.toCheckbox(vsyncCheckbox):isSelected())
+
+    -- fsaa
+    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
+    local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
+    local fsaaChanged = (currentFSAAMode ~= fsaaCombobox:getText())
+
+    local needRestart = themeChanged or vsyncChanged or fsaaChanged
+
+    local notice = winMgr:getWindow("orxonox/Display/Notice")
+    notice:setVisible(not needRestart)
+    local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
+    noticeRed:setVisible(needRestart)
+end
+
+---------------------
+-- Event callbacks --
+---------------------
+
+-- resolution
+
+function P.callback_FullscreenCheckbox_CheckStateChanged(e)
+    P.updateApplyButton()
+end
+
+function P.callback_ResolutionCombobox_ListSelectionAccepted(e)
+    P.updateResolutionEditboxes()
+end
+
+function P.callback_ResolutionEditboxWidth_TextChanged(e)
+    P.updateApplyButton()
+end
+
+function P.callback_ResolutionEditboxHeight_TextChanged(e)
+    P.updateApplyButton()
+end
+
+-- theme
+
+function P.callback_ThemeCombobox_ListSelectionAccepted(e)
+    P.updateRedLabel()
+end
+
+-- vsync
+
+function P.callback_VSyncCheckbox_CheckStateChanged(e)
+    P.updateRedLabel()
+end
+
+-- fsaa
+
+function P.callback_FSAACombobox_ListSelectionAccepted(e)
+    P.updateRedLabel()
+end
+
+-- buttons
+
+function P.callback_Apply_Clicked(e)
+    -- resolution
+    local fullscreenCheckbox = winMgr:getWindow("orxonox/Display/Resolution/Fullscreen")
+    local checkedFullscreen = tostring(CEGUI.toCheckbox(fullscreenCheckbox):isSelected())
+
+    local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
+    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
+
+    P.newWidth = widthEditbox:getText()
+    P.newHeight = heightEditbox:getText()
+    P.forceResolutionEditboxes = true
+
+    -- start revert timer
+    P.oldWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
+    P.oldHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
+    P.oldFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
+
+    P.revertTimerHandle = orxonox.CommandExecutor:query("delayreal 10 {hideGUI DecisionPopup; GraphicsManager setScreenResolution " .. P.oldWidth .. " " .. P.oldHeight .. " " .. tostring(P.oldFullscreen) .. "; config Core lastLevelTimestamp_ [expr [getConfig Core ogreConfigTimestamp_] + 1]}")
+
+    -- change settings
+    orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. P.newWidth .. " " .. P.newHeight .. " " .. checkedFullscreen)
+
+    P.updateApplyButton()
+
+    -- prompt for confirmation
+    openDecisionPopup("Do you want to keep these settings? (Settings will be reverted in 10 seconds if not accepted)", GraphicsMenu.callback_ApplyDecisionPopup)
+    if checkedFullscreen then
+        showCursor()
+    end
+end
+
+function P.callback_ApplyDecisionPopup(pressedOK)
+    orxonox.CommandExecutor:execute("killdelay " .. P.revertTimerHandle)
+
+    if not pressedOK then
+        orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. P.oldWidth .. " " .. P.oldHeight .. " " .. tostring(P.oldFullscreen))
+        P:onShow()
+    end
+
+    -- update timestamp to avoid showing the ogre config dialog again after the user accepted or reverted the resolution
+    orxonox.CommandExecutor:execute("config Core lastLevelTimestamp_ [expr [getConfig Core ogreConfigTimestamp_] + 1]")
+end
+
+function P.callback_Ok_Clicked(e)
+    -- aspect ratio
+    local aspectRatioEditbox = winMgr:getWindow("orxonox/Display/Resolution/AspectRatio")
+    orxonox.CommandExecutor:execute("config Camera aspectRatio_ " .. aspectRatioEditbox:getText())
+
+    -- theme
+    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
+    orxonox.CommandExecutor:execute("config GUIManager guiScheme_ " .. themeCombobox:getText())
+
+    -- vsync
+    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
+    local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
+    if hasVSync ~= CEGUI.toCheckbox(vsyncCheckbox):isSelected() then
+        orxonox.CommandExecutor:execute("GraphicsManager setVSync " .. tostring(CEGUI.toCheckbox(vsyncCheckbox):isSelected()))
+    end
+
+    -- fsaa
+    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
+    local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
+    if currentFSAAMode ~= fsaaCombobox:getText() then
+        orxonox.CommandExecutor:execute("GraphicsManager setFSAA {" .. fsaaCombobox:getText() .. "}") -- enclose argument in { ... } because it can contain [brackets] (conflicts with tcl)
+    end
+
+    -- fov
+    local fovEditbox = winMgr:getWindow("orxonox/Settings/Fov")
+    orxonox.CommandExecutor:execute("config Camera fov_ " .. fovEditbox:getText())
+
+    -- fps limit
+    local fpsEditbox = winMgr:getWindow("orxonox/Settings/FpsLimit")
+    orxonox.CommandExecutor:execute("config GraphicsSettings fpsLimit " .. fpsEditbox:getText())
+
+    -- particle lod
+    local particleLodCombobox = winMgr:getWindow("orxonox/Settings/ParticleLodCombobox")
+    local item = particleLodCombobox:getSelectedItem()
+    if item then
+        orxonox.CommandExecutor:execute("config GraphicsSettings particlesDetailLevel " .. particleLodCombobox:getItemIndex(item))
+    end
+
+    -- mesh lod
+    local meshLodCheckbox = winMgr:getWindow("orxonox/Settings/MeshLodCheckbox")
+    orxonox.CommandExecutor:execute("config GraphicsSettings enableMeshLoD " .. tostring(CEGUI.toCheckbox(meshLodCheckbox):isSelected()))
+
+    -- motion blur
+    local motionBlurCheckbox = winMgr:getWindow("orxonox/Settings/MotionBlurCheckbox")
+    orxonox.CommandExecutor:execute("config GraphicsSettings enableMotionBlur " .. tostring(CEGUI.toCheckbox(motionBlurCheckbox):isSelected()))
+
     hideMenuSheet(P.name)
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 1, 1)
+function P.callback_Cancel_Clicked(e)
+    hideMenuSheet(P.name)
 end
 
Index: code/trunk/data/gui/scripts/HostMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/HostMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/HostMenu.lua	(revision 8079)
@@ -5,5 +5,4 @@
 P.multiplayerMode = "startServer"
 
-P.buttonList = {}
 P.levelList = {}
 P.itemList = {}
@@ -11,5 +10,5 @@
 
 function P.onLoad()
-    P.multiplayerMode = "startServer" 
+    P.multiplayerMode = "startServer"
     local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     local button = tolua.cast(window,"CEGUI::Checkbox")
@@ -17,18 +16,23 @@
     P.createLevelList()
 
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/HostMenuStartButton"),
-            ["function"]  = P.HostMenuStartButton_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.HostMenuStartButton_clicked
+    })
 
-    local item = {
+    P:setButton(1, 2, {
             ["button"] = winMgr:getWindow("orxonox/HostMenuBackButton"),
-            ["function"]  = P.HostMenuBackButton_clicked
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.HostMenuBackButton_clicked
+    })
 end
 
 function P.onShow()
+    if P.showAll ~= orxonox.GUIManager:inDevMode() then
+        local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
+        local button = tolua.cast(window,"CEGUI::Checkbox")
+        P.showAll = not P.showAll
+        button:setSelected(P.showAll)
+    end
+
     if P.multiplayerMode == "startServer" then
         local window = winMgr:getWindow("orxonox/HostMenuHostButton")
@@ -44,8 +48,4 @@
         P.createLevelList()
     end
-
-    P.oldindex = -2
-    P.index = -1
-
 end
 
@@ -97,5 +97,5 @@
 end
 
-function P.HostMenuStartButton_clicked(e)    
+function P.HostMenuStartButton_clicked(e)
     local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox"))
     local choice = listbox:getFirstSelectedItem()
@@ -119,7 +119,3 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 1, 2)
-end
-
 return P
Index: code/trunk/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/InGameMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/InGameMenu.lua	(revision 8079)
@@ -4,40 +4,39 @@
 P.loadAlong = { "DecisionPopup" }
 
-P.buttonList = {}
-
 function P.onLoad()
-    P.multiplayerMode = "startClient" 
+    P.multiplayerMode = "startClient"
 
     --button are arranged in a 4x1 matrix, the left lower item is nil
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/InGameMenu_ReturnButton"),
-            ["function"]  = P.button_settings_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.button_return_clicked
+    })
 
-    local item = {
+    P:setButton(2, 1, {
             ["button"] = winMgr:getWindow("orxonox/InGameMenu_MainMenuButton"),
-            ["function"]  = P.button_mainmenu_clicked
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.button_mainmenu_clicked
+    })
 
-    local item = {
+    P:setButton(3, 1, {
             ["button"] = winMgr:getWindow("orxonox/InGameMenu_SettingsButton"),
-            ["function"]  = P.button_settings_clicked
-    }
-    P.buttonList[3] = item
+            ["callback"]  = P.button_settings_clicked
+    })
 
-    local item = {
+    P:setButton(4, 1, {
             ["button"] = winMgr:getWindow("orxonox/InGameMenu_QuitButton"),
-            ["function"]  = P.button_quit_clicked
-    }
-    P.buttonList[4] = item
-
+            ["callback"]  = P.button_quit_clicked
+    })
 end
 
 function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
+    if P:hasSelection() == false then
+        P:setSelection(1, 1)
+    end
+
+    orxonox.execute("setPause 1")
+end
+
+function P.onQuit()
+    orxonox.execute("setPause 0")
 end
 
@@ -64,13 +63,9 @@
         hideMenuSheet("InGameMenu")
         orxonox.execute("exit")
-    else 
+    else
         P.onShow()
     end
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 4, 1)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/KeyBindMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/KeyBindMenu.lua	(revision 8079)
@@ -26,5 +26,5 @@
     table.insert(commandList, "NewHumanController changeMode")
     table.insert(commandList, "switchCamera")
-    table.insert(commandList, "openConsole")
+    table.insert(commandList, "InGameConsole openConsole")
     table.insert(commandList, "OverlayGroup toggleVisibility Debug")
     table.insert(commandList, "OverlayGroup toggleVisibility Stats")
@@ -35,4 +35,8 @@
     table.insert(commandList, "mouseLook")
     table.insert(commandList, "pause")
+    table.insert(commandList, "printScreen")
+    if orxonox.GUIManager:inDevMode() then
+        table.insert(commandList, "printScreenHD 3")
+    end
 
     nameList = {}
@@ -65,4 +69,8 @@
     table.insert(nameList, "Look Around")
     table.insert(nameList, "Pause")
+    table.insert(nameList, "Screenshot")
+    if orxonox.GUIManager:inDevMode() then
+        table.insert(nameList, "HD screenshot")
+    end
 
     linesList = {}
@@ -100,4 +108,9 @@
     local funct = luaState:createLuaFunctor("KeyBindMenu.callback()")
     orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
+
+    P:setButton(1, 1, {
+            ["button"] = winMgr:getWindow("orxonox/KeyBindBackButton"),
+            ["callback"]  = P.KeyBindBackButton_clicked
+    })
 end
 
Index: code/trunk/data/gui/scripts/MainMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MainMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/MainMenu.lua	(revision 8079)
@@ -4,49 +4,35 @@
 P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" }
 
-P.buttonList = {}
-
 function P.onLoad()
     --buttons are arranged in a 6x1 Matrix (list)
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"),
-            ["function"]  = P.QuickGameTestButton_clicked
-    }
-    table.insert(P.buttonList,item)
+            ["callback"]  = P.QuickGameTestButton_clicked
+    })
 
-    item = {
+    P:setButton(2, 1, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"),
-            ["function"]  = P.SingleplayerButton_clicked
-    }
-    table.insert(P.buttonList,item)
+            ["callback"]  = P.SingleplayerButton_clicked
+    })
 
-    item = {
+    P:setButton(3, 1, {
             ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"),
-            ["function"]  = P.MultiplayerButton_clicked
-    }
-    table.insert(P.buttonList,item)
+            ["callback"]  = P.MultiplayerButton_clicked
+    })
 
-    item = {
+    P:setButton(4, 1, {
             ["button"] = winMgr:getWindow("orxonox/SettingsButton"),
-            ["function"]  = P.SettingsButton_clicked
-    }
-    table.insert(P.buttonList,item)
+            ["callback"]  = P.SettingsButton_clicked
+    })
 
-    item = {
+    P:setButton(5, 1, {
             ["button"] = winMgr:getWindow("orxonox/CreditsButton"),
-            ["function"]  = P.CreditsButton_clicked
-    }
-    table.insert(P.buttonList,item)
+            ["callback"]  = P.CreditsButton_clicked
+    })
 
-    item = {
+    P:setButton(6, 1, {
             ["button"] = winMgr:getWindow("orxonox/ExitButton"),
-            ["function"]  = P.ExitButton_clicked
-    }
-    table.insert(P.buttonList,item) 
-end
-
-function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
+            ["callback"]  = P.ExitButton_clicked
+    })
 end
 
@@ -77,8 +63,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 6, 1)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MiscConfigMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/MiscConfigMenu.lua	(revision 8079)
@@ -35,4 +35,5 @@
     table.insert(P.commandList, "HumanPlayer nick_")
     table.insert(P.commandList, "ChatOverlay displayTime_")
+    table.insert(P.commandList, "Core bDevMode_")
 
     P.nameList = {}
@@ -54,4 +55,5 @@
     table.insert(P.nameList, "Playername")
     table.insert(P.nameList, "Chat: display time")
+    table.insert(P.nameList, "Developer's Mode")
 
     P.linesList = {}
@@ -85,4 +87,8 @@
     P.createLines()
 
+    P:setButton(1, 1, {
+            ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigBackButton"),
+            ["callback"]  = P.MiscConfigBackButton_clicked
+    })
 end
 
Index: code/trunk/data/gui/scripts/MouseControlsMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MouseControlsMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/MouseControlsMenu.lua	(revision 8079)
@@ -32,4 +32,9 @@
         invert_active = false
     end
+
+    P:setButton(1, 1, {
+            ["button"] = winMgr:getWindow("orxonox/MouseControlsBackButton"),
+            ["callback"]  = P.MouseControlsBackButton_clicked
+    })
 end
 
Index: code/trunk/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MultiplayerMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/MultiplayerMenu.lua	(revision 8079)
@@ -2,6 +2,4 @@
 
 local P = createMenuSheet("MultiplayerMenu")
-
-P.buttonList = {}
 
 --joinMode is 1 for choice "LAN" and 2 for "Internet"
@@ -10,24 +8,21 @@
 
 function P.onLoad()
-    P.multiplayerMode = "startClient" 
+    P.multiplayerMode = "startClient"
 
-    --button are arranged in a 2x2 matrix, the left lower item is nil
-    local item = {
+    --button are arranged in a 3x2 matrix, Join and Host buttons are in the upper left and middle, the back button in the lower right of the table
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton"),
-            ["function"]  = P.MultiplayerJoinButton_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.MultiplayerJoinButton_clicked
+    })
 
-    local item = {
+    P:setButton(1, 2, {
             ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton"),
-            ["function"]  = P.MultiplayerHostButton_clicked
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.MultiplayerHostButton_clicked
+    })
 
-    local item = {
+    P:setButton(2, 3, {
             ["button"] = winMgr:getWindow("orxonox/MultiplayerBackButton"),
-            ["function"]  = P.MultiplayerBackButton_clicked
-    }
-    P.buttonList[4] = item
+            ["callback"]  = P.MultiplayerBackButton_clicked
+    })
 end
 
@@ -35,8 +30,4 @@
     --P.showServerList()
 
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
-    
     if P.joinMode == 1 then
         local window = winMgr:getWindow("orxonox/MultiplayerLanButton")
@@ -56,5 +47,5 @@
     P.joinMode = 1
     if button:isSelected() == true then
-	    P.showServerList()
+        P.showServerList()
     end
 end
@@ -65,6 +56,6 @@
     P.joinMode = 2
     if button:isSelected() == true then
-	    P.showServerList()
-	end
+        P.showServerList()
+    end
 end
 
@@ -92,72 +83,68 @@
 
 function P.showServerList()
-	-- LAN Discovery
-	if P.joinMode == 1 then
-		local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
-		CEGUI.toListbox(listbox):resetList()
-		local discovery = orxonox.LANDiscovery:getInstance()
-		discovery:discover()
-		P.serverList = {}
-		local index = 0
-		local servername = ""
-		local serverip = ""
-		while true do
-		    servername = discovery:getServerListItemName(index)
-		    if servername == "" then
-		        break
-		    end
-		    serverip = discovery:getServerListItemIP(index)
-		    if serverip == "" then
-		      break
-		    end
-		    table.insert(P.serverList, {servername, serverip})
-		    index = index + 1
-		end
-		index = 1
-		for k,v in pairs(P.serverList) do
-		    local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
-		    item:setID(index)
-		    index = index + 1
-		    item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
-		    CEGUI.toListbox(listbox):addItem(item)
-		end
-	-- WAN Discovery
-	elseif P.joinMode == 2 then
-		local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
-		CEGUI.toListbox(listbox):resetList()
-		local discovery = orxonox.WANDiscovery:getInstance()
-		cout(0, "discovering.\n" )
-		discovery:discover()
-		cout(0, "discovered.\n" )
-		P.serverList = {}
-		local index = 0
-		local servername = ""
-		local serverip = ""
-		while true do
-		    servername = discovery:getServerListItemName(index)
-		    if servername == "" then
-		        break
-		    end
-		    serverip = discovery:getServerListItemIP(index)
-		    if serverip == "" then
-		      break
-		    end
-		    table.insert(P.serverList, {servername, serverip})
-		    index = index + 1
-		end
-		index = 1
-		for k,v in pairs(P.serverList) do
-		    local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
-		    item:setID(index)
-		    index = index + 1
-		    item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
-		    CEGUI.toListbox(listbox):addItem(item)
-		end
-	end
-	
-end
+    -- LAN Discovery
+    if P.joinMode == 1 then
+        local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
+        CEGUI.toListbox(listbox):resetList()
+        local discovery = orxonox.LANDiscovery:getInstance()
+        discovery:discover()
+        P.serverList = {}
+        local index = 0
+        local servername = ""
+        local serverip = ""
+        while true do
+            servername = discovery:getServerListItemName(index)
+            if servername == "" then
+                break
+            end
+            serverip = discovery:getServerListItemIP(index)
+            if serverip == "" then
+                break
+            end
+            table.insert(P.serverList, {servername, serverip})
+            index = index + 1
+        end
+        index = 1
+        for k,v in pairs(P.serverList) do
+            local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
+            item:setID(index)
+            index = index + 1
+            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+            CEGUI.toListbox(listbox):addItem(item)
+        end
+    -- WAN Discovery
+    elseif P.joinMode == 2 then
+        local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
+        CEGUI.toListbox(listbox):resetList()
+        local discovery = orxonox.WANDiscovery:getInstance()
+        cout(0, "discovering.\n" )
+        discovery:discover()
+        cout(0, "discovered.\n" )
+        P.serverList = {}
+        local index = 0
+        local servername = ""
+        local serverip = ""
+        while true do
+            servername = discovery:getServerListItemName(index)
+            if servername == "" then
+                break
+            end
+            serverip = discovery:getServerListItemIP(index)
+            if serverip == "" then
+                break
+            end
+            table.insert(P.serverList, {servername, serverip})
+            index = index + 1
+        end
+        index = 1
+        for k,v in pairs(P.serverList) do
+            local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
+            item:setID(index)
+            index = index + 1
+            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+            CEGUI.toListbox(listbox):addItem(item)
+        end
+    end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 2, 2)
 end
 
Index: code/trunk/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/trunk/data/gui/scripts/NotificationLayer.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/NotificationLayer.lua	(revision 8079)
@@ -46,5 +46,5 @@
 end
 
--- Pushes an input notification to the input queue. 
+-- Pushes an input notification to the input queue.
 function P.pushNotification(queueName, notification)
     local queue = P.queueList[queueName]
@@ -333,5 +333,5 @@
 
 -- Is called after the sheet has been hidden.
-function P.afterHide()
+function P.onQuit()
     -- If we leave the edit mode we show the sheet again.
     if P.editMode then
Index: code/trunk/data/gui/scripts/SettingsMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/SettingsMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/SettingsMenu.lua	(revision 8079)
@@ -4,46 +4,33 @@
 P.loadAlong = { "ControlsMenu", "AudioMenu", "GraphicsMenu" }
 
-P.buttonList = {}
-
 function P.onLoad()
     --"Gameplay" and "Multiplayer Options" are not integrated in the list
-    --buttons are arranged in a 4x2 matrix. The lower-right element is not in the matrix!
-    local item = {
+    --buttons are arranged in a 4x2 matrix.
+    P:setButton(1, 2, {
             ["button"] = winMgr:getWindow("orxonox/SettingsMenu/GraphicsButton"),
-            ["function"]  = P.SettingsGraphicsButton_clicked
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.SettingsGraphicsButton_clicked
+    })
 
-    local item = {
+    P:setButton(2, 2, {
             ["button"] = winMgr:getWindow("orxonox/SettingsMenu/AudioButton"),
-            ["function"]  = P.SettingsAudioButton_clicked
-    }
-    P.buttonList[4] = item
+            ["callback"]  = P.SettingsAudioButton_clicked
+    })
 
+    P:setButton(3, 1, {
+            ["button"] = winMgr:getWindow("orxonox/SettingsMenu/ControlsButton"),
+            ["callback"]  = P.SettingsControlsButton_clicked
+    })
 
-    local item = {
-            ["button"] = winMgr:getWindow("orxonox/SettingsMenu/ControlsButton"),
-            ["function"]  = P.SettingsControlsButton_clicked
-    }
-    P.buttonList[5] = item
+    P:setButton(3, 2, {
+            ["button"] = winMgr:getWindow("orxonox/SettingsMenu/MiscellaneousButton"),
+            ["callback"]  = P.SettingsMiscellaneousButton_clicked
+    })
 
-    local item = {
-            ["button"] = winMgr:getWindow("orxonox/SettingsMenu/MiscellaneousButton"),
-            ["function"]  = P.SettingsMiscellaneousButton_clicked
-    }
-    P.buttonList[6] = item
+    P:setButton(4, 1, {
+            ["button"] = winMgr:getWindow("orxonox/SettingsMenu/SettingsBackButton"),
+            ["callback"]  = P.SettingsBackButton_clicked
+    })
 
-    local item = {
-            ["button"] = winMgr:getWindow("orxonox/SettingsMenu/SettingsBackButton"),
-            ["function"]  = P.SettingsBackButton_clicked
-    }
-    P.buttonList[7] = item
-
-end
-
-function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = 3
-    P.index = 2
+    P:setButton(4, 2, P:getButton(4, 1))
 end
 
@@ -76,8 +63,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 4, 2)
-end
-
 return P
 
Index: code/trunk/data/gui/scripts/SheetManager.lua
===================================================================
--- code/trunk/data/gui/scripts/SheetManager.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/SheetManager.lua	(revision 8079)
@@ -8,25 +8,21 @@
 local mainMenuLoaded = false
 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
-
------------------------
---- Local functions ---
------------------------
-
-local function hideCursor()
-    if cursor:isVisible() then
-        cursor:hide()
-    end
-end
-
-local function showCursor()
-    if not cursor:isVisible() and inputMgr:isMouseExclusive() then
-        cursor:show()
-    end
-end
-
+orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized")
 
 ------------------------
 --- Global functions ---
 ------------------------
+
+function hideCursor()
+    if cursor:isVisible() then
+        cursor:hide()
+    end
+end
+
+function showCursor()
+    if not cursor:isVisible() and inputMgr:isMouseExclusive() then
+        cursor:show()
+    end
+end
 
 -- Loads the GUI with the specified name
@@ -93,5 +89,6 @@
         ["sheet"]          = menuSheet,
         ["bHidePrevious"]  = bHidePrevious,
-        ["bNoInput"]       = bNoInput
+        ["bNoInput"]       = bNoInput,
+        ["name"]           = name
     }
     table.insert(activeMenuSheets, sheetTuple) -- indexed array access
@@ -121,12 +118,19 @@
 
     -- Hide all previous sheets if necessary
+    local previous
     if bHidePrevious then
         for i = 1, activeMenuSheets.size - 1 do
-            activeMenuSheets[i].sheet:hide()
-        end
-    end
-    
+            previous = activeMenuSheets[i].sheet
+            previous:hide()
+        end
+    end
+
     menuSheet:show()
     menuSheetsRoot:activate()
+
+    -- select first button if the menu was opened with the keyboard
+    if previous and previous.pressedEnter and menuSheet:hasSelection() == false then
+        menuSheet:setSelectionNear(1, 1)
+    end
 
     return menuSheet
@@ -179,5 +183,5 @@
         inputMgr:leaveState(sheetTuple.sheet.inputState)
     end
-    
+
     -- CURSOR SHOWING
     local i = activeMenuSheets.size
@@ -200,5 +204,5 @@
     end
 
-    sheetTuple.sheet:afterHide()
+    sheetTuple.sheet:quit()
 end
 
@@ -242,8 +246,27 @@
             keyESC()
         elseif code == "0"then
-            orxonox.CommandExecutor:execute("openConsole")
-        end
-    end
-    sheet.sheet:onKeyPressed()
+            orxonox.CommandExecutor:execute("InGameConsole openConsole")
+        end
+    end
+    sheet.sheet:keyPressed()
+end
+
+function windowResized(e)
+    for name, sheet in pairs(loadedSheets) do
+        if orxonox.GraphicsManager:getInstance():isFullScreen() or sheet.tShowCursor == TriBool.False then
+            inputMgr:setMouseExclusive(sheet.inputState, TriBool.True)
+        else
+            inputMgr:setMouseExclusive(sheet.inputState, TriBool.False)
+        end
+    end
+    local sheetTuple = activeMenuSheets[activeMenuSheets.size]
+    if sheetTuple then
+        if orxonox.GraphicsManager:getInstance():isFullScreen() and sheetTuple.sheet.tShowCursor ~= TriBool.False then
+            showCursor()
+        else
+            hideCursor()
+        end
+        sheetTuple.sheet:windowResized()
+    end
 end
 
@@ -276,4 +299,14 @@
 end
 
+function getGUIFirstActive(name, bHidePrevious, bNoInput)
+    local sheet = activeMenuSheets.topSheetTuple
+    -- If the topmost gui sheet has the input name
+    if sheet ~= nil and sheet.name == name then
+        guiMgr:toggleGUIHelper(name, bHidePrevious, bNoInput, false);
+    else
+        guiMgr:toggleGUIHelper(name, bHidePrevious, bNoInput, true);
+    end
+end
+
 ----------------------
 --- Initialisation ---
Index: code/trunk/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/SingleplayerMenu.lua	(revision 7913)
+++ code/trunk/data/gui/scripts/SingleplayerMenu.lua	(revision 8079)
@@ -3,5 +3,4 @@
 local P = createMenuSheet("SingleplayerMenu")
 
-P.buttonList = {}
 P.levelList = {}
 P.itemList = {}
@@ -15,15 +14,23 @@
 
     --buttons are arranged in a 1x2 matrix
-    local item = {
+    P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
-            ["function"]  = P.SingleplayerStartButton_clicked
-    }
-    P.buttonList[1] = item
+            ["callback"]  = P.SingleplayerStartButton_clicked
+    })
 
-    local item = {
+    P:setButton(1, 2, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
-            ["function"]  = P.SingleplayerBackButton_clicked
-    }
-    P.buttonList[2] = item
+            ["callback"]  = P.SingleplayerBackButton_clicked
+    })
+end
+
+function P.onShow()
+    if P.showAll ~= orxonox.GUIManager:inDevMode() then
+        local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
+        local button = tolua.cast(window,"CEGUI::Checkbox")
+        P.showAll = not P.showAll
+        button:setSelected(P.showAll)
+        P.createLevelList()
+    end
 end
 
@@ -47,6 +54,4 @@
         index = index + 1
     end
-    --TODO: Reintroduce sorting, if needed. At the moment it's sorted by filename.
-    --table.sort(levelList)
     for k,v in pairs(P.levelList) do
         local item = CEGUI.createListboxTextItem(v:getName())
@@ -59,10 +64,4 @@
         orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())
     end
-end
-
-function P.onShow()
-    --indices to iterate through buttonlist
-    P.oldindex = -2
-    P.index = -1
 end
 
@@ -93,8 +92,4 @@
 end
 
-function P.onKeyPressed() 
-    buttonIteratorHelper(P.buttonList, code, P, 1, 2)
-end
-
 return P
 
