diff options
author | Sebastian Rasmussen <sebras@hotmail.com> | 2010-06-16 14:49:26 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@hotmail.com> | 2010-06-16 14:49:26 +0200 |
commit | 415f030afeabba60c5eeb25d091b979324101e36 (patch) | |
tree | 33f2d7fea51e640a039be03923a876dc88121b9f | |
parent | cc098ffbfd88de6f186cdbb88242413eb17f5079 (diff) | |
download | mupdf-415f030afeabba60c5eeb25d091b979324101e36.tar.xz |
Allow bookmark commands in the viewer to take a number argument so you can store several bookmarks at once.
-rw-r--r-- | apps/pdfapp.c | 28 | ||||
-rw-r--r-- | apps/pdfapp.h | 1 |
2 files changed, 24 insertions, 5 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c index abde068b..f5467eb4 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -430,16 +430,34 @@ void pdfapp_onkey(pdfapp_t *app, int c) break; case 'm': - if (app->histlen + 1 == 256) + if (app->numberlen > 0) { - memmove(app->hist, app->hist + 1, sizeof(int) * 255); - app->histlen --; + int idx = atoi(app->number); + + if (idx >= 0 && idx < nelem(app->marks)) + app->marks[idx] = app->pageno; + } + else + { + if (app->histlen + 1 == 256) + { + memmove(app->hist, app->hist + 1, sizeof(int) * 255); + app->histlen --; + } + app->hist[app->histlen++] = app->pageno; } - app->hist[app->histlen++] = app->pageno; break; case 't': - if (app->histlen > 0) + if (app->numberlen > 0) + { + int idx = atoi(app->number); + + if (idx >= 0 && idx < nelem(app->marks)) + if (app->marks[idx] > 0) + app->pageno = app->marks[idx]; + } + else if (app->histlen > 0) app->pageno = app->hist[--app->histlen]; break; diff --git a/apps/pdfapp.h b/apps/pdfapp.h index db355fe3..567781e8 100644 --- a/apps/pdfapp.h +++ b/apps/pdfapp.h @@ -45,6 +45,7 @@ struct pdfapp_s /* snapback history */ int hist[256]; int histlen; + int marks[10]; /* window system sizes */ int winw, winh; |