- Timestamp:
- Dec 15, 2009, 5:02:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
r6352 r6355 67 67 linesList = {} 68 68 69 lineHeight = 30 70 commandWidth = 150 69 --Calculate design parameters: 70 sampleWindow = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/SampleWindow") 71 sampleWindow:setText("SampleText") 72 73 local size = getMinTextSize(sampleWindow) 74 lineHeight = size[1] 75 76 commandWidth = 0 77 for k,v in pairs(commandList) do 78 sampleWindow:setText(nameList[k]) 79 size = getMinTextSize(sampleWindow) 80 if size[2] > commandWidth then 81 commandWidth = size[2] 82 end 83 end 84 85 sampleWindow:setText("add") 86 size = getMinTextSize(sampleWindow) 87 addWidth = size[2] 88 89 sampleWindow:setText("X") 90 size = getMinTextSize(sampleWindow) 91 clearWidth = size[2] 92 93 spaceWidth = math.floor(1/14*commandWidth) 94 71 95 buttonWidth = 145 72 clearWidth = 2073 addWidth = 3074 spaceWidth = 1075 96 76 97 P.createLines() … … 101 122 102 123 local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 124 command:setText(nameList[k]) 103 125 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0))) 104 126 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0))) 105 command:setText(nameList[k])106 127 line:addChildWindow(command) 107 128 offset = offset + commandWidth + spaceWidth … … 118 139 for i=0,(numButtons-1) do 119 140 local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i) 120 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))121 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))122 141 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i) 123 142 name = P.KeyNameNiceifier(name) 124 143 button:setText(name) 144 sampleWindow:setText(name) 145 local size = getMinTextSize(sampleWindow) 146 local buttonWidth = size[2] 147 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0))) 148 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 125 149 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked") 126 150 --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked") … … 150 174 window:addChildWindow(line) 151 175 end 176 177 pane = tolua.cast(window, "CEGUI::ScrollablePane") 178 pane:setVerticalStepSize(getScrollingStepSize(window)) 152 179 end 153 180
Note: See TracChangeset
for help on using the changeset viewer.