Hotkeys order, minimap mark windw changes

This commit is contained in:
Henrique Santiago 2013-01-24 20:57:51 -02:00
parent d5b4e0929f
commit 42b05df717
4 changed files with 67 additions and 35 deletions

View File

@ -50,3 +50,20 @@ function string:explode(sep, limit)
return t
end
function string:operatorLess(other)
local selfLower = self:lower()
local otherLower = other:lower()
local selfLen = self:len()
local otherLen = other:len()
local minLen = math.min(selfLen, otherLen)
for i=1,minLen do
local selfByteI = string.byte(selfLower, i)
local otherByteI = string.byte(otherLower, i)
if selfByteI < otherByteI then
return true
elseif selfByteI > otherByteI then
return false
end
end
return selfLen < otherLen
end

View File

@ -252,10 +252,28 @@ end
function addKeyCombo(messageBox, keyCombo, keySettings)
local label = nil
if currentHotkeysList:getChildById(keyCombo) == nil then
local label = g_ui.createWidget('HotkeyListLabel', currentHotkeysList)
local label = g_ui.createWidget('HotkeyListLabel')
local children = currentHotkeysList:getChildren()
if #children == 0 then
currentHotkeysList:addChild(label)
else
local add = false
for i=1,#children do
if keyCombo:operatorLess(children[i]:getId()) then
currentHotkeysList:insertChild(i, label)
add = true
break
end
end
if not add then
currentHotkeysList:addChild(label)
end
end
label:setId(keyCombo)
label:setColor(HotkeyColors.text)
label:setText(keyCombo..': ')
label:setText(keyCombo .. ': ')
if keySettings then
hotkeyLabelSelectedOnList = label
label.keyCombo = keyCombo

View File

@ -26,7 +26,7 @@ FlagButton < CheckBox
FlagWindow < MainWindow
id: flagWindow
!text: tr('Create Map Mark')
size: 196 170
size: 196 185
Label
id: position
@ -110,7 +110,6 @@ FlagWindow < MainWindow
anchors.left: prev.right
anchors.top: prev.top
FlagButton
id: flag11
icon-clip: 0 11 11 11
@ -176,15 +175,14 @@ FlagWindow < MainWindow
Button
id: okButton
!text: tr('Ok')
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 10
width: 60
width: 64
anchors.right: next.left
anchors.bottom: parent.bottom
margin-right: 10
Button
id: cancelButton
!text: tr('Cancel')
anchors.top: prev.top
anchors.left: prev.right
margin-left: 15
width: 60
width: 64
anchors.right: parent.right
anchors.bottom: parent.bottom

View File

@ -104,4 +104,3 @@ MiniWindow
anchors.top: parent.top
margin: 4
@onClick: center()