diff --git a/frontend/ui/data/keyboardlayouts/el_keyboard.lua b/frontend/ui/data/keyboardlayouts/el_keyboard.lua index b6dae8068..2a128bf7a 100644 --- a/frontend/ui/data/keyboardlayouts/el_keyboard.lua +++ b/frontend/ui/data/keyboardlayouts/el_keyboard.lua @@ -40,8 +40,8 @@ return { { "C", "c", "&", "¥", "Ψ", "ψ", "Џ", "џ", "Í", "í", "Þ", "þ", }, { "V", "v", ":", "£", "Ω", "ω", "Ώ", "ώ", "Ñ", "ñ", "Ý", "ý", }, { "B", "b", "π", "‚", "Β", "β", "Ћ", "ћ", "Ó", "ó", "†", "‡", }, - { "N", "n", "е", "‘", "Ν", "ν", "Њ", "њ", "Ú", "ú", "–", "—", }, - { "M", "m", "~", "’", "Μ", "μ", "Ї", "ї", "Ç", "ç", "…", "¨", }, + { "N", "n", "е", "↑", "Ν", "ν", "Њ", "њ", "Ú", "ú", "–", "—", }, + { "M", "m", "~", "↓", "Μ", "μ", "Ї", "ї", "Ç", "ç", "…", "¨", }, { label = "Backspace", icon = "resources/icons/appbar.clear.reflect.horizontal.png", width = 1.5 @@ -57,8 +57,9 @@ return { { "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", }, { label = "space", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", - width = 4.0}, - { ",", ".", ".", ",", ",", ".", "Є", "є", ",", ".", ",", ".", }, + width = 3.0}, + { ",", ",", "‘", "←", ",", ",", "є", "є", ",", ",", ",", ",", }, + { ",", ".", "’", "→", ",", ".", "Є", "Є", ",", ".", ",", ".", }, { label = "Enter", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", icon = "resources/icons/appbar.arrow.enter.png", @@ -67,5 +68,3 @@ return { }, }, } - - diff --git a/frontend/ui/data/keyboardlayouts/fr_keyboard.lua b/frontend/ui/data/keyboardlayouts/fr_keyboard.lua index 006b65c3d..fee4c17e9 100644 --- a/frontend/ui/data/keyboardlayouts/fr_keyboard.lua +++ b/frontend/ui/data/keyboardlayouts/fr_keyboard.lua @@ -40,8 +40,8 @@ return { { "C", "c", "£", "9", "С", "с", "'", "9", "Í", "í", "Þ", "þ", }, { "V", "v", "<", "‚", "М", "м", "Ө", "ө", "Ñ", "ñ", "Ý", "ý", }, { "B", "b", ">", ".", "И", "и", "Һ", "һ", "Ó", "ó", "†", "‡", }, - { "N", "n", "‘", "“", "Т", "т", "Б", "б", "Ú", "ú", "–", "—", }, - { "M", "m", "’", "”", "Ь", "ь", "Ю", "ю", "Ç", "ç", "…", "¨", }, + { "N", "n", "‘", "↑", "Т", "т", "Б", "б", "Ú", "ú", "–", "—", }, + { "M", "m", "’", "↓", "Ь", "ь", "Ю", "ю", "Ç", "ç", "…", "¨", }, { label = "Backspace", icon = "resources/icons/appbar.clear.reflect.horizontal.png", width = 1.5 @@ -57,8 +57,9 @@ return { { "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", }, { label = "space", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", - width = 4.0}, - { ",", ".", ".", ",", ",", ".", "Ё", "ё", ",", ".", ",", ".", }, + width = 3.0}, + { ",", ",", "“", "←", ",", ",", "Ё", "Ё", ",", ",", ",", ",", }, + { ",", ".", "”", "→", ",", ".", "ё", "ё", ",", ".", ",", ".", }, { label = "Enter", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", icon = "resources/icons/appbar.arrow.enter.png", diff --git a/frontend/ui/data/keyboardlayouts/pl_keyboard.lua b/frontend/ui/data/keyboardlayouts/pl_keyboard.lua index 3bf665b23..310709f05 100644 --- a/frontend/ui/data/keyboardlayouts/pl_keyboard.lua +++ b/frontend/ui/data/keyboardlayouts/pl_keyboard.lua @@ -40,8 +40,8 @@ return { { "C", "c", "£", "9", "Ć", "ć", "£", "9", "Í", "í", "Þ", "þ", }, { "V", "v", "<", "‚", "V", "v", "<", ",", "Ñ", "ñ", "Ý", "ý", }, { "B", "b", ">", ".", "B", "b", ">", ".", "Ó", "ó", "†", "‡", }, - { "N", "n", "‘", "“", "Ń", "ń", "‘", "“", "Ú", "ú", "–", "—", }, - { "M", "m", "’", "”", "M", "m", "’", "”", "Ç", "ç", "…", "¨", }, + { "N", "n", "‘", "↑", "Ń", "ń", "‘", "“", "Ú", "ú", "–", "—", }, + { "M", "m", "’", "↓", "M", "m", "’", "”", "Ç", "ç", "…", "¨", }, { label = "Backspace", icon = "resources/icons/appbar.clear.reflect.horizontal.png", width = 1.5 @@ -57,8 +57,9 @@ return { { "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", }, { label = "space", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", - width = 4.0}, - { ",", ".", ".", ",", ",", ".", ".PL", ".pl", ",", ".", ",", ".", }, + width = 3.0}, + { ",", ",", "“", "←", ",", ",", ".pl", ".pl", ",", ",", ",", ",", }, + { ",", ".", "”", "→", ",", ".", ".PL", ".PL", ",", ".", ",", ".", }, { label = "Enter", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", icon = "resources/icons/appbar.arrow.enter.png", diff --git a/frontend/ui/data/keyboardlayouts/pt_keyboard.lua b/frontend/ui/data/keyboardlayouts/pt_keyboard.lua index e6567e6a4..69d6c5f32 100644 --- a/frontend/ui/data/keyboardlayouts/pt_keyboard.lua +++ b/frontend/ui/data/keyboardlayouts/pt_keyboard.lua @@ -40,8 +40,8 @@ return { { "C", "c", "£", "9", "Ç", "ç", "£", "9", "Í", "í", "Þ", "þ", }, { "V", "v", "<", "‚", "V", "v", "<", ",", "Ñ", "ñ", "Ý", "ý", }, { "B", "b", ">", ".", "B", "b", ">", ".", "Ó", "ó", "†", "‡", }, - { "N", "n", "‘", "“", "N", "n", "‘", "“", "Ú", "ú", "–", "—", }, - { "M", "m", "’", "”", "M", "m", "’", "”", "Ç", "ç", "…", "¨", }, + { "N", "n", "‘", "↑", "N", "n", "‘", "“", "Ú", "ú", "–", "—", }, + { "M", "m", "’", "↓", "M", "m", "’", "”", "Ç", "ç", "…", "¨", }, { label = "Backspace", icon = "resources/icons/appbar.clear.reflect.horizontal.png", width = 1.5 @@ -57,8 +57,9 @@ return { { "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", }, { label = "space", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", - width = 4.0}, - { ",", ".", ".", ",", ",", ".", ".PL", ".pl", ",", ".", ",", ".", }, + width = 3.0}, + { ",", ",", "“", "←", ",", ",", "Ё", "Ё", ",", ",", ",", ",", }, + { ",", ".", "”", "→", ",", ".", "ё", "ё", ",", ".", ",", ".", }, { label = "Enter", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", icon = "resources/icons/appbar.arrow.enter.png", diff --git a/frontend/ui/data/keyboardlayouts/std.lua b/frontend/ui/data/keyboardlayouts/std.lua index ff2bf1ae1..36bc42169 100644 --- a/frontend/ui/data/keyboardlayouts/std.lua +++ b/frontend/ui/data/keyboardlayouts/std.lua @@ -40,8 +40,8 @@ return { { "C", "c", "£", "9", "С", "с", "'", "9", "Í", "í", "Þ", "þ", }, { "V", "v", "<", "‚", "М", "м", "Ө", "ө", "Ñ", "ñ", "Ý", "ý", }, { "B", "b", ">", ".", "И", "и", "Һ", "һ", "Ó", "ó", "†", "‡", }, - { "N", "n", "‘", "“", "Т", "т", "Б", "б", "Ú", "ú", "–", "—", }, - { "M", "m", "’", "”", "Ь", "ь", "Ю", "ю", "Ç", "ç", "…", "¨", }, + { "N", "n", "‘", "↑", "Т", "т", "Б", "б", "Ú", "ú", "–", "—", }, + { "M", "m", "’", "↓", "Ь", "ь", "Ю", "ю", "Ç", "ç", "…", "¨", }, { label = "Backspace", icon = "resources/icons/appbar.clear.reflect.horizontal.png", width = 1.5 @@ -57,8 +57,9 @@ return { { "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", }, { label = "space", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", - width = 4.0}, - { ",", ".", ".", ",", ",", ".", "Ё", "ё", ",", ".", ",", ".", }, + width = 3.0}, + { ",", ",", "“", "←", ",", ",", "Ё", "Ё", ",", ",", ",", ",", }, + { ".", ".", "”", "→", ".", ".", "ё", "ё", ".", ".", ".", ".", }, { label = "Enter", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", icon = "resources/icons/appbar.arrow.enter.png", diff --git a/frontend/ui/data/keyboardlayouts/yazhert.lua b/frontend/ui/data/keyboardlayouts/yazhert.lua index cd80079a8..777dadd9d 100644 --- a/frontend/ui/data/keyboardlayouts/yazhert.lua +++ b/frontend/ui/data/keyboardlayouts/yazhert.lua @@ -39,9 +39,9 @@ return { { "X", "x", "€", ")", "Х", "х", "№", "@", "É", "é", "Ø", "ø", }, { "C", "c", "¥", "{", "Ц", "ц", "Џ", "џ", "Í", "í", "Þ", "þ", }, { "V", "v", "£", "}", "В", "в", "Ў", "ў", "Ñ", "ñ", "Ý", "ý", }, - { "B", "b", "‚", "[", "Б", "б", "Ћ", "ћ", "Ó", "ó", "†", "‡", }, - { "N", "n", "‘", "]", "Н", "н", "Њ", "њ", "Ú", "ú", "–", "—", }, - { "M", "m", "’", "&", "М", "м", "Ї", "ї", "Ç", "ç", "…", "¨", }, + { "B", "b", "‚", "&", "Б", "б", "Ћ", "ћ", "Ó", "ó", "†", "‡", }, + { "N", "n", "‘", "↑", "Н", "н", "Њ", "њ", "Ú", "ú", "–", "—", }, + { "M", "m", "’", "↓", "М", "м", "Ї", "ї", "Ç", "ç", "…", "¨", }, { label = "Backspace", icon = "resources/icons/appbar.clear.reflect.horizontal.png", width = 1.5 @@ -57,8 +57,9 @@ return { { "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", }, { label = "space", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", - width = 4.0}, - { ",", ".", ",", ".", ",", ".", "Є", "є", ",", ".", ",", ".", }, + width = 3.0}, + { ",", ",", "[", "←", ",", ",", "є", "є", ",", ",", ",", ",", }, + { ",", ".", "]", "→", ",", ".", "Є", "Є", ",", ".", ",", ".", }, { label = "Enter", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", icon = "resources/icons/appbar.arrow.enter.png", diff --git a/frontend/ui/widget/inputtext.lua b/frontend/ui/widget/inputtext.lua index 1d2b75a5e..0a92cf2bc 100644 --- a/frontend/ui/widget/inputtext.lua +++ b/frontend/ui/widget/inputtext.lua @@ -239,6 +239,30 @@ function InputText:delChar() self:initTextBox(table.concat(self.charlist)) end +function InputText:leftChar() + if self.charpos == 1 then return end + self.charpos = self.charpos -1 + self:initTextBox(table.concat(self.charlist)) +end + +function InputText:rightChar() + if self.charpos > #table.concat(self.charlist) then return end + self.charpos = self.charpos +1 + self:initTextBox(table.concat(self.charlist)) +end + +function InputText:upLine() + if self.text_widget.moveCursorUp then + self.text_widget:moveCursorUp() + end +end + +function InputText:downLine() + if self.text_widget.moveCursorDown then + self.text_widget:moveCursorDown() + end +end + function InputText:clear() self.charpos = nil self:initTextBox("") diff --git a/frontend/ui/widget/textboxwidget.lua b/frontend/ui/widget/textboxwidget.lua index 9445380ca..2fd6c4ad4 100644 --- a/frontend/ui/widget/textboxwidget.lua +++ b/frontend/ui/widget/textboxwidget.lua @@ -282,6 +282,7 @@ end -- Click event: Move the cursor to a new location with (x, y), in pixels. -- Be aware of virtual line number of the scorllTextWidget. function TextBoxWidget:moveCursor(x, y) + if x < 0 or y < 0 then return end if #self.vertical_string_list == 0 then -- if there's no text at all, nothing to do return 1 @@ -357,6 +358,26 @@ function TextBoxWidget:getSize() end end +function TextBoxWidget:moveCursorUp() + if self.vertical_string_list and #self.vertical_string_list < 2 then return end + local x, y + x, y = self:_findCharPos() + local charpos = self:moveCursor(x, y - self.line_height_px +1) + if charpos then + self:moveCursorToCharpos(charpos) + end +end + +function TextBoxWidget:moveCursorDown() + if self.vertical_string_list and #self.vertical_string_list < 2 then return end + local x, y + x, y = self:_findCharPos() + local charpos = self:moveCursor(x, y + self.line_height_px +1) + if charpos then + self:moveCursorToCharpos(charpos) + end +end + function TextBoxWidget:paintTo(bb, x, y) self.dimen.x, self.dimen.y = x, y bb:blitFrom(self._bb, x, y, 0, 0, self.width, self._bb:getHeight()) diff --git a/frontend/ui/widget/virtualkeyboard.lua b/frontend/ui/widget/virtualkeyboard.lua index 6af24dde5..2fa507d0b 100644 --- a/frontend/ui/widget/virtualkeyboard.lua +++ b/frontend/ui/widget/virtualkeyboard.lua @@ -44,6 +44,14 @@ function VirtualKey:init() elseif self.label == "Backspace" then self.callback = function () self.keyboard:delChar() end self.hold_callback = function () self.keyboard:clear() end + elseif self.label =="←" then + self.callback = function() self.keyboard:leftChar() end + elseif self.label == "→" then + self.callback = function() self.keyboard:rightChar() end + elseif self.label == "↑" then + self.callback = function() self.keyboard:upLine() end + elseif self.label == "↓" then + self.callback = function() self.keyboard:downLine() end else self.callback = function () self.keyboard:addChar(self.key) end end @@ -307,6 +315,22 @@ function VirtualKeyboard:delChar() self.inputbox:delChar() end +function VirtualKeyboard:leftChar() + self.inputbox:leftChar() +end + +function VirtualKeyboard:rightChar() + self.inputbox:rightChar() +end + +function VirtualKeyboard:upLine() + self.inputbox:upLine() +end + +function VirtualKeyboard:downLine() + self.inputbox:downLine() +end + function VirtualKeyboard:clear() logger.dbg("clear input") self.inputbox:clear()