Commit 0c0513a5 authored by MARCHE Claude's avatar MARCHE Claude

simplified contextual menu

The contextual menu inkoved by mouse-3 is now simplified: it contains only
the strategies and the provers that are marked visible in the preferences
parent 963fe04a
......@@ -265,6 +265,7 @@ let save_config t =
let ide = set_string ide "error_color_bg" t.error_color_bg in
let ide = set_string ide "error_line_color" t.error_line_color in
let ide = set_string ide "iconset" t.iconset in
let ide = set_stringl ide "hidden_prover" t.hidden_provers in
let config = Whyconf.set_section config "ide" ide in
Whyconf.save_config config
......@@ -800,6 +801,7 @@ let appearance_settings (c : t) (notebook:GPack.notebook) =
GPack.button_box `VERTICAL ~border_width:5 ~spacing:5
~packing:vb#add ()
in
(*
let intropremises =
GButton.check_button ~label:"introduce premises"
~packing:display_options_box#add ()
......@@ -809,6 +811,7 @@ let appearance_settings (c : t) (notebook:GPack.notebook) =
intropremises#connect#toggled ~callback:
(fun () -> c.intro_premises <- not c.intro_premises)
in
*)
let showfullcontext =
GButton.check_button ~label:"show full task context"
~packing:display_options_box#add ()
......@@ -942,7 +945,7 @@ let provers_page c (notebook:GPack.notebook) =
let hbox_pack = hbox#pack ~fill:true ~expand:true ?from:None ?padding:None in
(* show/hide provers *)
let frame =
GBin.frame ~label:"Prover button in the left toolbar" ~packing:hbox_pack ()
GBin.frame ~label:"Provers visible in the contextual menu" ~packing:hbox_pack ()
in
let provers_box =
GPack.button_box `VERTICAL ~border_width:5 ~spacing:5
......@@ -998,7 +1001,7 @@ let provers_page c (notebook:GPack.notebook) =
(* Page "Uninstalled provers" *)
let alternatives_frame c (notebook:GPack.notebook) =
let label = GMisc.label ~text:"Uninstalled provers" () in
let label = GMisc.label ~text:"Uninstalled provers policies" () in
let page =
GPack.vbox ~homogeneous:false ~packing:
(fun w -> ignore(notebook#append_page ~tab_label:label#coerce w)) ()
......
......@@ -474,6 +474,10 @@ let provers_factory =
let ( _ : GMenu.menu_item) = tools_factory#add_separator () in
new GMenu.factory tools_submenu_provers
(* context_tools : simplified tools menu for mouse-3 *)
let context_tools_menu = GMenu.menu ()
let context_tools_factory = new GMenu.factory context_tools_menu ~accel_group
(* 1.3 "View" menu items *)
......@@ -1593,7 +1597,7 @@ let (_ : GtkSignal.id) =
sel#select_path path
| _ -> ()
end;
tools_menu#popup ~button:3 ~time:(GdkEvent.Button.time ev);
context_tools_menu#popup ~button:3 ~time:(GdkEvent.Button.time ev);
true
| _ -> (* Other buttons *) false
end
......@@ -1948,14 +1952,21 @@ let add_submenu_strategy (shortcut,strategy) =
(String.map (function '_' -> ' ' | c -> c) strategy)
("run strategy " ^ strategy ^ " on selected goal" ^ pr_shortcut shortcut)
in
Opt.iter (fun (_,key,modi) -> i#add_accelerator ~group:tools_accel_group ~modi key)
(parse_shortcut_as_key shortcut);
let callback () =
Debug.dprintf debug "interp command '%s'@." strategy;
interp strategy
in
connect_menu_item i ~callback;
let i = create_menu_item
context_tools_factory
(String.map (function '_' -> ' ' | c -> c) strategy)
("run strategy " ^ strategy ^ " on selected goal" ^ pr_shortcut shortcut)
in
Opt.iter (fun (_,key,modi) -> i#add_accelerator ~group:tools_accel_group ~modi key)
(parse_shortcut_as_key shortcut);
connect_menu_item i ~callback
let add_submenu_prover (shortcut,prover_name,prover_parseable_name) =
let i = create_menu_item
provers_factory
......@@ -1968,7 +1979,16 @@ let add_submenu_prover (shortcut,prover_name,prover_parseable_name) =
Debug.dprintf debug "interp command '%s'@." prover_parseable_name;
interp prover_parseable_name
in
connect_menu_item i ~callback
connect_menu_item i ~callback;
if not (List.mem prover_parseable_name gconfig.hidden_provers) then
begin
let i = create_menu_item
context_tools_factory
prover_name
("run prover " ^ prover_name ^ " on selected goal" ^ pr_shortcut shortcut)
in
connect_menu_item i ~callback;
end
......@@ -1994,7 +2014,7 @@ let init_completion provers transformations strategies commands =
provers
in
List.iter add_submenu_prover provers_sorted;
let ( _ : GMenu.menu_item) = context_tools_factory#add_separator () in
let all_strings =
List.fold_left (fun acc (shortcut,strategy) ->
Debug.dprintf debug "string for completion: '%s' '%s'@." shortcut strategy;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment