diff options
Diffstat (limited to 'otherlibs/labltk/browser/jg_text.ml')
-rw-r--r-- | otherlibs/labltk/browser/jg_text.ml | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/otherlibs/labltk/browser/jg_text.ml b/otherlibs/labltk/browser/jg_text.ml index 910cd518d..97e071a6e 100644 --- a/otherlibs/labltk/browser/jg_text.ml +++ b/otherlibs/labltk/browser/jg_text.ml @@ -16,59 +16,59 @@ open Tk open Jg_tk -let get_all tw = Text.get tw start:tstart end:(tposend 1) +let get_all tw = Text.get tw ~start:tstart ~stop:(tposend 1) -let tag_and_see tw :tag :start :end = - Text.tag_remove tw start:(tpos 0) end:tend :tag; - Text.tag_add tw :start :end :tag; +let tag_and_see tw ~tag ~start ~stop = + Text.tag_remove tw ~start:(tpos 0) ~stop:tend ~tag; + Text.tag_add tw ~start ~stop ~tag; try - Text.see tw index:(`Tagfirst tag, []); - Text.mark_set tw mark:"insert" index:(`Tagfirst tag, []) + Text.see tw ~index:(`Tagfirst tag, []); + Text.mark_set tw ~mark:"insert" ~index:(`Tagfirst tag, []) with Protocol.TkError _ -> () -let output tw :buf :pos :len = - Text.insert tw index:tend text:(String.sub buf :pos :len) +let output tw ~buf ~pos ~len = + Text.insert tw ~index:tend ~text:(String.sub buf ~pos ~len) let add_scrollbar tw = - let sb = Scrollbar.create (Winfo.parent tw) command:(Text.yview tw) - in Text.configure tw yscrollcommand:(Scrollbar.set sb); sb + let sb = Scrollbar.create (Winfo.parent tw) ~command:(Text.yview tw) + in Text.configure tw ~yscrollcommand:(Scrollbar.set sb); sb let create_with_scrollbar parent = let frame = Frame.create parent in let tw = Text.create frame in frame, tw, add_scrollbar tw -let goto_tag tw :tag = +let goto_tag tw ~tag = let index = (`Tagfirst tag, []) in - try Text.see tw :index; - Text.mark_set tw :index mark:"insert" + try Text.see tw ~index; + Text.mark_set tw ~index ~mark:"insert" with Protocol.TkError _ -> () let search_string tw = let tl = Jg_toplevel.titled "Search" in - Wm.transient_set tl master:Widget.default_toplevel; + Wm.transient_set tl ~master:Widget.default_toplevel; let fi = Frame.create tl and fd = Frame.create tl and fm = Frame.create tl and buttons = Frame.create tl - and direction = Textvariable.create on:tl () - and mode = Textvariable.create on:tl () - and count = Textvariable.create on:tl () + and direction = Textvariable.create ~on:tl () + and mode = Textvariable.create ~on:tl () + and count = Textvariable.create ~on:tl () in - let label = Label.create fi text:"Pattern:" - and text = Entry.create fi width:20 - and back = Radiobutton.create fd variable:direction - text:"Backwards" value:"backward" - and forw = Radiobutton.create fd variable:direction - text:"Forwards" value:"forward" - and exact = Radiobutton.create fm variable:mode - text:"Exact" value:"exact" - and nocase = Radiobutton.create fm variable:mode - text:"No case" value:"nocase" - and regexp = Radiobutton.create fm variable:mode - text:"Regexp" value:"regexp" + let label = Label.create fi ~text:"Pattern:" + and text = Entry.create fi ~width:20 + and back = Radiobutton.create fd ~variable:direction + ~text:"Backwards" ~value:"backward" + and forw = Radiobutton.create fd ~variable:direction + ~text:"Forwards" ~value:"forward" + and exact = Radiobutton.create fm ~variable:mode + ~text:"Exact" ~value:"exact" + and nocase = Radiobutton.create fm ~variable:mode + ~text:"No case" ~value:"nocase" + and regexp = Radiobutton.create fm ~variable:mode + ~text:"Regexp" ~value:"regexp" in - let search = Button.create buttons text:"Search" command: + let search = Button.create buttons ~text:"Search" ~command: begin fun () -> try let pattern = Entry.get text in @@ -80,23 +80,23 @@ let search_string tw = | "nocase" -> [`Nocase] | "regexp" -> [`Regexp] | _ -> [] in let ndx = - Text.search tw :pattern switches:([dir;`Count count] @ mode) - start:(`Mark "insert", [`Char ofs]) + Text.search tw ~pattern ~switches:([dir;`Count count] @ mode) + ~start:(`Mark "insert", [`Char ofs]) in - tag_and_see tw tag:"sel" start:(ndx,[]) - end:(ndx,[`Char(int_of_string (Textvariable.get count))]) + tag_and_see tw ~tag:"sel" ~start:(ndx,[]) + ~stop:(ndx,[`Char(int_of_string (Textvariable.get count))]) with Invalid_argument _ -> () end - and ok = Jg_button.create_destroyer tl parent:buttons text:"Cancel" in + and ok = Jg_button.create_destroyer tl ~parent:buttons ~text:"Cancel" in Focus.set text; - Jg_bind.return_invoke text button:search; + Jg_bind.return_invoke text ~button:search; Jg_bind.escape_destroy tl; Textvariable.set direction "forward"; Textvariable.set mode "nocase"; - pack [label] side:`Left; - pack [text] side:`Right fill:`X expand:true; - pack [back; forw] side:`Left; - pack [exact; nocase; regexp] side:`Left; - pack [search; ok] side:`Left fill:`X expand:true; - pack [fi; fd; fm; buttons] side:`Top fill:`X + pack [label] ~side:`Left; + pack [text] ~side:`Right ~fill:`X ~expand:true; + pack [back; forw] ~side:`Left; + pack [exact; nocase; regexp] ~side:`Left; + pack [search; ok] ~side:`Left ~fill:`X ~expand:true; + pack [fi; fd; fm; buttons] ~side:`Top ~fill:`X |