Fix KOReader spelling in the code (#12670)

This commit is contained in:
mergen3107 authored and GitHub committed 2024-10-24 10:46:46 +02:00
1 parent 42d3f25034
commit f8446538c0
118 files changed
+290 -290

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ These instructions are intended for a Linux OS. MacOS and Windows users are sugg
## Prerequisites
This instructions asume that you [have a development environment ready to run](Building.md) KOReader. If not then please install common prerequisites first.
These instructions assume that you [have a development environment ready to run](Building.md) KOReader. If not then please install common prerequisites first.
### A toolchain for your target.
+1 -1
View File
@@ -90,7 +90,7 @@ integrate changes from this issue (or diff, patch, git cherry-pick sha-commit)
```
dpavlin$ git add -p unireader.lua
```
interactivly select just changes which are not whitespace
interactively select just changes which are not whitespace
```
dpavlin$ git commit --author NuPogodi -m 'TOC position on current place in the tree #235'
+1 -1
View File
@@ -62,7 +62,7 @@ print(total_time) --> 50
conn:close() -- Do not forget to close stmt after you are done
```
For more information on supported SQL quries, check out [SQLite3's official
For more information on supported SQL queries, check out [SQLite3's official
documentation][sq3-doc].
+3 -3
View File
@@ -21,7 +21,7 @@ At 16bpp, we assume the pixel format is RGB565.
For obvious performance reasons, we prefer 8bpp, and we will attempt to enforce that on devices which are not natively running at that depth (i.e., [on Kobos](https://github.com/koreader/koreader/blob/d1cd5e7ad4283611c57007b2c2d3dd5f7dab7057/platform/kobo/koreader.sh#L138-L186)).
As explained below, the same considerations should be kept in mind regarding the effective 16c palette of eInk screens.
When we're in control of the data, we attempt to always use "perfect" in-palette colors (c.f., the [COLOR constants](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/blitbuffer.lua#L1881-L1889) in the BlitBuffer module).
Otherwise, when there'd be signficiant gain in doing so (i.e., when displaying mainly image content), we attempt to make use of [dithering](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/blitbuffer.lua#L227-L271), ideally [offloaded to the hardware](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/framebuffer_mxcfb.lua#L412-L423) when supported.
Otherwise, when there'd be significant gain in doing so (i.e., when displaying mainly image content), we attempt to make use of [dithering](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/blitbuffer.lua#L227-L271), ideally [offloaded to the hardware](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/framebuffer_mxcfb.lua#L412-L423) when supported.
The actual framebuffer content is then refreshed (i.e., displayed) via device-specific ioctls, making the best effort in using device-specific capabilities, whether that be [optimized waveform modes](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/framebuffer_mxcfb.lua#L643-L655), hardware dithering or [hardware inversion](https://github.com/koreader/koreader-base/blob/a1fc4e43b7cce7a76b13224e145f9bada343d8ea/ffi/framebuffer_mxcfb.lua#L253-L256).
@@ -50,7 +50,7 @@ Following are the framebuffers that `framebuffer_einkfb.lua` currently supports:
For 4bpp framebuffers, it means every pixel is represented with 4 bits, so we have 2 pixels in 1 byte.
That also effectively limits the palette to 16 colors.
The inverted part means that every pixel's color value is flipped (`^ 0xFF`).
For example, two pixels `0x00` and `0xF0` will be flipped to `0xFF` and `0x0F`, before being packed to accomodate the framebuffer's pixel format (here, [into a single byte](https://github.com/NiLuJe/FBInk/blob/4f0230b17c480cdc75dd5497fddf33937781c812/fbink.c#L106-L133)).
For example, two pixels `0x00` and `0xF0` will be flipped to `0xFF` and `0x0F`, before being packed to accommodate the framebuffer's pixel format (here, [into a single byte](https://github.com/NiLuJe/FBInk/blob/4f0230b17c480cdc75dd5497fddf33937781c812/fbink.c#L106-L133)).
For 8bpp framebuffers, it means each pixel is instead stored in 1 byte, making addressing much simpler.
The effective color palette of the display is still limited to 16 shades of gray: it will do a decimating quantization pass on its own on refresh.
@@ -83,7 +83,7 @@ Next, you might need to define `Input:eventAdjustHook()` function in `Input:init
We use this hook function to translate events into a format that KOReader understands.
You can look at the KindleTouch initialization code for a real-world example.
For some Kobo devices (Mini, Touch, Glo and Aura HD) the function `Input:eventAdjustHook()` was skipped and the functions `Input:init()` and `Input:handleTypeBTouchEv()` were changed to accomodate for the single touch protocol.
For some Kobo devices (Mini, Touch, Glo and Aura HD) the function `Input:eventAdjustHook()` was skipped and the functions `Input:init()` and `Input:handleTypeBTouchEv()` were changed to accommodate for the single touch protocol.
For the Kobo Aura (and others with the same kernel quirks) with multitouch support, an extra function `Input:handlePhoenixTouchEv()` was added.
Linux supports two kinds of Multi-touch protocols:
@@ -508,7 +508,7 @@ To:
FFIUtil.purgeDir(cachedir)
end
lfs.mkdir(cachedir)
-- Also remove from the Cache objet references to the cache files we've just deleted
-- Also remove from the Cache object references to the cache files we've just deleted
local Cache = require("cache")
Cache.cached = {}
UIManager:askForRestart(_("Caches cleared. Please restart KOReader."))
@@ -68,7 +68,7 @@ function SetDefaultsWidget:init()
end
end
-- Prepare our menu entires
-- Prepare our menu entries
self.menu_entries = {}
local set_dialog
@@ -103,7 +103,7 @@ function ReaderCropping:onPageCrop(mode)
self.crop_dialog = VerticalGroup:new{
align = "left",
self.bbox_widget,
(Device:isTouchDevice() and button_container) or nil, -- button bar only availble for touch devices
(Device:isTouchDevice() and button_container) or nil, -- button bar only available for touch devices
}
UIManager:show(self.crop_dialog)
return true
@@ -114,7 +114,7 @@ function ReaderDictionary:init()
os.getenv("STARDICT_DATA_DIR") or
DataStorage:getDataDir() .. "/data/dict"
-- Show the "Seaching..." InfoMessage after this delay
-- Show the "Searching..." InfoMessage after this delay
self.lookup_msg_delay = 0.5
-- Allow quick interruption or dismiss of search result window
-- with tap if done before this delay. After this delay, the
@@ -649,7 +649,7 @@ local function tidyMarkup(results)
if ok then
result.definition = fixed_definition
else
logger.warn("Dict's user provided funcion failed:", fixed_definition)
logger.warn("Dict's user provided function failed:", fixed_definition)
end
end
else
@@ -813,7 +813,7 @@ function ReaderDictionary:rawSdcv(words, dict_names, fuzzy_search, lookup_progre
-- and a really bad selected text, can take up to 10 seconds.
-- It is nice to be able to cancel it when noticing wrong text was
-- selected.
-- Because sdcv starts outputing its output only at the end when it has
-- Because sdcv starts outputting its output only at the end when it has
-- done its work, we can use Trapper:dismissablePopen() to cancel it as
-- long as we are waiting for output.
-- When fuzzy search is enabled, we have a lookup_progress_msg that can
+2 -2
View File
@@ -427,7 +427,7 @@ function ReaderFont:updateFontFamilyFonts()
-- font (we have here in self.font_face) because of its increased bias (or the
-- monospace font we also added with bias).
-- So, we don't need to insert self.font_face in the list for unset family fonts,
-- which would otherwise need us to call updateFontFamilyFonts() everytime we
-- which would otherwise need us to call updateFontFamilyFonts() every time we
-- change the main font face.
local g_font_family_fonts = G_reader_settings:readSetting("cre_font_family_fonts", {})
local family_fonts = {}
@@ -745,7 +745,7 @@ If that font happens to be part of this list already, it will be used first.]]),
self.ui:handleEvent(Event:new("UpdatePos"))
end,
help_text = _([[
Adjust the size of each fallback font so they all get the same x-height, and lowercase characters picked in them look similarly sized as those from the defaut font.
Adjust the size of each fallback font so they all get the same x-height, and lowercase characters picked in them look similarly sized as those from the default font.
This may help with Greek words among Latin text (as Latin fonts often do not have all the Greek characters), but may make Chinese or Indic characters smaller when picked from fallback fonts.]]),
separator = true,
})
@@ -258,7 +258,7 @@ Hidden flows are shown with gray or hatched background in Book map and Page brow
self:updateDocFlows()
self.ui:handleEvent(Event:new("UpdateToc"))
self.ui:handleEvent(Event:new("InitScrollPageStates"))
-- The footer may be visible, so have it update its dependant items
-- The footer may be visible, so have it update its dependent items
self.view.footer:onUpdateFooter(self.view.footer_visible)
self.ui.annotation:setNeedsUpdateFlag()
if touchmenu_instance then
@@ -282,7 +282,7 @@ Hidden flows are shown with gray or hatched background in Book map and Page brow
self:updateDocFlows()
self.ui:handleEvent(Event:new("UpdateToc"))
self.ui:handleEvent(Event:new("InitScrollPageStates"))
-- The footer may be visible, so have it update its dependant items
-- The footer may be visible, so have it update its dependent items
self.view.footer:onUpdateFooter(self.view.footer_visible)
self.ui.annotation:setNeedsUpdateFlag()
if touchmenu_instance then
@@ -326,7 +326,7 @@ function ReaderHandMade:onReaderReady()
-- and it may fillToc(). So, it may happen that the expensive validateAndFixToc()
-- is called twice (first with the original ToC, then with ours).
-- - ReaderRolling will have its onReaderReady() called after ours, and if we
-- have set up hidden flows, we'll have overriden some documents methods so
-- have set up hidden flows, we'll have overridden some documents methods so
-- its cacheFlows() is a no-op.
self:updateHandmagePages()
-- Don't have each of these send their own events: we'll send them once afterwards
@@ -358,7 +358,7 @@ function ReaderHandMade:setupToc(no_event)
-- If enabled, plug one method into the document object,
-- so it is used instead of the method from its class.
self.document.getToc = function(this)
-- ReaderToc may add fieds to ToC items: return a copy,
-- ReaderToc may add fields to ToC items: return a copy,
-- so the one we will save doesn't get polluted.
return util.tableDeepCopy(self.toc)
end
@@ -23,7 +23,7 @@ function ReaderKoptListener:onReadSettings(config)
self:setZoomMode(normal_zoom_mode)
self.ui:handleEvent(Event:new("GammaUpdate", self.document.configurable.contrast, true)) -- no notification
-- since K2pdfopt v2.21 negative value of word spacing is also used, for config
-- compatability we should manually change previous -1 to a more reasonable -0.2
-- compatibility we should manually change previous -1 to a more reasonable -0.2
if self.document.configurable.word_spacing == -1 then
self.document.configurable.word_spacing = -0.2
end
+3 -3
View File
@@ -694,7 +694,7 @@ function ReaderLink:onTap(_, ges)
--
-- 30px on a reference 167 dpi screen makes 0.45cm, which
-- seems fine (on a 300dpi device, this will be scaled
-- to 54px (which makes 1/20th of screen witdh on a GloHD)
-- to 54px (which makes 1/20th of screen width on a GloHD)
-- Trust Screen.dpi (which may not be the real device
-- screen DPI if the user has set another one).
max_distance = Screen:scaleByDPI(30)
@@ -1292,7 +1292,7 @@ function ReaderLink:onGoToLatestBookmark(ges)
if latest_bookmark then
if self.ui.paging then
-- self:onGotoLink() needs something with a page attribute.
-- we need to substract 1 to bookmark page, as links start from 0
-- we need to subtract 1 to bookmark page, as links start from 0
-- and onGotoLink will add 1 - we need a fake_link (with a single
-- page attribute) so we don't touch the bookmark itself
local fake_link = {}
@@ -1355,7 +1355,7 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
flags = flags + 0x0002
end
-- Checks for private CSS properties "-cr-hint: footnote/noteref/..." are
-- always done (they can be applied to specific elements or classe names
-- always done (they can be applied to specific elements or class names
-- with Styles tweaks.)
-- Trust role= and epub:type= attribute values if defined, for source(*) and target
@@ -248,7 +248,7 @@ function ReaderPageMap:onShowPageList()
pl_menu,
}
-- buid up menu widget method as closure
-- build up menu widget method as closure
local pagemap = self
function pl_menu:onMenuChoice(item)
pagemap.ui.link:addCurrentLocationToStack()
@@ -274,7 +274,7 @@ end
function ReaderPageMap:getCurrentPageLabel(clean_label)
-- Note: in scroll mode with PDF, when multiple pages are shown on
-- the screen, the advertized page number is the greatest page number
-- the screen, the advertised page number is the greatest page number
-- among the pages shown (so, the page number of the partial page
-- shown at bottom of screen).
-- For consistency, getPageMapCurrentPageLabel() returns the last page
@@ -662,7 +662,7 @@ function ReaderPaging:onInitScrollPageStates(orig_mode)
blank_area:setSizeTo(self.view.visible_area)
while blank_area.h > 0 do
local offset = Geom:new()
-- caculate position in current page
-- calculate position in current page
if self.current_page == self.orig_page then
local page_area = self.view:getPageArea(
self.view.state.page,
@@ -95,7 +95,7 @@ function ReaderRolling:init()
-- We loaded from a valid cache file: remember its hash. It may allow not
-- having to do any background rerendering if the user somehow reverted
-- some setting changes before any background rerendering had completed
-- (ie. with autorotation, transitionning from portrait to landscape for
-- (ie. with autorotation, transitioning from portrait to landscape for
-- a few seconds, to then end up back in portrait).
self.valid_cache_rendering_hash = self.ui.document:getDocumentRenderingHash(false)
end
@@ -841,7 +841,7 @@ function ReaderRolling:onGotoXPointer(xp, marker_xp)
-- rectangle to unmark it; but it might not always be just white
-- margin: when we're in dual page mode and crengine has drawn a
-- vertical pages separator - or if we have had crengine draw
-- some backgroud texture with credocument:setBackgroundImage().
-- some background texture with credocument:setBackgroundImage().
if self.mark_orig_content_bb then
-- be sure we don't leak memory if a previous one is still
-- hanging around
@@ -1148,7 +1148,7 @@ function ReaderRolling:_gotoPos(new_pos, do_dim_area)
self.ui:handleEvent(Event:new("PageChangeAnimation", new_pos > self.current_pos))
end
self.ui.document:gotoPos(new_pos)
-- The current page we get in scroll mode may be a bit innacurate,
-- The current page we get in scroll mode may be a bit inaccurate,
-- but we give it anyway to onPosUpdate so footer and statistics can
-- keep up with page.
self.current_page = self.ui.document:getCurrentPage()
@@ -1241,7 +1241,7 @@ function ReaderRolling:onSetStatusLine(status_line)
self.cre_top_bar_enabled = status_line == 0
-- (We used to toggle the footer when toggling the top status bar,
-- but people seem to like having them both, and it feels more
-- practicable to have the independant.)
-- practicable to have the independent.)
self:onUpdatePos()
end
@@ -1681,7 +1681,7 @@ function ReaderRolling:handlePartialRerendering()
end
function ReaderRolling:_waitOrKillCurrentRerenderingSubprocess(wait, kill)
-- No need for an asynchronous collector: we'll explicitely call this and wait
-- No need for an asynchronous collector: we'll explicitly call this and wait
-- before going on, even when reloading, to avoid having multiple possibly huge
-- subprocesses at the same time.
-- Returns true if the process is no longer running.
@@ -1913,7 +1913,7 @@ function ReaderRolling:_rerenderInBackground()
-- (which happens when CSS properties "display:" and "white-space:" have changed for some nodes, which
-- is rather rare with our style tweaks) here, and do the reload and rerendering in this same background
-- subprocess, and doing this would hide this whole thing from the user, making the UX seamless.
-- But this would need a lot more memory, as we would then have 2 independant DOM in memory.
-- But this would need a lot more memory, as we would then have 2 independent DOM in memory.
-- Ie. with a big book and KOReader taking 120 MB, the subprocess would additionally use:
-- - 60 MB when doing a simple rerendering
-- - 130 MB when doing a full load+render
@@ -9,7 +9,7 @@ local C_ = _.pgettext
local T = require("ffi/util").template
local Screen = Device.screen
-- This module exposes Scrolling settings, and additionnally
-- This module exposes Scrolling settings, and additionally
-- handles inertial scrolling on non-eInk devices.
local SCROLL_METHOD_CLASSIC = "classic"
@@ -55,7 +55,7 @@ function ReaderScrolling:init()
-- The different scrolling methods are handled directly by readerpaging/readerrolling
self.scroll_method = G_reader_settings:readSetting("scroll_method")
-- Keep inertial scrolling available on the emulator (which advertizes itself as eInk)
-- Keep inertial scrolling available on the emulator (which advertises itself as eInk)
if not Device:hasEinkScreen() or Device:isEmulator() then
self._inertial_scroll_supported = true
end
@@ -352,7 +352,7 @@ function ReaderSearch:onShowSearchDialog(text, direction, regex, case_insensitiv
-- that are on previous/next page of the page we should show. And
-- sometimes even xpointers that resolve to no page.
-- We need to loop thru all the results until we find one suitable,
-- to follow its link and go to the next/prev page with occurences.
-- to follow its link and go to the next/prev page with occurrences.
local valid_link
-- If backward search, results are already in a reversed order, so we'll
-- start from the nearest to current page one.
@@ -367,7 +367,7 @@ function ReaderSearch:onShowSearchDialog(text, direction, regex, case_insensitiv
logger.dbg("res.end page & xpointer:", r_end_page, r_end)
local bounds = {}
if self._expect_back_results then
-- Process end of occurence first, which is nearest to current page
-- Process end of occurrence first, which is nearest to current page
table.insert(bounds, {r_end, r_end_page})
table.insert(bounds, {r_start, r_start_page})
else
@@ -228,7 +228,7 @@ function TweakInfoWidget:onSelect()
return true
end
-- Ordering function for tweaks when appened to css_test.
-- Ordering function for tweaks when appended to css_test.
-- The order needs to be consistent for crengine's stylesheet change
-- detection code to not invalidate cache across loadings.
local function tweakOrdering(l, r)
@@ -399,7 +399,7 @@ function ReaderStyleTweak:updateCssText(apply)
end
-- We could store what's been read into tweak.css to avoid
-- re-reading it, but this will allow a user to experiment
-- wihout having to restart KOReader
-- without having to restart KOReader
end
css = util.trim(css)
table.insert(css_snippets, css)
@@ -718,7 +718,7 @@ function ReaderStyleTweak:onToggleStyleTweak(tweak_id, item, no_notification)
local enabled, g_enabled = self:isTweakEnabled(tweak_id)
if enabled then
if g_enabled then
-- if globaly enabled, mark it as disabled
-- if globally enabled, mark it as disabled
-- for this document only
self.doc_tweaks[tweak_id] = false
else
@@ -514,7 +514,7 @@ function ReaderThumbnail:_getPageImage(page)
self.ui.bookmark:onPageUpdate(page) -- Update dogear state for this page
end
-- Draw the page on a new BB with the targetted size
-- Draw the page on a new BB with the targeted size
local bb = Blitbuffer.new(target_w, target_h, self.bb_type)
self.ui.view:paintTo(bb, 0, 0)
+2 -2
View File
@@ -183,7 +183,7 @@ function ReaderToc:validateAndFixToc()
local first = 1
local last = #toc
-- For testing: shuffle a bit a valid TOC and make it randomely invalid
-- For testing: shuffle a bit a valid TOC and make it randomly invalid
-- for i = first, last do
-- toc[i].page = toc[i].page + math.random(10) - 5
-- end
@@ -783,7 +783,7 @@ function ReaderToc:onShowToc()
end
-- Estimate expand/collapse icon size
-- *2/5 to acount for Menu top title and bottom icons, and add some space between consecutive icons
-- *2/5 to account for Menu top title and bottom icons, and add some space between consecutive icons
local icon_size = math.floor(Screen:getHeight() / items_per_page * 2/5)
local button_width = icon_size * 2
self.expand_button = Button:new{
@@ -155,7 +155,7 @@ function ReaderTypeset:onSetRenderDPI(dpi)
end
-- June 2018: epub.css has been cleaned to be more conforming to HTML specs
-- and to not include class name based styles (with conditional compatiblity
-- and to not include class name based styles (with conditional compatibility
-- styles for previously opened documents). It should be usable on all
-- HTML based documents, except FB2 which has some incompatible specs.
-- These other css files have not been updated in the same way, and are
@@ -151,7 +151,7 @@ When the book's language tag is not among our presets, no specific features will
hold_callback = function()
-- Show infos about TextLangMan seen lang_tags and loaded hyph dicts
local lang_infos = {}
local seen_hyph_dicts = {} -- to avoid outputing count and size for shared hyph dicts
local seen_hyph_dicts = {} -- to avoid outputting count and size for shared hyph dicts
local cre = require("document/credocument"):engineInit()
local main_lang_tag, main_lang_active_hyph_dict, loaded_lang_infos = cre.getTextLangStatus() -- luacheck: no unused
-- First output main lang tag
@@ -762,7 +762,7 @@ function ReaderTypography:onReadSettings(config)
self.allow_doc_lang_tag_override = true
-- Use the one manually set as fallback (with Hold)
self.text_lang_tag = G_reader_settings:readSetting("text_lang_fallback")
logger.dbg("Typography lang: using fallback ", self.text_lang_tag, ", might be overriden by doc language")
logger.dbg("Typography lang: using fallback ", self.text_lang_tag, ", might be overridden by doc language")
else
self.allow_doc_lang_tag_override = true
-- None decided, use default (shouldn't be reached)
@@ -11,7 +11,7 @@ local logger = require("logger")
local _ = require("gettext")
local T = require("ffi/util").template
-- if sometime in the future crengine is updated to use normalized utf8 for hypenation
-- if sometime in the future crengine is updated to use normalized utf8 for hyphenation
-- this variable can be set to `true`. (see discussion in : https://github.com/koreader/crengine/pull/466),
-- and some `if NORM then` branches can be simplified.
local NORM = false
@@ -108,7 +108,7 @@ end
-- Helper functions for dictionary entries-------------------------------------------
-- checks if suggestion is well formated
-- checks if suggestion is well formatted
function ReaderUserHyph:checkHyphenation(suggestion, word)
if suggestion:find("%-%-") then
return false -- two or more consecutive '-'
+2 -2
View File
@@ -306,7 +306,7 @@ function ReaderUI:init()
})
else
-- load crengine default settings (from cr3.ini, some of these
-- will be overriden by our settings by some reader modules below)
-- will be overridden by our settings by some reader modules below)
if self.document.setupDefaultView then
self.document:setupDefaultView()
end
@@ -766,7 +766,7 @@ end
function ReaderUI:onFlushSettings(show_notification)
self:saveSettings()
if show_notification then
-- Invoked from dispatcher to explicitely flush settings
-- Invoked from dispatcher to explicitly flush settings
Notification:notify(_("Book metadata saved."))
end
end
+1 -1
View File
@@ -114,7 +114,7 @@ function DepGraph:addNode(node_key, deps)
end
-- Attempt to remove a node, as well as all traces of it from other nodes' deps
-- If node has deps, it's kept, but marked as disabled, c.f., lenghty comment below.
-- If node has deps, it's kept, but marked as disabled, c.f., lengthy comment below.
function DepGraph:removeNode(node_key)
-- We shouldn't remove a node if it has dependencies (as these may have been added via addNodeDep
-- (as opposed to the optional deps list passed to addNode), like what InputContainer does with overrides,
+1 -1
View File
@@ -46,7 +46,7 @@ local function getCodename()
return codename
end
-- thirdparty app support
-- third-party app support
local external = require("device/thirdparty"):new{
dicts = {
{ "Aard2", "Aard2", false, "itkach.aard2", "aard2" },
+1 -1
View File
@@ -96,7 +96,7 @@ local Device = {
stopTextInput = function() end,
-- use these only as a last resort. We should abstract the functionality
-- and have device dependent implementations in the corresponting
-- and have device dependent implementations in the corresponding
-- device/<devicetype>/device.lua file
-- (these are functions!)
isAndroid = no,
+2 -2
View File
@@ -87,7 +87,7 @@ local GestureDetector = {
-- Hash of our currently active contacts
active_contacts = {},
contact_count = 0,
-- Used for double tap and bounce detection (this is outside a Contact object because it requires minimal persistance).
-- Used for double tap and bounce detection (this is outside a Contact object because it requires minimal persistence).
previous_tap = {},
-- for timestamp clocksource detection
clock_id = nil,
@@ -806,7 +806,7 @@ function Contact:voidState()
if tev.id == -1 then
if self.down and buddy_contact and buddy_contact.down and self.mt_gesture then
-- If we were lifted before our buddy, and we're part of a MT gesture,
-- defer to the proper state (wthout switching state ourselves).
-- defer to the proper state (without switching state ourselves).
if self.mt_gesture == "tap" then
return self:tapState()
elseif self.mt_gesture == "swipe" or self.mt_gesture == "pan" or self.mt_gesture == "pan_release" then
+2 -2
View File
@@ -185,7 +185,7 @@ local Input = {
ev_slots = nil, -- table
gesture_detector = nil,
-- simple internal clipboard implementation, can be overidden to use system clipboard
-- simple internal clipboard implementation, can be overridden to use system clipboard
hasClipboardText = function()
return _internal_clipboard_text ~= ""
end,
@@ -1493,7 +1493,7 @@ function Input:waitEvent(now, deadline)
for __, event in ipairs(ev) do
if DEBUG.is_on then
-- NOTE: This is rather spammy and computationally intensive,
-- and we can't conditionally prevent evalutation of function arguments,
-- and we can't conditionally prevent evaluation of function arguments,
-- so, just hide the whole thing behind a branch ;).
if event.type == C.EV_KEY then
logger.dbg(string.format(
+1 -1
View File
@@ -72,7 +72,7 @@ local function kindleGetCurrentProfile()
if lipc_handle then
local ha_input = lipc_handle:new_hasharray() -- an empty hash array since we only want to read
local ha_result = lipc_handle:access_hash_property("com.lab126.wifid", "currentEssid", ha_input)
local profile = ha_result:to_table()[1] -- theres only a single element
local profile = ha_result:to_table()[1] -- there is only a single element
ha_input:destroy()
ha_result:destroy()
lipc_handle:close()
+1 -1
View File
@@ -242,7 +242,7 @@ function KindlePowerD:checkUnexpectedWakeup()
end
end
-- Dummy fuctions. They will be defined in initWakeupMgr
-- Dummy functions. They will be defined in initWakeupMgr
function KindlePowerD:wakeupFromSuspend() end
function KindlePowerD:readyToSuspend() end
+2 -2
View File
@@ -52,7 +52,7 @@ local PocketBook = Generic:extend{
-- instead of busy looping at 50Hz the way inkview insists on doing.
-- In case this method fails (no root), we fallback to classic inkview api.
raw_input = nil, --[[{
-- value or function to adjust touch matrix orientiation.
-- value or function to adjust touch matrix orientation.
touch_rotation = -3+4,
-- Works same as input.event_map, but for raw input EV_KEY translation
keymap = { [scan] = event },
@@ -170,7 +170,7 @@ function PocketBook:init()
return self._fb_init(fb, finfo, vinfo)
end,
-- raw touch input orientiation is different from the screen
-- raw touch input orientation is different from the screen
getTouchRotation = function(fb)
if type(touch_rotation) == "function" then
return touch_rotation(self, fb:getRotationMode())
+1 -1
View File
@@ -125,7 +125,7 @@ function Remarkable:init()
-- logger.info("PPID:")
-- local parent_process = os.execute("echo $PPID")
-- os.execute("ps | grep $PPID")
-- logger.info(string.format("parent proccess is oxide?: %s", parent_process_is_oxide))
-- logger.info(string.format("parent process is oxide?: %s", parent_process_is_oxide))
self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg}
self.powerd = require("device/remarkable/powerd"):new{
+2 -2
View File
@@ -50,7 +50,7 @@ local function getLinkOpener()
return false
end
-- thirdparty app support
-- third-party app support
local external = require("device/thirdparty"):new{
dicts = getDesktopDicts(),
check = function(self, app)
@@ -185,7 +185,7 @@ function Device:init()
y = self.window.top,
is_always_portrait = self.isAlwaysPortrait(),
}
-- Pickup the updated window sizes if they were enforced in S.open (we'll get the coordinates via the inital SDL_WINDOWEVENT_MOVED)...
-- Pickup the updated window sizes if they were enforced in S.open (we'll get the coordinates via the initial SDL_WINDOWEVENT_MOVED)...
self.window.width = self.screen.w
self.window.height = self.screen.h
self.powerd = require("device/sdl/powerd"):new{device = self}
+1 -1
View File
@@ -66,7 +66,7 @@ function SysfsLight:setNaturalBrightness(brightness, warmth)
warmth = self.current_warmth
end
-- Newer devices use a mixer instead of writting values per color.
-- Newer devices use a mixer instead of writing values per color.
if self.frontlight_mixer then
if set_brightness then
-- Prefer the ioctl, as it's much lower latency.
+2 -2
View File
@@ -1,4 +1,4 @@
-- module for integration with thirdparty applications
-- module for integration with third-party applications
local logger = require("logger")
local roles = {
@@ -56,7 +56,7 @@ function M:checkMethod(role, method)
end
function M:dump()
local str = "user defined thirdparty apps\n"
local str = "user defined third-party apps\n"
for i, role in ipairs(roles) do
local apps = self[role.."s"]
for index, _ in ipairs(apps or {}) do
+1 -1
View File
@@ -138,7 +138,7 @@ function WakeupMgr:removeTasks(epoch, callback)
end
table.remove(self._task_queue, k)
removed = true
-- If we've successfuly pop'ed the upcoming task, we need to schedule the next one (if any) on exit.
-- If we've successfully pop'ed the upcoming task, we need to schedule the next one (if any) on exit.
if k == 1 then
reschedule = true
end
+8 -8
View File
@@ -53,7 +53,7 @@ local CreDocument = Document:extend{
-- in any fallback font. Also, we don't know if the user is using
-- a serif or a sans main font, so choosing to have one of these early
-- might not be the best decision (and moving them before FreeSans would
-- require one to set FreeSans as fallback to get its nicer glyphes, which
-- require one to set FreeSans as fallback to get its nicer glyphs, which
-- would override Noto Sans CJK good symbol glyphs with smaller ones
-- (Noto Sans & Serif do not have these symbol glyphs).
fallback_fonts = { -- const
@@ -169,12 +169,12 @@ function CreDocument:init()
local file_type = string.lower(string.match(self.file, ".+%.([^.]+)") or "")
if file_type == "zip" then
-- NuPogodi, 20.05.12: read the content of zip-file
-- and return extention of the 1st file
-- and return extension of the 1st file
file_type = self:zipContentExt(self.file) or "unknown"
end
-- June 2018: epub.css has been cleaned to be more conforming to HTML specs
-- and to not include class name based styles (with conditional compatiblity
-- and to not include class name based styles (with conditional compatibility
-- styles for previously opened documents). It should be usable on all
-- HTML based documents, except FB2 which has some incompatible specs.
-- The other css files (htm.css, rtf.css...) have not been updated in the
@@ -1065,7 +1065,7 @@ function CreDocument:setFontFace(new_font_face)
-- don't have the font.
cre.setAsPreferredFontWithBias(new_font_face, 1 + 128*5 + 256*5)
-- The above call has resetted all other biases, so re-set our other ones
-- The above call has reset all other biases, so re-set our other ones
self:setOtherFontBiases()
end
end
@@ -1207,7 +1207,7 @@ function CreDocument:setRenderDPI(value)
end
function CreDocument:setRenderScaleFontWithDPI(toggle)
-- wheter to scale font with DPI, or keep the current size
-- whether to scale font with DPI, or keep the current size
logger.dbg("CreDocument: set render scale font with dpi", toggle)
self._document:setIntProperty("crengine.render.scale.font.with.dpi", toggle)
end
@@ -1620,7 +1620,7 @@ function CreDocument:setupCallCache()
local do_log = false
-- Beware below for luacheck warnings "shadowing upvalue argument 'self'":
-- the 'self' we got and use here, and the one we may get implicitely
-- the 'self' we got and use here, and the one we may get implicitly
-- as first parameter of the methods we define or redefine, are actually
-- the same, but luacheck doesn't know that and would logically complain.
-- So, we define our helpers (self._callCache*) as functions and not methods:
@@ -1909,13 +1909,13 @@ function CreDocument:setupCallCache()
if add_reset then
self[name] = function(...)
-- logger.dbg("callCache:", name, "called with", select(2,...))
if do_log then logger.dbg("callCache:", name, "reseting cache") end
if do_log then logger.dbg("callCache:", name, "resetting cache") end
self._callCacheReset()
return func(...)
end
elseif add_buffer_trash then
self[name] = function(...)
if do_log then logger.dbg("callCache:", name, "reseting buffer") end
if do_log then logger.dbg("callCache:", name, "resetting buffer") end
self._callCacheSet("current_buffer_tag", nil)
return func(...)
end
+2 -2
View File
@@ -23,7 +23,7 @@ local Document = {
GAMMA_NO_GAMMA = 1.0,
-- override bbox from orignal page's getUsedBBox
-- override bbox from original page's getUsedBBox
bbox = nil, -- table
-- flag to show whether the document was opened successfully
@@ -501,7 +501,7 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, hinting)
-- Make the context match the rotation,
-- by pointing at the rotated origin via coordinates offsets.
-- NOTE: We rotate our *Screen* bb on rotation (SetRotationMode), not the document,
-- so we hardly ever exercize this codepath...
-- so we hardly ever exercise this codepath...
-- AFAICT, the only thing that will *ever* (attempt to) rotate the document is ReaderRotation's key bindings (RotationUpdate).
--- @fixme: And whaddayano, it's broken ;). The aptly named key binds in question are J/K, I shit you not.
if rotation == 90 then
+1 -1
View File
@@ -1379,7 +1379,7 @@ end
local function all_matches(boxes, plist, case_insensitive)
local pnb = #plist
-- return mached word indices from index i, j
-- return matched word indices from index i, j
local function match(i, j)
local pindex = 1
local matched_indices = {}
+1 -1
View File
@@ -35,7 +35,7 @@ local GetText_mt = {
__index = {}
}
-- wrapUntranslated() will be overriden by bidi.lua when UI language is RTL,
-- wrapUntranslated() will be overridden by bidi.lua when UI language is RTL,
-- to wrap untranslated english strings as LTR-isolated segments.
-- It should do nothing when the UI language is LTR.
GetText.wrapUntranslated_nowrap = function(text) return text end
+1 -1
View File
@@ -26,7 +26,7 @@ function HTTPClient:request(request, response_callback)
local client = turbo.async.HTTPClient({verify_ca = false})
local res = coroutine.yield(client:fetch(request.url, request))
self.input_timeouts = self.input_timeouts - 1
-- reset INPUT_TIMEOUT to nil when all HTTP requests are fullfilled.
-- reset INPUT_TIMEOUT to nil when all HTTP requests are fulfilled.
if self.input_timeouts == 0 then UIManager:resetInputTimeout() end
if response_callback then
response_callback(res)
+1 -1
View File
@@ -210,7 +210,7 @@ function LanguageSupport:improveWordSelection(selection)
-- We want to use native crengine text selection here, but we cannot use
-- getTextFromPositions because the conversion to and from screen
-- co-ordinates leads to issues with text selection of <ruby> text. In
-- coordinates leads to issues with text selection of <ruby> text. In
-- addition, using getTextFromXPointers means we can select text not on the
-- screen. But this means we need to manually create the text selection
-- object returned by getTextFromPositions (though this is not a big deal
+3 -3
View File
@@ -13,7 +13,7 @@ only 2 valid combinations:
Text direction is handled by the libkoreader-xtext.so C module,
and the TextWidget and TextBoxWidget widgets that handle text
aligment. We just need here to set the default global paragraph
alignment. We just need here to set the default global paragraph
direction (that widgets can override if needed).
UI mirroring is to be handled by our widget themselves, with the
@@ -62,7 +62,7 @@ function Bidi.setup(lang)
-- Text direction should normally not follow ui mirroring
-- lang override (so that Arabic is still right aligned
-- when one wants the UI layout LTR). But allow it to
-- be independantly reversed (for testing UI mirroring
-- be independently reversed (for testing UI mirroring
-- with english text right aligned).
if G_reader_settings:isTrue("dev_reverse_ui_text_direction") then
is_rtl = not is_rtl
@@ -127,7 +127,7 @@ function Bidi.mirroredUILayout()
return Bidi._mirrored_ui_layout
end
-- This fuction can be used by document widgets to temporarily match a widget
-- This function can be used by document widgets to temporarily match a widget
-- to the document page turn direction instead of the UI layout direction.
function Bidi.invert()
if not Bidi._inverted then
+1 -1
View File
@@ -554,7 +554,7 @@ Note that your selected font size is not affected by this setting.]]),
unit = "%",
name = "cjk_width_scaling",
name_text = _("CJK width scaling"),
info_text = _([[Increase the width of all CJK (Chinese, Japanese, Korean) chararacters by this percentage. This has the effect of adding space between these glyphs, and might make them easier to distinguish to some readers.]]),
info_text = _([[Increase the width of all CJK (Chinese, Japanese, Korean) characters by this percentage. This has the effect of adding space between these glyphs, and might make them easier to distinguish to some readers.]]),
event = "SetCJKWidthScaling",
other_button = {
text = _("Word expansion"),
+4 -4
View File
@@ -189,7 +189,7 @@ These tweaks allow you to change this behavior, and to override publisher rules.
separator = true,
},
-- To avoid duplicating these 2 tweaks into 2 others for ignoring publisher rules,
-- we apply the rules to BODY without !important (so they can still be overriden
-- we apply the rules to BODY without !important (so they can still be overridden
-- by publisher rules applied to BODY), and to DocFragment with !important (so
-- that with "* {widows/orphans: inherit !important}", all elements will inherit
-- from the DocFragment rules.
@@ -684,7 +684,7 @@ table, tcaption, tr, th, td { border: black solid 1px; border-collapse: collapse
title = _("Full-width images"),
description = _("Useful for books containing only images, when they are smaller than your screen. May stretch images in some cases."),
-- This helped me once with a book. Will mess with aspect ratio
-- when images have a style="width: NNpx; heigh: NNpx"
-- when images have a style="width: NNpx; height: NNpx"
css = [[
img {
text-align: center !important;
@@ -1019,7 +1019,7 @@ This tweak can be duplicated as a user style tweak when books contain footnotes
-- to apply the hint).
-- For the font-size changes, we want to match only block elements (with "-inline")
-- as we want to keep any relative font-size (ie. 0.5em) for inline nodes like <sup>.
-- We also add a selector for the <autoBoxing> internal element (which are explicitely
-- We also add a selector for the <autoBoxing> internal element (which are explicitly
-- not matched by '*') as we may get some in/as footnote containers, and they would
-- inherit some of these properties, that we wish to reset too.
(function()
@@ -1121,7 +1121,7 @@ This will break any complex footnote containing quotes or lists.]]),
id = "inpage_footnote_regularize_text",
title = _("Regularize text size on inline elements"),
description = _([[
If the footnote text uses variable or absolute font sizes, line height or vertical alignments, which would make it too irregular, you can reset all of them to get a leaner text (to the expense of loosing superscripts).]]),
If the footnote text uses variable or absolute font sizes, line height or vertical alignments, which would make it too irregular, you can reset all of them to get a leaner text (to the expense of losing superscripts).]]),
priority = 6,
css = [[
*, autoBoxing {
+1 -1
View File
@@ -665,7 +665,7 @@ if BD.mirroredUILayout() then
j.values[2], j.values[4] = j.values[4], j.values[2]
j.labels[2], j.labels[4] = j.labels[4], j.labels[2]
-- The zoom direction items will be mirrored, but we want them to
-- stay as is, as the RTL diretions are at the end of the arrays.
-- stay as is, as the RTL directions are at the end of the arrays.
-- By reverting the mirroring, RTL directions will be on the right,
-- so, at the start of the options for a RTL reader.
j = KoptOptions[3].options[7]
+2 -2
View File
@@ -78,7 +78,7 @@ if last_migration_date < 20200421 then
G_reader_settings:saveSetting("text_lang_fallback", dict_info[2])
g_text_lang_set = true
-- We can't really tweak other settings if the hyph algo fallback happens to be
-- @none, @softhyphens, @algortihm...
-- @none, @softhyphens, @algorithm...
end
end
if not g_text_lang_set then
@@ -444,7 +444,7 @@ end
if last_migration_date < 20220625 then
os.remove("afterupdate.marker")
-- Move an existing `koreader/patch.lua` to `koreader/patches/1-patch.lua` (-> will be excuted in `early`)
-- Move an existing `koreader/patch.lua` to `koreader/patches/1-patch.lua` (-> will be executed in `early`)
local data_dir = DataStorage:getDataDir()
local patch_dir = data_dir .. "/patches"
if lfs.attributes(data_dir .. "/patch.lua", "mode") == "file" then
@@ -56,7 +56,7 @@ This should be enough to appreciate this font.</div>
<div>&nbsp;</div>
<div>This is some sample content. You can have this document generated
with some text of yours in your prefered language(s) by creating and
with some text of yours in your preferred language(s) by creating and
adding it to a file named:<br/>
<code>koreader/settings/font-test-sample.html</code>
</div>
@@ -228,7 +228,7 @@ local sub_item_table = {
},
}
if Device:hasKeyboard() or Device:hasScreenKB() then
-- we use same pos. 4 as below so we are always above "keyboard apperance settings"
-- we use same pos. 4 as below so we are always above "keyboard appearance settings"
table.insert(sub_item_table, 4, {
text = _("Show virtual keyboard"),
help_text = _("Enable this setting to always display the virtual keyboard within a text input field. When a field is selected (in focus), you can temporarily toggle the keyboard on/off by pressing 'Shift' (or 'ScreenKB') + 'Home'."),
+12 -12
View File
@@ -29,11 +29,11 @@ local Font = {
regular_font_variant = _regular_font_variant,
-- Allow globally not promoting fonts to their bold variants
-- (and use thiner and narrower synthetized bold instead).
-- (and use thinner and narrower synthesized bold instead).
use_bold_font_for_bold = G_reader_settings:nilOrTrue("use_bold_font_for_bold"),
-- Widgets can provide "bold = Font.FORCE_SYNTHETIZED_BOLD" instead
-- of "bold = true" to explicitely request synthetized bold, which,
-- of "bold = true" to explicitly request synthesized bold, which,
-- with XText, makes a bold string the same width as itself non-bold.
FORCE_SYNTHETIZED_BOLD = "FORCE_SYNTHETIZED_BOLD",
@@ -168,7 +168,7 @@ for _, font_path in ipairs(FontList:getFontList()) do
end
bold_candidates = nil -- luacheck: ignore
-- Helper functions with explicite names around
-- Helper functions with explicit names around
-- bold/regular_font_variant tables
function Font:hasBoldVariant(name)
return self.bold_font_variant[name] and true or false
@@ -186,7 +186,7 @@ function Font:getRegularVariantName(name)
return self.regular_font_variant[name] or name
end
-- Synthetized bold strength can be tuned:
-- Synthesized bold strength can be tuned:
-- local bold_strength_factor = 1 -- really too bold
-- local bold_strength_factor = 1/2 -- bold enough
local bold_strength_factor = 3/8 -- as crengine, lighter
@@ -226,7 +226,7 @@ local _getFallbackFont = function(face_obj, num)
-- If main font is a real bold, or if it's not but we want bold,
-- get the bold variant of the fallback if one exists.
-- But if one exists, use the regular variant as an additional
-- fallback, drawn with synthetized bold (often, bold fonts
-- fallback, drawn with synthesized bold (often, bold fonts
-- have less glyphs than their regular counterpart).
if face_obj.is_real_bold or face_obj.wants_bold == true then
-- (not if wants_bold==Font.FORCE_SYNTHETIZED_BOLD)
@@ -296,7 +296,7 @@ function Font:getFace(font, size, faceindex)
if face_obj.orig_size ~= orig_size then
-- orig_size has changed (which may happen on small orig_size variations
-- mapping to a same final size, but more importantly when geometry
-- or dpi has changed): keep it updated, so code that would re-use
-- or dpi has changed): keep it updated, so code that would reuse
-- it to fetch another font get the current original font size and
-- not one from the past
face_obj.orig_size = orig_size
@@ -386,8 +386,8 @@ function Font:getAdjustedFace(face, bold)
if face.is_real_bold then
-- No adjustment needed: main real bold font will ensure
-- fallback fonts use their associated bold font or
-- get synthetized bold - whether bold is requested or not
-- (Set returned bold to true, to force synthetized bold
-- get synthesized bold - whether bold is requested or not
-- (Set returned bold to true, to force synthesized bold
-- on fallback fonts with no associated real bold)
-- (Drop bold=FORCE_SYNTHETIZED_BOLD and use 'true' if
-- we were given a real bold font.)
@@ -413,8 +413,8 @@ function Font:getAdjustedFace(face, bold)
end
end
-- Only the regular font is available, and bold requested:
-- we'll have synthetized bold - but _getFallbackFont() should
-- build a list of fallback fonts either synthetized, or possibly
-- we'll have synthesized bold - but _getFallbackFont() should
-- build a list of fallback fonts either synthesized, or possibly
-- using the bold variant of a regular fallback font.
-- We don't want to collide with the regular font face_obj.fallbacks
-- so let's make a shallow clone of this face_obj, and have it cached.
@@ -432,13 +432,13 @@ function Font:getAdjustedFace(face, bold)
orig_size = face.orig_size,
-- We can keep the same FT object and the same hash in this face_obj
-- (which is only used to identify cached glyphs, that we don't need
-- to distinguish as "bold" is appended when synthetized as bold)
-- to distinguish as "bold" is appended when synthesized as bold)
ftsize = face.ftsize,
hash = face.hash,
hb_features = face.hb_features,
is_real_bold = nil,
wants_bold = bold, -- true or Font.FORCE_SYNTHETIZED_BOLD, used
-- to pick the appropritate fallback fonts
-- to pick the appropriate fallback fonts
}
face_obj.getFallbackFont = function(num)
return _getFallbackFont(face_obj, num)
+1 -1
View File
@@ -544,7 +544,7 @@ function NetworkMgr:getBeforeActionFlag()
return self._before_action_tripped
end
--- @note: The callback will only run *after* a *succesful* network connection.
--- @note: The callback will only run *after* a *successful* network connection.
--- The only guarantee it provides is isConnected (i.e., an IP & a local gateway),
--- *NOT* isOnline (i.e., WAN), se be careful with recursive callbacks!
--- Should only return false on *explicit* failures,
+2 -2
View File
@@ -169,7 +169,7 @@ function RenderImage:renderGifImageDataWithGifLib(data, size, want_frames, width
end
end
-- Much like our other stuff, when we're puzzled about __gc, we do it manually!
-- So, also set this method, so that ImageViewer can explicitely call it onClose.
-- So, also set this method, so that ImageViewer can explicitly call it onClose.
function frames:free()
logger.dbg("frames.free() called, closing GifDocument", self.gif)
if self.gif_close_needed then
@@ -251,7 +251,7 @@ function RenderImage:renderWebpImageDataWithLibwebp(data, size, want_frames, wid
end
end
-- Much like our other stuff, when we're puzzled about __gc, we do it manually!
-- So, also set this method, so that ImageViewer can explicitely call it onClose.
-- So, also set this method, so that ImageViewer can explicitly call it onClose.
function frames:free()
logger.dbg("frames.free() called, closing webp object", self.webp)
if self.webp_close_needed then
+1 -1
View File
@@ -243,7 +243,7 @@ function RenderText:renderUtf8Text(dest_bb, x, baseline, face, text, kerning, bo
pen_x = pen_x + (char_pads[char_idx] or 0)
-- We used to use:
-- pen_x = pen_x + char_pads[char_idx]
-- above will fail if we didnt count the same number of chars, we'll see
-- above will fail if we didn't count the same number of chars, we'll see
-- We saw, and it's pretty robust: it never failed before we tried to
-- render some binary content, which messes the utf8 sequencing: the
-- split to UTF8 is only reversible if text is valid UTF8 (or nearly UTF8).
+1 -1
View File
@@ -687,7 +687,7 @@ function Screensaver:show()
message_widget,
}
else
-- No prevously created widget, so just show message widget
-- No previously created widget, so just show message widget
widget = message_widget
end
end
+3 -3
View File
@@ -1,5 +1,5 @@
--[[--
A runtime optimized module to compare and do simple arithmetics with fixed point time values (which are called fts in here).
A runtime optimized module to compare and do simple arithmetic with fixed point time values (which are called fts in here).
Also implements functions to retrieve time from various system clocks (monotonic, monotonic_coarse, realtime, realtime_coarse, boottime ...).
@@ -226,7 +226,7 @@ Which means that, yes, this is a fancier POSIX Epoch ;).
local time = require("ui/time")
local fts_start = time.realtime()
-- Do some stuff.
-- You can add and substract fts times
-- You can add and subtract fts times
local fts_duration = time.realtime() - fts_start
@treturn fts fixed point time
@@ -282,7 +282,7 @@ if HAVE_BOOTTIME then
time.boottime_or_realtime_coarse = time.boottime
else
function time.boottime()
logger.warn("fts: Attemped to call boottime on a platform where it's unsupported!")
logger.warn("fts: Attempted to call boottime on a platform where it's unsupported!")
return 0
end
+4 -4
View File
@@ -179,7 +179,7 @@ function Trapper:info(text, fast_refresh)
return false
end
if self.current_widget then
-- Resurect a dead widget. This should only be performed by trained Necromancers.
-- Resurrect a dead widget. This should only be performed by trained Necromancers.
-- Do NOT do this at home, kids.
-- Some state *might* be lost, but the basics should survive...
self.current_widget:init()
@@ -397,7 +397,7 @@ function Trapper:dismissablePopen(cmd, trap_widget_or_string)
-- We check regularly if data is available to be read, and we give control
-- in the meantime to UIManager so our trap_widget's dismiss_callback
-- get a chance to be triggered, in which case we won't wait for reading,
-- We'll schedule a background function to collect the uneeded output and
-- We'll schedule a background function to collect the unneeded output and
-- close the pipe later.
while true do
-- Every 10 iterations, increase interval until a max of 1 sec is reached
@@ -417,7 +417,7 @@ function Trapper:dismissablePopen(cmd, trap_widget_or_string)
-- zombie processes.
local collect_and_clean
collect_and_clean = function()
if ffiutil.getNonBlockingReadSize(std_out) ~= 0 then -- cmd started outputing
if ffiutil.getNonBlockingReadSize(std_out) ~= 0 then -- cmd started outputting
std_out:read("*all")
std_out:close()
logger.dbg("collected cancelled cmd output")
@@ -600,7 +600,7 @@ function Trapper:dismissableRunInSubprocess(task, trap_widget_or_string, task_re
logger.dbg("collected previously dismissed subprocess")
else
if parent_read_fd and ffiutil.getNonBlockingReadSize(parent_read_fd) ~= 0 then
-- If subprocess started outputing to fd, read from it,
-- If subprocess started outputting to fd, read from it,
-- so its write() stops blocking and subprocess can exit
ffiutil.readAllFromFD(parent_read_fd)
-- We closed our fd, don't try again to read or close it
+3 -3
View File
@@ -767,7 +767,7 @@ end
--- Top-to-bottom widgets iterator
--- NOTE: VirtualKeyboard can be instantiated multiple times, and is a modal,
-- so don't be suprised if you find a couple of instances of it at the top ;).
-- so don't be surprised if you find a couple of instances of it at the top ;).
function UIManager:topdown_widgets_iter()
local n = #self._window_stack
local i = n + 1
@@ -1149,7 +1149,7 @@ function UIManager:_refresh(mode, region, dither)
end
-- special case: "partial" refreshes
-- will get promoted every self.FULL_REFRESH_COUNT refreshes
-- since _refresh can be called mutiple times via setDirty called in
-- since _refresh can be called multiple times via setDirty called in
-- different widgets before a real screen repaint, we should make sure
-- refresh_count is incremented by only once at most for each repaint
-- NOTE: Ideally, we'd only check for "partial"" w/ no region set (that neatly narrows it down to just the reader).
@@ -1671,7 +1671,7 @@ function UIManager:_standbyTransition()
end
-- Used by a PM transition event handler to request an early return from input polling.
-- NOTE: We can't re-use setInputTimeout to avoid interactions with ZMQ...
-- NOTE: We can't reuse setInputTimeout to avoid interactions with ZMQ...
function UIManager:consumeInputEarlyAfterPM(toggle)
self._pm_consume_input_early = toggle
end
+1 -1
View File
@@ -308,7 +308,7 @@ function ViewHtml:_handleLongPress(document, css_selectors_offsets, offset_shift
ancestors_classnames_selector = " > " .. ancestors_classnames_selector
end
ancestors_classnames_selector = elem .. all_classnames .. ancestors_classnames_selector
seen_kind.element = true -- done with selectors targetting the selected element only
seen_kind.element = true -- done with selectors targeting the selected element only
end
if elem == "DocFragment" or elem == "FictionBook" then
-- Ignore the root node up these
+16 -16
View File
@@ -39,8 +39,8 @@ local BookMapRow = WidgetContainer:extend{
height = nil,
pages_frame_border = Size.border.default,
toc_span_border = Size.border.thin,
-- pages_frame_border = 10, -- for debugging positionning
-- toc_span_border = 5, -- for debugging positionning
-- pages_frame_border = 10, -- for debugging positioning
-- toc_span_border = 5, -- for debugging positioning
toc_items = nil, -- Arrays[levels] of arrays[items at this level to show as spans]
-- Many other options not described here, see BookMapWidget:update()
-- for the complete list.
@@ -151,7 +151,7 @@ function BookMapRow:init()
margin = 0,
padding = 0,
bordersize = self.pages_frame_border,
-- color = Blitbuffer.COLOR_GRAY, -- for debugging positionning
-- color = Blitbuffer.COLOR_GRAY, -- for debugging positioning
Widget:new{ -- empty widget to give dimensions around which to draw borders
dimen = Geom:new{
w = self.pages_frame_inner_width,
@@ -351,7 +351,7 @@ function BookMapRow:init()
local read_min_h = math.max(math.ceil(self.span_height * 0.1), unread_marker_h+Size.line.thick)
if self.page_slot_width >= 5 * unread_marker_h then
-- If page slots are large enough, we can make unread markers a bit taller (so they
-- are noticable and won't be confused with read page slots)
-- are noticeable and won't be confused with read page slots)
unread_marker_h = unread_marker_h * 2
end
for page = self.start_page, self.end_page do
@@ -359,7 +359,7 @@ function BookMapRow:init()
local x = self:getPageX(page)
local w = self:getPageX(page, true) - x
local h = math.ceil(self.read_pages[page][1] * self.span_height * 0.8)
h = math.max(h, read_min_h) -- so it's noticable
h = math.max(h, read_min_h) -- so it's noticeable
local y = self.pages_frame_height - self.pages_frame_border - h + 1
if self.with_page_sep then
-- We put the blank at the start of a page slot
@@ -545,11 +545,11 @@ function BookMapRow:paintTo(bb, x, y)
end
-- Paint regular sub widgets the classic way
InputContainer.paintTo(self, bb, x, y)
-- And explicitely paint read pages markers (which are not subwidgets)
-- And explicitly paint read pages markers (which are not subwidgets)
for _, marker in ipairs(self.pages_markers) do
bb:paintRect(x + self.pages_frame_offset_x + marker.x, y + marker.y, marker.w, marker.h, marker.color)
end
-- And explicitely paint indicators (which are not subwidgets)
-- And explicitly paint indicators (which are not subwidgets)
for _, indicator in ipairs(self.indicators) do
local glyph = RenderText:getGlyph(indicator.face or self.font_face, indicator.c)
local alt_bb
@@ -572,7 +572,7 @@ function BookMapRow:paintTo(bb, x, y)
alt_bb:free()
end
end
-- And explicitely paint bottom texts (which are not subwidgets)
-- And explicitly paint bottom texts (which are not subwidgets)
for _, btext in ipairs(self.bottom_texts) do
local text_w = TextWidget:new{
text = btext.text,
@@ -601,7 +601,7 @@ function BookMapRow:paintTo(bb, x, y)
end
end
-- BookMapWidget: shows a map of content, including TOC, boomarks, read pages, non-linear flows...
-- BookMapWidget: shows a map of content, including TOC, bookmarks, read pages, non-linear flows...
local BookMapWidget = InputContainer:extend{
-- Focus page: show the BookMapRow containing this page
-- in the middle of screen
@@ -745,9 +745,9 @@ function BookMapWidget:init()
}
-- We'll handle all events in this main BookMapWidget: none of the vgroup
-- children have any handler. Hack into vgroup so it doesn't propagate
-- events needlessly to its children (the slowness gets noticable when
-- events needlessly to its children (the slowness gets noticeable when
-- we have many TOC items in flat map mode - the also needless :paintTo()
-- don't seen to cause such a noticable slowness)
-- don't seen to cause such a noticeable slowness)
self.vgroup.propagateEvent = function() return false end
-- Our scrollable container needs to be known as widget.cropping_widget in
@@ -990,7 +990,7 @@ function BookMapWidget:update()
cur_left_spacing = cur_left_spacing + Size.span.horizontal_default
-- Note: this variable indentation may make the page slot widths variable across
-- rows from different levels (and self.fit_pages_per_row not really accurate) :/
-- Hopefully, it won't be noticable.
-- Hopefully, it won't be noticeable.
else
p_max = item.page - 1
p_end = p_max
@@ -1432,7 +1432,7 @@ function BookMapWidget:onClose(close_all_parents)
-- with the current size to be available)
self.ui.thumbnail:tidyCache()
-- Force a GC to free the memory used by the widgets and tiles
-- (delay it a bit so this pause is less noticable)
-- (delay it a bit so this pause is less noticeable)
UIManager:scheduleIn(0.5, function()
collectgarbage()
collectgarbage()
@@ -1463,7 +1463,7 @@ end
function BookMapWidget:getVGroupRowAtY(y)
-- y is expected relative to the ScrollableContainer crop top
-- (if y is from a screen coordinate, substract 'self.title_bar_h' before calling this)
-- (if y is from a screen coordinate, subtract 'self.title_bar_h' before calling this)
y = y + self.cropping_widget._scroll_offset_y
return self:getMatchingVGroupRow(function(r, r_y, r_h)
return y >= r_y and y < r_y + r_h
@@ -1472,7 +1472,7 @@ end
function BookMapWidget:getBookMapRowNearY(y)
-- y is expected relative to the ScrollableContainer crop top
-- (if y is from a screen coordinate, substract 'self.title_bar_h' before calling this)
-- (if y is from a screen coordinate, subtract 'self.title_bar_h' before calling this)
y = y + self.cropping_widget._scroll_offset_y
-- Return the BookMapRow at y, or if the vgroup element is a ToC
-- title (in flat_map mode), return the follow up BookMapRow
@@ -1798,7 +1798,7 @@ end
function BookMapWidget:paintTo(bb, x, y)
-- Paint regular sub widgets the classic way
InputContainer.paintTo(self, bb, x, y)
-- And explicitely paint "swipe" hints along the left and bottom borders
-- And explicitly paint "swipe" hints along the left and bottom borders
self:paintLeftVerticalSwipeHint(bb, x, y)
if not self.overview_mode then
self:paintBottomHorizontalSwipeHint(bb, x, y)
+1 -1
View File
@@ -122,7 +122,7 @@ function ButtonDialog:init()
shrink_min_width = self.shrink_min_width,
show_parent = self,
}
local buttontable_width = self.buttontable:getSize().w -- may be shrinked
local buttontable_width = self.buttontable:getSize().w -- may be shrunk
local title_widget, title_widget_height
if self.title then
@@ -21,7 +21,7 @@ local WidgetContainer = require("ui/widget/container/widgetcontainer")
local AlphaContainer = WidgetContainer:extend{
alpha = 1,
-- we cache a blitbuffer object for re-use here:
-- we cache a blitbuffer object for reuse here:
private_bb = nil,
}
@@ -30,7 +30,7 @@ local MovableContainer = InputContainer:extend{
alpha = nil,
-- Move threshold (if move distance less than that, considered as a Hold
-- with no movement, used for reseting move to original position)
-- with no movement, used for resetting move to original position)
move_threshold = Screen:scaleBySize(5),
-- Events to ignore (ie: ignore_events={"hold", "hold_release"})
@@ -414,7 +414,7 @@ end
function MovableContainer:resetEventState()
-- Cancel some internal moving-or-about-to-move state.
-- Can be called explicitely to prevent bad widget interactions.
-- Can be called explicitly to prevent bad widget interactions.
self._touch_pre_pan_was_inside = false
self._moving = false
end
@@ -45,8 +45,8 @@ local ScrollableContainer = InputContainer:extend{
-- content_bottom = y of the content bottom of a row (included)
-- that should not account for any top or bottom padding (which should be accounted in
-- top/bottom), which will be used instead of top/bottom when looking for truncated rows.
-- The disctinction allows, if only some top or bottom padding is truncated, but not the
-- content, to consider it fully visible and to not need to be visible after the swipe,
-- The distinction allows (if only some top or bottom padding is truncated, but not the
-- content) to consider it fully visible and to not need to be visible after the swipe,
-- but to still use these padding for the alignments.
step_scroll_grid = nil, -- either this array
step_scroll_grid_func = nil, -- or a function returning this array
+1 -1
View File
@@ -265,7 +265,7 @@ function DateTimeWidget:createLayout()
self.sec_widget, -- 11
}
-- remove empty widgets plus trailling placeholder
-- remove empty widgets plus trailing placeholder
for i = #date_group, 1, -2 do
if date_group[i] == dummy_widget then
table.remove(date_group, i)
+5 -5
View File
@@ -863,13 +863,13 @@ function DictQuickLookup:update()
-- Update main text widgets
if self.is_html and self.shw_widget then
-- Re-use our ScrollHtmlWidget (self.shw_widget)
-- Reuse our ScrollHtmlWidget (self.shw_widget)
-- NOTE: The recursive free via our WidgetContainer (self[1]) above already released the previous MµPDF document instance ;)
self.text_widget.htmlbox_widget:setContent(self.definition, self:getHtmlDictionaryCss(), Screen:scaleBySize(self.dict_font_size))
-- Scroll back to top
self.text_widget:resetScroll()
elseif not self.is_html and self.stw_widget then
-- Re-use our ScrollTextWidget (self.stw_widget)
-- Reuse our ScrollTextWidget (self.stw_widget)
-- Update properties that may change across results (as done in DictQuickLookup:_instantiateScrollWidget())
self.text_widget.text_widget.text = self.definition
self.text_widget.text_widget.charlist = nil -- (required when use_xtext=false for proper re-init)
@@ -906,7 +906,7 @@ function DictQuickLookup:update()
end
function DictQuickLookup:getInitialVisibleArea()
-- Some positionning happens only at paintTo() time, but we want
-- Some positioning happens only at paintTo() time, but we want
-- to know this before. So, do a bit like WidgetContainer does
-- (without any MovableContainer offset)
local dict_size = self.dict_frame:getSize()
@@ -1337,12 +1337,12 @@ function DictQuickLookup:lookupWikipedia(get_fullpage, word, is_sane, lang)
word = self.lookupword
is_sane = true
else
-- we use the original word that was querried
-- we use the original word that was queried
word = self.word
is_sane = false
end
end
-- Keep providing self.word_boxes so new windows keep being positionned to not hide it
-- Keep providing self.word_boxes so new windows keep being positioned to not hide it
self.ui:handleEvent(Event:new("LookupWikipedia", word, is_sane, self.word_boxes, get_fullpage, lang))
end
+1 -1
View File
@@ -62,7 +62,7 @@ function DoubleSpinWidget:init()
self.screen_height = Screen:getHeight()
if not self.width then
if not self.width_factor then
self.width_factor = 0.8 -- default if no width speficied
self.width_factor = 0.8 -- default if no width specified
end
self.width = math.floor(math.min(self.screen_width, self.screen_height) * self.width_factor)
end
+1 -1
View File
@@ -208,7 +208,7 @@ function FocusManager:onFocusPrevious()
end
function FocusManager:onFocusMove(args)
if not self.layout then -- allow parent focus manger to handle the event
if not self.layout then -- allow parent focus manager to handle the event
return false
end
local dx, dy = unpack(args)
+3 -3
View File
@@ -23,7 +23,7 @@ local time = require("ui/time")
-- Note: we can't use < or > in comments in the CSS, or MuPDF complains with:
-- error: css syntax error: unterminated comment.
-- So, HTML tags in comments are written upppercase (eg: <li> => LI)
-- So, HTML tags in comments are written uppercase (eg: <li> => LI)
-- Independent string for @page, so we can T() it individually,
-- without needing to escape % in DEFAULT_CSS
@@ -38,7 +38,7 @@ local PAGE_CSS = [[
-- Make default MuPDF styles (source/html/html-layout.c) a bit
-- more similar to our epub.css ones, and more condensed to fit
-- in a small bottom pannel
-- in a small bottom panel
local DEFAULT_CSS = [[
body {
margin: 0; /* MuPDF: margin: 1em */
@@ -119,7 +119,7 @@ body > section > title {
local FootnoteWidget = InputContainer:extend{
html = nil,
css = nil,
-- font_face can't really be overriden, it needs to be known by MuPDF
-- font_face can't really be overridden, it needs to be known by MuPDF
font_face = "Noto Sans",
-- For the doc_* values, we expect to be provided with the real
-- (already scaled) sizes in screen pixels
+1 -1
View File
@@ -35,7 +35,7 @@ local IconWidget = ImageWidget:extend{
icon = ICON_NOT_FOUND, -- show this if not provided
-- See ImageWidget for other available options,
-- we only start with a few different defaults, that can
-- be overriden by callers.
-- be overridden by callers.
width = Screen:scaleBySize(DGENERIC_ICON_SIZE), -- our icons are square
height = Screen:scaleBySize(DGENERIC_ICON_SIZE),
alpha = false, --- @note: Our icons have a transparent background, but, by default, we flatten them at caching time.
+2 -2
View File
@@ -437,7 +437,7 @@ function ImageViewer:_new_image_wg()
self._image_wg = ImageWidget:new{
file = self.file,
image = self.image,
image_disposable = false, -- we may re-use self.image
image_disposable = false, -- we may reuse self.image
file_do_cache = false,
alpha = true, -- we might be showing images with an alpha channel (e.g., from Wikipedia)
width = max_image_w,
@@ -828,7 +828,7 @@ function ImageViewer:onCloseWidget()
-- Our ImageWidget (self._image_wg) is always a proper child widget, so it'll receive this event,
-- and attempt to free its resources accordingly.
-- But, if it didn't have to touch the original BB (self.image) passed to ImageViewer (e.g., no scaling needed),
-- it will *re-use* self.image, and flag it as non-disposable, meaning it will not have been free'd earlier.
-- it will *reuse* self.image, and flag it as non-disposable, meaning it will not have been free'd earlier.
-- Since we're the ones who ultimately truly know whether we should dispose of self.image or not, do that now ;).
if self.image and self.image_disposable and self.image.free then
logger.dbg("ImageViewer:onCloseWidget: free self.image", self.image)
+4 -4
View File
@@ -284,7 +284,7 @@ function ImageWidget:_render()
-- we get corrupted images when using it for scaling such blitbuffers.
-- We need to make a real new blitbuffer with rotated content:
local rot_bb = self._bb:rotatedCopy(self.rotation_angle)
-- We made a new blitbuffer, we need to explicitely free
-- We made a new blitbuffer, we need to explicitly free
-- the old one to not leak memory
if self._bb_disposable then
self._bb:free()
@@ -330,7 +330,7 @@ function ImageWidget:_render()
-- replace blitbuffer with a resized one if needed
if self.scale_factor == nil then
-- no scaling, but strech to width and height, only if provided and needed
-- no scaling, but stretch to width and height, only if provided and needed
if self.width and self.height and (self.width ~= bb_w or self.height ~= bb_h) then
logger.dbg("ImageWidget: stretching")
self._bb = RenderImage:scaleBlitBuffer(self._bb, self.width, self.height, self._bb_disposable)
@@ -583,7 +583,7 @@ function ImageWidget:paintTo(bb, x, y)
-- In night mode, invert all rendered images, so the original is
-- displayed when the whole screen is inverted by night mode.
-- Except for our *black & white* icons: we do *NOT* want to invert them again:
-- they should match the UI's text/backgound.
-- they should match the UI's text/background.
--- @note: As for *color* icons, we really *ought* to invert them here,
--- but we currently don't, as we don't really trickle down
--- a way to discriminate them from the B&W ones.
@@ -594,7 +594,7 @@ function ImageWidget:paintTo(bb, x, y)
end
-- This will normally be called by our WidgetContainer:free()
-- But it SHOULD explicitely be called if we are getting replaced
-- But it SHOULD explicitly be called if we are getting replaced
-- (ie: in some other widget's update()), to not leak memory with
-- BlitBuffer zombies
function ImageWidget:free()
+1 -1
View File
@@ -11,7 +11,7 @@ Example:
local sample
sample = InfoMessage:new{
text = _("Some message"),
-- Usually the hight of a InfoMessage is self-adaptive. If this field is actively set, a
-- Usually the height of a InfoMessage is self-adaptive. If this field is actively set, a
-- scrollbar may be shown. This variable is usually helpful to display a large chunk of text
-- which may exceed the height of the screen.
height = Screen:scaleBySize(400),
+1 -1
View File
@@ -60,7 +60,7 @@ To add |Save|Close| buttons, use:
-- Stuff to do when InputDialog is closed, if anything.
)
end
return nil -- sucess, default notification shown
return nil -- success, default notification shown
return true, success_notif_text
return false, error_infomsg_text
end
+1 -1
View File
@@ -633,7 +633,7 @@ function InputText:onKeyPress(key)
elseif key["Right"] then
self:rightChar()
-- NOTE: When we are not showing the virtual keyboard, let focusmanger handle up/down keys, as they are used to directly move around the widget
-- seemlessly in and out of text fields and onto virtual buttons like `[cancel] [search dict]`, no need to unfocus first.
-- seamlessly in and out of text fields and onto virtual buttons like `[cancel] [search dict]`, no need to unfocus first.
elseif key["Up"] and G_reader_settings:nilOrTrue("virtual_keyboard_enabled") then
self:upLine()
elseif key["Down"] and G_reader_settings:nilOrTrue("virtual_keyboard_enabled") then
+2 -2
View File
@@ -286,8 +286,8 @@ local KeyValuePage = FocusManager:extend{
values_lang = nil,
-- index for the first item to show
show_page = 1,
-- aligment of value when key or value overflows its reserved width (for
-- now: 50%): "left" (stick to key), "right" (stick to scren right border)
-- alignment of value when key or value overflows its reserved width (for
-- now: 50%): "left" (stick to key), "right" (stick to screen's right border)
value_overflow_align = "left",
single_page = nil, -- show all items on one single page (and make them small)
title_bar_align = "left",
+1 -1
View File
@@ -51,7 +51,7 @@ local ListView = InputContainer:extend{
height = nil,
padding = nil,
item_height = nil,
itmes = nil,
items = nil,
}
function ListView:init()
+3 -3
View File
@@ -1149,7 +1149,7 @@ function Menu:mergeTitleBarIntoLayout()
end
--[[
the itemnumber paramter determines menu page number after switching item table
the itemnumber parameter determines menu page number after switching item table
1. itemnumber >= 0
the page number is calculated with items per page
2. itemnumber == nil
@@ -1492,10 +1492,10 @@ function Menu:setTitleBarLeftIcon(icon)
self.title_bar:setLeftIcon(icon)
end
function Menu:onLeftButtonTap() -- to be overriden and implemented by the caller
function Menu:onLeftButtonTap() -- to be overridden and implemented by the caller
end
function Menu:onLeftButtonHold() -- to be overriden and implemented by the caller
function Menu:onLeftButtonHold() -- to be overridden and implemented by the caller
end
function Menu:getFirstVisibleItemIndex()
+5 -5
View File
@@ -240,7 +240,7 @@ function PageBrowserWidget:updateLayout()
-- which should span over the page slots that get their thumbnails shown.
self.view_finder_r = Size.radius.window
self.view_finder_bw = Size.border.default
-- Have its top border noticable above the BookMapRow top border
-- Have its top border noticeable above the BookMapRow top border
self.view_finder_y = self.dimen.h - self.row_height - 2*self.view_finder_bw
-- And put its bottom rounded corner outside of screen
self.view_finder_h = self.row_height + 2*self.view_finder_bw + Size.radius.window
@@ -678,7 +678,7 @@ function PageBrowserWidget:paintTo(bb, x, y)
-- bb:paintRect(r.x, r.y, r.w, r.h, Blitbuffer.COLOR_GRAY_5)
-- But we prefer them translucent, so we can draw them over chapter spans
-- without getting bothered too much by them (alpha=0.3 feels fine).
-- Only hatchRect() currently supports paiting with alpha,
-- Only hatchRect() currently supports painting with alpha,
-- so use it to fill our rectangle by using a larger stripe_width
-- so it is fully filled.
bb:hatchRect(r.x, r.y, r.w, r.h, r.h, Blitbuffer.COLOR_BLACK, 0.3)
@@ -687,7 +687,7 @@ function PageBrowserWidget:paintTo(bb, x, y)
-- If we would prefer to see the BookMapRow top border always take the full width
-- so it acts as a separator from the thumbnail grid, add this:
-- bb:paintRect(0, self.dimen.h - self.row_height, self.dimen.w, BookMapRow.pages_frame_border, Blitbuffer.COLOR_BLACK)
-- And explicitely paint our viewfinder over the BookMapRow
-- And explicitly paint our viewfinder over the BookMapRow
bb:paintBorder(self.view_finder_x, self.view_finder_y, self.view_finder_w, self.view_finder_h,
self.view_finder_bw, Blitbuffer.COLOR_BLACK, self.view_finder_r)
end
@@ -1079,7 +1079,7 @@ function PageBrowserWidget:onClose(close_all_parents)
-- with the current size to be available)
self.ui.thumbnail:tidyCache()
-- Force a GC to free the memory used by the widgets and tiles
-- (delay it a bit so this pause is less noticable)
-- (delay it a bit so this pause is less noticeable)
UIManager:scheduleIn(0.5, function()
collectgarbage()
collectgarbage()
@@ -1465,7 +1465,7 @@ function PageBrowserWidget:onHold(arg, ges)
-- our current focus_page to help locating where we were (it's
-- quite more complicated to draw a rounded rectangle around
-- multiple pages to figure our view finder, as these pages
-- may be splitted onto multiple BookMapRows...)
-- may be split onto multiple BookMapRows...)
if ges.pos.y > Screen:getHeight() - self.row_height then
local page = self.row[1]:getPageAtX(ges.pos.x)
if page then
+1 -1
View File
@@ -60,7 +60,7 @@ function SpinWidget:init()
self.screen_height = Screen:getHeight()
if not self.width then
if not self.width_factor then
self.width_factor = 0.6 -- default if no width speficied
self.width_factor = 0.6 -- default if no width specified
end
self.width = math.floor(math.min(self.screen_width, self.screen_height) * self.width_factor)
end
+13 -13
View File
@@ -41,8 +41,8 @@ local TextBoxWidget = InputContainer:extend{
alignment = "left", -- or "center", "right"
dialog = nil, -- parent dialog that will be set dirty
face = nil,
bold = nil, -- use bold=true to use a real bold font (or synthetized if not available),
-- or bold=Font.FORCE_SYNTHETIZED_BOLD to force using synthetized bold,
bold = nil, -- use bold=true to use a real bold font (or synthesized if not available),
-- or bold=Font.FORCE_SYNTHETIZED_BOLD to force using synthesized bold,
-- which, with XText, makes a bold string the same width as it non-bolded.
line_height = 0.3, -- in em
fgcolor = Blitbuffer.COLOR_BLACK,
@@ -101,7 +101,7 @@ local TextBoxWidget = InputContainer:extend{
auto_para_direction = false, -- detect direction of each paragraph in text
-- (para_direction_rtl or UI language is then only
-- used as a weak hint about direction)
alignment_strict = false, -- true to force the alignemnt set by the alignment= attribute.
alignment_strict = false, -- true to force the alignment set by the alignment= attribute.
-- When false, specified alignment is inverted when para direction is RTL
tabstop_nb_space_width = 8, -- unscaled_size_check: ignore
-- width of tabstops, as a factor of the width of a space
@@ -404,11 +404,11 @@ function TextBoxWidget:_splitToLines()
end
self.vertical_string_list[ln] = line
if line.no_allowed_break_met then
-- let the fact a long word was splitted be known
-- let the fact a long word was split be known
self.has_split_inside_word = true
end
if line.hard_newline_at_eot and not line.next_start_offset then
-- Add an empty line to reprensent the \n at end of text
-- Add an empty line to represent the \n at end of text
-- and allow positioning cursor after it
self.vertical_string_list[ln+1] = {
offset = size+1,
@@ -460,7 +460,7 @@ function TextBoxWidget:_splitToLines()
-- either a very long english word occupying more than one line,
-- or the excessive char is itself splittable:
-- we let that excessive char for next line
if adjusted_idx == offset then -- let the fact a long word was splitted be known
if adjusted_idx == offset then -- let the fact a long word was split be known
self.has_split_inside_word = true
end
end_offset = idx - 1
@@ -479,7 +479,7 @@ function TextBoxWidget:_splitToLines()
idx = adjusted_idx + 1
end
if self.justified then
-- this line was splitted and can be justified
-- this line was split and can be justified
-- we record in idx_pad the nb of pixels to add to each char
-- to make the whole line justified. This also helps hold
-- position accuracy.
@@ -856,7 +856,7 @@ function TextBoxWidget:_renderText(start_row_idx, end_row_idx)
if self.line_with_ellipsis and i == self.line_with_ellipsis and not line.ellipsis_added then
-- Requested to add an ellipsis on this line
local ellipsis_width = RenderText:getEllipsisWidth(self.face)
-- no bold: xtext does synthetized bold with normal metrics
-- no bold: xtext does synthesized bold with normal metrics
line.width = line.width + ellipsis_width
if line.width > line.targeted_width then
-- The ellipsis would overflow: we need to re-makeLine()
@@ -1241,7 +1241,7 @@ function TextBoxWidget:free(full)
if full ~= false then -- final free(): free all remaining resources
if self.use_xtext and self._xtext then
-- Allow not waiting until Lua gc() to cleanup C XText malloc'ed stuff
-- (we should not free it if full=false as it is re-usable across renderings)
-- (we should not free it if full=false as it is reusable across renderings)
self._xtext:free()
self._xtext = nil
-- logger.dbg("TextBoxWidget:_xtext:free()")
@@ -1674,7 +1674,7 @@ function TextBoxWidget:moveCursorToCharPos(charpos)
-- needs to deal with possible overflow ?
y = y - scroll_lines * self.line_height_px
end
-- We can also get x ouside current view, when a line takes the full width
-- We can also get x outside current view, when a line takes the full width
-- (which happens when text is justified): move the cursor a bit to the left
-- (it will be drawn over the right of the last glyph, which should be ok.)
if x > self.width - self.cursor_line.dimen.w then
@@ -1711,7 +1711,7 @@ function TextBoxWidget:moveCursorToCharPos(charpos)
self._bb:blitFrom(self.cursor_restore_bb, self.cursor_restore_x, self.cursor_restore_y,
0, 0, self.cursor_line.dimen.w, self.cursor_line.dimen.h)
-- remember current values for use in the setDirty funcs, as
-- we will have overriden them when these are called
-- we will have overridden them when these are called
restore_x = self.cursor_restore_x
restore_y = self.cursor_restore_y
if not CURSOR_COMBINE_REGIONS then
@@ -1939,7 +1939,7 @@ function TextBoxWidget:onHoldWord(callback, ges)
local words = util.splitToWords(self:_getLineText(line))
local probe_idx = char_start
for _, w in ipairs(words) do
-- +1 for word separtor
-- +1 for word separator
probe_idx = probe_idx + #util.splitToChars(w)
if idx <= probe_idx - 1 then
callback(w)
@@ -2024,7 +2024,7 @@ function TextBoxWidget:onHoldReleaseText(callback, ges)
local ImageViewer = require("ui/widget/imageviewer")
local imgviewer = ImageViewer:new{
image = image.hi_bb or image.bb, -- fallback to low-res if high-res failed
image_disposable = false, -- we may re-use our bb if called again
image_disposable = false, -- we may reuse our bb if called again
with_title_bar = true,
title_text = image.title,
caption = image.caption,
+3 -3
View File
@@ -27,8 +27,8 @@ local xtext -- Delayed (and optional) loading
local TextWidget = Widget:extend{
text = nil,
face = nil,
bold = false, -- use bold=true to use a real bold font (or synthetized if not available),
-- or bold=Font.FORCE_SYNTHETIZED_BOLD to force using synthetized bold,
bold = false, -- use bold=true to use a real bold font (or synthesized if not available),
-- or bold=Font.FORCE_SYNTHETIZED_BOLD to force using synthesized bold,
-- which, with XText, makes a bold string the same width as it non-bolded.
fgcolor = Blitbuffer.COLOR_BLACK,
padding = Size.padding.small, -- vertical padding (should it be function of face.size ?)
@@ -212,7 +212,7 @@ function TextWidget:_measureWithXText()
-- a TextWidget, with use_xtext, to have it compute the width of
-- the ellipsis, and then cache this width in the font table.)
reserved_width = RenderText:getEllipsisWidth(self.face)
-- no bold: xtext does synthetized bold with normal metrics
-- no bold: xtext does synthesized bold with normal metrics
end
local max_width = self.max_width - reserved_width
if max_width <= 0 then -- avoid _xtext:makeLine() crash
+3 -3
View File
@@ -30,7 +30,7 @@ local TitleBar = OverlapGroup:extend{
title_face = nil, -- if not provided, one of these will be used:
title_face_fullscreen = Font:getFace("smalltfont"),
title_face_not_fullscreen = Font:getFace("x_smalltfont"),
-- by default: single line, truncated if overflow -- the default could be made dependant on self.fullscreen
-- by default: single line, truncated if overflow -- the default could be made dependent on self.fullscreen
title_multilines = false, -- multilines if overflow
title_shrink_font_to_fit = false, -- reduce font size so that single line text fits
@@ -159,7 +159,7 @@ function TitleBar:init()
-- We're with title_shrink_font_to_fit and in the first :init():
-- we don't want to go on measuring with this too long text.
-- We want metrics proper for when text fits, so if later :setTitle()
-- is called with a text that fits, this text will look allright.
-- is called with a text that fits, this text will look alright.
-- Longer title with a smaller font size should be laid out on the
-- baseline of a fitted text.
-- So, go on computing sizes with an empty title. When all is
@@ -224,7 +224,7 @@ function TitleBar:init()
}
end
end
-- To debug vertical positionning:
-- To debug vertical positioning:
-- local FrameContainer = require("ui/widget/container/framecontainer")
-- self.title_widget = FrameContainer:new{ padding=0, margin=0, bordersize=1, self.title_widget}
-- self.subtitle_widget = FrameContainer:new{ padding=0, margin=0, bordersize=1, self.subtitle_widget}
+5 -5
View File
@@ -304,10 +304,10 @@ function TouchMenuBar:init()
self.bar_icon_group = HorizontalGroup:new{}
-- build up image widget for menu icon bar
self.icon_widgets = {}
-- hold icon seperators
-- hold icon separators
self.icon_seps = {}
-- the start_seg for first icon_widget should be 0
-- we asign negative here to offset it in the loop
-- we assign negative here to offset it in the loop
local start_seg = -icon_sep_width
local end_seg = start_seg
-- self.width is the screen width
@@ -784,7 +784,7 @@ function TouchMenu:switchMenuTab(tab_num)
self.tab_item_table[tab_num].callback()
end
-- It's like getting a new menu everytime we switch tab!
-- It's like getting a new menu every time we switch tab!
-- Also, switching to the _same_ tab resets the stack and takes us back to
-- the top of the menu tree
self.page = 1
@@ -1092,7 +1092,7 @@ function TouchMenu:openMenu(path, with_animation)
local function walkStep()
walkStep_scheduled = false
-- Default delay if not overriden (-1 means no scheduleIn() so no refresh, 0 means nextTick)
-- Default delay if not overridden (-1 means no scheduleIn() so no refresh, 0 means nextTick)
local next_delay = with_animation and 1 or -1
if step == STEPS.START then
-- Ensure some initial delay so search dialog and result list can be closed and refreshed
@@ -1224,7 +1224,7 @@ function TouchMenu:openMenu(path, with_animation)
end,
resend_event = not with_animation, -- if not animation, don't eat the tap
}
UIManager:show(trap_widget) -- catch taps during animaton
UIManager:show(trap_widget) -- catch taps during animation
-- Call it: it will reschedule itself if animation; if not, it will
-- just execute itself without pause until done.
+1 -1
View File
@@ -117,7 +117,7 @@ function TrapWidget:_dismissAndResend(evtype, ev)
-- There may be some timing issues that could cause crashes, as we
-- use nextTick, if the dismiss_callback uses UIManager:scheduleIn()
-- or has set up some widget that may catch that event while not being
-- yet fully initialiazed.
-- yet fully initialized.
-- (It happened mostly when I had some bug somewhere, and it was a quite
-- reliable sign of a bug somewhere, but the stacktrace was unrelated
-- to the bug location.)
+6 -6
View File
@@ -54,7 +54,7 @@ local Wikipedia = {
wiki_phtml_params = {
action = "parse",
format = "json",
-- we only need the following informations
-- we only need the following pieces of information
prop = "text|sections|displaytitle|revid",
-- page = nil, -- text to lookup, will be added below
-- disabletoc = "", -- if we want to remove toc IN html
@@ -67,7 +67,7 @@ local Wikipedia = {
wiki_images_params = { -- same as previous one, with just text html
action = "parse",
format = "json",
-- we only need the following informations
-- we only need the following pieces of information
prop = "text",
-- page = nil, -- text to lookup, will be added below
redirects = "",
@@ -346,7 +346,7 @@ function Wikipedia:getFullPageImages(wiki_title, lang)
end
local width = tonumber(timg:match([[width="([^"]*)"]]))
local height = tonumber(timg:match([[height="([^"]*)"]]))
-- Ignore img without width and height, which should exlude
-- Ignore img without width and height, which should exclude
-- javascript maps and other unsupported stuff
if width and height then
-- Images in the html we got seem to be x4.5 the size of
@@ -582,7 +582,7 @@ end
-- UTF8 of unicode geometrical shapes we'll prepend to wikipedia section headers,
-- to help identifying hierarchy (othewise, the small font size differences helps).
-- to help identifying hierarchy (otherwise, the small font size differences helps).
-- Best if identical to the ones used above for prettifying full plain text page.
-- These chosen ones are available in most fonts (prettier symbols
-- exist in unicode, but are available in a few fonts only) and
@@ -1417,7 +1417,7 @@ abbr.abbr {
-- crengine does not support the <math> family of tags for displaying formulas,
-- which results in lots of space taken by individual character in the formula,
-- each on a single line...
-- Also, usally, these <math> tags are followed by a <img> tag pointing to a
-- Also, usually, these <math> tags are followed by a <img> tag pointing to a
-- SVG version of the formula, that we took care earlier to change the url to
-- point to a PNG version of the formula (which is still not perfect, as it does
-- not adjust to the current html font size, but it is at least readable).
@@ -1442,7 +1442,7 @@ abbr.abbr {
end
html = html:gsub([[href="/wiki/([^"]*)"]], cleanWikiPageTitle)
-- Remove href from links to non existant wiki page so they are not clickable :
-- Remove href from links to nonexistent wiki page so they are not clickable :
-- <a href="/w/index.php?title=PageTitle&amp;action=edit&amp;redlink=1" class="new"
-- title="PageTitle">PageTitle____on</a>
-- (removal of the href="" will make them non clickable)
+1 -1
View File
@@ -22,7 +22,7 @@ ko_update_check() {
INSTALLED="${KOREADER_DIR}/ota/koreader.installed.tar"
if [ -f "${NEWUPDATE}" ]; then
# If button-listen service is running then stop it during update so that
# the update can overwite the binary
# the update can overwrite the binary
systemctl is-active --quiet button-listen
USING_BUTTON_LISTEN=$?
if [ ${USING_BUTTON_LISTEN} -eq 0 ]; then
+1 -1
View File
@@ -549,7 +549,7 @@ function AutoSuspend:addToMainMenu(menu_items)
keep_menu_open = true,
callback = function(touchmenu_instance)
-- 5*60 sec (5') is the minimum and 28*24*3600 (28days) is the maximum shutdown time.
-- Minimum time has to be big enough, to avoid start-stop death scenarious.
-- Minimum time has to be big enough, to avoid start-stop death scenarios.
-- Maximum more than four weeks seems a bit excessive if you want to enable authoshutdown,
-- even if the battery can last up to three months.
self:pickTimeoutValue(touchmenu_instance,
+2 -2
View File
@@ -110,7 +110,7 @@ function AutoWarmth:init()
i = j
end
-- schedule recalculation shortly afer midnight
-- schedule recalculation shortly after midnight
self:scheduleMidnightUpdate()
end
@@ -676,7 +676,7 @@ function AutoWarmth:getFlOffDuringDayMenu()
• off after sunrise and
• on before sunset.]],
ok_always_enabled = true,
-- read the saved setting, as this get's not overwritten by toggling easy_mode
-- read the saved setting, as this gets overwritten by toggling easy_mode
value = G_reader_settings:readSetting("autowarmth_fl_off_during_day_offset_s", 0) * (1/60),
value_min = -15,
value_max = 30,
+6 -6
View File
@@ -24,7 +24,7 @@ Maximal errors from 2020-2050 (compared to https://midcdmz.nrel.gov/spa/) are:
*) A few days around beginning of summer (error <290s)
**) A few days after and befor midnight sun (error <1200s)
**) A few days after and before midnight sun (error <1200s)
@usage
local SunTime = require("suntime")
@@ -45,7 +45,7 @@ Maximal errors from 2020-2050 (compared to https://midcdmz.nrel.gov/spa/) are:
@module suntime
--]]--
-- math abbrevations
-- math abbreviations
local pi = math.pi
local pi_2 = pi/2
@@ -131,7 +131,7 @@ function SunTime:getZglAdvanced()
end
-- set current date or year/month/day daylightsaving hh/mm/ss
-- if dst == nil use curent daylight saving of the system
-- if dst == nil use current daylight saving of the system
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
function SunTime:setDate(year, month, day, dst, hour, min, sec)
@@ -167,7 +167,7 @@ Set position for later calculations
@param longitude Geographical longitude, West is negative
@param time_zone Timezone e.g. CET = +1; if nil try to autodetect the current zone
@param altitude Altitude of the location above the sea level
@param degree if `nil` latitude and longitue are in radian, else in decimal degree
@param degree if `nil` latitude and longitude are in radian, else in decimal degree
--]]--
function SunTime:setPosition(name, latitude, longitude, time_zone, altitude, degree)
altitude = altitude or 200
@@ -442,7 +442,7 @@ function SunTime:calculateNoon(hour)
return hour + local_correction + aberration_time
end
end
else -- sourthern hemisphere
else -- southern hemisphere
if pi_2 + self.pos.latitude - self.decl > self.eod then
if self:getHeight(hour) > 0 then
return hour + local_correction + aberration_time
@@ -466,7 +466,7 @@ function SunTime:calculateMidnight(hour)
return hour + local_correction
end
end
else -- sourthern hemisphere
else -- southern hemisphere
if pi_2 + self.pos.latitude + self.decl > self.eod then
if self:getHeight(hour) < 0 then
return hour + local_correction
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/sh
# Starts the arguments as a bash command in background with low priorty. The
# Starts the arguments as a bash command in background with low priority. The
# command will be killed if it executes for over 1 hour. If the command failed
# to start, this script returns 127. If the command is timed out, this script
# returns 255. Otherwise the return value of the command will be returned.
@@ -115,7 +115,7 @@ local BOOKINFO_SELECT_SQL = "SELECT " .. table.concat(BOOKINFO_COLS_SET, ",") ..
"WHERE directory=? AND filename=? AND in_progress=0;"
local BOOKINFO_IN_PROGRESS_SQL = "SELECT in_progress, filename, unsupported FROM bookinfo WHERE directory=? AND filename=?;"
-- We need these _ litterals for them to be made available to translators. the english "string" is
-- We need these _ literals for them to be made available to translators. the english "string" is
-- what is inserted in the DB, and it will be translated only when read from the DB and displayed.
local UNSUPPORTED_REASONS = {
not_readable_by_engine = {
@@ -306,7 +306,7 @@ function BookInfoManager:saveSetting(key, value, db_conn, skip_reload)
value = "Y"
end
stmt:bind(key, value)
stmt:step() -- commited
stmt:step() -- committed
stmt:clearbind():reset() -- cleanup
-- Optionally, reload settings, so we may get (or not if it failed) what we just saved
@@ -465,7 +465,7 @@ function BookInfoManager:extractBookInfo(filepath, cover_specs)
for num, col in ipairs(BOOKINFO_COLS_SET) do
self.set_stmt:bind1(num, dbrow[col])
end
self.set_stmt:step() -- commited
self.set_stmt:step() -- committed
self.set_stmt:clearbind():reset() -- get ready for next query
if tried_enough then
return -- Last insert done for this book, we're giving up
@@ -566,7 +566,7 @@ function BookInfoManager:setBookInfoProperties(filepath, props)
v = nil
end
stmt:bind(v, directory, filename)
stmt:step() -- commited
stmt:step() -- committed
stmt:clearbind():reset() -- cleanup
end
end
@@ -577,7 +577,7 @@ function BookInfoManager:deleteBookInfo(filepath)
local query = "DELETE FROM bookinfo WHERE directory=? AND filename=?;"
local stmt = self.db_conn:prepare(query)
stmt:bind(directory, filename)
stmt:step() -- commited
stmt:step() -- committed
stmt:clearbind():reset() -- cleanup
end
@@ -599,7 +599,7 @@ function BookInfoManager:removeNonExistantEntries()
local stmt = self.db_conn:prepare(query)
for i=1, #bcids_to_remove do
stmt:bind(bcids_to_remove[i])
stmt:step() -- commited
stmt:step() -- committed
stmt:clearbind():reset() -- cleanup
end
return T(_("Removed %1 / %2 entries from cache."), #bcids_to_remove, #bcids)
@@ -702,7 +702,7 @@ function BookInfoManager:extractInBackground(files)
-- Run task in sub-process, and remember its pid
local task_pid = FFIUtil.runInSubProcess(task)
if not task_pid then
logger.warn("Failed lauching background extraction sub-process (fork failed)")
logger.warn("Failed launching background extraction sub-process (fork failed)")
return false -- let caller know it failed
end
-- No straight control flow exists for background task completion here, so we bump prevent
+5 -5
View File
@@ -10,9 +10,9 @@ local BookInfoManager = require("bookinfomanager")
-- This is a kind of "base class" for both MosaicMenu and ListMenu.
-- It implements the common code shared by these, mostly the non-UI
-- work : the updating of items and the management of backgrouns jobs.
-- work : the updating of items and the management of background jobs.
--
-- Here are defined the common overriden methods of Menu:
-- Here the common overridden methods of Menu are defined:
-- :updateItems(select_number)
-- :onCloseWidget()
--
@@ -117,7 +117,7 @@ function CoverMenu:updateItems(select_number, no_recalculate_dimen)
-- when memory usage is already high
nb_drawings_since_last_collectgarbage = nb_drawings_since_last_collectgarbage + 1
if nb_drawings_since_last_collectgarbage >= NB_DRAWINGS_BETWEEN_COLLECTGARBAGE then
-- (delay it a bit so this pause is less noticable)
-- (delay it a bit so this pause is less noticeable)
UIManager:scheduleIn(0.2, function()
collectgarbage()
collectgarbage()
@@ -131,7 +131,7 @@ function CoverMenu:updateItems(select_number, no_recalculate_dimen)
-- Set the local variables with the things we know
-- These are used only by extractBooksInDirectory(), which should
-- use the cover_specs set for FileBrowser, and not those from History.
-- Hopefully, we get self.path=nil when called fro History
-- Hopefully, we get self.path=nil when called from History
if self.path then
current_path = self.path
current_cover_specs = self.cover_specs
@@ -490,7 +490,7 @@ function CoverMenu:onCloseWidget()
self.cover_info_cache = nil
-- Force garbage collecting when leaving too
-- (delay it a bit so this pause is less noticable)
-- (delay it a bit so this pause is less noticeable)
UIManager:scheduleIn(0.2, function()
collectgarbage()
collectgarbage()
+7 -7
View File
@@ -150,13 +150,13 @@ function ListMenuItem:init()
},
}
-- We now build the minimal widget container that won't change after udpate()
-- We now build the minimal widget container that won't change after update()
-- As done in MenuItem
-- for compatibility with keyboard navigation
-- (which does not seem to work well when multiple pages,
-- even with classic menu)
self.underline_h = 1 -- smaller than default (3) to not shift our vertical aligment
self.underline_h = 1 -- smaller than default (3) to not shift our vertical alignment
self._underline_container = UnderlineContainer:new{
vertical_align = "top",
padding = 0,
@@ -176,7 +176,7 @@ function ListMenuItem:init()
end
function ListMenuItem:update()
-- We will be a disctinctive widget whether we are a directory,
-- We will be a distinctive widget whether we are a directory,
-- a known file with image / without image, or a not yet known file
local widget
@@ -341,7 +341,7 @@ function ListMenuItem:update()
}
end
end
-- In case we got a blitbuffer and didnt use it (ignore_cover), free it
-- In case we got a blitbuffer and didn't use it (ignore_cover), free it
if bookinfo.cover_bb and not cover_bb_used then
bookinfo.cover_bb:free()
end
@@ -375,7 +375,7 @@ function ListMenuItem:update()
local filename_without_suffix, filetype = filemanagerutil.splitFileNameType(filename)
local fileinfo_str
if bookinfo._no_provider then
-- for unspported files: don't show extension on the right,
-- for unsupported files: don't show extension on the right,
-- keep it in filename
filename_without_suffix = filename
fileinfo_str = self.mandatory
@@ -489,7 +489,7 @@ function ListMenuItem:update()
-- whether to use or not title and authors
-- (We wrap each metadata text with BD.auto() to get for each of them
-- the text direction from the first strong character - which should
-- individually be the best thing, and additionnaly prevent shuffling
-- individually be the best thing, and additionally prevent shuffling
-- if concatenated.)
if self.do_filename_only or bookinfo.ignore_meta then
title = filename_without_suffix -- made out above
@@ -719,7 +719,7 @@ function ListMenuItem:update()
face = Font:getFace("cfont", fontsize_info),
fgcolor = fgcolor,
}
local wpageinfo = TextWidget:new{ -- Empty but needed for similar positionning
local wpageinfo = TextWidget:new{ -- Empty but needed for similar positioning
text = "",
face = Font:getFace("cfont", fontsize_info),
}
+3 -3
View File
@@ -546,7 +546,7 @@ end
function CoverBrowser:setupFileManagerDisplayMode(display_mode)
if not DISPLAY_MODES[display_mode] then
display_mode = nil -- unknow mode, fallback to classic
display_mode = nil -- unknown mode, fallback to classic
end
if init_done and display_mode == filemanager_display_mode then -- no change
return
@@ -677,7 +677,7 @@ end
function CoverBrowser:setupHistoryDisplayMode(display_mode)
if not DISPLAY_MODES[display_mode] then
display_mode = nil -- unknow mode, fallback to classic
display_mode = nil -- unknown mode, fallback to classic
end
if init_done and display_mode == history_display_mode then -- no change
return
@@ -756,7 +756,7 @@ end
function CoverBrowser:setupCollectionDisplayMode(display_mode)
if not DISPLAY_MODES[display_mode] then
display_mode = nil -- unknow mode, fallback to classic
display_mode = nil -- unknown mode, fallback to classic
end
if init_done and display_mode == collection_display_mode then -- no change
return
+7 -7
View File
@@ -154,7 +154,7 @@ function FakeCover:init()
if not authors and title and self.filename and self.filename:sub(1,title:len()) == title then
bd_wrap_title_as_filename = true
-- Replace a hyphen surrounded by spaces (which most probably was
-- used to separate Authors/Title/Serie/Year/Categorie in the
-- used to separate Authors/Title/Series/Year/Categories in the
-- filename with a \n
title = title:gsub(" %- ", "\n")
-- Same with |
@@ -165,9 +165,9 @@ function FakeCover:init()
-- can also have some meaning, so we can't just remove them.
-- But at least, make dots breakable (they wouldn't be if not
-- followed by a space), by adding to them a zero-width-space,
-- so the dots stay on the right of their preceeding word.
-- so the dots stay on the right of their preceding word.
title = title:gsub("%.", ".\u{200B}")
-- Except for a last dot near end of title that might preceed
-- Except for a last dot near end of title that might precede
-- a file extension: we'd rather want the dot and its suffix
-- together on a last line: so, move the zero-width-space
-- before it.
@@ -402,7 +402,7 @@ function MosaicMenuItem:init()
},
}
-- We now build the minimal widget container that won't change after udpate()
-- We now build the minimal widget container that won't change after update()
-- As done in MenuItem
-- for compatibility with keyboard navigation
@@ -434,7 +434,7 @@ function MosaicMenuItem:init()
end
function MosaicMenuItem:update()
-- We will be a disctinctive widget whether we are a directory,
-- We will be a distinctive widget whether we are a directory,
-- a known file with image / without image, or a not yet known file
local widget
@@ -665,7 +665,7 @@ function MosaicMenuItem:update()
}
}
end
-- In case we got a blitbuffer and didnt use it (ignore_cover, wikipedia), free it
-- In case we got a blitbuffer and didn't use it (ignore_cover, wikipedia), free it
if bookinfo.cover_bb and not cover_bb_used then
bookinfo.cover_bb:free()
end
@@ -901,7 +901,7 @@ function MosaicMenu:_recalculateDimen()
}
-- Create or replace corner_mark if needed
-- 1/12 (larger) or 1/16 (smaller) of cover looks allright
-- 1/12 (larger) or 1/16 (smaller) of cover looks alright
local mark_size = math.floor(math.min(self.item_width, self.item_height) / 8)
if mark_size ~= corner_mark_size then
corner_mark_size = mark_size
+1 -1
View File
@@ -35,7 +35,7 @@ local md5 = require("ffi/sha2").md5
local function isPathAllowed(path)
-- don't allow a path that interferes with frontent cache-framework; quick and dirty check
-- don't allow a path that interferes with frontend cache-framework; quick and dirty check
if not Device:isValidPath(path) then -- isValidPath expects a trailing slash
return false
+1 -1
View File
@@ -66,7 +66,7 @@ local function setupDebugFS()
if not found then
-- If we're not root, we won't be able to mount it
if C.getuid() ~= 0 then
logger.dbg("ExternalKeyboard: Cannot mount debugfs (unpriviledged user)")
logger.dbg("ExternalKeyboard: Cannot mount debugfs (unprivileged user)")
return false
end
+5 -5
View File
@@ -270,7 +270,7 @@ function HttpInspector:sendResponse(reqinfo, http_code, content_type, body)
table.insert(response, T("HTTP/1.0 %1 %2", http_code, HTTP_RESPONSE_CODE[http_code] or "Unspecified"))
-- If no content type provided, let the browser sniff it
if content_type then
-- Advertize all our text as being UTF-8
-- Advertise all our text as being UTF-8
local charset = ""
if util.stringStartsWith(content_type, "text/") then
charset = "; charset=utf-8"
@@ -669,7 +669,7 @@ function HttpInspector:exposeObject(obj, uri, reqinfo)
return self:sendResponse(reqinfo, 500, CTYPE.TEXT, json)
end
else
return self:sendResponse(reqinfo, 400, CTYPE.TEXT, "Invalid request: unexepected token after "..reqinfo.parsed_uri)
return self:sendResponse(reqinfo, 400, CTYPE.TEXT, "Invalid request: unexpected token after "..reqinfo.parsed_uri)
end
elseif obj_type == "function" then
@@ -715,7 +715,7 @@ function HttpInspector:exposeObject(obj, uri, reqinfo)
elseif (ftype == "=" or ftype == "?=") and fragment and uri then
-- 'property=value': assign value to property
-- 'property?=value': same, but output HTML allowing to get back to the parent
uri = fragment .. uri -- put back first frament into uri
uri = fragment .. uri -- put back first fragment into uri
local args, nb_args = getVariablesFromUri(uri)
if nb_args ~= 1 then
return self:sendResponse(reqinfo, 400, CTYPE.TEXT, "Variable assignment needs a single value")
@@ -744,7 +744,7 @@ function HttpInspector:exposeObject(obj, uri, reqinfo)
end
end
end
return self:sendResponse(reqinfo, 400, CTYPE.TEXT, "Unexepected request") -- luacheck: ignore 511
return self:sendResponse(reqinfo, 400, CTYPE.TEXT, "Unexpected request") -- luacheck: ignore 511
end
-- Send a HTML page describing all this object's key/values
@@ -817,7 +817,7 @@ function HttpInspector:browseObject(obj, reqinfo)
add_html(T(" <em>%1</em> instance", classinfo))
end
-- Keep track of names seen, so we can show these same names
-- in super classes lighter, as they are then overriden.
-- in super classes lighter, as they are then overridden.
local seen_names = {}
local seen_prefix = "<span style='opacity: 0.4'>"
local seen_suffix = "</span>"
+1 -1
View File
@@ -2,5 +2,5 @@ local _ = require("gettext")
return {
name = "kosync",
fullname = _("Progress sync"),
description = _([[Synchronizes your reading progess to a server across your KOReader devices.]]),
description = _([[Synchronizes your reading progress to a server across your KOReader devices.]]),
}
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff. Show more