Changeset 6324
- Timestamp:
- Dec 11, 2009, 5:24:32 PM (15 years ago)
- Location:
- code/branches/presentation2/data/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout
r6311 r6324 13 13 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 14 14 <Property Name="VertFormatting" Value="TopAligned" /> 15 <Property Name="UnifiedAreaRect" Value="{{0. 2,0},{0.25,0},{0.8,0},{0.6,0}}" />16 <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBind Text" >15 <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.8,0}}" /> 16 <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindWrapper" > 17 17 <Property Name="TextColours" Value="FF4444FF" /> 18 18 <Property Name="InheritsAlpha" Value="False" /> … … 20 20 <Property Name="HorzFormatting" Value="HorzCentred" /> 21 21 <Property Name="VertFormatting" Value="TopAligned" /> 22 <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.15,0},{0.958333,0},{0.92,0}}" />22 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.95,0}}" /> 23 23 <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane" > 24 24 <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" /> … … 27 27 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 28 28 <Property Name="HorzOverlapSize" Value="0.01" /> 29 <Property Name="UnifiedAreaRect" Value="{{0 .04,0},{0.005,0},{0.999,0},{0.99,0}}" />29 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 30 30 <Property Name="VertOverlapSize" Value="0.01" /> 31 31 <Property Name="HorzScrollPosition" Value="0" /> … … 37 37 <Property Name="Text" Value="Back" /> 38 38 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 39 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0. 625,0},{0.6,0},{0.675,0}}" />39 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.825,0},{0.6,0},{0.875,0}}" /> 40 40 <Event Name="Clicked" Function="KeyBindMenu.KeyBindBackButton_clicked"/> 41 41 </Window> -
code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
r6311 r6324 56 56 57 57 lineHeight = 35 58 commandWidth = 200 58 59 buttonWidth = 170 59 60 clearWidth = 20 60 61 spaceWidth = 10 62 63 P.createLines() 64 65 local funct = luaState:createLuaFunctor("KeyBindMenu.callback()") 66 orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct) 67 end 68 69 70 function P.KeyNameNiceifier(key) 71 local name = string.sub(key, string.find(key, '%.(.*)')+1) 72 local group = string.sub(key, string.find(key, '(.*)%.')) 73 group = string.sub(group,1,string.len(group)-1) 74 if( group == "Keys") then 75 return "Key " .. string.sub(name, string.find(name, 'Key(.*)')+3) 76 elseif( group == "MouseButtons") then 77 return "Mouse " .. name 78 end 79 return key 80 end 81 82 function P.createLine(k) 83 local offset = 0 84 local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k) 85 line:setHeight(CEGUI.UDim(0, lineHeight)) 86 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1)))) 87 88 local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 89 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(0.9, 0))) 90 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 91 command:setText(nameList[k]) 92 line:addChildWindow(command) 93 offset = offset + commandWidth + spaceWidth 94 95 local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus") 96 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0))) 97 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 98 plus:setText("+") 99 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked") 100 line:addChildWindow(plus) 101 offset = offset + clearWidth + spaceWidth 102 103 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]); 104 for i=0,(numButtons-1) do 105 local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i) 106 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0))) 107 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 108 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i) 109 name = P.KeyNameNiceifier(name) 110 button:setText(name) 111 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked") 112 --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked") 113 line:addChildWindow(button) 114 offset = offset + buttonWidth 115 116 local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i) 117 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0))) 118 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth+spaceWidth)+buttonWidth)+commandWidth+clearWidth+2*spaceWidth), CEGUI.UDim(0.15, 0))) 119 clear:setText("X") 120 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked") 121 line:addChildWindow(clear) 122 offset = offset + clearWidth + spaceWidth 123 end 124 125 line:setWidth(CEGUI.UDim(0, offset+clearWidth)) 126 127 return line 128 end 129 130 function P.createLines() 131 61 132 local window = winMgr:getWindow("orxonox/KeyBindPane") 62 133 … … 66 137 window:addChildWindow(line) 67 138 end 68 69 local funct = luaState:createLuaFunctor("KeyBindMenu.callback()") 70 orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct) 71 end 72 73 function P.createLine(k) 74 local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k) 75 line:setHeight(CEGUI.UDim(0, lineHeight)) 76 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1)))) 77 78 local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 79 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, 200), CEGUI.UDim(1, 0))) 80 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0))) 81 command:setText(nameList[k]) 82 line:addChildWindow(command) 83 84 local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus") 85 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(1, 0))) 86 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 200), CEGUI.UDim(0, 0))) 87 plus:setText("+") 88 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked") 89 line:addChildWindow(plus) 90 91 numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]); 92 for i=0,(numButtons-1) do 93 local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i) 94 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.8, 0))) 95 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth))+200+clearWidth), CEGUI.UDim(0.1, 0))) 96 button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)) 97 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked") 98 --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked") 99 line:addChildWindow(button) 100 101 local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i) 102 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.8, 0))) 103 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth)+buttonWidth)+200+clearWidth), CEGUI.UDim(0.1, 0))) 104 clear:setText("X") 105 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked") 106 line:addChildWindow(clear) 107 end 108 109 line:setWidth(CEGUI.UDim(0, 200+numButtons*(buttonWidth+clearWidth)+clearWidth)) 110 111 return line 139 112 140 end 113 141 … … 170 198 linesList = {} 171 199 172 window = winMgr:getWindow("orxonox/KeyBindPane") 173 for q,w in pairs(commandList) do 174 local line = P.createLine(q) 175 table.insert(linesList, line) 176 window:addChildWindow(line) 177 end 200 P.createLines() 178 201 179 202 if(InfoPopup ~= nil) then
Note: See TracChangeset
for help on using the changeset viewer.