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 return t
end 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) function addKeyCombo(messageBox, keyCombo, keySettings)
local label = nil local label = nil
if currentHotkeysList:getChildById(keyCombo) == nil then 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:setId(keyCombo)
label:setColor(HotkeyColors.text) label:setColor(HotkeyColors.text)
label:setText(keyCombo..': ') label:setText(keyCombo .. ': ')
if keySettings then if keySettings then
hotkeyLabelSelectedOnList = label hotkeyLabelSelectedOnList = label
label.keyCombo = keyCombo label.keyCombo = keyCombo

View File

@ -26,7 +26,7 @@ FlagButton < CheckBox
FlagWindow < MainWindow FlagWindow < MainWindow
id: flagWindow id: flagWindow
!text: tr('Create Map Mark') !text: tr('Create Map Mark')
size: 196 170 size: 196 185
Label Label
id: position id: position
@ -48,69 +48,68 @@ FlagWindow < MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
width: 158 width: 158
FlagButton FlagButton
id: flag1 id: flag1
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6
margin-left: 0 margin-left: 0
FlagButton FlagButton
id: flag2 id: flag2
icon-clip: 11 0 11 11 icon-clip: 11 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag3 id: flag3
icon-clip: 22 0 11 11 icon-clip: 22 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag4 id: flag4
icon-clip: 33 0 11 11 icon-clip: 33 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag5 id: flag5
icon-clip: 44 0 11 11 icon-clip: 44 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag6 id: flag6
icon-clip: 55 0 11 11 icon-clip: 55 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag7 id: flag7
icon-clip: 66 0 11 11 icon-clip: 66 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag8 id: flag8
icon-clip: 77 0 11 11 icon-clip: 77 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag9 id: flag9
icon-clip: 88 0 11 11 icon-clip: 88 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag10 id: flag10
icon-clip: 99 0 11 11 icon-clip: 99 0 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag11 id: flag11
icon-clip: 0 11 11 11 icon-clip: 0 11 11 11
@ -118,73 +117,72 @@ FlagWindow < MainWindow
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6
margin-left: 0 margin-left: 0
FlagButton FlagButton
id: flag12 id: flag12
icon-clip: 11 11 11 11 icon-clip: 11 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag13 id: flag13
icon-clip: 22 11 11 11 icon-clip: 22 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag14 id: flag14
icon-clip: 33 11 11 11 icon-clip: 33 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag15 id: flag15
icon-clip: 44 11 11 11 icon-clip: 44 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag16 id: flag16
icon-clip: 55 11 11 11 icon-clip: 55 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag17 id: flag17
icon-clip: 66 11 11 11 icon-clip: 66 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag18 id: flag18
icon-clip: 77 11 11 11 icon-clip: 77 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag19 id: flag19
icon-clip: 88 11 11 11 icon-clip: 88 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
FlagButton FlagButton
id: flag20 id: flag20
icon-clip: 99 11 11 11 icon-clip: 99 11 11 11
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
Button Button
id: okButton id: okButton
!text: tr('Ok') !text: tr('Ok')
anchors.top: prev.bottom width: 64
anchors.left: parent.left anchors.right: next.left
margin-top: 10 anchors.bottom: parent.bottom
width: 60 margin-right: 10
Button Button
id: cancelButton id: cancelButton
!text: tr('Cancel') !text: tr('Cancel')
anchors.top: prev.top width: 64
anchors.left: prev.right anchors.right: parent.right
margin-left: 15 anchors.bottom: parent.bottom
width: 60

View File

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