matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
$(LABLGLADECC) $< > matitaGeneratedGui.ml
- $(OCAMLC) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
+ $(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
%.cmi: %.mli
$(OCAMLC) $(PKGS) -c $<
<?xml version="1.0" encoding="utf-8"?>
<helm_registry>
<section name="prefs">
- <key name="server">mowgli.cs.unibo.it</key>
-<!-- <key name="server">localhost</key> -->
+<!-- <key name="server">mowgli.cs.unibo.it</key> -->
+ <key name="server">localhost</key>
</section>
<section name="matita">
<key name="glade_file">matita.glade</key>
<section name="db">
<key name="host">$(prefs.server)</key>
<key name="user">helm</key>
-<!-- <key name="database">mowgli</key> -->
- <key name="database">matita</key>
+ <key name="database">mowgli</key>
+<!-- <key name="database">matita</key> -->
</section>
<section name="getter">
<key name="mode">remote</key>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_TOOLBAR</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
</child>
</widget>
+<widget class="GtkWindow" id="BrowserWin">
+ <property name="title" translatable="yes">Cic browser</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+
+ <child>
+ <widget class="GtkEventBox" id="BrowserWinEventBox">
+ <property name="visible">True</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="BrowserBackButton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image188">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-back</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="BrowserForwardButton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkImage" id="image189">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-forward</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="BrowserHomeButton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkImage" id="image190">
+ <property name="visible">True</property>
+ <property name="stock">gtk-home</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkImage" id="image187">
+ <property name="visible">True</property>
+ <property name="stock">gtk-yes</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBoxEntry" id="BrowserUriCombo">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkNotebook" id="BrowserNotebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <placeholder/>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">current proof</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
false);
currentProof#connect `Abort (fun () -> sequents_viewer#reset; false)
+let mathViewer = MatitaMathView.mathViewer ()
let interpreter =
let console = (gui#console :> MatitaTypes.console) in
let currentProof = (currentProof :> MatitaTypes.currentProof) in
new MatitaInterpreter.interpreter
- ~disambiguator ~currentProof ~console ~dbd ()
+ ~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} *)
(try
load_script Sys.argv.(1)
with Invalid_argument _ -> ());
+ gui#console#show ();
GtkThread.main ()
self#buffer#insert msg;
paned#set_position (self#get_max_position - console_height);
self#misc#grab_focus ()
- method hide () =
- paned#set_position self#get_max_position
+ method hide () = (* ZACK still not sure about the gui, for the moment just
+ * keep the console persistent *)
+ ()
+(* paned#set_position self#get_max_position *)
method toggle () =
let pos = self#get_position in
if pos > self#get_max_position - console_height then
toplevel#destroy ()
method check_widgets () = ()
end
+class browserWin ?(file="matita.glade") ?domain ?autoconnect(*=true*) () =
+ let xmldata = Glade.create ~file ~root:"BrowserWin" ?domain () in
+ object (self)
+ inherit Glade.xml ?autoconnect xmldata
+ val toplevel =
+ new GWindow.window (GtkWindow.Window.cast
+ (Glade.get_widget_msg ~name:"BrowserWin" ~info:"GtkWindow" xmldata))
+ method toplevel = toplevel
+ val browserWin =
+ new GWindow.window (GtkWindow.Window.cast
+ (Glade.get_widget_msg ~name:"BrowserWin" ~info:"GtkWindow" xmldata))
+ method browserWin = browserWin
+ val browserWinEventBox =
+ new GBin.event_box (GtkBin.EventBox.cast
+ (Glade.get_widget_msg ~name:"BrowserWinEventBox" ~info:"GtkEventBox" xmldata))
+ method browserWinEventBox = browserWinEventBox
+ val vbox7 =
+ new GPack.box (GtkPack.Box.cast
+ (Glade.get_widget_msg ~name:"vbox7" ~info:"GtkVBox" xmldata))
+ method vbox7 = vbox7
+ val hbox7 =
+ new GPack.box (GtkPack.Box.cast
+ (Glade.get_widget_msg ~name:"hbox7" ~info:"GtkHBox" xmldata))
+ method hbox7 = hbox7
+ val browserBackButton =
+ new GButton.button (GtkButton.Button.cast
+ (Glade.get_widget_msg ~name:"BrowserBackButton" ~info:"GtkButton" xmldata))
+ method browserBackButton = browserBackButton
+ val alignment3 =
+ new GBin.alignment (GtkBin.Alignment.cast
+ (Glade.get_widget_msg ~name:"alignment3" ~info:"GtkAlignment" xmldata))
+ method alignment3 = alignment3
+ val hbox6 =
+ new GPack.box (GtkPack.Box.cast
+ (Glade.get_widget_msg ~name:"hbox6" ~info:"GtkHBox" xmldata))
+ method hbox6 = hbox6
+ val image188 =
+ new GMisc.image (GtkMisc.Image.cast
+ (Glade.get_widget_msg ~name:"image188" ~info:"GtkImage" xmldata))
+ method image188 = image188
+ val label10 =
+ new GMisc.label (GtkMisc.Label.cast
+ (Glade.get_widget_msg ~name:"label10" ~info:"GtkLabel" xmldata))
+ method label10 = label10
+ val browserForwardButton =
+ new GButton.button (GtkButton.Button.cast
+ (Glade.get_widget_msg ~name:"BrowserForwardButton" ~info:"GtkButton" xmldata))
+ method browserForwardButton = browserForwardButton
+ val image189 =
+ new GMisc.image (GtkMisc.Image.cast
+ (Glade.get_widget_msg ~name:"image189" ~info:"GtkImage" xmldata))
+ method image189 = image189
+ val browserHomeButton =
+ new GButton.button (GtkButton.Button.cast
+ (Glade.get_widget_msg ~name:"BrowserHomeButton" ~info:"GtkButton" xmldata))
+ method browserHomeButton = browserHomeButton
+ val image190 =
+ new GMisc.image (GtkMisc.Image.cast
+ (Glade.get_widget_msg ~name:"image190" ~info:"GtkImage" xmldata))
+ method image190 = image190
+ val image187 =
+ new GMisc.image (GtkMisc.Image.cast
+ (Glade.get_widget_msg ~name:"image187" ~info:"GtkImage" xmldata))
+ method image187 = image187
+ val browserNotebook =
+ new GPack.notebook (GtkPack.Notebook.cast
+ (Glade.get_widget_msg ~name:"BrowserNotebook" ~info:"GtkNotebook" xmldata))
+ method browserNotebook = browserNotebook
+ val label9 =
+ new GMisc.label (GtkMisc.Label.cast
+ (Glade.get_widget_msg ~name:"label9" ~info:"GtkLabel" xmldata))
+ method label9 = label9
+ method reparent parent =
+ browserWinEventBox#misc#reparent parent;
+ toplevel#destroy ()
+ method check_widgets () = ()
+ end
let check_all ?(show=false) () =
ignore (GMain.Main.init ());
+ let browserWin = new browserWin () in
+ if show then browserWin#toplevel#show ();
+ browserWin#check_widgets ();
let textDialog = new textDialog () in
if show then textDialog#toplevel#show ();
textDialog#check_widgets ();
method vbox5 : GPack.box
method xml : Glade.glade_xml Gtk.obj
end
+class browserWin :
+ ?file:string ->
+ ?domain:string ->
+ ?autoconnect:bool ->
+ unit ->
+ object
+ val alignment3 : GBin.alignment
+ val browserBackButton : GButton.button
+ val browserForwardButton : GButton.button
+ val browserHomeButton : GButton.button
+ val browserNotebook : GPack.notebook
+ val browserWin : GWindow.window
+ val browserWinEventBox : GBin.event_box
+ val hbox6 : GPack.box
+ val hbox7 : GPack.box
+ val image187 : GMisc.image
+ val image188 : GMisc.image
+ val image189 : GMisc.image
+ val image190 : GMisc.image
+ val label10 : GMisc.label
+ val label9 : GMisc.label
+ val toplevel : GWindow.window
+ val vbox7 : GPack.box
+ val xml : Glade.glade_xml Gtk.obj
+ method alignment3 : GBin.alignment
+ method bind : name:string -> callback:(unit -> unit) -> unit
+ method browserBackButton : GButton.button
+ method browserForwardButton : GButton.button
+ method browserHomeButton : GButton.button
+ method browserNotebook : GPack.notebook
+ method browserWin : GWindow.window
+ method browserWinEventBox : GBin.event_box
+ method check_widgets : unit -> unit
+ method hbox6 : GPack.box
+ method hbox7 : GPack.box
+ method image187 : GMisc.image
+ method image188 : GMisc.image
+ method image189 : GMisc.image
+ method image190 : GMisc.image
+ method label10 : GMisc.label
+ method label9 : GMisc.label
+ method reparent : GObj.widget -> unit
+ method toplevel : GWindow.window
+ method vbox7 : GPack.box
+ method xml : Glade.glade_xml Gtk.obj
+ end
val check_all : ?show:bool -> unit -> unit
let proof = new proofWin ~file () in
let check = new checkWin ~file () in
let script = new scriptWin ~file () in
+ let browser = new browserWin ~file () in
let keyBindingBoxes = (* event boxes which should receive global key events *)
[ toolbar#toolBarEventBox; proof#proofWinEventBox; main#mainWinEventBox;
- check#checkWinEventBox; script#scriptWinEventBox; main#consoleEventBox ]
+ check#checkWinEventBox; script#scriptWinEventBox; main#consoleEventBox;
+ browser#browserWinEventBox
+ ]
in
let console =
MatitaConsole.console ~evbox:main#consoleEventBox
(* 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 ]);
+ [ c about; c fileSel; c main; c proof; c toolbar; c check; c script;
+ c browser ]);
(* key bindings *)
List.iter (* global key bindings *)
(fun (key, callback) -> self#addKeyBinding key callback)
[] indTypes
in
let cicIndTypes = List.rev cicIndTypes in
-(*
- prerr_endline uri;
- pp_indtypes cicIndTypes;
-*)
(UriManager.uri_of_string uri, (cicIndTypes, [], paramsno))
(* TODO Zack a lot more to be done here:
| _ ->
MatitaTypes.not_implemented "some tactic"
in
- let shared = new sharedState ~disambiguator ~currentProof ~console ~dbd () in
+ let shared =
+ new sharedState ~disambiguator ~currentProof ~console ?mathViewer ~dbd ()
+ in
object (self)
inherit interpreterState ~console
in
aux
-let choose_selection mmlwidget (element : Gdome.element option) =
- let rec aux element =
- if element#hasAttributeNS
- ~namespaceURI:Misc.helmns
- ~localName:(Gdome.domString "xref")
- then
- mmlwidget#set_selection (Some element)
- else
- try
- match element#get_parentNode with
- | None -> assert false
- | Some p -> aux (new Gdome.element_of_node p)
- with GdomeInit.DOMCastException _ ->
- debug_print "trying to select above the document root"
- in
- match element with
- | Some x -> aux x
- | None -> mmlwidget#set_selection None
+class clickable_math_view obj =
+ let href = Gdome.domString "href" in
+ let xref = Gdome.domString "xref" in
+ object (self)
+ inherit GMathViewAux.multi_selection_math_view obj
+
+ val mutable href_callback: (UriManager.uri -> unit) option = None
+ method set_href_callback f = href_callback <- f
+
+ initializer
+ ignore (self#connect#selection_changed self#choose_selection);
+ ignore (self#connect#click (fun (gdome_elt, _, _, _) ->
+ match gdome_elt with
+ | Some elt (* element is an hyperlink, use href_callback on it *)
+ when elt#hasAttributeNS ~namespaceURI:Misc.xlink_ns ~localName:href ->
+ (match href_callback with
+ | None -> ()
+ | Some f ->
+ let uri =
+ elt#getAttributeNS ~namespaceURI:Misc.xlink_ns ~localName:href
+ in
+ f (UriManager.uri_of_string (uri#to_string)))
+ | Some elt -> ignore (self#action_toggle elt)
+ | None -> ()))
+ method private choose_selection gdome_elt =
+ let rec aux elt =
+ if elt#hasAttributeNS ~namespaceURI:Misc.helm_ns ~localName:xref then
+ self#set_selection (Some elt)
+ else
+ try
+ (match elt#get_parentNode with
+ | None -> assert false
+ | Some p -> aux (new Gdome.element_of_node p))
+ with GdomeInit.DOMCastException _ -> ()
+(* debug_print "trying to select above the document root" *)
+ in
+ match gdome_elt with
+ | Some elt -> aux elt
+ | None -> self#set_selection None
+ end
class proof_viewer obj =
- object(self)
+ object(self)
- inherit GMathViewAux.single_selection_math_view obj
+ inherit clickable_math_view obj
- val mutable current_infos = None
- val mutable current_mathml = None
+ val mutable current_infos = None
+ val mutable current_mathml = None
- initializer
- ignore (self#connect#click (fun (gdome_elt, _, _, _) ->
- match gdome_elt with
- | Some gdome_elt ->
- prerr_endline (gdome_elt#get_nodeName#to_string);
- ignore (self#action_toggle gdome_elt)
- | None -> ()));
- ignore (self#connect#selection_changed (choose_selection self))
-
- method load_proof ((uri_opt, _, _, _) as proof, (goal_opt: int option)) =
- let (annobj, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts,
- ids_to_inner_types, ids_to_conjectures, ids_to_hypotheses) =
- Cic2acic.acic_object_of_cic_object (cicCurrentProof proof)
- in
- current_infos <- Some (ids_to_terms, ids_to_father_ids, ids_to_conjectures,
- ids_to_hypotheses);
- let mathml =
- ApplyTransformation.mml_of_cic_object ~explode_all:true
- (unopt_uri uri_opt) annobj ids_to_inner_sorts ids_to_inner_types
- in
- debug_print "load_proof: dumping MathML to ./proof";
- ignore (Misc.domImpl#saveDocumentToFile ~name:"./proof" ~doc:mathml ());
- match current_mathml with
- | None ->
- self#load_root ~root:mathml#get_documentElement ;
- current_mathml <- Some mathml
- | Some current_mathml ->
- self#freeze;
- XmlDiff.update_dom ~from:current_mathml mathml ;
- self#thaw
+ method load_proof ((uri_opt, _, _, _) as proof, (goal_opt: int option)) =
+ let (annobj, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts,
+ ids_to_inner_types, ids_to_conjectures, ids_to_hypotheses) =
+ Cic2acic.acic_object_of_cic_object (cicCurrentProof proof)
+ in
+ current_infos <- Some (ids_to_terms, ids_to_father_ids,
+ ids_to_conjectures, ids_to_hypotheses);
+ let mathml =
+ ApplyTransformation.mml_of_cic_object ~explode_all:true
+ (unopt_uri uri_opt) annobj ids_to_inner_sorts ids_to_inner_types
+ in
+ debug_print "load_proof: dumping MathML to ./proof";
+ ignore (Misc.domImpl#saveDocumentToFile ~name:"./proof" ~doc:mathml ());
+ match current_mathml with
+ | None ->
+ self#load_root ~root:mathml#get_documentElement ;
+ current_mathml <- Some mathml
+ | Some current_mathml ->
+ self#freeze;
+ XmlDiff.update_dom ~from:current_mathml mathml ;
+ self#thaw
end
class sequent_viewer obj =
- object(self)
-
- inherit GMathViewAux.multi_selection_math_view obj
+ object(self)
- initializer
- ignore (self#connect#selection_changed (choose_selection self))
+ inherit clickable_math_view obj
- val mutable current_infos = None
+ val mutable current_infos = None
- method get_selected_terms =
- let selections = self#get_selections in
- list_map_fail
- (function node ->
- let xpath =
- ((node : Gdome.element)#getAttributeNS
- ~namespaceURI:Misc.helmns
- ~localName:(Gdome.domString "xref"))#to_string
- in
- if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
- else
- match current_infos with
- Some (ids_to_terms,_,_) ->
- let id = xpath in
- (try
- Hashtbl.find ids_to_terms id
- with _ -> raise Skip)
- | None -> assert false (* "ERROR: No current term!!!" *)
- ) selections
-
- method get_selected_hypotheses =
- let selections = self#get_selections in
- list_map_fail
- (function node ->
- let xpath =
- ((node : Gdome.element)#getAttributeNS
- ~namespaceURI:Misc.helmns
- ~localName:(Gdome.domString "xref"))#to_string
- in
- if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
- else
- match current_infos with
- Some (_,_,ids_to_hypotheses) ->
- let id = xpath in
- (try
- Hashtbl.find ids_to_hypotheses id
- with _ -> raise Skip)
- | None -> assert false (* "ERROR: No current term!!!" *)
- ) selections
+ method get_selected_terms =
+ let selections = self#get_selections in
+ list_map_fail
+ (fun node ->
+ let xpath =
+ ((node : Gdome.element)#getAttributeNS
+ ~namespaceURI:Misc.helm_ns
+ ~localName:(Gdome.domString "xref"))#to_string
+ in
+ if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
+ else
+ match current_infos with
+ | Some (ids_to_terms,_,_) ->
+ (try
+ Hashtbl.find ids_to_terms xpath
+ with _ -> raise Skip)
+ | None -> assert false) (* "ERROR: No current term!!!" *)
+ selections
+
+ method get_selected_hypotheses =
+ let selections = self#get_selections in
+ list_map_fail
+ (fun node ->
+ let xpath =
+ ((node : Gdome.element)#getAttributeNS
+ ~namespaceURI:Misc.helm_ns
+ ~localName:(Gdome.domString "xref"))#to_string
+ in
+ if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
+ else
+ match current_infos with
+ | Some (_,_,ids_to_hypotheses) ->
+ (try
+ Hashtbl.find ids_to_hypotheses xpath
+ with _ -> raise Skip)
+ | None -> assert false) (* "ERROR: No current term!!!" *)
+ selections
method load_sequent metasenv metano =
(*
=
new sequents_viewer ~notebook ~sequent_viewer ~set_goal ()
-let check_widget =
- lazy
- (let gui = MatitaGui.instance () in
- sequent_viewer ~show:true ~packing:gui#check#scrolledCheck#add ())
-
class mathViewer =
+ let href_callback: (UriManager.uri -> unit) option ref = ref None in
object
+ val check_widget =
+ lazy
+ (let gui = MatitaGui.instance () in
+ let sequent_viewer =
+ sequent_viewer ~show:true ~packing:gui#check#scrolledCheck#add ()
+ in
+ sequent_viewer#set_href_callback !href_callback;
+ sequent_viewer)
+
+ method set_href_callback f = href_callback := f
+
method checkTerm sequent metasenv =
let (metano, context, expr) = sequent in
let widget = Lazy.force check_widget in
* http://helm.cs.unibo.it/
*)
+ (** multi selection gtkMathView which handle mactions and hyperlinks. Mactions
+ * are handled internally. Hyperlinks are handled by calling an user provided
+ * callback *)
+class type clickable_math_view =
+ object
+ inherit GMathViewAux.multi_selection_math_view
+
+ (** set hyperlink callback. None disable hyperlink handling *)
+ method set_href_callback: (UriManager.uri -> unit) option -> unit
+ end
+
class type proof_viewer =
object
- inherit GMathViewAux.single_selection_math_view
+ inherit clickable_math_view
method load_proof: StatefulProofEngine.proof_status -> unit
end
class type sequent_viewer =
object
- inherit GMathViewAux.multi_selection_math_view
+ inherit clickable_math_view
(** @return the list of selected terms. Selections which are not terms are
* ignored *)
object
method checkTerm: Cic.conjecture -> Cic.metasenv -> unit
method unload: unit -> unit
+ method set_href_callback: (UriManager.uri -> unit) option -> unit
end
type mml_of_cic_sequent =
object
method checkTerm: Cic.conjecture -> Cic.metasenv -> unit
method unload: unit -> unit
+ method set_href_callback: (UriManager.uri -> unit) option -> unit
end
type mml_of_cic_sequent =