summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-07-05 17:55:18 +0100
committerRobin Watts <robin.watts@artifex.com>2012-07-05 18:02:03 +0100
commiteeaccf8444a4884801a92c0d23f66bd54c986a67 (patch)
treefc9e254dfeef4d61a80aace2f5dbbcd985580a9a /apps
parentb81be8d34b179d48e677463bd7b66ffdea129517 (diff)
parent15fc25b0055dbdbfaf4257ac908d43fd5a2da19d (diff)
downloadmupdf-eeaccf8444a4884801a92c0d23f66bd54c986a67.tar.xz
Merge branch 'master' into forms
Diffstat (limited to 'apps')
-rw-r--r--apps/man/mupdf.14
-rw-r--r--apps/mubusy.c2
-rw-r--r--apps/mudraw.c4
-rw-r--r--apps/mupdfclean.c7
-rw-r--r--apps/mupdfextract.c3
-rw-r--r--apps/mupdfinfo.c14
-rw-r--r--apps/mupdfshow.c5
-rw-r--r--apps/pdfapp.c19
-rw-r--r--apps/x11_image.c4
9 files changed, 38 insertions, 24 deletions
diff --git a/apps/man/mupdf.1 b/apps/man/mupdf.1
index dc2dfca1..99179d69 100644
--- a/apps/man/mupdf.1
+++ b/apps/man/mupdf.1
@@ -1,4 +1,4 @@
-.TH MUPDF 1 "March 19, 2012"
+.TH MUPDF 1 "June 12, 2012"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
mupdf \- MuPDF is a lightweight PDF viewer written in portable C
@@ -49,7 +49,7 @@ Reload file.
.B . pgdn right space
Go to the next page
.TP
-.B , pgup left b
+.B , pgup left b backspace
Go to the previous page
.TP
.B <, >
diff --git a/apps/mubusy.c b/apps/mubusy.c
index b520d0ec..e11d488c 100644
--- a/apps/mubusy.c
+++ b/apps/mubusy.c
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
{
strcpy(buf, "mupdf");
strcat(buf, tools[i].name);
- if (namematch(end, start, buf))
+ if (namematch(end, start, buf) || namematch(end, start, buf+2))
return tools[i].func(argc, argv);
}
}
diff --git a/apps/mudraw.c b/apps/mudraw.c
index 1d16ac25..dd5d88db 100644
--- a/apps/mudraw.c
+++ b/apps/mudraw.c
@@ -535,8 +535,8 @@ static void drawrange(fz_context *ctx, fz_document *doc, char *range)
epage = pagecount;
}
- spage = CLAMP(spage, 1, pagecount);
- epage = CLAMP(epage, 1, pagecount);
+ spage = fz_clampi(spage, 1, pagecount);
+ epage = fz_clampi(epage, 1, pagecount);
if (spage < epage)
for (page = spage; page <= epage; page++)
diff --git a/apps/mupdfclean.c b/apps/mupdfclean.c
index 8eb30efe..6b185668 100644
--- a/apps/mupdfclean.c
+++ b/apps/mupdfclean.c
@@ -87,8 +87,8 @@ static void retainpages(int argc, char **argv)
if (spage > epage)
page = spage, spage = epage, epage = page;
- spage = CLAMP(spage, 1, pagecount);
- epage = CLAMP(epage, 1, pagecount);
+ spage = fz_clampi(spage, 1, pagecount);
+ epage = fz_clampi(epage, 1, pagecount);
for (page = spage; page <= epage; page++)
{
@@ -123,8 +123,9 @@ static void retainpages(int argc, char **argv)
pdf_obj *names = pdf_new_dict(ctx, 1);
pdf_obj *dests = pdf_new_dict(ctx, 1);
pdf_obj *names_list = pdf_new_array(ctx, 32);
+ int len = pdf_dict_len(olddests);
- for (i = 0; i < pdf_dict_len(olddests); i++)
+ for (i = 0; i < len; i++)
{
pdf_obj *key = pdf_dict_get_key(olddests, i);
pdf_obj *val = pdf_dict_get_val(olddests, i);
diff --git a/apps/mupdfextract.c b/apps/mupdfextract.c
index 8db6ceaf..95f27be9 100644
--- a/apps/mupdfextract.c
+++ b/apps/mupdfextract.c
@@ -178,7 +178,8 @@ int pdfextract_main(int argc, char **argv)
if (fz_optind == argc)
{
- for (o = 0; o < pdf_count_objects(doc); o++)
+ int len = pdf_count_objects(doc);
+ for (o = 0; o < len; o++)
showobject(o);
}
else
diff --git a/apps/mupdfinfo.c b/apps/mupdfinfo.c
index 6e4db812..5bdf760e 100644
--- a/apps/mupdfinfo.c
+++ b/apps/mupdfinfo.c
@@ -202,6 +202,16 @@ gatherdimensions(int page, pdf_obj *pageref, pdf_obj *pageobj)
bbox = pdf_to_rect(ctx, obj);
+ obj = pdf_dict_gets(pageobj, "UserUnit");
+ if (pdf_is_real(obj))
+ {
+ float unit = pdf_to_real(obj);
+ bbox.x0 *= unit;
+ bbox.y0 *= unit;
+ bbox.x1 *= unit;
+ bbox.y1 *= unit;
+ }
+
for (j = 0; j < dims; j++)
if (!memcmp(dim[j].u.dim.bbox, &bbox, sizeof (fz_rect)))
break;
@@ -911,8 +921,8 @@ showinfo(char *filename, int show, char *pagelist)
if (spage > epage)
page = spage, spage = epage, epage = page;
- spage = CLAMP(spage, 1, pagecount);
- epage = CLAMP(epage, 1, pagecount);
+ spage = fz_clampi(spage, 1, pagecount);
+ epage = fz_clampi(epage, 1, pagecount);
if (allpages)
printf("Retrieving info from pages %d-%d...\n", spage, epage);
diff --git a/apps/mupdfshow.c b/apps/mupdfshow.c
index 252e7dc2..8e8425b0 100644
--- a/apps/mupdfshow.c
+++ b/apps/mupdfshow.c
@@ -142,9 +142,10 @@ static void showobject(int num, int gen)
static void showgrep(char *filename)
{
pdf_obj *obj;
- int i;
+ int i, len;
- for (i = 0; i < pdf_count_objects(doc); i++)
+ len = pdf_count_objects(doc);
+ for (i = 0; i < len; i++)
{
if (doc->table[i].type == 'n' || doc->table[i].type == 'o')
{
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 6efa89ad..c02ed3f2 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -56,7 +56,7 @@ char *pdfapp_usage(pdfapp_t *app)
"f\t\t-- fullscreen\n"
"r\t\t-- reload file\n"
". pgdn right spc\t-- next page\n"
- ", pgup left b\t-- previous page\n"
+ ", pgup left b bkspc\t-- previous page\n"
">\t\t-- next 10 pages\n"
"<\t\t-- back 10 pages\n"
"m\t\t-- mark page for snap back\n"
@@ -894,6 +894,7 @@ void pdfapp_onkey(pdfapp_t *app, int c)
app->pageno++;
break;
+ case '\b':
case 'b':
panto = DONT_PAN;
if (app->numberlen > 0)
@@ -1131,10 +1132,10 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
if (app->iscopying)
{
app->iscopying = 0;
- app->selr.x0 = MIN(app->selx, x) - app->panx + rect.x0;
- app->selr.x1 = MAX(app->selx, x) - app->panx + rect.x0;
- app->selr.y0 = MIN(app->sely, y) - app->pany + rect.y0;
- app->selr.y1 = MAX(app->sely, y) - app->pany + rect.y0;
+ app->selr.x0 = fz_mini(app->selx, x) - app->panx + rect.x0;
+ app->selr.x1 = fz_maxi(app->selx, x) - app->panx + rect.x0;
+ app->selr.y0 = fz_mini(app->sely, y) - app->pany + rect.y0;
+ app->selr.y1 = fz_maxi(app->sely, y) - app->pany + rect.y0;
winrepaint(app);
if (app->selr.x0 < app->selr.x1 && app->selr.y0 < app->selr.y1)
windocopy(app);
@@ -1201,10 +1202,10 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
else if (app->iscopying)
{
- app->selr.x0 = MIN(app->selx, x) - app->panx + rect.x0;
- app->selr.x1 = MAX(app->selx, x) - app->panx + rect.x0;
- app->selr.y0 = MIN(app->sely, y) - app->pany + rect.y0;
- app->selr.y1 = MAX(app->sely, y) - app->pany + rect.y0;
+ app->selr.x0 = fz_mini(app->selx, x) - app->panx + rect.x0;
+ app->selr.x1 = fz_maxi(app->selx, x) - app->panx + rect.x0;
+ app->selr.y0 = fz_mini(app->sely, y) - app->pany + rect.y0;
+ app->selr.y1 = fz_maxi(app->sely, y) - app->pany + rect.y0;
winrepaint(app);
}
diff --git a/apps/x11_image.c b/apps/x11_image.c
index 06764313..6392d868 100644
--- a/apps/x11_image.c
+++ b/apps/x11_image.c
@@ -432,10 +432,10 @@ ximage_blit(Drawable d, GC gc,
for (ay = 0; ay < srch; ay += HEIGHT)
{
- h = MIN(srch - ay, HEIGHT);
+ h = fz_mini(srch - ay, HEIGHT);
for (ax = 0; ax < srcw; ax += WIDTH)
{
- w = MIN(srcw - ax, WIDTH);
+ w = fz_mini(srcw - ax, WIDTH);
image = next_pool_image();