Index: code/branches/presentation2/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/GUITools.lua	(revision 6354)
+++ code/branches/presentation2/data/gui/scripts/GUITools.lua	(revision 6355)
@@ -11,2 +11,21 @@
     InfoPopup.setCloseButton(closeButton)
 end
+
+function getMinTextSize(window)
+    local size = {}
+    
+    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
+    local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
+    local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
+    
+    table.insert(size, height)
+    table.insert(size, width)
+    return size
+end
+
+function getScrollingStepSize(window)
+    local height = window:getUnclippedPixelRect():getHeight()
+    local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight()
+    local ratio = height/maxHeight
+    return 0.008*ratio/0.3204
+end
Index: code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua	(revision 6354)
+++ code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua	(revision 6355)
@@ -67,10 +67,31 @@
     linesList = {}
 
-    lineHeight = 30
-    commandWidth = 150
+    --Calculate design parameters:
+    sampleWindow = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/SampleWindow")
+    sampleWindow:setText("SampleText")
+    
+    local size = getMinTextSize(sampleWindow)
+    lineHeight = size[1]
+    
+    commandWidth = 0
+    for k,v in pairs(commandList) do
+        sampleWindow:setText(nameList[k])
+        size = getMinTextSize(sampleWindow)
+        if size[2] > commandWidth then
+            commandWidth = size[2]
+        end
+    end
+
+    sampleWindow:setText("add")
+    size = getMinTextSize(sampleWindow)
+    addWidth = size[2]
+    
+    sampleWindow:setText("X")
+    size = getMinTextSize(sampleWindow)
+    clearWidth = size[2]
+
+    spaceWidth = math.floor(1/14*commandWidth)
+    
     buttonWidth = 145
-    clearWidth = 20
-    addWidth = 30
-    spaceWidth = 10
 
     P.createLines()
@@ -101,7 +122,7 @@
 
     local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
+    command:setText(nameList[k])
     command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))
     command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
-    command:setText(nameList[k])
     line:addChildWindow(command)
     offset = offset + commandWidth + spaceWidth
@@ -118,9 +139,12 @@
     for i=0,(numButtons-1) do
         local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)
-        button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
-        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
         local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)
         name = P.KeyNameNiceifier(name)
         button:setText(name)
+        sampleWindow:setText(name)
+        local size = getMinTextSize(sampleWindow)
+        local buttonWidth = size[2]
+        button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
+        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
         orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
         --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
@@ -150,4 +174,7 @@
         window:addChildWindow(line)
     end
+    
+    pane = tolua.cast(window, "CEGUI::ScrollablePane")
+    pane:setVerticalStepSize(getScrollingStepSize(window))
 end
 
