diff options
author | Paul Gardiner <paul@glidos.net> | 2012-05-15 13:20:10 +0100 |
---|---|---|
committer | Paul Gardiner <paul@glidos.net> | 2012-05-15 13:20:10 +0100 |
commit | 407e39962d537d7c9cc38110cf37c0b93f329d0e (patch) | |
tree | ad053699f8bc9b8a221f786819e20cafa98f92a4 /pdf | |
parent | 0b8667c0c3c85bf497b554bfa64375a13527cd1c (diff) | |
download | mupdf-407e39962d537d7c9cc38110cf37c0b93f329d0e.tar.xz |
Forms: make forms API separate to the main document API
This also provides a way to test whether interactive methods
are supported.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/mupdf-internal.h | 8 | ||||
-rw-r--r-- | pdf/mupdf.h | 19 | ||||
-rw-r--r-- | pdf/pdf_xref.c | 23 |
3 files changed, 15 insertions, 35 deletions
diff --git a/pdf/mupdf-internal.h b/pdf/mupdf-internal.h index 4217be48..f5f6c69c 100644 --- a/pdf/mupdf-internal.h +++ b/pdf/mupdf-internal.h @@ -562,12 +562,18 @@ void pdf_run_glyph(pdf_document *doc, pdf_obj *resources, fz_buffer *contents, f /* * PDF interface to store */ - void pdf_store_item(fz_context *ctx, pdf_obj *key, void *val, unsigned int itemsize); void *pdf_find_item(fz_context *ctx, fz_store_free_fn *free, pdf_obj *key); void pdf_remove_item(fz_context *ctx, fz_store_free_fn *free, pdf_obj *key); /* + * PDF interaction interface + */ +int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event); +fz_rect *pdf_get_screen_update(pdf_document *doc); +fz_widget *pdf_get_focussed_widget(pdf_document *doc); + +/* * Javascript handler */ pdf_js *pdf_new_js(pdf_document *doc); diff --git a/pdf/mupdf.h b/pdf/mupdf.h index e257dd5a..07bfa12d 100644 --- a/pdf/mupdf.h +++ b/pdf/mupdf.h @@ -216,23 +216,4 @@ void pdf_run_page(pdf_document *doc, pdf_page *page, fz_device *dev, fz_matrix c void pdf_run_page_with_usage(pdf_document *doc, pdf_page *page, fz_device *dev, fz_matrix ctm, char *event, fz_cookie *cookie); -/* - pdf_pass_event: pass a UI event to a page. - - The event may activate or focus a form field. -*/ -int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event); - -/* - pdf_get_screen_update: return areas needing updating because of - appearance change. -*/ -fz_rect *pdf_get_screen_update(pdf_document *doc); - -/* - pdf_get_focussed_widget: return the currently focussed form field, - if any. -*/ -fz_widget *pdf_get_focussed_widget(pdf_document *doc); - #endif diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 82407b80..cd15051c 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -1285,19 +1285,14 @@ static int pdf_meta(fz_document *doc_, int key, void *ptr, int size) } } -static int pdf_pass_event_shim(fz_document *doc, fz_page *page, fz_ui_event *ui_event) +static fz_interactive *pdf_interact_shim(fz_document *doc) { - return pdf_pass_event((pdf_document*)doc, (pdf_page*)page, ui_event); -} - -static fz_rect *pdf_get_screen_update_shim(fz_document *doc) -{ - return pdf_get_screen_update((pdf_document*)doc); -} - -static fz_widget *pdf_get_focussed_widget_shim(fz_document *doc) -{ - return pdf_get_focussed_widget((pdf_document*)doc); + /* + Currently pdf is the only supporter of interaction, + so no need for indirecting interaction through + function pointers. + */ + return (fz_interactive *)doc; } static void @@ -1314,7 +1309,5 @@ pdf_init_document(pdf_document *doc) doc->super.run_page = pdf_run_page_shim; doc->super.free_page = pdf_free_page_shim; doc->super.meta = pdf_meta; - doc->super.pass_event = pdf_pass_event_shim; - doc->super.get_screen_update = pdf_get_screen_update_shim; - doc->super.get_focussed_widget = pdf_get_focussed_widget_shim; + doc->super.interact = pdf_interact_shim; } |