Merge branch 'new_ui_code' of https://github.com/hwhw/kindlepdfviewer into new_ui_code

pull/2/merge
clenton 11 years ago
commit cc8e58afd0

@ -329,6 +329,7 @@ static int addblitToBuffer(lua_State *L) {
int yoffs = luaL_checkint(L, 6);
int w = luaL_checkint(L, 7);
int h = luaL_checkint(L, 8);
double p = luaL_checknumber(L, 9);
int x, y;
uint8_t *dstptr;
@ -349,7 +350,7 @@ static int addblitToBuffer(lua_State *L) {
for(y = 0; y < h; y++) {
ASSERT_BLITBUFFER_BOUNDARIES(dst, dstptr);
ASSERT_BLITBUFFER_BOUNDARIES(src, srcptr);
uint8_t v = (*dstptr & 0x0F) + (*srcptr & 0x0F);
uint8_t v = (int)((*dstptr & 0x0F)*(1-p) + (*srcptr & 0x0F)*p);
*dstptr = (*dstptr & 0xF0) | (v < 0x0F ? v : 0x0F);
dstptr += dst->pitch;
srcptr += src->pitch;
@ -358,7 +359,7 @@ static int addblitToBuffer(lua_State *L) {
for(y = 0; y < h; y++) {
ASSERT_BLITBUFFER_BOUNDARIES(dst, dstptr);
ASSERT_BLITBUFFER_BOUNDARIES(src, srcptr);
uint8_t v = (*dstptr & 0x0F) + (*srcptr >> 4);
uint8_t v = (int)((*dstptr & 0x0F)*(1-p) + (*srcptr >> 4)*p);
*dstptr = (*dstptr & 0xF0) | (v < 0x0F ? v : 0x0F);
dstptr += dst->pitch;
srcptr += src->pitch;
@ -381,14 +382,14 @@ static int addblitToBuffer(lua_State *L) {
for(x = 0; x < (w / 2); x++) {
ASSERT_BLITBUFFER_BOUNDARIES(dst, dstptr);
ASSERT_BLITBUFFER_BOUNDARIES(src, srcptr);
uint16_t v1 = (dstptr[x] & 0xF0) + ((srcptr[x] & 0x0F) << 4);
uint8_t v2 = (dstptr[x] & 0x0F) + (srcptr[x+1] >> 4);
uint16_t v1 = (int)((dstptr[x] & 0xF0)*(1-p) + ((srcptr[x] & 0x0F) << 4)*p);
uint8_t v2 = (int)((dstptr[x] & 0x0F)*(1-p) + (srcptr[x+1] >> 4)*p);
dstptr[x] = (v1 < 0xF0 ? v1 : 0xF0) | (v2 < 0x0F ? v2 : 0x0F);
}
if(w & 1) {
ASSERT_BLITBUFFER_BOUNDARIES(dst, dstptr);
ASSERT_BLITBUFFER_BOUNDARIES(src, srcptr);
uint16_t v1 = (dstptr[x] & 0xF0) + ((srcptr[x] & 0x0F) << 4);
uint16_t v1 = (int)((dstptr[x] & 0xF0)*(1-p) + ((srcptr[x] & 0x0F) << 4)*p);
dstptr[x] = (dstptr[x] & 0x0F) | (v1 < 0xF0 ? v1 : 0xF0);
}
dstptr += dst->pitch;
@ -399,14 +400,14 @@ static int addblitToBuffer(lua_State *L) {
for(x = 0; x < (w / 2); x++) {
ASSERT_BLITBUFFER_BOUNDARIES(dst, dstptr);
ASSERT_BLITBUFFER_BOUNDARIES(src, srcptr);
uint16_t v1 = (dstptr[x] & 0xF0) + (srcptr[x] & 0xF0);
uint8_t v2 = (dstptr[x] & 0x0F) + (srcptr[x] & 0x0F);
uint16_t v1 = (int)((dstptr[x] & 0xF0)*(1-p) + (srcptr[x] & 0xF0)*p);
uint8_t v2 = (int)((dstptr[x] & 0x0F)*(1-p) + (srcptr[x] & 0x0F)*p);
dstptr[x] = (v1 < 0xF0 ? v1 : 0xF0) | (v2 < 0x0F ? v2 : 0x0F);
}
if(w & 1) {
ASSERT_BLITBUFFER_BOUNDARIES(dst, dstptr);
ASSERT_BLITBUFFER_BOUNDARIES(src, srcptr);
uint16_t v1 = (dstptr[x] & 0xF0) + (srcptr[x] & 0xF0);
uint16_t v1 = (int)((dstptr[x] & 0xF0)*(1-p) + (srcptr[x] & 0xF0)*p);
dstptr[x] = (dstptr[x] & 0x0F) | (v1 < 0xF0 ? v1 : 0xF0);
}
dstptr += dst->pitch;

@ -224,87 +224,18 @@ end
this method handles both single and double tap
--]]
function GestureDetector:tapState(tev)
DEBUG("in tap state...")
DEBUG("in tap state...", tev)
local slot = tev.slot
if slot == 1 then
if tev.id == -1 and self.last_tevs[0] ~= nil then
if self:isTwoFingerTap(self.last_tevs[0], tev) then
local pos0 = Geom:new{
x = self.last_tevs[0].x,
y = self.last_tevs[0].y,
w = 0, h = 0,
}
local pos1 = Geom:new{
x = tev.x,
y = tev.y,
w = 0, h = 0,
}
local ges_ev = {
ges = "two_finger_tap",
span = pos0:distance(pos1),
time = tev.timev,
}
DEBUG("two-finger tap detected with span", pos0:distance(pos1))
self:clearState(0)
self:clearState(1)
return ges_ev
else
self:clearState(0)
self:clearState(1)
end
if tev.id == -1 then
return self:handleTwoFingerTap(tev)
else
return self:handleNonTap(tev)
end
elseif tev.id == -1 then
-- end of tap event
if self.last_tevs[slot] ~= nil then
local ges_ev = {
-- default to single tap
ges = "tap",
pos = Geom:new{
x = self.last_tevs[slot].x,
y = self.last_tevs[slot].y,
w = 0, h = 0,
},
time = tev.timev,
}
-- cur_tap is used for double tap detection
local cur_tap = {
x = tev.x,
y = tev.y,
timev = tev.timev,
}
if self.last_taps[slot] ~= nil and
self:isDoubleTap(self.last_taps[slot], cur_tap) then
-- it is a double tap
self:clearState(slot)
ges_ev.ges = "double_tap"
self.last_taps[slot] = nil
DEBUG("double tap detected in slot", slot)
return ges_ev
end
-- set current tap to last tap
self.last_taps[slot] = cur_tap
DEBUG("set up tap timer")
-- deadline should be calculated by adding current tap time and the interval
local deadline = cur_tap.timev + TimeVal:new{
sec = 0, usec = self.DOUBLE_TAP_INTERVAL,
}
Input:setTimeout(function()
DEBUG("in tap timer", self.last_taps[slot] ~= nil)
-- double tap will set last_tap to nil so if it is not, then
-- user must only tapped once
if self.last_taps[slot] ~= nil then
self.last_taps[slot] = nil
-- we are using closure here
DEBUG("single tap detected in slot", slot)
return ges_ev
end
end, deadline)
-- we are already at the end of touch event
-- so reset the state
self:clearState(slot)
return self:handleDoubleTap(tev)
else
-- last tev in this slot is cleared by last two finger tap
self:clearState(slot)
@ -318,7 +249,95 @@ function GestureDetector:tapState(tev)
time = tev.timev,
}
end
elseif self.states[slot] ~= self.tapState then
else
return self:handleNonTap(tev)
end
end
function GestureDetector:handleTwoFingerTap(tev)
if self.last_tevs[0] ~= nil and self:isTwoFingerTap(self.last_tevs[0], tev) then
local pos0 = Geom:new{
x = self.last_tevs[0].x,
y = self.last_tevs[0].y,
w = 0, h = 0,
}
local pos1 = Geom:new{
x = tev.x,
y = tev.y,
w = 0, h = 0,
}
local ges_ev = {
ges = "two_finger_tap",
pos = pos0,
span = pos0:distance(pos1),
time = tev.timev,
}
DEBUG("two-finger tap detected with span", pos0:distance(pos1))
self:clearState(0)
self:clearState(1)
return ges_ev
else
self:clearState(0)
self:clearState(1)
end
end
function GestureDetector:handleDoubleTap(tev)
local slot = tev.slot
local ges_ev = {
-- default to single tap
ges = "tap",
pos = Geom:new{
x = self.last_tevs[slot].x,
y = self.last_tevs[slot].y,
w = 0, h = 0,
},
time = tev.timev,
}
-- cur_tap is used for double tap detection
local cur_tap = {
x = tev.x,
y = tev.y,
timev = tev.timev,
}
if self.last_taps[slot] ~= nil and
self:isDoubleTap(self.last_taps[slot], cur_tap) then
-- it is a double tap
self:clearState(slot)
ges_ev.ges = "double_tap"
self.last_taps[slot] = nil
DEBUG("double tap detected in slot", slot)
return ges_ev
end
-- set current tap to last tap
self.last_taps[slot] = cur_tap
DEBUG("set up tap timer")
-- deadline should be calculated by adding current tap time and the interval
local deadline = cur_tap.timev + TimeVal:new{
sec = 0, usec = self.DOUBLE_TAP_INTERVAL,
}
Input:setTimeout(function()
DEBUG("in tap timer", self.last_taps[slot] ~= nil)
-- double tap will set last_tap to nil so if it is not, then
-- user must only tapped once
if self.last_taps[slot] ~= nil then
self.last_taps[slot] = nil
-- we are using closure here
DEBUG("single tap detected in slot", slot)
return ges_ev
end
end, deadline)
-- we are already at the end of touch event
-- so reset the state
self:clearState(slot)
end
function GestureDetector:handleNonTap(tev)
local slot = tev.slot
if self.states[slot] ~= self.tapState then
-- switched from other state, probably from initialState
-- we return nil in this case
self.states[slot] = self.tapState
@ -405,6 +424,10 @@ function GestureDetector:panState(tev)
y = self.last_tevs[slot].y,
w = 0, h = 0,
}
if self.detectings[0] and self.detectings[1] then
pan_ev.ges = "two_finger_pan"
DEBUG("two finger pan detected")
end
return pan_ev
end
end

@ -2,7 +2,6 @@ require "ui/widget/menu"
require "ui/widget/touchmenu"
ReaderMenu = InputContainer:new{
_name = "ReaderMenu",
tab_item_table = nil,
registered_widgets = {},
}
@ -66,7 +65,6 @@ function ReaderMenu:onShowMenu()
end
local menu_container = CenterContainer:new{
name = "haha",
ignore = "height",
dimen = Screen:getSize(),
}
@ -74,7 +72,8 @@ function ReaderMenu:onShowMenu()
local main_menu = nil
if Device:isTouchDevice() then
main_menu = TouchMenu:new{
name = "wocao",
name = "main_menu",
width = Screen:getWidth(),
tab_item_table = {
self.tab_item_table.navi,
self.tab_item_table.typeset,

@ -10,7 +10,7 @@ function ReaderScreenshot:init()
Screenshot = {
GestureRange:new{
ges = "two_finger_tap",
scale = {diagonal - scaleByDPI(80), diagonal},
scale = {diagonal - scaleByDPI(100), diagonal},
rate = 1.0,
}
},

@ -77,21 +77,25 @@ function ReaderToc:onShowToc()
end
end
local menu_container = CenterContainer:new{
dimen = Screen:getSize(),
}
local toc_menu = Menu:new{
title = "Table of Contents",
item_table = self.toc,
ui = self.ui,
width = Screen:getWidth()-20,
height = Screen:getHeight(),
show_parent = menu_container,
}
table.insert(menu_container, toc_menu)
function toc_menu:onMenuChoice(item)
self.ui:handleEvent(Event:new("PageUpdate", item.page))
end
local menu_container = CenterContainer:new{
dimen = Screen:getSize(),
toc_menu,
}
toc_menu.close_callback = function()
UIManager:close(menu_container)
end

@ -4,14 +4,16 @@ require "cache"
TODO: all these functions should probably be methods on Face objects
]]--
function getGlyph(face, charcode)
local hash = "glyph|"..face.hash.."|"..charcode
function getGlyph(face, charcode, bgcolor, fgcolor)
if bgcolor == nil then bgcolor = 0.0 end
if fgcolor == nil then fgcolor = 1.0 end
local hash = "glyph|"..face.hash.."|"..charcode.."|"..bgcolor.."|"..fgcolor
local glyph = Cache:check(hash)
if glyph then
-- cache hit
return glyph[1]
end
local rendered_glyph = face.ftface:renderGlyph(charcode)
local rendered_glyph = face.ftface:renderGlyph(charcode, bgcolor, fgcolor)
if not rendered_glyph then
DEBUG("error rendering glyph (charcode=", charcode, ") for face", face)
return
@ -75,7 +77,7 @@ function sizeUtf8Text(x, width, face, text, kerning)
return { x = pen_x, y_top = pen_y_top, y_bottom = pen_y_bottom}
end
function renderUtf8Text(buffer, x, y, face, text, kerning)
function renderUtf8Text(buffer, x, y, face, text, kerning, bgcolor, fgcolor)
if not text then
DEBUG("renderUtf8Text called without text");
return 0
@ -89,7 +91,7 @@ function renderUtf8Text(buffer, x, y, face, text, kerning)
for uchar in string.gfind(text, "([%z\1-\127\194-\244][\128-\191]*)") do
if pen_x < buffer_width then
local charcode = util.utf8charcode(uchar)
local glyph = getGlyph(face, charcode)
local glyph = getGlyph(face, charcode, bgcolor, fgcolor)
if kerning and (prevcharcode ~= 0) then
pen_x = pen_x + face.ftface:getKerning(prevcharcode, charcode)
end
@ -97,7 +99,7 @@ function renderUtf8Text(buffer, x, y, face, text, kerning)
glyph.bb,
x + pen_x + glyph.l, y - glyph.t,
0, 0,
glyph.bb:getWidth(), glyph.bb:getHeight())
glyph.bb:getWidth(), glyph.bb:getHeight(), 1)
pen_x = pen_x + glyph.ax
prevcharcode = charcode
end -- if pen_x < buffer_width

@ -21,11 +21,10 @@ function BBoxWidget:init()
range = self.view.dimen,
}
},
PanAdjust = {
SwipeAdjust = {
GestureRange:new{
ges = "pan",
ges = "swipe",
range = self.view.dimen,
rate = 3.0, -- emit up to 3 evs per second
}
},
HoldAdjust = {
@ -95,7 +94,7 @@ function BBoxWidget:inPageArea(ges)
return not ges.pos:notIntersectWith(page_dimen)
end
function BBoxWidget:adjustScreenBBox(ges)
function BBoxWidget:adjustScreenBBox(ges, relative)
--DEBUG("adjusting crop bbox with pos", ges.pos)
if not self:inPageArea(ges) then return end
local bbox = self.screen_bbox
@ -129,13 +128,53 @@ function BBoxWidget:adjustScreenBBox(ges)
upper_left.x = ges.pos.x
bottom_right.y = ges.pos.y
elseif nearest == upper_center then
upper_left.y = ges.pos.y
if relative then
local delta = 0
if ges.direction == "up" then
delta = -ges.distance / 5
elseif ges.direction == "down" then
delta = ges.distance / 5
end
upper_left.y = upper_left.y + delta
else
upper_left.y = ges.pos.y
end
elseif nearest == right_center then
bottom_right.x = ges.pos.x
if relative then
local delta = 0
if ges.direction == "left" then
delta = -ges.distance / 5
elseif ges.direction == "right" then
delta = ges.distance / 5
end
bottom_right.x = bottom_right.x + delta
else
bottom_right.x = ges.pos.x
end
elseif nearest == bottom_center then
bottom_right.y = ges.pos.y
if relative then
local delta = 0
if ges.direction == "up" then
delta = -ges.distance / 5
elseif ges.direction == "down" then
delta = ges.distance / 5
end
bottom_right.y = bottom_right.y + delta
else
bottom_right.y = ges.pos.y
end
elseif nearest == left_center then
upper_left.x = ges.pos.x
if relative then
local delta = 0
if ges.direction == "left" then
delta = -ges.distance / 5
elseif ges.direction == "right" then
delta = ges.distance / 5
end
upper_left.x = upper_left.x + delta
else
upper_left.x = ges.pos.x
end
end
self.screen_bbox = {
x0 = math.round(upper_left.x),
@ -156,8 +195,8 @@ function BBoxWidget:onTapAdjust(arg, ges)
return true
end
function BBoxWidget:onPanAdjust(arg, ges)
self:adjustScreenBBox(ges)
function BBoxWidget:onSwipeAdjust(arg, ges)
self:adjustScreenBBox(ges, true)
return true
end

@ -143,14 +143,6 @@ function RectSpan:getSize()
return {w = self.width, h = self.height}
end
ToggleLabel = TextWidget:new{}
function ToggleLabel:paintTo(bb, x, y)
if self.color == 0 then
return
end
renderUtf8Text(bb, x, y+self._height*0.75, self.face, self.text, true)
end
ConfigOption = CenterContainer:new{}
function ConfigOption:init()
local default_name_font_size = 20

@ -91,6 +91,7 @@ Widget that displays an item for menu
--]]
MenuItem = InputContainer:new{
text = nil,
show_parent = nil,
detail = nil,
face = Font:getFace("cfont", 22),
dimen = nil,
@ -188,7 +189,13 @@ function MenuItem:onShowItemDetail()
end
function MenuItem:onTapSelect()
self.menu:onMenuSelect(self.table)
self[1].invert = true
UIManager:setDirty(self.show_parent, "partial")
UIManager:scheduleIn(0.1, function()
self[1].invert = false
UIManager:setDirty(self.show_parent, "partial")
self.menu:onMenuSelect(self.table)
end)
return true
end
@ -197,6 +204,7 @@ end
Widget that displays menu
--]]
Menu = FocusManager:new{
show_parent = nil,
-- face for displaying item contents
cface = Font:getFace("cfont", 22),
-- face for menu title
@ -218,7 +226,7 @@ Menu = FocusManager:new{
"A", "S", "D", "F", "G", "H", "J", "K", "L", "Del",
"Z", "X", "C", "V", "B", "N", "M", ".", "Sym", "Enter",
},
item_table_stack = {},
item_table_stack = nil,
is_enable_shortcut = true,
item_dimen = nil,
@ -256,6 +264,8 @@ function Menu:_recalculateDimen()
end
function Menu:init()
self.show_parent = self.show_parent or self
self.item_table_stack = {}
self:_recalculateDimen()
self.page = 1
@ -388,6 +398,7 @@ function Menu:updateItems(select_number)
end
end
local item_tmp = MenuItem:new{
show_parent = self.show_parent,
text = self.item_table[i].text,
face = self.cface,
dimen = self.item_dimen:new(),

@ -1,11 +1,20 @@
ToggleSwitch = InputContainer:new{}
ToggleLabel = TextWidget:new{
bgcolor = 0,
fgcolor = 1,
}
function ToggleLabel:paintTo(bb, x, y)
renderUtf8Text(bb, x, y+self._height*0.75, self.face, self.text, true, self.bgcolor, self.fgcolor)
end
ToggleSwitch = InputContainer:new{
width = scaleByDPI(204),
height = scaleByDPI(30),
}
function ToggleSwitch:init()
self.n_pos = #self.toggle
if self.n_pos ~= 2 and self.n_pos ~= 3 then
-- currently only support options with two or three items.
error("items number not supported")
end
self.position = nil
local label_font_face = "cfont"
@ -14,55 +23,27 @@ function ToggleSwitch:init()
self.toggle_frame = FrameContainer:new{background = 0, color = 7, radius = 7, bordersize = 1, padding = 2,}
self.toggle_content = HorizontalGroup:new{}
self.left_label = ToggleLabel:new{
align = "center",
color = 0,
text = self.toggle[self.n_pos],
face = Font:getFace(label_font_face, label_font_size),
}
self.left_button = FrameContainer:new{
background = 0,
color = 7,
margin = 0,
radius = 5,
bordersize = 1,
padding = 2,
self.left_label,
}
self.middle_label = ToggleLabel:new{
align = "center",
color = 0,
text = self.n_pos > 2 and self.toggle[2] or "",
face = Font:getFace(label_font_face, label_font_size),
}
self.middle_button = FrameContainer:new{
background = 0,
color = 7,
margin = 0,
radius = 5,
bordersize = 1,
padding = 2,
self.middle_label,
}
self.right_label = ToggleLabel:new{
align = "center",
color = 0,
text = self.toggle[1],
face = Font:getFace(label_font_face, label_font_size),
}
self.right_button = FrameContainer:new{
background = 0,
color = 7,
margin = 0,
radius = 5,
bordersize = 1,
padding = 2,
self.right_label,
}
table.insert(self.toggle_content, self.left_button)
table.insert(self.toggle_content, self.middle_button)
table.insert(self.toggle_content, self.right_button)
for i=1,#self.toggle do
local label = ToggleLabel:new{
align = "center",
text = self.toggle[i],
face = Font:getFace(label_font_face, label_font_size),
}
local content = CenterContainer:new{
dimen = Geom:new{w = self.width/self.n_pos, h = self.height},
label,
}
local button = FrameContainer:new{
background = 0,
color = 7,
margin = 0,
radius = 5,
bordersize = 1,
padding = 0,
content,
}
table.insert(self.toggle_content, button)
end
self.toggle_frame[1] = self.toggle_content
self[1] = self.toggle_frame
@ -81,18 +62,20 @@ function ToggleSwitch:init()
end
function ToggleSwitch:update()
local left_pos = self.position == 1
local right_pos = self.position == self.n_pos
local middle_pos = not left_pos and not right_pos
self.left_label.color = right_pos and 15 or 0
self.left_button.color = left_pos and 7 or 0
self.left_button.background = left_pos and 7 or 0
self.middle_label.color = middle_pos and 15 or 0
self.middle_button.color = middle_pos and 0 or 0
self.middle_button.background = middle_pos and 0 or 0
self.right_label.color = left_pos and 15 or 0
self.right_button.color = right_pos and 7 or 0
self.right_button.background = right_pos and 7 or 0
local pos = self.position
for i=1,#self.toggle_content do
if pos == i then
self.toggle_content[i].color = 7
self.toggle_content[i].background = 7
self.toggle_content[i][1][1].bgcolor = 0.5
self.toggle_content[i][1][1].fgcolor = 0.0
else
self.toggle_content[i].color = 0
self.toggle_content[i].background = 0
self.toggle_content[i][1][1].bgcolor = 0.0
self.toggle_content[i][1][1].fgcolor = 1.0
end
end
end
function ToggleSwitch:setPosition(position)

@ -164,7 +164,7 @@ TouchMenu = InputContainer:new{
item_height = scaleByDPI(50),
bordersize = scaleByDPI(2),
padding = scaleByDPI(5),
width = Screen:getWidth(),
width = nil,
height = nil,
page = 1,
max_per_page = 10,
@ -316,6 +316,9 @@ function TouchMenu:updateItems()
end
function TouchMenu:switchMenuTab(tab_num)
if self.tab_item_table[tab_num].callback then
self.tab_item_table[tab_num].callback()
end
if self.cur_tab ~= tab_num then
-- it's like getting a new menu everytime we switch tab!
self.page = 1

@ -67,6 +67,8 @@ static int newFace(lua_State *L) {
static int renderGlyph(lua_State *L) {
KPVFace *face = (KPVFace*) luaL_checkudata(L, 1, "ft_face");
int ch = luaL_checkint(L, 2);
double bg = luaL_checknumber(L, 3);
double fg = luaL_checknumber(L, 4);
FT_Error error = FT_Load_Char(face->face, ch, FT_LOAD_RENDER);
if(error) {
return luaL_error(L, "freetype error");
@ -91,12 +93,13 @@ static int renderGlyph(lua_State *L) {
for(y = 0; y < h; y++) {
uint8_t *src = face->face->glyph->bitmap.buffer + y * face->face->glyph->bitmap.pitch;
for(x = 0; x < (w/2); x++) {
*dst = (src[0] & 0xF0) | (src[1] >> 4);
*dst = (int)(0xFF * bg - src[0] * (bg - fg)) & 0xF0 |
(int)(0xFF * bg - src[1] * (bg - fg)) >> 4;
src+=2;
dst++;
}
if(w & 1) {
*dst = *src & 0xF0;
*dst = (int)(0xFF * bg - *src * (bg - fg)) & 0xF0;
dst++;
}
}

@ -81,17 +81,20 @@ function HomeMenu:onTapShowMenu()
self.item_table = {}
self:setUpdateItemTable()
local menu_container = CenterContainer:new{
ignore = "height",
dimen = Screen:getSize(),
}
local home_menu = Menu:new{
show_parent = menu_container,
title = "Home menu",
item_table = self.item_table,
width = Screen:getWidth() - 100,
}
local menu_container = CenterContainer:new{
ignore = "height",
dimen = Screen:getSize(),
home_menu,
}
menu_container[1] = home_menu
home_menu.close_callback = function ()
UIManager:close(menu_container)
end
@ -121,7 +124,12 @@ end
function showHomePage(path)
local exclude_dirs = {"%.sdr$"}
local HomePage = InputContainer:new{
}
local FileManager = FileChooser:new{
show_parent = HomePage,
title = "FileManager",
path = path,
width = Screen:getWidth(),
@ -141,10 +149,8 @@ function showHomePage(path)
end
}
local HomePage = InputContainer:new{
FileManager,
HomeMenu,
}
table.insert(HomePage, FileManager)
table.insert(HomePage, HomeMenu)
function FileManager:onFileSelect(file)
showReader(file)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76.0106" height="76.0106" viewBox="0 0 76.01 76.01" enable-background="new 0 0 76.01 76.01" xml:space="preserve">
<path fill="#000000" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 23.7533,55.4244L 23.7533,52.2573L 23.7533,38.322L 22.1698,39.5889L 19.0026,34.8382L 38.0053,20.5862L 45.9231,26.5245L 45.9231,22.1698L 49.0902,21.3781L 49.0902,28.8999L 57.0079,34.8382L 53.8408,39.5889L 52.2573,38.322L 52.2573,52.2573L 52.2573,55.4244L 23.7533,55.4244 Z M 38.0053,26.9204L 26.9204,35.7883L 26.9204,52.2573L 33.2546,52.2573L 33.2546,42.756L 42.756,42.756L 42.756,52.2573L 49.0902,52.2573L 49.0902,35.7883L 38.0053,26.9204 Z "/>
</svg>

@ -178,6 +178,7 @@ readerwindow[1][1] = reader
touch_menu = TouchMenu:new{
title = "Document menu",
width = Screen:getWidth(),
tab_item_table = {
{
icon = "resources/icons/appbar.pokeball.png",
@ -239,6 +240,12 @@ touch_menu = TouchMenu:new{
callback = function()
end,
},
},
{
icon = "resources/icons/appbar.home.png",
callback = function()
DEBUG("hello world!")
end
}
},
}

Loading…
Cancel
Save