--- /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>
+ */
+
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_GtkMathView.server.in.in
-CLEANFILES = $(server_in_files:.server.in.in=.server)
-
IDL = $(top_srcdir)/idl/GtkMathView.idl
IDL_GENERATED_C = \
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 = \
-// Copyright (C) 2000-2002, Luca Padovani <luca.padovani@cs.unibo.it>.
-//
-// This file is part of GtkMathView, a Gtk widget for MathML.
-//
-// GtkMathView 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.
-//
-// GtkMathView 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 GtkMathView; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// For details, see the GtkMathView World-Wide-Web page,
-// http://www.cs.unibo.it/helm/mml-widget, or send a mail to
-// <luca.padovani@cs.unibo.it>
+/* 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>
}
extern "C" GdomeElement*
-find_self_or_ancestor(GdomeElement* elem, const char* uri, const char* name)
+find_self_or_ancestor(GdomeElement* elem, const gchar* uri, const gchar* name)
{
DOM::Element el(elem);
extern "C" GdomeElement*
find_element_by_id(GdomeElement* root, GdomeDOMString* ns_uri, GdomeDOMString* name,
- const char* id)
+ const gchar* id)
{
DOM::Element el = findElementById(DOM::Element(root),
DOM::GdomeString(ns_uri), DOM::GdomeString(name),
+/* 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__
#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 char*);
+ const gchar*);
#ifdef __cplusplus
}
+/* 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"
cd->math_view = math_view;
cd->first_selected = NULL;
cd->root_selected = NULL;
- cd->id_ns_uri = NULL;
- cd->id_name = NULL;
+ cd->id_ns_uri = gdome_str_mkref("http://www.cs.unibo.it/helm");
+ cd->id_name = gdome_str_mkref("xref");
return cd;
}
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_attribute(GtkMathViewControlData* cd,
- const char* ns_uri, const char* name)
+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 = NULL;
- }
- if (cd->id_name != NULL)
- {
- gdome_str_unref(cd->id_name);
- cd->id_name = NULL;
- }
- if (ns_uri) cd->id_ns_uri = gdome_str_mkref(ns_uri);
- if (name) cd->id_name = gdome_str_mkref(name);
+ 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;
}
+/* 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__
GtkMathViewControlData* gtk_math_view_control_data_new(GtkMathView*);
void gtk_math_view_control_data_destroy(GtkMathViewControlData*);
-void gtk_math_view_control_data_set_id_attribute(GtkMathViewControlData*,
- const char*, const char*);
+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*);
#endif // __control_data_h__
+/* 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 "handlers.h"
#include "control-data.h"
+#include "persist-file.h"
+#include "persist-stream.h"
+#include "handlers.h"
#include "view.h"
enum
MATH_VIEW_TOP_X,
MATH_VIEW_TOP_Y,
MATH_VIEW_FONT_SIZE,
- MATH_VIEW_ANTI_ALIASING,
- MATH_VIEW_TRANSPARENCY,
MATH_VIEW_VERBOSITY,
- MATH_VIEW_FONT_MANAGER
+ MATH_VIEW_ID_NS_URI,
+ MATH_VIEW_ID_NAME
} math_args;
static void
CORBA_Environment *ev,
gpointer user_data)
{
- GtkMathView *math_view;
-
- g_return_if_fail(GTK_IS_MATH_VIEW(user_data));
-
- math_view = GTK_MATH_VIEW(user_data);
+ GtkMathViewControlData* control_data = user_data;
+ g_assert(control_data != NULL);
switch (arg_id)
{
case MATH_VIEW_WIDTH:
- {
- gint i = gtk_math_view_get_width(math_view);
- g_assert(arg->_type == BONOBO_ARG_INT);
- BONOBO_ARG_SET_INT(arg,i);
- }
+ BONOBO_ARG_SET_INT(arg, gtk_math_view_get_width(control_data->math_view));
break;
case MATH_VIEW_HEIGHT:
- {
- guint i = gtk_math_view_get_height(math_view);
- g_assert(arg->_type == BONOBO_ARG_INT);
- BONOBO_ARG_SET_INT(arg,i);
- }
+ BONOBO_ARG_SET_INT(arg, gtk_math_view_get_height(control_data->math_view));
break;
case MATH_VIEW_TOP_X:
{
- guint new_top_y,new_top_x;
- g_assert(arg->_type == BONOBO_ARG_INT);
- gtk_math_view_get_top(math_view,&new_top_x, &new_top_y);
- BONOBO_ARG_SET_INT(arg,new_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 new_top_y,new_top_x;
- g_assert(arg->_type == BONOBO_ARG_INT);
- gtk_math_view_get_top(math_view,&new_top_x,&new_top_y);
- BONOBO_ARG_SET_INT(arg,new_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:
- {
- guint i = gtk_math_view_get_font_size(math_view);
- g_assert(arg->_type == BONOBO_ARG_INT);
- BONOBO_ARG_SET_INT(arg,i);
- }
- break;
- case MATH_VIEW_ANTI_ALIASING:
- {
- gboolean i = gtk_math_view_get_anti_aliasing(math_view);
- g_assert(arg->_type == BONOBO_ARG_BOOLEAN);
- BONOBO_ARG_SET_BOOLEAN(arg,i);
- }
- break;
- case MATH_VIEW_TRANSPARENCY:
- {
- gboolean i = gtk_math_view_get_transparency(math_view);
- g_assert(arg->_type == BONOBO_ARG_BOOLEAN);
- BONOBO_ARG_SET_BOOLEAN(arg,i);
- }
+ 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:
{
- gint i = gtk_math_view_get_log_verbosity(math_view);
- g_assert(arg->_type == BONOBO_ARG_INT);
- BONOBO_ARG_SET_INT(arg,i);
+ 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_FONT_MANAGER:
+ case MATH_VIEW_ID_NAME:
{
- gint i = (gint) gtk_math_view_get_font_manager_type(math_view);
- BONOBO_ARG_SET_INT(arg,i);
+ 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:
- g_assert(FALSE);
+ bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound);
+ break;
}
}
CORBA_Environment* ev,
gpointer user_data)
{
- GtkMathView *math_view;
-
- g_return_if_fail(GTK_IS_MATH_VIEW(user_data));
-
- math_view = GTK_MATH_VIEW(user_data);
+ GtkMathViewControlData *control_data = user_data;
+ g_assert(control_data != NULL);
switch (arg_id)
{
case MATH_VIEW_TOP_X:
{
guint old_top_y;
- g_assert(arg->_type == BONOBO_ARG_INT);
- gtk_math_view_get_top(math_view, NULL, &old_top_y);
- gtk_math_view_set_top(math_view, BONOBO_ARG_GET_INT(arg), 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;
- g_assert(arg->_type == BONOBO_ARG_INT);
- gtk_math_view_get_top(math_view, &old_top_x, NULL);
- gtk_math_view_set_top(math_view, BONOBO_ARG_GET_INT(arg), 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:
- {
- guint i = gtk_math_view_get_font_size(math_view);
- g_assert(arg->_type == BONOBO_ARG_INT);
- BONOBO_ARG_SET_INT(arg,i);
- }
- break;
- case MATH_VIEW_ANTI_ALIASING:
- {
- gboolean i = gtk_math_view_get_anti_aliasing(math_view);
- g_assert(arg->_type == BONOBO_ARG_BOOLEAN);
- BONOBO_ARG_SET_BOOLEAN(arg,i);
- }
- break;
- case MATH_VIEW_TRANSPARENCY:
- {
- gboolean i = gtk_math_view_get_transparency(math_view);
- g_assert(arg->_type == BONOBO_ARG_BOOLEAN);
- BONOBO_ARG_SET_BOOLEAN(arg,i);
- }
+ gtk_math_view_set_font_size(control_data->math_view, BONOBO_ARG_GET_INT(arg));
break;
case MATH_VIEW_VERBOSITY:
- {
- gint i = gtk_math_view_get_log_verbosity(math_view);
- g_assert(arg->_type == BONOBO_ARG_INT);
- BONOBO_ARG_SET_INT(arg,i);
- }
+ gtk_math_view_set_log_verbosity(control_data->math_view, BONOBO_ARG_GET_INT(arg));
break;
- case MATH_VIEW_FONT_MANAGER:
- {
- gint i = (gint) gtk_math_view_get_font_manager_type(math_view);
- BONOBO_ARG_SET_INT(arg,i);
- }
+ 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);
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, math_view);
+ 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",
+ bonobo_property_bag_add(prop_bag, "width",
MATH_VIEW_WIDTH, BONOBO_ARG_INT,
- NULL,"width",0);
- bonobo_property_bag_add(prop_bag,"height",
+ NULL,
+ "Width of the view", 0);
+ bonobo_property_bag_add(prop_bag, "height",
MATH_VIEW_HEIGHT, BONOBO_ARG_INT,
- NULL,"height",0);
- bonobo_property_bag_add(prop_bag,"top_x",
+ NULL,
+ "Height of the view", 0);
+ bonobo_property_bag_add(prop_bag, "top-x",
MATH_VIEW_TOP_X, BONOBO_ARG_INT,
- NULL,"top_x",0);
- bonobo_property_bag_add(prop_bag,"top_y",
+ 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,"top_y",0);
- bonobo_property_bag_add(prop_bag,"font_size",
+ 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,"font_size",0);
- bonobo_property_bag_add(prop_bag,"anti_aliasing",
- MATH_VIEW_ANTI_ALIASING, BONOBO_ARG_BOOLEAN,
- NULL,"anti_aliasing",0);
- bonobo_property_bag_add(prop_bag,"transparency",
- MATH_VIEW_TRANSPARENCY, BONOBO_ARG_BOOLEAN,
- NULL,"transparency",0);
+ NULL,
+ "Default font size", 0);
bonobo_property_bag_add(prop_bag,"verbosity",
MATH_VIEW_VERBOSITY, BONOBO_ARG_INT,
- NULL,"verbosity",0);
- bonobo_property_bag_add(prop_bag,"font_manager",
- MATH_VIEW_FONT_MANAGER, BONOBO_ARG_INT,
- NULL,"font_manager",0);
+ 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));
-/*
- * gtk_math_view_bonobo.c
- * This file is part of gedit
- *
- * 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,
+/* 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 General Public License for more details.
+ * 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
*
- * 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.
+ * 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__
+/* 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
+/* 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__
+/* 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);
+ CORBA_Environment *ev);
static void save_implementation(PortableServer_Servant servant,const gchar *path,
- CORBA_Environment *ev);
+ CORBA_Environment *ev);
static void finalize(GObject *object)
{
- GtkMathViewPersistFile *file = GTK_MATH_VIEW_PERSIST_FILE(object);
+ GtkMathViewPersistFile *file = GTK_MATH_VIEW_PERSIST_FILE(object);
- if(file->math_view){
- g_object_unref(file->math_view);
- file->math_view = NULL;
- }
+ 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);
+ G_OBJECT_CLASS(gtk_math_view_persist_file_parent_class)->finalize (object);
}
static Bonobo_Persist_ContentTypeList *
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;
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS(klass);
+ POA_Bonobo_PersistFile__epv *epv = &klass->epv;
-#ifdef DEBUG
- printf("persist file class init\n");
-#endif
- gtk_math_view_persist_file_parent_class = g_type_class_peek_parent(klass);
+ gtk_math_view_persist_file_parent_class = g_type_class_peek_parent(klass);
- epv->load = load_implementation;
- epv->save = save_implementation;
+ epv->load = load_implementation;
+ epv->save = save_implementation;
- object_class->finalize = finalize;
- persist_class->get_content_types = get_content_types;
+ 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;
-#ifdef DEBUG
- printf("persist file get type\n");
-#endif
- 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,
+ 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;
+ }
+
+ return type;
}
BonoboObject *
{
BonoboObject *file;
- printf("persist file new\n");
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;
-#ifdef DEBUG
- printf("gtk_math_view_persist_file_new passed\n");
-#endif
-
return file;
}
GtkMathViewPersistFile* file = GTK_MATH_VIEW_PERSIST_FILE(bonobo_object_from_servant(servant));
//fd = open(path, O_RDONLY);
- printf("passing from here LOAD\n");
-
result = gtk_math_view_load_uri(file->math_view,path);
if(!result)
- {
- printf("exception here!\n");
- CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL);
- }
+ CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL);
+
bonobo_object_unref(BONOBO_OBJECT(file));
- return ;
}
static void
const gchar *path,
CORBA_Environment *ev)
{
- bonobo_exception_set(ev,"save_exception");
- bonobo_exception_add_handler_str("save_exception",
- "Save option is not valid");
- return;
+ bonobo_exception_set(ev,"save_exception");
+ bonobo_exception_add_handler_str("save_exception",
+ "Save option is not valid");
}
+/* 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__
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, \
+#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),\
+#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;
+struct _GtkMathViewPersistFile
+{
+ BonoboPersist parent;
+ GtkMathView *math_view;
};
-typedef struct {
- BonoboPersistClass parent_class;
-
- POA_Bonobo_PersistFile__epv epv;
-}GtkMathViewPersistFileClass;
+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 *math_view);
+GType gtk_math_view_persist_file_get_type(void);
+BonoboObject *gtk_math_view_persist_file_new(GtkMathView *);
G_END_DECLS
+/* 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-stream.h"
#include "control-factory.h"
-#define DEBUG
+#define DEBUG0
static BonoboObjectClass *gtk_math_view_persist_stream_parent_class;
static void finalize(GObject *object)
{
- GtkMathViewPersistStream *stream = GTK_MATH_VIEW_PERSIST_STREAM(object);
+ GtkMathViewPersistStream *stream = GTK_MATH_VIEW_PERSIST_STREAM(object);
- if(stream->math_view){
- g_object_unref(stream->math_view);
- stream->math_view = NULL;
+ 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);
+ G_OBJECT_CLASS(gtk_math_view_persist_stream_parent_class)->finalize(object);
}
static Bonobo_Persist_ContentTypeList *
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;
+ 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");
+ printf("persist stream class init\n");
#endif
- gtk_math_view_persist_stream_parent_class = g_type_class_peek_parent(klass);
+ gtk_math_view_persist_stream_parent_class = g_type_class_peek_parent(klass);
- epv->load = load_implementation;
- epv->save = save_implementation;
+ epv->load = load_implementation;
+ epv->save = save_implementation;
- object_class->finalize = finalize;
- persist_class->get_content_types = get_content_types;
+ 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;
+ static GType type = 0;
#ifdef DEBUG
- printf("persist stream get type\n");
+ 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");
+ 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;
+
+ return type;
}
BonoboObject *
gtk_math_view_persist_stream_new(GtkMathView *math_view)
{
- BonoboObject *stream;
+ BonoboObject *stream;
#ifdef DEBUG
- printf("persist stream new\n");
+ 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);
+ 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;
+ g_object_ref(math_view);
+ GTK_MATH_VIEW_PERSIST_STREAM(stream)->math_view = math_view;
- return stream;
+ return stream;
}
static FILE*
create_tmp_file(GtkMathViewPersistStream *persist)
{
- FILE *tmpfile;
- int fd;
+ 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;
+ 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;
}
- printf("salvo nel file %s\n", persist->tmp_path_name);
- tmpfile = fdopen(fd, "w");
- if(!tmpfile) {
- close(fd);
- return NULL;
+
+ tmpfile = fdopen(fd, "w");
+ if(!tmpfile)
+ {
+ close(fd);
+ return NULL;
}
- return tmpfile;
+
+ return tmpfile;
}
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;
+ 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");
+ printf("persist stream loading\n");
#endif
- printf("type = %s\n", type);
-
- if (strcmp (type, "application/mathml+xml") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
+ 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) {
- printf("*** eccezione 1 %s\n",ev->_major);
- goto clean;
- }
+ 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;
- printf("letti %d bytes\n", len_read);
-
- if (buffer->_buffer && len_read)
- if(fwrite(buffer->_buffer, 1, len_read, tmpfile) != len_read) {
- CORBA_free (buffer);
- printf("*** eccezione 2\n");
- 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);
+ CORBA_free (buffer);
} while (len_read > 0);
- fclose(tmpfile);
- result = gtk_math_view_load_uri(persist->math_view,persist->tmp_path_name);
- if(!result)
+ 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);
+ CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Bonobo_Persist_WrongDataType,NULL);
}
- return ;
+ return ;
-clean:
- fclose (tmpfile);
- return;
+ clean:
+ fclose (tmpfile);
+ return;
}
static void
+/* 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__
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_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;
- const gchar* tmp_path_name;
+struct _GtkMathViewPersistStream
+{
+ BonoboPersist parent;
+ GtkMathView *math_view;
+ gchar* tmp_path_name;
};
-typedef struct{
- BonoboPersistClass parent_class;
-
- POA_Bonobo_PersistStream__epv epv;
-}GtkMathViewPersistStreamClass;
+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 *math_view);
+BonoboObject *gtk_math_view_persist_stream_new(GtkMathView *);
G_END_DECLS
+/* 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>
/* do some initialization */
}
-BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view)
-
View*
view_new(GtkMathViewControlData* control_data)
{
view->control_data = control_data;
return view;
}
+
+BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view)
+
+/* 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__
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);
+ 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);
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);
+ 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_antialiasing(GtkWidget *widget,
- gpointer data)
-{
- gboolean antialiasing;
- 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);
-
- antialiasing = bonobo_pbclient_get_boolean(prop_bag,"anti_aliasing",NULL);
-
- if(antialiasing == TRUE)
- printf("Antialiasing is set\n");
- else if(antialiasing == FALSE)
- printf("Antialiasing is not set\n");
-
- bonobo_object_release_unref(prop_bag,NULL);
-}
-
-static void
-get_transparency(GtkWidget *widget,
- gpointer data)
-{
- gboolean transparency;
- 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);
-
- transparency = bonobo_pbclient_get_boolean(prop_bag,"transparency",NULL);
-
- if(transparency == TRUE)
- printf("Transparency is set\n");
- else if(transparency == FALSE)
- printf("Transparency is not set\n");
-
- bonobo_object_release_unref(prop_bag,NULL);
-}
-
static void
get_verbosity(GtkWidget *widget,
gpointer data)
bonobo_object_release_unref(prop_bag,NULL);
}
-static void
-get_font_manager(GtkWidget *widget,
- gpointer data)
-{
- gint font_manager;
- 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_manager = bonobo_pbclient_get_long(prop_bag,"font_manager",NULL);
-
- printf("Font_manager: %d\n",font_manager);
-
- 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 ("Size", get_size),
BONOBO_UI_UNSAFE_VERB ("Top", get_top),
BONOBO_UI_UNSAFE_VERB ("Font Size", get_font_size),
- BONOBO_UI_UNSAFE_VERB ("AntiAliasing", get_antialiasing),
- BONOBO_UI_UNSAFE_VERB ("Transparency", get_transparency),
BONOBO_UI_UNSAFE_VERB ("Verbosity", get_verbosity),
- BONOBO_UI_UNSAFE_VERB ("Font Manager", get_font_manager),
BONOBO_UI_UNSAFE_VERB ("FileExit", exit_cb),
BONOBO_UI_VERB_END
};
" <submenu name=\"File\" _label=\"_File\">"
" <menuitem name=\"OpenFile\" verb=\"\" _label=\"Open (PersistFile)\" _tip=\"Open using the PersistFile interface\""
" pixtype=\"stock\" pixname=\"Open\"/>"
-" <menuitem name=\"SaveFile\" verb=\"\" _label=\"Save (PersistFile)\" _tip=\"Save using the PersistFile interface\""
-" pixtype=\"stock\" pixname=\"Save\"/>"
-" <separator/>"
" <menuitem name=\"OpenStream\" verb=\"\" _label=\"_Open Stream (PersistStream)\" _tip=\"Open using the PersistStream interface\""
" pixtype=\"stock\" pixname=\"Open Stream\"/>"
-" <menuitem name=\"SaveStream\" verb=\"\" _label=\"_Save (PersistStream)\" _tip=\"Save using the PersistStream interface\""
-" pixtype=\"stock\" pixname=\"Save\"/>"
-" <menuitem name=\"SavePlainStream\" verb=\"\" _label=\"Save _plain(PersistStream)\" _tip=\"Save using the PersistStream interface\""
-" pixtype=\"stock\" pixname=\"Save\"/>"
" <separator/>"
-" <menuitem name=\"ViewHTMLSource\" verb=\"\" _label=\"View HTML Source\" _tip=\"View the html source of the current document\"/>"
-" <menuitem name=\"ViewHTMLSourceHTML\" verb=\"\" _label=\"View HTML Output\" _tip=\"View the html source of the current document as html\"/>"
-" <menuitem name=\"ViewPlainSource\" verb=\"\" _label=\"View PLAIN Source\" _tip=\"View the plain text source of the current document\"/>"
" <menuitem name=\"TestView\" verb=\"\" _label=\"Test View\" _tip=\"Test the View interface\"/>"
" <separator/>"
" <menuitem name=\"FileExit\" verb=\"\" _label=\"E_xit\"/>"
" <menuitem name=\"Font Size\" verb=\"\" _label=\"Font Size(PropertyBag)\" _tip=\"Get FontSize\""
" pixtype=\"stock\" pixname=\"Get FontSize\"/>"
-" <menuitem name=\"AntiAliasing\" verb=\"\" _label=\"AntiAliasing(PropertyBag)\" _tip=\"Get AntiAliasing\""
-" pixtype=\"stock\" pixname=\"Get AntiAliasing\"/>"
-
-" <menuitem name=\"Transparency\" verb=\"\" _label=\"Transparency(PropertyBag)\" _tip=\"Get Transparency\""
-" pixtype=\"stock\" pixname=\"Get Transparency\"/>"
-
" <menuitem name=\"Verbosity\" verb=\"\" _label=\"Verbosity(PropertyBag)\" _tip=\"Get Verbosity\""
" pixtype=\"stock\" pixname=\"Get Verbosity\"/>"
-
-" <menuitem name=\"Font Manager\" verb=\"\" _label=\"Font Manager(PropertyBag)\" _tip=\"Get FontManager\""
-" pixtype=\"stock\" pixname=\"Get FontManager\"/>"
-
-" <separator/>"
-" <placeholder name=\"FormatParagraph\"/>"
" </submenu>"
" </menu>"
" <dockitem name=\"Toolbar\" behavior=\"exclusive\">"
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/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/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/Property:change:font-size",NULL,bonobo_win);
bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)anti_aliasing_changed,
- "Bonobo/Property:change:anti_aliasing",NULL,bonobo_win);
- bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)transparency_changed,
- "Bonobo/Property:change:transparency",NULL,bonobo_win);
- bonobo_event_source_client_add_listener(prop_bag, (BonoboListenerCallbackFn)verbosity_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);
<mi>x</mi>
</mrow>
<mo>+</mo>
- <mi>q</mi>
+ <mi href="questo era q">q</mi>
</mrow>
</mfrac>
</mrow>