From 783153a9156030c67b263f8e8a5962ae42474832 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Tue, 26 Jul 2005 12:27:47 +0000 Subject: [PATCH] unreleased version of the bindings, with more gtkmathview method bounds and dependencies on gmetadom 0.2.3 --- helm/DEVEL/lablgtkmathview/debian/changelog | 6 ++ helm/DEVEL/lablgtkmathview/debian/control | 4 +- helm/DEVEL/lablgtkmathview/gMathView.ml | 40 +++++++++---- helm/DEVEL/lablgtkmathview/gMathView.mli | 63 +++++++++++++------- helm/DEVEL/lablgtkmathview/gMathViewAux.ml | 25 ++++---- helm/DEVEL/lablgtkmathview/gMathViewAux.mli | 42 ++++++------- helm/DEVEL/lablgtkmathview/gtkMathView.ml | 39 ++++++++---- helm/DEVEL/lablgtkmathview/gtk_mathview.ml | 25 ++++---- helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c | 42 +++++++++---- helm/DEVEL/lablgtkmathview/test/test.ml | 13 +++- 10 files changed, 197 insertions(+), 102 deletions(-) diff --git a/helm/DEVEL/lablgtkmathview/debian/changelog b/helm/DEVEL/lablgtkmathview/debian/changelog index da93964dd..412de1ea9 100644 --- a/helm/DEVEL/lablgtkmathview/debian/changelog +++ b/helm/DEVEL/lablgtkmathview/debian/changelog @@ -1,3 +1,9 @@ +lablgtkmathview (0.7.1+cvs-1) UNRELEASED; urgency=low + + * ... new gtkmathview ... bound a lot more methods ... + + -- Stefano Zacchiroli Fri, 22 Jul 2005 13:54:31 +0200 + lablgtkmathview (0.7.1-2) unstable; urgency=low * debian/control diff --git a/helm/DEVEL/lablgtkmathview/debian/control b/helm/DEVEL/lablgtkmathview/debian/control index 48ad4d0b8..8908587cd 100644 --- a/helm/DEVEL/lablgtkmathview/debian/control +++ b/helm/DEVEL/lablgtkmathview/debian/control @@ -2,13 +2,13 @@ Source: lablgtkmathview Section: devel Priority: optional Maintainer: Stefano Zacchiroli -Build-Depends: debhelper (>> 4.0.0), ocaml-3.08.3, ocaml-findlib, liblablgtk2-ocaml-dev (>= 2.4.0+2005.06.13-1), libgdome2-ocaml-dev (>= 0.2.3), libgtkmathview-dev (>= 0.7.1), pkg-config, autoconf +Build-Depends: debhelper (>> 4.0.0), ocaml-3.08.3, ocaml-findlib, liblablgtk2-ocaml-dev (>= 2.4.0+2005.06.13-1), libgdome2-ocaml-dev (>= 0.2.2), libgtkmathview-dev (>= 0.7.1), pkg-config, autoconf Standards-Version: 3.6.1.1 Package: liblablgtkmathview-ocaml Architecture: any Section: libs -Depends: ocaml-base-nox-3.08.3, liblablgtk2-ocaml (>= 2.4.0+2005.06.13-1), libgdome2-ocaml (>= 0.2.3), ${shlibs:Depends}, ${misc:Depends} +Depends: ocaml-base-nox-3.08.3, liblablgtk2-ocaml (>= 2.4.0+2005.06.13-1), libgdome2-ocaml (>= 0.2.2), ${shlibs:Depends}, ${misc:Depends} Description: OCaml bindings for libgtkmathview, a GTK widget to render MathML This is the Ocaml binding for the GtkMathView widget, that is currently available in the libgtkmathview0 package. diff --git a/helm/DEVEL/lablgtkmathview/gMathView.ml b/helm/DEVEL/lablgtkmathview/gMathView.ml index 57a6aa9a6..0ec81f3f9 100644 --- a/helm/DEVEL/lablgtkmathview/gMathView.ml +++ b/helm/DEVEL/lablgtkmathview/gMathView.ml @@ -1,24 +1,27 @@ -(* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +(* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. *) open Gaux @@ -39,8 +42,14 @@ let option_element_of_option = None -> None | Some v -> Some (new Gdome.element v) +let option_document_of_option = + function + None -> None + | Some v -> Some (new Gdome.document v) + class math_view_skel obj = object inherit GObj.widget (obj : Gtk_mathview.math_view obj) + method event = new GObj.event_ops obj method freeze = MathView.freeze obj method thaw = MathView.thaw obj method load_uri ~filename = @@ -53,6 +62,7 @@ class math_view_skel obj = object 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 get_document = option_document_of_option (MathView.get_document obj) 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 @@ -68,6 +78,10 @@ class math_view_skel obj = object method get_font_size = MathView.get_font_size obj method set_log_verbosity = MathView.set_log_verbosity obj method get_log_verbosity = MathView.get_log_verbosity obj + method set_t1_opaque_mode = MathView.set_t1_opaque_mode obj + method get_t1_opaque_mode = MathView.get_t1_opaque_mode obj + method set_t1_anti_aliased_mode = MathView.set_t1_anti_aliased_mode obj + method get_t1_anti_aliased_mode = MathView.get_t1_anti_aliased_mode obj end class math_view_signals obj = object @@ -84,4 +98,6 @@ let math_view ?hadjustment ?vadjustment ?font_size ?log_verbosity = GtkBase.Widget.size_params ~cont:( OgtkMathViewProps.pack_return (fun p -> OgtkMathViewProps.set_params (new math_view (MathView.create p)) ~font_size ~log_verbosity)) [] -;; + +let add_configuration_path = GtkMathView.add_configuration_path + diff --git a/helm/DEVEL/lablgtkmathview/gMathView.mli b/helm/DEVEL/lablgtkmathview/gMathView.mli index bf5b56e2a..d116c527d 100644 --- a/helm/DEVEL/lablgtkmathview/gMathView.mli +++ b/helm/DEVEL/lablgtkmathview/gMathView.mli @@ -1,24 +1,27 @@ -(* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +(* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. *) exception ErrorLoadingFile of string @@ -49,29 +52,35 @@ class math_view_skel : (Gtk_mathview.math_view Gtk.obj as 'a)-> object inherit GObj.widget + val obj : 'a + method attribute_changed : Gdome.element -> name:Gdome.domString -> unit + method event : GObj.event_ops method freeze : unit - method thaw : unit + method get_adjustments : GData.adjustment * GData.adjustment + method get_bounding_box : int * int * int method get_buffer : Gdk.pixmap + method get_document : Gdome.document option + method get_element_at : int -> int -> Gdome.element option (* x, y *) method get_font_size : int - method get_adjustments : GData.adjustment * GData.adjustment - method get_size : int * int method get_log_verbosity : int + method get_size : int * int + method get_t1_anti_aliased_mode : bool + method get_t1_opaque_mode : bool method get_top : int * int - method load_uri : filename:string -> unit + method is_selected : Gdome.element -> bool method load_root : root:Gdome.element -> unit + method load_uri : filename:string -> unit + method select : 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 - method is_selected : Gdome.element -> bool method set_top : int -> int -> unit + method set_t1_anti_aliased_mode : bool -> unit + method set_t1_opaque_mode : bool -> unit + method structure_changed : Gdome.element -> unit + method thaw : unit method unload : unit - val obj : 'a + method unselect : Gdome.element -> unit end class math_view : @@ -89,3 +98,11 @@ val math_view : ?width:int -> ?height:int -> ?packing:(GObj.widget -> unit) -> ?show:bool -> unit -> math_view + +(** {2 Global configuration for all math_view instances *) + + (** @param fname file name to be added to the list of configuration files read + * at initialization time. + * To be invoked before GTK initialization. *) +val add_configuration_path: string -> unit + diff --git a/helm/DEVEL/lablgtkmathview/gMathViewAux.ml b/helm/DEVEL/lablgtkmathview/gMathViewAux.ml index 8880ee06c..45bc5d90c 100644 --- a/helm/DEVEL/lablgtkmathview/gMathViewAux.ml +++ b/helm/DEVEL/lablgtkmathview/gMathViewAux.ml @@ -1,24 +1,27 @@ -(* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +(* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. *) (* finds the common node ancestor of two nodes *) diff --git a/helm/DEVEL/lablgtkmathview/gMathViewAux.mli b/helm/DEVEL/lablgtkmathview/gMathViewAux.mli index 58a8d17b9..299328733 100644 --- a/helm/DEVEL/lablgtkmathview/gMathViewAux.mli +++ b/helm/DEVEL/lablgtkmathview/gMathViewAux.mli @@ -1,33 +1,36 @@ -(* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +(* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. *) class single_selection_math_view_signals : ([> `gtk | `mathview_gmetadom | `widget] as 'b) Gtk.obj -> ((Gdome.element option -> unit) -> unit) -> - object - inherit GMathView.math_view_signals - method selection_changed : (Gdome.element_of_node option -> unit) -> unit - end + object + inherit GMathView.math_view_signals + method selection_changed : (Gdome.element_of_node option -> unit) -> unit + end class single_selection_math_view : Gtk_mathview.math_view Gtk.obj -> @@ -48,9 +51,8 @@ val single_selection_math_view : ?height:int -> ?packing:(GObj.widget -> unit) -> ?show:bool -> - unit -> single_selection_math_view - - (** EXPERIMENTAL STUFF from now on: use with care and at your own risk! *) + unit -> + single_selection_math_view class multi_selection_math_view : Gtk_mathview.math_view Gtk.obj -> @@ -71,6 +73,6 @@ val multi_selection_math_view : ?height:int -> ?packing:(GObj.widget -> unit) -> ?show:bool -> - unit -> multi_selection_math_view - + unit -> + multi_selection_math_view diff --git a/helm/DEVEL/lablgtkmathview/gtkMathView.ml b/helm/DEVEL/lablgtkmathview/gtkMathView.ml index 6d2db8849..0b9d45349 100644 --- a/helm/DEVEL/lablgtkmathview/gtkMathView.ml +++ b/helm/DEVEL/lablgtkmathview/gtkMathView.ml @@ -1,24 +1,27 @@ -(* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +(* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. *) open Gtk_mathview @@ -32,6 +35,9 @@ open GtkBase external _gtkmathview_init : unit -> unit = "ml_gtk_mathview_init" let () = _gtkmathview_init () +external add_configuration_path : string -> unit = + "ml_gtk_math_view_add_configuration_path" + module MathView = struct include MathView_GMetaDOM external freeze : [>`mathview_gmetadom] obj -> unit = @@ -65,6 +71,9 @@ module MathView = struct external get_element_at : [> `mathview_gmetadom] obj -> int -> int -> TElement.t option = "ml_gtk_math_view_get_element_at" + external get_document : + [> `mathview_gmetadom] obj -> TDocument.t option = + "ml_gtk_math_view_get_document" (* beginning of prop-like methods *) external get_size : [>`mathview_gmetadom] obj -> int * int = "ml_gtk_math_view_get_size" @@ -87,4 +96,12 @@ module MathView = struct "ml_gtk_math_view_set_log_verbosity" external get_log_verbosity : [>`mathview_gmetadom] obj -> int = "ml_gtk_math_view_get_log_verbosity" + external set_t1_opaque_mode : [>`mathview_gmetadom] obj -> bool -> unit = + "ml_gtk_math_view_set_t1_opaque_mode" + external get_t1_opaque_mode : [>`mathview_gmetadom] obj -> bool = + "ml_gtk_math_view_get_t1_opaque_mode" + external set_t1_anti_aliased_mode : [>`mathview_gmetadom] obj -> bool -> unit = + "ml_gtk_math_view_set_t1_anti_aliased_mode" + external get_t1_anti_aliased_mode : [>`mathview_gmetadom] obj -> bool = + "ml_gtk_math_view_get_t1_anti_aliased_mode" end diff --git a/helm/DEVEL/lablgtkmathview/gtk_mathview.ml b/helm/DEVEL/lablgtkmathview/gtk_mathview.ml index f5b8c5ef6..3267176a0 100644 --- a/helm/DEVEL/lablgtkmathview/gtk_mathview.ml +++ b/helm/DEVEL/lablgtkmathview/gtk_mathview.ml @@ -1,24 +1,27 @@ -(* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +(* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. *) type math_view = [Gtk.widget|`mathview_gmetadom] diff --git a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c index f8141f9eb..5d36bc0c4 100644 --- a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c +++ b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c @@ -1,24 +1,27 @@ -/* Copyright (C) 2000-2003, Luca Padovani , - * Claudio Sacerdoti Coen . +/* Copyright (C) 2000-2005, + * Luca Padovani + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * - * This file is part of lablgtkmathview, the Ocaml binding - * for the GtkMathView widget. + * This file is part of lablgtkmathview, the Ocaml binding for the + * GtkMathView widget. * * lablgtkmathview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * * lablgtkmathview is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with lablgtkmathview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. * - * For details, send a mail to the author. + * For details, send a mail to the authors. */ #include @@ -111,6 +114,11 @@ ML_2 (gtk_math_view_set_font_size, GtkMathView_val, Int_val, Unit) ML_1 (gtk_math_view_get_font_size, GtkMathView_val, Val_int) 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) +ML_2 (gtk_math_view_set_t1_opaque_mode, GtkMathView_val, Bool_val, Unit) +ML_1 (gtk_math_view_get_t1_opaque_mode, GtkMathView_val, Val_bool) +ML_2 (gtk_math_view_set_t1_anti_aliased_mode, GtkMathView_val, Bool_val, Unit) +ML_1 (gtk_math_view_get_t1_anti_aliased_mode, GtkMathView_val, Val_bool) +ML_1 (gtk_math_view_add_configuration_path, String_val, Unit) value ml_gtk_math_view_get_element_at (value arg1, value arg2, value arg3) { @@ -124,6 +132,18 @@ value ml_gtk_math_view_get_element_at (value arg1, value arg2, value arg3) CAMLreturn (result); } +value ml_gtk_math_view_get_document (value arg1) +{ + CAMLparam1(arg1); + CAMLlocal1(result); + GdomeDocument* doc = gtk_math_view_get_document(GtkMathView_val (arg1)); + if (doc == NULL) + result = Val_unit; + else + result = Val_option_ptr(doc, Val_Document); + CAMLreturn (result); +} + value ml_gtk_math_view_get_adjustments(value arg1) { CAMLparam1(arg1); diff --git a/helm/DEVEL/lablgtkmathview/test/test.ml b/helm/DEVEL/lablgtkmathview/test/test.ml index d1821bfca..b0e584cae 100644 --- a/helm/DEVEL/lablgtkmathview/test/test.ml +++ b/helm/DEVEL/lablgtkmathview/test/test.ml @@ -160,13 +160,22 @@ let click mathview ((element : Gdome.element option), _, _, _) = () ;; - let load_uri mathview () = mathview#load_uri ~filename:"test.xml" ; print_string "load: SEEMS TO WORK\n" ; flush stdout ;; +let get_document mathview () = + (match mathview#get_document with + | None -> print_string "no document loaded\n" + | Some doc -> + let name = "out.xml" in + ignore ((Gdome.domImplementation ())#saveDocumentToFile ~doc ~name ()); + print_string ("document loaded and saved to " ^ name ^ "\n")); + flush stdout +;; + let load_doc mathview () = mathview#load_root ~root:(((Gdome.domImplementation ())#createDocumentFromURI ~uri:"test.xml" ())#get_documentElement) ; print_string "load from DOM: SEEMS TO WORK\n" ; @@ -340,6 +349,7 @@ let mathview= GMathViewAux.multi_selection_math_view ~packing:sw#add ~width:50 ~ let table = GPack.table ~rows:6 ~columns:5 ~packing:vbox#pack () in let button_load = GButton.button ~label:"load" ~packing:(table#attach ~left:1 ~top:0) () in let button_unload = GButton.button ~label:"unload" ~packing:(table#attach ~left:2 ~top:0) () in +let button_get_document = GButton.button ~label:"get_document" ~packing:(table#attach ~left:1 ~top:1) () in let button_selection = GButton.button ~label:"get_selection" ~packing:(table#attach ~left:3 ~top:0) () in let button_set_selection = GButton.button ~label:"set_selection" ~packing:(table#attach ~left:4 ~top:0) () in let button_add_selection = GButton.button ~label:"add_selection" ~packing:(table#attach ~left:3 ~top:3) () in @@ -359,6 +369,7 @@ let button_load_dom = GButton.button ~label:"load from DOM" ~packing:(table#atta (* Signals connection *) ignore(button_load#connect#clicked (load_uri mathview)) ; ignore(button_unload#connect#clicked (unload mathview)) ; +ignore(button_get_document#connect#clicked (get_document mathview)) ; ignore(button_selection#connect#clicked (test_get_selection mathview)) ; ignore(button_set_selection#connect#clicked (test_set_selection mathview)) ; ignore(button_add_selection#connect#clicked (test_add_selection mathview)) ; -- 2.39.2