+lablgtkmathview (0.7.1+cvs-1) UNRELEASED; urgency=low
+
+ * ... new gtkmathview ... bound a lot more methods ...
+
+ -- Stefano Zacchiroli <zack@debian.org> Fri, 22 Jul 2005 13:54:31 +0200
+
lablgtkmathview (0.7.1-2) unstable; urgency=low
* debian/control
Section: devel
Priority: optional
Maintainer: Stefano Zacchiroli <zack@debian.org>
-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.
-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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
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 =
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
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
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
+
-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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
(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 :
?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
+
-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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 *)
-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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 ->
?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 ->
?height:int ->
?packing:(GObj.widget -> unit) ->
?show:bool ->
- unit -> multi_selection_math_view
-
+ unit ->
+ multi_selection_math_view
-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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
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 =
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"
"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
-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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]
-/* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+/* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * 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 <assert.h>
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)
{
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);
()
;;
-
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" ;
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
(* 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)) ;