From: Stefano Zacchiroli Date: Thu, 2 Feb 2006 18:20:44 +0000 (+0000) Subject: dir reorganization X-Git-Tag: make_still_working~7672 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=2b2b90087f836c2f32291935216549e9370e68c3;p=helm.git dir reorganization --- diff --git a/helm/DEVEL/gtkmathview-bonobo/.cvsignore b/helm/DEVEL/gtkmathview-bonobo/.cvsignore new file mode 100644 index 000000000..d4b698b3a --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/.cvsignore @@ -0,0 +1,18 @@ +aclocal.m4 +config.h.in +Makefile.in +autom4te.cache +config.guess +config.sub +install-sh +mkinstalldirs +ltmain.sh +configure +depcomp +Makefile +config.h +config.log +config.status +libtool +stamp-h1 +gtkmathview-bonobo.pc diff --git a/helm/DEVEL/gtkmathview-bonobo/AUTHORS b/helm/DEVEL/gtkmathview-bonobo/AUTHORS new file mode 100644 index 000000000..c4b11a9bd --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/AUTHORS @@ -0,0 +1,2 @@ +Luca Padovani +Pouria Masoudi diff --git a/helm/DEVEL/gtkmathview-bonobo/ChangeLog b/helm/DEVEL/gtkmathview-bonobo/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/helm/DEVEL/gtkmathview-bonobo/LICENSE b/helm/DEVEL/gtkmathview-bonobo/LICENSE new file mode 100644 index 000000000..d9bf0fad0 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/LICENSE @@ -0,0 +1,23 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + diff --git a/helm/DEVEL/gtkmathview-bonobo/Makefile.am b/helm/DEVEL/gtkmathview-bonobo/Makefile.am new file mode 100644 index 000000000..afa1ecdc2 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/Makefile.am @@ -0,0 +1,20 @@ +EXTRA_DIST = config.h.in +SUBDIRS = idl src test +CLEANFILES = core *.log *.eps + +pkgconfigdir = $(libdir)/pkgconfig +#pkgconfig_DATA=gtkmathview-bonobo.pc + +backup: + tar cvfz ../@PACKAGE@-@VERSION@-`date|tr ' ' '_'|tr ':' '_'`.tar.gz . + +cleanbak: + -rm -f `find . -name "*~"` + +lc: + @( \ + CFILES=`find . -name "*.c"`; \ + HFILES=`find . -name "*.h"`; \ + wc -l $$CFILES $$HFILES | tail -n 1 \ + ) + diff --git a/helm/DEVEL/gtkmathview-bonobo/NEWS b/helm/DEVEL/gtkmathview-bonobo/NEWS new file mode 100644 index 000000000..bbb294549 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/NEWS @@ -0,0 +1,5 @@ + +Tue, 15 Jul 2003 15:56:54 +0200 + + o The project formally starts + diff --git a/helm/DEVEL/gtkmathview-bonobo/README b/helm/DEVEL/gtkmathview-bonobo/README new file mode 100644 index 000000000..e69de29bb diff --git a/helm/DEVEL/gtkmathview-bonobo/TODO b/helm/DEVEL/gtkmathview-bonobo/TODO new file mode 100644 index 000000000..8f1032a0c --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/TODO @@ -0,0 +1,21 @@ + +* remove shadow from plugin. This causes the plugin window to be dirty, + find out why + +* disable double buffering for the plugin with GTK+ API? + +* remove black border in upper and left corners of the plugin window + +* try to implement size negotiations with the plugin that sends javascript + to the browser. + +* access object's attribute and children. Jean claims he does + this already, but the code seems to access GLib properties only, + no external params + +* implement a size negotiation mechanism from the plugin using + javascript. The plugin understands its ID from the object element, + calculates the size and sends a URL with a javascript call to a function + that sets width, height attributes of the object element + + diff --git a/helm/DEVEL/gtkmathview-bonobo/configure.ac b/helm/DEVEL/gtkmathview-bonobo/configure.ac new file mode 100644 index 000000000..e30b55212 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/configure.ac @@ -0,0 +1,112 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(gtkmathview-bonobo, [0.0.3]) +AC_CONFIG_SRCDIR(src/GNOME_GtkMathView.server.in.in) +AM_INIT_AUTOMAKE($AC_PACKAGE_NAME, $AC_PACKAGE_VERSION) + +PACKAGE=$PACKAGE_NAME +VERSION=$PACKAGE_VERSION +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) + +GTKMATHVIEW_CONTROL_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'` +AC_SUBST(GTKMATHVIEW_CONTROL_VERSION_INFO) + +GTKMATHVIEW_API_VERSION="1.0" +AC_SUBST(GTKMATHVIEW_API_VERSION) +AC_DEFINE_UNQUOTED(MATH_VIEW_API_VERSION, "$GTKMATHVIEW_API_VERSION", [Version number of the API implemented]) + +AC_ARG_ENABLE( + profile, + [ --enable-profile[=ARG] include profiling information [default=no]], + profile=$enableval, + profile=no +) + +AC_ARG_ENABLE( + debug, + [ --enable-debug[=ARG] include debugging debug [default=yes]], + enable_debug=$enableval, + enable_debug=yes +) + +if test "x$enable_debug" = "xyes"; then + AC_DEFINE(ENABLE_DEBUG,,[Define to 1 if you want to enable validity checks while running]) +fi + +dnl AC_CONFIG_HEADERS([config.h]) +AM_CONFIG_HEADER(config.h) + +AH_TOP([ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef config_h +#define config_h +]) + +AH_BOTTOM([ +#endif /* config_h */ +]) + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_HEADER_STDC([]) + +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + +AM_PROG_LIBTOOL + +PKG_CHECK_MODULES(GTKMATHVIEW, gtkmathview >= 0.5.1) +AC_SUBST(GTKMATHVIEW_CFLAGS) +AC_SUBST(GTKMATHVIEW_LIBS) + +PKG_CHECK_MODULES(BONOBO, libbonobo-2.0) +AC_SUBST(BONOBO_CFLAGS) +AC_SUBST(BONOBO_LIBS) + +PKG_CHECK_MODULES(BONOBOUI, libbonoboui-2.0) +AC_SUBST(BONOBOUI_CFLAGS) +AC_SUBST(BONOBOUI_LIBS) + +PKG_CHECK_MODULES(GNOMEUI, libgnomeui-2.0) +AC_SUBST(GNOMEUI_CFLAGS) +AC_SUBST(GNOMEUI_LIBS) + +ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" +AC_SUBST(ORBIT_IDL) + +BONOBO_IDL_INCLUDES="-I`$PKG_CONFIG --variable=idldir libbonobo-2.0` -I`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" +AC_SUBST(BONOBO_IDL_INCLUDES) + +AC_CONFIG_FILES([ + Makefile + gtkmathview-bonobo.pc + idl/Makefile + src/Makefile + src/GNOME_GtkMathView.server.in + test/Makefile +]) +AC_OUTPUT diff --git a/helm/DEVEL/gtkmathview-bonobo/gtkmathview-bonobo.pc.in b/helm/DEVEL/gtkmathview-bonobo/gtkmathview-bonobo.pc.in new file mode 100644 index 000000000..aa9499612 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/gtkmathview-bonobo.pc.in @@ -0,0 +1,14 @@ +# This is a comment +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datadir=@datadir@ + +Name: GtkMathView-Bonobo +Description: Bonobo interfaces for GtkMathView +Version: @VERSION@ +Requires: gtkmathview libbonoboui-2.0 +Libs: @DOM_LIBS@ -L${libdir} -lgtkmathview-bonobo +Cflags: @DOM_CFLAGS@ -I${includedir}/@PACKAGE@ + diff --git a/helm/DEVEL/gtkmathview-bonobo/idl/.cvsignore b/helm/DEVEL/gtkmathview-bonobo/idl/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/idl/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/helm/DEVEL/gtkmathview-bonobo/idl/GtkMathView.idl b/helm/DEVEL/gtkmathview-bonobo/idl/GtkMathView.idl new file mode 100644 index 000000000..307c166c1 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/idl/GtkMathView.idl @@ -0,0 +1,105 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +module GNOME { + + module GtkMathView { + + typedef string element_id; + + interface View : Bonobo::Unknown { + + /** + * load: + * @uri: URI of a MathML document + * + * Loads the document at the specified URI in the component + * and displays it. If the load is successful returns @TRUE, + * @FALSE otherwise. + */ + boolean load (in string uri); + + /** + * unload: + * + * Unload any loaded document from the component + */ + void unload (); + + /** + * freeze: + * + * Freezes the component. Any modification to the document is + * not reflected by the view. + */ + void freeze (); + + /** + * thaw: + * + * Thaws the component. If the document was changed while the + * component was frozen, the view is updated. + */ + void thaw (); + + void setIdAttribute (in string ns, in string name); + void getIdAttribute (out string ns, out string name); + + void select (in element_id elem); + void unselect (in element_id elem); + boolean isSelected (in element_id elem); + + boolean elementCoords (in element_id elem, + out short x, out short y); + /** + * elementRectangle: + * @elem: ID of the element + * @x: x coordinate of the element + * @y: y coordinate of the element + * @width: width of the element + * @height: height of the element + * + * Returns the position and the size of the rectangle includes @elem + */ + boolean elementBoundingBox (in element_id elem, + out short width, out short height, out short depth); + + void getSize (out short width, out short height); + + void getTop (out short x, out short y); + void setTop (in short x, in short y); + + void setDefaultFontSize (in short size); + short getDefaultFontSize (); + + void setVerbosity (in short level); + short getVerbosity (); + + }; + + }; + +}; + diff --git a/helm/DEVEL/gtkmathview-bonobo/idl/Makefile.am b/helm/DEVEL/gtkmathview-bonobo/idl/Makefile.am new file mode 100644 index 000000000..14555d1e3 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/idl/Makefile.am @@ -0,0 +1,5 @@ + +idldir = $(datadir)/idl/bonobo-2.0 +idl_DATA = GtkMathView.idl + +EXTRA_DIST = $(idl_DATA) diff --git a/helm/DEVEL/gtkmathview-bonobo/src/.cvsignore b/helm/DEVEL/gtkmathview-bonobo/src/.cvsignore new file mode 100644 index 000000000..7bac46e25 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/.cvsignore @@ -0,0 +1,21 @@ +.deps +.libs +GNOME_GtkMathView.server +GNOME_GtkMathView.server.in +Makefile +Makefile.in +libgtkmathview-bonobo.la +control-factory.lo +control-data.lo +view.lo +aux.lo +handlers.lo +persist-file.lo +persist-stream.lo +GtkMathView-common.c +GtkMathView-common.lo +GtkMathView-skels.c +GtkMathView-skels.lo +GtkMathView-stubs.c +GtkMathView-stubs.lo +GtkMathView.h diff --git a/helm/DEVEL/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in b/helm/DEVEL/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in new file mode 100644 index 000000000..957c40004 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/Makefile.am b/helm/DEVEL/gtkmathview-bonobo/src/Makefile.am new file mode 100644 index 000000000..92e6a9690 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/Makefile.am @@ -0,0 +1,68 @@ + +location = $(libdir)/libgtkmathview-bonobo.so +serverdir = $(libdir)/bonobo/servers +server_in_files = GNOME_GtkMathView.server.in.in + +IDL = $(top_srcdir)/idl/GtkMathView.idl + +IDL_GENERATED_C = \ + GtkMathView-common.c \ + GtkMathView-skels.c \ + GtkMathView-stubs.c + +IDL_GENERATED_H = \ + GtkMathView.h + +IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H) + +CLEANFILES = \ + $(server_in_files:.server.in.in=.server) \ + $(IDL_GENERATED) + +lib_LTLIBRARIES = libgtkmathview-bonobo.la + +libgtkmathview_bonobo_la_LIBADD = \ + $(GTKMATHVIEW_LIBS) \ + $(BONOBOUI_LIBS) \ + $(BONOBO_LIBS) + +libgtkmathview_bonobo_la_LDFLAGS = -version-info @GTKMATHVIEW_CONTROL_VERSION_INFO@ + +libgtkmathview_bonobo_la_SOURCES = \ + $(IDL_GENERATED_C) \ + control-data.c \ + control-factory.c \ + persist-file.c \ + persist-stream.c \ + aux.cc \ + handlers.c \ + view.c + +noinst_HEADERS = \ + control-data.h \ + control-factory.h \ + persist-file.h \ + persist-stream.h \ + handlers.h \ + view.h \ + aux.h + +pkginclude_HEADERS = \ + $(IDL_GENERATED_H) + +server_DATA = $(server_in_files:.server.in.in=.server) +$(server_in_files:.server.in.in=.server): $(server_in_files:.server.in.in=.server.in) Makefile + sed -e "s|\@GTKMATHVIEW_FACTORY_LOCATION\@|$(location)|g" $< >$@ + +view.c : $(VIEW_CORBA_GENERATED) + +$(IDL_GENERATED): $(IDL) + $(ORBIT_IDL) $(BONOBO_IDL_INCLUDES) $< + +EXTRA_DIST = $(server_DATA) + +INCLUDES = \ + $(BONOBOUI_CFLAGS) \ + $(BONOBO_CFLAGS) \ + $(GTKMATHVIEW_CFLAGS) + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/aux.cc b/helm/DEVEL/gtkmathview-bonobo/src/aux.cc new file mode 100644 index 000000000..4ef531239 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/aux.cc @@ -0,0 +1,302 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include + +#include + +#include +#include + +#include + +#include "aux.h" + +#define MATHML_NS_URI "http://www.w3.org/1998/Math/MathML" + +namespace DOM = GdomeSmartDOM; + +static DOM::Element +findElementById(const DOM::Element& el, + const DOM::GdomeString& ns, const DOM::GdomeString& name, + const DOM::GdomeString& id) +{ + assert(el); + if (el.getAttributeNS(ns, name) == id) + return el; + else + for (DOM::Node p = el.get_firstChild(); p; p = p.get_nextSibling()) + if (p.get_nodeType() == DOM::Node::ELEMENT_NODE) + if (DOM::Element res = findElementById(p, ns, name, id)) + return res; + return DOM::Element(); +} + +static unsigned +getDepth(const DOM::Element& elem) +{ + unsigned length = 0; + DOM::Element p = elem; + + while (p) + { + p = p.get_parentNode(); + length++; + } + + return length; +} + +static DOM::Element +findCommonAncestor(const DOM::Element& first, const DOM::Element& last) +{ + if (!first || !last) return DOM::Element(0); + + DOM::Element p(first); + DOM::Element q(last); + + if (p != q) + { + unsigned pDepth = getDepth(p); + unsigned qDepth = getDepth(q); + + while (p && pDepth > qDepth) + { + p = p.get_parentNode(); + pDepth--; + } + + while (q && qDepth > pDepth) + { + q = q.get_parentNode(); + qDepth--; + } + + assert(pDepth == qDepth); + + while (p && q && p != q) + { + p = p.get_parentNode(); + q = q.get_parentNode(); + } + } + + return p; +} + +static void +findCommonSiblings(const DOM::Element& first, const DOM::Element& last, + DOM::Element& firstS, DOM::Element& lastS) +{ + DOM::Element p(first); + DOM::Element q(last); + + if (p != q) + { + unsigned pDepth = getDepth(p); + unsigned qDepth = getDepth(q); + + while (p && pDepth > qDepth) + { + p = p.get_parentNode(); + pDepth--; + } + + while (q && qDepth > pDepth) + { + q = q.get_parentNode(); + qDepth--; + } + + assert(pDepth == qDepth); + + while (p && q && p.get_parentNode() != q.get_parentNode()) + { + p = p.get_parentNode(); + q = q.get_parentNode(); + } + } + + firstS = p; + lastS = q; +} + +static DOM::Node +leftmostChild(const DOM::Node& node) +{ + if (!node) return node; + + DOM::Node firstChild = node.get_firstChild(); + if (!firstChild) return node; + + return leftmostChild(firstChild); +} + +static DOM::Node +rightmostChild(const DOM::Node& node) +{ + if (!node) return node; + + DOM::Node lastChild = node.get_lastChild(); + if (!lastChild) return node; + + return rightmostChild(lastChild); +} + +static DOM::Node +leftSibling(const DOM::Node& node) +{ + DOM::Node p = node; + + if (!p) return p; + + while (p.get_parentNode() && p.get_parentNode().get_firstChild() == p) + p = p.get_parentNode(); + + if (!p.get_parentNode()) return DOM::Node(0); + + DOM::Node prevSibling = p.get_previousSibling(); + assert(prevSibling); + + return rightmostChild(prevSibling); +} + +static DOM::Node +rightSibling(const DOM::Node& node) +{ + DOM::Node p = node; + + if (!p) return p; + + DOM::Node firstChild = p.get_firstChild(); + if (firstChild) return firstChild; + + while (p.get_parentNode() && p.get_parentNode().get_lastChild() == p) + p = p.get_parentNode(); + + if (!p.get_parentNode()) return DOM::Node(0); + + DOM::Node nextSibling = p.get_nextSibling(); + assert(nextSibling); + + return leftmostChild(nextSibling); +} + +extern "C" GdomeElement* +find_common_ancestor(GdomeElement* first, GdomeElement* last) +{ + DOM::Element p(first); + DOM::Element q(last); + return gdome_cast_el(findCommonAncestor(p, q).gdome_object()); +} + +extern "C" GdomeElement* +find_self_or_ancestor(GdomeElement* elem, const gchar* uri, const gchar* name) +{ + DOM::Element el(elem); + + while (el && (el.get_namespaceURI() != uri || el.get_localName() != name)) + el = el.get_parentNode(); + + return gdome_cast_el(el.gdome_object()); +} + +extern "C" void +action_toggle(GdomeElement* elem) +{ + DOM::Element el(elem); + if (el.get_namespaceURI() != MATHML_NS_URI || el.get_localName() != "maction") return; + + guint idx; + if (el.hasAttribute("selection")) + idx = atoi(std::string(el.getAttribute("selection")).c_str()); + else idx = 1; + + idx++; + + std::ostringstream os; + os << idx; + el.setAttribute("selection", os.str()); +} + +extern "C" void +find_common_siblings(GdomeElement* first, GdomeElement* last, + GdomeElement** firstS, GdomeElement** lastS) +{ + DOM::Element fs(0); + DOM::Element ls(0); + + findCommonSiblings(DOM::Element(first), DOM::Element(last), fs, ls); + + if (firstS != NULL) *firstS = gdome_cast_el(fs.gdome_object()); + if (lastS != NULL) *lastS = gdome_cast_el(ls.gdome_object()); +} + +static DOM::Element +findElementWithAttribute(const DOM::Element& elem, const std::string& name) +{ + DOM::Element el(elem); + while (el && !el.hasAttribute(name)) el = el.get_parentNode(); + return el; +} + +static DOM::Element +findElementWithAttributeNS(const DOM::Element& elem, const std::string& ns_uri, const std::string& name) +{ + DOM::Element el(elem); + while (el && !el.hasAttributeNS(ns_uri, name)) el = el.get_parentNode(); + return el; +} + +extern "C" GdomeElement* +find_element_with_id(GdomeElement* elem, GdomeDOMString* ns_uri, GdomeDOMString* name) +{ + assert(name != NULL); + DOM::Element el; + if (ns_uri != NULL) + el = findElementWithAttributeNS(DOM::Element(elem), DOM::GdomeString(ns_uri), DOM::GdomeString(name)); + else + el = findElementWithAttribute(DOM::Element(elem), DOM::GdomeString(name)); + return gdome_cast_el(el.gdome_object()); +} + +extern "C" GdomeDOMString* +find_hyperlink(GdomeElement* elem) +{ + DOM::Element el = findElementWithAttribute(DOM::Element(elem),"href"); + if (el) return el.getAttribute("href").gdome_str(); + else return NULL; +} + +extern "C" GdomeElement* +find_element_by_id(GdomeElement* root, GdomeDOMString* ns_uri, GdomeDOMString* name, + const gchar* id) +{ + DOM::Element el = findElementById(DOM::Element(root), + DOM::GdomeString(ns_uri), DOM::GdomeString(name), + DOM::GdomeString(id)); + return gdome_cast_el(el.gdome_object()); +} + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/aux.h b/helm/DEVEL/gtkmathview-bonobo/src/aux.h new file mode 100644 index 000000000..e7cedd2cd --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/aux.h @@ -0,0 +1,46 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __aux_h__ +#define __aux_h__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + void action_toggle(GdomeElement*); + GdomeElement* find_common_ancestor(GdomeElement*, GdomeElement*); + GdomeElement* find_self_or_ancestor(GdomeElement*, const gchar*, const gchar*); + GdomeElement* find_element_with_id(GdomeElement*, GdomeDOMString*, GdomeDOMString*); + GdomeDOMString* find_hyperlink(GdomeElement*); + GdomeElement* find_element_by_id(GdomeElement*, GdomeDOMString*, GdomeDOMString*, + const gchar*); + +#ifdef __cplusplus +} +#endif + +#endif // __aux_h__ + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/control-data.c b/helm/DEVEL/gtkmathview-bonobo/src/control-data.c new file mode 100644 index 000000000..d97d0fd2f --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/control-data.c @@ -0,0 +1,138 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include + +#include "control-data.h" + +GtkMathViewControlData* +gtk_math_view_control_data_new(BonoboControl* control, GtkMathView *math_view) +{ + GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1); + cd->control = control; /* we don't ref the control this is a weak pointer */ + cd->math_view = math_view; + gtk_widget_ref(GTK_WIDGET(math_view)); + cd->item_factory = NULL; + cd->semantic_selection = FALSE; + cd->first_selected = NULL; + cd->root_selected = NULL; + cd->id_ns_uri = gdome_str_mkref("http://www.cs.unibo.it/helm"); + cd->id_name = gdome_str_mkref("xref"); + cd->x = cd->y = 0; + return cd; +} + +void +gtk_math_view_control_data_destroy(GtkMathViewControlData* cd) +{ + GdomeException exc = 0; + cd->control = NULL; /* don't unref the control, see above */ + gtk_widget_unref(GTK_WIDGET(cd->math_view)); + cd->math_view = NULL; + if (cd->item_factory != NULL) + { + gtk_object_unref(cd->item_factory); + cd->item_factory = NULL; + } + if (cd->first_selected != NULL) + { + gdome_el_unref(cd->first_selected, &exc); + g_assert(exc == 0); + cd->first_selected = NULL; + } + if (cd->root_selected != NULL) + { + gdome_el_unref(cd->root_selected, &exc); + g_assert(exc == 0); + cd->root_selected = NULL; + } + if (cd->id_ns_uri != NULL) + { + gdome_str_unref(cd->id_ns_uri); + cd->id_ns_uri = NULL; + } + if (cd->id_name != NULL) + { + gdome_str_unref(cd->id_name); + cd->id_name = NULL; + } + g_free(cd); +} + +gchar* +gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData* cd) +{ + g_return_val_if_fail(cd != NULL, NULL); + return (cd->id_ns_uri != NULL) ? g_strdup(cd->id_ns_uri->str) : NULL; +} + +void +gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData* cd, const gchar* ns_uri) +{ + g_return_if_fail(cd != NULL); + if (cd->id_ns_uri != NULL) gdome_str_unref(cd->id_ns_uri); + cd->id_ns_uri = (ns_uri != NULL) ? gdome_str_mkref_dup(ns_uri) : NULL; +} + +gchar* +gtk_math_view_control_data_get_id_name(GtkMathViewControlData* cd) +{ + g_return_val_if_fail(cd != NULL, NULL); + return (cd->id_name != NULL) ? g_strdup(cd->id_name->str) : NULL; +} + +void +gtk_math_view_control_data_set_id_name(GtkMathViewControlData* cd, const gchar* name) +{ + g_return_if_fail(cd != NULL); + if (cd->id_name != NULL) gdome_str_unref(cd->id_name); + cd->id_name = (name != NULL) ? gdome_str_mkref_dup(name) : NULL; +} + +void +gtk_math_view_control_data_set_root_selected(GtkMathViewControlData* cd, GdomeElement* elem) +{ + g_return_if_fail(cd != NULL); + GdomeException exc = 0; + + gtk_math_view_freeze(cd->math_view); + + if (cd->root_selected != NULL) + { + gtk_math_view_unselect(cd->math_view, cd->root_selected); + gdome_el_unref(cd->root_selected, &exc); + g_assert(exc == 0); + } + + cd->root_selected = elem; + if (cd->root_selected != NULL) + { + gdome_el_ref(cd->root_selected, &exc); + g_assert(exc == 0); + gtk_math_view_select(cd->math_view, cd->root_selected); + } + + gtk_math_view_thaw(cd->math_view); +} diff --git a/helm/DEVEL/gtkmathview-bonobo/src/control-data.h b/helm/DEVEL/gtkmathview-bonobo/src/control-data.h new file mode 100644 index 000000000..46bc6cef7 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/control-data.h @@ -0,0 +1,53 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __control_data_h__ +#define __control_data_h__ + +#include +#include +#include + +typedef struct _GtkMathViewControlData +{ + BonoboControl* control; /* the control this data belongs to */ + GtkMathView* math_view; + GtkWidget* item_factory; + gboolean semantic_selection; + GdomeElement* first_selected; + GdomeElement* root_selected; + GdomeDOMString* id_ns_uri; + GdomeDOMString* id_name; + gint x; + gint y; +} GtkMathViewControlData; + +GtkMathViewControlData* gtk_math_view_control_data_new(BonoboControl*, GtkMathView*); +void gtk_math_view_control_data_destroy(GtkMathViewControlData*); +gchar* gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData*); +void gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData*, const gchar*); +gchar* gtk_math_view_control_data_get_id_name(GtkMathViewControlData*); +void gtk_math_view_control_data_set_id_name(GtkMathViewControlData*, const gchar*); +void gtk_math_view_control_data_set_root_selected(GtkMathViewControlData*, GdomeElement*); + +#endif // __control_data_h__ diff --git a/helm/DEVEL/gtkmathview-bonobo/src/control-factory.c b/helm/DEVEL/gtkmathview-bonobo/src/control-factory.c new file mode 100644 index 000000000..6d90bef3d --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/control-factory.c @@ -0,0 +1,431 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include +#include +#include + +#include "control-factory.h" +#include "control-data.h" +#include "persist-file.h" +#include "persist-stream.h" +#include "handlers.h" +#include "view.h" + +enum + { + MATH_VIEW_WIDTH, + MATH_VIEW_HEIGHT, + MATH_VIEW_TOP_X, + MATH_VIEW_TOP_Y, + MATH_VIEW_FONT_SIZE, + MATH_VIEW_VERBOSITY, + MATH_VIEW_ID_NS_URI, + MATH_VIEW_ID_NAME + } math_args; + +static void +activate_maction(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + GdomeElement* elem; + + g_return_if_fail(control_data != NULL); + + elem = gtk_math_view_get_element_at(control_data->math_view, control_data->x, control_data->y); + if (elem != NULL) + { + GdomeException exc = 0; + GdomeElement* action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction"); + if (action != NULL) + { + gtk_math_view_freeze(control_data->math_view); + action_toggle(action); + gtk_math_view_thaw(control_data->math_view); + gdome_el_unref(action, &exc); + g_assert(exc == 0); + } + gdome_el_unref(elem, &exc); + g_assert(exc == 0); + } +} + +static void +copy_link_address(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ +} + +static void +zoom_in(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + g_return_if_fail(control_data != NULL); + guint old_font_size = gtk_math_view_get_font_size(control_data->math_view); + gtk_math_view_set_font_size(control_data->math_view, old_font_size + 1); +} + +static void +zoom_out(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + g_return_if_fail(control_data != NULL); + guint old_font_size = gtk_math_view_get_font_size(control_data->math_view); + gtk_math_view_set_font_size(control_data->math_view, old_font_size - 1); +} + +static void +switch_semantic_selection(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + g_return_if_fail(control_data != NULL); + control_data->semantic_selection = !control_data->semantic_selection; + if (control_data->semantic_selection) + { + GdomeElement* elem = find_element_with_id(control_data->root_selected, + control_data->id_ns_uri, + control_data->id_name); + } +} + +/* +static void +copy_selected_markup(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + gchar* res = copy_markup(control_data->root_selected); + if (res != NULL) + { + set_clipboard(res); + g_free(res); + } +} +*/ + +static void +copy_selected_id(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ +} + +static void +select_parent(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + g_return_if_fail(control_data != NULL); + if (control_data->root_selected != NULL) + { + GdomeException exc = 0; + GdomeNode* parent_node = gdome_el_parentNode(control_data->root_selected, &exc); + g_assert(parent_node != NULL); + g_assert(exc == 0); + GdomeElement* parent = gdome_cast_el(parent_node); + gtk_math_view_control_data_set_root_selected(control_data, parent); + gdome_n_unref(parent_node, &exc); + g_assert(exc == 0); + } +} + +static void +deselect(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) +{ + g_return_if_fail(control_data != NULL); + + if (control_data->root_selected != NULL) + { + gtk_math_view_unselect(control_data->math_view, control_data->root_selected); + control_data->root_selected = NULL; + } +} + +/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */ +static GtkItemFactoryEntry menu_items[] = { + { "/Activate ", NULL, activate_maction, 0, "", GTK_STOCK_EXECUTE }, + { "/Copy Link Address", NULL, copy_link_address, 0, "", GTK_STOCK_COPY }, + /* { "/Jump To", NULL, NULL, 0, "", GTK_STOCK_JUMP_TO }, */ + { "/sep1", NULL, NULL, 0, "" }, + /* { "/Semantic Selection", NULL, switch_semantic_selection, 0, "" }, */ + /* { "/Copy Selected Markup", NULL, copy_selected_markup, 0, "" }, */ + /* { "/Copy Id", NULL, copy_selected_id, 0, "" }, */ + /* { "/Show Selected", NULL, NULL, 0, "" }, */ + { "/Select Parent", NULL, select_parent, 0, "" }, + { "/De-Select", NULL, deselect, 0, "", GTK_STOCK_CLEAR }, + { "/sep2", NULL, NULL, 0, "" }, + { "/Smaller", NULL, zoom_out, 0, "", GTK_STOCK_ZOOM_OUT }, + { "/Bigger", NULL, zoom_in, 0, "", GTK_STOCK_ZOOM_IN }, + /* { "/Properties...", NULL, NULL, 0, "", GTK_STOCK_PROPERTIES }, */ +}; + +static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); + +void +button_pressed_cb(GtkMathView* math_view, GdkEventButton* event, GtkMathViewControlData* control_data) +{ + g_return_if_fail(math_view != NULL); + g_return_if_fail(event != NULL); + g_return_if_fail(control_data != NULL); + + if (event->button == 3) + { +#if 0 + gtk_menu_popup (GTK_MENU(control_data->popup_menu), NULL, NULL, + NULL, event, event->button, event->time); +#endif + control_data->x = (gint) event->x; + control_data->y = (gint) event->y; + printf("data %d %d\n", control_data->x, control_data->y); + + gtk_item_factory_popup_with_data(control_data->item_factory, + NULL, NULL, event->x_root, event->y_root, + event->button, gtk_get_current_event_time()); + } +} + + +static void +get_prop(BonoboPropertyBag* bag, + BonoboArg* arg, + guint arg_id, + CORBA_Environment *ev, + gpointer user_data) +{ + GtkMathViewControlData* control_data = user_data; + g_assert(control_data != NULL); + + switch (arg_id) + { + case MATH_VIEW_WIDTH: + BONOBO_ARG_SET_INT(arg, gtk_math_view_get_width(control_data->math_view)); + break; + case MATH_VIEW_HEIGHT: + BONOBO_ARG_SET_INT(arg, gtk_math_view_get_height(control_data->math_view)); + break; + case MATH_VIEW_TOP_X: + { + guint top_x; + gtk_math_view_get_top(control_data->math_view, &top_x, NULL); + BONOBO_ARG_SET_INT(arg, top_x); + } + break; + case MATH_VIEW_TOP_Y: + { + guint top_y; + gtk_math_view_get_top(control_data->math_view, NULL, &top_y); + BONOBO_ARG_SET_INT(arg, top_y); + } + break; + case MATH_VIEW_FONT_SIZE: + BONOBO_ARG_SET_INT(arg, gtk_math_view_get_font_size(control_data->math_view)); + break; + case MATH_VIEW_VERBOSITY: + BONOBO_ARG_SET_INT(arg, gtk_math_view_get_log_verbosity(control_data->math_view)); + break; + case MATH_VIEW_ID_NS_URI: + { + gchar* id_ns_uri = gtk_math_view_control_data_get_id_ns_uri(control_data); + BONOBO_ARG_SET_STRING(arg, id_ns_uri); + g_free(id_ns_uri); + } + break; + case MATH_VIEW_ID_NAME: + { + gchar* id_name = gtk_math_view_control_data_get_id_name(control_data); + BONOBO_ARG_SET_STRING(arg, id_name); + g_free(id_name); + } + break; + default: + bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); + break; + } +} + +static void +set_prop(BonoboPropertyBag* bag, + const BonoboArg* arg, + guint arg_id, + CORBA_Environment* ev, + gpointer user_data) +{ + GtkMathViewControlData *control_data = user_data; + g_assert(control_data != NULL); + + switch (arg_id) + { + case MATH_VIEW_TOP_X: + { + guint old_top_y; + gtk_math_view_get_top(control_data->math_view, NULL, &old_top_y); + gtk_math_view_set_top(control_data->math_view, BONOBO_ARG_GET_INT(arg), old_top_y); + } + break; + case MATH_VIEW_TOP_Y: + { + guint old_top_x; + gtk_math_view_get_top(control_data->math_view, &old_top_x, NULL); + gtk_math_view_set_top(control_data->math_view, BONOBO_ARG_GET_INT(arg), old_top_x); + } + break; + case MATH_VIEW_FONT_SIZE: + gtk_math_view_set_font_size(control_data->math_view, BONOBO_ARG_GET_INT(arg)); + break; + case MATH_VIEW_VERBOSITY: + gtk_math_view_set_log_verbosity(control_data->math_view, BONOBO_ARG_GET_INT(arg)); + break; + case MATH_VIEW_ID_NS_URI: + gtk_math_view_control_data_set_id_ns_uri(control_data, BONOBO_ARG_GET_STRING(arg)); + break; + case MATH_VIEW_ID_NAME: + gtk_math_view_control_data_set_id_name(control_data, BONOBO_ARG_GET_STRING(arg)); + break; + default: + bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); + break; + } +} + +static void +control_destroy(BonoboObject *object, GtkMathViewControlData *cd) +{ + gtk_math_view_control_data_destroy(cd); +} + +static void +gtk_math_view_control_init(BonoboControl *control, GtkWidget *scrolled_window) +{ + GtkMathViewControlData *control_data; + GtkWidget *math_view; + GtkItemFactory *item_factory; + + Bonobo_UIContainer remote_ui_container; + BonoboUIComponent *ui_component; + + BonoboPropertyBag *prop_bag; + BonoboObject *persist_file; + BonoboObject *persist_stream; + BonoboEventSource *evs; + View* view; + + math_view = gtk_math_view_new(NULL,NULL); + gtk_widget_show(math_view); + + control_data = gtk_math_view_control_data_new(control, (GtkMathView*)math_view); + + g_signal_connect (control, "destroy", G_CALLBACK (control_destroy), control_data); + + /* Same as before but don't bother with the accelerators */ + control_data->item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "
", NULL); + gtk_item_factory_create_items (control_data->item_factory, nmenu_items, menu_items, control_data); + /* control_data->popup_menu = gtk_item_factory_get_widget (control_data->item_factory, "
"); */ + /* gtk_widget_ref(control_data->popup_menu); */ + + evs = bonobo_event_source_new(); + bonobo_object_add_interface(BONOBO_OBJECT(control), BONOBO_OBJECT(evs)); + + gtk_container_add(GTK_CONTAINER (scrolled_window), GTK_WIDGET (control_data->math_view)); + + view = view_new(control_data); + bonobo_object_add_interface(BONOBO_OBJECT(control), BONOBO_OBJECT(view)); + + persist_file = gtk_math_view_persist_file_new(GTK_MATH_VIEW(math_view)); + bonobo_object_add_interface(BONOBO_OBJECT(control), persist_file); + + persist_stream = gtk_math_view_persist_stream_new(GTK_MATH_VIEW(math_view)); + bonobo_object_add_interface(BONOBO_OBJECT(control), persist_stream); + + prop_bag = bonobo_property_bag_new(get_prop, set_prop, control_data); + bonobo_control_set_properties(control, BONOBO_OBJREF(prop_bag), NULL); + + bonobo_property_bag_add(prop_bag, "width", + MATH_VIEW_WIDTH, BONOBO_ARG_INT, + NULL, + "Width of the view", 0); + bonobo_property_bag_add(prop_bag, "height", + MATH_VIEW_HEIGHT, BONOBO_ARG_INT, + NULL, + "Height of the view", 0); + bonobo_property_bag_add(prop_bag, "top-x", + MATH_VIEW_TOP_X, BONOBO_ARG_INT, + NULL, + "X coordinate of the top-left corner", 0); + bonobo_property_bag_add(prop_bag, "top-y", + MATH_VIEW_TOP_Y, BONOBO_ARG_INT, + NULL, + "Y coordinate of the top-left corner", 0); + bonobo_property_bag_add(prop_bag, "font-size", + MATH_VIEW_FONT_SIZE, BONOBO_ARG_INT, + NULL, + "Default font size", 0); + bonobo_property_bag_add(prop_bag,"verbosity", + MATH_VIEW_VERBOSITY, BONOBO_ARG_INT, + NULL, + "Verbosity level", 0); + bonobo_property_bag_add(prop_bag, "id-ns-uri", + MATH_VIEW_ID_NS_URI, BONOBO_ARG_STRING, + NULL, + "Namespace URI of ID attribute", 0); + bonobo_property_bag_add(prop_bag, "id-name", + MATH_VIEW_ID_NAME, BONOBO_ARG_STRING, + NULL, + "Name of ID attribute", 0); + + bonobo_object_unref(BONOBO_OBJECT(prop_bag)); + + g_signal_connect(control,"set_frame", G_CALLBACK(set_frame), control_data); + g_signal_connect(control_data->math_view, "button_press_event", G_CALLBACK (button_pressed_cb), + control_data); + g_signal_connect(control_data->math_view, "click", G_CALLBACK (click_cb), + control_data); + g_signal_connect(control_data->math_view, "select_begin", G_CALLBACK(select_begin_cb), + control_data); + g_signal_connect(control_data->math_view, "select_over", G_CALLBACK(select_over_cb), + control_data); + g_signal_connect(control_data->math_view, "select_end", G_CALLBACK(select_end_cb), + control_data); + g_signal_connect(control_data->math_view, "select_abort", G_CALLBACK(select_abort_cb), + control_data); +} + +static BonoboObject* +gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, + gpointer closure) +{ + BonoboControl *control; + GtkWidget *scrolled_window; + + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + /* putting SHADOW_NONE screws the plugin window, how's that??? */ + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); + gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 0); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_show_all (scrolled_window); + + control = bonobo_control_new(scrolled_window); + + if(control) + { + gtk_math_view_control_init(control,scrolled_window); + return BONOBO_OBJECT(control); + } + else + return NULL; +} + +BONOBO_ACTIVATION_SHLIB_FACTORY (CONTROL_FACTORY_ID, "GtkMathView Factory", + gtk_math_view_control_factory, NULL); + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/control-factory.h b/helm/DEVEL/gtkmathview-bonobo/src/control-factory.h new file mode 100644 index 000000000..0d2e5a24d --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/control-factory.h @@ -0,0 +1,34 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __control_factory_h__ +#define __control_factory_h__ + +#include +#include +#include + +#define CONTROL_FACTORY_ID "OAFIID:GNOME_GtkMathView_Factory:" MATH_VIEW_API_VERSION +#define CONTROL_ID "OAFIID:GNOME_GtkMathView:" MATH_VIEW_API_VERSION + +#endif /* __control_factory_h__ */ diff --git a/helm/DEVEL/gtkmathview-bonobo/src/handlers.c b/helm/DEVEL/gtkmathview-bonobo/src/handlers.c new file mode 100644 index 000000000..4861b2f0b --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/handlers.c @@ -0,0 +1,245 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include "aux.h" +#include "handlers.h" + +static void +set_clipboard(GdomeDOMString* data) +{ + GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text(clipboard, data->str, gdome_str_length(data)); +} + +void +set_frame(BonoboControl *control, gpointer data) +{ +} + +static void +notify_browser(GtkMathViewControlData* control_data, const char* url) +{ + BonoboObject* evs = bonobo_object_query_local_interface(BONOBO_OBJECT(control_data->control), + "IDL:Bonobo/EventSource:1.0"); + if (evs != NULL) + { + BonoboArg* arg = bonobo_arg_new(BONOBO_ARG_STRING); + BONOBO_ARG_SET_STRING(arg, url); + bonobo_event_source_notify_listeners (evs, "URL", arg, NULL); + /* bonobo_arg_release(arg); */ + bonobo_object_unref(BONOBO_OBJECT(evs)); + } +} + +void +click_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) +{ + GdomeException exc = 0; + + g_return_if_fail(math_view != NULL); + g_return_if_fail(control_data != NULL); + + if (elem != NULL) + { + GdomeElement* action; + GdomeDOMString* href = find_hyperlink(elem); + + if (href != NULL) + { + /*gtk_math_view_load_uri(math_view,href->str);*/ + + notify_browser(control_data, href->str); + + //set_clipboard(href); + gdome_str_unref(href); + return; + } + + action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction"); + if (action != NULL) + { + gtk_math_view_freeze(math_view); + action_toggle(action); + gtk_math_view_thaw(math_view); + gdome_el_unref(action, &exc); + g_assert(exc == 0); + return; + } + } + + if (control_data->root_selected != NULL) + { + gtk_math_view_freeze(math_view); + gtk_math_view_unselect(math_view, control_data->root_selected); + gtk_math_view_thaw(math_view); + gdome_el_unref(control_data->root_selected, &exc); + g_assert(exc == 0); + control_data->root_selected = NULL; + } +} + +void +select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) +{ + g_return_if_fail(math_view != NULL); + g_return_if_fail(control_data != NULL); + + if (elem != NULL) + { + GdomeException exc = 0; + gtk_math_view_freeze(math_view); + if (control_data->root_selected != NULL) + { + gtk_math_view_unselect(math_view, control_data->root_selected); + gdome_el_unref(control_data->root_selected, &exc); + g_assert(exc == 0); + control_data->root_selected = NULL; + } + + if (control_data->semantic_selection) + { + GdomeElement* new_elem = find_element_with_id(elem, control_data->id_ns_uri, control_data->id_name); + if (new_elem != NULL) + { + gdome_el_ref(new_elem, &exc); + g_assert(exc == 0); + } + control_data->first_selected = control_data->root_selected = new_elem; + } + else + { + gdome_el_ref(elem, &exc); + g_assert(exc == 0); + gdome_el_ref(elem, &exc); + g_assert(exc == 0); + control_data->first_selected = control_data->root_selected = elem; + } + + if (control_data->root_selected != NULL) + gtk_math_view_select(math_view, control_data->root_selected); + + gtk_math_view_thaw(math_view); + } +} + +void +select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) +{ + g_return_if_fail(math_view != NULL); + g_return_if_fail(control_data != NULL); + + if (control_data->first_selected != NULL && elem != NULL) + { + GdomeException exc = 0; + + gtk_math_view_freeze(math_view); + + if (control_data->root_selected != NULL) + { + gtk_math_view_unselect(math_view, control_data->root_selected); + gdome_el_unref(control_data->root_selected, &exc); + g_assert(exc == 0); + control_data->root_selected = NULL; + } + + if (control_data->semantic_selection) + { + GdomeElement* new_root = find_common_ancestor(control_data->first_selected, elem); + if (new_root != NULL) + { + control_data->root_selected = find_element_with_id(new_root, control_data->id_ns_uri, control_data->id_name); + gdome_el_unref(new_root, &exc); + g_assert(exc == 0); + } + else + control_data->root_selected = NULL; + } + else + control_data->root_selected = find_common_ancestor(control_data->first_selected, elem); + + if (control_data->root_selected != NULL) + gtk_math_view_select(math_view, control_data->root_selected); + + gtk_math_view_thaw(math_view); + } +} + +void +select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) +{ + g_return_if_fail(math_view != NULL); + g_return_if_fail(control_data != NULL); + + if (control_data->first_selected != NULL) + { + GdomeException exc = 0; + gdome_el_unref(control_data->first_selected, &exc); + g_assert(exc == 0); + control_data->first_selected = NULL; + + if (control_data->root_selected != NULL && control_data->semantic_selection) + { + GdomeException exc = 0; + GdomeDOMString* id = gdome_el_getAttributeNS(control_data->root_selected, + control_data->id_ns_uri, + control_data->id_name, &exc); + g_assert(exc == 0); + g_assert(id != NULL); + set_clipboard(id); + gdome_str_unref(id); + } + } +} + +void +select_abort_cb(GtkMathView* math_view, GtkMathViewControlData* control_data) +{ + GdomeException exc = 0; + + g_return_if_fail(math_view != NULL); + g_return_if_fail(control_data != NULL); + + if (control_data->first_selected != NULL) + { + gdome_el_unref(control_data->first_selected, &exc); + g_assert(exc == 0); + control_data->first_selected = NULL; + } + + if (control_data->root_selected != NULL) + { + gtk_math_view_freeze(math_view); + gtk_math_view_unselect(math_view, control_data->root_selected); + gtk_math_view_thaw(math_view); + gdome_el_unref(control_data->root_selected, &exc); + g_assert(exc == 0); + control_data->root_selected = NULL; + } +} + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/handlers.h b/helm/DEVEL/gtkmathview-bonobo/src/handlers.h new file mode 100644 index 000000000..47eda64b3 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/handlers.h @@ -0,0 +1,41 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __handlers_h__ +#define __handlers_h__ + +#include +#include +#include + +#include "control-data.h" + +void set_frame(BonoboControl*, gpointer); +void button_pressed_cb(GtkMathView*, GdkEventButton*, GtkMathViewControlData*); +void click_cb(GtkMathView*, GdomeElement*, gint, GtkMathViewControlData*); +void select_begin_cb(GtkMathView*,GdomeElement*, gint, GtkMathViewControlData*); +void select_over_cb(GtkMathView*,GdomeElement*,gint, GtkMathViewControlData*); +void select_end_cb(GtkMathView*,GdomeElement*,gint, GtkMathViewControlData*); +void select_abort_cb(GtkMathView*, GtkMathViewControlData*); + +#endif // __handlers_h__ diff --git a/helm/DEVEL/gtkmathview-bonobo/src/persist-file.c b/helm/DEVEL/gtkmathview-bonobo/src/persist-file.c new file mode 100644 index 000000000..1d3fd36c6 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/persist-file.c @@ -0,0 +1,141 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include +#include +#include + +#include "persist-file.h" +#include "control-factory.h" + +static BonoboObjectClass *gtk_math_view_persist_file_parent_class; + +static void load_implementation(PortableServer_Servant servant,const gchar *path, + CORBA_Environment *ev); + +static void save_implementation(PortableServer_Servant servant,const gchar *path, + CORBA_Environment *ev); + +static void finalize(GObject *object) +{ + GtkMathViewPersistFile *file = GTK_MATH_VIEW_PERSIST_FILE(object); + + if (file->math_view) + { + g_object_unref(file->math_view); + file->math_view = NULL; + } + + G_OBJECT_CLASS(gtk_math_view_persist_file_parent_class)->finalize (object); +} + +static Bonobo_Persist_ContentTypeList * +get_content_types(BonoboPersist *persist,CORBA_Environment *ev) +{ + return bonobo_persist_generate_content_types(3, "application/mathml+xml", "text/mathml", "text/plain"); +} + +static void +gtk_math_view_persist_file_class_init(GtkMathViewPersistFileClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS(klass); + POA_Bonobo_PersistFile__epv *epv = &klass->epv; + + gtk_math_view_persist_file_parent_class = g_type_class_peek_parent(klass); + + epv->load = load_implementation; + epv->save = save_implementation; + + object_class->finalize = finalize; + persist_class->get_content_types = get_content_types; +} + +GType +gtk_math_view_persist_file_get_type(void) +{ + static GType type = 0; + + if (!type) + { + GTypeInfo info = + { + sizeof(GtkMathViewPersistFileClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gtk_math_view_persist_file_class_init, + NULL, /* class finalize */ + NULL, /* class_data */ + sizeof(GtkMathViewPersistFile), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL + }; + + type = bonobo_type_unique(BONOBO_TYPE_PERSIST, + POA_Bonobo_PersistFile__init,POA_Bonobo_PersistFile__fini, + G_STRUCT_OFFSET(GtkMathViewPersistFileClass, epv), + &info,"GtkMathViewPresistFile"); + } + + return type; +} + +BonoboObject * +gtk_math_view_persist_file_new(GtkMathView *math_view) +{ + BonoboObject *file; + + file = g_object_new(gtk_math_view_persist_file_get_type(),NULL); + bonobo_persist_construct(BONOBO_PERSIST(file),CONTROL_FACTORY_ID); + + g_object_ref(math_view); + GTK_MATH_VIEW_PERSIST_FILE(file)->math_view = math_view; + + return file; +} + +static void +load_implementation(PortableServer_Servant servant,const gchar *path,CORBA_Environment *ev) +{ + gboolean result; + GtkMathViewPersistFile* file = GTK_MATH_VIEW_PERSIST_FILE(bonobo_object_from_servant(servant)); + //fd = open(path, O_RDONLY); + + result = gtk_math_view_load_uri(file->math_view,path); + if(!result) + CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL); + + bonobo_object_unref(BONOBO_OBJECT(file)); +} + +static void +save_implementation(PortableServer_Servant servant, + const gchar *path, + CORBA_Environment *ev) +{ + bonobo_exception_set(ev,"save_exception"); + bonobo_exception_add_handler_str("save_exception", + "Save option is not valid"); +} diff --git a/helm/DEVEL/gtkmathview-bonobo/src/persist-file.h b/helm/DEVEL/gtkmathview-bonobo/src/persist-file.h new file mode 100644 index 000000000..6f70e76ef --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/persist-file.h @@ -0,0 +1,61 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __GTK_MATH_VIEW_PERSIST_FILE_H__ +#define __GTK_MATH_VIEW_PERSIST_FILE_H__ + +#include +#include + +G_BEGIN_DECLS + +struct _GtkMathViewPersistFile; +typedef struct _GtkMathViewPersistFile GtkMathViewPersistFile; +typedef struct _GtkMathViewPersistFilePrivate GtkMathViewPersistFilePrivate; + +#define GTK_MATH_VIEW_TYPE_PERSIST_FILE (gtk_math_view_persist_file_get_type()) +#define GTK_MATH_VIEW_PERSIST_FILE(object) (G_TYPE_CHECK_INSTANCE_CAST((object), GTK_MATH_VIEW_TYPE_PERSIST_FILE, \ + GtkMathViewPersistFile)) +#define GTK_MATH_VIEW_IS_PERSIST_FILE(object) (G_TYPE_CHECK_INSTANCE_TYPE((object),\ + GTK_MATH_VIEW_TYPE_PERSIST_FILE)) +#define GTK_MATH_VIEW_IS_PERSIST_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\ + GTK_MATH_VIEW_TYPE_PERSIST_FILE)) + +struct _GtkMathViewPersistFile +{ + BonoboPersist parent; + GtkMathView *math_view; +}; + +typedef struct +{ + BonoboPersistClass parent_class; + POA_Bonobo_PersistFile__epv epv; +} GtkMathViewPersistFileClass; + +GType gtk_math_view_persist_file_get_type(void); +BonoboObject *gtk_math_view_persist_file_new(GtkMathView *); + +G_END_DECLS + +#endif diff --git a/helm/DEVEL/gtkmathview-bonobo/src/persist-stream.c b/helm/DEVEL/gtkmathview-bonobo/src/persist-stream.c new file mode 100644 index 000000000..bef7d90cb --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/persist-stream.c @@ -0,0 +1,221 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include +#include + +#include "persist-stream.h" +#include "control-factory.h" + +#define DEBUG0 + +static BonoboObjectClass *gtk_math_view_persist_stream_parent_class; + +static void load_implementation(PortableServer_Servant servant, + const Bonobo_Stream stream, + const CORBA_char *type, + CORBA_Environment *ev); + +static void save_implementation(PortableServer_Servant servant, + const Bonobo_Stream stream, + const CORBA_char *type, + CORBA_Environment *ev); + +static void finalize(GObject *object) +{ + GtkMathViewPersistStream *stream = GTK_MATH_VIEW_PERSIST_STREAM(object); + + if (stream->math_view != NULL) + { + g_object_unref(stream->math_view); + stream->math_view = NULL; + } + + G_OBJECT_CLASS(gtk_math_view_persist_stream_parent_class)->finalize(object); +} + +static Bonobo_Persist_ContentTypeList * +get_content_types(BonoboPersist *persist,CORBA_Environment *ev) +{ + return bonobo_persist_generate_content_types(2, "application/mathml+xml", "text/mathml"); +} + +static void +gtk_math_view_persist_stream_class_init(GtkMathViewPersistStreamClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS(klass); + POA_Bonobo_PersistStream__epv *epv = &klass->epv; + +#ifdef DEBUG + printf("persist stream class init\n"); +#endif + gtk_math_view_persist_stream_parent_class = g_type_class_peek_parent(klass); + + epv->load = load_implementation; + epv->save = save_implementation; + + object_class->finalize = finalize; + persist_class->get_content_types = get_content_types; +} + +GType +gtk_math_view_persist_stream_get_type(void) +{ + static GType type = 0; +#ifdef DEBUG + printf("persist stream get type\n"); +#endif + if (!type) + { + GTypeInfo info = + { + sizeof(GtkMathViewPersistStreamClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gtk_math_view_persist_stream_class_init, + NULL, /*class finalize */ + NULL, /*class data */ + sizeof(GtkMathViewPersistStream), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL + }; + + type = bonobo_type_unique(BONOBO_TYPE_PERSIST, + POA_Bonobo_PersistStream__init,POA_Bonobo_PersistStream__fini, + G_STRUCT_OFFSET(GtkMathViewPersistStreamClass,epv), + &info,"GtkMathViewPersistStream"); + } + + return type; +} + +BonoboObject * +gtk_math_view_persist_stream_new(GtkMathView *math_view) +{ + BonoboObject *stream; + +#ifdef DEBUG + printf("persist stream new\n"); +#endif + stream = g_object_new(gtk_math_view_persist_stream_get_type(),NULL); + bonobo_persist_construct(BONOBO_PERSIST(stream),CONTROL_FACTORY_ID); + + g_object_ref(math_view); + GTK_MATH_VIEW_PERSIST_STREAM(stream)->math_view = math_view; + + return stream; +} + +static FILE* +create_tmp_file(GtkMathViewPersistStream *persist) +{ + FILE *tmpfile; + int fd; + + persist->tmp_path_name = g_strconcat(g_get_tmp_dir(), "/gmvXXXXXX", NULL); + if ((fd = mkstemp(persist->tmp_path_name)) < 0) + { + g_free(persist->tmp_path_name), + persist->tmp_path_name = NULL; + return NULL; + } + + tmpfile = fdopen(fd, "w"); + if(!tmpfile) + { + close(fd); + return NULL; + } + + return tmpfile; +} + + +static void +load_implementation(PortableServer_Servant servant, + Bonobo_PersistStream stream, + const CORBA_char *type, + CORBA_Environment *ev) +{ + GtkMathViewPersistStream *persist = GTK_MATH_VIEW_PERSIST_STREAM (bonobo_object_from_servant (servant)); + Bonobo_Stream_iobuf *buffer; + GtkMathViewPersistStream *handle; + CORBA_long len_read; + gboolean result; + FILE *tmpfile; + +#ifdef DEBUG + printf("persist stream loading\n"); +#endif + + if (strcmp (type, "application/mathml+xml") != 0) + { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_Bonobo_Persist_WrongDataType, NULL); + return; + } + + tmpfile = create_tmp_file(persist); + do + { + Bonobo_Stream_read (stream, 4096, &buffer, ev); + if (ev->_major != CORBA_NO_EXCEPTION) + goto clean; + + len_read = buffer->_length; + + if (buffer->_buffer && len_read) + if (fwrite(buffer->_buffer, 1, len_read, tmpfile) != len_read) + { + CORBA_free (buffer); + goto clean; + } + + CORBA_free (buffer); + } while (len_read > 0); + + fclose(tmpfile); + + result = gtk_math_view_load_uri(persist->math_view,persist->tmp_path_name); + if(!result) + { + CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL); + } + return ; + + clean: + fclose (tmpfile); + return; +} + +static void +save_implementation(PortableServer_Servant servant,const Bonobo_Stream stream,const CORBA_char *type,CORBA_Environment *ev) +{ + bonobo_exception_set(ev,"save_exception"); + bonobo_exception_add_handler_str("save_exception", + "Save option is not valid"); + return; +} diff --git a/helm/DEVEL/gtkmathview-bonobo/src/persist-stream.h b/helm/DEVEL/gtkmathview-bonobo/src/persist-stream.h new file mode 100644 index 000000000..848121436 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/persist-stream.h @@ -0,0 +1,59 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __GTK_MATH_VIEW_PERSIST_STREAM_H__ +#define __GTK_MATH_VIEW_PERSIST_STREAM_H__ + +#include +#include + +G_BEGIN_DECLS + +struct _GtkMathViewPersistStream; +typedef struct _GtkMathViewPersistStream GtkMathViewPersistStream; +typedef struct _GtkMathViewPersistStreamPrivate GtkMathViewPersistStreamPrivate; + +#define GTK_MATH_VIEW_TYPE_PERSIST_STREAM (gtk_math_view_persist_stream_get_type()) +#define GTK_MATH_VIEW_PERSIST_STREAM(object) (G_TYPE_CHECK_INSTANCE_CAST((object), GTK_MATH_VIEW_TYPE_PERSIST_STREAM,GtkMathViewPersistStream)) +#define GTK_MATH_VIEW_IS_PERSIST_STREAM(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), GTK_MATH_VIEW_TYPE_PERSIST_STREAM)) +#define GTK_MATH_VIEW_IS_PERSIST_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_MATH_VIEW_TYPE_PERSIST_STREAM)) + +struct _GtkMathViewPersistStream +{ + BonoboPersist parent; + GtkMathView *math_view; + gchar* tmp_path_name; +}; + +typedef struct +{ + BonoboPersistClass parent_class; + POA_Bonobo_PersistStream__epv epv; +} GtkMathViewPersistStreamClass; + +GType gtk_math_view_persist_stream_get_type(void); +BonoboObject *gtk_math_view_persist_stream_new(GtkMathView *); + +G_END_DECLS + +#endif diff --git a/helm/DEVEL/gtkmathview-bonobo/src/view.c b/helm/DEVEL/gtkmathview-bonobo/src/view.c new file mode 100644 index 000000000..068558d25 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/view.c @@ -0,0 +1,361 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#define HAVE_GMETADOM +#include + +#include "aux.h" +#include "view.h" + +static GObjectClass* view_parent_class; + +static void +view_object_finalize(GObject* object) +{ + View* view = VIEW(object); + /* free resources */ + view_parent_class->finalize(object); + return; +} + +static void +impl_view_freeze(PortableServer_Servant servant, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_freeze(view->control_data->math_view); + return; +} + +static void +impl_view_thaw(PortableServer_Servant servant, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_thaw(view->control_data->math_view); + return; +} + +static CORBA_boolean +impl_view_load(PortableServer_Servant servant, + const CORBA_char *uri, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + return gtk_math_view_load_uri(view->control_data->math_view, uri); +} + +static void +impl_view_unload(PortableServer_Servant servant, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_unload(view->control_data->math_view); +} + +static void +impl_view_setIdAttribute (PortableServer_Servant servant, + const CORBA_char *ns, + const CORBA_char *name, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_control_data_set_id_attribute(view->control_data, ns, name); +} + +static void +impl_view_getIdAttribute (PortableServer_Servant servant, + CORBA_string *ns, + CORBA_string *name, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + if (view->control_data->id_ns_uri != NULL) + *ns = CORBA_string_dup(view->control_data->id_ns_uri->str); + else + *ns = NULL; + + if (view->control_data->id_name != NULL) + *name = CORBA_string_dup(view->control_data->id_name); + else + *name = NULL; +} + +static void +impl_view_select(PortableServer_Servant servant, + const CORBA_char *id, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); + if (root != NULL) + { + GdomeException exc = 0; + GdomeElement* el = find_element_by_id(root, + view->control_data->id_ns_uri, + view->control_data->id_name, + id); + if (el != NULL) + { + gtk_math_view_select(view->control_data->math_view, el); + gdome_el_unref(el, &exc); + g_assert(exc == 0); + } + gdome_el_unref(root, &exc); + g_assert(exc == 0); + } +} + +static void +impl_view_unselect(PortableServer_Servant servant, + const CORBA_char *id, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); + if (root != NULL) + { + GdomeException exc = 0; + GdomeElement* el = find_element_by_id(root, + view->control_data->id_ns_uri, + view->control_data->id_name, + id); + if (el != NULL) + { + gtk_math_view_unselect(view->control_data->math_view, el); + gdome_el_unref(el, &exc); + g_assert(exc == 0); + } + gdome_el_unref(root, &exc); + g_assert(exc == 0); + } +} + +static CORBA_boolean +impl_view_isSelected(PortableServer_Servant servant, + const CORBA_char *id, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); + CORBA_boolean res = CORBA_FALSE; + if (root != NULL) + { + GdomeException exc = 0; + GdomeElement* el = find_element_by_id(root, + view->control_data->id_ns_uri, + view->control_data->id_name, + id); + if (el != NULL) + { + res = gtk_math_view_is_selected(view->control_data->math_view, el) ? CORBA_TRUE : CORBA_FALSE; + gdome_el_unref(el, &exc); + g_assert(exc == 0); + } + gdome_el_unref(root, &exc); + g_assert(exc == 0); + } + return res; +} + +static CORBA_boolean +impl_view_elementCoords(PortableServer_Servant servant, + const CORBA_char *id, + CORBA_short *x, CORBA_short *y, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); + CORBA_boolean res = CORBA_FALSE; + if (root != NULL) + { + GdomeException exc = 0; + GdomeElement* el = find_element_by_id(root, + view->control_data->id_ns_uri, + view->control_data->id_name, + id); + if (el != NULL) + { + gint xx; + gint yy; + res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &xx, &yy) ? CORBA_TRUE : CORBA_FALSE; + gdome_el_unref(el, &exc); + g_assert(exc == 0); + *x = xx; + *y = yy; + } + gdome_el_unref(root, &exc); + g_assert(exc == 0); + } + return res; +} + +static CORBA_boolean +impl_view_elementBoundingBox(PortableServer_Servant servant, + const CORBA_char *id, + CORBA_short *width, CORBA_short *height, CORBA_short *depth, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); + CORBA_boolean res = CORBA_FALSE; + if (root != NULL) + { + GdomeException exc = 0; + GdomeElement* el = find_element_by_id(root, + view->control_data->id_ns_uri, + view->control_data->id_name, + id); + if (el != NULL) + { + gint w; + gint h; + gint d; + res = gtk_math_view_get_element_bounding_box(view->control_data->math_view, el, &w, &h, &d) ? CORBA_TRUE : CORBA_FALSE; + gdome_el_unref(el, &exc); + g_assert(exc == 0); + *width = w; + *height = h; + *depth = d; + } + gdome_el_unref(root, &exc); + g_assert(exc == 0); + } + return res; +} + +static void +impl_view_getSize(PortableServer_Servant servant, + CORBA_short *width, CORBA_short *height, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + *width = gtk_math_view_get_width(view->control_data->math_view); + *height = gtk_math_view_get_height(view->control_data->math_view); +} + +static void +impl_view_getTop(PortableServer_Servant servant, + CORBA_short *x, CORBA_short *y, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gint xx; + gint yy; + gtk_math_view_get_top(view->control_data->math_view, &xx, &yy); + *x = xx; + *y = yy; +} + +static void +impl_view_setTop (PortableServer_Servant servant, + CORBA_short x, CORBA_short y, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_set_top(view->control_data->math_view, x, y); +} + +static void +impl_view_setDefaultFontSize(PortableServer_Servant servant, + CORBA_short size, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_set_font_size(view->control_data->math_view, size); +} + +static short +impl_view_getDefaultFontSize(PortableServer_Servant servant, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + return gtk_math_view_get_font_size(view->control_data->math_view); +} + +static void +impl_view_setVerbosity(PortableServer_Servant servant, + const CORBA_short level, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + gtk_math_view_set_log_verbosity(view->control_data->math_view, level); +} + +static short +impl_view_getVerbosity(PortableServer_Servant servant, + CORBA_Environment *ev) +{ + View* view = VIEW (bonobo_object (servant)); + return gtk_math_view_get_log_verbosity(view->control_data->math_view); +} + +static void +view_class_init(ViewClass* klass) +{ + GObjectClass* object_class = (GObjectClass *) klass; + POA_GNOME_GtkMathView_View__epv* epv = &klass->epv; + + view_parent_class = g_type_class_peek_parent (klass); + object_class->finalize = view_object_finalize; + + epv->freeze = impl_view_freeze; + epv->thaw = impl_view_thaw; + epv->load = impl_view_load; + epv->unload = impl_view_unload; + epv->setIdAttribute = impl_view_setIdAttribute; + epv->getIdAttribute = impl_view_getIdAttribute; + epv->select = impl_view_select; + epv->unselect = impl_view_unselect; + epv->isSelected = impl_view_isSelected; + epv->elementCoords = impl_view_elementCoords; + epv->elementBoundingBox = impl_view_elementBoundingBox; + epv->getSize = impl_view_getSize; + epv->getTop = impl_view_getTop; + epv->setTop = impl_view_setTop; + epv->setDefaultFontSize = impl_view_setDefaultFontSize; + epv->getDefaultFontSize = impl_view_getDefaultFontSize; + epv->setVerbosity = impl_view_setVerbosity; + epv->getVerbosity = impl_view_getVerbosity; +} + +static void +view_init(View* view) +{ + /* do some initialization */ +} + +View* +view_new(GtkMathViewControlData* control_data) +{ + View* view; + g_return_val_if_fail(control_data != NULL, NULL); + view = g_object_new(VIEW_TYPE, NULL); + view->control_data = control_data; + return view; +} + +BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view) + diff --git a/helm/DEVEL/gtkmathview-bonobo/src/view.h b/helm/DEVEL/gtkmathview-bonobo/src/view.h new file mode 100644 index 000000000..86394bec5 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/src/view.h @@ -0,0 +1,53 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#ifndef __view_h__ +#define __view_h__ + +#include + +#include "GtkMathView.h" +#include "control-data.h" + +#define VIEW_TYPE (view_get_type()) +#define VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), VIEW_TYPE, View)) +#define VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), VIEW_TYPE, ViewClass)) +#define VIEW_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), VIEW_TYPE)) +#define VIEW_IS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), VIEW_TYPE)) +#define VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), VIEW_TYPE, ViewClass)) + +typedef struct { + BonoboObject parent; + GtkMathViewControlData* control_data; +} View; + +typedef struct { + BonoboObjectClass parent_class; + POA_GNOME_GtkMathView_View__epv epv; +} ViewClass; + +GType view_get_type(void); +View* view_new(GtkMathViewControlData*); + +#endif /* __view_h__ */ + diff --git a/helm/DEVEL/gtkmathview-bonobo/test/.cvsignore b/helm/DEVEL/gtkmathview-bonobo/test/.cvsignore new file mode 100644 index 000000000..46490baa4 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/.cvsignore @@ -0,0 +1,5 @@ +.deps +.libs +viewer +Makefile +Makefile.in diff --git a/helm/DEVEL/gtkmathview-bonobo/test/Makefile.am b/helm/DEVEL/gtkmathview-bonobo/test/Makefile.am new file mode 100644 index 000000000..204ae3dfc --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/Makefile.am @@ -0,0 +1,25 @@ + +noinst_PROGRAMS = viewer + +viewer_SOURCES = \ + main.c \ + $(top_srcdir)/src/GtkMathView-common.c \ + $(top_srcdir)/src/GtkMathView-stubs.c + +viewer_LDADD = \ + $(BONOBOUI_LIBS) \ + $(BONOBO_LIBS) \ + $(GNOMEUI_LIBS) + +AM_CFLAGS = \ + -DPREFIX=\""$(prefix)"\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DLIBDIR=\""$(datadir)"\" + +INCLUDES = \ + $(BONOBOUI_CFLAGS) \ + $(BONOBO_CFLAGS) \ + $(GNOMEUI_CFLAGS) \ + -I$(top_srcdir)/src + diff --git a/helm/DEVEL/gtkmathview-bonobo/test/embedding.html b/helm/DEVEL/gtkmathview-bonobo/test/embedding.html new file mode 100644 index 000000000..674012ff4 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/embedding.html @@ -0,0 +1,41 @@ + + + + + + + + + +

GtkMathView-Bonobo test page

+ + The embedded object should display a mathematical formula. +
+ + + + + x + 2 + + = + click for the answer + + + +
+ +
+ + + + + diff --git a/helm/DEVEL/gtkmathview-bonobo/test/embedding.xml b/helm/DEVEL/gtkmathview-bonobo/test/embedding.xml new file mode 100644 index 000000000..57fe49a87 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/embedding.xml @@ -0,0 +1,43 @@ + + + + + + + + + +

GtkMathView-Bonobo test page

+ + The embedded object should display a mathematical formula. +
+ + + + + x + 2 + + = + click for the answer + + + +
+ Size +
+ + + + + diff --git a/helm/DEVEL/gtkmathview-bonobo/test/main.c b/helm/DEVEL/gtkmathview-bonobo/test/main.c new file mode 100644 index 000000000..e737329ec --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/main.c @@ -0,0 +1,476 @@ +#include +#include +#include +#include + +#include "control-factory.h" +#include "GtkMathView.h" + +static GtkWidget *control; + +typedef enum{LOAD_STREAM,LOAD_FILE,NONE}FileSelectionOp; + +struct FileSelectionInfo { + BonoboWidget* control; + GtkWidget* widget; + + FileSelectionOp Operations; +}; + + +static struct FileSelectionInfo file_selection_info = { NULL, NULL,NONE}; + +static void +file_selection_destroy_cb (GtkWidget *widget,gpointer data) +{ + file_selection_info.widget = NULL; +} + + +static void +load_through_persist_file (const gchar *filename, + Bonobo_PersistFile pfile) +{ + CORBA_Environment ev; + CORBA_exception_init (&ev); + Bonobo_PersistFile_load (pfile, filename, &ev); + if (ev._major != CORBA_NO_EXCEPTION) + g_warning ("Cannot load."); + CORBA_exception_free (&ev); +} + +static void +load_through_persist_stream(const gchar *filename, + Bonobo_PersistStream pstream) +{ + BonoboObject *stream = NULL; + CORBA_Environment ev; + CORBA_exception_init (&ev); + +#if 0 + stream = bonobo_stream_open ("fs", filename, + Bonobo_Storage_READ, 0); +#endif + + /*if (stream == NULL) + { + g_warning ("Couldn't load `%s'\n", filename); + } else*/ { + Bonobo_Stream corba_stream; + corba_stream = bonobo_object_corba_objref (stream); + Bonobo_Stream_truncate (corba_stream, 0, &ev); + Bonobo_PersistStream_load (pstream, corba_stream, "application/mathml+xml", &ev); + } + Bonobo_Unknown_unref (pstream, &ev); + CORBA_Object_release (pstream, &ev); + CORBA_exception_free (&ev); +} + +static void +file_selection_ok_cb (GtkWidget *widget, + gpointer data) +{ + CORBA_Object interface; + const gchar *interface_name; + CORBA_Environment ev; + + if (file_selection_info.Operations == LOAD_FILE) + interface_name = "IDL:Bonobo/PersistFile:1.0"; + else if(file_selection_info.Operations == LOAD_STREAM) + interface_name = "IDL:Bonobo/PersistStream:1.0"; + else printf("failed to get operation type\n"); + + CORBA_exception_init (&ev); + interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (file_selection_info.control), + interface_name, &ev); + CORBA_exception_free (&ev); + + if (interface == CORBA_OBJECT_NIL) + { + g_warning ("The Control does not seem to support `%s'.", interface_name); + } + else + { + const gchar *fname; + fname = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection_info.widget)); + switch (file_selection_info.Operations) { + case LOAD_STREAM: + load_through_persist_stream (fname, interface); + break; + case LOAD_FILE: + load_through_persist_file (fname, interface); + break; + } + } + + gtk_widget_destroy (file_selection_info.widget); +} + +static void +open_dialog (BonoboWindow *app, + FileSelectionOp operation) +{ + GtkWidget *widget; + BonoboWidget *control; + + control = BONOBO_WIDGET (bonobo_window_get_contents (app)); + + if (file_selection_info.widget != NULL) { + gdk_window_show (GTK_WIDGET (file_selection_info.widget)->window); + return; + } + + if(operation == LOAD_STREAM) + widget = gtk_file_selection_new(_("Open Stream....")); + if(operation == LOAD_FILE) + widget = gtk_file_selection_new (_("Open file...")); + + gtk_window_set_transient_for (GTK_WINDOW (widget), + GTK_WINDOW (app)); + + file_selection_info.widget = widget; + file_selection_info.control = control; + file_selection_info.Operations = operation; + + g_signal_connect_object (GTK_FILE_SELECTION (widget)->cancel_button, + "clicked", G_CALLBACK (gtk_widget_destroy), widget, G_CONNECT_AFTER); + + g_signal_connect (GTK_FILE_SELECTION (widget)->ok_button, "clicked", G_CALLBACK (file_selection_ok_cb), NULL); + + g_signal_connect (file_selection_info.widget, "destroy", G_CALLBACK (file_selection_destroy_cb), NULL); + + gtk_widget_show (file_selection_info.widget); +} + +/* "Open through persist file" dialog. */ +static void +open_through_persist_file_cb (GtkWidget *widget, + gpointer data) +{ + open_dialog (BONOBO_WINDOW (data), LOAD_FILE); +} + +static void +open_through_persist_stream_cb(GtkWidget *widget, + gpointer data) +{ + open_dialog(BONOBO_WINDOW(data), LOAD_STREAM); +} + +static void +test_view(GtkWidget* widget, gpointer data) +{ + CORBA_Object interface; + CORBA_Environment ev; + + CORBA_exception_init (&ev); + interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (bonobo_window_get_contents (BONOBO_WINDOW(data)))), + "IDL:GNOME/GtkMathView/View:1.0", &ev); + CORBA_exception_free (&ev); + + if (interface == CORBA_OBJECT_NIL) + { + g_warning ("The Control does not seem to support `View'."); + } + + CORBA_exception_init (&ev); + GNOME_GtkMathView_View_freeze(interface, &ev); + CORBA_exception_free (&ev); + + CORBA_exception_init (&ev); + GNOME_GtkMathView_View_thaw(interface, &ev); + CORBA_exception_free (&ev); + + CORBA_exception_init (&ev); + Bonobo_Unknown_unref (interface, &ev); + CORBA_Object_release (interface, &ev); + CORBA_exception_free (&ev); +} + +static void +exit_cb (GtkWidget *widget, + gpointer data) +{ + gtk_widget_destroy (GTK_WIDGET (data)); + bonobo_main_quit (); +} + +static void +get_size(GtkWidget *widget, + gpointer data) +{ + gint width,height; + BonoboWidget* control; + BonoboControlFrame* control_frame; + + Bonobo_PropertyBag prop_bag; + + control = BONOBO_WIDGET (bonobo_window_get_contents (BONOBO_WINDOW (data))); + control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); + prop_bag = bonobo_control_frame_get_control_property_bag(control_frame, NULL); + + width = bonobo_pbclient_get_long(prop_bag,"width",NULL); + height = bonobo_pbclient_get_long(prop_bag,"height",NULL); + + printf("Width: %d Height: %d\n",width,height); + + bonobo_object_release_unref (prop_bag,NULL); + +}; + +static void +get_top(GtkWidget *widget, + gpointer data) +{ + gint top_x,top_y; + BonoboWidget* control; + BonoboControlFrame* control_frame; + Bonobo_PropertyBag prop_bag; + + control = BONOBO_WIDGET(bonobo_window_get_contents(BONOBO_WINDOW(data))); + control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); + prop_bag = bonobo_control_frame_get_control_property_bag(control_frame,NULL); + + top_x = bonobo_pbclient_get_long(prop_bag,"top-x",NULL); + top_y = bonobo_pbclient_get_long(prop_bag,"top-y",NULL); + + printf("Top X: %d ,Top Y: %d\n",top_x,top_y); + + bonobo_object_release_unref(prop_bag,NULL); +} + +static void +get_font_size(GtkWidget *widget, + gpointer data) +{ + gint font_size; + BonoboWidget* control; + BonoboControlFrame* control_frame; + Bonobo_PropertyBag prop_bag; + + control = BONOBO_WIDGET(bonobo_window_get_contents(BONOBO_WINDOW(data))); + control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); + prop_bag = bonobo_control_frame_get_control_property_bag(control_frame,NULL); + + font_size = bonobo_pbclient_get_long(prop_bag,"font-size",NULL); + + printf("FontSize : %d\n",font_size); + + bonobo_object_release_unref(prop_bag,NULL); +} + +static void +get_verbosity(GtkWidget *widget, + gpointer data) +{ + gint verbosity; + BonoboWidget* control; + BonoboControlFrame* control_frame; + Bonobo_PropertyBag prop_bag; + + control = BONOBO_WIDGET(bonobo_window_get_contents(BONOBO_WINDOW(data))); + control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); + prop_bag = bonobo_control_frame_get_control_property_bag(control_frame,NULL); + + verbosity = bonobo_pbclient_get_long(prop_bag,"verbosity",NULL); + + printf("Verbosity: %d\n",verbosity); + + bonobo_object_release_unref(prop_bag,NULL); +} + +static BonoboUIVerb verbs [] = { + BONOBO_UI_UNSAFE_VERB ("OpenFile", open_through_persist_file_cb), + BONOBO_UI_UNSAFE_VERB ("OpenStream", open_through_persist_stream_cb), + BONOBO_UI_UNSAFE_VERB ("TestView", test_view), + BONOBO_UI_UNSAFE_VERB ("Size", get_size), + BONOBO_UI_UNSAFE_VERB ("Top", get_top), + BONOBO_UI_UNSAFE_VERB ("Font Size", get_font_size), + BONOBO_UI_UNSAFE_VERB ("Verbosity", get_verbosity), + BONOBO_UI_UNSAFE_VERB ("FileExit", exit_cb), + BONOBO_UI_VERB_END +}; + +/* A dirty, non-translatable hack */ +static char ui [] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " + +" " + +" " + +" " +" " +" " +" " +" " +""; + +static int +app_delete_cb (GtkWidget *widget, GdkEvent *event, gpointer dummy) +{ + gtk_widget_destroy (GTK_WIDGET (widget)); + bonobo_main_quit (); + + return FALSE; +} + +static guint +container_create (void) +{ + GtkWidget *win; + GtkWindow *window; + BonoboUIComponent *component; + BonoboUIContainer *container; + CORBA_Environment ev; + + + win = bonobo_window_new ("test-editor", + "GtkMathView Control Test"); + window = GTK_WINDOW (win); + + container = bonobo_window_get_ui_container (BONOBO_WINDOW (win)); + + g_signal_connect (window, "delete_event", G_CALLBACK (app_delete_cb), NULL); + + gtk_window_set_default_size (window, 600, 440); + gtk_window_set_resizable (window, TRUE); + + component = bonobo_ui_component_new ("test"); + bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (component)); + + bonobo_ui_component_set_container (component, BONOBO_OBJREF (container), NULL); + bonobo_ui_component_add_verb_list_with_data (component, verbs, win); + bonobo_ui_component_set_translate (component, "/", ui, NULL); + + control = bonobo_widget_new_control (CONTROL_ID, BONOBO_OBJREF (container)); + + if (control == NULL) + g_error ("Cannot get `%s'.", CONTROL_ID); + + bonobo_window_set_contents (BONOBO_WINDOW (win), control); + + gtk_widget_show_all (GTK_WIDGET (window)); + + CORBA_exception_init (&ev); + + return FALSE; +} + +static gint +load_file (const gchar *fname) +{ + CORBA_Object interface; + CORBA_Environment ev; + + printf ("loading: %s\n", fname); + CORBA_exception_init (&ev); + interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (control)), + "IDL:Bonobo/PersistFile:1.0", &ev); + CORBA_exception_free (&ev); + load_through_persist_file (fname, interface); + + return FALSE; +} + +static gint +load_file_stream(const gchar *fname) +{ + CORBA_Object interface; + CORBA_Environment ev; + + printf("loading with stream %s\n",fname); + CORBA_exception_init(&ev); + interface = Bonobo_Unknown_queryInterface(bonobo_widget_get_objref(BONOBO_WIDGET(control)), + "IDL:Bonobo/PersistStream:1.0",&ev); + + CORBA_exception_free(&ev); + load_through_persist_stream(fname,interface); + + return FALSE; +} + +/* +static void +install_property_bag_listener (BonoboWidget *control, BonoboWindow *bonobo_win) +{ + Bonobo_Listener corba_listener; + BonoboListener *listener; + BonoboControlFrame *control_frame; + CORBA_Environment ev; + Bonobo_PropertyBag prop_bag; + + CORBA_exception_init(&ev); + + control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); + if(!control_frame) + g_error("can't find control frame\n"); + + prop_bag = bonobo_control_frame_get_control_property_bag(control_frame, NULL); + if(prop_bag == CORBA_OBJECT_NIL) + g_error("can't connect to property bag\n"); + + //connect a listener to the property bag + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn) width_changed, + "Bonobo/Property:change:width",NULL,bonobo_win); + + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)height_changed, + "Bonobo/Property:change:height",NULL,bonobo_win); + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)top_x_changed, + "Bonobo/Property:change:top-x",NULL,bonobo_win); + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)top_y_changed, + "Bonobo/Property:change:top-y",NULL,bonobo_win); + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)font_size_changed, + "Bonobo/Property:change:font-size",NULL,bonobo_win); + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)anti_aliasing_changed, + "Bonobo/Property:change:verbosity",NULL,bonobo_win); + bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)font_manager_changed, + "Bonobo/Property:change:font_manager",NULL,bonobo_win); + CORBA_exception_free(&ev); +}*/ + + +int +main (int argc, char **argv) +{ + gnome_program_init("test-editor", VERSION, LIBGNOMEUI_MODULE, argc, argv, + GNOME_PROGRAM_STANDARD_PROPERTIES, + GNOME_PARAM_HUMAN_READABLE_NAME, _("GtkMathView Test Container"), + NULL); + + bonobo_activate (); + + /* We can't make any CORBA calls unless we're in the main loop. So we + delay creating the container here. */ + gtk_idle_add ((GtkFunction) container_create, NULL); + if (argc > 1 && *argv [argc - 1] != '-') + gtk_idle_add ((GtkFunction) load_file, argv [argc - 1]); + + bonobo_activate (); + bonobo_main (); + + return bonobo_ui_debug_shutdown (); +} diff --git a/helm/DEVEL/gtkmathview-bonobo/test/test.mml b/helm/DEVEL/gtkmathview-bonobo/test/test.mml new file mode 100644 index 000000000..2436838bf --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/test.mml @@ -0,0 +1,128 @@ + + + + + + + + + a + + x + + + + b + + + + x + 2 + + + + + p + + x + + + + q + + + + ... + + d + x + = + + + a2 + + + ln + + + ( + + x2 + + + + p + + x + + + + q + + ) + + + + + + + + + + 2 + + b + + - + + a + + p + + + + + + 4 + + q + + - + + p + 2 + + + + + + + arctg + + + + + 2 + + x + + + + p + + + + + 4 + + q + + - + + p + 2 + + + + + + + + + c + + + go to Luca's home page + diff --git a/helm/DEVEL/gtkmathview-bonobo/test/testembedding.html b/helm/DEVEL/gtkmathview-bonobo/test/testembedding.html new file mode 100644 index 000000000..e894388d6 --- /dev/null +++ b/helm/DEVEL/gtkmathview-bonobo/test/testembedding.html @@ -0,0 +1,17 @@ + + + + + + +

GtkMathView-Bonobo test page

+ +The embedded object should display a mathematical formula. +
+
+ +No viewer capable of displaying the test document installed. + + + + diff --git a/helm/annotationHelper/.cvsignore b/helm/annotationHelper/.cvsignore deleted file mode 100644 index b79ea367a..000000000 --- a/helm/annotationHelper/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.cm[iox] *.o cicAnnotationHelper cicAnnotationHelper.opt diff --git a/helm/annotationHelper/.depend b/helm/annotationHelper/.depend deleted file mode 100644 index 699b8de3a..000000000 --- a/helm/annotationHelper/.depend +++ /dev/null @@ -1,4 +0,0 @@ -cicAnnotationHinter.cmo: cicAnnotationHinter.cmi -cicAnnotationHinter.cmx: cicAnnotationHinter.cmi -cicAnnotationHelper.cmo: cicAnnotationHinter.cmi -cicAnnotationHelper.cmx: cicAnnotationHinter.cmx diff --git a/helm/annotationHelper/Makefile b/helm/annotationHelper/Makefile deleted file mode 100644 index 272ac3eba..000000000 --- a/helm/annotationHelper/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -BIN_DIR = /usr/local/bin -REQUIRES = lablgtkmathview helm-cic_annotations_cache -PREDICATES = -OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS) -OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS) -OCAMLDEP = ocamldep - -LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) -LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) - -all: cicAnnotationHelper -opt: cicAnnotationHelper.opt - -DEPOBJS = cicAnnotationHinter.mli cicAnnotationHinter.ml cicAnnotationHelper.ml - -CICANNOTATIONHELPEROBJS = cicAnnotationHinter.cmo cicAnnotationHelper.cmo - -depend: - $(OCAMLDEP) $(DEPOBJS) > .depend - -cicAnnotationHelper: $(CICANNOTATIONHELPEROBJS) $(LIBRARIES) - $(OCAMLC) -linkpkg -o cicAnnotationHelper $(CICANNOTATIONHELPEROBJS) - -cicAnnotationHelper.opt: $(CICANNOTATIONHELPEROBJS:.cmo=.cmx) $(LIBRARIES_OPT) - $(OCAMLOPT) -linkpkg -o cicAnnotationHelper.opt $(CICANNOTATIONHELPEROBJS:.cmo=.cmx) - -.SUFFIXES: .ml .mli .cmo .cmi .cmx -.ml.cmo: $(LIBRARIES) - $(OCAMLC) -c $< -.mli.cmi: $(LIBRARIES) - $(OCAMLC) -c $< -.ml.cmx: $(LIBRARIES_OPT) - $(OCAMLOPT) -c $< - -clean: - rm -f *.cm[iox] *.o cicAnnotationHelper cicAnnotationHelper.opt - -install: - cp cicAnnotationHelper cicAnnotationHelper.opt $(BIN_DIR) - -uninstall: - rm -f $(BIN_DIR)/cicAnnotationHelper $(BIN_DIR)/cicAnnotationHelper.opt - -.PHONY: install uninstall clean - -include .depend diff --git a/helm/annotationHelper/cicAnnotationHelper.ml b/helm/annotationHelper/cicAnnotationHelper.ml deleted file mode 100644 index 5ed1fa26d..000000000 --- a/helm/annotationHelper/cicAnnotationHelper.ml +++ /dev/null @@ -1,594 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM 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. - * - * HELM 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. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 03/04/2001 *) -(* *) -(* This is a simple gtk interface to the Coq-like pretty printer cicPp for *) -(* cic terms exported in xml. It uses directly the modules cicPp and *) -(* cicCcache and indirectly all the other modules (cicParser, cicParser2, *) -(* cicParser3, getter). *) -(* The syntax is "gtkInterface[.opt] filename1 ... filenamen" where *) -(* filenamei is the path-name of an xml file describing a cic term. *) -(* The terms are loaded in cache and then pretty-printed one at a time and *) -(* only once, when the user wants to look at it: if the user wants to look at *) -(* a term again, then the pretty-printed term is showed again, but not *) -(* recomputed *) -(* *) -(******************************************************************************) - -(* GLOBAL REFERENCES (USED BY CALLBACKS) *) - -let annotated_obj = ref None;; (* reference to a triple option where *) - (* the first component is the current *) - (* annotated object, the second is the *) - (* map from ids to annotated targets and *) - (* the third is the map from ids to *) - (* annotations. *) -let current_id = ref None;; (* id of the element to annotate *) -let radio_some_status = ref false;; (* is the radio_some button selected? *) -let current_url = ref "";; - -(* GLOBAL CONSTANTS *) - -let helmns = Gdome.domString "http://www.cs.unibo.it/helm";; - -(* MISC FUNCTIONS *) - -let pathname_of_annuri uristring = - Configuration.annotations_dir ^ - Str.replace_first (Str.regexp "^cic:") "" uristring -;; - -let make_dirs dirpath = - ignore (Unix.system ("mkdir -p " ^ dirpath)) -;; - -module UrlManipulator = - struct - exception No_param_dot_CICURI_or_param_dot_annotations_found_in of string;; - exception No_param_found_in of string * string;; - exception Bad_formed_url of string;; - - let uri_from_url url = - let module N = Neturl in - let founduri = ref None in - let foundann = ref None in - let rec find_uri = - function - [] -> raise (No_param_dot_CICURI_or_param_dot_annotations_found_in url) - | he::tl -> - match Str.split (Str.regexp "=") he with - ["param.CICURI";uri] -> - if !founduri <> None then - raise (Bad_formed_url url) - else - begin - founduri := Some uri ; - if !foundann = None then - find_uri tl - end - | ["param.annotations";ann] -> - if !foundann <> None then - raise (Bad_formed_url url) - else - begin - foundann := - Some - (match ann with - "yes" -> ".ann" - | "no" -> "" - | _ -> raise (Bad_formed_url url) - ) ; - if !founduri = None then - find_uri tl - end - | _ -> find_uri tl - in - find_uri - (Str.split (Str.regexp "&") - (N.url_query ~encoded:true (N.url_of_string N.ip_url_syntax url))) ; - match !founduri,!foundann with - (Some uri),(Some ann) -> uri ^ ann - | _ , _ -> - raise (No_param_dot_CICURI_or_param_dot_annotations_found_in url) - ;; - - let extractParam param url = - let module N = Neturl in - let rec find_param = - function - [] -> raise (No_param_found_in (param,url)) - | he::tl -> - match Str.split (Str.regexp "=") he with - [name;value] when name = param -> value - | _ -> find_param tl - in - find_param - (Str.split (Str.regexp "&") - (N.url_query ~encoded:true (N.url_of_string N.ip_url_syntax url))) - ;; - - let set_annotations_to_yes query url = - let found =ref false in - let rec aux = - function - [] -> - if !found then "" - else raise (No_param_found_in ("param.annotations",url)) - | he::tl -> - match Str.split (Str.regexp "=") he with - ["param.annotations" as s ; ann] -> - found := true ; - let auxtl = aux tl in - s ^ "=yes" ^ - (if auxtl = "" then "" else "&" ^ auxtl) - | [name ; value] -> - let auxtl = aux tl in - name ^ "=" ^ value ^ - (if auxtl = "" then "" else "&" ^ auxtl) - | [name] -> - let auxtl = aux tl in - name ^ "=" ^ - (if auxtl = "" then "" else "&" ^ auxtl) - | _ -> raise (Bad_formed_url url) - in - aux (Str.split (Str.regexp "&") query) - ;; - - let annurl_of_url url = - let module N = Neturl in - let nurl = N.url_of_string N.ip_url_syntax url in - let query = N.url_query ~encoded:true nurl in - let newquery = set_annotations_to_yes query url in - N.string_of_url (N.modify_url ~encoded:true ~query:newquery nurl) - ;; -end - -let get_current_uri () = - UriManager.uri_of_string (UrlManipulator.uri_from_url !current_url) -;; - -(* CALLBACKS *) - -let get_annotated_obj () = - match !annotated_obj with - None -> - let annobj = - let (annobj,ids_to_annotations) = - match CicCache.get_annobj (get_current_uri ()) with - (annobj,None) -> annobj, Hashtbl.create 503 - | (annobj, Some ids_to_annotations) -> (annobj,ids_to_annotations) - in - let ids_to_targets = CicXPath.get_ids_to_targets annobj in - (annobj,ids_to_targets,ids_to_annotations) - in - annotated_obj := Some annobj ; - annobj - | Some annobj -> annobj -;; - -let update_output rendering_window url = - rendering_window#label#set_text (UrlManipulator.uri_from_url url) ; - rendering_window#output#load url -;; - -let choose_selection rendering_window (element : Gdome.element option) = - let module G = Gdome in - let rec aux element = - if element#hasAttributeNS - ~namespaceURI:helmns - ~localName:(G.domString "xref") - then - rendering_window#output#set_selection (Some element) - else - match element#get_parentNode with - None -> assert false - (*CSC: OCAML DIVERGES! - | Some p -> aux (new G.element_of_node p) - *) - | Some p -> aux (new Gdome.element_of_node p) - in - match element with - Some x -> aux x - | None -> rendering_window#output#set_selection None -;; - -let annotateb_pressed rendering_window annotation_window () = - let module G = Gdome in - match rendering_window#output#get_selection with - Some element -> - let xpath = - ((element : Gdome.element)#getAttributeNS - (*CSC: OCAML DIVERGE - ((element : G.element)#getAttributeNS - *) - ~namespaceURI:helmns - ~localName:(G.domString "xref"))#to_string - in - if xpath = "" then - rendering_window#label#set_text ("ERROR: No xref found!!!\n") - else - let annobj = get_annotated_obj () in - let (anno, ids_to_targets, ids_to_annotations) = annobj in - let annotation = (annotation_window#annotation : GEdit.text) in - let id = xpath in - current_id := Some id ; - let ann = CicXPath.get_annotation ids_to_annotations id in - CicAnnotationHinter.create_hints annotation_window ids_to_targets - xpath ; - annotation#delete_text 0 annotation#length ; - begin - match ann with - None -> - annotation#misc#set_sensitive false ; - annotation_window#radio_none#set_active true ; - radio_some_status := false - | Some ann' -> - annotation#insert ann' ; - annotation#misc#set_sensitive true ; - annotation_window#radio_some#set_active true ; - radio_some_status := true - end ; - GMain.Grab.add (annotation_window#window_to_annotate#coerce) ; - annotation_window#show () ; - | None -> rendering_window#label#set_text ("ERROR: No selection!!!\n") -;; - -let change_annotation ids_to_annotations id ann = - begin - try - Hashtbl.remove ids_to_annotations id - with - Not_found -> () - end ; - match ann with - None -> () - | Some ann' -> Hashtbl.add ids_to_annotations id ann' -;; - -(* called when the annotation is confirmed *) -let save_annotation (annotation : GEdit.text) = - let module S = Str in - let module U = UriManager in - let (annobj,ids_to_annotations) = - match !annotated_obj with - None -> assert false - | Some (annobj,_,ids_to_annotations) -> annobj,ids_to_annotations - in - change_annotation ids_to_annotations - (match !current_id with - Some id -> id - | None -> assert false - ) - (if !radio_some_status then - Some (annotation#get_chars 0 annotation#length) - else - None - ) ; - let uri = get_current_uri () in - let annxml = - CicAnnotation2Xml.pp_annotation annobj ids_to_annotations uri - in - make_dirs - (pathname_of_annuri (U.buri_of_uri uri)) ; - Xml.pp ~quiet:true annxml - (Some - (pathname_of_annuri (U.string_of_uri (U.annuri_of_uri uri)) ^ - ".xml" - ) - ) -;; - -(* STUFF TO BUILD THE GTK INTERFACE *) - -(* Stuff for the widget settings *) - -let export_to_postscript (output : GMathView.math_view) () = - output#export_to_postscript ~filename:"output.ps" (); -;; - -let activate_t1 (output : GMathView.math_view) - button_set_anti_aliasing button_set_kerning - button_set_transparency button_export_to_postscript button_t1 () -= - let is_set = button_t1#active in - output#set_font_manager_type - (if is_set then `font_manager_t1 else `font_manager_gtk) ; - if is_set then - begin - button_set_anti_aliasing#misc#set_sensitive true ; - button_set_kerning#misc#set_sensitive true ; - button_set_transparency#misc#set_sensitive true ; - button_export_to_postscript#misc#set_sensitive true ; - end - else - begin - button_set_anti_aliasing#misc#set_sensitive false ; - button_set_kerning#misc#set_sensitive false ; - button_set_transparency#misc#set_sensitive false ; - button_export_to_postscript#misc#set_sensitive false ; - end -;; - -let set_anti_aliasing output button_set_anti_aliasing () = - output#set_anti_aliasing button_set_anti_aliasing#active -;; - -let set_kerning output button_set_kerning () = - output#set_kerning button_set_kerning#active -;; - -let set_transparency output button_set_transparency () = - output#set_transparency button_set_transparency#active -;; - -let changefont output font_size_spinb () = - output#set_font_size font_size_spinb#value_as_int -;; - -let set_log_verbosity output log_verbosity_spinb () = - output#set_log_verbosity log_verbosity_spinb#value_as_int -;; - -class settings_window (output : GMathView.math_view) - sw button_export_to_postscript selection_changed_callback -= - let settings_window = GWindow.window ~title:"GtkMathView settings" () in - let vbox = - GPack.vbox ~packing:settings_window#add () in - let table = - GPack.table - ~rows:1 ~columns:3 ~homogeneous:false ~row_spacings:5 ~col_spacings:5 - ~border_width:5 ~packing:vbox#add () in - let button_t1 = - GButton.toggle_button ~label:"activate t1 fonts" - ~packing:(table#attach ~left:0 ~top:0) () in - let button_set_anti_aliasing = - GButton.toggle_button ~label:"set_anti_aliasing" - ~packing:(table#attach ~left:0 ~top:1) () in - let button_set_kerning = - GButton.toggle_button ~label:"set_kerning" - ~packing:(table#attach ~left:1 ~top:1) () in - let button_set_transparency = - GButton.toggle_button ~label:"set_transparency" - ~packing:(table#attach ~left:2 ~top:1) () in - let table = - GPack.table - ~rows:2 ~columns:2 ~homogeneous:false ~row_spacings:5 ~col_spacings:5 - ~border_width:5 ~packing:vbox#add () in - let font_size_label = - GMisc.label ~text:"font size:" - ~packing:(table#attach ~left:0 ~top:0 ~expand:`NONE) () in - let font_size_spinb = - let sadj = - GData.adjustment ~value:14.0 ~lower:5.0 ~upper:50.0 ~step_incr:1.0 () - in - GEdit.spin_button - ~adjustment:sadj ~packing:(table#attach ~left:1 ~top:0 ~fill:`NONE) () in - let log_verbosity_label = - GMisc.label ~text:"log verbosity:" - ~packing:(table#attach ~left:0 ~top:1) () in - let log_verbosity_spinb = - let sadj = - GData.adjustment ~value:0.0 ~lower:0.0 ~upper:3.0 ~step_incr:1.0 () - in - GEdit.spin_button - ~adjustment:sadj ~packing:(table#attach ~left:1 ~top:1) () in - let hbox = - GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in - let closeb = - GButton.button ~label:"Close" - ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in -object(self) - method show = settings_window#show - initializer - button_set_anti_aliasing#misc#set_sensitive false ; - button_set_kerning#misc#set_sensitive false ; - button_set_transparency#misc#set_sensitive false ; - (* Signals connection *) - ignore(button_t1#connect#clicked - ~callback:(activate_t1 output button_set_anti_aliasing button_set_kerning - button_set_transparency button_export_to_postscript button_t1)) ; - ignore(font_size_spinb#connect#changed (changefont output font_size_spinb)) ; - ignore(button_set_anti_aliasing#connect#toggled - (set_anti_aliasing output button_set_anti_aliasing)); - ignore(button_set_kerning#connect#toggled - (set_kerning output button_set_kerning)) ; - ignore(button_set_transparency#connect#toggled - (set_transparency output button_set_transparency)) ; - ignore(log_verbosity_spinb#connect#changed - (set_log_verbosity output log_verbosity_spinb)) ; - ignore(closeb#connect#clicked ~callback:settings_window#misc#hide) -end;; - -(* Main windows *) - -class annotation_window output label = - let window_to_annotate = - GWindow.window ~title:"Annotating environment" ~border_width:2 () in - let hbox1 = - GPack.hbox ~packing:window_to_annotate#add () in - let vbox1 = - GPack.vbox ~packing:(hbox1#pack ~padding:5) () in - let hbox2 = - GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in - let radio_some = GButton.radio_button ~label:"Annotation below" - ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) () in - let radio_none = GButton.radio_button ~label:"No annotation" - ~group:radio_some#group - ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) - ~active:true () in - let annotation = GEdit.text ~editable:true ~width:400 ~height:180 - ~packing:(vbox1#pack ~padding:5) () in - let table = - GPack.table ~rows:3 ~columns:3 ~packing:(vbox1#pack ~padding:5) () in - let annotation_hints = - Array.init 9 - (function i -> - GButton.button ~label:("Hint " ^ string_of_int i) - ~packing:(table#attach ~left:(i mod 3) ~top:(i / 3)) () - ) in - let vbox2 = - GPack.vbox ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in - let confirmb = - GButton.button ~label:"O.K." - ~packing:(vbox2#pack ~expand:false ~fill:false ~padding:5) () in - let abortb = - GButton.button ~label:"Abort" - ~packing:(vbox2#pack ~expand:false ~fill:false ~padding:5) () in -object (self) - method window_to_annotate = window_to_annotate - method annotation = annotation - method radio_some = radio_some - method radio_none = radio_none - method annotation_hints = annotation_hints - method output = (output : GMathView.math_view) - method show () = window_to_annotate#show () - initializer - (* signal handlers here *) - ignore (window_to_annotate#event#connect#delete - (fun _ -> - window_to_annotate#misc#hide () ; - GMain.Grab.remove (window_to_annotate#coerce) ; - true - )) ; - ignore (confirmb#connect#clicked - ~callback:(fun () -> - window_to_annotate#misc#hide () ; - save_annotation annotation ; - GMain.Grab.remove (window_to_annotate#coerce) ; - let new_current_uri = UriManager.annuri_of_uri (get_current_uri ()) in - Getter.register new_current_uri - (Configuration.annotations_url ^ - Str.replace_first (Str.regexp "^cic:") "" - (UriManager.string_of_uri new_current_uri) ^ ".xml" - ) ; - let new_current_url = UrlManipulator.annurl_of_url !current_url in - current_url := new_current_url ; - label#set_text (UriManager.string_of_uri new_current_uri) ; - output#load new_current_url - )) ; - ignore (abortb#connect#clicked - ~callback:(fun () -> - window_to_annotate#misc#hide () ; - GMain.Grab.remove (window_to_annotate#coerce) - )); - ignore (radio_some#connect#clicked - ~callback:(fun () -> annotation#misc#set_sensitive true ; radio_some_status := true)) ; - ignore (radio_none #connect#clicked - ~callback:(fun () -> - annotation#misc#set_sensitive false; - radio_some_status := false) - ) -end;; - -class rendering_window annotation_window output (label : GMisc.label) = - let window = - GWindow.window ~title:"MathML viewer" ~border_width:2 () in - let vbox = - GPack.vbox ~packing:window#add () in - let _ = vbox#pack ~expand:false ~fill:false ~padding:5 label#coerce in - let scrolled_window0 = - GBin.scrolled_window ~border_width:10 - ~packing:(vbox#pack ~expand:true ~padding:5) () in - let _ = scrolled_window0#add output#coerce in - let hbox = - GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in - let annotateb = - GButton.button ~label:"Annotate" - ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in - let settingsb = - GButton.button ~label:"Settings" - ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in - let button_export_to_postscript = - GButton.button ~label:"export_to_postscript" - ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in - let closeb = - GButton.button ~label:"Close" - ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in -object(self) - method label = label - method output = (output : GMathView.math_view) - method show () = window#show () - initializer - button_export_to_postscript#misc#set_sensitive false ; - - (* signal handlers here *) - ignore(output#connect#selection_changed (choose_selection self)) ; - ignore(closeb#connect#clicked ~callback:(fun _ -> GMain.Main.quit ())) ; - ignore(annotateb#connect#clicked - ~callback:(annotateb_pressed self annotation_window)) ; - let settings_window = new settings_window output scrolled_window0 - button_export_to_postscript (choose_selection self) in - ignore(settingsb#connect#clicked ~callback:settings_window#show) ; - ignore(button_export_to_postscript#connect#clicked ~callback:(export_to_postscript output)) ; - ignore(window#event#connect#delete (fun _ -> GMain.Main.quit () ; true )) -end;; - -(* MAIN *) - -let initialize_everything tmpfile url = - let module U = Unix in - let output = GMathView.math_view ~width:400 ~height:380 () - and label = GMisc.label ~text:"???" () in - let annotation_window = new annotation_window output label in - let rendering_window = - new rendering_window annotation_window output label - in - rendering_window#show () ; - rendering_window#label#set_text (UrlManipulator.uri_from_url url) ; - rendering_window#output#load tmpfile ; - GMain.Main.main () -;; - -let _ = - let filename = ref "" in - let usage_msg = - "\nusage: annotationHelper[.opt] file url\n\n List of options:" - in - Arg.parse [] - (fun x -> - if x = "" then raise (Arg.Bad "Empty filename or URL not allowed") ; - if !filename = "" then - filename := x - else if !current_url = "" then - current_url := x - else - begin - prerr_string "More than two arguments provided\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - ) usage_msg ; - Getter.getter_url := - Netencoding.Url.decode - (UrlManipulator.extractParam "param.getterURL" !current_url) ; - initialize_everything !filename !current_url -;; diff --git a/helm/annotationHelper/cicAnnotationHinter.ml b/helm/annotationHelper/cicAnnotationHinter.ml deleted file mode 100644 index 7cf3cddbb..000000000 --- a/helm/annotationHelper/cicAnnotationHinter.ml +++ /dev/null @@ -1,393 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM 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. - * - * HELM 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. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 14/06/2000 *) -(* *) -(* *) -(******************************************************************************) - -let deactivate_hints_from annotation_window n = - let annotation_hints = annotation_window#annotation_hints in - for i = n to Array.length annotation_hints - 1 do - annotation_hints.(i)#misc#hide () - done -;; - -(* CSC: orripilante *) -(* the list of the signal ids *) -let sig_ids = ref ([] : GtkSignal.id list);; - -let disconnect_hint annotation_window buttonno = - match !sig_ids with - id::ids -> - annotation_window#annotation_hints.(buttonno)#misc#disconnect id ; - sig_ids := ids - | _ -> assert false -;; - -(* link_hint annotation_window n label hint *) -(* set the label of the nth hint button of annotation_window to label *) -(* and the correspondent hint to hint *) -let link_hint annotation_window buttonno label hint = - let button = annotation_window#annotation_hints.(buttonno) in - sig_ids := - (button#connect#clicked - ~callback:(fun () -> (annotation_window#annotation : GEdit.text)#insert hint) - ) :: !sig_ids ; - button#misc#show () ; - match button#children with - [labelw] -> (GMisc.label_cast labelw)#set_text label - | _ -> assert false -;; - -exception TooManyHints;; - -let link_hints annotation_window a = - if Array.length a > Array.length annotation_window#annotation_hints then - raise TooManyHints ; - for i = List.length !sig_ids - 1 downto 0 do - disconnect_hint annotation_window i - done ; - Array.iteri - (fun i (label,hint) -> link_hint annotation_window i label hint) a ; - deactivate_hints_from annotation_window (Array.length a) -;; - -let list_mapi f = - let rec aux n = - function - [] -> [] - | he::tl -> (f n he)::(aux (n + 1) tl) - in - aux 0 -;; - -let get_id annterm = - let module C = Cic in - match annterm with - C.ARel (id,_,_) - | C.AVar (id,_) - | C.AMeta (id,_,_) - | C.ASort (id,_) - | C.AImplicit id - | C.ACast (id,_,_) - | C.AProd (id,_,_,_) - | C.ALambda (id,_,_,_) - | C.ALetIn (id,_,_,_) - | C.AAppl (id,_) - | C.AConst (id,_,_) - | C.AMutInd (id,_,_,_) - | C.AMutConstruct (id,_,_,_,_) - | C.AMutCase (id,_,_,_,_,_,_) - | C.AFix (id,_,_) - | C.ACoFix (id,_,_) -> id -;; - -let create_hint_from_term annotation_window annterm = - let module C = Cic in - match annterm with - C.ARel (id,_,_) -> - link_hints annotation_window - [| "Binder", "" |] - | C.AVar (id,_) -> - link_hints annotation_window - [| "relURI???", "" |] - | C.AMeta (id,_,subst) -> - let res = - Array.append - [| "Number", "" |] - (Array.mapi - (fun i s -> - match s with - None -> - "Argument " ^ string_of_int i, "_" - | Some t -> - "Argument " ^ string_of_int i, "" - ) (Array.of_list subst) - ) - in - link_hints annotation_window res - | C.ASort (id,_) -> - link_hints annotation_window - [| "Value", "" |] - | C.AImplicit id -> - link_hints annotation_window [| |] - | C.ACast (id,bo,ty) -> - let boid = get_id bo - and tyid = get_id ty in - link_hints annotation_window - [| "Body", "" ; - "Type", "" - |] - | C.AProd (id,_,ty,bo) -> - let boid = get_id bo - and tyid = get_id ty in - link_hints annotation_window - [| "Binder", - "" ; - "Body", "" ; - "Type", "" - |] - | C.ALambda (id,_,ty,bo) -> - let boid = get_id bo - and tyid = get_id ty in - link_hints annotation_window - [| "Binder", - "" ; - "Body", "" ; - "Type", "" - |] - | C.ALetIn (id,_,ty,bo) -> - let boid = get_id bo - and tyid = get_id ty in - link_hints annotation_window - [| "Binder", - "" ; - "Term", "" ; - "Target", "" - |] - | C.AAppl (id,args) -> - let argsid = - Array.mapi - (fun i te -> "Argument " ^ string_of_int i, "") - (Array.of_list args) - in - link_hints annotation_window argsid - | C.AConst (id,_,_) -> - link_hints annotation_window - [| "Uri???", "" |] - | C.AMutInd (id,_,_,_) -> - link_hints annotation_window - [| "Uri???", "" |] - | C.AMutConstruct (id,_,_,_,_) -> - link_hints annotation_window - [| "Uri???", "" |] - | C.AMutCase (id,_,_,_,outty,te,pl) -> - let outtyid = get_id outty - and teid = get_id te - and plid = - Array.mapi - (fun i te -> "Pattern " ^ string_of_int i, "") - (Array.of_list pl) - in - link_hints annotation_window - (Array.append - [| "Uri???", "" ; - "Case Type", "" ; - "Term", "" ; - |] - plid) - | C.AFix (id,_,funl) -> - let funtylid = - Array.mapi - (fun i (_,_,ty,_) -> - "Type " ^ string_of_int i, "") - (Array.of_list funl) - and funbolid = - Array.mapi - (fun i (_,_,_,bo) -> - "Body " ^ string_of_int i, "") - (Array.of_list funl) - and funnamel = - Array.mapi - (fun i (_,_,_,_) -> - "Name " ^ string_of_int i, "") - (Array.of_list funl) - and funrecindexl = - Array.mapi - (fun i (_,_,_,_) -> - "Recursive Index??? " ^ string_of_int i, "") - (Array.of_list funl) - in - link_hints annotation_window - (Array.concat - [ funtylid ; - funbolid ; - funnamel ; - funrecindexl ; - [| "NoFun???", "" |] - ] - ) - | C.ACoFix (id,_,funl) -> - let funtylid = - Array.mapi - (fun i (_,ty,_) -> - "Type " ^ string_of_int i, "") - (Array.of_list funl) - and funbolid = - Array.mapi - (fun i (_,_,bo) -> - "Body " ^ string_of_int i, "") - (Array.of_list funl) - and funnamel = - Array.mapi - (fun i (_,_,_) -> - "Name " ^ string_of_int i, "") - (Array.of_list funl) - in - link_hints annotation_window - (Array.concat - [ funtylid ; - funbolid ; - funnamel ; - [| "NoFun???", "" |] - ] - ) -;; - -(*CSC: da riscrivere completamente eliminando il paciugo degli array - liste *) -let create_hint_from_obj annotation_window annobj = - let module C = Cic in - match annobj with - C.ADefinition (id,_,bo,ty,_) -> - let boid = get_id bo - and tyid = get_id ty in - link_hints annotation_window - [| "Name", "" ; - "Ingredients", "" ; - "Body", "" ; - "Type", "" - |] - | C.AAxiom (id,_,ty,_) -> - let tyid = get_id ty in - link_hints annotation_window - [| "Name", "" ; - "Ingredients", "" ; - "Type", "" - |] - | C.AVariable (id,_,bo,ty) -> - let tyid = get_id ty in - link_hints annotation_window - (match bo with - None -> - [| "Name", "" ; - "Type", "" - |] - | Some bo -> - let boid = get_id bo in - [| "Name", "" ; - "Body", "" ; - "Type", "" - |] - ) - | C.ACurrentProof (id,_,conjs,bo,ty) -> - let boid = get_id bo - and tyid = get_id ty - and conjsid = List.map (fun (id,_,_,_) -> id) conjs in - link_hints annotation_window -(*CSC: never tested since the introduction of the new Metas *) - (Array.append - [| "Name", "" ; - "Ingredients", "" ; - "Body", "" ; - "Type", "" - |] - (Array.mapi - (fun i id -> - "Conjecture " ^ string_of_int i, "" - ) (Array.of_list conjsid) - ) - ) - | C.AInductiveDefinition (id,itl,_,_) -> - let itlids = - List.map - (fun (_,_,arity,cons) -> - get_id arity, - List.map (fun (_,ty,_) -> get_id ty) cons - ) itl - in - link_hints annotation_window - (Array.concat - [ - [| "Ingredients","" |]; - (Array.mapi - (fun i _ -> - "Type Name " ^ string_of_int i, - "" - ) (Array.of_list itlids) - ) ; - (Array.mapi - (fun i (id,_) -> - "Type " ^ string_of_int i, "" - ) (Array.of_list itlids) - ) ; - (Array.concat - (list_mapi - (fun i (_,consid) -> - (Array.mapi - (fun j _ -> - "Constructor Name " ^ string_of_int i ^ " " ^ string_of_int j, - "" - ) (Array.of_list consid) - ) ; - ) itlids - ) - ) ; - (Array.concat - (list_mapi - (fun i (_,consid) -> - (Array.mapi - (fun j id -> - "Constructor " ^ string_of_int i ^ " " ^ string_of_int j, - "" - ) (Array.of_list consid) - ) ; - ) itlids - ) - ) - ] - ) -;; - -exception IdUnknown of string;; - -let create_hints annotation_window ids_to_targets xpath = - try - match Hashtbl.find ids_to_targets xpath with - Cic.Object annobj -> create_hint_from_obj annotation_window annobj - | Cic.Term annterm -> create_hint_from_term annotation_window annterm -(*CSC: never tested since the introduction of the new Metas *) - | Cic.Hypothesis _ - | Cic.Conjecture _ -> assert false - with - Not_found -> raise (IdUnknown xpath) -;; diff --git a/helm/annotationHelper/cicAnnotationHinter.mli b/helm/annotationHelper/cicAnnotationHinter.mli deleted file mode 100644 index 8cfc04c22..000000000 --- a/helm/annotationHelper/cicAnnotationHinter.mli +++ /dev/null @@ -1,46 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM 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. - * - * HELM 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. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 29/11/2000 *) -(* *) -(* *) -(******************************************************************************) - -val create_hints : - < annotation : GEdit.text; - annotation_hints : < children : < as_widget : 'a Gtk.obj; .. > list; - connect : < clicked : callback:(unit -> unit) -> GtkSignal.id; - .. >; - misc : < disconnect : GtkSignal.id -> 'b; - hide : unit -> 'c; show : unit -> 'd; .. >; - .. > - array; - .. > -> - (Cic.id, Cic.anntarget) Hashtbl.t -> string -> unit diff --git a/helm/cgi/mkcontrol.pl b/helm/cgi/mkcontrol.pl deleted file mode 100755 index e314aa778..000000000 --- a/helm/cgi/mkcontrol.pl +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/perl - -# First of all, let's load HELM configuration -use Env; -my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"}; -# this should be the only fixed constant -my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm"; -if (defined ($HELM_LIB_DIR)) { - $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl"; -} else { - $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl"; -} - -# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm -require $HELM_LIB_PATH; - -use CGI; - -$cgi = new CGI($ENV{"REQUEST_URL"}); -$mode = $cgi->param('mode'); -$cicuri = $cgi->param('cicuri'); -$theoryuri = $cgi->param('theoryuri'); -$topurl = $cgi->param('topurl'); -$processorURL = $cgi->param('processorURL'); -$getterURL = $cgi->param('getterURL'); -($mode1,$mode2,$mode3,$mode4,$mode5) = split(/,/, $mode); -$natural = "checked" if ($mode4 eq "yes"); -$annotations = "checked" if ($mode5 eq "yes"); -if ($mode1 eq "raw") { - $format_raw = "selected"; -} else { - $format_processed = "selected"; -} - -print < - - -Control panel - - - -
- - - - - - - - - - - -
- Format: - - - - - Reload
- (do it also before attempting to take a link to the current page) - -
-  Natural Language -  Annotations - - Configuration panel -
-
- - -EOT diff --git a/helm/cgi/mkheader.pl b/helm/cgi/mkheader.pl deleted file mode 100755 index b3db1cfa3..000000000 --- a/helm/cgi/mkheader.pl +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl - -# First of all, let's load HELM configuration -use Env; -my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"}; -# this should be the only fixed constant -my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm"; -if (defined ($HELM_LIB_DIR)) { - $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl"; -} else { - $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl"; -} - -# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm -require $HELM_LIB_PATH; - -use CGI; - -$cgi = new CGI($ENV{"REQUEST_URL"}); -$uri = $cgi->param('uri'); - -print < - - -Control panel - - - - - - - -
- Index of $uri -
-
- - -EOT diff --git a/helm/cgi/mkindex.pl b/helm/cgi/mkindex.pl deleted file mode 100755 index 955d6d8b0..000000000 --- a/helm/cgi/mkindex.pl +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl - -# First of all, let's load HELM configuration -use Env; -my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"}; -# this should be the only fixed constant -my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm"; -if (defined ($HELM_LIB_DIR)) { - $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl"; -} else { - $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl"; -} - -# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm -require $HELM_LIB_PATH; - -#use URI::Escape; -use CGI; - -$cgi = new CGI($ENV{"REQUEST_URL"}); - -$mode = $cgi->param('mode'); -$cicuri = $cgi->param('cicuri'); -$theoryuri = $cgi->param('theoryuri'); -$processorURL = $cgi->param('processorURL'); -$getterURL = $cgi->param('getterURL'); -$topurl = $cgi->url(); - -print < - - - Index of $cicuri and $theoryuri - - - - - - - - - - - - - - - -EOT diff --git a/helm/cgi/mkindexcic.pl b/helm/cgi/mkindexcic.pl deleted file mode 100755 index a31f5ecfb..000000000 --- a/helm/cgi/mkindexcic.pl +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/perl - -# First of all, let's load HELM configuration -use Env; -my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"}; -# this should be the only fixed constant -my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm"; -if (defined ($HELM_LIB_DIR)) { - $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl"; -} else { - $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl"; -} - -# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm -require $HELM_LIB_PATH; - -use URI::Escape; -use LWP::UserAgent; -use CGI; - -my $cgi = new CGI($ENV{"REQUEST_URL"}); -$uri = $cgi->param('cicuri'); -$getterURL = $cgi->param('getterURL'); -$uri =~ s/(.*)\/$/$1/; # Remove a final slash if present -$uri .= "/"; # Put a final slash -$myurl = $cgi->url(); - -$cont = ""; # modified by side-effect by &callback -my $ua = LWP::UserAgent->new; -my $request = HTTP::Request->new(GET => $getterURL."ls?format=txt&baseuri=".$uri); -my $response = $ua->request($request, \&callback); - -@filenames = split(/\n/, $cont); - -my $uridotdot = $uri; -$uridotdot =~ s/(.*)\/.+/$1/; -if ($uri ne "cic:/") { - # Let's print the link to the parent directory - $output = < -[BACK] -Parent Directory - -EOT -} - -foreach $i (@filenames) { - my ($type,$name,$flags) = split(/, /, $i); - my ($flagscic, $flagstypes) = split(/,/, $flags); - $flagscic =~ s/^<(.*)/$1/; - $flagstypes =~ s/(.*)>$/$1/; - if ($type eq "dir") { - $output .= < -[DIR] -$name - - -EOT - } elsif ($type eq "object") { - if ($name =~ /\.(con|var|ind)$/) { - # cic file - $output .= < -[DIR] -$name - -EOT - } else { - $output .= < -[DIR] -$name - -EOT - } - } else { - $output .= < -[DIR] -$name - -EOT - } -} - -print < - - -Index of $uri - - - - -$output -
-
- - -EOT - -#================================ - -sub callback -{ - my ($data) = @_; - $cont .= $data; -} diff --git a/helm/cgi/mkindextheory.pl b/helm/cgi/mkindextheory.pl deleted file mode 100755 index 424f688ff..000000000 --- a/helm/cgi/mkindextheory.pl +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/perl - -# First of all, let's load HELM configuration -use Env; -my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"}; -# this should be the only fixed constant -my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm"; -if (defined ($HELM_LIB_DIR)) { - $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl"; -} else { - $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl"; -} - -# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm -require $HELM_LIB_PATH; - -use URI::Escape; -use LWP::UserAgent; -use CGI; - -my $cgi = new CGI($ENV{"REQUEST_URL"}); -$uri = $cgi->param('theoryuri'); -$getterURL = $cgi->param('getterURL'); -$uri =~ s/(.*)\/$/$1/; # Remove a final slash if present -$uri .= "/"; # Put a final slash -$myurl = $cgi->url(); - -$cont = ""; # modified by side-effect by &callback -my $ua = LWP::UserAgent->new; -my $request = HTTP::Request->new(GET => $getterURL."ls?format=txt&baseuri=".$uri); -my $response = $ua->request($request, \&callback); - -@filenames = split(/\n/, $cont); - -my $uridotdot = $uri; -$uridotdot =~ s/(.*)\/.+/$1/; -if ($uri ne "theory:/") { - # Let's print the link to the parent directory - $output = < -[BACK] -Parent Directory - -EOT -} - -foreach $i (@filenames) { - my ($type,$name,$flags) = split(/, /, $i); - my ($flagscic, $flagstypes) = split(/,/, $flags); - $flagscic =~ s/^<(.*)/$1/; - $flagstypes =~ s/(.*)>$/$1/; - if ($type eq "dir") { - $output .= < -[DIR] -$name - -EOT - } elsif ($type eq "object") { - if ($name =~ /\.theory$/) { - # theory file - $output .= < -[DIR] -$name - -EOT - } else { - $output .= < -[DIR] -$name - -EOT - } - } else { - $output .= < -[DIR] -$name - -EOT - } -} - -print < - - -Index of $uri - - - - -$output -
-
- - -EOT - -#================================ - -sub callback -{ - my ($data) = @_; - $cont .= $data; -} diff --git a/helm/configuration/.cvsignore b/helm/configuration/.cvsignore deleted file mode 100644 index d8a7ecb4a..000000000 --- a/helm/configuration/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile configure config.log config.cache config.status -helm-config -helm_configuration.spec diff --git a/helm/configuration/AUTHORS b/helm/configuration/AUTHORS deleted file mode 100644 index 0ceb16fd5..000000000 --- a/helm/configuration/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Andrea Asperti -Luca Padovani -Claudio Sacerdoti Coen -Irene Schena diff --git a/helm/configuration/COPYING b/helm/configuration/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/helm/configuration/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program 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. - - This program 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/helm/configuration/ChangeLog b/helm/configuration/ChangeLog deleted file mode 100644 index 20c36b475..000000000 --- a/helm/configuration/ChangeLog +++ /dev/null @@ -1 +0,0 @@ -28/12/2000: First alpha release diff --git a/helm/configuration/Makefile.in b/helm/configuration/Makefile.in deleted file mode 100644 index 00c3893dc..000000000 --- a/helm/configuration/Makefile.in +++ /dev/null @@ -1,47 +0,0 @@ - -HELM_BIN_DIR=@HELM_BIN_DIR@ -HELM_LIB_DIR=@HELM_LIB_DIR@ -HELM_ETC_DIR=@HELM_ETC_DIR@ -HELM_SHARE_DIR=@HELM_SHARE_DIR@ -HELM_VAR_DIR=@HELM_VAR_DIR@ -HELM_DTD_DIR=@HELM_DTD_DIR@ -HELM_STYLE_DIR=@HELM_STYLE_DIR@ -HELM_LIBRARY_DIR=@HELM_LIBRARY_DIR@ - -all: - -install: - mkdir -p $(HELM_BIN_DIR) - cp helm-config $(HELM_BIN_DIR) - mkdir -p $(HELM_LIB_DIR) - mkdir -p $(HELM_ETC_DIR) - mkdir -p $(HELM_SHARE_DIR) - mkdir -p $(HELM_VAR_DIR) - chmod 777 $(HELM_VAR_DIR) - mkdir -p $(HELM_LIBRARY_DIR) - chmod 777 $(HELM_LIBRARY_DIR) - mkdir -p $(HELM_DTD_DIR) - mkdir -p $(HELM_STYLE_DIR) - cp lib/configuration.pl $(HELM_LIB_DIR) - cp etc/configuration.dtd etc/configuration.xml etc/helm-dictionary.xml \ - etc/helm-font-configuration.xml etc/helm-math-engine-configuration.xml\ - $(HELM_ETC_DIR) - cp library/servers.txt library/urls_of_uris.db $(HELM_VAR_DIR) - chmod 666 $(HELM_VAR_DIR)/servers.txt \ - $(HELM_VAR_DIR)/urls_of_uris.db - -clean: - -distclean: - rm -f Makefile configure config.log config.cache config.status \ - etc/configuration.xml etc/helm-math-engine-configuration.xml \ - lib/configuration.pl helm-config helm_configuration.spec - -dist: clean - rm -rf ../@PACKAGE@-@VERSION@ - mkdir ../@PACKAGE@-@VERSION@ - cp -r * ../@PACKAGE@-@VERSION@ - (cd .. ; tar cvfz @PACKAGE@-@VERSION@.tar.gz @PACKAGE@-@VERSION@ ; rm -rf @PACKAGE@-@VERSION@) - -.PHONY: all install distclean - diff --git a/helm/configuration/NEWS b/helm/configuration/NEWS deleted file mode 100644 index 20c36b475..000000000 --- a/helm/configuration/NEWS +++ /dev/null @@ -1 +0,0 @@ -28/12/2000: First alpha release diff --git a/helm/configuration/README b/helm/configuration/README deleted file mode 100644 index 9f6eb3534..000000000 --- a/helm/configuration/README +++ /dev/null @@ -1,8 +0,0 @@ -NOTE: This is the first alpha release of project HELM. - -HELM (Hypertextual Electronic Library of Mathematics) is a project aimed -at the creation of tools for the development and exploitation of a huge -distributed library of formal mathematical knowledge. This package holds -the configuration files shared by all this tools. - -For more information see http://www.cs.unibo.it/helm diff --git a/helm/configuration/config.cache.pkg b/helm/configuration/config.cache.pkg deleted file mode 100644 index 434e570a2..000000000 --- a/helm/configuration/config.cache.pkg +++ /dev/null @@ -1,15 +0,0 @@ -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -helm_cv_HELM_VAR_DIR=${helm_cv_HELM_VAR_DIR='/var/local/helm'} diff --git a/helm/configuration/configure.in b/helm/configuration/configure.in deleted file mode 100644 index 03c923e9d..000000000 --- a/helm/configuration/configure.in +++ /dev/null @@ -1,186 +0,0 @@ -AC_INIT(etc/configuration.xml.in) - -PACKAGE=helm_configuration - -HELM_MAJOR_VERSION=0 -HELM_MINOR_VERSION=0 -HELM_MICRO_VERSION=2 -HELM_VERSION=$HELM_MAJOR_VERSION.$HELM_MINOR_VERSION.$HELM_MICRO_VERSION -VERSION=$HELM_VERSION - -DEFAULT_HELM_VAR_DIR=/var/local/helm -DEFAULT_HELM_TMP_DIR=/tmp - -AC_ARG_ENABLE( - defaults, - [ --enable-defaults[=ARG] if yes then use defaults (don't ask user) [default=auto]], - USE_DEFAULTS=$enableval, - USE_DEFAULTS=auto -) - -if test "x$prefix" != xNONE; then - RESOLVED_PREFIX=$prefix -else - RESOLVED_PREFIX=$ac_default_prefix -fi - -if test "x$exec_prefix" != xNONE; then - RESOLVED_EXEC_PREFIX=$exec_prefix -else - RESOLVED_EXEC_PREFIX=$RESOLVED_PREFIX -fi - -dnl General -HELM_BIN_DIR=$RESOLVED_EXEC_PREFIX/bin -HELM_LIB_DIR=$RESOLVED_EXEC_PREFIX/lib/helm -HELM_ETC_DIR=$RESOLVED_PREFIX/etc/helm -HELM_SHARE_DIR=$RESOLVED_PREFIX/share/helm - -dnl Checking for the variable directory -if test $USE_DEFAULTS != yes; then - echo - echo "Now you have to choose a suitable directory for variable files." - echo "Normally, this directory would be something like /var/local/helm, you" - echo "have to be sure that the directory (and the subdirectories in it)" - echo "is world-writable." - echo - echo -n "[[$DEFAULT_HELM_VAR_DIR]] ? " - read HELM_VAR_DIR - echo - if test x$HELM_VAR_DIR = x; then - HELM_VAR_DIR="/var/local/helm" - fi -else - HELM_VAR_DIR=$DEFAULT_HELM_VAR_DIR -fi - -AC_MSG_CHECKING(for HELM variable dir) -AC_MSG_RESULT($HELM_VAR_DIR) - -dnl Checking for the /tmp directory -DEFAULTS=$USE_DEFAULTS -if test $DEFAULTS = auto; then - if test -d $DEFAULT_HELM_TMP_DIR ; then - HELM_TMP_DIR=$DEFAULT_HELM_TMP_DIR - else - DEFAULTS=no - fi -fi - -if test $DEFAULTS = no; then - echo - echo "Please, tell me the name of a directory which can be used to store" - echo "temporary files (normally it is something like /tmp)" - echo - echo -n "[[$DEFAULT_HELM_TMP_DIR]]" - read HELM_TMP_DIR - echo - if test x$HELM_TMP_DIR = x; then - HELM_TMP_DIR=$DEFAULT_HELM_TMP_DIR - fi -else - HELM_TMP_DIR=$DEFAULT_HELM_TMP_DIR -fi - -AC_MSG_CHECKING(for $HELM_TMP_DIR) -if test ! -d $HELM_TMP_DIR; then - AC_MSG_RESULT(no) - AC_MSG_ERROR(please check your installation) -fi -AC_MSG_RESULT(ok) - -dnl Checks for GtkMathView -AC_CHECK_PROG(HAVE_GTKMATHVIEW_CONFIG, gtkmathview-config, yes, no) -if test $HAVE_GTKMATHVIEW_CONFIG = no; then - AC_MSG_ERROR(Could not find gtkmathview-config) -fi -GTKMATHVIEW_PREFIX=`gtkmathview-config --prefix` - -AC_CACHE_CHECK( - for dictionary.xml, - helm_cv_GTKMATHVIEW_DICTIONARY_PATH, - helm_cv_GTKMATHVIEW_DICTIONARY_PATH=$GTKMATHVIEW_PREFIX/share/gtkmathview/dictionary.xml - if test ! -f $helm_cv_GTKMATHVIEW_DICTIONARY_PATH; then - read helm_cv_GTKMATHVIEW_DICTIONARY_PATH - fi -) -GTKMATHVIEW_DICTIONARY_PATH=$helm_cv_GTKMATHVIEW_DICTIONARY_PATH - -AC_CACHE_CHECK( - for font-configuration.xml, - helm_cv_GTKMATHVIEW_FONT_CONFIGURATION_PATH, - helm_cv_GTKMATHVIEW_FONT_CONFIGURATION_PATH=$GTKMATHVIEW_PREFIX/share/gtkmathview/font-configuration.xml - if test ! -f $helm_cv_GTKMATHVIEW_FONT_CONFIGURATION_PATH; then - read helm_cv_GTKMATHVIEW_FONT_CONFIGURATION_PATH - fi -) -GTKMATHVIEW_FONT_CONFIGURATION_PATH=$helm_cv_GTKMATHVIEW_FONT_CONFIGURATION_PATH - -AC_CACHE_CHECK( - for t1lib configuration file, - helm_cv_GTKMATHVIEW_T1_CONFIG_FILE, - helm_cv_GTKMATHVIEW_T1_CONFIG_FILE=$GTKMATHVIEW_PREFIX/share/gtkmathview/t1.config - if test ! -f $helm_cv_GTKMATHVIEW_T1_CONFIG_FILE; then - read GTKMATHVIEW_T1_CONFIG_FILE - fi -) -GTKMATHVIEW_T1_CONFIG_FILE=$helm_cv_GTKMATHVIEW_T1_CONFIG_FILE - -HELM_DICTIONARY_PATH=$HELM_ETC_DIR/helm-dictionary.xml -HELM_FONT_CONFIGURATION_PATH=$HELM_ETC_DIR/helm-font-configuration.xml - -dnl Only for HELM XML configuration -HELM_LIBRARY_DIR=$HELM_VAR_DIR/library -HELM_SERVERS_FILE=$HELM_VAR_DIR/servers.txt -HELM_URIS_DBM=$HELM_VAR_DIR/urls_of_uris.db - -dnl CSC: FIXME: getters should download the DTDs -HELM_DTD_DIR=$HELM_SHARE_DIR/dtd -HELM_STYLE_DIR=$HELM_SHARE_DIR/style - -dnl HELM prefixes -AC_SUBST(RESOLVED_PREFIX) -AC_SUBST(RESOLVED_EXEC_PREFIX) - -dnl HELM version -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -dnl HELM directories -AC_SUBST(HELM_BIN_DIR) -AC_SUBST(HELM_LIB_DIR) -AC_SUBST(HELM_ETC_DIR) -AC_SUBST(HELM_SHARE_DIR) -AC_SUBST(HELM_VAR_DIR) -AC_SUBST(HELM_TMP_DIR) - -dnl HELM download directory -AC_SUBST(HELM_LIBRARY_DIR) - -dnl HELM servers -AC_SUBST(HELM_SERVERS_FILE) - -dnl HELM URIS data-base -AC_SUBST(HELM_URIS_DBM) - -dnl HELM DTDs -AC_SUBST(HELM_DTD_DIR) - -dnl HELM stylesheets -AC_SUBST(HELM_STYLE_DIR) - -dnl HELM customized GtkMathView configuration -AC_SUBST(HELM_DICTIONARY_PATH) -AC_SUBST(HELM_FONT_CONFIGURATION_PATH) -AC_SUBST(GTKMATHVIEW_DICTIONARY_PATH) -AC_SUBST(GTKMATHVIEW_FONT_CONFIGURATION_PATH) -AC_SUBST(GTKMATHVIEW_T1_CONFIG_FILE) - -AC_OUTPUT( -[ Makefile - helm-config - lib/configuration.pl - etc/helm-math-engine-configuration.xml - etc/configuration.xml - helm_configuration.spec -], chmod +x helm-config) diff --git a/helm/configuration/etc/.cvsignore b/helm/configuration/etc/.cvsignore deleted file mode 100644 index c85a7bd9b..000000000 --- a/helm/configuration/etc/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -helm-math-engine-configuration.xml configuration.xml diff --git a/helm/configuration/etc/configuration.dtd b/helm/configuration/etc/configuration.dtd deleted file mode 100644 index 8fc5612a8..000000000 --- a/helm/configuration/etc/configuration.dtd +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helm/configuration/etc/configuration.xml.in b/helm/configuration/etc/configuration.xml.in deleted file mode 100644 index db034369d..000000000 --- a/helm/configuration/etc/configuration.xml.in +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @HELM_LIBRARY_DIR@ - - @HELM_DTD_DIR@ - @HELM_STYLE_DIR@ - - @HELM_SERVERS_FILE@ - @HELM_URIS_DBM@ - - index.txt - @HELM_TMP_DIR@ - - /home/lpadovan/helm/PARSER/examples - http://localhost/really_very_local/helm/header/getheader.xml - http://localhost/really_very_local/helm/style/ - http://localhost/cgi-bin/helm/webeq.pl - http://localhost/cgi-bin/helm/webeqp.pl - http://localhost/cgi-bin/helm/use_webeqp.pl - ?baseurl=&stylesheet1=rootcontent.xsl&stylesheet2=content_to_html.xsl&xmluri= - http://localhost:8081/ - http://localhost:8080/helm/servlet/uwobo/ - diff --git a/helm/configuration/etc/helm-dictionary.xml b/helm/configuration/etc/helm-dictionary.xml deleted file mode 100644 index 6d1caf722..000000000 --- a/helm/configuration/etc/helm-dictionary.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helm/configuration/etc/helm-font-configuration.xml b/helm/configuration/etc/helm-font-configuration.xml deleted file mode 100644 index b5a9f7cf5..000000000 --- a/helm/configuration/etc/helm-font-configuration.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helm/configuration/etc/helm-math-engine-configuration.xml.in b/helm/configuration/etc/helm-math-engine-configuration.xml.in deleted file mode 100644 index 96839778f..000000000 --- a/helm/configuration/etc/helm-math-engine-configuration.xml.in +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @HELM_DICTIONARY_PATH@ - @GTKMATHVIEW_DICTIONARY_PATH@ - @HELM_FONT_CONFIGURATION_PATH@ - @GTKMATHVIEW_FONT_CONFIGURATION_PATH@ - @GTKMATHVIEW_T1_CONFIG_FILE@ - - - - - diff --git a/helm/configuration/helm-config.in b/helm/configuration/helm-config.in deleted file mode 100644 index 3b569dec9..000000000 --- a/helm/configuration/helm-config.in +++ /dev/null @@ -1,84 +0,0 @@ - -usage() -{ - cat <&2 -fi - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --version) - echo @VERSION@ - ;; - --prefix) - echo @RESOLVED_PREFIX@ - ;; - --exec-prefix) - echo @RESOLVED_EXEC_PREFIX@ - ;; - --bin-dir) - echo @HELM_BIN_DIR@ - ;; - --lib-dir) - echo @HELM_LIB_DIR@ - ;; - --etc-dir) - echo @HELM_ETC_DIR@ - ;; - --share-dir) - echo @HELM_SHARE_DIR@ - ;; - --var-dir) - echo @HELM_VAR_DIR@ - ;; - --tmp-dir) - echo @HELM_TMP_DIR@ - ;; - --library-dir) - echo @HELM_LIBRARY_DIR@ - ;; - --servers) - echo @HELM_SERVERS_FILE@ - ;; - --uris-dbm) - echo @HELM_URIS_DBM@ - ;; - --dtd-dir) - echo @HELM_DTD_DIR@ - ;; - --style-dir) - echo @HELM_STYLE_DIR@ - ;; - *) - usage 1 1>&2 - ;; - esac - shift -done - diff --git a/helm/configuration/helm_configuration.spec.in b/helm/configuration/helm_configuration.spec.in deleted file mode 100644 index 56695c263..000000000 --- a/helm/configuration/helm_configuration.spec.in +++ /dev/null @@ -1,43 +0,0 @@ -Summary: The configuration files shared by all the tools of project HELM -Name: @PACKAGE@ -Version: @VERSION@ -Release: 1 -Copyright: GPL -URL: http://www.cs.unibo.it/helm -Packager: Claudio Sacerdoti Coen -Group: Applications/Publishing -Source: www.cs.unibo.it:/helm/@PACKAGE@-@VERSION@.tar.gz -%description -HELM (Hypertextual Electronic Library of Mathematics) is a project aimed -at the creation of tools for the development and exploitation of a huge -distributed library of formal mathematical knowledge. This package holds -the configuration files shared by all this tools. -For more information see http://www.cs.unibo.it/helm - -%prep -%setup - -%build -cp config.cache.pkg config.cache -./configure --enable-defaults -make - -%install -make install - -%files -%doc AUTHORS COPYING ChangeLog NEWS README - -/usr/local/bin/helm-config -/usr/local/lib/helm/configuration.pl -/usr/local/etc/helm/configuration.dtd -/usr/local/etc/helm/helm-font-configuration.xml -/usr/local/etc/helm/configuration.xml -/usr/local/etc/helm/helm-math-engine-configuration.xml -/usr/local/etc/helm/helm-dictionary.xml -%attr(666,root,root) /var/local/helm/servers.txt -%attr(666,root,root) /var/local/helm/urls_of_uris.db - -%dir /var/local/helm/library -%dir /usr/local/share/helm/dtd -%dir /usr/local/share/helm/style diff --git a/helm/configuration/lib/.cvsignore b/helm/configuration/lib/.cvsignore deleted file mode 100644 index ff6af6814..000000000 --- a/helm/configuration/lib/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -configuration.pl diff --git a/helm/configuration/lib/configuration.pl.in b/helm/configuration/lib/configuration.pl.in deleted file mode 100644 index 6540b800e..000000000 --- a/helm/configuration/lib/configuration.pl.in +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2000, HELM Team. -# -# This file is part of HELM, an Hypertextual, Electronic -# Library of Mathematics, developed at the Computer Science -# Department, University of Bologna, Italy. -# -# HELM 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. -# -# HELM 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. -# -# You should have received a copy of the GNU General Public License -# along with HELM; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# For details, see the HELM World-Wide-Web page, -# http://cs.unibo.it/helm/. - -use XML::Parser; - -use Env; -my $HELM_CONFIGURATION_DIR = $ENV{"HELM_CONFIGURATION_DIR"}; -my $DEFAULT_HELM_CONFIGURATION_DIR = "@HELM_ETC_DIR@"; -# this should be the only fixed constant -if (defined ($HELM_CONFIGURATION_DIR)) { - $configuration_file = $HELM_CONFIGURATION_DIR."/configuration.xml"; -} else { - $configuration_file = $DEFAULT_HELM_CONFIGURATION_DIR."/configuration.xml"; -} - -$parser = new XML::Parser(Handlers => {Start => \&handle_start, - End => \&handle_end, - Char => \&handle_char}); - - -$parser->parsefile($configuration_file, ErrorContext => 3); - - -sub handle_start -{ - if ($_[1] eq "value-of") { - $$varname .= ${$_[3]}; - } elsif ($_[1] ne "configuration") { - $varname = $_[1]; - } -} - -sub handle_end -{ - if ($_[1] ne "value-of" && $_[1] ne "configuration") { - # Next line for debugging only: - # print "OK: #$_[1]# := #$$varname#\n"; - $varname = undef; - } -} - -sub handle_char -{ - $$varname .= $_[1]; -} diff --git a/helm/configuration/library/servers.txt b/helm/configuration/library/servers.txt deleted file mode 100644 index 5a172e462..000000000 --- a/helm/configuration/library/servers.txt +++ /dev/null @@ -1 +0,0 @@ -http://www.cs.unibo.it/~sacerdot/examples diff --git a/helm/configuration/library/urls_of_uris.db b/helm/configuration/library/urls_of_uris.db deleted file mode 100644 index 9f01b7ae5..000000000 Binary files a/helm/configuration/library/urls_of_uris.db and /dev/null differ diff --git a/helm/gtkmathview-bonobo/.cvsignore b/helm/gtkmathview-bonobo/.cvsignore deleted file mode 100644 index d4b698b3a..000000000 --- a/helm/gtkmathview-bonobo/.cvsignore +++ /dev/null @@ -1,18 +0,0 @@ -aclocal.m4 -config.h.in -Makefile.in -autom4te.cache -config.guess -config.sub -install-sh -mkinstalldirs -ltmain.sh -configure -depcomp -Makefile -config.h -config.log -config.status -libtool -stamp-h1 -gtkmathview-bonobo.pc diff --git a/helm/gtkmathview-bonobo/AUTHORS b/helm/gtkmathview-bonobo/AUTHORS deleted file mode 100644 index c4b11a9bd..000000000 --- a/helm/gtkmathview-bonobo/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Luca Padovani -Pouria Masoudi diff --git a/helm/gtkmathview-bonobo/ChangeLog b/helm/gtkmathview-bonobo/ChangeLog deleted file mode 100644 index e69de29bb..000000000 diff --git a/helm/gtkmathview-bonobo/LICENSE b/helm/gtkmathview-bonobo/LICENSE deleted file mode 100644 index d9bf0fad0..000000000 --- a/helm/gtkmathview-bonobo/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - diff --git a/helm/gtkmathview-bonobo/Makefile.am b/helm/gtkmathview-bonobo/Makefile.am deleted file mode 100644 index afa1ecdc2..000000000 --- a/helm/gtkmathview-bonobo/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -EXTRA_DIST = config.h.in -SUBDIRS = idl src test -CLEANFILES = core *.log *.eps - -pkgconfigdir = $(libdir)/pkgconfig -#pkgconfig_DATA=gtkmathview-bonobo.pc - -backup: - tar cvfz ../@PACKAGE@-@VERSION@-`date|tr ' ' '_'|tr ':' '_'`.tar.gz . - -cleanbak: - -rm -f `find . -name "*~"` - -lc: - @( \ - CFILES=`find . -name "*.c"`; \ - HFILES=`find . -name "*.h"`; \ - wc -l $$CFILES $$HFILES | tail -n 1 \ - ) - diff --git a/helm/gtkmathview-bonobo/NEWS b/helm/gtkmathview-bonobo/NEWS deleted file mode 100644 index bbb294549..000000000 --- a/helm/gtkmathview-bonobo/NEWS +++ /dev/null @@ -1,5 +0,0 @@ - -Tue, 15 Jul 2003 15:56:54 +0200 - - o The project formally starts - diff --git a/helm/gtkmathview-bonobo/README b/helm/gtkmathview-bonobo/README deleted file mode 100644 index e69de29bb..000000000 diff --git a/helm/gtkmathview-bonobo/TODO b/helm/gtkmathview-bonobo/TODO deleted file mode 100644 index 8f1032a0c..000000000 --- a/helm/gtkmathview-bonobo/TODO +++ /dev/null @@ -1,21 +0,0 @@ - -* remove shadow from plugin. This causes the plugin window to be dirty, - find out why - -* disable double buffering for the plugin with GTK+ API? - -* remove black border in upper and left corners of the plugin window - -* try to implement size negotiations with the plugin that sends javascript - to the browser. - -* access object's attribute and children. Jean claims he does - this already, but the code seems to access GLib properties only, - no external params - -* implement a size negotiation mechanism from the plugin using - javascript. The plugin understands its ID from the object element, - calculates the size and sends a URL with a javascript call to a function - that sets width, height attributes of the object element - - diff --git a/helm/gtkmathview-bonobo/configure.ac b/helm/gtkmathview-bonobo/configure.ac deleted file mode 100644 index e30b55212..000000000 --- a/helm/gtkmathview-bonobo/configure.ac +++ /dev/null @@ -1,112 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(gtkmathview-bonobo, [0.0.3]) -AC_CONFIG_SRCDIR(src/GNOME_GtkMathView.server.in.in) -AM_INIT_AUTOMAKE($AC_PACKAGE_NAME, $AC_PACKAGE_VERSION) - -PACKAGE=$PACKAGE_NAME -VERSION=$PACKAGE_VERSION -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -GTKMATHVIEW_CONTROL_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'` -AC_SUBST(GTKMATHVIEW_CONTROL_VERSION_INFO) - -GTKMATHVIEW_API_VERSION="1.0" -AC_SUBST(GTKMATHVIEW_API_VERSION) -AC_DEFINE_UNQUOTED(MATH_VIEW_API_VERSION, "$GTKMATHVIEW_API_VERSION", [Version number of the API implemented]) - -AC_ARG_ENABLE( - profile, - [ --enable-profile[=ARG] include profiling information [default=no]], - profile=$enableval, - profile=no -) - -AC_ARG_ENABLE( - debug, - [ --enable-debug[=ARG] include debugging debug [default=yes]], - enable_debug=$enableval, - enable_debug=yes -) - -if test "x$enable_debug" = "xyes"; then - AC_DEFINE(ENABLE_DEBUG,,[Define to 1 if you want to enable validity checks while running]) -fi - -dnl AC_CONFIG_HEADERS([config.h]) -AM_CONFIG_HEADER(config.h) - -AH_TOP([ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef config_h -#define config_h -]) - -AH_BOTTOM([ -#endif /* config_h */ -]) - -AC_PROG_CC -AC_PROG_CXX -AC_PROG_INSTALL -AC_HEADER_STDC([]) - -AC_SUBST(CFLAGS) -AC_SUBST(CPPFLAGS) -AC_SUBST(LDFLAGS) - -AM_PROG_LIBTOOL - -PKG_CHECK_MODULES(GTKMATHVIEW, gtkmathview >= 0.5.1) -AC_SUBST(GTKMATHVIEW_CFLAGS) -AC_SUBST(GTKMATHVIEW_LIBS) - -PKG_CHECK_MODULES(BONOBO, libbonobo-2.0) -AC_SUBST(BONOBO_CFLAGS) -AC_SUBST(BONOBO_LIBS) - -PKG_CHECK_MODULES(BONOBOUI, libbonoboui-2.0) -AC_SUBST(BONOBOUI_CFLAGS) -AC_SUBST(BONOBOUI_LIBS) - -PKG_CHECK_MODULES(GNOMEUI, libgnomeui-2.0) -AC_SUBST(GNOMEUI_CFLAGS) -AC_SUBST(GNOMEUI_LIBS) - -ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" -AC_SUBST(ORBIT_IDL) - -BONOBO_IDL_INCLUDES="-I`$PKG_CONFIG --variable=idldir libbonobo-2.0` -I`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" -AC_SUBST(BONOBO_IDL_INCLUDES) - -AC_CONFIG_FILES([ - Makefile - gtkmathview-bonobo.pc - idl/Makefile - src/Makefile - src/GNOME_GtkMathView.server.in - test/Makefile -]) -AC_OUTPUT diff --git a/helm/gtkmathview-bonobo/gtkmathview-bonobo.pc.in b/helm/gtkmathview-bonobo/gtkmathview-bonobo.pc.in deleted file mode 100644 index aa9499612..000000000 --- a/helm/gtkmathview-bonobo/gtkmathview-bonobo.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -# This is a comment -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datadir=@datadir@ - -Name: GtkMathView-Bonobo -Description: Bonobo interfaces for GtkMathView -Version: @VERSION@ -Requires: gtkmathview libbonoboui-2.0 -Libs: @DOM_LIBS@ -L${libdir} -lgtkmathview-bonobo -Cflags: @DOM_CFLAGS@ -I${includedir}/@PACKAGE@ - diff --git a/helm/gtkmathview-bonobo/idl/.cvsignore b/helm/gtkmathview-bonobo/idl/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/helm/gtkmathview-bonobo/idl/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/helm/gtkmathview-bonobo/idl/GtkMathView.idl b/helm/gtkmathview-bonobo/idl/GtkMathView.idl deleted file mode 100644 index 307c166c1..000000000 --- a/helm/gtkmathview-bonobo/idl/GtkMathView.idl +++ /dev/null @@ -1,105 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -module GNOME { - - module GtkMathView { - - typedef string element_id; - - interface View : Bonobo::Unknown { - - /** - * load: - * @uri: URI of a MathML document - * - * Loads the document at the specified URI in the component - * and displays it. If the load is successful returns @TRUE, - * @FALSE otherwise. - */ - boolean load (in string uri); - - /** - * unload: - * - * Unload any loaded document from the component - */ - void unload (); - - /** - * freeze: - * - * Freezes the component. Any modification to the document is - * not reflected by the view. - */ - void freeze (); - - /** - * thaw: - * - * Thaws the component. If the document was changed while the - * component was frozen, the view is updated. - */ - void thaw (); - - void setIdAttribute (in string ns, in string name); - void getIdAttribute (out string ns, out string name); - - void select (in element_id elem); - void unselect (in element_id elem); - boolean isSelected (in element_id elem); - - boolean elementCoords (in element_id elem, - out short x, out short y); - /** - * elementRectangle: - * @elem: ID of the element - * @x: x coordinate of the element - * @y: y coordinate of the element - * @width: width of the element - * @height: height of the element - * - * Returns the position and the size of the rectangle includes @elem - */ - boolean elementBoundingBox (in element_id elem, - out short width, out short height, out short depth); - - void getSize (out short width, out short height); - - void getTop (out short x, out short y); - void setTop (in short x, in short y); - - void setDefaultFontSize (in short size); - short getDefaultFontSize (); - - void setVerbosity (in short level); - short getVerbosity (); - - }; - - }; - -}; - diff --git a/helm/gtkmathview-bonobo/idl/Makefile.am b/helm/gtkmathview-bonobo/idl/Makefile.am deleted file mode 100644 index 14555d1e3..000000000 --- a/helm/gtkmathview-bonobo/idl/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ - -idldir = $(datadir)/idl/bonobo-2.0 -idl_DATA = GtkMathView.idl - -EXTRA_DIST = $(idl_DATA) diff --git a/helm/gtkmathview-bonobo/src/.cvsignore b/helm/gtkmathview-bonobo/src/.cvsignore deleted file mode 100644 index 7bac46e25..000000000 --- a/helm/gtkmathview-bonobo/src/.cvsignore +++ /dev/null @@ -1,21 +0,0 @@ -.deps -.libs -GNOME_GtkMathView.server -GNOME_GtkMathView.server.in -Makefile -Makefile.in -libgtkmathview-bonobo.la -control-factory.lo -control-data.lo -view.lo -aux.lo -handlers.lo -persist-file.lo -persist-stream.lo -GtkMathView-common.c -GtkMathView-common.lo -GtkMathView-skels.c -GtkMathView-skels.lo -GtkMathView-stubs.c -GtkMathView-stubs.lo -GtkMathView.h diff --git a/helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in b/helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in deleted file mode 100644 index 957c40004..000000000 --- a/helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in.in +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helm/gtkmathview-bonobo/src/Makefile.am b/helm/gtkmathview-bonobo/src/Makefile.am deleted file mode 100644 index 92e6a9690..000000000 --- a/helm/gtkmathview-bonobo/src/Makefile.am +++ /dev/null @@ -1,68 +0,0 @@ - -location = $(libdir)/libgtkmathview-bonobo.so -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_GtkMathView.server.in.in - -IDL = $(top_srcdir)/idl/GtkMathView.idl - -IDL_GENERATED_C = \ - GtkMathView-common.c \ - GtkMathView-skels.c \ - GtkMathView-stubs.c - -IDL_GENERATED_H = \ - GtkMathView.h - -IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H) - -CLEANFILES = \ - $(server_in_files:.server.in.in=.server) \ - $(IDL_GENERATED) - -lib_LTLIBRARIES = libgtkmathview-bonobo.la - -libgtkmathview_bonobo_la_LIBADD = \ - $(GTKMATHVIEW_LIBS) \ - $(BONOBOUI_LIBS) \ - $(BONOBO_LIBS) - -libgtkmathview_bonobo_la_LDFLAGS = -version-info @GTKMATHVIEW_CONTROL_VERSION_INFO@ - -libgtkmathview_bonobo_la_SOURCES = \ - $(IDL_GENERATED_C) \ - control-data.c \ - control-factory.c \ - persist-file.c \ - persist-stream.c \ - aux.cc \ - handlers.c \ - view.c - -noinst_HEADERS = \ - control-data.h \ - control-factory.h \ - persist-file.h \ - persist-stream.h \ - handlers.h \ - view.h \ - aux.h - -pkginclude_HEADERS = \ - $(IDL_GENERATED_H) - -server_DATA = $(server_in_files:.server.in.in=.server) -$(server_in_files:.server.in.in=.server): $(server_in_files:.server.in.in=.server.in) Makefile - sed -e "s|\@GTKMATHVIEW_FACTORY_LOCATION\@|$(location)|g" $< >$@ - -view.c : $(VIEW_CORBA_GENERATED) - -$(IDL_GENERATED): $(IDL) - $(ORBIT_IDL) $(BONOBO_IDL_INCLUDES) $< - -EXTRA_DIST = $(server_DATA) - -INCLUDES = \ - $(BONOBOUI_CFLAGS) \ - $(BONOBO_CFLAGS) \ - $(GTKMATHVIEW_CFLAGS) - diff --git a/helm/gtkmathview-bonobo/src/aux.cc b/helm/gtkmathview-bonobo/src/aux.cc deleted file mode 100644 index 4ef531239..000000000 --- a/helm/gtkmathview-bonobo/src/aux.cc +++ /dev/null @@ -1,302 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#include - -#include - -#include -#include - -#include - -#include "aux.h" - -#define MATHML_NS_URI "http://www.w3.org/1998/Math/MathML" - -namespace DOM = GdomeSmartDOM; - -static DOM::Element -findElementById(const DOM::Element& el, - const DOM::GdomeString& ns, const DOM::GdomeString& name, - const DOM::GdomeString& id) -{ - assert(el); - if (el.getAttributeNS(ns, name) == id) - return el; - else - for (DOM::Node p = el.get_firstChild(); p; p = p.get_nextSibling()) - if (p.get_nodeType() == DOM::Node::ELEMENT_NODE) - if (DOM::Element res = findElementById(p, ns, name, id)) - return res; - return DOM::Element(); -} - -static unsigned -getDepth(const DOM::Element& elem) -{ - unsigned length = 0; - DOM::Element p = elem; - - while (p) - { - p = p.get_parentNode(); - length++; - } - - return length; -} - -static DOM::Element -findCommonAncestor(const DOM::Element& first, const DOM::Element& last) -{ - if (!first || !last) return DOM::Element(0); - - DOM::Element p(first); - DOM::Element q(last); - - if (p != q) - { - unsigned pDepth = getDepth(p); - unsigned qDepth = getDepth(q); - - while (p && pDepth > qDepth) - { - p = p.get_parentNode(); - pDepth--; - } - - while (q && qDepth > pDepth) - { - q = q.get_parentNode(); - qDepth--; - } - - assert(pDepth == qDepth); - - while (p && q && p != q) - { - p = p.get_parentNode(); - q = q.get_parentNode(); - } - } - - return p; -} - -static void -findCommonSiblings(const DOM::Element& first, const DOM::Element& last, - DOM::Element& firstS, DOM::Element& lastS) -{ - DOM::Element p(first); - DOM::Element q(last); - - if (p != q) - { - unsigned pDepth = getDepth(p); - unsigned qDepth = getDepth(q); - - while (p && pDepth > qDepth) - { - p = p.get_parentNode(); - pDepth--; - } - - while (q && qDepth > pDepth) - { - q = q.get_parentNode(); - qDepth--; - } - - assert(pDepth == qDepth); - - while (p && q && p.get_parentNode() != q.get_parentNode()) - { - p = p.get_parentNode(); - q = q.get_parentNode(); - } - } - - firstS = p; - lastS = q; -} - -static DOM::Node -leftmostChild(const DOM::Node& node) -{ - if (!node) return node; - - DOM::Node firstChild = node.get_firstChild(); - if (!firstChild) return node; - - return leftmostChild(firstChild); -} - -static DOM::Node -rightmostChild(const DOM::Node& node) -{ - if (!node) return node; - - DOM::Node lastChild = node.get_lastChild(); - if (!lastChild) return node; - - return rightmostChild(lastChild); -} - -static DOM::Node -leftSibling(const DOM::Node& node) -{ - DOM::Node p = node; - - if (!p) return p; - - while (p.get_parentNode() && p.get_parentNode().get_firstChild() == p) - p = p.get_parentNode(); - - if (!p.get_parentNode()) return DOM::Node(0); - - DOM::Node prevSibling = p.get_previousSibling(); - assert(prevSibling); - - return rightmostChild(prevSibling); -} - -static DOM::Node -rightSibling(const DOM::Node& node) -{ - DOM::Node p = node; - - if (!p) return p; - - DOM::Node firstChild = p.get_firstChild(); - if (firstChild) return firstChild; - - while (p.get_parentNode() && p.get_parentNode().get_lastChild() == p) - p = p.get_parentNode(); - - if (!p.get_parentNode()) return DOM::Node(0); - - DOM::Node nextSibling = p.get_nextSibling(); - assert(nextSibling); - - return leftmostChild(nextSibling); -} - -extern "C" GdomeElement* -find_common_ancestor(GdomeElement* first, GdomeElement* last) -{ - DOM::Element p(first); - DOM::Element q(last); - return gdome_cast_el(findCommonAncestor(p, q).gdome_object()); -} - -extern "C" GdomeElement* -find_self_or_ancestor(GdomeElement* elem, const gchar* uri, const gchar* name) -{ - DOM::Element el(elem); - - while (el && (el.get_namespaceURI() != uri || el.get_localName() != name)) - el = el.get_parentNode(); - - return gdome_cast_el(el.gdome_object()); -} - -extern "C" void -action_toggle(GdomeElement* elem) -{ - DOM::Element el(elem); - if (el.get_namespaceURI() != MATHML_NS_URI || el.get_localName() != "maction") return; - - guint idx; - if (el.hasAttribute("selection")) - idx = atoi(std::string(el.getAttribute("selection")).c_str()); - else idx = 1; - - idx++; - - std::ostringstream os; - os << idx; - el.setAttribute("selection", os.str()); -} - -extern "C" void -find_common_siblings(GdomeElement* first, GdomeElement* last, - GdomeElement** firstS, GdomeElement** lastS) -{ - DOM::Element fs(0); - DOM::Element ls(0); - - findCommonSiblings(DOM::Element(first), DOM::Element(last), fs, ls); - - if (firstS != NULL) *firstS = gdome_cast_el(fs.gdome_object()); - if (lastS != NULL) *lastS = gdome_cast_el(ls.gdome_object()); -} - -static DOM::Element -findElementWithAttribute(const DOM::Element& elem, const std::string& name) -{ - DOM::Element el(elem); - while (el && !el.hasAttribute(name)) el = el.get_parentNode(); - return el; -} - -static DOM::Element -findElementWithAttributeNS(const DOM::Element& elem, const std::string& ns_uri, const std::string& name) -{ - DOM::Element el(elem); - while (el && !el.hasAttributeNS(ns_uri, name)) el = el.get_parentNode(); - return el; -} - -extern "C" GdomeElement* -find_element_with_id(GdomeElement* elem, GdomeDOMString* ns_uri, GdomeDOMString* name) -{ - assert(name != NULL); - DOM::Element el; - if (ns_uri != NULL) - el = findElementWithAttributeNS(DOM::Element(elem), DOM::GdomeString(ns_uri), DOM::GdomeString(name)); - else - el = findElementWithAttribute(DOM::Element(elem), DOM::GdomeString(name)); - return gdome_cast_el(el.gdome_object()); -} - -extern "C" GdomeDOMString* -find_hyperlink(GdomeElement* elem) -{ - DOM::Element el = findElementWithAttribute(DOM::Element(elem),"href"); - if (el) return el.getAttribute("href").gdome_str(); - else return NULL; -} - -extern "C" GdomeElement* -find_element_by_id(GdomeElement* root, GdomeDOMString* ns_uri, GdomeDOMString* name, - const gchar* id) -{ - DOM::Element el = findElementById(DOM::Element(root), - DOM::GdomeString(ns_uri), DOM::GdomeString(name), - DOM::GdomeString(id)); - return gdome_cast_el(el.gdome_object()); -} - diff --git a/helm/gtkmathview-bonobo/src/aux.h b/helm/gtkmathview-bonobo/src/aux.h deleted file mode 100644 index e7cedd2cd..000000000 --- a/helm/gtkmathview-bonobo/src/aux.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __aux_h__ -#define __aux_h__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - void action_toggle(GdomeElement*); - GdomeElement* find_common_ancestor(GdomeElement*, GdomeElement*); - GdomeElement* find_self_or_ancestor(GdomeElement*, const gchar*, const gchar*); - GdomeElement* find_element_with_id(GdomeElement*, GdomeDOMString*, GdomeDOMString*); - GdomeDOMString* find_hyperlink(GdomeElement*); - GdomeElement* find_element_by_id(GdomeElement*, GdomeDOMString*, GdomeDOMString*, - const gchar*); - -#ifdef __cplusplus -} -#endif - -#endif // __aux_h__ - diff --git a/helm/gtkmathview-bonobo/src/control-data.c b/helm/gtkmathview-bonobo/src/control-data.c deleted file mode 100644 index d97d0fd2f..000000000 --- a/helm/gtkmathview-bonobo/src/control-data.c +++ /dev/null @@ -1,138 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#include - -#include "control-data.h" - -GtkMathViewControlData* -gtk_math_view_control_data_new(BonoboControl* control, GtkMathView *math_view) -{ - GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1); - cd->control = control; /* we don't ref the control this is a weak pointer */ - cd->math_view = math_view; - gtk_widget_ref(GTK_WIDGET(math_view)); - cd->item_factory = NULL; - cd->semantic_selection = FALSE; - cd->first_selected = NULL; - cd->root_selected = NULL; - cd->id_ns_uri = gdome_str_mkref("http://www.cs.unibo.it/helm"); - cd->id_name = gdome_str_mkref("xref"); - cd->x = cd->y = 0; - return cd; -} - -void -gtk_math_view_control_data_destroy(GtkMathViewControlData* cd) -{ - GdomeException exc = 0; - cd->control = NULL; /* don't unref the control, see above */ - gtk_widget_unref(GTK_WIDGET(cd->math_view)); - cd->math_view = NULL; - if (cd->item_factory != NULL) - { - gtk_object_unref(cd->item_factory); - cd->item_factory = NULL; - } - if (cd->first_selected != NULL) - { - gdome_el_unref(cd->first_selected, &exc); - g_assert(exc == 0); - cd->first_selected = NULL; - } - if (cd->root_selected != NULL) - { - gdome_el_unref(cd->root_selected, &exc); - g_assert(exc == 0); - cd->root_selected = NULL; - } - if (cd->id_ns_uri != NULL) - { - gdome_str_unref(cd->id_ns_uri); - cd->id_ns_uri = NULL; - } - if (cd->id_name != NULL) - { - gdome_str_unref(cd->id_name); - cd->id_name = NULL; - } - g_free(cd); -} - -gchar* -gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData* cd) -{ - g_return_val_if_fail(cd != NULL, NULL); - return (cd->id_ns_uri != NULL) ? g_strdup(cd->id_ns_uri->str) : NULL; -} - -void -gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData* cd, const gchar* ns_uri) -{ - g_return_if_fail(cd != NULL); - if (cd->id_ns_uri != NULL) gdome_str_unref(cd->id_ns_uri); - cd->id_ns_uri = (ns_uri != NULL) ? gdome_str_mkref_dup(ns_uri) : NULL; -} - -gchar* -gtk_math_view_control_data_get_id_name(GtkMathViewControlData* cd) -{ - g_return_val_if_fail(cd != NULL, NULL); - return (cd->id_name != NULL) ? g_strdup(cd->id_name->str) : NULL; -} - -void -gtk_math_view_control_data_set_id_name(GtkMathViewControlData* cd, const gchar* name) -{ - g_return_if_fail(cd != NULL); - if (cd->id_name != NULL) gdome_str_unref(cd->id_name); - cd->id_name = (name != NULL) ? gdome_str_mkref_dup(name) : NULL; -} - -void -gtk_math_view_control_data_set_root_selected(GtkMathViewControlData* cd, GdomeElement* elem) -{ - g_return_if_fail(cd != NULL); - GdomeException exc = 0; - - gtk_math_view_freeze(cd->math_view); - - if (cd->root_selected != NULL) - { - gtk_math_view_unselect(cd->math_view, cd->root_selected); - gdome_el_unref(cd->root_selected, &exc); - g_assert(exc == 0); - } - - cd->root_selected = elem; - if (cd->root_selected != NULL) - { - gdome_el_ref(cd->root_selected, &exc); - g_assert(exc == 0); - gtk_math_view_select(cd->math_view, cd->root_selected); - } - - gtk_math_view_thaw(cd->math_view); -} diff --git a/helm/gtkmathview-bonobo/src/control-data.h b/helm/gtkmathview-bonobo/src/control-data.h deleted file mode 100644 index 46bc6cef7..000000000 --- a/helm/gtkmathview-bonobo/src/control-data.h +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __control_data_h__ -#define __control_data_h__ - -#include -#include -#include - -typedef struct _GtkMathViewControlData -{ - BonoboControl* control; /* the control this data belongs to */ - GtkMathView* math_view; - GtkWidget* item_factory; - gboolean semantic_selection; - GdomeElement* first_selected; - GdomeElement* root_selected; - GdomeDOMString* id_ns_uri; - GdomeDOMString* id_name; - gint x; - gint y; -} GtkMathViewControlData; - -GtkMathViewControlData* gtk_math_view_control_data_new(BonoboControl*, GtkMathView*); -void gtk_math_view_control_data_destroy(GtkMathViewControlData*); -gchar* gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData*); -void gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData*, const gchar*); -gchar* gtk_math_view_control_data_get_id_name(GtkMathViewControlData*); -void gtk_math_view_control_data_set_id_name(GtkMathViewControlData*, const gchar*); -void gtk_math_view_control_data_set_root_selected(GtkMathViewControlData*, GdomeElement*); - -#endif // __control_data_h__ diff --git a/helm/gtkmathview-bonobo/src/control-factory.c b/helm/gtkmathview-bonobo/src/control-factory.c deleted file mode 100644 index 6d90bef3d..000000000 --- a/helm/gtkmathview-bonobo/src/control-factory.c +++ /dev/null @@ -1,431 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#include -#include -#include - -#include "control-factory.h" -#include "control-data.h" -#include "persist-file.h" -#include "persist-stream.h" -#include "handlers.h" -#include "view.h" - -enum - { - MATH_VIEW_WIDTH, - MATH_VIEW_HEIGHT, - MATH_VIEW_TOP_X, - MATH_VIEW_TOP_Y, - MATH_VIEW_FONT_SIZE, - MATH_VIEW_VERBOSITY, - MATH_VIEW_ID_NS_URI, - MATH_VIEW_ID_NAME - } math_args; - -static void -activate_maction(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - GdomeElement* elem; - - g_return_if_fail(control_data != NULL); - - elem = gtk_math_view_get_element_at(control_data->math_view, control_data->x, control_data->y); - if (elem != NULL) - { - GdomeException exc = 0; - GdomeElement* action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction"); - if (action != NULL) - { - gtk_math_view_freeze(control_data->math_view); - action_toggle(action); - gtk_math_view_thaw(control_data->math_view); - gdome_el_unref(action, &exc); - g_assert(exc == 0); - } - gdome_el_unref(elem, &exc); - g_assert(exc == 0); - } -} - -static void -copy_link_address(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ -} - -static void -zoom_in(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - g_return_if_fail(control_data != NULL); - guint old_font_size = gtk_math_view_get_font_size(control_data->math_view); - gtk_math_view_set_font_size(control_data->math_view, old_font_size + 1); -} - -static void -zoom_out(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - g_return_if_fail(control_data != NULL); - guint old_font_size = gtk_math_view_get_font_size(control_data->math_view); - gtk_math_view_set_font_size(control_data->math_view, old_font_size - 1); -} - -static void -switch_semantic_selection(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - g_return_if_fail(control_data != NULL); - control_data->semantic_selection = !control_data->semantic_selection; - if (control_data->semantic_selection) - { - GdomeElement* elem = find_element_with_id(control_data->root_selected, - control_data->id_ns_uri, - control_data->id_name); - } -} - -/* -static void -copy_selected_markup(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - gchar* res = copy_markup(control_data->root_selected); - if (res != NULL) - { - set_clipboard(res); - g_free(res); - } -} -*/ - -static void -copy_selected_id(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ -} - -static void -select_parent(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - g_return_if_fail(control_data != NULL); - if (control_data->root_selected != NULL) - { - GdomeException exc = 0; - GdomeNode* parent_node = gdome_el_parentNode(control_data->root_selected, &exc); - g_assert(parent_node != NULL); - g_assert(exc == 0); - GdomeElement* parent = gdome_cast_el(parent_node); - gtk_math_view_control_data_set_root_selected(control_data, parent); - gdome_n_unref(parent_node, &exc); - g_assert(exc == 0); - } -} - -static void -deselect(GtkMathViewControlData* control_data, guint action, GtkWidget* widget) -{ - g_return_if_fail(control_data != NULL); - - if (control_data->root_selected != NULL) - { - gtk_math_view_unselect(control_data->math_view, control_data->root_selected); - control_data->root_selected = NULL; - } -} - -/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */ -static GtkItemFactoryEntry menu_items[] = { - { "/Activate ", NULL, activate_maction, 0, "", GTK_STOCK_EXECUTE }, - { "/Copy Link Address", NULL, copy_link_address, 0, "", GTK_STOCK_COPY }, - /* { "/Jump To", NULL, NULL, 0, "", GTK_STOCK_JUMP_TO }, */ - { "/sep1", NULL, NULL, 0, "" }, - /* { "/Semantic Selection", NULL, switch_semantic_selection, 0, "" }, */ - /* { "/Copy Selected Markup", NULL, copy_selected_markup, 0, "" }, */ - /* { "/Copy Id", NULL, copy_selected_id, 0, "" }, */ - /* { "/Show Selected", NULL, NULL, 0, "" }, */ - { "/Select Parent", NULL, select_parent, 0, "" }, - { "/De-Select", NULL, deselect, 0, "", GTK_STOCK_CLEAR }, - { "/sep2", NULL, NULL, 0, "" }, - { "/Smaller", NULL, zoom_out, 0, "", GTK_STOCK_ZOOM_OUT }, - { "/Bigger", NULL, zoom_in, 0, "", GTK_STOCK_ZOOM_IN }, - /* { "/Properties...", NULL, NULL, 0, "", GTK_STOCK_PROPERTIES }, */ -}; - -static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); - -void -button_pressed_cb(GtkMathView* math_view, GdkEventButton* event, GtkMathViewControlData* control_data) -{ - g_return_if_fail(math_view != NULL); - g_return_if_fail(event != NULL); - g_return_if_fail(control_data != NULL); - - if (event->button == 3) - { -#if 0 - gtk_menu_popup (GTK_MENU(control_data->popup_menu), NULL, NULL, - NULL, event, event->button, event->time); -#endif - control_data->x = (gint) event->x; - control_data->y = (gint) event->y; - printf("data %d %d\n", control_data->x, control_data->y); - - gtk_item_factory_popup_with_data(control_data->item_factory, - NULL, NULL, event->x_root, event->y_root, - event->button, gtk_get_current_event_time()); - } -} - - -static void -get_prop(BonoboPropertyBag* bag, - BonoboArg* arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GtkMathViewControlData* control_data = user_data; - g_assert(control_data != NULL); - - switch (arg_id) - { - case MATH_VIEW_WIDTH: - BONOBO_ARG_SET_INT(arg, gtk_math_view_get_width(control_data->math_view)); - break; - case MATH_VIEW_HEIGHT: - BONOBO_ARG_SET_INT(arg, gtk_math_view_get_height(control_data->math_view)); - break; - case MATH_VIEW_TOP_X: - { - guint top_x; - gtk_math_view_get_top(control_data->math_view, &top_x, NULL); - BONOBO_ARG_SET_INT(arg, top_x); - } - break; - case MATH_VIEW_TOP_Y: - { - guint top_y; - gtk_math_view_get_top(control_data->math_view, NULL, &top_y); - BONOBO_ARG_SET_INT(arg, top_y); - } - break; - case MATH_VIEW_FONT_SIZE: - BONOBO_ARG_SET_INT(arg, gtk_math_view_get_font_size(control_data->math_view)); - break; - case MATH_VIEW_VERBOSITY: - BONOBO_ARG_SET_INT(arg, gtk_math_view_get_log_verbosity(control_data->math_view)); - break; - case MATH_VIEW_ID_NS_URI: - { - gchar* id_ns_uri = gtk_math_view_control_data_get_id_ns_uri(control_data); - BONOBO_ARG_SET_STRING(arg, id_ns_uri); - g_free(id_ns_uri); - } - break; - case MATH_VIEW_ID_NAME: - { - gchar* id_name = gtk_math_view_control_data_get_id_name(control_data); - BONOBO_ARG_SET_STRING(arg, id_name); - g_free(id_name); - } - break; - default: - bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); - break; - } -} - -static void -set_prop(BonoboPropertyBag* bag, - const BonoboArg* arg, - guint arg_id, - CORBA_Environment* ev, - gpointer user_data) -{ - GtkMathViewControlData *control_data = user_data; - g_assert(control_data != NULL); - - switch (arg_id) - { - case MATH_VIEW_TOP_X: - { - guint old_top_y; - gtk_math_view_get_top(control_data->math_view, NULL, &old_top_y); - gtk_math_view_set_top(control_data->math_view, BONOBO_ARG_GET_INT(arg), old_top_y); - } - break; - case MATH_VIEW_TOP_Y: - { - guint old_top_x; - gtk_math_view_get_top(control_data->math_view, &old_top_x, NULL); - gtk_math_view_set_top(control_data->math_view, BONOBO_ARG_GET_INT(arg), old_top_x); - } - break; - case MATH_VIEW_FONT_SIZE: - gtk_math_view_set_font_size(control_data->math_view, BONOBO_ARG_GET_INT(arg)); - break; - case MATH_VIEW_VERBOSITY: - gtk_math_view_set_log_verbosity(control_data->math_view, BONOBO_ARG_GET_INT(arg)); - break; - case MATH_VIEW_ID_NS_URI: - gtk_math_view_control_data_set_id_ns_uri(control_data, BONOBO_ARG_GET_STRING(arg)); - break; - case MATH_VIEW_ID_NAME: - gtk_math_view_control_data_set_id_name(control_data, BONOBO_ARG_GET_STRING(arg)); - break; - default: - bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); - break; - } -} - -static void -control_destroy(BonoboObject *object, GtkMathViewControlData *cd) -{ - gtk_math_view_control_data_destroy(cd); -} - -static void -gtk_math_view_control_init(BonoboControl *control, GtkWidget *scrolled_window) -{ - GtkMathViewControlData *control_data; - GtkWidget *math_view; - GtkItemFactory *item_factory; - - Bonobo_UIContainer remote_ui_container; - BonoboUIComponent *ui_component; - - BonoboPropertyBag *prop_bag; - BonoboObject *persist_file; - BonoboObject *persist_stream; - BonoboEventSource *evs; - View* view; - - math_view = gtk_math_view_new(NULL,NULL); - gtk_widget_show(math_view); - - control_data = gtk_math_view_control_data_new(control, (GtkMathView*)math_view); - - g_signal_connect (control, "destroy", G_CALLBACK (control_destroy), control_data); - - /* Same as before but don't bother with the accelerators */ - control_data->item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "
", NULL); - gtk_item_factory_create_items (control_data->item_factory, nmenu_items, menu_items, control_data); - /* control_data->popup_menu = gtk_item_factory_get_widget (control_data->item_factory, "
"); */ - /* gtk_widget_ref(control_data->popup_menu); */ - - evs = bonobo_event_source_new(); - bonobo_object_add_interface(BONOBO_OBJECT(control), BONOBO_OBJECT(evs)); - - gtk_container_add(GTK_CONTAINER (scrolled_window), GTK_WIDGET (control_data->math_view)); - - view = view_new(control_data); - bonobo_object_add_interface(BONOBO_OBJECT(control), BONOBO_OBJECT(view)); - - persist_file = gtk_math_view_persist_file_new(GTK_MATH_VIEW(math_view)); - bonobo_object_add_interface(BONOBO_OBJECT(control), persist_file); - - persist_stream = gtk_math_view_persist_stream_new(GTK_MATH_VIEW(math_view)); - bonobo_object_add_interface(BONOBO_OBJECT(control), persist_stream); - - prop_bag = bonobo_property_bag_new(get_prop, set_prop, control_data); - bonobo_control_set_properties(control, BONOBO_OBJREF(prop_bag), NULL); - - bonobo_property_bag_add(prop_bag, "width", - MATH_VIEW_WIDTH, BONOBO_ARG_INT, - NULL, - "Width of the view", 0); - bonobo_property_bag_add(prop_bag, "height", - MATH_VIEW_HEIGHT, BONOBO_ARG_INT, - NULL, - "Height of the view", 0); - bonobo_property_bag_add(prop_bag, "top-x", - MATH_VIEW_TOP_X, BONOBO_ARG_INT, - NULL, - "X coordinate of the top-left corner", 0); - bonobo_property_bag_add(prop_bag, "top-y", - MATH_VIEW_TOP_Y, BONOBO_ARG_INT, - NULL, - "Y coordinate of the top-left corner", 0); - bonobo_property_bag_add(prop_bag, "font-size", - MATH_VIEW_FONT_SIZE, BONOBO_ARG_INT, - NULL, - "Default font size", 0); - bonobo_property_bag_add(prop_bag,"verbosity", - MATH_VIEW_VERBOSITY, BONOBO_ARG_INT, - NULL, - "Verbosity level", 0); - bonobo_property_bag_add(prop_bag, "id-ns-uri", - MATH_VIEW_ID_NS_URI, BONOBO_ARG_STRING, - NULL, - "Namespace URI of ID attribute", 0); - bonobo_property_bag_add(prop_bag, "id-name", - MATH_VIEW_ID_NAME, BONOBO_ARG_STRING, - NULL, - "Name of ID attribute", 0); - - bonobo_object_unref(BONOBO_OBJECT(prop_bag)); - - g_signal_connect(control,"set_frame", G_CALLBACK(set_frame), control_data); - g_signal_connect(control_data->math_view, "button_press_event", G_CALLBACK (button_pressed_cb), - control_data); - g_signal_connect(control_data->math_view, "click", G_CALLBACK (click_cb), - control_data); - g_signal_connect(control_data->math_view, "select_begin", G_CALLBACK(select_begin_cb), - control_data); - g_signal_connect(control_data->math_view, "select_over", G_CALLBACK(select_over_cb), - control_data); - g_signal_connect(control_data->math_view, "select_end", G_CALLBACK(select_end_cb), - control_data); - g_signal_connect(control_data->math_view, "select_abort", G_CALLBACK(select_abort_cb), - control_data); -} - -static BonoboObject* -gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, - gpointer closure) -{ - BonoboControl *control; - GtkWidget *scrolled_window; - - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - /* putting SHADOW_NONE screws the plugin window, how's that??? */ - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); - gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 0); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_show_all (scrolled_window); - - control = bonobo_control_new(scrolled_window); - - if(control) - { - gtk_math_view_control_init(control,scrolled_window); - return BONOBO_OBJECT(control); - } - else - return NULL; -} - -BONOBO_ACTIVATION_SHLIB_FACTORY (CONTROL_FACTORY_ID, "GtkMathView Factory", - gtk_math_view_control_factory, NULL); - diff --git a/helm/gtkmathview-bonobo/src/control-factory.h b/helm/gtkmathview-bonobo/src/control-factory.h deleted file mode 100644 index 0d2e5a24d..000000000 --- a/helm/gtkmathview-bonobo/src/control-factory.h +++ /dev/null @@ -1,34 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __control_factory_h__ -#define __control_factory_h__ - -#include -#include -#include - -#define CONTROL_FACTORY_ID "OAFIID:GNOME_GtkMathView_Factory:" MATH_VIEW_API_VERSION -#define CONTROL_ID "OAFIID:GNOME_GtkMathView:" MATH_VIEW_API_VERSION - -#endif /* __control_factory_h__ */ diff --git a/helm/gtkmathview-bonobo/src/handlers.c b/helm/gtkmathview-bonobo/src/handlers.c deleted file mode 100644 index 4861b2f0b..000000000 --- a/helm/gtkmathview-bonobo/src/handlers.c +++ /dev/null @@ -1,245 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#include "aux.h" -#include "handlers.h" - -static void -set_clipboard(GdomeDOMString* data) -{ - GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); - gtk_clipboard_set_text(clipboard, data->str, gdome_str_length(data)); -} - -void -set_frame(BonoboControl *control, gpointer data) -{ -} - -static void -notify_browser(GtkMathViewControlData* control_data, const char* url) -{ - BonoboObject* evs = bonobo_object_query_local_interface(BONOBO_OBJECT(control_data->control), - "IDL:Bonobo/EventSource:1.0"); - if (evs != NULL) - { - BonoboArg* arg = bonobo_arg_new(BONOBO_ARG_STRING); - BONOBO_ARG_SET_STRING(arg, url); - bonobo_event_source_notify_listeners (evs, "URL", arg, NULL); - /* bonobo_arg_release(arg); */ - bonobo_object_unref(BONOBO_OBJECT(evs)); - } -} - -void -click_cb(GtkMathView* math_view, GdomeElement* elem, gint state, - GtkMathViewControlData* control_data) -{ - GdomeException exc = 0; - - g_return_if_fail(math_view != NULL); - g_return_if_fail(control_data != NULL); - - if (elem != NULL) - { - GdomeElement* action; - GdomeDOMString* href = find_hyperlink(elem); - - if (href != NULL) - { - /*gtk_math_view_load_uri(math_view,href->str);*/ - - notify_browser(control_data, href->str); - - //set_clipboard(href); - gdome_str_unref(href); - return; - } - - action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction"); - if (action != NULL) - { - gtk_math_view_freeze(math_view); - action_toggle(action); - gtk_math_view_thaw(math_view); - gdome_el_unref(action, &exc); - g_assert(exc == 0); - return; - } - } - - if (control_data->root_selected != NULL) - { - gtk_math_view_freeze(math_view); - gtk_math_view_unselect(math_view, control_data->root_selected); - gtk_math_view_thaw(math_view); - gdome_el_unref(control_data->root_selected, &exc); - g_assert(exc == 0); - control_data->root_selected = NULL; - } -} - -void -select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state, - GtkMathViewControlData* control_data) -{ - g_return_if_fail(math_view != NULL); - g_return_if_fail(control_data != NULL); - - if (elem != NULL) - { - GdomeException exc = 0; - gtk_math_view_freeze(math_view); - if (control_data->root_selected != NULL) - { - gtk_math_view_unselect(math_view, control_data->root_selected); - gdome_el_unref(control_data->root_selected, &exc); - g_assert(exc == 0); - control_data->root_selected = NULL; - } - - if (control_data->semantic_selection) - { - GdomeElement* new_elem = find_element_with_id(elem, control_data->id_ns_uri, control_data->id_name); - if (new_elem != NULL) - { - gdome_el_ref(new_elem, &exc); - g_assert(exc == 0); - } - control_data->first_selected = control_data->root_selected = new_elem; - } - else - { - gdome_el_ref(elem, &exc); - g_assert(exc == 0); - gdome_el_ref(elem, &exc); - g_assert(exc == 0); - control_data->first_selected = control_data->root_selected = elem; - } - - if (control_data->root_selected != NULL) - gtk_math_view_select(math_view, control_data->root_selected); - - gtk_math_view_thaw(math_view); - } -} - -void -select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state, - GtkMathViewControlData* control_data) -{ - g_return_if_fail(math_view != NULL); - g_return_if_fail(control_data != NULL); - - if (control_data->first_selected != NULL && elem != NULL) - { - GdomeException exc = 0; - - gtk_math_view_freeze(math_view); - - if (control_data->root_selected != NULL) - { - gtk_math_view_unselect(math_view, control_data->root_selected); - gdome_el_unref(control_data->root_selected, &exc); - g_assert(exc == 0); - control_data->root_selected = NULL; - } - - if (control_data->semantic_selection) - { - GdomeElement* new_root = find_common_ancestor(control_data->first_selected, elem); - if (new_root != NULL) - { - control_data->root_selected = find_element_with_id(new_root, control_data->id_ns_uri, control_data->id_name); - gdome_el_unref(new_root, &exc); - g_assert(exc == 0); - } - else - control_data->root_selected = NULL; - } - else - control_data->root_selected = find_common_ancestor(control_data->first_selected, elem); - - if (control_data->root_selected != NULL) - gtk_math_view_select(math_view, control_data->root_selected); - - gtk_math_view_thaw(math_view); - } -} - -void -select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state, - GtkMathViewControlData* control_data) -{ - g_return_if_fail(math_view != NULL); - g_return_if_fail(control_data != NULL); - - if (control_data->first_selected != NULL) - { - GdomeException exc = 0; - gdome_el_unref(control_data->first_selected, &exc); - g_assert(exc == 0); - control_data->first_selected = NULL; - - if (control_data->root_selected != NULL && control_data->semantic_selection) - { - GdomeException exc = 0; - GdomeDOMString* id = gdome_el_getAttributeNS(control_data->root_selected, - control_data->id_ns_uri, - control_data->id_name, &exc); - g_assert(exc == 0); - g_assert(id != NULL); - set_clipboard(id); - gdome_str_unref(id); - } - } -} - -void -select_abort_cb(GtkMathView* math_view, GtkMathViewControlData* control_data) -{ - GdomeException exc = 0; - - g_return_if_fail(math_view != NULL); - g_return_if_fail(control_data != NULL); - - if (control_data->first_selected != NULL) - { - gdome_el_unref(control_data->first_selected, &exc); - g_assert(exc == 0); - control_data->first_selected = NULL; - } - - if (control_data->root_selected != NULL) - { - gtk_math_view_freeze(math_view); - gtk_math_view_unselect(math_view, control_data->root_selected); - gtk_math_view_thaw(math_view); - gdome_el_unref(control_data->root_selected, &exc); - g_assert(exc == 0); - control_data->root_selected = NULL; - } -} - diff --git a/helm/gtkmathview-bonobo/src/handlers.h b/helm/gtkmathview-bonobo/src/handlers.h deleted file mode 100644 index 47eda64b3..000000000 --- a/helm/gtkmathview-bonobo/src/handlers.h +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __handlers_h__ -#define __handlers_h__ - -#include -#include -#include - -#include "control-data.h" - -void set_frame(BonoboControl*, gpointer); -void button_pressed_cb(GtkMathView*, GdkEventButton*, GtkMathViewControlData*); -void click_cb(GtkMathView*, GdomeElement*, gint, GtkMathViewControlData*); -void select_begin_cb(GtkMathView*,GdomeElement*, gint, GtkMathViewControlData*); -void select_over_cb(GtkMathView*,GdomeElement*,gint, GtkMathViewControlData*); -void select_end_cb(GtkMathView*,GdomeElement*,gint, GtkMathViewControlData*); -void select_abort_cb(GtkMathView*, GtkMathViewControlData*); - -#endif // __handlers_h__ diff --git a/helm/gtkmathview-bonobo/src/persist-file.c b/helm/gtkmathview-bonobo/src/persist-file.c deleted file mode 100644 index 1d3fd36c6..000000000 --- a/helm/gtkmathview-bonobo/src/persist-file.c +++ /dev/null @@ -1,141 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#include -#include -#include - -#include "persist-file.h" -#include "control-factory.h" - -static BonoboObjectClass *gtk_math_view_persist_file_parent_class; - -static void load_implementation(PortableServer_Servant servant,const gchar *path, - CORBA_Environment *ev); - -static void save_implementation(PortableServer_Servant servant,const gchar *path, - CORBA_Environment *ev); - -static void finalize(GObject *object) -{ - GtkMathViewPersistFile *file = GTK_MATH_VIEW_PERSIST_FILE(object); - - if (file->math_view) - { - g_object_unref(file->math_view); - file->math_view = NULL; - } - - G_OBJECT_CLASS(gtk_math_view_persist_file_parent_class)->finalize (object); -} - -static Bonobo_Persist_ContentTypeList * -get_content_types(BonoboPersist *persist,CORBA_Environment *ev) -{ - return bonobo_persist_generate_content_types(3, "application/mathml+xml", "text/mathml", "text/plain"); -} - -static void -gtk_math_view_persist_file_class_init(GtkMathViewPersistFileClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS(klass); - BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS(klass); - POA_Bonobo_PersistFile__epv *epv = &klass->epv; - - gtk_math_view_persist_file_parent_class = g_type_class_peek_parent(klass); - - epv->load = load_implementation; - epv->save = save_implementation; - - object_class->finalize = finalize; - persist_class->get_content_types = get_content_types; -} - -GType -gtk_math_view_persist_file_get_type(void) -{ - static GType type = 0; - - if (!type) - { - GTypeInfo info = - { - sizeof(GtkMathViewPersistFileClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gtk_math_view_persist_file_class_init, - NULL, /* class finalize */ - NULL, /* class_data */ - sizeof(GtkMathViewPersistFile), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = bonobo_type_unique(BONOBO_TYPE_PERSIST, - POA_Bonobo_PersistFile__init,POA_Bonobo_PersistFile__fini, - G_STRUCT_OFFSET(GtkMathViewPersistFileClass, epv), - &info,"GtkMathViewPresistFile"); - } - - return type; -} - -BonoboObject * -gtk_math_view_persist_file_new(GtkMathView *math_view) -{ - BonoboObject *file; - - file = g_object_new(gtk_math_view_persist_file_get_type(),NULL); - bonobo_persist_construct(BONOBO_PERSIST(file),CONTROL_FACTORY_ID); - - g_object_ref(math_view); - GTK_MATH_VIEW_PERSIST_FILE(file)->math_view = math_view; - - return file; -} - -static void -load_implementation(PortableServer_Servant servant,const gchar *path,CORBA_Environment *ev) -{ - gboolean result; - GtkMathViewPersistFile* file = GTK_MATH_VIEW_PERSIST_FILE(bonobo_object_from_servant(servant)); - //fd = open(path, O_RDONLY); - - result = gtk_math_view_load_uri(file->math_view,path); - if(!result) - CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL); - - bonobo_object_unref(BONOBO_OBJECT(file)); -} - -static void -save_implementation(PortableServer_Servant servant, - const gchar *path, - CORBA_Environment *ev) -{ - bonobo_exception_set(ev,"save_exception"); - bonobo_exception_add_handler_str("save_exception", - "Save option is not valid"); -} diff --git a/helm/gtkmathview-bonobo/src/persist-file.h b/helm/gtkmathview-bonobo/src/persist-file.h deleted file mode 100644 index 6f70e76ef..000000000 --- a/helm/gtkmathview-bonobo/src/persist-file.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __GTK_MATH_VIEW_PERSIST_FILE_H__ -#define __GTK_MATH_VIEW_PERSIST_FILE_H__ - -#include -#include - -G_BEGIN_DECLS - -struct _GtkMathViewPersistFile; -typedef struct _GtkMathViewPersistFile GtkMathViewPersistFile; -typedef struct _GtkMathViewPersistFilePrivate GtkMathViewPersistFilePrivate; - -#define GTK_MATH_VIEW_TYPE_PERSIST_FILE (gtk_math_view_persist_file_get_type()) -#define GTK_MATH_VIEW_PERSIST_FILE(object) (G_TYPE_CHECK_INSTANCE_CAST((object), GTK_MATH_VIEW_TYPE_PERSIST_FILE, \ - GtkMathViewPersistFile)) -#define GTK_MATH_VIEW_IS_PERSIST_FILE(object) (G_TYPE_CHECK_INSTANCE_TYPE((object),\ - GTK_MATH_VIEW_TYPE_PERSIST_FILE)) -#define GTK_MATH_VIEW_IS_PERSIST_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\ - GTK_MATH_VIEW_TYPE_PERSIST_FILE)) - -struct _GtkMathViewPersistFile -{ - BonoboPersist parent; - GtkMathView *math_view; -}; - -typedef struct -{ - BonoboPersistClass parent_class; - POA_Bonobo_PersistFile__epv epv; -} GtkMathViewPersistFileClass; - -GType gtk_math_view_persist_file_get_type(void); -BonoboObject *gtk_math_view_persist_file_new(GtkMathView *); - -G_END_DECLS - -#endif diff --git a/helm/gtkmathview-bonobo/src/persist-stream.c b/helm/gtkmathview-bonobo/src/persist-stream.c deleted file mode 100644 index bef7d90cb..000000000 --- a/helm/gtkmathview-bonobo/src/persist-stream.c +++ /dev/null @@ -1,221 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#include -#include - -#include "persist-stream.h" -#include "control-factory.h" - -#define DEBUG0 - -static BonoboObjectClass *gtk_math_view_persist_stream_parent_class; - -static void load_implementation(PortableServer_Servant servant, - const Bonobo_Stream stream, - const CORBA_char *type, - CORBA_Environment *ev); - -static void save_implementation(PortableServer_Servant servant, - const Bonobo_Stream stream, - const CORBA_char *type, - CORBA_Environment *ev); - -static void finalize(GObject *object) -{ - GtkMathViewPersistStream *stream = GTK_MATH_VIEW_PERSIST_STREAM(object); - - if (stream->math_view != NULL) - { - g_object_unref(stream->math_view); - stream->math_view = NULL; - } - - G_OBJECT_CLASS(gtk_math_view_persist_stream_parent_class)->finalize(object); -} - -static Bonobo_Persist_ContentTypeList * -get_content_types(BonoboPersist *persist,CORBA_Environment *ev) -{ - return bonobo_persist_generate_content_types(2, "application/mathml+xml", "text/mathml"); -} - -static void -gtk_math_view_persist_stream_class_init(GtkMathViewPersistStreamClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS(klass); - BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS(klass); - POA_Bonobo_PersistStream__epv *epv = &klass->epv; - -#ifdef DEBUG - printf("persist stream class init\n"); -#endif - gtk_math_view_persist_stream_parent_class = g_type_class_peek_parent(klass); - - epv->load = load_implementation; - epv->save = save_implementation; - - object_class->finalize = finalize; - persist_class->get_content_types = get_content_types; -} - -GType -gtk_math_view_persist_stream_get_type(void) -{ - static GType type = 0; -#ifdef DEBUG - printf("persist stream get type\n"); -#endif - if (!type) - { - GTypeInfo info = - { - sizeof(GtkMathViewPersistStreamClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gtk_math_view_persist_stream_class_init, - NULL, /*class finalize */ - NULL, /*class data */ - sizeof(GtkMathViewPersistStream), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = bonobo_type_unique(BONOBO_TYPE_PERSIST, - POA_Bonobo_PersistStream__init,POA_Bonobo_PersistStream__fini, - G_STRUCT_OFFSET(GtkMathViewPersistStreamClass,epv), - &info,"GtkMathViewPersistStream"); - } - - return type; -} - -BonoboObject * -gtk_math_view_persist_stream_new(GtkMathView *math_view) -{ - BonoboObject *stream; - -#ifdef DEBUG - printf("persist stream new\n"); -#endif - stream = g_object_new(gtk_math_view_persist_stream_get_type(),NULL); - bonobo_persist_construct(BONOBO_PERSIST(stream),CONTROL_FACTORY_ID); - - g_object_ref(math_view); - GTK_MATH_VIEW_PERSIST_STREAM(stream)->math_view = math_view; - - return stream; -} - -static FILE* -create_tmp_file(GtkMathViewPersistStream *persist) -{ - FILE *tmpfile; - int fd; - - persist->tmp_path_name = g_strconcat(g_get_tmp_dir(), "/gmvXXXXXX", NULL); - if ((fd = mkstemp(persist->tmp_path_name)) < 0) - { - g_free(persist->tmp_path_name), - persist->tmp_path_name = NULL; - return NULL; - } - - tmpfile = fdopen(fd, "w"); - if(!tmpfile) - { - close(fd); - return NULL; - } - - return tmpfile; -} - - -static void -load_implementation(PortableServer_Servant servant, - Bonobo_PersistStream stream, - const CORBA_char *type, - CORBA_Environment *ev) -{ - GtkMathViewPersistStream *persist = GTK_MATH_VIEW_PERSIST_STREAM (bonobo_object_from_servant (servant)); - Bonobo_Stream_iobuf *buffer; - GtkMathViewPersistStream *handle; - CORBA_long len_read; - gboolean result; - FILE *tmpfile; - -#ifdef DEBUG - printf("persist stream loading\n"); -#endif - - if (strcmp (type, "application/mathml+xml") != 0) - { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - tmpfile = create_tmp_file(persist); - do - { - Bonobo_Stream_read (stream, 4096, &buffer, ev); - if (ev->_major != CORBA_NO_EXCEPTION) - goto clean; - - len_read = buffer->_length; - - if (buffer->_buffer && len_read) - if (fwrite(buffer->_buffer, 1, len_read, tmpfile) != len_read) - { - CORBA_free (buffer); - goto clean; - } - - CORBA_free (buffer); - } while (len_read > 0); - - fclose(tmpfile); - - result = gtk_math_view_load_uri(persist->math_view,persist->tmp_path_name); - if(!result) - { - CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL); - } - return ; - - clean: - fclose (tmpfile); - return; -} - -static void -save_implementation(PortableServer_Servant servant,const Bonobo_Stream stream,const CORBA_char *type,CORBA_Environment *ev) -{ - bonobo_exception_set(ev,"save_exception"); - bonobo_exception_add_handler_str("save_exception", - "Save option is not valid"); - return; -} diff --git a/helm/gtkmathview-bonobo/src/persist-stream.h b/helm/gtkmathview-bonobo/src/persist-stream.h deleted file mode 100644 index 848121436..000000000 --- a/helm/gtkmathview-bonobo/src/persist-stream.h +++ /dev/null @@ -1,59 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __GTK_MATH_VIEW_PERSIST_STREAM_H__ -#define __GTK_MATH_VIEW_PERSIST_STREAM_H__ - -#include -#include - -G_BEGIN_DECLS - -struct _GtkMathViewPersistStream; -typedef struct _GtkMathViewPersistStream GtkMathViewPersistStream; -typedef struct _GtkMathViewPersistStreamPrivate GtkMathViewPersistStreamPrivate; - -#define GTK_MATH_VIEW_TYPE_PERSIST_STREAM (gtk_math_view_persist_stream_get_type()) -#define GTK_MATH_VIEW_PERSIST_STREAM(object) (G_TYPE_CHECK_INSTANCE_CAST((object), GTK_MATH_VIEW_TYPE_PERSIST_STREAM,GtkMathViewPersistStream)) -#define GTK_MATH_VIEW_IS_PERSIST_STREAM(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), GTK_MATH_VIEW_TYPE_PERSIST_STREAM)) -#define GTK_MATH_VIEW_IS_PERSIST_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_MATH_VIEW_TYPE_PERSIST_STREAM)) - -struct _GtkMathViewPersistStream -{ - BonoboPersist parent; - GtkMathView *math_view; - gchar* tmp_path_name; -}; - -typedef struct -{ - BonoboPersistClass parent_class; - POA_Bonobo_PersistStream__epv epv; -} GtkMathViewPersistStreamClass; - -GType gtk_math_view_persist_stream_get_type(void); -BonoboObject *gtk_math_view_persist_stream_new(GtkMathView *); - -G_END_DECLS - -#endif diff --git a/helm/gtkmathview-bonobo/src/view.c b/helm/gtkmathview-bonobo/src/view.c deleted file mode 100644 index 068558d25..000000000 --- a/helm/gtkmathview-bonobo/src/view.c +++ /dev/null @@ -1,361 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#include - -#define HAVE_GMETADOM -#include - -#include "aux.h" -#include "view.h" - -static GObjectClass* view_parent_class; - -static void -view_object_finalize(GObject* object) -{ - View* view = VIEW(object); - /* free resources */ - view_parent_class->finalize(object); - return; -} - -static void -impl_view_freeze(PortableServer_Servant servant, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_freeze(view->control_data->math_view); - return; -} - -static void -impl_view_thaw(PortableServer_Servant servant, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_thaw(view->control_data->math_view); - return; -} - -static CORBA_boolean -impl_view_load(PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - return gtk_math_view_load_uri(view->control_data->math_view, uri); -} - -static void -impl_view_unload(PortableServer_Servant servant, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_unload(view->control_data->math_view); -} - -static void -impl_view_setIdAttribute (PortableServer_Servant servant, - const CORBA_char *ns, - const CORBA_char *name, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_control_data_set_id_attribute(view->control_data, ns, name); -} - -static void -impl_view_getIdAttribute (PortableServer_Servant servant, - CORBA_string *ns, - CORBA_string *name, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - if (view->control_data->id_ns_uri != NULL) - *ns = CORBA_string_dup(view->control_data->id_ns_uri->str); - else - *ns = NULL; - - if (view->control_data->id_name != NULL) - *name = CORBA_string_dup(view->control_data->id_name); - else - *name = NULL; -} - -static void -impl_view_select(PortableServer_Servant servant, - const CORBA_char *id, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); - if (root != NULL) - { - GdomeException exc = 0; - GdomeElement* el = find_element_by_id(root, - view->control_data->id_ns_uri, - view->control_data->id_name, - id); - if (el != NULL) - { - gtk_math_view_select(view->control_data->math_view, el); - gdome_el_unref(el, &exc); - g_assert(exc == 0); - } - gdome_el_unref(root, &exc); - g_assert(exc == 0); - } -} - -static void -impl_view_unselect(PortableServer_Servant servant, - const CORBA_char *id, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); - if (root != NULL) - { - GdomeException exc = 0; - GdomeElement* el = find_element_by_id(root, - view->control_data->id_ns_uri, - view->control_data->id_name, - id); - if (el != NULL) - { - gtk_math_view_unselect(view->control_data->math_view, el); - gdome_el_unref(el, &exc); - g_assert(exc == 0); - } - gdome_el_unref(root, &exc); - g_assert(exc == 0); - } -} - -static CORBA_boolean -impl_view_isSelected(PortableServer_Servant servant, - const CORBA_char *id, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); - CORBA_boolean res = CORBA_FALSE; - if (root != NULL) - { - GdomeException exc = 0; - GdomeElement* el = find_element_by_id(root, - view->control_data->id_ns_uri, - view->control_data->id_name, - id); - if (el != NULL) - { - res = gtk_math_view_is_selected(view->control_data->math_view, el) ? CORBA_TRUE : CORBA_FALSE; - gdome_el_unref(el, &exc); - g_assert(exc == 0); - } - gdome_el_unref(root, &exc); - g_assert(exc == 0); - } - return res; -} - -static CORBA_boolean -impl_view_elementCoords(PortableServer_Servant servant, - const CORBA_char *id, - CORBA_short *x, CORBA_short *y, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); - CORBA_boolean res = CORBA_FALSE; - if (root != NULL) - { - GdomeException exc = 0; - GdomeElement* el = find_element_by_id(root, - view->control_data->id_ns_uri, - view->control_data->id_name, - id); - if (el != NULL) - { - gint xx; - gint yy; - res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &xx, &yy) ? CORBA_TRUE : CORBA_FALSE; - gdome_el_unref(el, &exc); - g_assert(exc == 0); - *x = xx; - *y = yy; - } - gdome_el_unref(root, &exc); - g_assert(exc == 0); - } - return res; -} - -static CORBA_boolean -impl_view_elementBoundingBox(PortableServer_Servant servant, - const CORBA_char *id, - CORBA_short *width, CORBA_short *height, CORBA_short *depth, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view); - CORBA_boolean res = CORBA_FALSE; - if (root != NULL) - { - GdomeException exc = 0; - GdomeElement* el = find_element_by_id(root, - view->control_data->id_ns_uri, - view->control_data->id_name, - id); - if (el != NULL) - { - gint w; - gint h; - gint d; - res = gtk_math_view_get_element_bounding_box(view->control_data->math_view, el, &w, &h, &d) ? CORBA_TRUE : CORBA_FALSE; - gdome_el_unref(el, &exc); - g_assert(exc == 0); - *width = w; - *height = h; - *depth = d; - } - gdome_el_unref(root, &exc); - g_assert(exc == 0); - } - return res; -} - -static void -impl_view_getSize(PortableServer_Servant servant, - CORBA_short *width, CORBA_short *height, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - *width = gtk_math_view_get_width(view->control_data->math_view); - *height = gtk_math_view_get_height(view->control_data->math_view); -} - -static void -impl_view_getTop(PortableServer_Servant servant, - CORBA_short *x, CORBA_short *y, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gint xx; - gint yy; - gtk_math_view_get_top(view->control_data->math_view, &xx, &yy); - *x = xx; - *y = yy; -} - -static void -impl_view_setTop (PortableServer_Servant servant, - CORBA_short x, CORBA_short y, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_set_top(view->control_data->math_view, x, y); -} - -static void -impl_view_setDefaultFontSize(PortableServer_Servant servant, - CORBA_short size, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_set_font_size(view->control_data->math_view, size); -} - -static short -impl_view_getDefaultFontSize(PortableServer_Servant servant, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - return gtk_math_view_get_font_size(view->control_data->math_view); -} - -static void -impl_view_setVerbosity(PortableServer_Servant servant, - const CORBA_short level, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - gtk_math_view_set_log_verbosity(view->control_data->math_view, level); -} - -static short -impl_view_getVerbosity(PortableServer_Servant servant, - CORBA_Environment *ev) -{ - View* view = VIEW (bonobo_object (servant)); - return gtk_math_view_get_log_verbosity(view->control_data->math_view); -} - -static void -view_class_init(ViewClass* klass) -{ - GObjectClass* object_class = (GObjectClass *) klass; - POA_GNOME_GtkMathView_View__epv* epv = &klass->epv; - - view_parent_class = g_type_class_peek_parent (klass); - object_class->finalize = view_object_finalize; - - epv->freeze = impl_view_freeze; - epv->thaw = impl_view_thaw; - epv->load = impl_view_load; - epv->unload = impl_view_unload; - epv->setIdAttribute = impl_view_setIdAttribute; - epv->getIdAttribute = impl_view_getIdAttribute; - epv->select = impl_view_select; - epv->unselect = impl_view_unselect; - epv->isSelected = impl_view_isSelected; - epv->elementCoords = impl_view_elementCoords; - epv->elementBoundingBox = impl_view_elementBoundingBox; - epv->getSize = impl_view_getSize; - epv->getTop = impl_view_getTop; - epv->setTop = impl_view_setTop; - epv->setDefaultFontSize = impl_view_setDefaultFontSize; - epv->getDefaultFontSize = impl_view_getDefaultFontSize; - epv->setVerbosity = impl_view_setVerbosity; - epv->getVerbosity = impl_view_getVerbosity; -} - -static void -view_init(View* view) -{ - /* do some initialization */ -} - -View* -view_new(GtkMathViewControlData* control_data) -{ - View* view; - g_return_val_if_fail(control_data != NULL, NULL); - view = g_object_new(VIEW_TYPE, NULL); - view->control_data = control_data; - return view; -} - -BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view) - diff --git a/helm/gtkmathview-bonobo/src/view.h b/helm/gtkmathview-bonobo/src/view.h deleted file mode 100644 index 86394bec5..000000000 --- a/helm/gtkmathview-bonobo/src/view.h +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. - * Copyright (C) 2003 Luca Padovani - * Pouria Masoudi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For more information, please visit the project's home page - * http://helm.cs.unibo.it/gtkmathview-bonobo - * or send an email to - */ - -#ifndef __view_h__ -#define __view_h__ - -#include - -#include "GtkMathView.h" -#include "control-data.h" - -#define VIEW_TYPE (view_get_type()) -#define VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), VIEW_TYPE, View)) -#define VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), VIEW_TYPE, ViewClass)) -#define VIEW_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), VIEW_TYPE)) -#define VIEW_IS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), VIEW_TYPE)) -#define VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), VIEW_TYPE, ViewClass)) - -typedef struct { - BonoboObject parent; - GtkMathViewControlData* control_data; -} View; - -typedef struct { - BonoboObjectClass parent_class; - POA_GNOME_GtkMathView_View__epv epv; -} ViewClass; - -GType view_get_type(void); -View* view_new(GtkMathViewControlData*); - -#endif /* __view_h__ */ - diff --git a/helm/gtkmathview-bonobo/test/.cvsignore b/helm/gtkmathview-bonobo/test/.cvsignore deleted file mode 100644 index 46490baa4..000000000 --- a/helm/gtkmathview-bonobo/test/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -viewer -Makefile -Makefile.in diff --git a/helm/gtkmathview-bonobo/test/Makefile.am b/helm/gtkmathview-bonobo/test/Makefile.am deleted file mode 100644 index 204ae3dfc..000000000 --- a/helm/gtkmathview-bonobo/test/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ - -noinst_PROGRAMS = viewer - -viewer_SOURCES = \ - main.c \ - $(top_srcdir)/src/GtkMathView-common.c \ - $(top_srcdir)/src/GtkMathView-stubs.c - -viewer_LDADD = \ - $(BONOBOUI_LIBS) \ - $(BONOBO_LIBS) \ - $(GNOMEUI_LIBS) - -AM_CFLAGS = \ - -DPREFIX=\""$(prefix)"\" \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DLIBDIR=\""$(datadir)"\" - -INCLUDES = \ - $(BONOBOUI_CFLAGS) \ - $(BONOBO_CFLAGS) \ - $(GNOMEUI_CFLAGS) \ - -I$(top_srcdir)/src - diff --git a/helm/gtkmathview-bonobo/test/embedding.html b/helm/gtkmathview-bonobo/test/embedding.html deleted file mode 100644 index 674012ff4..000000000 --- a/helm/gtkmathview-bonobo/test/embedding.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - -

GtkMathView-Bonobo test page

- - The embedded object should display a mathematical formula. -
- - - - - x - 2 - - = - click for the answer - - - -
- -
- - - - - diff --git a/helm/gtkmathview-bonobo/test/embedding.xml b/helm/gtkmathview-bonobo/test/embedding.xml deleted file mode 100644 index 57fe49a87..000000000 --- a/helm/gtkmathview-bonobo/test/embedding.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - -

GtkMathView-Bonobo test page

- - The embedded object should display a mathematical formula. -
- - - - - x - 2 - - = - click for the answer - - - -
- Size -
- - - - - diff --git a/helm/gtkmathview-bonobo/test/main.c b/helm/gtkmathview-bonobo/test/main.c deleted file mode 100644 index e737329ec..000000000 --- a/helm/gtkmathview-bonobo/test/main.c +++ /dev/null @@ -1,476 +0,0 @@ -#include -#include -#include -#include - -#include "control-factory.h" -#include "GtkMathView.h" - -static GtkWidget *control; - -typedef enum{LOAD_STREAM,LOAD_FILE,NONE}FileSelectionOp; - -struct FileSelectionInfo { - BonoboWidget* control; - GtkWidget* widget; - - FileSelectionOp Operations; -}; - - -static struct FileSelectionInfo file_selection_info = { NULL, NULL,NONE}; - -static void -file_selection_destroy_cb (GtkWidget *widget,gpointer data) -{ - file_selection_info.widget = NULL; -} - - -static void -load_through_persist_file (const gchar *filename, - Bonobo_PersistFile pfile) -{ - CORBA_Environment ev; - CORBA_exception_init (&ev); - Bonobo_PersistFile_load (pfile, filename, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Cannot load."); - CORBA_exception_free (&ev); -} - -static void -load_through_persist_stream(const gchar *filename, - Bonobo_PersistStream pstream) -{ - BonoboObject *stream = NULL; - CORBA_Environment ev; - CORBA_exception_init (&ev); - -#if 0 - stream = bonobo_stream_open ("fs", filename, - Bonobo_Storage_READ, 0); -#endif - - /*if (stream == NULL) - { - g_warning ("Couldn't load `%s'\n", filename); - } else*/ { - Bonobo_Stream corba_stream; - corba_stream = bonobo_object_corba_objref (stream); - Bonobo_Stream_truncate (corba_stream, 0, &ev); - Bonobo_PersistStream_load (pstream, corba_stream, "application/mathml+xml", &ev); - } - Bonobo_Unknown_unref (pstream, &ev); - CORBA_Object_release (pstream, &ev); - CORBA_exception_free (&ev); -} - -static void -file_selection_ok_cb (GtkWidget *widget, - gpointer data) -{ - CORBA_Object interface; - const gchar *interface_name; - CORBA_Environment ev; - - if (file_selection_info.Operations == LOAD_FILE) - interface_name = "IDL:Bonobo/PersistFile:1.0"; - else if(file_selection_info.Operations == LOAD_STREAM) - interface_name = "IDL:Bonobo/PersistStream:1.0"; - else printf("failed to get operation type\n"); - - CORBA_exception_init (&ev); - interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (file_selection_info.control), - interface_name, &ev); - CORBA_exception_free (&ev); - - if (interface == CORBA_OBJECT_NIL) - { - g_warning ("The Control does not seem to support `%s'.", interface_name); - } - else - { - const gchar *fname; - fname = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection_info.widget)); - switch (file_selection_info.Operations) { - case LOAD_STREAM: - load_through_persist_stream (fname, interface); - break; - case LOAD_FILE: - load_through_persist_file (fname, interface); - break; - } - } - - gtk_widget_destroy (file_selection_info.widget); -} - -static void -open_dialog (BonoboWindow *app, - FileSelectionOp operation) -{ - GtkWidget *widget; - BonoboWidget *control; - - control = BONOBO_WIDGET (bonobo_window_get_contents (app)); - - if (file_selection_info.widget != NULL) { - gdk_window_show (GTK_WIDGET (file_selection_info.widget)->window); - return; - } - - if(operation == LOAD_STREAM) - widget = gtk_file_selection_new(_("Open Stream....")); - if(operation == LOAD_FILE) - widget = gtk_file_selection_new (_("Open file...")); - - gtk_window_set_transient_for (GTK_WINDOW (widget), - GTK_WINDOW (app)); - - file_selection_info.widget = widget; - file_selection_info.control = control; - file_selection_info.Operations = operation; - - g_signal_connect_object (GTK_FILE_SELECTION (widget)->cancel_button, - "clicked", G_CALLBACK (gtk_widget_destroy), widget, G_CONNECT_AFTER); - - g_signal_connect (GTK_FILE_SELECTION (widget)->ok_button, "clicked", G_CALLBACK (file_selection_ok_cb), NULL); - - g_signal_connect (file_selection_info.widget, "destroy", G_CALLBACK (file_selection_destroy_cb), NULL); - - gtk_widget_show (file_selection_info.widget); -} - -/* "Open through persist file" dialog. */ -static void -open_through_persist_file_cb (GtkWidget *widget, - gpointer data) -{ - open_dialog (BONOBO_WINDOW (data), LOAD_FILE); -} - -static void -open_through_persist_stream_cb(GtkWidget *widget, - gpointer data) -{ - open_dialog(BONOBO_WINDOW(data), LOAD_STREAM); -} - -static void -test_view(GtkWidget* widget, gpointer data) -{ - CORBA_Object interface; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (bonobo_window_get_contents (BONOBO_WINDOW(data)))), - "IDL:GNOME/GtkMathView/View:1.0", &ev); - CORBA_exception_free (&ev); - - if (interface == CORBA_OBJECT_NIL) - { - g_warning ("The Control does not seem to support `View'."); - } - - CORBA_exception_init (&ev); - GNOME_GtkMathView_View_freeze(interface, &ev); - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - GNOME_GtkMathView_View_thaw(interface, &ev); - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - Bonobo_Unknown_unref (interface, &ev); - CORBA_Object_release (interface, &ev); - CORBA_exception_free (&ev); -} - -static void -exit_cb (GtkWidget *widget, - gpointer data) -{ - gtk_widget_destroy (GTK_WIDGET (data)); - bonobo_main_quit (); -} - -static void -get_size(GtkWidget *widget, - gpointer data) -{ - gint width,height; - BonoboWidget* control; - BonoboControlFrame* control_frame; - - Bonobo_PropertyBag prop_bag; - - control = BONOBO_WIDGET (bonobo_window_get_contents (BONOBO_WINDOW (data))); - control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); - prop_bag = bonobo_control_frame_get_control_property_bag(control_frame, NULL); - - width = bonobo_pbclient_get_long(prop_bag,"width",NULL); - height = bonobo_pbclient_get_long(prop_bag,"height",NULL); - - printf("Width: %d Height: %d\n",width,height); - - bonobo_object_release_unref (prop_bag,NULL); - -}; - -static void -get_top(GtkWidget *widget, - gpointer data) -{ - gint top_x,top_y; - BonoboWidget* control; - BonoboControlFrame* control_frame; - Bonobo_PropertyBag prop_bag; - - control = BONOBO_WIDGET(bonobo_window_get_contents(BONOBO_WINDOW(data))); - control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); - prop_bag = bonobo_control_frame_get_control_property_bag(control_frame,NULL); - - top_x = bonobo_pbclient_get_long(prop_bag,"top-x",NULL); - top_y = bonobo_pbclient_get_long(prop_bag,"top-y",NULL); - - printf("Top X: %d ,Top Y: %d\n",top_x,top_y); - - bonobo_object_release_unref(prop_bag,NULL); -} - -static void -get_font_size(GtkWidget *widget, - gpointer data) -{ - gint font_size; - BonoboWidget* control; - BonoboControlFrame* control_frame; - Bonobo_PropertyBag prop_bag; - - control = BONOBO_WIDGET(bonobo_window_get_contents(BONOBO_WINDOW(data))); - control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); - prop_bag = bonobo_control_frame_get_control_property_bag(control_frame,NULL); - - font_size = bonobo_pbclient_get_long(prop_bag,"font-size",NULL); - - printf("FontSize : %d\n",font_size); - - bonobo_object_release_unref(prop_bag,NULL); -} - -static void -get_verbosity(GtkWidget *widget, - gpointer data) -{ - gint verbosity; - BonoboWidget* control; - BonoboControlFrame* control_frame; - Bonobo_PropertyBag prop_bag; - - control = BONOBO_WIDGET(bonobo_window_get_contents(BONOBO_WINDOW(data))); - control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); - prop_bag = bonobo_control_frame_get_control_property_bag(control_frame,NULL); - - verbosity = bonobo_pbclient_get_long(prop_bag,"verbosity",NULL); - - printf("Verbosity: %d\n",verbosity); - - bonobo_object_release_unref(prop_bag,NULL); -} - -static BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("OpenFile", open_through_persist_file_cb), - BONOBO_UI_UNSAFE_VERB ("OpenStream", open_through_persist_stream_cb), - BONOBO_UI_UNSAFE_VERB ("TestView", test_view), - BONOBO_UI_UNSAFE_VERB ("Size", get_size), - BONOBO_UI_UNSAFE_VERB ("Top", get_top), - BONOBO_UI_UNSAFE_VERB ("Font Size", get_font_size), - BONOBO_UI_UNSAFE_VERB ("Verbosity", get_verbosity), - BONOBO_UI_UNSAFE_VERB ("FileExit", exit_cb), - BONOBO_UI_VERB_END -}; - -/* A dirty, non-translatable hack */ -static char ui [] = -"" -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " - -" " - -" " - -" " -" " -" " -" " -" " -""; - -static int -app_delete_cb (GtkWidget *widget, GdkEvent *event, gpointer dummy) -{ - gtk_widget_destroy (GTK_WIDGET (widget)); - bonobo_main_quit (); - - return FALSE; -} - -static guint -container_create (void) -{ - GtkWidget *win; - GtkWindow *window; - BonoboUIComponent *component; - BonoboUIContainer *container; - CORBA_Environment ev; - - - win = bonobo_window_new ("test-editor", - "GtkMathView Control Test"); - window = GTK_WINDOW (win); - - container = bonobo_window_get_ui_container (BONOBO_WINDOW (win)); - - g_signal_connect (window, "delete_event", G_CALLBACK (app_delete_cb), NULL); - - gtk_window_set_default_size (window, 600, 440); - gtk_window_set_resizable (window, TRUE); - - component = bonobo_ui_component_new ("test"); - bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (component)); - - bonobo_ui_component_set_container (component, BONOBO_OBJREF (container), NULL); - bonobo_ui_component_add_verb_list_with_data (component, verbs, win); - bonobo_ui_component_set_translate (component, "/", ui, NULL); - - control = bonobo_widget_new_control (CONTROL_ID, BONOBO_OBJREF (container)); - - if (control == NULL) - g_error ("Cannot get `%s'.", CONTROL_ID); - - bonobo_window_set_contents (BONOBO_WINDOW (win), control); - - gtk_widget_show_all (GTK_WIDGET (window)); - - CORBA_exception_init (&ev); - - return FALSE; -} - -static gint -load_file (const gchar *fname) -{ - CORBA_Object interface; - CORBA_Environment ev; - - printf ("loading: %s\n", fname); - CORBA_exception_init (&ev); - interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (control)), - "IDL:Bonobo/PersistFile:1.0", &ev); - CORBA_exception_free (&ev); - load_through_persist_file (fname, interface); - - return FALSE; -} - -static gint -load_file_stream(const gchar *fname) -{ - CORBA_Object interface; - CORBA_Environment ev; - - printf("loading with stream %s\n",fname); - CORBA_exception_init(&ev); - interface = Bonobo_Unknown_queryInterface(bonobo_widget_get_objref(BONOBO_WIDGET(control)), - "IDL:Bonobo/PersistStream:1.0",&ev); - - CORBA_exception_free(&ev); - load_through_persist_stream(fname,interface); - - return FALSE; -} - -/* -static void -install_property_bag_listener (BonoboWidget *control, BonoboWindow *bonobo_win) -{ - Bonobo_Listener corba_listener; - BonoboListener *listener; - BonoboControlFrame *control_frame; - CORBA_Environment ev; - Bonobo_PropertyBag prop_bag; - - CORBA_exception_init(&ev); - - control_frame = bonobo_widget_get_control_frame(BONOBO_WIDGET(control)); - if(!control_frame) - g_error("can't find control frame\n"); - - prop_bag = bonobo_control_frame_get_control_property_bag(control_frame, NULL); - if(prop_bag == CORBA_OBJECT_NIL) - g_error("can't connect to property bag\n"); - - //connect a listener to the property bag - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn) width_changed, - "Bonobo/Property:change:width",NULL,bonobo_win); - - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)height_changed, - "Bonobo/Property:change:height",NULL,bonobo_win); - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)top_x_changed, - "Bonobo/Property:change:top-x",NULL,bonobo_win); - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)top_y_changed, - "Bonobo/Property:change:top-y",NULL,bonobo_win); - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)font_size_changed, - "Bonobo/Property:change:font-size",NULL,bonobo_win); - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)anti_aliasing_changed, - "Bonobo/Property:change:verbosity",NULL,bonobo_win); - bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)font_manager_changed, - "Bonobo/Property:change:font_manager",NULL,bonobo_win); - CORBA_exception_free(&ev); -}*/ - - -int -main (int argc, char **argv) -{ - gnome_program_init("test-editor", VERSION, LIBGNOMEUI_MODULE, argc, argv, - GNOME_PROGRAM_STANDARD_PROPERTIES, - GNOME_PARAM_HUMAN_READABLE_NAME, _("GtkMathView Test Container"), - NULL); - - bonobo_activate (); - - /* We can't make any CORBA calls unless we're in the main loop. So we - delay creating the container here. */ - gtk_idle_add ((GtkFunction) container_create, NULL); - if (argc > 1 && *argv [argc - 1] != '-') - gtk_idle_add ((GtkFunction) load_file, argv [argc - 1]); - - bonobo_activate (); - bonobo_main (); - - return bonobo_ui_debug_shutdown (); -} diff --git a/helm/gtkmathview-bonobo/test/test.mml b/helm/gtkmathview-bonobo/test/test.mml deleted file mode 100644 index 2436838bf..000000000 --- a/helm/gtkmathview-bonobo/test/test.mml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - a - - x - - + - b - - - - x - 2 - - + - - p - - x - - + - q - - - - ... - - d - x - = - - - a2 - - - ln - - - ( - - x2 - + - - p - - x - - + - q - - ) - - - - + - - - - - 2 - - b - - - - - a - - p - - - - - - 4 - - q - - - - - p - 2 - - - - - - - arctg - - - - - 2 - - x - - + - p - - - - - 4 - - q - - - - - p - 2 - - - - - - - + - c - - - go to Luca's home page - diff --git a/helm/gtkmathview-bonobo/test/testembedding.html b/helm/gtkmathview-bonobo/test/testembedding.html deleted file mode 100644 index e894388d6..000000000 --- a/helm/gtkmathview-bonobo/test/testembedding.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

GtkMathView-Bonobo test page

- -The embedded object should display a mathematical formula. -
-
- -No viewer capable of displaying the test document installed. - - - -