mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
added cleanCache bound to C key in menu #80
This commit is contained in:
12
djvu.c
12
djvu.c
@@ -450,7 +450,7 @@ static int drawPage(lua_State *L) {
|
||||
static int getCacheSize(lua_State *L) {
|
||||
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
|
||||
unsigned long size = ddjvu_cache_get_size(doc->context);
|
||||
printf("ddjvu_cache_get_size = %d\n", size);
|
||||
printf("## ddjvu_cache_get_size = %d\n", size);
|
||||
lua_pushnumber(L, size);
|
||||
return 1;
|
||||
}
|
||||
@@ -458,11 +458,18 @@ static int getCacheSize(lua_State *L) {
|
||||
static int setCacheSize(lua_State *L) {
|
||||
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
|
||||
int size = luaL_checkint(L, 2);
|
||||
printf("ddjvu_cache_set_size = %d\n", size);
|
||||
printf("## ddjvu_cache_set_size = %d\n", size);
|
||||
ddjvu_cache_set_size(doc->context, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cleanCache(lua_State *L) {
|
||||
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
|
||||
printf("## ddjvu_cache_clear\n");
|
||||
ddjvu_cache_clear(doc->context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct luaL_Reg djvu_func[] = {
|
||||
{"openDocument", openDocument},
|
||||
{NULL, NULL}
|
||||
@@ -476,6 +483,7 @@ static const struct luaL_Reg djvudocument_meth[] = {
|
||||
{"close", closeDocument},
|
||||
{"getCacheSize", getCacheSize},
|
||||
{"setCacheSize", setCacheSize},
|
||||
{"cleanCache", cleanCache},
|
||||
{"__gc", closeDocument},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -140,6 +140,10 @@ function UniReader:setCacheSize(size)
|
||||
return
|
||||
end
|
||||
|
||||
function UniReader:cleanCache()
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--[ following are default methods ]--
|
||||
|
||||
@@ -827,6 +831,8 @@ function UniReader:showMenu()
|
||||
if ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_PRESS then
|
||||
if ev.code == KEY_BACK or ev.code == KEY_MENU then
|
||||
return
|
||||
elseif ev.code == KEY_C then
|
||||
self.doc:cleanCache()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user