| Incomplete_proof ((proof, goal) as status) ->
sequents_viewer#load_sequents status;
sequents_viewer#goto_sequent goal
- | Proof proof ->
- sequents_viewer#load_logo_with_qed
- | No_proof ->
- sequents_viewer#load_logo
- | Intermediate _ ->
- assert false (* only the engine may be in this state *)
+ | Proof proof -> sequents_viewer#load_logo_with_qed
+ | No_proof -> sequents_viewer#load_logo
+ | Intermediate _ -> assert false (* only the engine may be in this state *)
in
script#addObserver sequents_observer;
script#addObserver browser_observer
let script = s () in
let status = script#status in
try
- if source_view#buffer#modified then
- begin
- match ask_unsaved main#toplevel with
- | `YES -> saveScript ()
- | `NO -> ()
- | `CANCEL -> raise MatitaTypes.Cancel
- end;
- (match script_fname with
- | None -> ()
- | Some fname ->
- ask_and_save_moo_if_needed main#toplevel fname status);
match self#chooseFile () with
| Some f ->
+ if source_view#buffer#modified then
+ begin
+ match ask_unsaved main#toplevel with
+ | `YES -> saveScript ()
+ | `NO -> ()
+ | `CANCEL -> raise MatitaTypes.Cancel
+ end;
+ (match script_fname with
+ | None -> ()
+ | Some fname ->
+ ask_and_save_moo_if_needed main#toplevel fname status);
script#reset ();
script#assignFileName f;
source_view#source_buffer#begin_not_undoable_action ();
w#remove cicMathView#coerce;
scrolledWin <- None
| None -> ());
- for i = 0 to pages do notebook#remove_page 0 done;
+ (match switch_page_callback with
+ | Some id ->
+ GtkSignal.disconnect notebook#as_widget id;
+ switch_page_callback <- None
+ | None -> ());
+ for i = 0 to pages do notebook#remove_page 0 done;
notebook#set_show_tabs true;
pages <- 0;
page2goal <- [];
goal2page <- [];
goal2win <- [];
- _metasenv <- [];
+ _metasenv <- [];
self#script#setGoal ~-1;
- (match switch_page_callback with
- | Some id ->
- GtkSignal.disconnect notebook#as_widget id;
- switch_page_callback <- None
- | None -> ())
method load_sequents (status: ProofEngineTypes.status) =
let ((_, metasenv, _, _), goal) = status in
method loadFromFile f =
buffer#set_text (MatitaMisc.input_file f);
- self#goto_top;
+ self#reset_buffer;
buffer#set_modified false
method assignFileName file =
end
method private goto_top =
- MatitaSync.time_travel ~present:self#status ~past:init;
+ MatitaSync.time_travel ~present:self#status ~past:init
+
+ method private reset_buffer =
statements <- [];
history <- [ init ];
userGoal <- ~-1;
+ self#notify;
buffer#remove_tag locked_tag ~start:buffer#start_iter ~stop:buffer#end_iter;
buffer#move_mark (`MARK locked_mark) ~where:buffer#start_iter
method reset () =
- self#goto_top;
+ self#reset_buffer;
source_buffer#begin_not_undoable_action ();
buffer#delete ~start:buffer#start_iter ~stop:buffer#end_iter;
source_buffer#end_not_undoable_action ();
- self#notify;
buffer#set_modified false
-
+
method template () =
let template = MatitaMisc.input_file BuildTimeConf.script_template in
buffer#insert ~iter:(buffer#get_iter `START) template;
let getoldpos _ = buffer#get_iter_at_mark old_locked_mark in
let dispose_old_locked_mark () = buffer#delete_mark old_locked_mark in
match pos with
- | `Top -> dispose_old_locked_mark (); self#goto_top; self#notify
+ | `Top ->
+ dispose_old_locked_mark ();
+ self#goto_top;
+ self#reset_buffer;
+ self#notify
| `Bottom ->
(try
let rec dowhile () =