Merge pull request #191 from chrox/master

fix fast refresh waveform
This commit is contained in:
{Qingping,Dave} Hou
2013-07-31 08:54:51 -07:00
7 changed files with 16 additions and 20 deletions

View File

@@ -48,6 +48,8 @@ DKOPTREADER_CONFIG_DOC_LANGS_TEXT = {"English", "Chinese_S", "Chinese_T"}
DKOPTREADER_CONFIG_DOC_LANGS_CODE = {"eng", "chi_sim", "chi_tra"} -- ISO 639-3 language string,
DKOPTREADER_CONFIG_DOC_DEFAULT_LANG_CODE = "eng" -- and make sure you have corresponding training data
-- gesture detector defaults
DGESDETECT_DISABLE_DOUBLE_TAP = true
-- ####################################################################
-- following features are not supported right now

View File

@@ -350,7 +350,8 @@ function GestureDetector:handleDoubleTap(tev)
DEBUG("set up tap timer")
-- deadline should be calculated by adding current tap time and the interval
local deadline = cur_tap.timev + TimeVal:new{
sec = 0, usec = self.DOUBLE_TAP_INTERVAL,
sec = 0,
usec = not Input.disable_double_tap and self.DOUBLE_TAP_INTERVAL or 0,
}
Input:setTimeout(function()
DEBUG("in tap timer", self.last_taps[slot] ~= nil)

View File

@@ -136,6 +136,7 @@ Input = {
},
rotation = 0,
timer_callbacks = {},
disable_double_tap = DGESDETECT_DISABLE_DOUBLE_TAP,
}
function Input:initKeyMap()

View File

@@ -56,16 +56,22 @@ function UIManager:show(widget, x, y)
self:setDirty(widget)
-- tell the widget that it is shown now
widget:handleEvent(Event:new("Show"))
-- check if this widget disables double tap gesture
if widget.disable_double_tap then
Input.disable_double_tap = true
end
end
-- unregister a widget
function UIManager:close(widget)
Input.disable_double_tap = DGESDETECT_DISABLE_DOUBLE_TAP
local dirty = false
for i = #self._window_stack, 1, -1 do
if self._window_stack[i].widget == widget then
table.remove(self._window_stack, i)
dirty = true
break
elseif self._window_stack[i].widget.disable_double_tap then
Input.disable_double_tap = true
end
end
if dirty then
@@ -236,7 +242,7 @@ function UIManager:run()
refresh_type = 0
end
if force_fast_refresh then
self.waveform_mode = self.fast_waveform_mode
waveform_mode = self.fast_waveform_mode
end
if self.update_region_func then
local update_region = self.update_region_func()

View File

@@ -102,6 +102,7 @@ function InputText:addChar(char)
end
function InputText:delChar()
if self.charpos == 1 then return end
self.charpos = self.charpos - 1
table.remove(self.charlist, self.charpos)
self.text = self:CharlistToString()

View File

@@ -69,12 +69,6 @@ function VirtualKey:init()
range = self.dimen,
},
},
DoubleTapSelect = {
GestureRange:new{
ges = "double_tap",
range = self.dimen,
},
},
}
end
end
@@ -88,16 +82,6 @@ function VirtualKey:onTapSelect()
return true
end
function VirtualKey:onDoubleTapSelect()
self[1].invert = true
if self.callback then
self.callback() -- once
self.callback() -- twice
end
UIManager:scheduleIn(0.02, function() self:invert(false) end)
return true
end
function VirtualKey:invert(invert)
self[1].invert = invert
UIManager.update_region_func = function()
@@ -109,6 +93,7 @@ end
VirtualKeyboard = InputContainer:new{
is_always_active = true,
disable_double_tap = true,
inputbox = nil,
KEYS = {}, -- table to store layouts
min_layout = 2,