--- /dev/null
+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
--- /dev/null
+Luca Padovani <lpadovan@cs.unibo.it>
+Pouria Masoudi <pmasoudi@cs.unibo.it>
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
--- /dev/null
+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 \
+ )
+
--- /dev/null
+
+Tue, 15 Jul 2003 15:56:54 +0200
+
+ o The project formally starts
+
--- /dev/null
+
+* 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 <PARAM> 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
+
+
--- /dev/null
+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 <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#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
--- /dev/null
+# 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@
+
--- /dev/null
+Makefile
+Makefile.in
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <Bonobo.idl>
+
+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 ();
+
+ };
+
+ };
+
+};
+
--- /dev/null
+
+idldir = $(datadir)/idl/bonobo-2.0
+idl_DATA = GtkMathView.idl
+
+EXTRA_DIST = $(idl_DATA)
--- /dev/null
+.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
--- /dev/null
+<oaf_info>
+
+<oaf_server iid="OAFIID:GNOME_GtkMathView_Factory:@GTKMATHVIEW_API_VERSION@" type="shlib"
+ location="@GTKMATHVIEW_FACTORY_LOCATION@">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="name" type="string" value="Gtk MathML Viewer Factory"/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_GtkMathView:@GTKMATHVIEW_API_VERSION@" type="factory" location="OAFIID:GNOME_GtkMathView_Factory:@GTKMATHVIEW_API_VERSION@">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/GtkMathView/View:1.0"/>
+ <item value="IDL:Bonobo/Control:1.0"/>
+ <item value="IDL:Bonobo/Unkown:1.0"/>
+ <item value="IDL:Bonobo/PersistFile:1.0"/>
+ <item value="IDL:Bonobo/PersistStream:1.0"/>
+ <item value="IDL:Bonobo/Persist:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="name" type="string" value="GtkMathView"/>
+
+ <oaf_attribute name="description" type="string" value="GtkMathView"/>
+ <oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
+ <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
+ <item value="application/mathml+xml"/>
+ <item value="text/mathml"/>
+ </oaf_attribute>
+</oaf_server>
+
+</oaf_info>
--- /dev/null
+
+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)
+
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#include <cassert>
+
+#include <sstream>
+
+#include <gdome.h>
+#include <gdome-util.h>
+
+#include <GdomeSmartDOM.hh>
+
+#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());
+}
+
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __aux_h__
+#define __aux_h__
+
+#include <gdome.h>
+
+#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__
+
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#include <gdome.h>
+
+#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);
+}
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __control_data_h__
+#define __control_data_h__
+
+#include <bonobo.h>
+#include <gtkmathview.h>
+#include <gdome.h>
+
+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__
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#include <bonobo.h>
+#include <bonobo/bonobo-shlib-factory.h>
+#include <gtkmathview.h>
+
+#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 <maction>", NULL, activate_maction, 0, "<StockItem>", GTK_STOCK_EXECUTE },
+ { "/Copy Link Address", NULL, copy_link_address, 0, "<StockItem>", GTK_STOCK_COPY },
+ /* { "/Jump To", NULL, NULL, 0, "<StockItem>", GTK_STOCK_JUMP_TO }, */
+ { "/sep1", NULL, NULL, 0, "<Separator>" },
+ /* { "/Semantic Selection", NULL, switch_semantic_selection, 0, "<CheckItem>" }, */
+ /* { "/Copy Selected Markup", NULL, copy_selected_markup, 0, "<Item>" }, */
+ /* { "/Copy Id", NULL, copy_selected_id, 0, "<Item>" }, */
+ /* { "/Show Selected", NULL, NULL, 0, "<Item>" }, */
+ { "/Select Parent", NULL, select_parent, 0, "<Item>" },
+ { "/De-Select", NULL, deselect, 0, "<StockItem>", GTK_STOCK_CLEAR },
+ { "/sep2", NULL, NULL, 0, "<Separator>" },
+ { "/Smaller", NULL, zoom_out, 0, "<StockItem>", GTK_STOCK_ZOOM_OUT },
+ { "/Bigger", NULL, zoom_in, 0, "<StockItem>", GTK_STOCK_ZOOM_IN },
+ /* { "/Properties...", NULL, NULL, 0, "<StockItem>", 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, "<main>", 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, "<main>"); */
+ /* 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);
+
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __control_factory_h__
+#define __control_factory_h__
+
+#include <config.h>
+#include <bonobo.h>
+#include <bonobo/bonobo-control.h>
+
+#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__ */
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#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;
+ }
+}
+
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __handlers_h__
+#define __handlers_h__
+
+#include <bonobo.h>
+#include <gdome.h>
+#include <gtkmathview.h>
+
+#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__
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#include <bonobo.h>
+#include <gtkmathview.h>
+#include <glib.h>
+
+#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");
+}
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __GTK_MATH_VIEW_PERSIST_FILE_H__
+#define __GTK_MATH_VIEW_PERSIST_FILE_H__
+
+#include <bonobo/bonobo-persist.h>
+#include <gtkmathview.h>
+
+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
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#include <bonobo.h>
+#include <gtkmathview.h>
+
+#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;
+}
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __GTK_MATH_VIEW_PERSIST_STREAM_H__
+#define __GTK_MATH_VIEW_PERSIST_STREAM_H__
+
+#include <bonobo/bonobo-persist.h>
+#include <gtkmathview.h>
+
+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
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#include <config.h>
+
+#define HAVE_GMETADOM
+#include <gtkmathview.h>
+
+#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)
+
--- /dev/null
+/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
+ * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
+ * Pouria Masoudi <pmasoudi@cs.unibo.it>
+ *
+ * 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 <lpadovan@cs.unibo.it>
+ */
+
+#ifndef __view_h__
+#define __view_h__
+
+#include <bonobo.h>
+
+#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__ */
+
--- /dev/null
+.deps
+.libs
+viewer
+Makefile
+Makefile.in
--- /dev/null
+
+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
+
--- /dev/null
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <script language="JavaScript">
+<!--
+ function set_object_size(id, width, height)
+ {
+ document[id].width = width;
+ document[id].height = height;
+ }
+-->
+ </script>
+</head>
+
+<body>
+
+ <h1>GtkMathView-Bonobo test page</h1>
+
+ The embedded object should display a mathematical formula.
+ <br />
+
+ <object name="MATH" data="#math1" width="500" height="100" type="application/mathml+xml">
+ <math id="math1" display="block" xmlns="http://www.w3.org/1998/Math/MathML">
+ <mfrac>
+ <mi href="http://www.google.it">x</mi>
+ <mn>2</mn>
+ </mfrac>
+ <mo>=</mo>
+ <mtext href="javascript:alert('like if I can do that')">click for the answer</mtext>
+ </math>
+ </object>
+
+ <form name="test">
+ <input name="eccolo" type="button" onClick="set_object_size('MATH', 100, 50)" value="Size"/>
+ </form>
+
+</body>
+
+</html>
+
--- /dev/null
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <script language="JavaScript">
+<!--
+ function setSize(id, width, height)
+ {
+ document.elements[id].width = width;
+ document.elements[id].height = height;
+ document.elements['eccolo'].value = 'Ciao';
+ alert('hello!');
+ }
+-->
+ </script>
+</head>
+
+<body>
+
+ <h1>GtkMathView-Bonobo test page</h1>
+
+ The embedded object should display a mathematical formula.
+ <br />
+
+ <object name="MATH" data="#math1" width="500" height="100" type="application/mathml+xml">
+ <math id="math1" display="block" xmlns="http://www.w3.org/1998/Math/MathML">
+ <mfrac>
+ <mi href="http://www.google.it">x</mi>
+ <mn>2</mn>
+ </mfrac>
+ <mo>=</mo>
+ <mtext href="javascript:alert('like if I can do that')">click for the answer</mtext>
+ </math>
+ </object>
+
+ <form name="test">
+ <input name="eccolo" type="button" onClick="alert('hi')">Size</input>
+ </form>
+
+</body>
+
+</html>
+
--- /dev/null
+#include <config.h>
+#include <gnome.h>
+#include <bonobo.h>
+#include <glib.h>
+
+#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 [] =
+"<Root>"
+" <commands>"
+" <cmd name=\"FileExit\" _label=\"Exit\" _tip=\"Exit the program\""
+" pixtype=\"stock\" pixname=\"Exit\" accel=\"*Control*q\"/>"
+" <cmd name=\"FormatHTML\" _label=\"HTML mode\" type=\"toggle\" _tip=\"HTML Format switch\"/>"
+" </commands>"
+" <menu>"
+" <submenu name=\"File\" _label=\"_File\">"
+" <menuitem name=\"OpenFile\" verb=\"\" _label=\"Open (PersistFile)\" _tip=\"Open using the PersistFile interface\""
+" pixtype=\"stock\" pixname=\"Open\"/>"
+" <menuitem name=\"OpenStream\" verb=\"\" _label=\"_Open Stream (PersistStream)\" _tip=\"Open using the PersistStream interface\""
+" pixtype=\"stock\" pixname=\"Open Stream\"/>"
+" <separator/>"
+" <menuitem name=\"TestView\" verb=\"\" _label=\"Test View\" _tip=\"Test the View interface\"/>"
+" <separator/>"
+" <menuitem name=\"FileExit\" verb=\"\" _label=\"E_xit\"/>"
+" </submenu>"
+" <placeholder name=\"Component\"/>"
+" <submenu name=\"PropertyBags\" _label=\"Property_Bag\">"
+" <menuitem name=\"Size\" verb=\"\" _label=\"Size(PropertyBag)\" _tip=\"Get size\""
+" pixtype=\"stock\" pixname=\"Get Size\"/>"
+
+" <menuitem name=\"Top\" verb=\"\" _label=\"Top(PropertyBag)\" _tip=\"Get Top\""
+" pixtype=\"stock\" pixname=\"Get Top\"/>"
+
+" <menuitem name=\"Font Size\" verb=\"\" _label=\"Font Size(PropertyBag)\" _tip=\"Get FontSize\""
+" pixtype=\"stock\" pixname=\"Get FontSize\"/>"
+
+" <menuitem name=\"Verbosity\" verb=\"\" _label=\"Verbosity(PropertyBag)\" _tip=\"Get Verbosity\""
+" pixtype=\"stock\" pixname=\"Get Verbosity\"/>"
+" </submenu>"
+" </menu>"
+" <dockitem name=\"Toolbar\" behavior=\"exclusive\">"
+" </dockitem>"
+"</Root>";
+
+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 ();
+}
--- /dev/null
+<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
+ <maction>
+ <mrow>
+ <mo>∫</mo>
+ <mo>⁡</mo>
+ <mfrac>
+ <mrow>
+ <mrow>
+ <mi>a</mi>
+ <mo>⁢</mo>
+ <mi>x</mi>
+ </mrow>
+ <mo>+</mo>
+ <mi>b</mi>
+ </mrow>
+ <mrow>
+ <msup>
+ <mi>x</mi>
+ <mn>2</mn>
+ </msup>
+ <mo>+</mo>
+ <mrow>
+ <mi>p</mi>
+ <mo>⁢</mo>
+ <mi>x</mi>
+ </mrow>
+ <mo>+</mo>
+ <mi href="javascript:alert('You clicked on q')">q</mi>
+ </mrow>
+ </mfrac>
+ </mrow>
+ <mtable frame="solid" framespacing=".5em .5em"><mtr><mtd><mtext>...</mtext></mtd></mtr></mtable>
+ </maction>
+ <mo fontstyle="italic">d</mo>
+ <mi>x</mi>
+ <mo>=</mo>
+ <mrow>
+ <mrow>
+ <mfrac><mi>a</mi><mn>2</mn></mfrac>
+ <mo>⁢</mo>
+ <mrow>
+ <mi>ln</mi>
+ <mo>⁡</mo>
+ <mrow>
+ <mo>(</mo>
+ <mrow>
+ <msup><mi>x</mi><mn>2</mn></msup>
+ <mo>+</mo>
+ <mrow>
+ <mi>p</mi>
+ <mo>⁢</mo>
+ <mi>x</mi>
+ </mrow>
+ <mo>+</mo>
+ <mi>q</mi>
+ </mrow>
+ <mo>)</mo>
+ </mrow>
+ </mrow>
+ </mrow>
+ <mo>+</mo>
+ <mrow>
+ <mfrac>
+ <mrow>
+ <mrow>
+ <mn>2</mn>
+ <mo>⁢</mo>
+ <mi>b</mi>
+ </mrow>
+ <mo>-</mo>
+ <mrow>
+ <mi>a</mi>
+ <mo>⁢</mo>
+ <mi>p</mi>
+ </mrow>
+ </mrow>
+ <msqrt>
+ <mrow>
+ <mrow>
+ <mn>4</mn>
+ <mo>⁢</mo>
+ <mi>q</mi>
+ </mrow>
+ <mo>-</mo>
+ <msup>
+ <mi>p</mi>
+ <mn>2</mn>
+ </msup>
+ </mrow>
+ </msqrt>
+ </mfrac>
+ <mo>⁢</mo>
+ <mrow>
+ <mi>arctg</mi>
+ <mo>⁡</mo>
+ <mfrac>
+ <mrow>
+ <mrow>
+ <mn>2</mn>
+ <mo>⁢</mo>
+ <mi>x</mi>
+ </mrow>
+ <mo>+</mo>
+ <mi>p</mi>
+ </mrow>
+ <msqrt>
+ <mrow>
+ <mrow>
+ <mn>4</mn>
+ <mo>⁢</mo>
+ <mi>q</mi>
+ </mrow>
+ <mo>-</mo>
+ <msup>
+ <mi>p</mi>
+ <mn>2</mn>
+ </msup>
+ </mrow>
+ </msqrt>
+ </mfrac>
+ </mrow>
+ </mrow>
+ <mo>+</mo>
+ <mi href="javascript:alert('You clicked on c')">c</mi>
+ </mrow>
+ <mspace width="1cm"/>
+ <mtext href="http://www.cs.unibo.it/~lpadovan/">go to Luca's home page</mtext>
+</math>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+</head>
+<body>
+
+<h1>GtkMathView-Bonobo test page</h1>
+
+The embedded object should display a mathematical formula.
+<br />
+<br />
+<object data="test.mml" width="500" height="100" type="application/mathml+xml">
+No viewer capable of displaying the test document installed.
+</object>
+
+</body>
+</html>
+++ /dev/null
-*.cm[iox] *.o cicAnnotationHelper cicAnnotationHelper.opt
+++ /dev/null
-cicAnnotationHinter.cmo: cicAnnotationHinter.cmi
-cicAnnotationHinter.cmx: cicAnnotationHinter.cmi
-cicAnnotationHelper.cmo: cicAnnotationHinter.cmi
-cicAnnotationHelper.cmx: cicAnnotationHinter.cmx
+++ /dev/null
-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
+++ /dev/null
-(* 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 <sacerdot@cs.unibo.it> *)
-(* 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
-;;
+++ /dev/null
-(* 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 <sacerdot@cs.unibo.it> *)
-(* 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", "<attribute name = 'binder' id = '" ^ id ^ "'/>" |]
- | C.AVar (id,_) ->
- link_hints annotation_window
- [| "relURI???", "<attribute name = 'relUri' id = '" ^ id ^ "'/>" |]
- | C.AMeta (id,_,subst) ->
- let res =
- Array.append
- [| "Number", "<attribute name = 'no' id = '" ^ id ^ "'/>" |]
- (Array.mapi
- (fun i s ->
- match s with
- None ->
- "Argument " ^ string_of_int i, "_"
- | Some t ->
- "Argument " ^ string_of_int i, "<node id ='" ^ get_id t ^ "'/>"
- ) (Array.of_list subst)
- )
- in
- link_hints annotation_window res
- | C.ASort (id,_) ->
- link_hints annotation_window
- [| "Value", "<attribute name = 'value' id = '" ^ id ^ "'/>" |]
- | 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", "<node id = '" ^ boid ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- | C.AProd (id,_,ty,bo) ->
- let boid = get_id bo
- and tyid = get_id ty in
- link_hints annotation_window
- [| "Binder",
- "<attribute child = '2' name = 'binder' id = '" ^ id ^ "'/>" ;
- "Body", "<node id = '" ^ boid ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- | C.ALambda (id,_,ty,bo) ->
- let boid = get_id bo
- and tyid = get_id ty in
- link_hints annotation_window
- [| "Binder",
- "<attribute child = '2' name = 'binder' id = '" ^ id ^ "'/>" ;
- "Body", "<node id = '" ^ boid ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- | C.ALetIn (id,_,ty,bo) ->
- let boid = get_id bo
- and tyid = get_id ty in
- link_hints annotation_window
- [| "Binder",
- "<attribute child = '2' name = 'binder' id = '" ^ id ^ "'/>" ;
- "Term", "<node id = '" ^ boid ^ "'/>" ;
- "Target", "<node id = '" ^ tyid ^ "'/>"
- |]
- | C.AAppl (id,args) ->
- let argsid =
- Array.mapi
- (fun i te -> "Argument " ^ string_of_int i, "<node id ='" ^
- get_id te ^ "'/>")
- (Array.of_list args)
- in
- link_hints annotation_window argsid
- | C.AConst (id,_,_) ->
- link_hints annotation_window
- [| "Uri???", "<attribute name = 'uri' id = '" ^ id ^ "'/>" |]
- | C.AMutInd (id,_,_,_) ->
- link_hints annotation_window
- [| "Uri???", "<attribute name = 'uri' id = '" ^ id ^ "'/>" |]
- | C.AMutConstruct (id,_,_,_,_) ->
- link_hints annotation_window
- [| "Uri???", "<attribute name = 'uri' id = '" ^ id ^ "'/>" |]
- | 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, "<node id ='" ^
- get_id te ^ "'/>")
- (Array.of_list pl)
- in
- link_hints annotation_window
- (Array.append
- [| "Uri???", "<attribute name = 'uri' id = '" ^ id ^ "'/>" ;
- "Case Type", "<node id = '" ^ outtyid ^ "'/>" ;
- "Term", "<node id = '" ^ teid ^ "'/>" ;
- |]
- plid)
- | C.AFix (id,_,funl) ->
- let funtylid =
- Array.mapi
- (fun i (_,_,ty,_) ->
- "Type " ^ string_of_int i, "<node id ='" ^
- get_id ty ^ "'/>")
- (Array.of_list funl)
- and funbolid =
- Array.mapi
- (fun i (_,_,_,bo) ->
- "Body " ^ string_of_int i, "<node id ='" ^
- get_id bo ^ "'/>")
- (Array.of_list funl)
- and funnamel =
- Array.mapi
- (fun i (_,_,_,_) ->
- "Name " ^ string_of_int i, "<attribute id ='" ^ id ^
- "' name = 'name' child='" ^ string_of_int i ^ "'/>")
- (Array.of_list funl)
- and funrecindexl =
- Array.mapi
- (fun i (_,_,_,_) ->
- "Recursive Index??? " ^ string_of_int i, "<attribute id = '" ^ id ^
- "' name = 'recIndex' child='" ^ string_of_int i ^ "'/>")
- (Array.of_list funl)
- in
- link_hints annotation_window
- (Array.concat
- [ funtylid ;
- funbolid ;
- funnamel ;
- funrecindexl ;
- [| "NoFun???", "<attribute name = 'noFun' id = '" ^ id ^ "'/>" |]
- ]
- )
- | C.ACoFix (id,_,funl) ->
- let funtylid =
- Array.mapi
- (fun i (_,ty,_) ->
- "Type " ^ string_of_int i, "<node id ='" ^
- get_id ty ^ "'/>")
- (Array.of_list funl)
- and funbolid =
- Array.mapi
- (fun i (_,_,bo) ->
- "Body " ^ string_of_int i, "<node id ='" ^
- get_id bo ^ "'/>")
- (Array.of_list funl)
- and funnamel =
- Array.mapi
- (fun i (_,_,_) ->
- "Name " ^ string_of_int i, "<attribute id ='" ^ id ^
- "' name = 'name' child='" ^ string_of_int i ^ "'/>")
- (Array.of_list funl)
- in
- link_hints annotation_window
- (Array.concat
- [ funtylid ;
- funbolid ;
- funnamel ;
- [| "NoFun???", "<attribute name = 'noFun' id = '" ^ id ^ "'/>" |]
- ]
- )
-;;
-
-(*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", "<attribute name = 'name' id = '" ^ id ^ "'/>" ;
- "Ingredients", "<attribute name = 'params' id = '" ^ id ^ "'/>" ;
- "Body", "<node id = '" ^ boid ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- | C.AAxiom (id,_,ty,_) ->
- let tyid = get_id ty in
- link_hints annotation_window
- [| "Name", "<attribute name = 'name' id = '" ^ id ^ "'/>" ;
- "Ingredients", "<attribute name = 'params' id = '" ^ id ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- | C.AVariable (id,_,bo,ty) ->
- let tyid = get_id ty in
- link_hints annotation_window
- (match bo with
- None ->
- [| "Name", "<attribute name = 'name' id = '" ^ id ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- | Some bo ->
- let boid = get_id bo in
- [| "Name", "<attribute name = 'name' id = '" ^ id ^ "'/>" ;
- "Body", "<node id = '" ^ boid ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- )
- | 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", "<attribute name = 'name' id = '" ^ id ^ "'/>" ;
- "Ingredients", "<attribute name = 'params' id = '" ^ id ^ "'/>" ;
- "Body", "<node id = '" ^ boid ^ "'/>" ;
- "Type", "<node id = '" ^ tyid ^ "'/>"
- |]
- (Array.mapi
- (fun i id ->
- "Conjecture " ^ string_of_int i, "<node id = '" ^ id ^ "'/>"
- ) (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","<attribute name = 'params' id = '" ^ id ^ "'/>" |];
- (Array.mapi
- (fun i _ ->
- "Type Name " ^ string_of_int i,
- "<attribute name = 'name' child = '" ^ string_of_int i ^
- "' id = '" ^ id ^ "'/>"
- ) (Array.of_list itlids)
- ) ;
- (Array.mapi
- (fun i (id,_) ->
- "Type " ^ string_of_int i, "<node id = '" ^ id ^ "'/>"
- ) (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,
- "<attribute name = 'name' id = '" ^ id ^
- "' child = '" ^ string_of_int i ^ "' grandchild = '" ^
- 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,
- "<node id = '" ^ id ^ "'/>"
- ) (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)
-;;
+++ /dev/null
-(* 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 <sacerdot@cs.unibo.it> *)
-(* 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
+++ /dev/null
-#!/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 <<EOT;
-Content-type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
-<title>Control panel</title>
-<script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/utils.js">
-<script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/utils.js">
-<script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/control.js">
-</script>
-</head>
-<body bgcolor="#ffffff" text="#000000">
-<form>
-<table>
- <tr>
- <td>
- <b>Format</b>:
- </td>
- <td>
- <select name="output" onChange="updateOutput(this,document.forms[0].format)">
- <option value="processed" $format_processed>Processed</option>
- <option value="raw" $format_raw>Raw</option>
- </select>
- </td>
- <td>
- <select name="format" onChange="updateFormat(this)">
-EOT
- if ($mode1 eq "raw") {
- $tmp = "output_".$mode2;
- $$tmp="selected";
- print <<EOT;
- <option value="cic" $output_cic>CIC</option>
- <option value="zcic" $output_zcic>CIC GZipped</option>
-EOT
- } else {
- $tmp = "output_".$mode3;
- $$tmp="selected";
- print <<EOT;
- <option value="html" $output_html>HTML</option>
- <option value="mml_cont" $output_mml_cont>MathML Content</option>
- <option value="mml_pres" $output_mml_pres>MathML Presentation</option>
-EOT
- }
-print <<EOT;
- </select>
- </td>
- <td>
- <a target="_top" href="$topurl?mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri&processorURL=$processorURL&getterURL=$getterURL">Reload</a><br>
- (do it also before attempting to take a link to the current page)
- <script>
- top.processorURL = getParam('processorURL');
- top.getterURL = getParam('getterURL');
- top.topurl = getParam('topurl');
- top.mode = getParam('mode');
- top.cicuri = getParam('cicuri');
- top.theoryuri = getParam('theoryuri');
- </script>
- </td>
- </tr>
- <tr>
- <td colspan="3">
- <input type="checkbox" $natural onClick="updateNatural(this)"> Natural Language</input>
- <input type="checkbox" $annotations onClick="updateAnnotations(this)"> Annotations</input>
- </td>
- <td>
- <a target="_top" href="../html/index.html?mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri&processorURL=$processorURL&getterURL=$getterURL">Configuration panel</a>
- </td>
- </tr>
-</table>
-</form>
-</body>
-</html>
-EOT
+++ /dev/null
-#!/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 <<EOT;
-Content-type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
-<title>Control panel</title>
-<script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/control.js">
-</script>
-</head>
-<body bgcolor="#ffffff" text="#000000">
-<table width="100%">
-<tr>
- <td width="50%">
- <font size="+3" face="Helvetica,Arial,sans-serif"><b>Index of $uri</b></font>
- <hr noshade align="left" width="80%">
- </td>
-</tr>
-</table>
-</body>
-</html>
-EOT
+++ /dev/null
-#!/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 <<EOT;
-Content-type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
- <title>Index of $cicuri and $theoryuri</title>
-</head>
-<frameset rows="18%,*" border="0" scrolling="no">
- <frame src="mkcontrol.pl?topurl=$topurl&mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri&processorURL=$processorURL&getterURL=$getterURL" name="control"/>
- <frameset cols="50%,50%" border="0" scrolling="no">
- <frameset rows="11%,*" border="0" scrolling="no">
- <frame src="mkheader.pl?uri=$theoryuri" name="theoryheader"/>
- <frame src="mkindextheory.pl?theoryuri=$theoryuri&getterURL=$getterURL" name="theoryresult"/>
- </frameset>
- <frameset rows="11%,*" border="0" scrolling="no">
- <frame src="mkheader.pl?uri=$cicuri" name="cicheader"/>
- <frame src="mkindexcic.pl?cicuri=$cicuri&getterURL=$getterURL" name="cicresult"/>
- </frameset>
- </frameset>
-</frameset>
-</html>
-EOT
+++ /dev/null
-#!/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 = <<EOT;
-<tr>
-<td><img border="0" src="/icons/back.gif" alt="[BACK]"></td>
-<td><a href="$myurl" onClick="top.cicuri='$uridotdot'; refreshReload(); refreshCICHeader(); this.search='?cicuri=$uridotdot&getterURL=$getterURL';" onMouseOver="window.status='$uridotdot'; return true">Parent Directory</a></td>
-</tr>
-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 .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/folder.gif" alt="[DIR]"></td>
-<td><a href="$myurl" onClick="top.cicuri='$uri$name'; refreshReload(); refreshCICHeader(); this.search='?cicuri=$uri$name&getterURL=$getterURL';" onMouseOver="window.status='$uri$name'; return true">$name</a></td>
-</tr>
-</tr>
-EOT
- } elsif ($type eq "object") {
- if ($name =~ /\.(con|var|ind)$/) {
- # cic file
- $output .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/generic.red.gif" alt="[DIR]"></td>
-<td><a href="" target="cic" onClick="this.href=makeURL('cic','$uri$name','$flagscic','$flagstypes')" onMouseOver="window.status='$uri$name'; return true">$name</a>
-</tr>
-EOT
- } else {
- $output .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/unknown.gif" alt="[DIR]"></td>
-<td>$name</td>
-</tr>
-EOT
- }
- } else {
- $output .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/burst.gif" alt="[DIR]"></td>
-<td>$name</td>
-</tr>
-EOT
- }
-}
-
-print <<EOT;
-Content-type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
-<title>Index of $uri</title>
-<script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/control.js">
-</script>
-</head>
-<body bgcolor="#ffffff" text="#000000">
-<table>
-$output
-</table>
-<hr noshade align="left" width="80%">
-</body>
-</html>
-EOT
-
-#================================
-
-sub callback
-{
- my ($data) = @_;
- $cont .= $data;
-}
+++ /dev/null
-#!/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 = <<EOT;
-<tr>
-<td><img border="0" src="/icons/back.gif" alt="[BACK]"></td>
-<td><a href="$myurl" onClick="top.theoryuri='$uridotdot'; refreshReload(); refreshTheoryHeader(); this.search='?theoryuri=$uridotdot&getterURL=$getterURL';" onMouseOver="window.status='$uridotdot'; return true">Parent Directory</a></td>
-</tr>
-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 .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/folder.gif" alt="[DIR]"></td>
-<td><a href="$myurl" onClick="top.theoryuri='$uri$name'; refreshReload(); refreshTheoryHeader(); this.search='?theoryuri=$uri$name&getterURL=$getterURL';" onMouseOver="window.status='$uri$name'; return true">$name</a></td>
-</tr>
-EOT
- } elsif ($type eq "object") {
- if ($name =~ /\.theory$/) {
- # theory file
- $output .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/generic.red.gif" alt="[DIR]"></td>
-<td><a href="" target="theory" onClick="this.href=makeURL('theory','$uri$name','$flagscic','$flagstypes')" onMouseOver="window.status='$uri$name'; return true">$name</a>
-</tr>
-EOT
- } else {
- $output .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/unknown.gif" alt="[DIR]"></td>
-<td>$name</td>
-</tr>
-EOT
- }
- } else {
- $output .= <<EOT;
-<tr>
-<td><img border="0" src="/icons/burst.gif" alt="[DIR]"></td>
-<td>$name</td>
-</tr>
-EOT
- }
-}
-
-print <<EOT;
-Content-type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
-<title>Index of $uri</title>
-<script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/control.js">
-</script>
-</head>
-<body bgcolor="#ffffff" text="#000000">
-<table>
-$output
-</table>
-<hr noshade align="left" width="80%">
-</body>
-</html>
-EOT
-
-#================================
-
-sub callback
-{
- my ($data) = @_;
- $cont .= $data;
-}
+++ /dev/null
-Makefile configure config.log config.cache config.status
-helm-config
-helm_configuration.spec
+++ /dev/null
-Andrea Asperti <asperti@cs.unibo.it>
-Luca Padovani <luca.padovani@cs.unibo.it>
-Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
-Irene Schena <schena@cs.unibo.it>
+++ /dev/null
- 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.
-\f
- 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.)
-\f
-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.
-\f
- 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.
-\f
- 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
-\f
- 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.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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.
-
- <signature of Ty Coon>, 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.
+++ /dev/null
-28/12/2000: First alpha release
+++ /dev/null
-
-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
-
+++ /dev/null
-28/12/2000: First alpha release
+++ /dev/null
-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
+++ /dev/null
-# 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'}
+++ /dev/null
-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)
+++ /dev/null
-helm-math-engine-configuration.xml configuration.xml
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!-- 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/. -->
-
-<!--*****************************************************************-->
-<!-- DTD FOR HELM CONFIGURATION FILE: -->
-<!-- First draft: June 6 2000, Claudio Sacerdoti Coen -->
-<!-- Last Revision: June 6 2000, Claudio Sacerdoti Coen -->
-<!--*****************************************************************-->
-
-<!ELEMENT configuration (helm_dir, dtd_dir, style_dir, servers_file, uris_dbm, dest,
- indexname, tmp_dir, helm_url_path,
- getheader_url, style_url, webeq_url, webeqp_url,
- use_webeqp_url, html_link, getter_url, processor_url)>
-
-<!ENTITY % expr '(#PCDATA | value-of)*'>
-
-<!ELEMENT value-of EMPTY>
-<!ATTLIST value-of
- var NMTOKEN #REQUIRED >
-
-<!ELEMENT helm_dir %expr;>
-<!ELEMENT dtd_dir %expr;>
-<!ELEMENT style_dir %expr;>
-<!ELEMENT servers_file %expr;>
-<!ELEMENT uris_dbm %expr;>
-<!ELEMENT dest %expr;>
-<!ELEMENT indexname %expr;>
-<!ELEMENT tmp_dir %expr;>
-<!ELEMENT helm_url_path %expr;>
-<!ELEMENT getheader_url %expr;>
-<!ELEMENT style_url %expr;>
-<!ELEMENT webeq_url %expr;>
-<!ELEMENT webeqp_url %expr;>
-<!ELEMENT use_webeqp_url %expr;>
-<!ELEMENT html_link %expr;>
-<!ELEMENT getter_url %expr;>
-<!ELEMENT processor_url %expr;>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE configuration SYSTEM "configuration.dtd">
-
-<!-- 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/. -->
-
-<configuration>
- <helm_dir>@HELM_LIBRARY_DIR@</helm_dir>
-
- <dtd_dir>@HELM_DTD_DIR@</dtd_dir>
- <style_dir>@HELM_STYLE_DIR@</style_dir>
-
- <servers_file>@HELM_SERVERS_FILE@</servers_file>
- <uris_dbm>@HELM_URIS_DBM@</uris_dbm>
- <dest><value-of var="helm_dir"/></dest>
- <indexname>index.txt</indexname>
- <tmp_dir>@HELM_TMP_DIR@</tmp_dir>
-
- <helm_url_path>/home/lpadovan/helm/PARSER/examples</helm_url_path>
- <getheader_url>http://localhost/really_very_local/helm/header/getheader.xml</getheader_url>
- <style_url>http://localhost/really_very_local/helm/style/</style_url>
- <webeq_url>http://localhost/cgi-bin/helm/webeq.pl</webeq_url>
- <webeqp_url>http://localhost/cgi-bin/helm/webeqp.pl</webeqp_url>
- <use_webeqp_url>http://localhost/cgi-bin/helm/use_webeqp.pl</use_webeqp_url>
- <html_link><value-of var="getheader_url"/>?baseurl=<value-of var="style_url"/>&stylesheet1=rootcontent.xsl&stylesheet2=content_to_html.xsl&xmluri=</html_link>
- <getter_url>http://localhost:8081/</getter_url>
- <processor_url>http://localhost:8080/helm/servlet/uwobo/</processor_url>
-</configuration>
+++ /dev/null
-<?xml version="1.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/. -->
-
-<dictionary>
- <operator name="⋃" form="infix" stretchy="false" lspace="mediummathspace" rspace="mediummathspace"/>
- <operator name="⋂" form="infix" stretchy="false" lspace="mediummathspace" rspace="mediummathspace"/>
- <operator name="lim" form="prefix" movablelimits="false"/>
-</dictionary>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE font-configuration SYSTEM "font-configuration.dtd">
-
-<!-- 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/. -->
-
-<font-configuration>
- <font type="x" mode="math" map="adobe-symbol-forall"
- x-foundry="adobe" x-family="symbol" x-encoding="fontspecific"
- />
-
- <map id="adobe-symbol-forall">
- <single code="0x2200" index="0x22"/>
- </map>
-</font-configuration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE math-engine-configuration SYSTEM "math-engine-configuration.dtd">
-
-<!-- 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/. -->
-
-<math-engine-configuration>
- <dictionary-path>@HELM_DICTIONARY_PATH@</dictionary-path>
- <dictionary-path>@GTKMATHVIEW_DICTIONARY_PATH@</dictionary-path>
- <font-configuration-path>@HELM_FONT_CONFIGURATION_PATH@</font-configuration-path>
- <font-configuration-path>@GTKMATHVIEW_FONT_CONFIGURATION_PATH@</font-configuration-path>
- <t1-config-file>@GTKMATHVIEW_T1_CONFIG_FILE@</t1-config-file>
- <font-size size="14pt"/>
- <color foreground="black" background="white"/>
- <link-color foreground="#32648b" background="white"/>
- <select-color foreground="black" background="#87cefa"/>
-</math-engine-configuration>
+++ /dev/null
-
-usage()
-{
- cat <<EOF
-Usage: helm-config [OPTIONS]
-Options:
- [--version]
- [--prefix]
- [--exec-prefix]
- [--bin-dir]
- [--lib-dir]
- [--etc-dir]
- [--share-dir]
- [--var-dir]
- [--tmp-dir]
- [--library-dir]
- [--servers]
- [--uris-dbm]
- [--dtd-dir]
- [--style-dir]
-EOF
- exit $1
-}
-
-if test $# -eq 0; then
- usage 1 1>&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
-
+++ /dev/null
-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 <sacerdot@cs.unibo.it>
-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
+++ /dev/null
-configuration.pl
+++ /dev/null
-# 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];
-}
+++ /dev/null
-http://www.cs.unibo.it/~sacerdot/examples
+++ /dev/null
-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
+++ /dev/null
-Luca Padovani <lpadovan@cs.unibo.it>
-Pouria Masoudi <pmasoudi@cs.unibo.it>
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
+++ /dev/null
-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 \
- )
-
+++ /dev/null
-
-Tue, 15 Jul 2003 15:56:54 +0200
-
- o The project formally starts
-
+++ /dev/null
-
-* 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 <PARAM> 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
-
-
+++ /dev/null
-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 <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#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
+++ /dev/null
-# 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@
-
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <Bonobo.idl>
-
-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 ();
-
- };
-
- };
-
-};
-
+++ /dev/null
-
-idldir = $(datadir)/idl/bonobo-2.0
-idl_DATA = GtkMathView.idl
-
-EXTRA_DIST = $(idl_DATA)
+++ /dev/null
-.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
+++ /dev/null
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_GtkMathView_Factory:@GTKMATHVIEW_API_VERSION@" type="shlib"
- location="@GTKMATHVIEW_FACTORY_LOCATION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/GenericFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string" value="Gtk MathML Viewer Factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_GtkMathView:@GTKMATHVIEW_API_VERSION@" type="factory" location="OAFIID:GNOME_GtkMathView_Factory:@GTKMATHVIEW_API_VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/GtkMathView/View:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Bonobo/Unkown:1.0"/>
- <item value="IDL:Bonobo/PersistFile:1.0"/>
- <item value="IDL:Bonobo/PersistStream:1.0"/>
- <item value="IDL:Bonobo/Persist:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string" value="GtkMathView"/>
-
- <oaf_attribute name="description" type="string" value="GtkMathView"/>
- <oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="application/mathml+xml"/>
- <item value="text/mathml"/>
- </oaf_attribute>
-</oaf_server>
-
-</oaf_info>
+++ /dev/null
-
-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)
-
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#include <cassert>
-
-#include <sstream>
-
-#include <gdome.h>
-#include <gdome-util.h>
-
-#include <GdomeSmartDOM.hh>
-
-#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());
-}
-
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __aux_h__
-#define __aux_h__
-
-#include <gdome.h>
-
-#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__
-
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#include <gdome.h>
-
-#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);
-}
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __control_data_h__
-#define __control_data_h__
-
-#include <bonobo.h>
-#include <gtkmathview.h>
-#include <gdome.h>
-
-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__
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#include <bonobo.h>
-#include <bonobo/bonobo-shlib-factory.h>
-#include <gtkmathview.h>
-
-#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 <maction>", NULL, activate_maction, 0, "<StockItem>", GTK_STOCK_EXECUTE },
- { "/Copy Link Address", NULL, copy_link_address, 0, "<StockItem>", GTK_STOCK_COPY },
- /* { "/Jump To", NULL, NULL, 0, "<StockItem>", GTK_STOCK_JUMP_TO }, */
- { "/sep1", NULL, NULL, 0, "<Separator>" },
- /* { "/Semantic Selection", NULL, switch_semantic_selection, 0, "<CheckItem>" }, */
- /* { "/Copy Selected Markup", NULL, copy_selected_markup, 0, "<Item>" }, */
- /* { "/Copy Id", NULL, copy_selected_id, 0, "<Item>" }, */
- /* { "/Show Selected", NULL, NULL, 0, "<Item>" }, */
- { "/Select Parent", NULL, select_parent, 0, "<Item>" },
- { "/De-Select", NULL, deselect, 0, "<StockItem>", GTK_STOCK_CLEAR },
- { "/sep2", NULL, NULL, 0, "<Separator>" },
- { "/Smaller", NULL, zoom_out, 0, "<StockItem>", GTK_STOCK_ZOOM_OUT },
- { "/Bigger", NULL, zoom_in, 0, "<StockItem>", GTK_STOCK_ZOOM_IN },
- /* { "/Properties...", NULL, NULL, 0, "<StockItem>", 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, "<main>", 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, "<main>"); */
- /* 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);
-
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __control_factory_h__
-#define __control_factory_h__
-
-#include <config.h>
-#include <bonobo.h>
-#include <bonobo/bonobo-control.h>
-
-#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__ */
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#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;
- }
-}
-
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __handlers_h__
-#define __handlers_h__
-
-#include <bonobo.h>
-#include <gdome.h>
-#include <gtkmathview.h>
-
-#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__
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#include <bonobo.h>
-#include <gtkmathview.h>
-#include <glib.h>
-
-#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");
-}
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __GTK_MATH_VIEW_PERSIST_FILE_H__
-#define __GTK_MATH_VIEW_PERSIST_FILE_H__
-
-#include <bonobo/bonobo-persist.h>
-#include <gtkmathview.h>
-
-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
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#include <bonobo.h>
-#include <gtkmathview.h>
-
-#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;
-}
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __GTK_MATH_VIEW_PERSIST_STREAM_H__
-#define __GTK_MATH_VIEW_PERSIST_STREAM_H__
-
-#include <bonobo/bonobo-persist.h>
-#include <gtkmathview.h>
-
-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
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#include <config.h>
-
-#define HAVE_GMETADOM
-#include <gtkmathview.h>
-
-#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)
-
+++ /dev/null
-/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
- * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
- * Pouria Masoudi <pmasoudi@cs.unibo.it>
- *
- * 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 <lpadovan@cs.unibo.it>
- */
-
-#ifndef __view_h__
-#define __view_h__
-
-#include <bonobo.h>
-
-#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__ */
-
+++ /dev/null
-.deps
-.libs
-viewer
-Makefile
-Makefile.in
+++ /dev/null
-
-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
-
+++ /dev/null
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <script language="JavaScript">
-<!--
- function set_object_size(id, width, height)
- {
- document[id].width = width;
- document[id].height = height;
- }
--->
- </script>
-</head>
-
-<body>
-
- <h1>GtkMathView-Bonobo test page</h1>
-
- The embedded object should display a mathematical formula.
- <br />
-
- <object name="MATH" data="#math1" width="500" height="100" type="application/mathml+xml">
- <math id="math1" display="block" xmlns="http://www.w3.org/1998/Math/MathML">
- <mfrac>
- <mi href="http://www.google.it">x</mi>
- <mn>2</mn>
- </mfrac>
- <mo>=</mo>
- <mtext href="javascript:alert('like if I can do that')">click for the answer</mtext>
- </math>
- </object>
-
- <form name="test">
- <input name="eccolo" type="button" onClick="set_object_size('MATH', 100, 50)" value="Size"/>
- </form>
-
-</body>
-
-</html>
-
+++ /dev/null
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <script language="JavaScript">
-<!--
- function setSize(id, width, height)
- {
- document.elements[id].width = width;
- document.elements[id].height = height;
- document.elements['eccolo'].value = 'Ciao';
- alert('hello!');
- }
--->
- </script>
-</head>
-
-<body>
-
- <h1>GtkMathView-Bonobo test page</h1>
-
- The embedded object should display a mathematical formula.
- <br />
-
- <object name="MATH" data="#math1" width="500" height="100" type="application/mathml+xml">
- <math id="math1" display="block" xmlns="http://www.w3.org/1998/Math/MathML">
- <mfrac>
- <mi href="http://www.google.it">x</mi>
- <mn>2</mn>
- </mfrac>
- <mo>=</mo>
- <mtext href="javascript:alert('like if I can do that')">click for the answer</mtext>
- </math>
- </object>
-
- <form name="test">
- <input name="eccolo" type="button" onClick="alert('hi')">Size</input>
- </form>
-
-</body>
-
-</html>
-
+++ /dev/null
-#include <config.h>
-#include <gnome.h>
-#include <bonobo.h>
-#include <glib.h>
-
-#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 [] =
-"<Root>"
-" <commands>"
-" <cmd name=\"FileExit\" _label=\"Exit\" _tip=\"Exit the program\""
-" pixtype=\"stock\" pixname=\"Exit\" accel=\"*Control*q\"/>"
-" <cmd name=\"FormatHTML\" _label=\"HTML mode\" type=\"toggle\" _tip=\"HTML Format switch\"/>"
-" </commands>"
-" <menu>"
-" <submenu name=\"File\" _label=\"_File\">"
-" <menuitem name=\"OpenFile\" verb=\"\" _label=\"Open (PersistFile)\" _tip=\"Open using the PersistFile interface\""
-" pixtype=\"stock\" pixname=\"Open\"/>"
-" <menuitem name=\"OpenStream\" verb=\"\" _label=\"_Open Stream (PersistStream)\" _tip=\"Open using the PersistStream interface\""
-" pixtype=\"stock\" pixname=\"Open Stream\"/>"
-" <separator/>"
-" <menuitem name=\"TestView\" verb=\"\" _label=\"Test View\" _tip=\"Test the View interface\"/>"
-" <separator/>"
-" <menuitem name=\"FileExit\" verb=\"\" _label=\"E_xit\"/>"
-" </submenu>"
-" <placeholder name=\"Component\"/>"
-" <submenu name=\"PropertyBags\" _label=\"Property_Bag\">"
-" <menuitem name=\"Size\" verb=\"\" _label=\"Size(PropertyBag)\" _tip=\"Get size\""
-" pixtype=\"stock\" pixname=\"Get Size\"/>"
-
-" <menuitem name=\"Top\" verb=\"\" _label=\"Top(PropertyBag)\" _tip=\"Get Top\""
-" pixtype=\"stock\" pixname=\"Get Top\"/>"
-
-" <menuitem name=\"Font Size\" verb=\"\" _label=\"Font Size(PropertyBag)\" _tip=\"Get FontSize\""
-" pixtype=\"stock\" pixname=\"Get FontSize\"/>"
-
-" <menuitem name=\"Verbosity\" verb=\"\" _label=\"Verbosity(PropertyBag)\" _tip=\"Get Verbosity\""
-" pixtype=\"stock\" pixname=\"Get Verbosity\"/>"
-" </submenu>"
-" </menu>"
-" <dockitem name=\"Toolbar\" behavior=\"exclusive\">"
-" </dockitem>"
-"</Root>";
-
-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 ();
-}
+++ /dev/null
-<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
- <maction>
- <mrow>
- <mo>∫</mo>
- <mo>⁡</mo>
- <mfrac>
- <mrow>
- <mrow>
- <mi>a</mi>
- <mo>⁢</mo>
- <mi>x</mi>
- </mrow>
- <mo>+</mo>
- <mi>b</mi>
- </mrow>
- <mrow>
- <msup>
- <mi>x</mi>
- <mn>2</mn>
- </msup>
- <mo>+</mo>
- <mrow>
- <mi>p</mi>
- <mo>⁢</mo>
- <mi>x</mi>
- </mrow>
- <mo>+</mo>
- <mi href="javascript:alert('You clicked on q')">q</mi>
- </mrow>
- </mfrac>
- </mrow>
- <mtable frame="solid" framespacing=".5em .5em"><mtr><mtd><mtext>...</mtext></mtd></mtr></mtable>
- </maction>
- <mo fontstyle="italic">d</mo>
- <mi>x</mi>
- <mo>=</mo>
- <mrow>
- <mrow>
- <mfrac><mi>a</mi><mn>2</mn></mfrac>
- <mo>⁢</mo>
- <mrow>
- <mi>ln</mi>
- <mo>⁡</mo>
- <mrow>
- <mo>(</mo>
- <mrow>
- <msup><mi>x</mi><mn>2</mn></msup>
- <mo>+</mo>
- <mrow>
- <mi>p</mi>
- <mo>⁢</mo>
- <mi>x</mi>
- </mrow>
- <mo>+</mo>
- <mi>q</mi>
- </mrow>
- <mo>)</mo>
- </mrow>
- </mrow>
- </mrow>
- <mo>+</mo>
- <mrow>
- <mfrac>
- <mrow>
- <mrow>
- <mn>2</mn>
- <mo>⁢</mo>
- <mi>b</mi>
- </mrow>
- <mo>-</mo>
- <mrow>
- <mi>a</mi>
- <mo>⁢</mo>
- <mi>p</mi>
- </mrow>
- </mrow>
- <msqrt>
- <mrow>
- <mrow>
- <mn>4</mn>
- <mo>⁢</mo>
- <mi>q</mi>
- </mrow>
- <mo>-</mo>
- <msup>
- <mi>p</mi>
- <mn>2</mn>
- </msup>
- </mrow>
- </msqrt>
- </mfrac>
- <mo>⁢</mo>
- <mrow>
- <mi>arctg</mi>
- <mo>⁡</mo>
- <mfrac>
- <mrow>
- <mrow>
- <mn>2</mn>
- <mo>⁢</mo>
- <mi>x</mi>
- </mrow>
- <mo>+</mo>
- <mi>p</mi>
- </mrow>
- <msqrt>
- <mrow>
- <mrow>
- <mn>4</mn>
- <mo>⁢</mo>
- <mi>q</mi>
- </mrow>
- <mo>-</mo>
- <msup>
- <mi>p</mi>
- <mn>2</mn>
- </msup>
- </mrow>
- </msqrt>
- </mfrac>
- </mrow>
- </mrow>
- <mo>+</mo>
- <mi href="javascript:alert('You clicked on c')">c</mi>
- </mrow>
- <mspace width="1cm"/>
- <mtext href="http://www.cs.unibo.it/~lpadovan/">go to Luca's home page</mtext>
-</math>
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-</head>
-<body>
-
-<h1>GtkMathView-Bonobo test page</h1>
-
-The embedded object should display a mathematical formula.
-<br />
-<br />
-<object data="test.mml" width="500" height="100" type="application/mathml+xml">
-No viewer capable of displaying the test document installed.
-</object>
-
-</body>
-</html>