From 47e881c3de297da2498989676f98266aac9161d3 Mon Sep 17 00:00:00 2001 From: malc Date: Wed, 23 Nov 2016 08:52:15 +0300 Subject: [PATCH] Add an option to disable document style WIP --- config.ml | 3 +++ link.c | 8 +++++--- main.ml | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/config.ml b/config.ml index 2b4e9cb..6da99b7 100644 --- a/config.ml +++ b/config.ml @@ -110,6 +110,7 @@ type keymap = and colorspace = | Rgb | Bgr | Gray and haspbo = bool and usefontconfig = bool + and usedoccss = bool and uri = string and caption = string and x = int @@ -280,6 +281,7 @@ type conf = ; mutable annotinline : bool ; mutable coarseprespos : bool ; mutable css : css + ; mutable usedoccss : usedoccss } and columns = | Csingle of singlecolumn @@ -556,6 +558,7 @@ let defconf = ; annotinline = true ; coarseprespos = false ; css = E.s + ; usedoccss = true ; keyhashes = let mk n = (n, Hashtbl.create 1) in [ mk "global" diff --git a/link.c b/link.c index cb2b545..55cbdfb 100644 --- a/link.c +++ b/link.c @@ -1650,15 +1650,16 @@ static void * mainloop (void UNUSED_ATTR *unused) p[len] = 0; if (!strncmp ("open", p, 4)) { - int wthack, off, ok = 0; + int wthack, off, usedoccss, ok = 0; char *password; char *filename; char *utf8filename; size_t filenamelen; fz_var (ok); - ret = sscanf (p + 5, " %d %d %n", &wthack, &state.cxack, &off); - if (ret != 2) { + ret = sscanf (p + 5, " %d %d %d %n", + &wthack, &state.cxack, &usedoccss, &off); + if (ret != 3) { errx (1, "malformed open `%.*s' ret=%d", len, p, ret); } @@ -1671,6 +1672,7 @@ static void * mainloop (void UNUSED_ATTR *unused) } lock ("open"); + /* fz_set_use_document_css (state.ctx, usedoccss); */ fz_try (state.ctx) { ok = openxref (filename, password); } diff --git a/main.ml b/main.ml index a92270c..fe2253d 100644 --- a/main.ml +++ b/main.ml @@ -1112,8 +1112,9 @@ let opendoc path password = else state.origin in Wsi.settitle ("llpp " ^ (mbtoutf8 (Filename.basename titlepath))); - wcmd "open %d %d %s\000%s\000%s\000" - (btod !wtmode) (btod !cxack) path password conf.css; + wcmd "open %d %d %d %s\000%s\000%s\000" + (btod !wtmode) (btod !cxack) (btod conf.usedoccss) + path password conf.css; invalidate "reqlayout" (fun () -> wcmd "reqlayout %d %d %d %s\000" @@ -3982,6 +3983,9 @@ let enterinfomode = src#bool "coarse positioning in presentation mode" (fun () -> conf.coarseprespos) (fun v -> conf.coarseprespos <- v); + src#bool "use document css" + (fun () -> conf.usedoccss) + (fun v -> conf.usedoccss <- v) ); sep (); -- 2.11.4.GIT