diff options
author | Paul Gardiner <paulg.artifex@glidos.net> | 2012-08-02 15:49:47 +0100 |
---|---|---|
committer | Paul Gardiner <paulg.artifex@glidos.net> | 2012-08-02 16:04:57 +0100 |
commit | 5379fed0ece9cc51e124eb30d5e6486049f25c12 (patch) | |
tree | b23e7391788ffb086c996b50b2704e19ed1bdd4d | |
parent | 901f3ea1bb6ffc55f297a52b7b4c72138962a986 (diff) | |
download | mupdf-5379fed0ece9cc51e124eb30d5e6486049f25c12.tar.xz |
Forms: implement saving on 'S' key
-rw-r--r-- | apps/pdfapp.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c index bc47cf9a..2cf7e7b2 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -198,14 +198,35 @@ void pdfapp_close(pdfapp_t *app) fz_flush_warnings(app->ctx); } +static int pdfapp_save(pdfapp_t *app) +{ + char buf[PATH_MAX]; + + if (wingetsavepath(app, buf, PATH_MAX)) + { + fz_write_options opts; + + opts.do_ascii = 1; + opts.do_expand = 0; + opts.do_garbage = 1; + opts.do_linear = 0; + + fz_write_document(app->doc, buf, &opts); + + return 1; + } + else + { + return 0; + } +} + int pdfapp_preclose(pdfapp_t *app) { fz_interactive *idoc = fz_interact(app->doc); if (idoc && fz_has_unsaved_changes(idoc)) { - char buf[PATH_MAX]; - switch (winsavequery(app)) { case DISCARD: @@ -215,23 +236,7 @@ int pdfapp_preclose(pdfapp_t *app) return 0; case SAVE: - if (wingetsavepath(app, buf, PATH_MAX)) - { - fz_write_options opts; - - opts.do_ascii = 1; - opts.do_expand = 0; - opts.do_garbage = 1; - opts.do_linear = 0; - - fz_write_document(app->doc, buf, &opts); - - return 1; - } - else - { - return 0; - } + return pdfapp_save(app); } } @@ -964,6 +969,13 @@ void pdfapp_onkey(pdfapp_t *app, int c) break; /* + * Saving the file + */ + case 'S': + pdfapp_save(app); + break; + + /* * Reloading the file... */ |