summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/pdfapp.c19
-rw-r--r--apps/pdfapp.h1
-rw-r--r--apps/win_main.c13
-rw-r--r--apps/x11_main.c15
-rw-r--r--debian/mupdf.19
5 files changed, 49 insertions, 8 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 773bc397..fca41c7a 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -29,13 +29,14 @@ static void pdfapp_error(pdfapp_t *app, fz_error error)
char *pdfapp_usage(pdfapp_t *app)
{
return
- " l <\t\t-- rotate left\n"
- " r >\t\t-- rotate right\n"
+ " <\t\t-- rotate left\n"
+ " >\t\t-- rotate right\n"
" u up\t\t-- scroll up\n"
" d down\t-- scroll down\n"
" = +\t\t-- zoom in\n"
" -\t\t-- zoom out\n"
" w\t\t-- shrinkwrap\n"
+ " r\t\t-- reload file\n"
"\n"
" n pgdn space\t-- next page\n"
" b pgup back\t-- previous page\n"
@@ -56,7 +57,6 @@ void pdfapp_init(pdfapp_t *app)
app->scrw = 640;
app->scrh = 480;
app->zoom = 1.0;
- app->cache = fz_newglyphcache();
}
void pdfapp_open(pdfapp_t *app, char *filename, int fd)
@@ -66,6 +66,8 @@ void pdfapp_open(pdfapp_t *app, char *filename, int fd)
char *password = "";
fz_stream *file;
+ app->cache = fz_newglyphcache();
+
/*
* Open PDF and load xref table
*/
@@ -357,12 +359,10 @@ void pdfapp_onkey(pdfapp_t *app, int c)
app->zoom = 0.1;
pdfapp_showpage(app, 0, 1);
break;
- case 'l':
case '<':
app->rotate -= 90;
pdfapp_showpage(app, 0, 1);
break;
- case 'r':
case '>':
app->rotate += 90;
pdfapp_showpage(app, 0, 1);
@@ -478,6 +478,15 @@ void pdfapp_onkey(pdfapp_t *app, int c)
panto = PAN_TO_TOP; app->pageno -= 10; break;
case 'F':
panto = PAN_TO_TOP; app->pageno += 10; break;
+
+ /*
+ * Reloading the file...
+ */
+
+ case 'r':
+ oldpage = -1;
+ winreloadfile(app);
+ break;
}
if (c < '0' || c > '9')
diff --git a/apps/pdfapp.h b/apps/pdfapp.h
index 8c82f635..37f11895 100644
--- a/apps/pdfapp.h
+++ b/apps/pdfapp.h
@@ -18,6 +18,7 @@ extern char* winpassword(pdfapp_t*, char *filename);
extern void winopenuri(pdfapp_t*, char *s);
extern void wincursor(pdfapp_t*, int curs);
extern void windocopy(pdfapp_t*);
+extern void winreloadfile(pdfapp_t*);
struct pdfapp_s
{
diff --git a/apps/win_main.c b/apps/win_main.c
index 688c5efb..da896a4c 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -527,6 +527,19 @@ void windocopy(pdfapp_t *app)
justcopied = 1; /* keep inversion around for a while... */
}
+void winreloadfile(pdfapp_t *app)
+{
+ int fd;
+
+ pdfapp_close(app);
+
+ fd = _wopen(wbuf, O_BINARY | O_RDONLY, 0666);
+ if (fd < 0)
+ winerror(&gapp, fz_throw("cannot reload file '%s'", filename));
+
+ pdfapp_open(app, filename, fd);
+}
+
void winopenuri(pdfapp_t *app, char *buf)
{
ShellExecute(hwndframe, "open", buf, 0, 0, SW_SHOWNORMAL);
diff --git a/apps/x11_main.c b/apps/x11_main.c
index a0fde675..a9fe22f8 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -69,6 +69,7 @@ static int reqh = 0;
static char copylatin1[1024 * 16] = "";
static char copyutf8[1024 * 48] = "";
static Time copytime;
+static char *filename;
static pdfapp_t gapp;
@@ -426,6 +427,19 @@ void onselreq(Window requestor, Atom selection, Atom target, Atom property, Time
XSendEvent(xdpy, requestor, False, SelectionNotify, &nevt);
}
+void winreloadfile(pdfapp_t *app)
+{
+ int fd;
+
+ pdfapp_close(app);
+
+ fd = open(filename, O_BINARY | O_RDONLY, 0666);
+ if (fd < 0)
+ winerror(app, fz_throw("cannot reload file '%s'", filename));
+
+ pdfapp_open(app, filename, fd);
+}
+
void winopenuri(pdfapp_t *app, char *buf)
{
char *browser = getenv("BROWSER");
@@ -512,7 +526,6 @@ static void winresettmo(struct timeval *tmo, struct timeval *tmo_at)
int main(int argc, char **argv)
{
- char *filename;
int c;
int len;
char buf[128];
diff --git a/debian/mupdf.1 b/debian/mupdf.1
index 5ee3860f..118804d3 100644
--- a/debian/mupdf.1
+++ b/debian/mupdf.1
@@ -100,10 +100,10 @@ Zoom in.
.B \-
Zoom out.
.TP
-.B <, l
+.B <
Rotate page counter-clockwise or left by 90\(de.
.TP
-.B >, r
+.B >
Rotate page clockwise or right by 90\(de.
.TP
.B a
@@ -111,6 +111,11 @@ Rotate page counter-clockwise or left by 15\(de.
.TP
.B s
Rotate page clockwise or right by 15\(de.
+.TP
+.B FILE HANDLING
+.TP
+.B r
+Reload the file and display the same page, if still present.
.SH SEE ALSO
.BR pdfclean (1),
.BR pdfdraw (1),