X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=helm%2Fmatita%2FmatitaGui.ml;h=0a0239aeb4769b7eaff04b8a84c4ba8c265bb74b;hb=5388b96750d501a187a961b802e4b2c533f093c3;hp=eb75ac11042da2148a198472aebeaa33047583db;hpb=b6e1e47a8fdb45e9e47af9dfd047a0241ecf59c1;p=helm.git diff --git a/helm/matita/matitaGui.ml b/helm/matita/matitaGui.ml index eb75ac110..0a0239aeb 100644 --- a/helm/matita/matitaGui.ml +++ b/helm/matita/matitaGui.ml @@ -107,7 +107,6 @@ let ask_unsaved parent = class gui () = (* creation order _is_ relevant for windows placement *) let main = new mainWin () in - let about = new aboutWin () in let fileSel = new fileSelectionWin () in let findRepl = new findReplWin () in let develList = new develListWin () in @@ -142,7 +141,7 @@ class gui () = (* glade's check widgets *) List.iter (fun w -> w#check_widgets ()) (let c w = (w :> unit>) in - [ c about; c fileSel; c main; c findRepl]); + [ c fileSel; c main; c findRepl]); (* key bindings *) List.iter (* global key bindings *) (fun (key, callback) -> self#addKeyBinding key callback) @@ -154,13 +153,33 @@ class gui () = *) [ ]; (* about win *) - ignore (about#aboutWin#event#connect#delete (fun _ -> true)); - ignore (main#aboutMenuItem#connect#activate (fun _ -> - about#aboutWin#show ())); - connect_button about#aboutDismissButton (fun _ -> - about#aboutWin#misc#hide ()); - about#aboutLabel#set_label (Pcre.replace ~pat:"@VERSION@" - ~templ:BuildTimeConf.version about#aboutLabel#label); + let parse_txt_file file = + let ch = open_in file in + let l_rev = ref [] in + try + while true do + l_rev := input_line ch :: !l_rev; + done; + assert false + with + End_of_file -> + close_in ch; + List.rev !l_rev in + let about_dialog = + GWindow.about_dialog + ~authors:(parse_txt_file "AUTHORS") + ~comments:"comments" + ~copyright:"Copyright (C) 2005, the HELM team" + ~license:(String.concat "\n" (parse_txt_file "LICENSE")) + (*?logo:GdkPixbuf.pixbuf*) + (*?logo_icon_name:string*) + ~name:"Matita" + ~version:BuildTimeConf.version + ~website:"http://helm.cs.unibo.it" + () + in + ignore (main#aboutMenuItem#connect#activate + (fun _ -> about_dialog#present ())); (* findRepl win *) let show_find_Repl () = findRepl#toplevel#misc#show (); @@ -325,6 +344,20 @@ class gui () = ignore(self#main#findReplMenuItem#connect#activate ~callback:show_find_Repl); ignore (findRepl#findEntry#connect#activate ~callback:find_forward); + (* interface lockers *) + let lock_world _ = + main#buttonsToolbar#misc#set_sensitive false; + source_view#set_editable false + in + let unlock_world _ = + main#buttonsToolbar#misc#set_sensitive true; + source_view#set_editable true + in + let locker f = + fun () -> + lock_world (); + try f ();unlock_world () with exc -> unlock_world (); raise exc + in (* developments win *) let model = new MatitaGtkMisc.multiStringListModel @@ -360,12 +393,20 @@ class gui () = (fun () -> match get_devel_selected () with | None -> () - | Some d -> ignore(MatitamakeLib.build_development_in_bg refresh d)); + | Some d -> + let build = locker + (fun () -> MatitamakeLib.build_development_in_bg refresh d) + in + ignore(build ())); connect_button develList#cleanButton (fun () -> match get_devel_selected () with | None -> () - | Some d -> ignore(MatitamakeLib.clean_development_in_bg refresh d)); + | Some d -> + let clean = locker + (fun () -> MatitamakeLib.clean_development_in_bg refresh d) + in + ignore(clean ())); connect_button develList#closeButton (fun () -> develList#toplevel#misc#hide()); ignore(develList#toplevel#event#connect#delete @@ -446,7 +487,6 @@ class gui () = | `DELETE_EVENT -> return None)); (* menus *) List.iter (fun w -> w#misc#set_sensitive false) [ main#saveMenuItem ]; - main#helpMenu#set_right_justified true; (* console *) let adj = main#logScrolledWin#vadjustment in ignore (adj#connect#changed @@ -575,24 +615,11 @@ class gui () = source_buffer#place_cursor (source_buffer#get_iter_at_mark (`NAME "locked")) in - let lock_world _ = - main#buttonsToolbar#misc#set_sensitive false; - source_view#set_editable false - in - let unlock_world _ = - main#buttonsToolbar#misc#set_sensitive true; - source_view#set_editable true - in let advance _ = (MatitaScript.instance ())#advance (); cursor () in let retract _ = (MatitaScript.instance ())#retract (); cursor () in let top _ = (MatitaScript.instance ())#goto `Top (); cursor () in let bottom _ = (MatitaScript.instance ())#goto `Bottom (); cursor () in let jump _ = (MatitaScript.instance ())#goto `Cursor (); cursor () in - let locker f = - fun () -> - lock_world (); - try f ();unlock_world () with exc -> unlock_world (); raise exc - in let advance = locker advance in let retract = locker retract in let top = locker top in @@ -712,7 +739,6 @@ class gui () = method console = console method sourceView: GSourceView.source_view = (source_view: GSourceView.source_view) - method about = about method fileSel = fileSel method findRepl = findRepl method main = main