]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaGui.ml
snapshot, notably:
[helm.git] / helm / matita / matitaGui.ml
index d50a2f31964d5fe50865e9c24e674abf0672488a..9226ea7b680e78c05eacb771fa179b038a34f52e 100644 (file)
@@ -64,9 +64,17 @@ class gui file =
     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 ())
@@ -109,6 +117,7 @@ class gui file =
         | `CANCEL -> return None
         | `HELP -> ()
         | `DELETE_EVENT -> return None));
+        (* script *)
         (* menus *)
       List.iter (fun w -> w#misc#set_sensitive false)
         [ main#saveMenuItem; main#saveAsMenuItem ];
@@ -184,6 +193,14 @@ class gui file =
       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 =