MatitaConsole.console ~evbox:main#consoleEventBox ~phrase_sep:";;"
~packing:main#scrolledConsole#add ()
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 ())
| `CANCEL -> return None
| `HELP -> ()
| `DELETE_EVENT -> return None));
+ (* script *)
(* menus *)
List.iter (fun w -> w#misc#set_sensitive false)
[ main#saveMenuItem; main#saveAsMenuItem ];
GtkThread.main ();
chosen_file
+ method askText ?(title = "") ?(msg = "") () =
+ let dialog = new textDialog () in
+ dialog#textDialog#set_title title;
+ dialog#textDialogLabel#set_label msg;
+ let text = ref None in
+ let return v =
+ text := v;
+ dialog#textDialog#destroy ();
+ 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 _ ->
+ let text = dialog#textDialogTextView#buffer#get_text () in
+ 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 =