]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaGui.ml
snapshot (notably: implemented "check")
[helm.git] / helm / matita / matitaGui.ml
index 6ad3e81e0c015e57c1ff40e83a6c283a0c14c904..70a909a57c0a05234f8ae93061fd790b8ae34372 100644 (file)
@@ -41,6 +41,8 @@ class stringListModel' uriChoiceDialog =
   end
 *)
 
+open Printf
+
 open MatitaGeneratedGui
 open MatitaGtkMisc
 
@@ -51,24 +53,24 @@ class gui file =
   let about = new aboutWin ~file () in
   let fileSel = new fileSelectionWin ~file () in
   let proof = new proofWin ~file () in
+  let check = new checkWin ~file () in
   let keyBindingBoxes = (* event boxes which should receive global key events *)
-    [ toolbar#toolBarEventBox; proof#proofWinEventBox ]
+    [ toolbar#toolBarEventBox; proof#proofWinEventBox; main#mainWinEventBox ]
   in
-  let console = MatitaConsole.console ~packing:main#scrolledConsole#add () in
-  let _ =
-    console#echo_message "message";
-    console#echo_error "error";
-    console#echo_prompt ()
+  let console =
+    MatitaConsole.console ~evbox:main#consoleEventBox
+      ~packing:main#scrolledConsole#add ()
   in
   object (self)
     initializer
         (* glade's check widgets *)
       List.iter (fun w -> w#check_widgets ())
         (let c w = (w :> <check_widgets: unit -> unit>) in
-         [ c about; c fileSel; c main; c proof; c toolbar ]);
+         [ c about; c fileSel; c main; c proof; c toolbar; c check ]);
         (* show/hide commands *)
       toggle_visibility toolbar#toolBarWin main#showToolBarMenuItem;
       toggle_visibility proof#proofWin main#showProofMenuItem;
+      toggle_visibility check#checkWin main#showCheckMenuItem;
         (* "global" key bindings *)
       List.iter (fun (key, callback) -> self#addKeyBinding key callback)
         [ GdkKeysyms._F3,
@@ -80,18 +82,25 @@ class gui file =
         about#aboutWin#show ()));
       ignore (about#aboutDismissButton#connect#clicked (fun _ ->
         about#aboutWin#misc#hide ()));
+      about#aboutLabel#set_label (Pcre.replace ~pat:"@VERSION@"
+        ~templ:BuildTimeConf.version about#aboutLabel#label);
         (* menus *)
       List.iter (fun w -> w#misc#set_sensitive false)
         [ main#saveMenuItem; main#saveAsMenuItem ];
       main#helpMenu#set_right_justified true;
-        (* uri choice *)
-      ()
+        (* console *)
+      console#echo_message (sprintf "\tMatita version %s\n"
+        BuildTimeConf.version);
+      console#echo_prompt ();
+      console#misc#grab_focus ()
 
-    method toolbar = toolbar
-    method main = main
     method about = about
+    method check = check
+    method console = console
     method fileSel = fileSel
+    method main = main
     method proof = proof
+    method toolbar = toolbar
 
     method newUriDialog () =
       let dialog = new uriChoiceDialog ~file () in
@@ -122,5 +131,11 @@ class gui file =
       ignore (main#quitMenuItem#connect#activate callback);
       self#addKeyBinding GdkKeysyms._q callback
 
+    method setPhraseCallback = console#set_callback
+
   end
 
+let instance =
+  let gui = lazy (new gui (Helm_registry.get "matita.glade_file")) in
+  fun () -> Lazy.force gui
+