2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

Merge pull request #571 from tigran123/bbox-fix

Don't slow down :inform() when modifying bbox (and other very minor fixes)
This commit is contained in:
Tigran Aivazian 2012-11-14 01:37:50 -08:00
commit f3c5670016
6 changed files with 15 additions and 22 deletions

View File

@ -105,10 +105,10 @@ Adding new parameters -- 'message_importance' & 'alternative_voice_message' -- i
Brief description of the function parameters
-- text : is the text message for visual and (if 'alternative_voice_message' isn't defined) voice notification
-- msec : parameter to define visual notification method
msec=0: one calls InfoMessage:show(), otherwise one calls showInfoMsgWithDelay()
msec>0: with either predefines msec-value or
msec<0: autocalculated from the text length: one may eventually add user-configurable
parameter 'reading_speed' that would define the popup exposition for this regime
nil: display the message immediately without slowing it down on the emulator
DINFO_TIMEOUT_FAST: display the message and return immediately on Kindle, but after a delay on the emulator
DINFO_TIMEOUT_SLOW: display the message and return after a delay
msec<0: the delay is auto-calculated from the text length
-- message_importance : parameter separating various messages on
MSG_AUX - not obligatory messages that might be readily avoided
MSG_WARN - warnings (important messages)

View File

@ -420,12 +420,11 @@ function FileChooser:addAllCommands()
"delete selected item",
function(self)
local pos = self.perpage*(self.page-1)+self.current
local confirm = "Please, press key Y to confirm deleting"
if pos > #self.dirs then -- file
if InfoMessage.InfoMethod[MSG_CONFIRM] == 0 then -- silent regime
self:deleteFileAtPosition(pos)
else
InfoMessage:inform("Press 'Y' to confirm ", nil, 0, MSG_CONFIRM, confirm)
InfoMessage:inform("Press 'Y' to confirm ", nil, 0, MSG_CONFIRM)
if ReturnKey() == KEY_Y then self:deleteFileAtPosition(pos) end
end
elseif self.dirs[pos] == ".." then
@ -434,7 +433,7 @@ function FileChooser:addAllCommands()
if InfoMessage.InfoMethod[MSG_CONFIRM] == 0 then -- silent regime
self:deleteFolderAtPosition(pos)
else
InfoMessage:inform("Press 'Y' to confirm ", nil, 0, MSG_CONFIRM, confirm)
InfoMessage:inform("Press 'Y' to confirm ", nil, 0, MSG_CONFIRM)
if ReturnKey() == KEY_Y then self:deleteFolderAtPosition(pos) end
end
end
@ -530,15 +529,13 @@ function FileChooser:addAllCommands()
self.commands:add(KEY_C, MOD_SHIFT, "C",
"copy file to 'clipboard'",
function(self)
-- TODO (NuPogodi, 27.09.12): overwrite?
local file = self:FullFileName()
if file then
os.execute("cp "..InQuotes(file).." "..self.clipboard)
local fn = self.files[self.perpage*(self.page-1)+self.current - #self.dirs]
os.execute("cp "..InQuotes(DocToHistory(file)).." "
..InQuotes(DocToHistory(self.clipboard.."/"..fn)) )
InfoMessage:inform("File copied to clipboard ", DINFO_TIMEOUT_FAST, 1, MSG_WARN,
"The file has been copied to clipboard.")
InfoMessage:inform("File copied to clipboard ", DINFO_TIMEOUT_FAST, 1, MSG_WARN)
end
end
)
@ -551,8 +548,7 @@ function FileChooser:addAllCommands()
local fn = self.files[self.perpage*(self.page-1)+self.current - #self.dirs]
os.rename(file, self.clipboard.."/"..fn)
os.rename(DocToHistory(file), DocToHistory(self.clipboard.."/"..fn))
InfoMessage:inform("File moved to clipboard ", DINFO_TIMEOUT_FAST, 0, MSG_WARN,
"The file has been moved to clipboard.")
InfoMessage:inform("File moved to clipboard ", DINFO_TIMEOUT_FAST, 0, MSG_WARN)
local pos = self.perpage*(self.page-1)+self.current
table.remove(self.files, pos-#self.dirs)
self.items = self.items - 1
@ -684,8 +680,7 @@ function FileChooser:deleteFolderAtPosition(pos)
self.items = #self.dirs + #self.files
self.current, self.page = gotoTargetItem(pos, self.items, pos, self.page, self.perpage)
else
InfoMessage:inform("Folder can't be deleted! ", DINFO_TIMEOUT_SLOW, 1, MSG_ERROR,
"This folder can not be deleted! Please, make sure that it is empty.")
InfoMessage:inform("Directory not empty ", DINFO_TIMEOUT_SLOW, 1, MSG_ERROR)
end
end
@ -715,7 +710,6 @@ function gotoTargetItem(target_item, all_items, current_item, current_page, perp
end
function warningUnsupportedFunction()
InfoMessage:inform("Unsupported function! ", DINFO_TIMEOUT_SLOW, 1, MSG_WARN,
"The requested function is not supported.")
InfoMessage:inform("Unsupported function ", DINFO_TIMEOUT_SLOW, 1, MSG_WARN)
return nil
end

View File

@ -64,7 +64,6 @@ function FileInfo:formatDiskSizeInfo()
end
function FileInfo:getFolderContent()
InfoMessage:inform("Scanning folder...", DINFO_TIMEOUT_FAST, 1, MSG_AUX)
local tmp = io.popen('du -a \"'..self.pathfile..'\"', "r")
local dirs, files, books, size, name, output, ftype, j = -1, 0, 0, 0
for output in tmp:lines() do

View File

@ -470,7 +470,7 @@ function KOPTConfig:modBBox(koptreader)
fb.bb:invertRect( 0,y_s, G_width,1 )
fb.bb:invertRect( x_s,0, 1,G_height )
InfoMessage:inform(running_corner.." bbox ", DINFO_TIMEOUT_FAST, 1, MSG_WARN,
InfoMessage:inform(running_corner.." bbox ", nil, 1, MSG_WARN,
running_corner.." bounding box")
fb:refresh(1)
@ -506,7 +506,7 @@ function KOPTConfig:modBBox(koptreader)
Debug("change top-left", bbox, "to", new_bbox)
running_corner = "bottom-right"
Screen:restoreFromSavedBB()
InfoMessage:inform(running_corner.." bbox ", DINFO_TIMEOUT_FAST, 1, MSG_WARN,
InfoMessage:inform(running_corner.." bbox ", nil, 1, MSG_WARN,
running_corner.." bounding box")
fb:refresh(1)
x_s = x+w

View File

@ -35,7 +35,7 @@ function openFile(filename)
reader = ReaderChooser:getReaderByName(filename)
if reader then
InfoMessage:inform("Opening document... ", DINFO_TIMEOUT_FAST, 0, MSG_AUX)
InfoMessage:inform("Opening document... ", nil, 0, MSG_AUX)
reader:preLoadSettings(filename)
local ok, err = reader:open(filename)
if ok then

View File

@ -2970,7 +2970,7 @@ function UniReader:addAllCommands()
fb.bb:invertRect( 0,y_s, G_width,1 )
fb.bb:invertRect( x_s,0, 1,G_height )
InfoMessage:inform(running_corner.." bbox ", DINFO_TIMEOUT_FAST, 1, MSG_WARN,
InfoMessage:inform(running_corner.." bbox ", nil, 1, MSG_WARN,
running_corner.." bounding box")
fb:refresh(1)
@ -3006,7 +3006,7 @@ function UniReader:addAllCommands()
Debug("change top-left", bbox, "to", new_bbox)
running_corner = "bottom-right"
Screen:restoreFromSavedBB()
InfoMessage:inform(running_corner.." bbox ", DINFO_TIMEOUT_FAST, 1, MSG_WARN,
InfoMessage:inform(running_corner.." bbox ", nil, 1, MSG_WARN,
running_corner.." bounding box")
fb:refresh(1)
x_s = x+w