From 6e289c07138a9840beff4833b57521593fd732b1 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Mon, 13 Jun 2005 15:22:36 +0000 Subject: [PATCH] cosmetic fix --- helm/matita/matitaGtkMisc.ml | 16 ++++++++++++---- helm/matita/matitaGtkMisc.mli | 9 +++++++-- helm/matita/matitaGui.ml | 9 +++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/helm/matita/matitaGtkMisc.ml b/helm/matita/matitaGtkMisc.ml index 7c8b611a2..0971cf1bb 100644 --- a/helm/matita/matitaGtkMisc.ml +++ b/helm/matita/matitaGtkMisc.ml @@ -57,11 +57,19 @@ let connect_key (ev:GObj.event_ops) ?(modifiers = []) ?(stop = false) key stop | _ -> false))) -let toggle_visibility ~(win: GWindow.window) ~(check: GMenu.check_menu_item) = +let toggle_widget_visibility ~(widget: GObj.widget) + ~(check: GMenu.check_menu_item) += + ignore (check#connect#toggled (fun _ -> + if check#active then widget#misc#show () else widget#misc#hide ())) + +let toggle_window_visibility ~(window: GWindow.window) + ~(check: GMenu.check_menu_item) += ignore (check#connect#toggled (fun _ -> - if check#active then win#show () else win#misc#hide ())); - ignore (win#event#connect#delete (fun _ -> - win#misc#hide (); + if check#active then window#show () else window#misc#hide ())); + ignore (window#event#connect#delete (fun _ -> + window#misc#hide (); check#set_active false; true)) diff --git a/helm/matita/matitaGtkMisc.mli b/helm/matita/matitaGtkMisc.mli index 32b1fe53b..575329330 100644 --- a/helm/matita/matitaGtkMisc.mli +++ b/helm/matita/matitaGtkMisc.mli @@ -27,8 +27,13 @@ (** given a window and a check menu item it links the two so that the former * is only hidden on delete and the latter toggle show/hide of the former *) -val toggle_visibility: - win:GWindow.window -> check:GMenu.check_menu_item -> unit +val toggle_window_visibility: + window:GWindow.window -> check:GMenu.check_menu_item -> unit + + (** given a window and a check menu item it links the two so that the former + * is only hidden on delete and the latter toggle show/hide of the former *) +val toggle_widget_visibility: + widget:GObj.widget -> check:GMenu.check_menu_item -> unit val toggle_win: ?check:GMenu.check_menu_item -> GWindow.window -> unit -> unit diff --git a/helm/matita/matitaGui.ml b/helm/matita/matitaGui.ml index 7256601b6..899c4b41e 100644 --- a/helm/matita/matitaGui.ml +++ b/helm/matita/matitaGui.ml @@ -154,12 +154,9 @@ class gui () = connect_button tbar#assumptionButton (tac (A.Assumption loc)); connect_button tbar#cutButton (tac_w_term (A.Cut (loc, hole))); connect_button tbar#autoButton (tac (A.Auto (loc,None))); - ignore(self#main#tacticsBarMenuItem#connect#toggled - ~callback:(fun _ -> - if self#main#tacticsBarMenuItem#active then - self#main#tacticsButtonsHandlebox#misc#show () - else - self#main#tacticsButtonsHandlebox#misc#hide ())); + MatitaGtkMisc.toggle_widget_visibility + ~widget:(self#main#tacticsButtonsHandlebox :> GObj.widget) + ~check:self#main#tacticsBarMenuItem; let module Hr = Helm_registry in if not(Hr.get_opt_default Hr.get_bool false "matita.tactics_bar") then self#main#tacticsBarMenuItem#set_active false; -- 2.39.2