+let proof_viewer = MatitaMathView.proof_viewer_instance ()
+let sequent_viewer = MatitaMathView.sequent_viewer ~show:true ()
+let sequents_viewer =
+ let set_goal goal =
+ if not (currentProof#onGoing ()) then assert false;
+ currentProof#proof#set_goal goal
+ in
+ MatitaMathView.sequents_viewer ~notebook:gui#main#sequentsNotebook
+ ~sequent_viewer ~set_goal ()
+let _ = (* attach observers to proof status *)
+ let proof_observer _ (status, ()) =
+ let ((uri_opt, _, _, _), _) = status in
+ proof_viewer#load_proof status;
+ in
+ let sequents_observer _ (((_, metasenv, _, _), goal_opt), ()) =
+ sequents_viewer#reset;
+ (match goal_opt with
+ | None -> ()
+ | Some goal ->
+ sequents_viewer#load_sequents metasenv;
+ sequents_viewer#goto_sequent goal)
+ in
+ currentProof#addObserver sequents_observer;
+ currentProof#addObserver proof_observer;
+ currentProof#connect `Quit (fun () ->
+ (* quit program, asking for confirmation if needed *)
+ if not (currentProof#onGoing ()) ||
+ (ask_confirmation ~gui
+ ~msg:("Proof in progress, are you sure you want to quit?") ())
+ then
+ GMain.Main.quit ();
+ false);
+ currentProof#connect `Abort (fun () -> sequents_viewer#reset; false)
+
+let mathViewer = MatitaMathView.mathViewer ()
+let cicBrowser = MatitaMathView.cicBrowser ()
+let interpreter =
+ let console = (gui#console :> MatitaTypes.console) in
+ let currentProof = (currentProof :> MatitaTypes.currentProof) in
+ new MatitaInterpreter.interpreter
+ ~disambiguator ~currentProof ~console ~mathViewer ~dbd ()
+let _ =
+ let href_callback uri =
+ let term = CicAst.Uri (UriManager.string_of_uri uri, None) in
+ ignore (interpreter#evalAst (TacticAst.Command (TacticAst.Check term)))
+ in
+ proof_viewer#set_href_callback (Some href_callback);
+ sequent_viewer#set_href_callback (Some href_callback);
+ mathViewer#set_href_callback (Some href_callback)
+
+(** {2 Script window handling} *)