From 71ba9208c99941939df8a2eeff6493351d8c9235 Mon Sep 17 00:00:00 2001 From: malc Date: Wed, 21 Jan 2015 23:35:48 +0300 Subject: [PATCH] Add a knob contolling the way annoations are created/edited --- KEYS | 2 -- config.ml | 5 +++++ main.ml | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/KEYS b/KEYS index a749ac7..14e7d49 100644 --- a/KEYS +++ b/KEYS @@ -37,8 +37,6 @@ mouse buttons 3/4 - scroll up/down (aka mouse wheel) mouse buttons 5/6 - pan left/right (aka horizontal mouse wheel) other mouse button[2] - select rectangle to zoom to when shift is held - add text annotation - when shift and control - are held - ($EDITOR will be spawned to get the text) Note: moving mouse while holding primary mouse button will pan the page, diff --git a/config.ml b/config.ml index a756125..1a1be77 100644 --- a/config.ml +++ b/config.ml @@ -283,6 +283,7 @@ type conf = ; mutable leftscroll : bool ; mutable title : string ; mutable lastvisit : float + ; mutable annotinline : bool } and columns = | Csingle of singlecolumn @@ -585,6 +586,7 @@ let defconf = ; leftscroll = false ; title = E.s ; lastvisit = 0.0 + ; annotinline = true ; keyhashes = let mk n = (n, Hashtbl.create 1) in [ mk "global" @@ -1114,6 +1116,7 @@ let config_of c attrs = | "scroll-bar-on-the-left" -> { c with leftscroll = bool_of_string v } | "title" -> { c with title = unent v } | "last-visit" -> { c with lastvisit = float_of_string v } + | "edit-annots-inline" -> { c with annotinline = bool_of_string v } | _ -> c with exn -> prerr_endline ("Error processing attribute (`" ^ @@ -1234,6 +1237,7 @@ let setconf dst src = dst.paxmark <- src.paxmark; dst.leftscroll <- src.leftscroll; dst.title <- src.title; + dst.annotinline <- src.annotinline; dst.pax <- if src.pax = None then None @@ -1708,6 +1712,7 @@ let add_attrs bb always dc c time = if not always then os "title" c.title dc.title; oF "last-visit" (snd (modf time)) 0.0; + ob "edit-annotations-inline" c.annotinline dc.annotinline; ;; let keymapsbuf always dc c = diff --git a/main.ml b/main.ml index 8f59b8e..70c4fa4 100644 --- a/main.ml +++ b/main.ml @@ -4045,6 +4045,9 @@ let enterinfomode = src#bool "open remote links in a new instance" (fun () -> conf.riani) (fun v -> conf.riani <- v); + src#bool "edit annotations inline" + (fun () -> conf.annotinline) + (fun v -> conf.annotinline <- v); ); sep (); @@ -4334,7 +4337,7 @@ let enterannotmode opaque slinkindex = m_items <- ( "[Copy]", fun () -> selstring m_text) :: ("[Delete]", dele) - :: ("[Edit]", edit true) + :: ("[Edit]", edit conf.annotinline) :: (E.s, unit) :: split [] 0 0 |> List.rev |> Array.of_list @@ -5911,7 +5914,7 @@ let viewmouse button down x y mask = then ( if Wsi.withshift mask then ( - annot (not (Wsi.withctrl mask)) x y; + annot conf.annotinline x y; G.postRedisplay "addannot" ) else -- 2.11.4.GIT