2012-04-15 00:28:48 +00:00
|
|
|
require "widget"
|
|
|
|
require "font"
|
|
|
|
|
|
|
|
InfoMessage = {
|
|
|
|
face = Font:getFace("infofont", 25)
|
|
|
|
}
|
|
|
|
|
2012-04-16 19:29:58 +00:00
|
|
|
function InfoMessage:show(text,refresh_mode)
|
2012-06-03 22:49:23 +00:00
|
|
|
Debug("# InfoMessage ", text, refresh_mode)
|
2012-04-15 00:28:48 +00:00
|
|
|
local dialog = CenterContainer:new({
|
|
|
|
dimen = { w = G_width, h = G_height },
|
|
|
|
FrameContainer:new({
|
|
|
|
margin = 2,
|
2012-04-15 00:34:09 +00:00
|
|
|
background = 0,
|
2012-04-15 00:28:48 +00:00
|
|
|
HorizontalGroup:new({
|
|
|
|
align = "center",
|
2012-04-16 21:02:28 +00:00
|
|
|
ImageWidget:new({
|
|
|
|
file = "resources/info-i.png"
|
|
|
|
}),
|
2012-04-15 00:28:48 +00:00
|
|
|
Widget:new({
|
|
|
|
dimen = { w = 10, h = 0 }
|
|
|
|
}),
|
|
|
|
TextWidget:new({
|
|
|
|
text = text,
|
|
|
|
face = Font:getFace("cfont", 30)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
dialog:paintTo(fb.bb, 0, 0)
|
|
|
|
dialog:free()
|
2012-04-16 19:29:58 +00:00
|
|
|
if refresh_mode ~= nil then
|
|
|
|
fb:refresh(refresh_mode)
|
|
|
|
end
|
2012-04-15 00:28:48 +00:00
|
|
|
end
|
2012-04-15 03:02:42 +00:00
|
|
|
|
|
|
|
function showInfoMsgWithDelay(text, msec, refresh_mode)
|
|
|
|
if not refresh_mode then refresh_mode = 0 end
|
|
|
|
Screen:saveCurrentBB()
|
|
|
|
|
|
|
|
InfoMessage:show(text)
|
|
|
|
fb:refresh(refresh_mode)
|
2012-04-16 16:27:26 +00:00
|
|
|
-- util.usleep(msec*1000)
|
2012-04-17 06:26:42 +00:00
|
|
|
|
|
|
|
-- eat the first key release event
|
|
|
|
local ev = input.waitForEvent()
|
|
|
|
adjustKeyEvents(ev)
|
|
|
|
repeat
|
|
|
|
ok = pcall( function()
|
|
|
|
ev = input.waitForEvent(msec*1000)
|
|
|
|
adjustKeyEvents(ev)
|
|
|
|
end)
|
|
|
|
until not ok or ev.value == EVENT_VALUE_KEY_PRESS
|
2012-04-15 03:02:42 +00:00
|
|
|
|
|
|
|
Screen:restoreFromSavedBB()
|
|
|
|
fb:refresh(refresh_mode)
|
|
|
|
end
|