Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6283


Ignore:
Timestamp:
Dec 9, 2009, 1:56:36 PM (14 years ago)
Author:
dafrick
Message:

Some enhancements in KeyBindMenu.lua and InfoPopup, clear doesn't work, yet.

Location:
code/branches/presentation2/data/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/data/gui/layouts/InfoPopup.layout

    r6266 r6283  
    99            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1010            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    11             <Property Name="Alpha" Value="0.6" />
     11            <Property Name="Alpha" Value="0.7" />
    1212            <Window Type="TaharezLook/Button" Name="orxonox/InfoPopup_close" >
    1313                <Property Name="Font" Value="BlueHighway-12" />
  • code/branches/presentation2/data/gui/scripts/GUITools.lua

    r6266 r6283  
    55end
    66
    7 function openInfoPopup( text, functionPtr )
     7function openInfoPopup(text, functionPtr, closeButton)
    88    showGUI("InfoPopup", false, true)
    9     InfoPopup.setDo(functionPtr)
     9    InfoPopup.execute(functionPtr)
    1010    InfoPopup.setText(text)
     11    InfoPopup.setCloseButton(closeButton)
    1112end
  • code/branches/presentation2/data/gui/scripts/InfoPopup.lua

    r6266 r6283  
    1515end
    1616
    17 function P.setDo(functionPtr)
    18     P.functionPtr = functionPtr
    19     if P.functionPtr ~= nil then
    20         P.functionPtr()
     17function P.execute(functionPtr)
     18    if functionPtr ~= nil then
     19        functionPtr()
    2120    end
    2221end
     
    2423function P.setText( text )
    2524    winMgr:getWindow("orxonox/InfoPopup_text"):setText( text )
     25end
     26
     27function P.setCloseButton(closeButton)
     28    close = winMgr:getWindow("orxonox/InfoPopup_close")
     29    close:setVisible(closeButton)
     30    if(not closeButton) then
     31        close:deactivate();
     32    else
     33        close:activate();
     34    end
    2635end
    2736
  • code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua

    r6281 r6283  
    5656
    5757    for k,v in pairs(commandList) do
     58        local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
     59        local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
    5860        local button = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Button")
    59         local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
    60         local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
     61        local clear = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Clear")
    6162       
    6263        line:setSize(CEGUI.UVector2(CEGUI.UDim(1,-13),CEGUI.UDim(0, lineHeight)))
     64        command:setSize(CEGUI.UVector2(CEGUI.UDim(0.55, 0), CEGUI.UDim(1, 0)))
    6365        button:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(1, 0)))
    64         command:setSize(CEGUI.UVector2(CEGUI.UDim(0.6, 0), CEGUI.UDim(1, 0)))
     66        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0),CEGUI.UDim(1,0)))
    6567       
    66         button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.6, 0),CEGUI.UDim(0, 0)))
     68        line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1))))       
    6769        command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, 0)))
    68         line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1))))
     70        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.55, 0),CEGUI.UDim(0, 0)))
     71        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0.95, 0),CEGUI.UDim(0, 0)))
    6972       
     73        command:setText(nameList[k])
    7074        button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v))
    71         command:setText(nameList[k])
    72        
     75        clear:setText("X")
     76
    7377        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
     78        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
    7479        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
    7580       
    7681        line:addChildWindow(command)
    7782        line:addChildWindow(button)
     83        line:addChildWindow(clear)
    7884        window:addChildWindow(line)
    7985    end
     
    8389    local we = CEGUI.toWindowEventArgs(e)
    8490    local name = we.window:getName()
    85     commandNr = tonumber(string.match(name, "%d+"))
     91    buttonNr = tonumber(string.match(name, "%d+"))
    8692   
    8793    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind)
    8894end
    8995
     96function P.KeyBindClear_clicked(e)
     97    local we = CEGUI.toWindowEventArgs(e)
     98    local name = we.window:getName()
     99    clearNr = tonumber(string.match(name, "%d+"))
     100   
     101   
     102end
     103
    90104function P.keybind()
    91     local funct = luaState:createLuaFunctor("InfoPopup:close()")
     105    local funct = luaState:createLuaFunctor("KeyBindMenu.callback(" .. buttonNr ..")")
    92106    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
    93     orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr])
     107    orxonox.KeyBinderManager:getInstance():keybind(commandList[buttonNr])
     108end
     109
     110function P.callback(number)
     111    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(0)
     112    local button = winMgr:getWindow("orxonox/KeyBindPane/Binding" .. number .. "/Button")
     113    button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[number]))
     114   
     115    InfoPopup.close()
    94116end
    95117
Note: See TracChangeset for help on using the changeset viewer.