X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=helm%2Fsoftware%2Fmatita%2FmatitaGui.ml;h=8bc226ed4a4bdbbbf33292d7afaa3a4f75c6f406;hb=424982ded255df68245241f56064202844ed1194;hp=55b044ba44662b286493d077229d9ced6b82955c;hpb=68f3812e06c04ddd664e86dbfd3a1c32f96a22d1;p=helm.git
diff --git a/helm/software/matita/matitaGui.ml b/helm/software/matita/matitaGui.ml
index 55b044ba4..8bc226ed4 100644
--- a/helm/software/matita/matitaGui.ml
+++ b/helm/software/matita/matitaGui.ml
@@ -42,7 +42,7 @@ class type browserWin =
* lablgladecc :-(((( *)
object
inherit MatitaGeneratedGui.browserWin
- method browserUri: GEdit.combo_box_entry
+ method browserUri: GEdit.entry
end
class console ~(buffer: GText.buffer) () =
@@ -754,9 +754,60 @@ class gui () =
ignore (adj#connect#changed
(fun _ -> adj#set_value (adj#upper -. adj#page_size)));
console#message (sprintf "\tMatita version %s\n" BuildTimeConf.version);
- (* TO BE REMOVED *)
+ (* natural deduction palette *)
main#tacticsButtonsHandlebox#misc#hide ();
- main#tacticsBarMenuItem#misc#hide ();
+ MatitaGtkMisc.toggle_callback
+ ~callback:(fun b ->
+ if b then main#tacticsButtonsHandlebox#misc#show ()
+ else main#tacticsButtonsHandlebox#misc#hide ())
+ ~check:main#menuitemPalette;
+ connect_button main#butImpl_intro
+ (fun () -> source_buffer#insert "apply rule (â_i [â¦] (â¦));\n");
+ connect_button main#butAnd_intro
+ (fun () -> source_buffer#insert
+ "apply rule (â§_i (â¦) (â¦));\n\t[\n\t|\n\t]\n");
+ connect_button main#butOr_intro_left
+ (fun () -> source_buffer#insert "apply rule (â¨_i_l (â¦));\n");
+ connect_button main#butOr_intro_right
+ (fun () -> source_buffer#insert "apply rule (â¨_i_r (â¦));\n");
+ connect_button main#butNot_intro
+ (fun () -> source_buffer#insert "apply rule (¬_i [â¦] (â¦));\n");
+ connect_button main#butTop_intro
+ (fun () -> source_buffer#insert "apply rule (â¤_i);\n");
+ connect_button main#butImpl_elim
+ (fun () -> source_buffer#insert
+ "apply rule (â_e (â¦) (â¦));\n\t[\n\t|\n\t]\n");
+ connect_button main#butAnd_elim_left
+ (fun () -> source_buffer#insert "apply rule (â§_e_l (â¦));\n");
+ connect_button main#butAnd_elim_right
+ (fun () -> source_buffer#insert "apply rule (â§_e_r (â¦));\n");
+ connect_button main#butOr_elim
+ (fun () -> source_buffer#insert
+ "apply rule (â¨_e (â¦) [â¦] (â¦) [â¦] (â¦));\n\t[\n\t|\n\t|\n\t]\n");
+ connect_button main#butNot_elim
+ (fun () -> source_buffer#insert
+ "apply rule (¬_e (â¦) (â¦));\n\t[\n\t|\n\t]\n");
+ connect_button main#butBot_elim
+ (fun () -> source_buffer#insert "apply rule (â¥_e (â¦));\n");
+ connect_button main#butRAA
+ (fun () -> source_buffer#insert "apply rule (RAA [â¦] (â¦));\n");
+ connect_button main#butUseLemma
+ (fun () -> source_buffer#insert "apply rule (lem â¦);\n");
+ connect_button main#butDischarge
+ (fun () -> source_buffer#insert "apply rule (discharge [â¦]);\n");
+
+ connect_button main#butForall_intro
+ (fun () -> source_buffer#insert "apply rule (â_i {â¦} (â¦));\n");
+ connect_button main#butForall_elim
+ (fun () -> source_buffer#insert "apply rule (â_e {â¦} (â¦));\n");
+ connect_button main#butExists_intro
+ (fun () -> source_buffer#insert "apply rule (â_i {â¦} (â¦));\n");
+ connect_button main#butExists_elim
+ (fun () -> source_buffer#insert
+ "apply rule (â_e (â¦) {â¦} [â¦] (â¦));\n\t[\n\t|\n\t]\n");
+
+
+ (* TO BE REMOVED *)
main#scriptNotebook#remove_page 1;
main#scriptNotebook#set_show_tabs false;
(* / TO BE REMOVED *)
@@ -843,6 +894,8 @@ class gui () =
source_view#source_buffer#begin_not_undoable_action ();
script#loadFromFile f;
source_view#source_buffer#end_not_undoable_action ();
+ source_view#buffer#move_mark `INSERT source_view#buffer#start_iter;
+ source_view#buffer#place_cursor source_view#buffer#start_iter;
console#message ("'"^f^"' loaded.\n");
self#_enableSaveTo f
| None -> ()
@@ -907,31 +960,12 @@ class gui () =
(fun _ -> MatitaAutoGui.auto_dialog Auto.get_auto_status);
connect_menu_item main#showTermGrammarMenuItem
(fun _ ->
- let w = GWindow.window ~resizable:true
- ~position:`CENTER_ON_PARENT
- ~title:"Terms grammar" ~width:640 ~height:400 () in
- w#set_transient_for (main#toplevel#as_window);
- let s = GBin.scrolled_window () in
- (w :> GContainer.container)#add (s :> GObj.widget);
- let t = GText.view () in
- t#buffer#insert (Print_grammar.ebnf_of_term ());
- s#add (t:>GObj.widget);
- w#show ());
+ let c = MatitaMathView.cicBrowser () in
+ c#load (`About `Grammar));
connect_menu_item main#showUnicodeTable
(fun _ ->
- let w = GWindow.window ~resizable:true
- ~position:`CENTER_ON_PARENT
- ~title:"Tex/UTF8 table" ~width:640 ~height:400 () in
- w#set_transient_for (main#toplevel#as_window);
- let s = GBin.scrolled_window () in
- (w :> GContainer.container)#add (s :> GObj.widget);
- let t = GTree.view () in
- let m = new MatitaGtkMisc.multiStringListModel ~cols:2 t in
- List.iter (fun (k,vs) ->
- m#easy_mappend [k;String.concat " " vs])
- (Utf8Macro.pp_table ());
- s#add (t:>GObj.widget);
- w#show ());
+ let c = MatitaMathView.cicBrowser () in
+ c#load (`About `TeX));
(* script monospace font stuff *)
self#updateFontSize ();
(* debug menu *)
@@ -981,7 +1015,7 @@ class gui () =
end));
(* math view handling *)
connect_menu_item main#newCicBrowserMenuItem (fun () ->
- ignore (MatitaMathView.cicBrowser ()));
+ ignore(MatitaMathView.cicBrowser ()));
connect_menu_item main#increaseFontSizeMenuItem (fun () ->
self#increaseFontSize ();
MatitaMathView.increase_font_size ();
@@ -1153,6 +1187,8 @@ class gui () =
source_view#source_buffer#begin_not_undoable_action ();
script#loadFromFile content;
source_view#source_buffer#end_not_undoable_action ();
+ source_view#buffer#move_mark `INSERT source_view#buffer#start_iter;
+ source_view#buffer#place_cursor source_view#buffer#start_iter;
console#message ("'"^file^"' loaded.");
self#_enableSaveTo file
@@ -1180,12 +1216,12 @@ class gui () =
method newBrowserWin () =
object (self)
inherit browserWin ()
- val combo = GEdit.combo_box_entry ()
+ val combo = GEdit.entry ()
initializer
self#check_widgets ();
let combo_widget = combo#coerce in
uriHBox#pack ~from:`END ~fill:true ~expand:true combo_widget;
- combo#entry#misc#grab_focus ()
+ combo#misc#grab_focus ()
method browserUri = combo
end
@@ -1250,7 +1286,8 @@ class gui () =
method private updateFontSize () =
self#sourceView#misc#modify_font_by_name
- (sprintf "%s %d" BuildTimeConf.script_font font_size)
+ (sprintf "%s %d" BuildTimeConf.script_font font_size);
+ MatitaAutoGui.set_font_size font_size
method increaseFontSize () =
font_size <- font_size + 1;
@@ -1394,9 +1431,10 @@ class interpModel =
tree_store#get ~row:iter ~column:interp_no_col
end
+
let interactive_string_choice
text prefix_len ?(title = "") ?(msg = "") () ~id locs uris
-=
+=
let gui = instance () in
let dialog = gui#newUriDialog () in
dialog#uriEntryHBox#misc#hide ();
@@ -1412,13 +1450,15 @@ let interactive_string_choice
let rec colorize acc_len = function
| [] ->
let floc = HExtlib.floc_of_loc (acc_len,hack_len) in
- fst(MatitaGtkMisc.utf8_parsed_text text floc)
+ escape_pango_markup (fst(MatitaGtkMisc.utf8_parsed_text text floc))
| he::tl ->
let start, stop = HExtlib.loc_of_floc he in
let floc1 = HExtlib.floc_of_loc (acc_len,start) in
let str1,_=MatitaGtkMisc.utf8_parsed_text text floc1 in
let str2,_ = MatitaGtkMisc.utf8_parsed_text text he in
- str1 ^ "" ^ str2 ^ "" ^ colorize stop tl
+ escape_pango_markup str1 ^ "" ^
+ escape_pango_markup str2 ^ "" ^
+ colorize stop tl
in
(* List.iter (fun l -> let start, stop = HExtlib.loc_of_floc l in
Printf.eprintf "(%d,%d)" start stop) locs; *)
@@ -1437,6 +1477,7 @@ let interactive_string_choice
let txt,_ = MatitaGtkMisc.utf8_parsed_text txt
(HExtlib.floc_of_loc (prefix_len,MatitaGtkMisc.utf8_string_length txt))
in
+ prerr_endline ("txt:" ^ txt);
dialog#uriChoiceLabel#set_label txt;
List.iter model#easy_append uris;
let return v =