let keys ={|-----Quitting-----escape/q - quitQ - quit without saving the configuration or changesW - save changes-----Movement-----up/down arrow - scroll up/downleft/right arrow - pan left/right (when zoomed in)Ctrl-arrows - half a screen width/height scoll/panspace - go to the next pagedelete - go to the previous pagepageup/pagedown - go forward/backward one screen-fullg/G - go to first/last pagehome/end - go to first/last page-----Advanced Movement / History-----backspace - go back after jumping (clicking link and suchlike)[1]Alt-left/right arrow - go backward/forward in history0..9 - enter page number to jump tot - align top of the screen with the top of the page<,> - rotateCtrl-pageup/pagedown - align top of the screen with first/last visible pageF - go to hinted linkif auto scrolling is active: up/down arrows and mouse buttons 3/4 will make scrolling go faster/slower-----Mouse-----primary mouse button - click on link or select text[2] when Shift is held - run "synctex command" with coordinates of the point[3] when Ctrl is held - pan zoom to block - when in block zoom mode otherwise - pan if there's no text/link under the cursormouse buttons 3/4 - scroll up/down (aka mouse wheel) when Shift is held - pan left/right when Ctrl is held - zoommouse buttons 5/6 - pan left/right (aka horizontal mouse wheel)secondary mouse button - select rectangle to zoom to when Shift is held - add text annotationNote: moving mouse while holding primary mouse button will pan the page, if the mouse is over selectable element (text/link) holding Ctrl will make the page pan instead of the default action (selecting text/ clicking link)-----Bookmarks-----m - create named bookmark~ - create quick bookmark-----Zoom-----Ctrl+Shift up/down - set previous zoom levelB - toggle zoom block modew - change height of the window to encompass all of the pageAlt-c - center viewCtrl-+/Ctrl-= - zoom inCtrl-- - zoom outCtrl-0 - reset zoom and panningCtrl-1 - fit tallest pageCtrl-2 - fit tallest page height exactlyCtrl-3 - cycle fit modelsCtrl-4 - 1:1 zoomCtrl-9/F9 - enter bird's eye view-----Actions-----u - dehighlightr - reload document[4]y - select link and paste its description to the clipboard| - pipe selection through specified commandx - run pax command on selected regionCtrl-p - launch a command with the document path as an argumentreturn - (in link navigation mode) follow link= - show current positione - view error log-----Search-----/,? - enter text to search for (/ - forward, ? - backward)n - repeat last search (forward)p, N - repeat last search (backward)z[zbt] - "zoom in" on the first search resultCtrl-g - interrupt search-----Settings / Modes-----[/] - decrease/increase page brightness+ - set page bias- - toggle/set tunableb - toggle scroll barl - toggle highlighting of the linksf - toggle fullscreeninsert - toggle link navigation modeo - switch to outline/table of contents mode' - switch to bookmark modeF1 - switch to help modeAlt-F1 - switch to history modei - switch to info modeP - switch to "presentation" modec - switch to previous column layouta - auto scroll mode-----Tunables------i - toggle case sensitivity of searches-R<number> - rotate-v - toggle verbosity-Z<number> - set zoom (percent)-T - toggle trimming of margins-I - invert colors-M - toggle pax mode-C<number> - set column count-x<string> - set command to run on selection-f - toggle "what's under cursor" identification - (or "what's currently selected" in link navigation mode) - (font name of the text under cursor or link target)-----Bird's eye mode-----Ctrl-9/F9/esc - leave bird's eye viewCtrl-l - center the view on the currently selected page(page)up/(page)down - navigatehome/end - go to first/last pageenter - select the page and leave bird's eye modeprimary mouse button - select the page under cursor and leave bird's eye mode-----Outline/bookmark/help/info/history mode-----esc - leave outline/bookmark modeup/down - select previous/next itemalpha-numeric - quick searchCtrl-s - repeat search (forward)Ctrl-r - repeat search (backward)Ctrl-l - center on current itemCtrl-left/right - pan text left/rightCtrl-up/down - scroll view up/downCtrl-insert - copy active item's text to clipboard-----Outline/history mode-----left/right - go up/down a levelShift-left/right - go to prev/next item of same or higher levelCtrl-a - toggle auto narrowing/ - enter auto narrowingtab - begin nested narrowingCtrl-n - narrow to search patternCtrl-u - undo narrowingCtrl-S - synchronize-----Info mode-----enter - toggle/enter new value for selected parameter-----When entering search pattern/page number-----up/down arrow - previous/next entered textenter - confirmCtrl-g/esc - canceldouble/triple/quadruple/quintuple clicks in view mode will pipe theword/line/block/page through pax command when Ctrl is held andselection command otherwise[1] if the document was previously visited initial backspace will jump to the last visited place[2] C&P[3] arguments to the command are: 1 = path to the document 2 = zero based page number 3 = X coordinate within the page 4 = Y …[4] document will also be reloaded upon reception of the HUP signal-----Caveat emptor-----o Text selection is limited to a single pageo Text searching is very naive|}open Utilslet gotourl launcher url = let command = Str.global_replace Utils.Re.percents url launcher in try ignore @@ spawn command [] with exn -> dolog "failed to execute `%s': %s" command @@ exntos exnlet gotouri launcher uri = if emptystr launcher then dolog "%s" uri else if nonemptystr @@ geturl uri then gotourl launcher uri else dolog "obtained empty url from uri %S" urilet version () = Printf.sprintf "llpp %s, ocaml %s (%d bit), fitz %s" (Ffi.llpp_version ()) Sys.ocaml_version Sys.word_size (Ffi.fz_version ())let fixup = let gr = Str.global_replace in let dash = Str.regexp {|\([^ ]*\) +- +\(.*\)|} and head = Str.regexp {|-----\(.*\)-----|} and wcAp = Str.regexp "C&P" in fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" @@ gr wcAp Wsi.cAp slet makehelp launcher = version () :: "(searching in this text works just by typing (i.e. no initial '/'))" :: E.s :: String.split_on_char '\n' keys |> List.map (fun s -> let s = fixup s in match geturl s with | "" -> (s, 0, None) | url -> (s, 0, Some (fun uioh -> gotourl launcher url; uioh)) )
let keys =
{|-----Quitting-----
escape/q - quit
Q - quit without saving the configuration or changes
W - save changes
-----Movement-----
up/down arrow - scroll up/down
left/right arrow - pan left/right (when zoomed in)
Ctrl-arrows - half a screen width/height scoll/pan
space - go to the next page
delete - go to the previous page
pageup/pagedown - go forward/backward one screen-full
g/G - go to first/last page
home/end - go to first/last page
-----Advanced Movement / History-----
backspace - go back after jumping (clicking link and suchlike)[1]
Alt-left/right arrow - go backward/forward in history
0..9 - enter page number to jump to
t - align top of the screen with the top of the page
<,> - rotate
Ctrl-pageup/pagedown - align top of the screen with first/last visible page
F - go to hinted link
if auto scrolling is active:
up/down arrows and mouse buttons 3/4 will make scrolling go faster/slower
-----Mouse-----
primary mouse button - click on link or select text[2]
when Shift is held - run "synctex command" with coordinates of the point[3]
when Ctrl is held - pan
zoom to block - when in block zoom mode
otherwise - pan if there's no text/link under the cursor
mouse buttons 3/4 - scroll up/down (aka mouse wheel)
when Shift is held - pan left/right
when Ctrl is held - zoom
mouse buttons 5/6 - pan left/right (aka horizontal mouse wheel)
secondary mouse button - select rectangle to zoom to
when Shift is held - add text annotation
Note:
moving mouse while holding primary mouse button will pan the page,
if the mouse is over selectable element (text/link) holding Ctrl
will make the page pan instead of the default action (selecting text/
clicking link)
-----Bookmarks-----
m - create named bookmark
~ - create quick bookmark
-----Zoom-----
Ctrl+Shift up/down - set previous zoom level
B - toggle zoom block mode
w - change height of the window to encompass all of the page
Alt-c - center view
Ctrl-+/Ctrl-= - zoom in
Ctrl-- - zoom out
Ctrl-0 - reset zoom and panning
Ctrl-1 - fit tallest page
Ctrl-2 - fit tallest page height exactly
Ctrl-3 - cycle fit models
Ctrl-4 - 1:1 zoom
Ctrl-9/F9 - enter bird's eye view
-----Actions-----
u - dehighlight
r - reload document[4]
y - select link and paste its description to the clipboard
| - pipe selection through specified command
x - run pax command on selected region
Ctrl-p - launch a command with the document path as an argument
return - (in link navigation mode) follow link
= - show current position
e - view error log
-----Search-----
/,? - enter text to search for (/ - forward, ? - backward)
n - repeat last search (forward)
p, N - repeat last search (backward)
z[zbt] - "zoom in" on the first search result
Ctrl-g - interrupt search
-----Settings / Modes-----
[/] - decrease/increase page brightness
+ - set page bias
- - toggle/set tunable
b - toggle scroll bar
l - toggle highlighting of the links
f - toggle fullscreen
insert - toggle link navigation mode
o - switch to outline/table of contents mode
' - switch to bookmark mode
F1 - switch to help mode
Alt-F1 - switch to history mode
i - switch to info mode
P - switch to "presentation" mode
c - switch to previous column layout
a - auto scroll mode
-----Tunables-----
-i - toggle case sensitivity of searches
-R<number> - rotate
-v - toggle verbosity
-Z<number> - set zoom (percent)
-T - toggle trimming of margins
-I - invert colors
-M - toggle pax mode
-C<number> - set column count
-x<string> - set command to run on selection
-f - toggle "what's under cursor" identification
- (or "what's currently selected" in link navigation mode)
- (font name of the text under cursor or link target)
-----Bird's eye mode-----
Ctrl-9/F9/esc - leave bird's eye view
Ctrl-l - center the view on the currently selected page
(page)up/(page)down - navigate
home/end - go to first/last page
enter - select the page and leave bird's eye mode
primary mouse button - select the page under cursor and leave bird's eye mode
-----Outline/bookmark/help/info/history mode-----
esc - leave outline/bookmark mode
up/down - select previous/next item
alpha-numeric - quick search
Ctrl-s - repeat search (forward)
Ctrl-r - repeat search (backward)
Ctrl-l - center on current item
Ctrl-left/right - pan text left/right
Ctrl-up/down - scroll view up/down
Ctrl-insert - copy active item's text to clipboard
-----Outline/history mode-----
left/right - go up/down a level
Shift-left/right - go to prev/next item of same or higher level
Ctrl-a - toggle auto narrowing
/ - enter auto narrowing
tab - begin nested narrowing
Ctrl-n - narrow to search pattern
Ctrl-u - undo narrowing
Ctrl-S - synchronize
-----Info mode-----
enter - toggle/enter new value for selected parameter
-----When entering search pattern/page number-----
up/down arrow - previous/next entered text
enter - confirm
Ctrl-g/esc - cancel
double/triple/quadruple/quintuple clicks in view mode will pipe the
word/line/block/page through pax command when Ctrl is held and
selection command otherwise
[1] if the document was previously visited initial backspace will
jump to the last visited place
[2] C&P
[3] arguments to the command are:
1 = path to the document
2 = zero based page number
3 = X coordinate within the page
4 = Y …
[4] document will also be reloaded upon reception of the HUP signal
-----Caveat emptor-----
o Text selection is limited to a single page
o Text searching is very naive|}
open Utils
let gotourl launcher url =
let command = Str.global_replace Utils.Re.percents url launcher in
try ignore @@ spawn command []
with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
let gotouri launcher uri =
if emptystr launcher
then dolog "%s" uri
else
if nonemptystr @@ geturl uri
then gotourl launcher uri
else dolog "obtained empty url from uri %S" uri
let version () =
Printf.sprintf "llpp %s, ocaml %s (%d bit), fitz %s"
(Ffi.llpp_version ()) Sys.ocaml_version Sys.word_size (Ffi.fz_version ())
let fixup =
let gr = Str.global_replace in
let dash = Str.regexp {|\([^ ]*\) +- +\(.*\)|}
and head = Str.regexp {|-----\(.*\)-----|}
and wcAp = Str.regexp "C&P" in
fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" @@ gr wcAp Wsi.cAp s
let makehelp launcher =
version ()
:: "(searching in this text works just by typing (i.e. no initial '/'))"
:: E.s :: String.split_on_char '\n' keys |>
List.map (fun s ->
let s = fixup s in
match geturl s with
| "" -> (s, 0, None)
| url -> (s, 0, Some (fun uioh -> gotourl launcher url; uioh))
)