From c9bdd525e41cd0e2392da161dde2cf6aa72d8b4d Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 13 Jun 2000 14:37:28 +0000 Subject: Changed the needed e_marshal functions. 2000-06-13 Christopher James Lahey * e-util.c, e-util.h: Changed the needed e_marshal functions. * e-printable.c, e-printable.h: Added a quantize parameter to e_printable_height. Also, added a e_printable_will_fit function. svn path=/trunk/; revision=3551 --- e-util/ChangeLog | 7 +++++++ e-util/e-printable.c | 41 ++++++++++++++++++++++++++++++++++++++--- e-util/e-printable.h | 22 ++++++++++++++++++---- e-util/e-util.c | 44 +++++++++++++++++++++++++++++++++++--------- e-util/e-util.c-8611 | 44 +++++++++++++++++++++++++++++++++++--------- e-util/e-util.h | 10 +++++++--- e-util/e-util.h-29002 | 10 +++++++--- widgets/misc/e-printable.c | 41 ++++++++++++++++++++++++++++++++++++++--- widgets/misc/e-printable.h | 22 ++++++++++++++++++---- 9 files changed, 203 insertions(+), 38 deletions(-) diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 636486f392..d225599501 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,10 @@ +2000-06-13 Christopher James Lahey + + * e-util.c, e-util.h: Changed the needed e_marshal functions. + + * e-printable.c, e-printable.h: Added a quantize parameter to + e_printable_height. Also, added a e_printable_will_fit function. + 2000-06-10 Christopher James Lahey * Makefile.am: Added e-printable.c and e-printable.h. diff --git a/e-util/e-printable.c b/e-util/e-printable.c index 27170fef84..ed982469b8 100644 --- a/e-util/e-printable.c +++ b/e-util/e-printable.c @@ -24,6 +24,7 @@ enum { DATA_LEFT, RESET, HEIGHT, + WILL_FIT, LAST_SIGNAL }; @@ -64,8 +65,16 @@ e_printable_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, object_class->type, GTK_SIGNAL_OFFSET (EPrintableClass, height), - e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE, - GTK_TYPE_DOUBLE, 3, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE); + e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL, + GTK_TYPE_DOUBLE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); + + e_printable_signals [WILL_FIT] = + gtk_signal_new ("will_fit", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EPrintableClass, will_fit), + e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL, + GTK_TYPE_BOOL, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); gtk_object_class_add_signals (object_class, e_printable_signals, LAST_SIGNAL); @@ -73,6 +82,7 @@ e_printable_class_init (GtkObjectClass *object_class) klass->data_left = NULL; klass->reset = NULL; klass->height = NULL; + klass->will_fit = NULL; } @@ -154,7 +164,8 @@ gdouble e_printable_height (EPrintable *e_printable, GnomePrintContext *context, gdouble width, - gdouble max_height) + gdouble max_height, + gboolean quantized) { gdouble ret_val; @@ -166,6 +177,30 @@ e_printable_height (EPrintable *e_printable, context, width, max_height, + quantized, + &ret_val); + + return ret_val; +} + +gboolean +e_printable_will_fit (EPrintable *e_printable, + GnomePrintContext *context, + gdouble width, + gdouble max_height, + gboolean quantized) +{ + gboolean ret_val; + + g_return_val_if_fail (e_printable != NULL, -1); + g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1); + + gtk_signal_emit (GTK_OBJECT (e_printable), + e_printable_signals [WILL_FIT], + context, + width, + max_height, + quantized, &ret_val); return ret_val; diff --git a/e-util/e-printable.h b/e-util/e-printable.h index 2f8532e0ec..18e6ec8472 100644 --- a/e-util/e-printable.h +++ b/e-util/e-printable.h @@ -33,7 +33,16 @@ typedef struct { void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized); gboolean (*data_left) (EPrintable *etm); void (*reset) (EPrintable *etm); - gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height); + gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); + + /* e_printable_will_fit (ep, ...) should be equal in value to + * (e_printable_print_page (ep, ...), + * !e_printable_data_left(ep)) except that the latter has the + * side effect of doing the printing and advancing the + * position of the printable. + */ + + gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); } EPrintableClass; GtkType e_printable_get_type (void); @@ -41,8 +50,7 @@ GtkType e_printable_get_type (void); EPrintable *e_printable_new (void); /* - * Routines for emitting signals on the e_table - */ + * Routines for emitting signals on the e_table */ void e_printable_print_page (EPrintable *e_printable, GnomePrintContext *context, gdouble width, @@ -53,6 +61,12 @@ void e_printable_reset (EPrintable *e_printable); gdouble e_printable_height (EPrintable *e_printable, GnomePrintContext *context, gdouble width, - gdouble max_height); + gdouble max_height, + gboolean quantized); +gboolean e_printable_will_fit (EPrintable *e_printable, + GnomePrintContext *context, + gdouble width, + gdouble max_height, + gboolean quantized); #endif /* _E_PRINTABLE_H_ */ diff --git a/e-util/e-util.c b/e-util/e-util.c index a9c122eb74..6cb261410d 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -204,24 +204,50 @@ e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, func_data); } -typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE) (GtkObject * object, - GtkObject *arg1, - gdouble arg2, - gdouble arg3, - gpointer user_data); +typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, + GtkObject *arg1, + gdouble arg2, + gdouble arg3, + gboolean arg4, + gpointer user_data); void -e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE (GtkObject * object, +e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { - GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE rfunc; + GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; gdouble *return_val; - return_val = GTK_RETLOC_DOUBLE (args[3]); - rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE) func; + return_val = GTK_RETLOC_DOUBLE (args[4]); + rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) func; *return_val = (*rfunc) (object, GTK_VALUE_OBJECT (args[0]), GTK_VALUE_DOUBLE (args[1]), GTK_VALUE_DOUBLE (args[2]), + GTK_VALUE_BOOL (args[3]), + func_data); +} + +typedef gdouble (*GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, + GtkObject *arg1, + gdouble arg2, + gdouble arg3, + gboolean arg4, + gpointer user_data); + +void +e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, GtkArg * args) +{ + GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; + gboolean *return_val; + return_val = GTK_RETLOC_BOOL (args[4]); + rfunc = (GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) func; + *return_val = (*rfunc) (object, + GTK_VALUE_OBJECT (args[0]), + GTK_VALUE_DOUBLE (args[1]), + GTK_VALUE_DOUBLE (args[2]), + GTK_VALUE_BOOL (args[3]), func_data); } diff --git a/e-util/e-util.c-8611 b/e-util/e-util.c-8611 index a9c122eb74..6cb261410d 100644 --- a/e-util/e-util.c-8611 +++ b/e-util/e-util.c-8611 @@ -204,24 +204,50 @@ e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, func_data); } -typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE) (GtkObject * object, - GtkObject *arg1, - gdouble arg2, - gdouble arg3, - gpointer user_data); +typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, + GtkObject *arg1, + gdouble arg2, + gdouble arg3, + gboolean arg4, + gpointer user_data); void -e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE (GtkObject * object, +e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { - GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE rfunc; + GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; gdouble *return_val; - return_val = GTK_RETLOC_DOUBLE (args[3]); - rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE) func; + return_val = GTK_RETLOC_DOUBLE (args[4]); + rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) func; *return_val = (*rfunc) (object, GTK_VALUE_OBJECT (args[0]), GTK_VALUE_DOUBLE (args[1]), GTK_VALUE_DOUBLE (args[2]), + GTK_VALUE_BOOL (args[3]), + func_data); +} + +typedef gdouble (*GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, + GtkObject *arg1, + gdouble arg2, + gdouble arg3, + gboolean arg4, + gpointer user_data); + +void +e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, GtkArg * args) +{ + GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; + gboolean *return_val; + return_val = GTK_RETLOC_BOOL (args[4]); + rfunc = (GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) func; + *return_val = (*rfunc) (object, + GTK_VALUE_OBJECT (args[0]), + GTK_VALUE_DOUBLE (args[1]), + GTK_VALUE_DOUBLE (args[2]), + GTK_VALUE_BOOL (args[3]), func_data); } diff --git a/e-util/e-util.h b/e-util/e-util.h index 541c3f9afe..3df503f2d9 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -50,9 +50,13 @@ void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args); -void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args); +void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, GtkArg * args); + +void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, GtkArg * args); #endif /* _E_UTIL_H_ */ diff --git a/e-util/e-util.h-29002 b/e-util/e-util.h-29002 index 541c3f9afe..3df503f2d9 100644 --- a/e-util/e-util.h-29002 +++ b/e-util/e-util.h-29002 @@ -50,9 +50,13 @@ void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args); -void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args); +void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, GtkArg * args); + +void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, GtkArg * args); #endif /* _E_UTIL_H_ */ diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c index 27170fef84..ed982469b8 100644 --- a/widgets/misc/e-printable.c +++ b/widgets/misc/e-printable.c @@ -24,6 +24,7 @@ enum { DATA_LEFT, RESET, HEIGHT, + WILL_FIT, LAST_SIGNAL }; @@ -64,8 +65,16 @@ e_printable_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, object_class->type, GTK_SIGNAL_OFFSET (EPrintableClass, height), - e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE, - GTK_TYPE_DOUBLE, 3, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE); + e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL, + GTK_TYPE_DOUBLE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); + + e_printable_signals [WILL_FIT] = + gtk_signal_new ("will_fit", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EPrintableClass, will_fit), + e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL, + GTK_TYPE_BOOL, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); gtk_object_class_add_signals (object_class, e_printable_signals, LAST_SIGNAL); @@ -73,6 +82,7 @@ e_printable_class_init (GtkObjectClass *object_class) klass->data_left = NULL; klass->reset = NULL; klass->height = NULL; + klass->will_fit = NULL; } @@ -154,7 +164,8 @@ gdouble e_printable_height (EPrintable *e_printable, GnomePrintContext *context, gdouble width, - gdouble max_height) + gdouble max_height, + gboolean quantized) { gdouble ret_val; @@ -166,6 +177,30 @@ e_printable_height (EPrintable *e_printable, context, width, max_height, + quantized, + &ret_val); + + return ret_val; +} + +gboolean +e_printable_will_fit (EPrintable *e_printable, + GnomePrintContext *context, + gdouble width, + gdouble max_height, + gboolean quantized) +{ + gboolean ret_val; + + g_return_val_if_fail (e_printable != NULL, -1); + g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1); + + gtk_signal_emit (GTK_OBJECT (e_printable), + e_printable_signals [WILL_FIT], + context, + width, + max_height, + quantized, &ret_val); return ret_val; diff --git a/widgets/misc/e-printable.h b/widgets/misc/e-printable.h index 2f8532e0ec..18e6ec8472 100644 --- a/widgets/misc/e-printable.h +++ b/widgets/misc/e-printable.h @@ -33,7 +33,16 @@ typedef struct { void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized); gboolean (*data_left) (EPrintable *etm); void (*reset) (EPrintable *etm); - gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height); + gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); + + /* e_printable_will_fit (ep, ...) should be equal in value to + * (e_printable_print_page (ep, ...), + * !e_printable_data_left(ep)) except that the latter has the + * side effect of doing the printing and advancing the + * position of the printable. + */ + + gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); } EPrintableClass; GtkType e_printable_get_type (void); @@ -41,8 +50,7 @@ GtkType e_printable_get_type (void); EPrintable *e_printable_new (void); /* - * Routines for emitting signals on the e_table - */ + * Routines for emitting signals on the e_table */ void e_printable_print_page (EPrintable *e_printable, GnomePrintContext *context, gdouble width, @@ -53,6 +61,12 @@ void e_printable_reset (EPrintable *e_printable); gdouble e_printable_height (EPrintable *e_printable, GnomePrintContext *context, gdouble width, - gdouble max_height); + gdouble max_height, + gboolean quantized); +gboolean e_printable_will_fit (EPrintable *e_printable, + GnomePrintContext *context, + gdouble width, + gdouble max_height, + gboolean quantized); #endif /* _E_PRINTABLE_H_ */ -- cgit v1.2.3