PACKAGE=lablgtkmathview
LABLGTKMATHVIEW_MAJOR_VERSION=0
-LABLGTKMATHVIEW_MINOR_VERSION=5
-LABLGTKMATHVIEW_MICRO_VERSION=1
+LABLGTKMATHVIEW_MINOR_VERSION=6
+LABLGTKMATHVIEW_MICRO_VERSION=2
LABLGTKMATHVIEW_VERSION=$LABLGTKMATHVIEW_MAJOR_VERSION.$LABLGTKMATHVIEW_MINOR_VERSION.$LABLGTKMATHVIEW_MICRO_VERSION
VERSION=$LABLGTKMATHVIEW_VERSION
AC_SUBST(GDOME_CFLAGS)
AC_SUBST(GDOME_LIBS)
-PKG_CHECK_MODULES(GTKMATHVIEW, gtkmathview >= 0.5.1,, AC_MSG_ERROR(could not find gtkmathview))
+PKG_CHECK_MODULES(GTKMATHVIEW, gtkmathview-gmetadom >= 0.6.2,, AC_MSG_ERROR(could not find gtkmathview-gmetadom))
AC_SUBST(GTKMATHVIEW_CFLAGS)
AC_SUBST(GTKMATHVIEW_LIBS)
method thaw = MathView.thaw obj
method load_uri ~filename =
if not (MathView.load_uri obj ~filename) then raise (ErrorLoadingFile filename)
- method load_doc ~dom =
- if not (MathView.load_doc obj ~dom:((dom : Gdome.document)#as_Document)) then
+ method load_root ~root =
+ if not (MathView.load_root obj ~root:((root : Gdome.element)#as_Element)) then
raise ErrorLoadingDOM
method unload = MathView.unload obj
method select element = MathView.select obj ((element : Gdome.element)#as_Element)
method unselect element = MathView.unselect obj ((element : Gdome.element)#as_Element)
method is_selected element = MathView.is_selected obj ((element : Gdome.element)#as_Element)
method get_element_at x y = option_element_of_option (MathView.get_element_at obj x y)
+ method structure_changed element = MathView.structure_changed obj ((element : Gdome.element)#as_Element)
+ method attribute_changed element ~name = MathView.attribute_changed obj ((element : Gdome.element)#as_Element) ((name : Gdome.domString)#as_DOMString)
+ method get_bounding_box = MathView.get_bounding_box obj
method get_width = MathView.get_width obj
method get_height = MathView.get_height obj
method get_top = MathView.get_top obj
method get_vadjustment : GData.adjustment
method get_width : int
method load_uri : filename:string -> unit
- method load_doc : dom:Gdome.document -> unit
+ method load_root : root:Gdome.element -> unit
method set_adjustments : GData.adjustment -> GData.adjustment -> unit
method set_font_size : int -> unit
method set_log_verbosity : int -> unit
+ method structure_changed : Gdome.element -> unit
+ method attribute_changed : Gdome.element -> name:Gdome.domString -> unit
+ method get_bounding_box : int * int * int
method select : Gdome.element -> unit
method unselect : Gdome.element -> unit
method get_element_at : int -> int -> Gdome.element option
"ml_gtk_math_view_thaw"
external load_uri : [>`mathview] obj -> filename:string -> bool =
"ml_gtk_math_view_load_uri"
- external load_doc : [>`mathview] obj -> dom:[> `Document] GdomeT.t -> bool =
- "ml_gtk_math_view_load_doc"
+ external load_root : [>`mathview] obj -> root:[> `Element] GdomeT.t -> bool =
+ "ml_gtk_math_view_load_root"
external unload : [>`mathview] obj -> unit =
"ml_gtk_math_view_unload"
external select :
external is_selected :
[>`mathview] obj -> [> `Element] GdomeT.t -> bool =
"ml_gtk_math_view_is_selected"
+ external structure_changed :
+ [>`mathview] obj -> [> `Element] GdomeT.t -> unit =
+ "ml_gtk_math_view_structure_changed"
+ external attribute_changed :
+ [>`mathview] obj -> [> `Element] GdomeT.t -> name:TDOMString.t -> unit =
+ "ml_gtk_math_view_attribute_changed"
+ external get_bounding_box :
+ [>`mathview] obj -> (int * int * int) =
+ "ml_gtk_math_view_get_bounding_box"
external get_element_at :
[> `mathview] obj -> int -> int -> TElement.t option =
"ml_gtk_math_view_get_element_at"
#include <assert.h>
-#include <gtkmathview.h>
+#include <gtk/gtkmathview_gmetadom.h>
#include <gtk/gtk.h>
#include <caml/mlvalues.h>
return Val_Element(elem);
}
-OML_3 (gtk_math_view_get_element_at, GtkMathView_val, Int_val, Int_val, Val_Element)
+ML_2 (gtk_math_view_structure_changed, GtkMathView_val, Element_val, Unit)
+ML_3 (gtk_math_view_attribute_changed, GtkMathView_val, Element_val, DOMString_val, Unit)
+/* OML_3 (gtk_math_view_get_element_at, GtkMathView_val, Int_val, Int_val, Val_Element) */
ML_1 (gtk_math_view_freeze, GtkMathView_val, Unit)
ML_1 (gtk_math_view_thaw, GtkMathView_val, Unit)
ML_2 (gtk_math_view_load_uri, GtkMathView_val, String_val, Val_bool)
-ML_2 (gtk_math_view_load_doc, GtkMathView_val, Document_val, Val_bool)
+ML_2 (gtk_math_view_load_root, GtkMathView_val, Element_val, Val_bool)
ML_1 (gtk_math_view_unload, GtkMathView_val, Unit)
ML_2 (gtk_math_view_select, GtkMathView_val, Element_val, Unit)
ML_2 (gtk_math_view_unselect, GtkMathView_val, Element_val, Unit)
ML_2 (gtk_math_view_set_log_verbosity, GtkMathView_val, Int_val, Unit)
ML_1 (gtk_math_view_get_log_verbosity, GtkMathView_val, Val_int)
+value ml_gtk_math_view_get_element_at (value arg1, value arg2, value arg3)
+{
+ CAMLparam3(arg1, arg2, arg3);
+ CAMLlocal1 (result);
+ GdomeElement* el;
+ if (gtk_math_view_get_element_at(GtkMathView_val (arg1), Int_val(arg2), Int_val(arg3), &el, NULL, NULL))
+ result = Val_option_ptr(el, Val_Element);
+ else
+ result = Val_unit;
+ CAMLreturn (result);
+}
+
+value ml_gtk_math_view_get_bounding_box (value arg1)
+{
+ CAMLparam1(arg1);
+ CAMLlocal1 (result);
+ int width, height, depth;
+ GtkMathViewBoundingBox gbox;
+ gtk_math_view_get_bounding_box(GtkMathView_val (arg1), &gbox);
+ result = alloc(3, 0);
+ Store_field(result, 0, Val_int(gbox.width));
+ Store_field(result, 1, Val_int(gbox.height));
+ Store_field(result, 2, Val_int(gbox.depth));
+ CAMLreturn (result);
+}
+
value ml_gtk_math_view_get_top (value arg1)
{
CAMLparam1(arg1);
;;
let load_doc mathview () =
- mathview#load_doc ~dom:((Gdome.domImplementation ())#createDocumentFromURI ~uri:"test.xml" ()) ;
+ mathview#load_root ~root:(((Gdome.domImplementation ())#createDocumentFromURI ~uri:"test.xml" ())#get_documentElement) ;
print_string "load from DOM: SEEMS TO WORK\n" ;
flush stdout
;;
let x_coord = ref 0
;;
+(*
let get_element_at mathview () =
begin
match mathview#get_element_at !x_coord 10 with
x_coord := !x_coord + 10 ;
flush stdout
;;
+*)
let get_drawing_area mathview () =
begin
flush stdout
;;
+let _ = (GtkMain.Main.init ())
+;;
+
(* Widget creation *)
let main_window = GWindow.window ~title:"GtkMathView test" () in
let vbox = GPack.vbox ~packing:main_window#add () in
let button_set_log_verbosity = GButton.button ~label:"set_log_verbosity" ~packing:(table#attach ~left:0 ~top:4) () in
let button_get_log_verbosity = GButton.button ~label:"get_log_verbosity" ~packing:(table#attach ~left:1 ~top:4) () in
let button_load_dom = GButton.button ~label:"load from DOM" ~packing:(table#attach ~left:2 ~top:5) () in
-let button_get_element_at = GButton.button ~label:"get_element_at" ~packing:(table#attach ~left:3 ~top:5) () in
+(* let button_get_element_at = GButton.button ~label:"get_element_at" ~packing:(table#attach ~left:3 ~top:5) () in *)
let button_get_drawing_area = GButton.button ~label:"get_drawing_area" ~packing:(table#attach ~left:4 ~top:5) () in
(* Signals connection *)
ignore(button_load#connect#clicked (load_uri mathview)) ;
ignore(mathview#connect#selection_changed (selection_changed mathview));
ignore(mathview#connect#element_over (element_over mathview)) ;
ignore(button_load_dom#connect#clicked (load_doc mathview)) ;
-ignore(button_get_element_at#connect#clicked (get_element_at mathview)) ;
+(* ignore(button_get_element_at#connect#clicked (get_element_at mathview)) ; *)
ignore(button_get_drawing_area#connect#clicked (get_drawing_area mathview)) ;
(* Main Loop *)
main_window#show () ;
<m:mo>∫</m:mo>
<m:mo>⁡</m:mo>
<m:mfrac>
- <m:maction>
+ <m:maction actiontype="toggle">
<m:mtext>It's a secret!</m:mtext>
<m:mrow>
<m:mrow>