[Orxonox-commit 2291] orxonox r7006 - in code/branches/presentation3/data/gui: layouts scripts

dafrick at orxonox.net dafrick at orxonox.net
Sun May 30 12:21:21 CEST 2010


Author: dafrick
Date: 2010-05-29 17:09:58 +0200 (Sat, 29 May 2010)
New Revision: 7006

Added:
   code/branches/presentation3/data/gui/layouts/MiscConfigMenu.layout
   code/branches/presentation3/data/gui/scripts/MiscConfigMenu.lua
Modified:
   code/branches/presentation3/data/gui/layouts/SettingsMenu.layout
   code/branches/presentation3/data/gui/scripts/SettingsMenu.lua
Log:
Added Menu to display and edit config values.
But the list of available config values has still to be populated and editing doesn't work yet.


Added: code/branches/presentation3/data/gui/layouts/MiscConfigMenu.layout
===================================================================
--- code/branches/presentation3/data/gui/layouts/MiscConfigMenu.layout	                        (rev 0)
+++ code/branches/presentation3/data/gui/layouts/MiscConfigMenu.layout	2010-05-29 15:09:58 UTC (rev 7006)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="orxonox/MiscConfigMenu/Background" >
+        <Property Name="InheritsAlpha" 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/MicsConfigMenu/ConfigWindow" >
+            <Property Name="Text" Value="Keybindings" />
+            <Property Name="Alpha" Value="0.8" />
+            <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.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" />
+            <Window Type="MenuWidgets/StaticText" Name="orxonox/MiscConfigMenu/Wrapper" >
+                <Property Name="TextColours" Value="FF4444FF" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="HorzFormatting" Value="HorzCentred" />
+                <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
+                <Window Type="MenuWidgets/ScrollablePane" Name="orxonox/MiscConfigMenu/MiscConfigPane" >
+                    <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
+                    <Property Name="HorzStepSize" Value="0.005" />
+                    <Property Name="VertStepSize" Value="0.005" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="HorzOverlapSize" Value="0.01" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" />
+                    <Property Name="VertOverlapSize" Value="0.01" />
+                    <Property Name="HorzScrollPosition" Value="0" />
+                    <Property Name="VertScrollPosition" Value="0" />
+                </Window>
+            </Window>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/MiscConfigBackButton" >
+            <Property Name="Text" Value="Back" />
+            <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="MiscConfigMenu.MiscConfigBackButton_clicked"/>
+        </Window>
+    </Window>
+</GUILayout>

Modified: code/branches/presentation3/data/gui/layouts/SettingsMenu.layout
===================================================================
--- code/branches/presentation3/data/gui/layouts/SettingsMenu.layout	2010-05-28 08:23:14 UTC (rev 7005)
+++ code/branches/presentation3/data/gui/layouts/SettingsMenu.layout	2010-05-29 15:09:58 UTC (rev 7006)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <GUILayout >
-    <Window Type="MenuWidgets/StaticImage" Name="orxonox/SettingsBackground" >
+    <Window Type="MenuWidgets/StaticImage" Name="orxonox/SettingsMenu/Background" >
         <Property Name="InheritsAlpha" Value="False" />
         <Property Name="FrameEnabled" Value="False" />
         <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
         <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
         <Property Name="BackgroundEnabled" Value="False" />
-        <Window Type="MenuWidgets/StaticText" Name="orxonox/SettingsWindow" >
+        <Window Type="MenuWidgets/StaticText" Name="orxonox/SettingsMenu/SettingsWindow" >
             <Property Name="Text" Value="Settings" />
             <Property Name="Alpha" Value="0.8" />
             <Property Name="InheritsAlpha" Value="False" />
@@ -15,47 +15,47 @@
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="VertFormatting" Value="TopAligned" />
             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.3625,0},{0.75,0},{0.6375,0}}" />
-            <Window Type="MenuWidgets/Button" Name="orxonox/GameplayButton" >
+            <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/GameplayButton" >
                 <Property Name="Text" Value="Gameplay" />
                 <Property Name="Disabled" Value="True" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.181818,0},{0.45,0},{0.363636,0}}" />
                 <Event Name="Clicked" Function="SettingsMenu.SettingsGameplayButton_clicked"/>
             </Window>
-            <Window Type="MenuWidgets/Button" Name="orxonox/MultiplayerOptionsButton" >
+            <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/MultiplayerOptionsButton" >
                 <Property Name="Text" Value="Multiplayer options" />
                 <Property Name="Disabled" Value="True" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.454545,0},{0.45,0},{0.636363,0}}" />
                 <Event Name="Clicked" Function="SettingsMenu.SettingsMultiplayerOptionsButton_clicked"/>
             </Window>
-            <Window Type="MenuWidgets/Button" Name="orxonox/ControlsButton" >
+            <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/ControlsButton" >
                 <Property Name="Text" Value="Controls" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.727272,0},{0.45,0},{0.909090,0}}" />
                 <Event Name="Clicked" Function="SettingsMenu.SettingsControlsButton_clicked"/>
             </Window>
-            <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsButton" >
+            <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/GraphicsButton" >
                 <Property Name="Text" Value="Graphics" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.181818,0},{0.95,0},{0.363636,0}}" />
                 <Event Name="Clicked" Function="SettingsMenu.SettingsGraphicsButton_clicked"/>
             </Window>
-            <Window Type="MenuWidgets/Button" Name="orxonox/AudioButton" >
+            <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/AudioButton" >
                 <Property Name="Text" Value="Audio" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.454545,0},{0.95,0},{0.636363,0}}" />
                 <Event Name="Clicked" Function="SettingsMenu.SettingsAudioButton_clicked"/>
             </Window>
-            <Window Type="MenuWidgets/Button" Name="orxonox/ResetSettingsButton" >
-                <Property Name="Text" Value="Reset settings" />
+            <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/MiscellaneousButton" >
+                <Property Name="Text" Value="Miscellaneous" />
                 <Property Name="Disabled" Value="True" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.727272,0},{0.95,0},{0.909090,0}}" />
-                <Event Name="Clicked" Function="SettingsMenu.SettingsResetSettingsButton_clicked"/>
+                <Event Name="Clicked" Function="SettingsMenu.SettingsMiscellaneousButton_clicked"/>
             </Window>
         </Window>
-        <Window Type="MenuWidgets/Button" Name="orxonox/SettingsBackButton" >
+        <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/SettingsBackButton" >
             <Property Name="Text" Value="Back" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />

Added: code/branches/presentation3/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/branches/presentation3/data/gui/scripts/MiscConfigMenu.lua	                        (rev 0)
+++ code/branches/presentation3/data/gui/scripts/MiscConfigMenu.lua	2010-05-29 15:09:58 UTC (rev 7006)
@@ -0,0 +1,147 @@
+-- MiscConfigMenu.lua
+
+local P = createMenuSheet("MiscConfigMenu")
+
+P.commandList = {}
+P.nameList = {}
+P.linesList = {}
+
+P.sampleWindow = nil
+
+P.lineHeight = 0
+P.commandWidth = 0
+P.configWidth = 0
+P.resetWidth = 0
+P.spaceWidth = 0
+
+function P.onLoad()
+
+    P.commandList = {}
+    table.insert(P.commandList, "ChatOverlay displayTime_")
+
+    P.nameList = {}
+    table.insert(P.nameList, "ChatOverlay: display time")
+
+    P.linesList = {}
+
+    --Calculate design parameters:
+    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/MiscConfigMenu/MiscConfigPane/SampleWindow")
+    P.sampleWindow:setText("SampleText")
+
+    local size = getMinTextSize(P.sampleWindow)
+    P.lineHeight = size[1]
+
+    P.commandWidth = 0
+    for k,v in pairs(P.commandList) do
+        P.sampleWindow:setText(P.nameList[k])
+        size = getMinTextSize(P.sampleWindow)
+        if size[2] > P.commandWidth then
+            P.commandWidth = size[2]
+        end
+    end
+
+    P.sampleWindow:setText("configure")
+    size = getMinTextSize(P.sampleWindow)
+    P.configWidth = size[2]+20
+
+    P.sampleWindow:setText("reset")
+    size = getMinTextSize(P.sampleWindow)
+    P.resetWidth = size[2]+20
+
+    P.spaceWidth = math.floor(1/8*P.configWidth)
+
+    P.createLines()
+
+end
+
+function P.createLine(k)
+    local offset = 0
+    local line = winMgr:createWindow("DefaultWindow", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k)
+    line:setHeight(CEGUI.UDim(0, P.lineHeight))
+    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
+
+    local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")
+    command:setText(P.nameList[k])
+    command:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
+    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
+    line:addChildWindow(command)
+    offset = offset + P.commandWidth + P.spaceWidth
+
+    local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
+    configvalue:setProperty("ReadOnly", "set:False")
+    orxonox.CommandExecutor:execute("getConfig " .. P.commandList[k])
+    local value = orxonox.CommandExecutor:getReturnValueString()
+    configvalue:setText(value)
+    P.sampleWindow:setText(value)
+    local size = getMinTextSize(P.sampleWindow)
+    local configvalueWidth = 2*size[2]
+    configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, configvalueWidth), CEGUI.UDim(0.9, 0)))
+    configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
+    line:addChildWindow(configvalue)
+    offset = offset + configvalueWidth + P.spaceWidth
+
+    local config = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Config")
+    config:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.configWidth), CEGUI.UDim(0.9, 0)))
+    config:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
+    config:setText("configure")
+    orxonox.GUIManager:subscribeEventHelper(config, "Clicked", P.name .. ".MiscConfigConfigure_clicked")
+    line:addChildWindow(config)
+    offset = offset + P.configWidth + P.spaceWidth
+
+    local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
+    reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
+    reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
+    reset:setText("reset")
+    orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigReset_clicked")
+    line:addChildWindow(reset)
+    offset = offset + P.resetWidth + P.spaceWidth
+
+    line:setWidth(CEGUI.UDim(0, offset))
+
+    return line
+end
+
+function P.createLines()
+    local window = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane")
+
+    for k,v in pairs(P.commandList) do
+        local line = P.createLine(k)
+        table.insert(P.linesList, line)
+        window:addChildWindow(line)
+    end
+
+    local pane = tolua.cast(window, "CEGUI::ScrollablePane")
+    pane:setVerticalStepSize(getScrollingStepSize(window))
+end
+
+function P.MiscConfigReset_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+
+    -- TODO: Implement reset.
+end
+
+function P.MiscConfigConfigure_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+
+    local window = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
+
+    -- TODO: tconfig or permanent?
+    orxonox.CommandExecutor:execute("tconfig " .. P.commandList[commandNr] .. " " .. window:getText())
+    orxonox.CommandExecutor:execute("getConfig " .. P.commandList[commandNr])
+    local value = orxonox.CommandExecutor:getReturnValueString()
+    window:setText(value)
+end
+
+function P.MiscConfigBackButton_clicked(e)
+    hideMenuSheet("MiscConfigMenu")
+end
+
+return P

Modified: code/branches/presentation3/data/gui/scripts/SettingsMenu.lua
===================================================================
--- code/branches/presentation3/data/gui/scripts/SettingsMenu.lua	2010-05-28 08:23:14 UTC (rev 7005)
+++ code/branches/presentation3/data/gui/scripts/SettingsMenu.lua	2010-05-29 15:09:58 UTC (rev 7006)
@@ -23,9 +23,8 @@
     showMenuSheet("AudioMenu", true)
 end
 
-function P.SettingsResetSettingsButton_clicked(e)
-    -- reset settings
-    logMessage(0, "event: reset settings")
+function P.SettingsMiscellaneousButton_clicked(e)
+    showMenuSheet("MiscConfigMenu", true)
 end
 
 function P.SettingsBackButton_clicked(e)




More information about the Orxonox-commit mailing list