From 95d5efddaff059d7ada36e3af76ca0545e44a04f Mon Sep 17 00:00:00 2001 From: Luca Padovani Date: Tue, 15 Jul 2003 14:54:22 +0000 Subject: [PATCH] * first snapshot --- helm/gtkmathview-bonobo/.cvsignore | 18 ++ helm/gtkmathview-bonobo/AUTHORS | 2 + helm/gtkmathview-bonobo/ChangeLog | 0 helm/gtkmathview-bonobo/Makefile.am | 20 ++ helm/gtkmathview-bonobo/NEWS | 5 + helm/gtkmathview-bonobo/README | 0 helm/gtkmathview-bonobo/configure.ac | 97 +++++++ helm/gtkmathview-bonobo/src/.cvsignore | 6 + .../src/GNOME_GtkMathView.server.in | 32 +++ helm/gtkmathview-bonobo/src/Makefile.am | 17 ++ .../src/gtkmathview-bonobo.c | 269 ++++++++++++++++++ .../src/gtkmathview-bonobo.h | 36 +++ 12 files changed, 502 insertions(+) create mode 100644 helm/gtkmathview-bonobo/.cvsignore create mode 100644 helm/gtkmathview-bonobo/AUTHORS create mode 100644 helm/gtkmathview-bonobo/ChangeLog create mode 100644 helm/gtkmathview-bonobo/Makefile.am create mode 100644 helm/gtkmathview-bonobo/NEWS create mode 100644 helm/gtkmathview-bonobo/README create mode 100644 helm/gtkmathview-bonobo/configure.ac create mode 100644 helm/gtkmathview-bonobo/src/.cvsignore create mode 100644 helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in create mode 100644 helm/gtkmathview-bonobo/src/Makefile.am create mode 100644 helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c create mode 100644 helm/gtkmathview-bonobo/src/gtkmathview-bonobo.h diff --git a/helm/gtkmathview-bonobo/.cvsignore b/helm/gtkmathview-bonobo/.cvsignore new file mode 100644 index 000000000..1d6c13d38 --- /dev/null +++ b/helm/gtkmathview-bonobo/.cvsignore @@ -0,0 +1,18 @@ +aclocal.m4 +config.h.in +Makefile.in +autom4te.cache +config.guess +config.sub +install-sh +mkinstalldirs +ltmain.sh +configure +depcomp +Makefile +config.h +config.log +config.status +libtool +stamp-h1 +` diff --git a/helm/gtkmathview-bonobo/AUTHORS b/helm/gtkmathview-bonobo/AUTHORS new file mode 100644 index 000000000..c4b11a9bd --- /dev/null +++ b/helm/gtkmathview-bonobo/AUTHORS @@ -0,0 +1,2 @@ +Luca Padovani +Pouria Masoudi diff --git a/helm/gtkmathview-bonobo/ChangeLog b/helm/gtkmathview-bonobo/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/helm/gtkmathview-bonobo/Makefile.am b/helm/gtkmathview-bonobo/Makefile.am new file mode 100644 index 000000000..38452e227 --- /dev/null +++ b/helm/gtkmathview-bonobo/Makefile.am @@ -0,0 +1,20 @@ +EXTRA_DIST = BUGS HISTORY LICENSE ANNOUNCEMENT CONTRIBUTORS config.h.in +SUBDIRS = src +CLEANFILES = core *.log *.eps + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA=gtkmathview-bonobo.pc + +backup: + tar cvfz ../@PACKAGE@-@VERSION@-`date|tr ' ' '_'|tr ':' '_'`.tar.gz . + +cleanbak: + -rm -f `find . -name "*~"` + +lc: + @( \ + CFILES=`find . -name "*.c"`; \ + HFILES=`find . -name "*.h"`; \ + wc -l $$CFILES $$HFILES | tail -n 1 \ + ) + diff --git a/helm/gtkmathview-bonobo/NEWS b/helm/gtkmathview-bonobo/NEWS new file mode 100644 index 000000000..bbb294549 --- /dev/null +++ b/helm/gtkmathview-bonobo/NEWS @@ -0,0 +1,5 @@ + +Tue, 15 Jul 2003 15:56:54 +0200 + + o The project formally starts + diff --git a/helm/gtkmathview-bonobo/README b/helm/gtkmathview-bonobo/README new file mode 100644 index 000000000..e69de29bb diff --git a/helm/gtkmathview-bonobo/configure.ac b/helm/gtkmathview-bonobo/configure.ac new file mode 100644 index 000000000..7e2452a5f --- /dev/null +++ b/helm/gtkmathview-bonobo/configure.ac @@ -0,0 +1,97 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(gtkmathview-bonobo, [0.0.1]) +AC_CONFIG_SRCDIR(src/GNOME_GtkMathView.server.in) +AM_INIT_AUTOMAKE($AC_PACKAGE_NAME, $AC_PACKAGE_VERSION) + +PACKAGE=$PACKAGE_NAME +VERSION=$PACKAGE_VERSION +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) + +GTKMATHVIEW_BONOBO_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'` +AC_SUBST(EDITEX_VERSION_INFO) + +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, an implementation of + * some Bonobo interfaces for GtkMathView. + * + * Copyright (C) 2003 Luca Padovani , + * Pouria Masoudi . + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo/ + * or send an email to + */ + +#ifndef config_h +#define config_h +]) + +AH_BOTTOM([ +#endif /* config_h */ +]) + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_HEADER_STDC([]) + +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + +AM_PROG_LIBTOOL + +PKG_CHECK_MODULES(GTKMATHVIEW, gtkmathview >= 0.4.3) +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) + +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/GNOME_GtkMathView.server +]) +AC_OUTPUT diff --git a/helm/gtkmathview-bonobo/src/.cvsignore b/helm/gtkmathview-bonobo/src/.cvsignore new file mode 100644 index 000000000..9cabbbc5a --- /dev/null +++ b/helm/gtkmathview-bonobo/src/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +GNOME_GtkMathView.server +Makefile +Makefile.in +gtkmathview-bonobo.lo diff --git a/helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in b/helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in new file mode 100644 index 000000000..766d135b2 --- /dev/null +++ b/helm/gtkmathview-bonobo/src/GNOME_GtkMathView.server.in @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/helm/gtkmathview-bonobo/src/Makefile.am b/helm/gtkmathview-bonobo/src/Makefile.am new file mode 100644 index 000000000..2553e9720 --- /dev/null +++ b/helm/gtkmathview-bonobo/src/Makefile.am @@ -0,0 +1,17 @@ + +lib_LTLIBRARIES = libgtkmathview-bonobo.la + +libgtkmathview_bonobo_la_LIBADD = $(GTKMATHVIEW_LIBS) $(BONOBOUI_LIBS) $(BONOBO_LIBS) +libgtkmathview_bonobo_la_LDFLAGS = -version-info @MATHVIEW_VERSION_INFO@ + +libgtkmathview_bonobo_la_SOURCES = \ + gtkmathview-bonobo.c + +pkginclude_HEADERS = \ + gtkmathview-bonobo.h + +INCLUDES = \ + $(BONOBOUI_CFLAGS) \ + $(BONOBO_CFLAGS) \ + $(GTKMATHVIEW_CFLAGS) + diff --git a/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c b/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c new file mode 100644 index 000000000..3b24af7ee --- /dev/null +++ b/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c @@ -0,0 +1,269 @@ + +#include + +#if 1 +#include +#endif + +enum { + MATH_VIEW_WIDTH, + MATH_VIEW_HEIGHT, + MATH_VIEW_TOP_X, + MATH_VIEW_TOP_Y, + MATH_VIEW_TOP, + MATH_VIEW_FONT_SIZE, + MATH_VIEW_ANTI_ALIASING, + MATH_VIEW_TRANSPARENCY, + MATH_VIEW_VERBOSITY, + MATH_VIEW_FONT_MANAGER +} math_args; + + +/*static char * +make_reg_id(const char *iid) +{ + char *id; + id = bonobo_activation_make_registration_id(iid,Display_String(gdk_display)); + return id; +}*/ + +static void +get_prop(BonoboPropertyBag *bag, + BonoboArg *arg, + guint arg_id, + 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); + + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + break; + case MATH_VIEW_FONT_MANAGER: + {gint i = (gint) gtk_math_view_get_font_manager_type(math_view); + BONOBO_ARG_SET_INT(arg,i); + } + break; + default: + g_assert(FALSE); + } +} + +static void +set_prop(BonoboPropertyBag *bag, + const BonoboArg *arg, + guint arg_id, + 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); + + switch(arg_id) + { + /*case MATH_VIEW_WIDTH: + g_assert(arg->_type == BONOBO_ARG_INT); + + guint i = gtk_math_view_set_width(math_view); + BONOBO_ARG_SET_INT(arg,i); + break; + case MATH_VIEW_HEIGHT: + g_assert(arg->_type == BONOBO_ARG_INT); + + guint i = gtk_math_view_get_height(math_view); + BONOBO_ARG_SET_INT(arg,i); + break;*/ + 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); + } + 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); + } + 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); + } + 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); + } + break; + case MATH_VIEW_FONT_MANAGER: + { + gint i = (gint) gtk_math_view_get_font_manager_type(math_view); + BONOBO_ARG_SET_INT(arg,i); + } + break; + default: + g_assert(FALSE); + } +} + +static BonoboControl* +instantiate_func(void) +{ + BonoboControl *control; + GtkWidget *math_view; + BonoboPropertyBag *prop_bag; + + math_view = gtk_math_view_new(NULL,NULL); + + gtk_widget_show(math_view); + + control = bonobo_control_new(math_view); + + prop_bag = bonobo_property_bag_new(get_prop, set_prop, math_view); + + 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",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",MATH_VIEW_TOP_X,BONOBO_ARG_INT, + NULL,"top_x",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",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); + + 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_NULL, + NULL,"font_manager",0); + return control; +} + +static void +notify_property_bag(GtkMathView *math_view,gpointer data) +{ + BonoboPropertyBag *prop_bag; + BonoboArg *arg; + + g_return_if_fail(BONOBO_IS_PROPERTY_BAG(data)); + prop_bag = BONOBO_PROPERTY_BAG(data); + + //we use arg to notify the container that somthing has changed + + arg = bonobo_arg_new(BONOBO_ARG_INT); + BONOBO_ARG_SET_INT(arg,0); + + //bonobo_property_bag_notify_listeners(prop_bag,); +} diff --git a/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.h b/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.h new file mode 100644 index 000000000..68830bc87 --- /dev/null +++ b/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.h @@ -0,0 +1,36 @@ +/* + * 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, + * 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. + */ +#include +#include +#include + +#include + + +enum math_args; + +static void get_prop(BonoboPropertyBag*, BonoboArg *, guint , CorbaEnvironment*, gpointer); +static void set_prop(BonoboPropertyBag*, BonoboArg *, guint , CorbaEnvironment*, gpointer); + +static BonoboControl* instantiate_func(void); + +static void notify_property_bag(GtkMathView* ,gpointer); + + -- 2.39.2