package chamo

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file prefs.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
(*********************************************************************************)
(*                Chamo                                                          *)
(*                                                                               *)
(*    Copyright (C) 2003-2021 Institut National de Recherche en Informatique     *)
(*    et en Automatique. All rights reserved.                                    *)
(*                                                                               *)
(*    This program is free software; you can redistribute it and/or modify       *)
(*    it under the terms of the GNU Lesser General Public License version        *)
(*    3 as published by the Free Software Foundation.                            *)
(*                                                                               *)
(*    This program is distributed in the hope that it will be useful,            *)
(*    but WITHOUT ANY WARRANTY; without even the implied warranty of             *)
(*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *)
(*    GNU General Public License for more details.                               *)
(*                                                                               *)
(*    You should have received a copy of the GNU General Public License          *)
(*    along with this program; if not, write to the Free Software                *)
(*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                   *)
(*    02111-1307  USA                                                            *)
(*                                                                               *)
(*    Contact: Maxence.Guesdon@inria.fr                                          *)
(*                                                                               *)
(*********************************************************************************)

(*
let style_scheme_box () =
  let hb = GPack.hbox () in
  let style_box = new Gtksv_utils.source_style_scheme_box () in
  hb#pack ~expand: true ~fill: true style_box#box;
  (Configwin.custom hb
   (fun () -> Gtksv_utils.store_style_scheme_selection style_box#scheme) true,
   (fun () -> Gtksv_utils.apply_source_style_scheme_to_registered_buffers
      (Gtksv_utils.source_style_scheme()))
  )

let source_view_props_box () =
  let hb = GPack.hbox () in
  let p = Gtksv_utils.read_sourceview_props () in
  let box = new Gtksv_utils.sourceview_props_box
      Gtksv_utils.apply_sourceview_props_to_registered
  in
  box#set_props (Some p);
  hb#pack ~expand: true ~fill: true box#box;
  (Configwin.custom hb
     (fun () ->
       match box#props with
         None -> ()
       | Some p -> Gtksv_utils.store_sourceview_props p
     ) true,
   (fun () ->
     Gtksv_utils.apply_sourceview_props_to_registered
       (Gtksv_utils.read_sourceview_props ()))
  )

let edit_preferences () =
  let (param_scheme, f_restore_scheme) = style_scheme_box () in
  let (param_svprops, f_restore_svprops) = source_view_props_box () in
  let sections =
    [
      Configwin.Section ("Source views", [param_svprops]) ;
      Configwin.Section ("Style scheme", [param_scheme]) ;
    ]
  in
  match Configwin.get Messages.preferences sections with
    Configwin.Return_ok ->(* save_options () ;*)()
  | _ -> f_restore_scheme (); f_restore_svprops ()
*)

let sourceview () =
  let open Stk_ocf in
  let group = table () in
  let undo_levels = int ~cb:(Ocf.set Sourceview_rc.max_undo_levels)
    (Ocf.get Sourceview_rc.max_undo_levels)
  in
  group#add_option ["undo_levels"] ~text:"Undo levels:" undo_levels ;
  group

let edit_preferences () =
  let conf = Stk_ocf.hnotebook () in
  conf#add_group ["sourceview"] ~text:"Sourceviews" (sourceview())#as_group ;
  let d = Stk.Dialog.dialog ~w:600 ~h:600 "Preferences" in
  d#content_area#set_child conf#as_widget ;
  d#run (fun _ -> Lwt.return_unit)

  
  
OCaml

Innovation. Community. Security.