diff --git a/TODO b/TODO index 20d005a2..87fdf276 100644 --- a/TODO +++ b/TODO @@ -6,11 +6,11 @@ left panel with dragging windows console history console text selection console scrolling -padding scrollbar -make otui syntax more like css a real working border and background property in otui load state styles in order grid layout fix moving windows and tooltips conflicts -todo display otclient icon in window bar \ No newline at end of file +todo display otclient icon in window bar +remake otui styles states system +padding \ No newline at end of file diff --git a/modules/about/about.lua b/modules/about/about.lua index 98ce5ff0..8e6032d5 100644 --- a/modules/about/about.lua +++ b/modules/about/about.lua @@ -5,8 +5,7 @@ local about -- public functions function About.create() - about = UI.display('about.otui') - UI.root:lockChild(about) + about = UI.display('about.otui', { locked = true }) end function About.destroy() @@ -16,4 +15,4 @@ end function About.openWebpage() displayErrorBox("Error", "Not implemented yet") -end \ No newline at end of file +end diff --git a/modules/about/about.otui b/modules/about/about.otui index 4466dff9..9ca6f7a8 100644 --- a/modules/about/about.otui +++ b/modules/about/about.otui @@ -7,55 +7,55 @@ MainWindow size: 208 129 anchors.left: parent.left anchors.top: parent.top - margin.top: 32 - margin.left: 18 + margin-top: 32 + margin-left: 18 Label - align: center + text-align: center text: |- OTClient Version 0.2.0 Created by edubart anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top - margin.top: 20 + margin-top: 20 HorizontalSeparator size: 190 2 anchors.left: parent.left anchors.top: parent.top - margin.top: 83 - margin.left: 9 + margin-top: 83 + margin-left: 9 Label text: Official Website anchors.left: parent.left anchors.bottom: parent.bottom - margin.bottom: 14 - margin.left: 9 + margin-bottom: 14 + margin-left: 9 Button text: Github Page size: 88 24 anchors.right: parent.right anchors.bottom: parent.bottom - margin.bottom: 9 - margin.right: 9 + margin-bottom: 9 + margin-right: 9 @onClick: About.openWebpage() HorizontalSeparator anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - margin.bottom: 40 - margin.left: 13 - margin.right: 13 + margin-bottom: 40 + margin-left: 13 + margin-right: 13 Button text: Ok size: 46 24 anchors.left: parent.left anchors.top: parent.top - margin.top: 191 - margin.left: 188 + margin-top: 191 + margin-left: 188 @onClick: About.destroy() diff --git a/modules/background/background.otui b/modules/background/background.otui index b81d91ac..a2d9dadd 100644 --- a/modules/background/background.otui +++ b/modules/background/background.otui @@ -8,5 +8,5 @@ Panel anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - margin.top: 1 + margin-top: 1 focusable: false diff --git a/modules/chat/chat.otui b/modules/chat/chat.otui index aed58da9..1972c8aa 100644 --- a/modules/chat/chat.otui +++ b/modules/chat/chat.otui @@ -15,13 +15,13 @@ Panel anchors.left: parent.left anchors.right: parent.right anchors.bottom: chatLineEdit.top - margin.right: 6 - margin.left: 6 - margin.bottom: 2 - margin.top: 6 + margin-right: 6 + margin-left: 6 + margin-bottom: 2 + margin-top: 6 layout: type: verticalBox - align bottom: true + align-bottom: true focusable: false LineEdit @@ -29,7 +29,7 @@ Panel anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - margin.right: 6 - margin.left: 6 - margin.bottom: 6 - always focused: true \ No newline at end of file + margin-right: 6 + margin-left: 6 + margin-bottom: 6 + always-active: true \ No newline at end of file diff --git a/modules/console/console.otui b/modules/console/console.otui index 46e9b92a..de1900d8 100644 --- a/modules/console/console.otui +++ b/modules/console/console.otui @@ -15,15 +15,15 @@ RectPanel anchors.left: parent.left anchors.right: parent.right anchors.bottom: commandSymbolLabel.top - margin.left: 2 + margin-left: 2 UILabel id: commandSymbolLabel size: 20 16 - size fixed: true + fixed-size: true anchors.bottom: parent.bottom anchors.left: parent.left - margin.left: 2 + margin-left: 2 font: terminus-14px-bold text: >> @@ -33,5 +33,5 @@ RectPanel anchors.bottom: parent.bottom anchors.left: commandSymbolLabel.right anchors.right: parent.right - margin.left: 5 + margin-left: 5 font: terminus-14px-bold diff --git a/modules/core_fonts/terminus-14px-bold.otfont b/modules/core_fonts/terminus-14px-bold.otfont index 92a83003..2e1d314a 100644 --- a/modules/core_fonts/terminus-14px-bold.otfont +++ b/modules/core_fonts/terminus-14px-bold.otfont @@ -1,8 +1,8 @@ Font name: terminus-14px-bold height: 16 - top margin: 2 + y-offset: 2 texture: terminus-14px-bold.png - glyph size: 16 16 - fixed glyph width: 8 + glyph-size: 16 16 + fixed-glyph-width: 8 diff --git a/modules/core_fonts/verdana-11px-antialised.otfont b/modules/core_fonts/verdana-11px-antialised.otfont index 19d3689d..87bc065e 100644 --- a/modules/core_fonts/verdana-11px-antialised.otfont +++ b/modules/core_fonts/verdana-11px-antialised.otfont @@ -2,7 +2,7 @@ Font name: verdana-11px-antialised texture: verdana-11px-antialised.png height: 14 - glyph size: 16 16 + glyph-size: 16 16 - glyph widths: + glyph-widths: 32: 4 diff --git a/modules/core_fonts/verdana-11px-monochrome.otfont b/modules/core_fonts/verdana-11px-monochrome.otfont index fefb1c03..a9dfb31b 100644 --- a/modules/core_fonts/verdana-11px-monochrome.otfont +++ b/modules/core_fonts/verdana-11px-monochrome.otfont @@ -2,7 +2,7 @@ Font name: verdana-11px-monochrome texture: verdana-11px-monochrome.png height: 14 - glyph size: 16 16 + glyph-size: 16 16 - glyph widths: + glyph-widths: 32: 2 diff --git a/modules/core_fonts/verdana-11px-rounded.otfont b/modules/core_fonts/verdana-11px-rounded.otfont index 7ca49b5d..10ecefc2 100644 --- a/modules/core_fonts/verdana-11px-rounded.otfont +++ b/modules/core_fonts/verdana-11px-rounded.otfont @@ -2,9 +2,9 @@ Font name: verdana-11px-rounded texture: verdana-11px-rounded.png height: 14 - glyph size: 16 16 + glyph-size: 16 16 - glyph widths: + glyph-widths: 32: 4 33: 4 34: 7 diff --git a/modules/core_styles/styles/buttons.otui b/modules/core_styles/styles/buttons.otui index 099e22f6..58494080 100644 --- a/modules/core_styles/styles/buttons.otui +++ b/modules/core_styles/styles/buttons.otui @@ -54,7 +54,7 @@ TopButton < UIButton MenuButton < UIButton color: white size: 40 18 - align: center + text-align: center border-image: source: /core_styles/images/menu.png size: 64 24 diff --git a/modules/core_styles/styles/lineedits.otui b/modules/core_styles/styles/lineedits.otui index 34d6198b..01c2a492 100644 --- a/modules/core_styles/styles/lineedits.otui +++ b/modules/core_styles/styles/lineedits.otui @@ -2,7 +2,7 @@ LineEdit < UILineEdit font: verdana-11px-antialised color: #aaaaaa size: 86 20 - text margin: 3 + text-margin: 3 border-image: source: /core_styles/images/panel_flat.png border: 1 @@ -11,4 +11,4 @@ LineEdit < UILineEdit color: #aaaaaa88 PasswordLineEdit < LineEdit - text hidden: true + text-hidden: true diff --git a/modules/core_styles/styles/windows.otui b/modules/core_styles/styles/windows.otui index 9c9e1018..7168c380 100644 --- a/modules/core_styles/styles/windows.otui +++ b/modules/core_styles/styles/windows.otui @@ -4,9 +4,9 @@ Window < UIWindow opacity: 255 color: white background-color: white - head height: 20 - head text align: center - move policy: free + head-height: 20 + head-text-align: center + move-policy: free stackable: true border-image: source: /core_styles/images/window.png @@ -22,12 +22,12 @@ Window < UIWindow MiniWindow < UIWindow font: verdana-11px-antialised size: 192 200 - head height: 25 - head text align: center - margin.top: 10 - margin.left: 6 - margin.right: 6 - move policy: free updated + head-height: 25 + head-text-align: center + margin-top: 10 + margin-left: 6 + margin-right: 6 + move-policy: free updated border-image: source: /core_styles/images/mini_window.png border: 4 diff --git a/modules/entergame/characterlist.otui b/modules/entergame/characterlist.otui index 0a753305..c678ea75 100644 --- a/modules/entergame/characterlist.otui +++ b/modules/entergame/characterlist.otui @@ -4,9 +4,9 @@ CharacterListLabel < Label background-color: #00000000 offset: 2 0 focusable: true - margin.left: 1 - margin.right: 1 - margin.top: 1 + margin-left: 1 + margin-right: 1 + margin-top: 1 $focus: background-color: #ffffff22 @@ -16,17 +16,17 @@ MainWindow id: charactersWindow title: Character List size: 250 248 - onEnter: CharacterList.doLogin() - onEscape: CharacterList.destroy() + @onEnter: CharacterList.doLogin() + @onEscape: CharacterList.destroy() TextList id: characterList anchors.fill: parent anchors.bottom: next.top - margin.top: 30 - margin.bottom: 5 - margin.left: 16 - margin.right: 16 + margin-top: 30 + margin-bottom: 5 + margin-left: 16 + margin-right: 16 Label id: accountStatusLabel @@ -36,17 +36,17 @@ MainWindow anchors.left: parent.left anchors.right: parent.right anchors.bottom: separator.top - margin.left: 16 - margin.bottom: 5 + margin-left: 16 + margin-bottom: 5 HorizontalSeparator id: separator anchors.left: parent.left anchors.right: parent.right anchors.bottom: next.top - margin.left: 16 - margin.right: 16 - margin.bottom: 10 + margin-left: 16 + margin-right: 16 + margin-bottom: 10 //CheckBox // id: charAutoLoginBox @@ -55,9 +55,9 @@ MainWindow // anchors.left: parent.left // anchors.right: parent.right // anchors.bottom: next.top - // margin.bottom: 6 - // margin.left: 18 - // margin.right: 18 + // margin-bottom: 6 + // margin-left: 18 + // margin-right: 18 Button id: buttonOk @@ -65,8 +65,8 @@ MainWindow width: 64 anchors.right: next.left anchors.bottom: parent.bottom - margin.bottom: 16 - margin.right: 16 + margin-bottom: 16 + margin-right: 16 @onClick: CharacterList.doLogin() Button @@ -75,6 +75,6 @@ MainWindow width: 64 anchors.right: parent.right anchors.bottom: parent.bottom - margin.bottom: 16 - margin.right: 16 + margin-bottom: 16 + margin-right: 16 @onClick: CharacterList.destroy() \ No newline at end of file diff --git a/modules/entergame/entergame.otui b/modules/entergame/entergame.otui index 304570b3..f07f2525 100644 --- a/modules/entergame/entergame.otui +++ b/modules/entergame/entergame.otui @@ -2,39 +2,39 @@ MainWindow id: enterGame title: Enter Game size: 236 240 - onEnter: EnterGame.doLogin() - onEscape: EnterGame.hide() + @onEnter: EnterGame.doLogin() + @onEscape: EnterGame.hide() LargerLabel text: Account name anchors.left: parent.left anchors.top: parent.top - margin.left: 18 - margin.top: 28 + margin-left: 18 + margin-top: 28 LineEdit id: accountNameLineEdit anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom - margin.top: 2 - margin.left: 18 - margin.right: 18 + margin-top: 2 + margin-left: 18 + margin-right: 18 LargerLabel text: Password anchors.left: prev.left anchors.top: prev.bottom - margin.top: 8 + margin-top: 8 PasswordLineEdit id: accountPasswordLineEdit anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom - margin.top: 2 - margin.left: 18 - margin.right: 18 + margin-top: 2 + margin-left: 18 + margin-right: 18 LargerLabel id: serverLabel @@ -42,7 +42,7 @@ MainWindow text: Server anchors.left: prev.left anchors.top: prev.bottom - margin.top: 8 + margin-top: 8 LineEdit id: serverHostLineEdit @@ -50,7 +50,7 @@ MainWindow anchors.left: serverLabel.left anchors.right: serverLabel.right anchors.top: serverLabel.bottom - margin.top: 2 + margin-top: 2 LargerLabel id: portLabel @@ -58,7 +58,7 @@ MainWindow width: 50 anchors.left: serverLabel.right anchors.top: serverLabel.top - margin.left: 10 + margin-left: 10 LineEdit id: serverPortLineEdit @@ -66,7 +66,7 @@ MainWindow anchors.left: portLabel.left anchors.right: portLabel.right anchors.top: portLabel.bottom - margin.top: 2 + margin-top: 2 CheckBox id: rememberPasswordBox @@ -75,9 +75,9 @@ MainWindow anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom - margin.top: 10 - margin.left: 18 - margin.right: 18 + margin-top: 10 + margin-left: 18 + margin-right: 18 @onCheckChange: | function(self, checked) self:getParent():getChildById('autoLoginBox'):setEnabled(checked) @@ -91,17 +91,17 @@ MainWindow anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom - margin.top: 8 - margin.left: 18 - margin.right: 18 + margin-top: 8 + margin-left: 18 + margin-right: 18 Button text: Ok width: 64 anchors.right: next.left anchors.bottom: parent.bottom - margin.bottom: 16 - margin.right: 16 + margin-bottom: 16 + margin-right: 16 @onClick: EnterGame.doLogin() Button @@ -109,6 +109,6 @@ MainWindow width: 64 anchors.right: parent.right anchors.bottom: parent.bottom - margin.bottom: 16 - margin.right: 16 + margin-bottom: 16 + margin-right: 16 @onClick: EnterGame.hide() diff --git a/modules/health_mana/health_mana.otui b/modules/health_mana/health_mana.otui index 856a476e..79019d82 100644 --- a/modules/health_mana/health_mana.otui +++ b/modules/health_mana/health_mana.otui @@ -5,7 +5,7 @@ HealthBar < UIProgressBar anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - + ManaBar < UIProgressBar color: black height: 15 @@ -16,27 +16,27 @@ ManaBar < UIProgressBar HealthLabel < Label color: white - align: center + text-align: center font: verdana-11px-rounded anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - margin.top: 2 + margin-top: 2 ManaLabel < Label color: white - align: center + text-align: center font: verdana-11px-rounded anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - margin.bottom: -1 + margin-bottom: -1 UIWindow id: healthManaPanel width: 192 - margin.top: 10 - margin.left: 6 - margin.right: 6 - move policy: free updated + margin-top: 10 + margin-left: 6 + margin-right: 6 + move-policy: free updated diff --git a/modules/inventory/inventory.otui b/modules/inventory/inventory.otui index b8cf2faf..5c6c5ff1 100644 --- a/modules/inventory/inventory.otui +++ b/modules/inventory/inventory.otui @@ -1,9 +1,9 @@ UIWindow width: 192 - margin.top: 10 - margin.left: 6 - margin.right: 6 - move policy: free updated + margin-top: 10 + margin-left: 6 + margin-right: 6 + move-policy: free updated Item id: head @@ -15,82 +15,82 @@ UIWindow id: armor anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 + margin-top: 5 Item id: legs anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 + margin-top: 5 Item id: feet anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 + margin-top: 5 Item id: necklace anchors.top: parent.top anchors.right: head.left - margin.top: 10 - margin.right: 5 + margin-top: 10 + margin-right: 5 Item id: left anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 + margin-top: 5 Item id: ring anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 + margin-top: 5 Item id: backpack anchors.top: parent.top anchors.left: head.right - margin.top: 10 - margin.left: 5 + margin-top: 10 + margin-left: 5 Item id: right anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 + margin-top: 5 Item id: ammo anchors.top: prev.bottom anchors.horizontalCenter: prev.horizontalCenter - margin.top: 5 - + margin-top: 5 + Label id: soul anchors.top: ring.bottom anchors.bottom: feet.bottom anchors.left: ring.left anchors.right: ring.right - margin.top: 5 - - align: center - + margin-top: 5 + + text-align: center + border-image: source: /core_styles/images/panel_flat.png border: 1 - + Label id: capacity anchors.top: ammo.bottom anchors.bottom: feet.bottom anchors.left: ammo.left anchors.right: ammo.right - margin.top: 5 - - align: center - + margin-top: 5 + + text-align: center + border-image: source: /core_styles/images/panel_flat.png border: 1 diff --git a/modules/messagebox/messagebox.otui b/modules/messagebox/messagebox.otui index 01a6b544..4f01f876 100644 --- a/modules/messagebox/messagebox.otui +++ b/modules/messagebox/messagebox.otui @@ -8,14 +8,14 @@ Window id: messageBoxLabel anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top - margin.top: 27 - margin.bottom : 27 + margin-top: 27 + margin-bottom : 27 Button id: messageBoxRightButton anchors.bottom: parent.bottom anchors.right: parent.right - margin.right: 10 - margin.bottom: 10 + margin-right: 10 + margin-bottom: 10 width: 64 visible: true diff --git a/modules/options/options.otui b/modules/options/options.otui index 47aaa87b..abd2697d 100644 --- a/modules/options/options.otui +++ b/modules/options/options.otui @@ -10,9 +10,9 @@ MainWindow anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - margin.top: 28 - margin.left: 18 - margin.right: 18 + margin-top: 28 + margin-left: 18 + margin-right: 18 CheckBox id: fpsCheckBox @@ -20,15 +20,15 @@ MainWindow anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom - margin.top: 10 - margin.left: 18 - margin.right: 18 + margin-top: 10 + margin-left: 18 + margin-right: 18 Button text: Ok width: 64 anchors.right: parent.right anchors.bottom: parent.bottom - margin.right: 10 - margin.bottom: 10 + margin-right: 10 + margin-bottom: 10 @onClick: Options.destroy() \ No newline at end of file diff --git a/modules/outfit/outfit.otui b/modules/outfit/outfit.otui index 9a41e961..75479316 100644 --- a/modules/outfit/outfit.otui +++ b/modules/outfit/outfit.otui @@ -9,8 +9,8 @@ Window anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - onEnter: Outfit.accept() - onEscape: Outfit.destroy() + @onEnter: Outfit.accept() + @onEscape: Outfit.destroy() Label id: name @@ -18,34 +18,34 @@ Window width: 100 anchors.top: parent.top anchors.left: parent.left - margin.top: 34 - margin.left: 20 + margin-top: 34 + margin-left: 20 Creature id: creature anchors.top: name.bottom anchors.left: name.left - margin.top: 5 - + margin-top: 5 + Button id: head text: Head anchors.top: creature.top anchors.left: creature.right - margin.left: 10 - + margin-left: 10 + Button id: primary text: Primary anchors.top: prev.bottom anchors.left: prev.left - + Button id: secondary text: Secondary anchors.top: prev.bottom anchors.left: prev.left - + Button id: detail text: Detail @@ -56,7 +56,7 @@ Window @onClick: Outfit.nextType() text: >> width: 32 - margin.top: 4 + margin-top: 4 anchors.top: creature.bottom anchors.right: creature.right @@ -64,7 +64,7 @@ Window @onClick: Outfit.previousType() text: << width: 32 - margin.top: 4 + margin-top: 4 anchors.top: creature.bottom anchors.left: creature.left @@ -72,7 +72,7 @@ Window id: addon1 text: Addon 1 enabled: false - margin.top: 10 + margin-top: 10 width: 100 anchors.top: prev.bottom anchors.left: prev.left @@ -81,7 +81,7 @@ Window id: addon2 text: Addon 2 enabled: false - margin.top: 10 + margin-top: 10 width: 100 anchors.top: prev.bottom anchors.left: prev.left @@ -90,7 +90,7 @@ Window id: addon3 text: Addon 3 enabled: false - margin.top: 10 + margin-top: 10 width: 100 anchors.top: prev.bottom anchors.left: prev.left @@ -99,9 +99,9 @@ Window anchors.left: parent.left anchors.right: parent.right anchors.bottom: next.top - margin.left: 16 - margin.right: 16 - margin.bottom: 10 + margin-left: 16 + margin-right: 16 + margin-bottom: 10 Button id: buttonOk @@ -109,8 +109,8 @@ Window width: 64 anchors.right: next.left anchors.bottom: parent.bottom - margin.bottom: 16 - margin.right: 16 + margin-bottom: 16 + margin-right: 16 @onClick: Outfit.accept() Button @@ -119,6 +119,6 @@ Window width: 64 anchors.right: parent.right anchors.bottom: parent.bottom - margin.bottom: 16 - margin.right: 16 + margin-bottom: 16 + margin-right: 16 @onClick: Outfit.destroy() diff --git a/modules/skills/skills.otui b/modules/skills/skills.otui index fcbe7145..5e6ab1bb 100644 --- a/modules/skills/skills.otui +++ b/modules/skills/skills.otui @@ -2,9 +2,9 @@ SkillFirstWidget < UIWidget SkillButton < UIButton height: 14 - margin.top: 4 - margin.left: 10 - margin.right: 10 + margin-top: 4 + margin-left: 10 + margin-right: 10 SkillNameLabel < Label font: verdana-11px-monochrome @@ -14,7 +14,7 @@ SkillNameLabel < Label SkillLevelLabel < Label font: verdana-11px-monochrome - align: right + text-align: right width: 32 anchors.right: parent.right anchors.top: parent.top @@ -25,9 +25,9 @@ SkillPercentPanel < UIProgressBar background-color: green tooltip: test height: 5 - margin.top: 3 - margin.left: 10 - margin.right: 10 + margin-top: 3 + margin-left: 10 + margin-right: 10 MiniWindow id: skillWindow @@ -37,8 +37,8 @@ MiniWindow Panel id: skillPanel anchors.fill: parent - margin.top: 26 - margin.bottom: 3 - margin.left: 3 - margin.right: 3 + margin-top: 26 + margin-bottom: 3 + margin-left: 3 + margin-right: 3 layout: verticalBox diff --git a/modules/textmessage/textmessage.otui b/modules/textmessage/textmessage.otui index 0e46a408..f1281196 100644 --- a/modules/textmessage/textmessage.otui +++ b/modules/textmessage/textmessage.otui @@ -1,7 +1,7 @@ CenterLabel < Label font: verdana-11px-rounded height: 16 - align: center + text-align: center anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.right: parent.right @@ -9,8 +9,8 @@ CenterLabel < Label BottomLabel < Label font: verdana-11px-rounded height: 16 - align: center - margin.bottom: 2 + text-align: center + margin-bottom: 2 anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/modules/topmenu/topmenu.otui b/modules/topmenu/topmenu.otui index 50d444ab..729ed44a 100644 --- a/modules/topmenu/topmenu.otui +++ b/modules/topmenu/topmenu.otui @@ -9,8 +9,8 @@ TopPanel id: settingsButton anchors.top: parent.top anchors.left: parent.left - margin.top: 4 - margin.left: 6 + margin-top: 4 + margin-left: 6 tooltip: Options icon: /core_styles/icons/settings.png @onClick: Options.create() @@ -20,7 +20,7 @@ TopPanel id: enterGameButton anchors.top: prev.top anchors.left: prev.right - margin.left: 6 + margin-left: 6 tooltip: Enter game with a character icon: /core_styles/icons/login.png @onClick: | @@ -34,7 +34,7 @@ TopPanel id: motdButton anchors.top: prev.top anchors.left: prev.right - margin.left: 6 + margin-left: 6 tooltip: Message of the day icon: /core_styles/icons/motd.png visible: false @@ -43,8 +43,8 @@ TopPanel TopButton anchors.top: parent.top anchors.right: parent.right - margin.top: 4 - margin.right: 6 + margin-top: 4 + margin-right: 6 tooltip: Logout icon: /core_styles/icons/logout.png @onClick: | @@ -57,8 +57,8 @@ TopPanel TopButton anchors.top: parent.top anchors.right: prev.left - margin.top: 4 - margin.right: 6 + margin-top: 4 + margin-right: 6 tooltip: About OTClient icon: /core_styles/icons/about.png @onClick: About.create() @@ -67,5 +67,5 @@ TopPanel id: frameCounter anchors.top: parent.top anchors.right: prev.left - margin.top: 8 - margin.right: 12 \ No newline at end of file + margin-top: 8 + margin-right: 12 \ No newline at end of file diff --git a/modules/viplist/viplist.otui b/modules/viplist/viplist.otui index f08d3123..68a8e7db 100644 --- a/modules/viplist/viplist.otui +++ b/modules/viplist/viplist.otui @@ -1,6 +1,6 @@ VipListLabel < Label font: verdana-11px-monochrome - margin.left: 5 + margin-left: 5 $disabled: ~ @@ -12,7 +12,7 @@ MiniWindow id: vipList border-image: ~ anchors.fill: parent - margin.top: 26 - margin.bottom: 6 - margin.left: 6 - margin.right: 6 + margin-top: 26 + margin-bottom: 6 + margin-left: 6 + margin-right: 6 diff --git a/src/framework/graphics/font.cpp b/src/framework/graphics/font.cpp index 5a59dd8a..abe0d820 100644 --- a/src/framework/graphics/font.cpp +++ b/src/framework/graphics/font.cpp @@ -29,10 +29,10 @@ void Font::load(const OTMLNodePtr& fontNode) { std::string textureName = fontNode->valueAt("texture"); - Size glyphSize = fontNode->valueAt("glyph size"); + Size glyphSize = fontNode->valueAt("glyph-size"); m_glyphHeight = fontNode->valueAt("height"); - m_topMargin = fontNode->valueAt("top margin", 0); - m_firstGlyph = fontNode->valueAt("first glyph", 32); + m_yOffset = fontNode->valueAt("y-offset", 0); + m_firstGlyph = fontNode->valueAt("first-glyph", 32); m_glyphSpacing = fontNode->valueAt("spacing", Size(0,0)); // load font texture @@ -40,14 +40,14 @@ void Font::load(const OTMLNodePtr& fontNode) if(!m_texture) throw std::runtime_error("failed to load texture for font"); - if(OTMLNodePtr node = fontNode->get("fixed glyph width")) { + if(OTMLNodePtr node = fontNode->get("fixed-glyph-width")) { for(int glyph = m_firstGlyph; glyph < 256; ++glyph) m_glyphsSize[glyph] = Size(node->value(), m_glyphHeight); } else calculateGlyphsWidthsAutomatically(glyphSize); // read custom widths - if(OTMLNodePtr node = fontNode->get("glyph widths")) { + if(OTMLNodePtr node = fontNode->get("glyph-widths")) { for(const OTMLNodePtr& child : node->children()) m_glyphsSize[Fw::safeCast(child->tag())].setWidth(child->value()); } @@ -200,7 +200,7 @@ const std::vector& Font::calculateGlyphsPositions(const std::string& text } } - Point virtualPos(0, m_topMargin); + Point virtualPos(0, m_yOffset); lines = 0; for(i = 0; i < textLength; ++i) { glyph = (uchar)text[i]; diff --git a/src/framework/graphics/font.h b/src/framework/graphics/font.h index f9f7154c..c5e64b3a 100644 --- a/src/framework/graphics/font.h +++ b/src/framework/graphics/font.h @@ -59,7 +59,7 @@ public: const Rect* getGlyphsTextureCoords() const { return m_glyphsTextureCoords; } const Size* getGlyphsSize() const { return m_glyphsSize; } const TexturePtr& getTexture() const { return m_texture; } - int getTopMargin() const { return m_topMargin; } + int getYOffset() const { return m_yOffset; } Size getGlyphSpacing() const { return m_glyphSpacing; } private: @@ -69,7 +69,7 @@ private: std::string m_name; int m_glyphHeight; int m_firstGlyph; - int m_topMargin; + int m_yOffset; Size m_glyphSpacing; TexturePtr m_texture; Rect m_glyphsTextureCoords[256]; diff --git a/src/framework/ui/uilabel.cpp b/src/framework/ui/uilabel.cpp index 8f87dbaa..143d9a38 100644 --- a/src/framework/ui/uilabel.cpp +++ b/src/framework/ui/uilabel.cpp @@ -29,15 +29,15 @@ UILabel::UILabel() { m_focusable = false; m_phantom = true; - m_align = Fw::AlignLeft; + m_textAlign = Fw::AlignLeft; } void UILabel::render() { UIWidget::render(); Rect textRect = m_rect; - textRect.setTopLeft(textRect.topLeft() + m_offset); - m_font->renderText(m_text, textRect, m_align, m_foregroundColor); + textRect.setTopLeft(textRect.topLeft() + m_textOffset); + m_font->renderText(m_text, textRect, m_textAlign, m_foregroundColor); } void UILabel::setText(const std::string& text) @@ -66,10 +66,10 @@ void UILabel::onStyleApply(const OTMLNodePtr& styleNode) for(const OTMLNodePtr& node : styleNode->children()) { if(node->tag() == "text") setText(node->value()); - else if(node->tag() == "align") - setAlign(Fw::translateAlignment(node->value())); - else if(node->tag() == "offset") { - setOffset(node->value()); + else if(node->tag() == "text-align") + setTextAlign(Fw::translateAlignment(node->value())); + else if(node->tag() == "text-offset") { + setTextOffset(node->value()); } } } diff --git a/src/framework/ui/uilabel.h b/src/framework/ui/uilabel.h index f76fce5b..8176cbb3 100644 --- a/src/framework/ui/uilabel.h +++ b/src/framework/ui/uilabel.h @@ -34,20 +34,20 @@ public: void resizeToText(); void setText(const std::string& text); - void setAlign(Fw::AlignmentFlag align) { m_align = align; } - void setOffset(const Point& offset) { m_offset = offset; } + void setTextAlign(Fw::AlignmentFlag align) { m_textAlign = align; } + void setTextOffset(const Point& offset) { m_textOffset = offset; } std::string getText() const { return m_text; } - Fw::AlignmentFlag getAlign() const { return m_align; } - Point getOffset() const { return m_offset; } + Fw::AlignmentFlag getTextAlign() const { return m_textAlign; } + Point getTextOffset() const { return m_textOffset; } protected: virtual void onStyleApply(const OTMLNodePtr& styleNode); private: std::string m_text; - Point m_offset; - Fw::AlignmentFlag m_align; + Point m_textOffset; + Fw::AlignmentFlag m_textAlign; }; #endif diff --git a/src/framework/ui/uilineedit.cpp b/src/framework/ui/uilineedit.cpp index 7797272d..62b71372 100644 --- a/src/framework/ui/uilineedit.cpp +++ b/src/framework/ui/uilineedit.cpp @@ -33,7 +33,7 @@ UILineEdit::UILineEdit() m_startRenderPos = 0; m_textHorizontalMargin = 0; m_textHidden = false; - m_alwaysFocused = false; + m_alwaysActive = false; blinkCursor(); } @@ -51,7 +51,7 @@ void UILineEdit::render() g_graphics.drawTexturedRect(m_glyphsCoords[i], texture, m_glyphsTexCoords[i]); // render cursor - if(isExplicitlyEnabled() && (isActive() || m_alwaysFocused) && m_cursorPos >= 0) { + if(isExplicitlyEnabled() && (isActive() || m_alwaysActive) && m_cursorPos >= 0) { assert(m_cursorPos <= textLength); // draw every 333ms const int delay = 333; @@ -98,7 +98,7 @@ void UILineEdit::update() if(m_cursorPos < m_startRenderPos) // cursor is before the previuos first rendered glyph, so we need to update { m_startInternalPos.x = glyphsPositions[m_cursorPos].x; - m_startInternalPos.y = glyphsPositions[m_cursorPos].y - m_font->getTopMargin(); + m_startInternalPos.y = glyphsPositions[m_cursorPos].y - m_font->getYOffset(); m_startRenderPos = m_cursorPos; } else if(m_cursorPos > m_startRenderPos || // cursor is after the previuos first rendered glyph (m_cursorPos == m_startRenderPos && textLength == m_cursorPos)) // cursor is at the previuos rendered element, and is the last text element @@ -119,13 +119,13 @@ void UILineEdit::update() for(pos = 0; pos < textLength; ++pos) { glyph = (uchar)text[pos]; glyphRect = Rect(glyphsPositions[pos], glyphsSize[glyph]); - glyphRect.setTop(std::max(glyphRect.top() - m_font->getTopMargin() - m_font->getGlyphSpacing().height(), 0)); + glyphRect.setTop(std::max(glyphRect.top() - m_font->getYOffset() - m_font->getGlyphSpacing().height(), 0)); glyphRect.setLeft(std::max(glyphRect.left() - m_font->getGlyphSpacing().width(), 0)); // first glyph entirely visible found if(glyphRect.topLeft() >= startGlyphPos) { m_startInternalPos.x = glyphsPositions[pos].x; - m_startInternalPos.y = glyphsPositions[pos].y - m_font->getTopMargin(); + m_startInternalPos.y = glyphsPositions[pos].y - m_font->getYOffset(); m_startRenderPos = pos; break; } @@ -351,7 +351,7 @@ int UILineEdit::getTextPos(Point pos) int candidatePos = -1; for(int i=0;igetTopMargin() + m_font->getGlyphSpacing().height()); + clickGlyphRect.addTop(m_font->getYOffset() + m_font->getGlyphSpacing().height()); clickGlyphRect.addLeft(m_font->getGlyphSpacing().width()+1); if(clickGlyphRect.contains(pos)) return i; @@ -381,12 +381,12 @@ void UILineEdit::onStyleApply(const OTMLNodePtr& styleNode) if(node->tag() == "text") { setText(node->value()); setCursorPos(m_text.length()); - } else if(node->tag() == "text hidden") { + } else if(node->tag() == "text-hidden") { setTextHidden(node->value()); - } else if(node->tag() == "text margin") { + } else if(node->tag() == "text-margin") { m_textHorizontalMargin = node->value(); - } else if(node->tag() == "always focused") { - m_alwaysFocused = true; + } else if(node->tag() == "always-active") { + m_alwaysActive = true; } } } @@ -398,7 +398,7 @@ void UILineEdit::onGeometryUpdate(const Rect& oldRect, const Rect& newRect) void UILineEdit::onFocusChange(bool focused, Fw::FocusReason reason) { - if(focused && !m_alwaysFocused) { + if(focused && !m_alwaysActive) { if(reason == Fw::TabFocusReason) setCursorPos(m_text.length()); else @@ -423,7 +423,7 @@ bool UILineEdit::onKeyPress(uchar keyCode, char keyChar, int keyboardModifiers) else if(keyCode == Fw::KeyV && keyboardModifiers == Fw::KeyboardCtrlModifier) appendText(g_platform.getClipboardText()); else if(keyCode == Fw::KeyTab) { - if(!m_alwaysFocused) { + if(!m_alwaysActive) { if(UIWidgetPtr parent = getParent()) parent->focusNextChild(Fw::TabFocusReason); } diff --git a/src/framework/ui/uilineedit.h b/src/framework/ui/uilineedit.h index 12a33ffd..ef8a401c 100644 --- a/src/framework/ui/uilineedit.h +++ b/src/framework/ui/uilineedit.h @@ -71,7 +71,7 @@ private: int m_cursorTicks; int m_textHorizontalMargin; bool m_textHidden; - bool m_alwaysFocused; + bool m_alwaysActive; std::vector m_glyphsCoords; std::vector m_glyphsTexCoords; diff --git a/src/framework/ui/uiverticallayout.cpp b/src/framework/ui/uiverticallayout.cpp index 717655a4..a3680fd7 100644 --- a/src/framework/ui/uiverticallayout.cpp +++ b/src/framework/ui/uiverticallayout.cpp @@ -36,7 +36,7 @@ void UIVerticalLayout::applyStyle(const OTMLNodePtr& styleNode) UILayout::applyStyle(styleNode); for(const OTMLNodePtr& node : styleNode->children()) { - if(node->tag() == "align bottom") + if(node->tag() == "align-bottom") m_alignBottom = node->value(); else if(node->tag() == "padding") m_padding = node->value(); diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index 97c05fa1..165bb3cf 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -40,7 +40,7 @@ UIWidget::UIWidget() m_states = Fw::DefaultState; m_font = g_fonts.getDefaultFont(); m_opacity = 255; - m_marginTop = m_marginBottom = m_marginLeft = m_marginRight = 0; + m_marginTop = m_marginRight = m_marginBottom = m_marginLeft = 0; // generate an unique id, this is need because anchored layouts find widgets by id static unsigned long id = 1; @@ -817,7 +817,7 @@ void UIWidget::onStyleApply(const OTMLNodePtr& styleNode) setWidth(node->value()); else if(node->tag() == "height") setHeight(node->value()); - else if(node->tag() == "size fixed") + else if(node->tag() == "fixed-size") setSizeFixed(node->value()); else if(node->tag() == "position") moveTo(node->value()); @@ -825,14 +825,46 @@ void UIWidget::onStyleApply(const OTMLNodePtr& styleNode) setX(node->value()); else if(node->tag() == "y") setY(node->value()); - else if(node->tag() == "margin.left") - setMarginLeft(node->value()); - else if(node->tag() == "margin.right") - setMarginRight(node->value()); - else if(node->tag() == "margin.top") + else if(node->tag() == "margin-top") setMarginTop(node->value()); - else if(node->tag() == "margin.bottom") + else if(node->tag() == "margin-right") + setMarginRight(node->value()); + else if(node->tag() == "margin-bottom") setMarginBottom(node->value()); + else if(node->tag() == "margin-left") + setMarginLeft(node->value()); + else if(node->tag() == "margin") { + std::string marginDesc = node->value(); + std::vector split; + boost::split(split, marginDesc, boost::is_any_of(std::string(" "))); + if(split.size() == 4) { + setMarginTop(Fw::safeCast(split[0])); + setMarginRight(Fw::safeCast(split[1])); + setMarginBottom(Fw::safeCast(split[2])); + setMarginLeft(Fw::safeCast(split[3])); + } else if(split.size() == 3) { + int marginTop = Fw::safeCast(split[0]); + int marginHorizontal = Fw::safeCast(split[1]); + int marginBottom = Fw::safeCast(split[2]); + setMarginTop(marginTop); + setMarginRight(marginHorizontal); + setMarginBottom(marginBottom); + setMarginLeft(marginHorizontal); + } else if(split.size() == 2) { + int marginVertical = Fw::safeCast(split[0]); + int marginHorizontal = Fw::safeCast(split[1]); + setMarginTop(marginVertical); + setMarginRight(marginHorizontal); + setMarginBottom(marginVertical); + setMarginLeft(marginHorizontal); + } else if(split.size() == 1) { + int margin = Fw::safeCast(split[0]); + setMarginTop(margin); + setMarginRight(margin); + setMarginBottom(margin); + setMarginLeft(margin); + } + } // layouts else if(node->tag() == "layout") { // layout is set only once diff --git a/src/framework/ui/uiwidget.h b/src/framework/ui/uiwidget.h index 5be383e5..d7fa153b 100644 --- a/src/framework/ui/uiwidget.h +++ b/src/framework/ui/uiwidget.h @@ -62,10 +62,10 @@ public: void setOpacity(int opacity) { m_opacity = opacity; } void setBackgroundColor(const Color& color) { m_backgroundColor = color; } void setForegroundColor(const Color& color) { m_foregroundColor = color; } - void setMarginLeft(int margin) { m_marginLeft = margin; updateParentLayout(); } - void setMarginRight(int margin) { m_marginRight = margin; updateParentLayout(); } void setMarginTop(int margin) { m_marginTop = margin; updateParentLayout(); } + void setMarginRight(int margin) { m_marginRight = margin; updateParentLayout(); } void setMarginBottom(int margin) { m_marginBottom = margin; updateParentLayout(); } + void setMarginLeft(int margin) { m_marginLeft = margin; updateParentLayout(); } void setSizeFixed(bool fixed) { m_fixedSize = fixed; updateParentLayout(); } void setLastFocusReason(Fw::FocusReason reason) { m_lastFocusReason = reason; } @@ -112,10 +112,10 @@ public: Color getForegroundColor() { return m_foregroundColor; } Color getBackgroundColor() { return m_backgroundColor; } int getOpacity() { return m_opacity; } - int getMarginLeft() { return m_marginLeft; } - int getMarginRight() { return m_marginRight; } int getMarginTop() { return m_marginTop; } + int getMarginRight() { return m_marginRight; } int getMarginBottom() { return m_marginBottom; } + int getMarginLeft() { return m_marginLeft; } Fw::FocusReason getLastFocusReason() { return m_lastFocusReason; } OTMLNodePtr getStyle() { return m_style; } @@ -205,10 +205,10 @@ protected: Color m_foregroundColor; int m_states; int m_opacity; - int m_marginLeft; - int m_marginRight; int m_marginTop; + int m_marginRight; int m_marginBottom; + int m_marginLeft; }; #endif diff --git a/src/framework/ui/uiwindow.cpp b/src/framework/ui/uiwindow.cpp index f184f40b..f1adb97d 100644 --- a/src/framework/ui/uiwindow.cpp +++ b/src/framework/ui/uiwindow.cpp @@ -41,19 +41,17 @@ void UIWindow::render() // render children UIWidget::render(); - // draw window head - // draw window head text Rect headTextRect = m_rect; - headTextRect.addTop(-m_headOffset.y); + headTextRect.addTop(-m_headTextOffset.y); headTextRect.setHeight(m_headHeight); if(m_titleAlign & Fw::AlignLeft) - headTextRect.addLeft(-m_headOffset.x); + headTextRect.addLeft(-m_headTextOffset.x); else if(m_titleAlign & Fw::AlignRight) - headTextRect.addRight(-m_headOffset.x); + headTextRect.addRight(-m_headTextOffset.x); else { - headTextRect.addLeft(-m_headOffset.x); - headTextRect.addRight(-m_headOffset.x); + headTextRect.addLeft(-m_headTextOffset.x); + headTextRect.addRight(-m_headTextOffset.x); } m_font->renderText(m_title, headTextRect, m_titleAlign, m_foregroundColor); } @@ -63,15 +61,15 @@ void UIWindow::onStyleApply(const OTMLNodePtr& styleNode) UIWidget::onStyleApply(styleNode); for(OTMLNodePtr node : styleNode->children()) { - if(node->tag() == "head height") + if(node->tag() == "head-height") m_headHeight = node->value(); - else if(node->tag() == "head offset") - m_headOffset = node->value(); + else if(node->tag() == "head-text-offset") + m_headTextOffset = node->value(); else if(node->tag() == "title") setTitle(node->value()); - else if(node->tag() == "head text align") + else if(node->tag() == "head-text-align") m_titleAlign = Fw::translateAlignment(node->value()); - else if(node->tag() == "move policy") { + else if(node->tag() == "move-policy") { if(node->value() == "free") m_movePolicy = FREE_MOVE; else if(node->value() == "free updated") @@ -79,14 +77,6 @@ void UIWindow::onStyleApply(const OTMLNodePtr& styleNode) else m_movePolicy = DONT_MOVE; } - else if(node->tag() == "onEnter") { - g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]"); - luaSetField(node->tag()); - } - else if(node->tag() == "onEscape") { - g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]"); - luaSetField(node->tag()); - } } } diff --git a/src/framework/ui/uiwindow.h b/src/framework/ui/uiwindow.h index 72c7bafd..a6f48651 100644 --- a/src/framework/ui/uiwindow.h +++ b/src/framework/ui/uiwindow.h @@ -53,7 +53,7 @@ private: bool m_moving; MovePolicy m_movePolicy; Fw::AlignmentFlag m_titleAlign; - Point m_headOffset; + Point m_headTextOffset; Point m_movingReference; Point m_oldPos; int m_oldIndex;