]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaGui.ml
The getter maps are now dumped also if matitac exits abruptly.
[helm.git] / helm / matita / matitaGui.ml
index 5045f36d1aa5148bd3ec80c2f3c3a7fa4b46ed26..d18b82d140833f1cedfdc78db10d728f6af639cb 100644 (file)
@@ -225,14 +225,36 @@ class gui () =
            let buf = self#main#scriptTextView#buffer in
            buf#insert ~iter:(buf#get_iter_at_mark `INSERT) "\n";
            advance ());
+         (* script monospace font stuff *)  
+      let font =
+        Helm_registry.get_opt_default Helm_registry.get
+          BuildTimeConf.default_script_font "matita.script_font"
+      in
+(*       let monospace_tag = 
+        self#main#scriptTextView#buffer#create_tag [`FONT_DESC font] 
+      in *)
+      self#main#scriptTextView#misc#modify_font_by_name font;
+(*       let _ = 
+        self#main#scriptTextView#buffer#connect#changed ~callback:(fun _ ->
+          let start, stop = self#main#scriptTextView#buffer#bounds in
+          self#main#scriptTextView#buffer#apply_tag monospace_tag start stop)
+      in *)
         (* debug menu *)
       self#main#debugMenu#misc#hide ();
         (* status bar *)
-      self#main#hintLowImage#set_file "icons/matita-bulb-low.png";
-      self#main#hintMediumImage#set_file "icons/matita-bulb-medium.png";
-      self#main#hintHighImage#set_file "icons/matita-bulb-high.png";
+      self#main#hintLowImage#set_file (image_path "matita-bulb-low.png");
+      self#main#hintMediumImage#set_file (image_path "matita-bulb-medium.png");
+      self#main#hintHighImage#set_file (image_path "matita-bulb-high.png");
         (* focus *)
-      self#main#scriptTextView#misc#grab_focus ()
+      self#main#scriptTextView#misc#grab_focus ();
+        (* main win dimension *)
+      let width = Gdk.Screen.width () in
+      let height = Gdk.Screen.height () in
+      let main_w = width * 90 / 100 in 
+      let main_h = height * 80 / 100 in
+      let script_w = main_w / 2 in
+      self#main#toplevel#resize ~width:main_w ~height:main_h;
+      self#main#hpaneScriptSequent#set_position script_w  
     
     method loadScript file =       
       let script = MatitaScript.instance () in
@@ -254,30 +276,6 @@ class gui () =
 
     method newBrowserWin () =
       let win = new browserWin () in
-      win#whelpImage2#set_file "icons/whelp.png";
-      win#whelpBarToggleButton#set_active false;   
-      win#whelpBarBox#misc#hide ();
-      win#mathOrListNotebook#set_show_tabs false;
-      connect_toggle_button win#whelpBarToggleButton 
-        (fun () -> 
-          if win#whelpBarToggleButton#active then
-            win#whelpBarBox#misc#show ()
-          else
-            win#whelpBarBox#misc#hide ());
-      let queries = ["Locate";"Hint";"Match";"Elim";"Instance"] in
-      let combo,(combo_store,combo_column) = 
-        GEdit.combo_box_text ~strings:queries () 
-      in
-      combo#set_active 0;
-      win#comboVbox#add (combo :> GObj.widget);
-      let start_query () = 
-        let query = String.lowercase (List.nth queries combo#active) in
-        let input = win#queryInputText#text in
-        let statement = "whelp " ^ query ^ " " ^ input ^ "." in
-        (MatitaScript.instance ())#advance ~statement ()
-      in
-      ignore(win#queryInputText#connect#activate ~callback:start_query);
-      ignore(combo#connect#changed ~callback:start_query);
       win#check_widgets ();
       win
 
@@ -351,10 +349,12 @@ let is_var_uri s =
     String.sub s (String.length s - 4) 4 = ".var"
   with Invalid_argument _ -> false
 
+(* this is a shit and should be changed :-{ *)
 let interactive_uri_choice
   ?(selection_mode:[`SINGLE|`MULTIPLE] = `MULTIPLE) ?(title = "")
   ?(msg = "") ?(nonvars_button = false) ?(hide_uri_entry=false) 
-  ?(hide_try=false) ?(ok_label="_Auto") ?copy_cb ()
+  ?(hide_try=false) ?(ok_label="_Auto") ?(ok_action:[`SELECT|`AUTO] = `AUTO) 
+  ?copy_cb ()
   ~id uris
 =
   let gui = instance () in
@@ -399,9 +399,15 @@ let interactive_uri_choice
     ignore (dialog#uriChoiceDialog#event#connect#delete (fun _ -> true));
     connect_button dialog#uriChoiceConstantsButton (fun _ ->
       return (Some (Lazy.force nonvars_uris)));
-    connect_button dialog#uriChoiceAutoButton (fun _ ->
-      Helm_registry.set_bool "matita.auto_disambiguation" true;
-      return (Some (Lazy.force nonvars_uris)));
+    if ok_action = `AUTO then
+      connect_button dialog#uriChoiceAutoButton (fun _ ->
+        Helm_registry.set_bool "matita.auto_disambiguation" true;
+        return (Some (Lazy.force nonvars_uris)))
+    else
+      connect_button dialog#uriChoiceAutoButton (fun _ ->
+        match model#easy_selection () with
+        | [] -> ()
+        | uris -> return (Some uris));
     connect_button dialog#uriChoiceSelectedButton (fun _ ->
       match model#easy_selection () with
       | [] -> ()