Permalink
Browse files

added destination coordinates to index action table

  • Loading branch information...
1 parent a8ec8e9 commit a06af6fecc222be648197cbcbb5e52ab5521ea83 @karottenreibe committed Sep 5, 2011
Showing with 22 additions and 1 deletion.
  1. +22 −1 widgets/document/index.c
View
@@ -28,12 +28,33 @@ luaH_document_push_index(lua_State *L, PopplerIndexIter *iter)
int i = 1;
do {
PopplerAction *action = poppler_index_iter_get_action(iter);
- lua_createtable(L, 0, 2);
+ lua_createtable(L, 0, 3);
lua_pushstring(L, "title");
lua_pushstring(L, action->any.title);
lua_rawset(L, -3);
+ if (action->any.type == POPPLER_ACTION_GOTO_DEST) {
+ lua_pushstring(L, "destination");
+ lua_createtable(L, 0, 3);
+
+ lua_pushstring(L, "page");
+ lua_pushnumber(L, action->goto_dest.dest->page_num);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "x");
+ lua_pushnumber(L, action->goto_dest.dest->left);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "y");
+ lua_pushnumber(L, action->goto_dest.dest->top);
+ lua_rawset(L, -3);
+
+ lua_rawset(L, -3);
+ }
+
+ poppler_action_free(action);
+
lua_pushstring(L, "children");
PopplerIndexIter *child = poppler_index_iter_get_child(iter);
luaH_document_push_index(L, child);

0 comments on commit a06af6f

Please sign in to comment.