[Orxonox-commit 1565] r6283 - in code/branches/presentation2/data/gui: layouts scripts

dafrick at orxonox.net dafrick at orxonox.net
Wed Dec 9 13:56:36 CET 2009


Author: dafrick
Date: 2009-12-09 13:56:36 +0100 (Wed, 09 Dec 2009)
New Revision: 6283

Modified:
   code/branches/presentation2/data/gui/layouts/InfoPopup.layout
   code/branches/presentation2/data/gui/scripts/GUITools.lua
   code/branches/presentation2/data/gui/scripts/InfoPopup.lua
   code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
Log:
Some enhancements in KeyBindMenu.lua and InfoPopup, clear doesn't work, yet.


Modified: code/branches/presentation2/data/gui/layouts/InfoPopup.layout
===================================================================
--- code/branches/presentation2/data/gui/layouts/InfoPopup.layout	2009-12-09 12:39:39 UTC (rev 6282)
+++ code/branches/presentation2/data/gui/layouts/InfoPopup.layout	2009-12-09 12:56:36 UTC (rev 6283)
@@ -8,7 +8,7 @@
         <Window Type="TaharezLook/StaticImage" Name="orxonox/InfoPopup_Background" >
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
-            <Property Name="Alpha" Value="0.6" />
+            <Property Name="Alpha" Value="0.7" />
             <Window Type="TaharezLook/Button" Name="orxonox/InfoPopup_close" >
                 <Property Name="Font" Value="BlueHighway-12" />
                 <Property Name="Text" Value="Close" />

Modified: code/branches/presentation2/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/GUITools.lua	2009-12-09 12:39:39 UTC (rev 6282)
+++ code/branches/presentation2/data/gui/scripts/GUITools.lua	2009-12-09 12:56:36 UTC (rev 6283)
@@ -4,8 +4,9 @@
     DecisionPopup.setText(text)
 end
 
-function openInfoPopup( text, functionPtr )
+function openInfoPopup(text, functionPtr, closeButton)
     showGUI("InfoPopup", false, true)
-    InfoPopup.setDo(functionPtr)
+    InfoPopup.execute(functionPtr)
     InfoPopup.setText(text)
+    InfoPopup.setCloseButton(closeButton)
 end

Modified: code/branches/presentation2/data/gui/scripts/InfoPopup.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/InfoPopup.lua	2009-12-09 12:39:39 UTC (rev 6282)
+++ code/branches/presentation2/data/gui/scripts/InfoPopup.lua	2009-12-09 12:56:36 UTC (rev 6283)
@@ -14,10 +14,9 @@
 function P:init()
 end
 
-function P.setDo(functionPtr)
-    P.functionPtr = functionPtr
-    if P.functionPtr ~= nil then
-        P.functionPtr()
+function P.execute(functionPtr)
+    if functionPtr ~= nil then
+        functionPtr()
     end
 end
 
@@ -25,6 +24,16 @@
     winMgr:getWindow("orxonox/InfoPopup_text"):setText( text )
 end
 
+function P.setCloseButton(closeButton)
+    close = winMgr:getWindow("orxonox/InfoPopup_close")
+    close:setVisible(closeButton)
+    if(not closeButton) then
+        close:deactivate();
+    else
+        close:activate();
+    end
+end
+
 -- events for ingamemenu
 function P.close(e)
     hideGUI("InfoPopup")

Modified: code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua	2009-12-09 12:39:39 UTC (rev 6282)
+++ code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua	2009-12-09 12:56:36 UTC (rev 6283)
@@ -55,26 +55,32 @@
     local window = winMgr:getWindow("orxonox/KeyBindPane")
 
     for k,v in pairs(commandList) do
+        local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
+        local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
         local button = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Button")
-        local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
-        local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
+        local clear = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Clear")
         
         line:setSize(CEGUI.UVector2(CEGUI.UDim(1,-13),CEGUI.UDim(0, lineHeight)))
+        command:setSize(CEGUI.UVector2(CEGUI.UDim(0.55, 0), CEGUI.UDim(1, 0)))
         button:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(1, 0)))
-        command:setSize(CEGUI.UVector2(CEGUI.UDim(0.6, 0), CEGUI.UDim(1, 0)))
+        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0),CEGUI.UDim(1,0)))
         
-        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.6, 0),CEGUI.UDim(0, 0)))
+        line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1))))        
         command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, 0)))
-        line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1))))
+        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.55, 0),CEGUI.UDim(0, 0)))
+        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0.95, 0),CEGUI.UDim(0, 0)))
         
+        command:setText(nameList[k])
         button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v))
-        command:setText(nameList[k])
-        
+        clear:setText("X")
+
         orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
+        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
         --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
         
         line:addChildWindow(command)
         line:addChildWindow(button)
+        line:addChildWindow(clear)
         window:addChildWindow(line)
     end
 end
@@ -82,17 +88,33 @@
 function P.KeyBindButton_clicked(e)
     local we = CEGUI.toWindowEventArgs(e)
     local name = we.window:getName()
-    commandNr = tonumber(string.match(name, "%d+"))
+    buttonNr = tonumber(string.match(name, "%d+"))
     
     openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind)
 end
 
+function P.KeyBindClear_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+    clearNr = tonumber(string.match(name, "%d+"))
+    
+    
+end
+
 function P.keybind()
-    local funct = luaState:createLuaFunctor("InfoPopup:close()")
+    local funct = luaState:createLuaFunctor("KeyBindMenu.callback(" .. buttonNr ..")")
     orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
-    orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr])
+    orxonox.KeyBinderManager:getInstance():keybind(commandList[buttonNr])
 end
 
+function P.callback(number)
+    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(0)
+    local button = winMgr:getWindow("orxonox/KeyBindPane/Binding" .. number .. "/Button")
+    button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[number]))
+    
+    InfoPopup.close()
+end
+
 function P.KeyBindBackButton_clicked(e)
     hideGUI("KeyBindMenu")
     debug("event: back")




More information about the Orxonox-commit mailing list