* http://helm.cs.unibo.it/
*)
-(*
-class stringListModel' uriChoiceDialog =
- let tree_view = uriChoiceDialog#uriChoiceTreeView in
- let column_list = new GTree.column_list in
- let text_column = column_list#add Gobject.Data.string in
- let list_store = GTree.list_store column_list in
- let renderer = (GTree.cell_renderer_text [], ["text", text_column]) in
- let view_column = GTree.view_column ~renderer () in
- let _ = tree_view#set_model (Some (list_store :> GTree.model)) in
- let _ = tree_view#append_column view_column in
- object
- method append s =
- let tree_iter = list_store#append () in
- list_store#set ~row:tree_iter ~column:text_column s
- method clear () = list_store#clear ()
- end
-*)
-
open Printf
open MatitaGeneratedGui
let script = new scriptWin ~file () in
let keyBindingBoxes = (* event boxes which should receive global key events *)
[ toolbar#toolBarEventBox; proof#proofWinEventBox; main#mainWinEventBox;
- check#checkWinEventBox; script#scriptWinEventBox ]
+ check#checkWinEventBox; script#scriptWinEventBox; main#consoleEventBox ]
in
let console =
- MatitaConsole.console ~evbox:main#consoleEventBox ~phrase_sep:";;"
- ~packing:main#scrolledConsole#add ()
+ MatitaConsole.console ~evbox:main#consoleEventBox
+ ~phrase_sep:BuildTimeConf.phrase_sep
+ ~packing:main#scrolledConsole#add ~paned:main#mainVPanes ()
in
+ let script_buf = script#scriptTextView#buffer in
object (self)
val mutable chosen_file = None
+ (** text mark and tag representing locked part of a script *)
+ val locked_mark =
+ script_buf#create_mark ~name:"locked" ~left_gravity:true
+ script_buf#start_iter
+ val locked_tag =
+ script_buf#create_tag [`BACKGROUND "green"; `EDITABLE false]
+
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 check; c script ]);
- (* show/hide commands *)
- toggle_visibility toolbar#toolBarWin main#showToolBarMenuItem;
- toggle_visibility proof#proofWin main#showProofMenuItem;
- toggle_visibility check#checkWin main#showCheckMenuItem;
- toggle_visibility script#scriptWin main#showScriptMenuItem;
- (* "global" key bindings *)
- List.iter (fun (key, callback) -> self#addKeyBinding key callback)
+ (* key bindings *)
+ List.iter (* global key bindings *)
+ (fun (key, callback) -> self#addKeyBinding key callback)
[ GdkKeysyms._F3,
toggle_win ~check:main#showProofMenuItem proof#proofWin;
GdkKeysyms._F4,
toggle_win ~check:main#showCheckMenuItem check#checkWin;
GdkKeysyms._F5,
toggle_win ~check:main#showScriptMenuItem script#scriptWin;
+ GdkKeysyms._x, (fun () -> console#toggle ());
];
+ add_key_binding GdkKeysyms._Escape console#hide main#consoleEventBox;
(* about win *)
ignore (about#aboutWin#event#connect#delete (fun _ -> true));
ignore (main#aboutMenuItem#connect#activate (fun _ ->
about#aboutWin#show ()));
- ignore (about#aboutDismissButton#connect#clicked (fun _ ->
- about#aboutWin#misc#hide ()));
+ connect_button about#aboutDismissButton (fun _ ->
+ about#aboutWin#misc#hide ());
about#aboutLabel#set_label (Pcre.replace ~pat:"@VERSION@"
~templ:BuildTimeConf.version about#aboutLabel#label);
(* file selection win *)
| `CANCEL -> return None
| `HELP -> ()
| `DELETE_EVENT -> return None));
+ (* script *)
(* menus *)
+ toggle_visibility toolbar#toolBarWin main#showToolBarMenuItem;
+ toggle_visibility proof#proofWin main#showProofMenuItem;
+ toggle_visibility check#checkWin main#showCheckMenuItem;
+ toggle_visibility script#scriptWin main#showScriptMenuItem;
List.iter (fun w -> w#misc#set_sensitive false)
[ main#saveMenuItem; main#saveAsMenuItem ];
main#helpMenu#set_right_justified true;
+ ignore (main#showConsoleMenuItem#connect#activate console#toggle);
+ (* main *)
+ connect_button main#hideConsoleButton console#hide;
+(*
(* console *)
console#echo_message (sprintf "\tMatita version %s\n"
BuildTimeConf.version);
console#echo_prompt ();
- console#misc#grab_focus ()
+ console#misc#grab_focus ();
+*)
method about = about
method check = check
GMain.Main.quit ()
in
ignore (dialog#textDialog#event#connect#delete (fun _ -> true));
- ignore (dialog#textDialogCancelButton#connect#clicked (fun _ ->
- return None));
- ignore (dialog#textDialogOkButton#connect#clicked (fun _ ->
+ connect_button dialog#textDialogCancelButton (fun _ -> return None);
+ connect_button dialog#textDialogOkButton (fun _ ->
let text = dialog#textDialogTextView#buffer#get_text () in
- return (Some text)));
+ return (Some text));
dialog#textDialog#show ();
GtkThread.main ();
!text
+ method lockScript offset =
+ let mark = `MARK locked_mark in
+ script_buf#move_mark mark ~where:(script_buf#get_iter_at_char offset);
+ script_buf#remove_tag locked_tag ~start:script_buf#start_iter
+ ~stop:script_buf#end_iter;
+ script_buf#apply_tag locked_tag ~start:script_buf#start_iter
+ ~stop:(script_buf#get_iter_at_mark mark)
+
end
let instance =