From: Luca Padovani Date: Wed, 16 Jul 2003 12:46:11 +0000 (+0000) Subject: * changed name to control factory X-Git-Tag: LucaOK~76 X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=commitdiff_plain;h=bd1567199bf9a875cd3cef3b0301d359ad008867 * changed name to control factory --- diff --git a/helm/gtkmathview-bonobo/.cvsignore b/helm/gtkmathview-bonobo/.cvsignore index 1d6c13d38..d4b698b3a 100644 --- a/helm/gtkmathview-bonobo/.cvsignore +++ b/helm/gtkmathview-bonobo/.cvsignore @@ -15,4 +15,4 @@ config.log config.status libtool stamp-h1 -` +gtkmathview-bonobo.pc diff --git a/helm/gtkmathview-bonobo/src/.cvsignore b/helm/gtkmathview-bonobo/src/.cvsignore index c150801c5..d4c91def3 100644 --- a/helm/gtkmathview-bonobo/src/.cvsignore +++ b/helm/gtkmathview-bonobo/src/.cvsignore @@ -3,5 +3,5 @@ GNOME_GtkMathView.server Makefile Makefile.in -gtkmathview-bonobo.lo libgtkmathview-bonobo.la +control-factory.lo diff --git a/helm/gtkmathview-bonobo/src/Makefile.am b/helm/gtkmathview-bonobo/src/Makefile.am index fa02addeb..ca93f9ee5 100644 --- a/helm/gtkmathview-bonobo/src/Makefile.am +++ b/helm/gtkmathview-bonobo/src/Makefile.am @@ -5,10 +5,10 @@ libgtkmathview_bonobo_la_LIBADD = $(GTKMATHVIEW_LIBS) $(BONOBOUI_LIBS) $(BONOBO_ libgtkmathview_bonobo_la_LDFLAGS = -version-info @GTKMATHVIEW_BONOBO_VERSION_INFO@ libgtkmathview_bonobo_la_SOURCES = \ - gtkmathview-bonobo.c + control-factory.c pkginclude_HEADERS = \ - gtkmathview-bonobo.h + control-factory.h INCLUDES = \ $(BONOBOUI_CFLAGS) \ diff --git a/helm/gtkmathview-bonobo/src/control-factory.c b/helm/gtkmathview-bonobo/src/control-factory.c new file mode 100644 index 000000000..3b24af7ee --- /dev/null +++ b/helm/gtkmathview-bonobo/src/control-factory.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/control-factory.h b/helm/gtkmathview-bonobo/src/control-factory.h new file mode 100644 index 000000000..68830bc87 --- /dev/null +++ b/helm/gtkmathview-bonobo/src/control-factory.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); + + diff --git a/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c b/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c deleted file mode 100644 index 3b24af7ee..000000000 --- a/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.c +++ /dev/null @@ -1,269 +0,0 @@ - -#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 deleted file mode 100644 index 68830bc87..000000000 --- a/helm/gtkmathview-bonobo/src/gtkmathview-bonobo.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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); - -