diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-06-20 18:56:06 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-06-20 20:06:19 +0800 |
commit | 5d0878967ee21a039ef599222b1cf3eb606354d4 (patch) | |
tree | 790cfcbf63fea7292740f182dd612ab20244f6e8 | |
parent | f5f2132d60cdd1884c6343f759aadfd38a159e04 (diff) | |
download | gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.gz gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.bz2 gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.lz gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.xz gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.zst gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.zip |
Coding style and whitespace cleanup.
114 files changed, 1970 insertions, 2222 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c index 127b63daa1..8953e3705e 100644 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c @@ -140,14 +140,18 @@ addressbook_height (EReflowModel *erm, gint i, GnomeCanvasGroup *parent) gint count = 0; gchar *string; EContact *contact = (EContact*)e_addressbook_model_contact_at (priv->model, i); - PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), ""); + PangoLayout *layout; gint height; + layout = gtk_widget_create_pango_layout ( + GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), ""); + string = e_contact_get(contact, E_CONTACT_FILE_AS); height = text_height (layout, string ? string : "") + 10.0; g_free(string); - for (field = E_CONTACT_FULL_NAME; field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) { + for (field = E_CONTACT_FULL_NAME; + field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) { if (field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_GIVEN_NAME) continue; @@ -220,7 +224,9 @@ addressbook_compare (EReflowModel *erm, gint n1, gint n2) } static gint -adapter_drag_begin (EMinicard *card, GdkEvent *event, EAddressbookReflowAdapter *adapter) +adapter_drag_begin (EMinicard *card, + GdkEvent *event, + EAddressbookReflowAdapter *adapter) { gint ret_val = 0; @@ -296,7 +302,9 @@ remove_contacts (EAddressbookModel *model, gint count = indices->len; if (count == 1) - e_reflow_model_item_removed (E_REFLOW_MODEL (adapter), g_array_index (indices, gint, 0)); + e_reflow_model_item_removed ( + E_REFLOW_MODEL (adapter), + g_array_index (indices, gint, 0)); else e_reflow_model_changed (E_REFLOW_MODEL (adapter)); @@ -339,7 +347,10 @@ search_result (EAddressbookModel *model, } static void -addressbook_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +addressbook_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); EAddressbookReflowAdapterPrivate *priv = adapter->priv; @@ -367,7 +378,10 @@ addressbook_set_property (GObject *object, guint prop_id, const GValue *value, G } static void -addressbook_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +addressbook_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); EAddressbookReflowAdapterPrivate *priv = adapter->priv; diff --git a/calendar/common/authentication.c b/calendar/common/authentication.c index baacc1ead4..801a3907bf 100644 --- a/calendar/common/authentication.c +++ b/calendar/common/authentication.c @@ -35,7 +35,10 @@ static GHashTable *source_lists_hash = NULL; static gchar * -auth_func_cb (ECal *ecal, const gchar *prompt, const gchar *key, gpointer user_data) +auth_func_cb (ECal *ecal, + const gchar *prompt, + const gchar *key, + gpointer user_data) { gboolean remember; gchar *password, *auth_domain; @@ -48,11 +51,16 @@ auth_func_cb (ECal *ecal, const gchar *prompt, const gchar *key, gpointer user_d password = e_passwords_get_password (component_name, key); if (!password) - password = e_passwords_ask_password (_("Enter password"), component_name, key, prompt, - E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET|E_PASSWORDS_ONLINE, - &remember, - NULL); + password = e_passwords_ask_password ( + _("Enter password"), + component_name, key, prompt, + E_PASSWORDS_REMEMBER_FOREVER | + E_PASSWORDS_SECRET | + E_PASSWORDS_ONLINE, + &remember, NULL); + g_free (auth_domain); + return password; } @@ -139,7 +147,8 @@ e_auth_new_cal_from_uri (const gchar *uri, ECalSourceType type) if (source_list) { GSList *gl; - for (gl = e_source_list_peek_groups (source_list); gl != NULL && source == NULL; gl = gl->next) { + for (gl = e_source_list_peek_groups (source_list); + gl != NULL && source == NULL; gl = gl->next) { GSList *sl; for (sl = e_source_group_peek_sources (gl->data); sl != NULL; sl = sl->next) { diff --git a/calendar/gui/ea-calendar.c b/calendar/gui/ea-calendar.c index dcdf8bd650..84ce9d8f6b 100644 --- a/calendar/gui/ea-calendar.c +++ b/calendar/gui/ea-calendar.c @@ -36,9 +36,13 @@ EA_FACTORY (EA_TYPE_CAL_VIEW, ea_cal_view, ea_cal_view_new) EA_FACTORY (EA_TYPE_DAY_VIEW, ea_day_view, ea_day_view_new) -EA_FACTORY_GOBJECT (EA_TYPE_DAY_VIEW_MAIN_ITEM, ea_day_view_main_item, ea_day_view_main_item_new) +EA_FACTORY_GOBJECT ( + EA_TYPE_DAY_VIEW_MAIN_ITEM, + ea_day_view_main_item, ea_day_view_main_item_new) EA_FACTORY (EA_TYPE_WEEK_VIEW, ea_week_view, ea_week_view_new) -EA_FACTORY_GOBJECT (EA_TYPE_WEEK_VIEW_MAIN_ITEM, ea_week_view_main_item, ea_week_view_main_item_new) +EA_FACTORY_GOBJECT ( + EA_TYPE_WEEK_VIEW_MAIN_ITEM, + ea_week_view_main_item, ea_week_view_main_item_new) EA_FACTORY (EA_TYPE_GNOME_CALENDAR, ea_gnome_calendar, ea_gnome_calendar_new) static gboolean ea_calendar_focus_watcher (GSignalInvocationHint *ihint, diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index d2e60ccc1e..21f508d8d1 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1710,27 +1710,36 @@ msg_composer_delete_event_cb (GtkWidget *widget, gpointer user_data) } static void -msg_composer_prepare_for_quit_cb (EShell *shell, EActivity *activity, EMsgComposer *composer) +msg_composer_prepare_for_quit_cb (EShell *shell, + EActivity *activity, + EMsgComposer *composer) { if (e_msg_composer_is_exiting (composer)) { /* needs save draft first */ g_object_ref (activity); - g_object_weak_ref (G_OBJECT (composer), (GWeakNotify) g_object_unref, activity); + g_object_weak_ref ( + G_OBJECT (composer), (GWeakNotify) + g_object_unref, activity); gtk_action_activate (ACTION (SAVE_DRAFT)); } } static void -msg_composer_quit_requested_cb (EShell *shell, EShellQuitReason reason, EMsgComposer *composer) +msg_composer_quit_requested_cb (EShell *shell, + EShellQuitReason reason, + EMsgComposer *composer) { if (e_msg_composer_is_exiting (composer)) { EShell *shell; shell = e_shell_get_default (); - g_signal_handlers_disconnect_by_func (shell, msg_composer_quit_requested_cb, composer); - g_signal_handlers_disconnect_by_func (shell, msg_composer_prepare_for_quit_cb, composer); - } else if (!e_msg_composer_can_close (composer, FALSE) && !e_msg_composer_is_exiting (composer)) { + g_signal_handlers_disconnect_by_func ( + shell, msg_composer_quit_requested_cb, composer); + g_signal_handlers_disconnect_by_func ( + shell, msg_composer_prepare_for_quit_cb, composer); + } else if (!e_msg_composer_can_close (composer, FALSE) && + !e_msg_composer_is_exiting (composer)) { e_shell_cancel_quit (shell); } } @@ -1900,8 +1909,10 @@ msg_composer_destroy (GtkObject *object) shell = e_shell_get_default (); - g_signal_handlers_disconnect_by_func (shell, msg_composer_quit_requested_cb, composer); - g_signal_handlers_disconnect_by_func (shell, msg_composer_prepare_for_quit_cb, composer); + g_signal_handlers_disconnect_by_func ( + shell, msg_composer_quit_requested_cb, composer); + g_signal_handlers_disconnect_by_func ( + shell, msg_composer_prepare_for_quit_cb, composer); /* Chain up to parent's destroy() method. */ GTK_OBJECT_CLASS (parent_class)->destroy (object); diff --git a/e-util/e-alert.c b/e-util/e-alert.c index 3c7aca3ee1..c6b5357923 100644 --- a/e-util/e-alert.c +++ b/e-util/e-alert.c @@ -69,10 +69,18 @@ static struct _e_alert_button default_ok_button = { }; static struct _e_alert default_alerts[] = { - { GTK_DIALOG_MODAL, "error", 3, GTK_RESPONSE_OK, N_("Evolution Error"), "{0}", "{1}", NULL, FALSE, &default_ok_button }, - { GTK_DIALOG_MODAL, "error-primary", 3, GTK_RESPONSE_OK, N_("Evolution Error"), "{0}", NULL, NULL, FALSE, &default_ok_button }, - { GTK_DIALOG_MODAL, "warning", 1, GTK_RESPONSE_OK, N_("Evolution Warning"), "{0}", "{1}", NULL, FALSE, &default_ok_button }, - { GTK_DIALOG_MODAL, "warning-primary", 1, GTK_RESPONSE_OK, N_("Evolution Warning"), "{0}", NULL, NULL, FALSE, &default_ok_button }, + { GTK_DIALOG_MODAL, "error", 3, GTK_RESPONSE_OK, + N_("Evolution Error"), "{0}", "{1}", NULL, FALSE, + &default_ok_button }, + { GTK_DIALOG_MODAL, "error-primary", 3, GTK_RESPONSE_OK, + N_("Evolution Error"), "{0}", NULL, NULL, FALSE, + &default_ok_button }, + { GTK_DIALOG_MODAL, "warning", 1, GTK_RESPONSE_OK, + N_("Evolution Warning"), "{0}", "{1}", NULL, FALSE, + &default_ok_button }, + { GTK_DIALOG_MODAL, "warning-primary", 1, GTK_RESPONSE_OK, + N_("Evolution Warning"), "{0}", NULL, NULL, FALSE, + &default_ok_button }, }; /* ********************************************************************** */ @@ -150,12 +158,14 @@ struct _EAlertPrivate /* XML format: - <error id="error-id" type="info|warning|question|error"? response="default_response"? modal="true"? > + <error id="error-id" type="info|warning|question|error"? + response="default_response"? modal="true"? > <title>Window Title</title>? <primary>Primary error text.</primary>? <secondary>Secondary error text.</secondary>? <help uri="help uri"/> ? - <button stock="stock-button-id"? label="button label"? response="response_id"? /> * + <button stock="stock-button-id"? label="button label"? + response="response_id"? /> * </error> The tool e-error-tool is used to extract the translatable strings for @@ -335,7 +345,9 @@ e_alert_load_tables(void) table->domain = "builtin"; table->alerts = g_hash_table_new(g_str_hash, g_str_equal); for (i = 0; i < G_N_ELEMENTS (default_alerts); i++) - g_hash_table_insert(table->alerts, (gpointer) default_alerts[i].id, &default_alerts[i]); + g_hash_table_insert ( + table->alerts, (gpointer) + default_alerts[i].id, &default_alerts[i]); g_hash_table_insert(alert_table, (gpointer) table->domain, table); /* look for installed alert tables */ @@ -544,7 +556,10 @@ e_alert_append_text_escaped (GString *out, const gchar *text) } static void -e_alert_format_string (GString *out, const gchar *fmt, GPtrArray *args, gboolean escape_args) +e_alert_format_string (GString *out, + const gchar *fmt, + GPtrArray *args, + gboolean escape_args) { const gchar *end, *newstart; gint id; diff --git a/e-util/e-profile-event.h b/e-util/e-profile-event.h index 59d39f5a3a..6811526a6f 100644 --- a/e-util/e-profile-event.h +++ b/e-util/e-profile-event.h @@ -73,7 +73,11 @@ GType e_profile_event_get_type(void); EProfileEvent *e_profile_event_peek(void); -EProfileEventTarget *e_profile_event_target_new(EProfileEvent *emp, const gchar *id, const gchar *uid, guint32 flags); +EProfileEventTarget * +e_profile_event_target_new (EProfileEvent *emp, + const gchar *id, + const gchar *uid, + guint32 flags); /* we don't want ANY rubbish code lying around if we have profiling off */ #ifdef ENABLE_PROFILING diff --git a/libart_lgpl/art_affine.c b/libart_lgpl/art_affine.c index 8f3973de8e..dd6866ca86 100644 --- a/libart_lgpl/art_affine.c +++ b/libart_lgpl/art_affine.c @@ -27,7 +27,6 @@ #include <stdio.h> /* for sprintf */ #include <string.h> /* for strcpy */ - /* According to a strict interpretation of the libart structure, this routine should go into its own module, art_point_affine. However, it's only two lines of code, and it can be argued that it is one of @@ -42,9 +41,9 @@ **/ void art_affine_point (ArtPoint *dst, const ArtPoint *src, - const double affine[6]) + const gdouble affine[6]) { - double x, y; + gdouble x, y; x = src->x; y = src->y; @@ -64,9 +63,9 @@ art_affine_point (ArtPoint *dst, const ArtPoint *src, * will be (to within roundoff error) the identity affine. **/ void -art_affine_invert (double dst[6], const double src[6]) +art_affine_invert (gdouble dst[6], const gdouble src[6]) { - double r_det; + gdouble r_det; r_det = 1.0 / (src[0] * src[3] - src[1] * src[2]); dst[0] = src[3] * r_det; @@ -77,80 +76,6 @@ art_affine_invert (double dst[6], const double src[6]) dst[5] = -src[4] * dst[1] - src[5] * dst[3]; } -#define EPSILON 1e-6 - -/* It's ridiculous I have to write this myself. This is hardcoded to - six digits of precision, which is good enough for PostScript. - - The return value is the number of characters (i.e. strlen (str)). - It is no more than 12. */ -static int -art_ftoa (char str[80], double x) -{ - char *p = str; - int i, j; - - p = str; - if (fabs (x) < EPSILON / 2) - { - strcpy (str, "0"); - return 1; - } - if (x < 0) - { - *p++ = '-'; - x = -x; - } - if ((int)floor ((x + EPSILON / 2) < 1)) - { - *p++ = '0'; - *p++ = '.'; - i = sprintf (p, "%06d", (int)floor ((x + EPSILON / 2) * 1e6)); - while (i && p[i - 1] == '0') - i--; - if (i == 0) - i--; - p += i; - } - else if (x < 1e6) - { - i = sprintf (p, "%d", (int)floor (x + EPSILON / 2)); - p += i; - if (i < 6) - { - int ix; - - *p++ = '.'; - x -= floor (x + EPSILON / 2); - for (j = i; j < 6; j++) - x *= 10; - ix = floor (x + 0.5); - - for (j = 0; j < i; j++) - ix *= 10; - - /* A cheap hack, this routine can round wrong for fractions - near one. */ - if (ix == 1000000) - ix = 999999; - - sprintf (p, "%06d", ix); - i = 6 - i; - while (i && p[i - 1] == '0') - i--; - if (i == 0) - i--; - p += i; - } - } - else - p += sprintf (p, "%g", x); - - *p = '\0'; - return p - str; -} - - /** * art_affine_multiply: Multiply two affine transformation matrices. * @dst: Where to store the result. @@ -165,9 +90,9 @@ art_ftoa (char str[80], double x) * It is safe to call this function with @dst equal to @src1 or @src2. **/ void -art_affine_multiply (double dst[6], const double src1[6], const double src2[6]) +art_affine_multiply (gdouble dst[6], const gdouble src1[6], const gdouble src2[6]) { - double d0, d1, d2, d3, d4, d5; + gdouble d0, d1, d2, d3, d4, d5; d0 = src1[0] * src2[0] + src1[1] * src2[2]; d1 = src1[0] * src2[1] + src1[1] * src2[3]; @@ -190,7 +115,7 @@ art_affine_multiply (double dst[6], const double src1[6], const double src2[6]) * Sets up an identity matrix. **/ void -art_affine_identity (double dst[6]) +art_affine_identity (gdouble dst[6]) { dst[0] = 1; dst[1] = 0; @@ -200,7 +125,6 @@ art_affine_identity (double dst[6]) dst[5] = 0; } - /** * art_affine_scale: Set up a scaling matrix. * @dst: Where to store the resulting affine transform. @@ -210,7 +134,7 @@ art_affine_identity (double dst[6]) * Sets up a scaling matrix. **/ void -art_affine_scale (double dst[6], double sx, double sy) +art_affine_scale (gdouble dst[6], gdouble sx, gdouble sy) { dst[0] = sx; dst[1] = 0; @@ -229,7 +153,7 @@ art_affine_scale (double dst[6], double sx, double sy) * Sets up a translation matrix. **/ void -art_affine_translate (double dst[6], double tx, double ty) +art_affine_translate (gdouble dst[6], gdouble tx, gdouble ty) { dst[0] = 1; dst[1] = 0; @@ -250,8 +174,8 @@ art_affine_translate (double dst[6], double tx, double ty) * * Return value: the expansion factor. **/ -double -art_affine_expansion (const double src[6]) +gdouble +art_affine_expansion (const gdouble src[6]) { return sqrt (fabs (src[0] * src[3] - src[1] * src[2])); } diff --git a/libart_lgpl/art_affine.h b/libart_lgpl/art_affine.h index 44326d1388..2c50df1382 100644 --- a/libart_lgpl/art_affine.h +++ b/libart_lgpl/art_affine.h @@ -28,32 +28,30 @@ extern "C" { void art_affine_point (ArtPoint *dst, const ArtPoint *src, - const double affine[6]); + const gdouble affine[6]); void -art_affine_invert (double dst_affine[6], const double src_affine[6]); +art_affine_invert (gdouble dst_affine[6], const gdouble src_affine[6]); void -art_affine_multiply (double dst[6], - const double src1[6], const double src2[6]); +art_affine_multiply (gdouble dst[6], + const gdouble src1[6], const gdouble src2[6]); /* set up the identity matrix */ void -art_affine_identity (double dst[6]); +art_affine_identity (gdouble dst[6]); /* set up a scaling matrix */ void -art_affine_scale (double dst[6], double sx, double sy); +art_affine_scale (gdouble dst[6], gdouble sx, gdouble sy); /* set up a translation matrix */ void -art_affine_translate (double dst[6], double tx, double ty); - +art_affine_translate (gdouble dst[6], gdouble tx, gdouble ty); /* find the affine's "expansion factor", i.e. the scale amount */ -double -art_affine_expansion (const double src[6]); - +gdouble +art_affine_expansion (const gdouble src[6]); #ifdef __cplusplus } diff --git a/libart_lgpl/art_alphagamma.h b/libart_lgpl/art_alphagamma.h index f3ee35765f..a779ae86a8 100644 --- a/libart_lgpl/art_alphagamma.h +++ b/libart_lgpl/art_alphagamma.h @@ -32,9 +32,9 @@ typedef struct _ArtAlphaGamma ArtAlphaGamma; struct _ArtAlphaGamma { /*< private >*/ - double gamma; - int invtable_size; - int table[256]; + gdouble gamma; + gint invtable_size; + gint table[256]; art_u8 invtable[1]; }; diff --git a/libart_lgpl/art_bpath.c b/libart_lgpl/art_bpath.c index a25acbf95d..8c8dad0480 100644 --- a/libart_lgpl/art_bpath.c +++ b/libart_lgpl/art_bpath.c @@ -24,7 +24,6 @@ #include <math.h> - /** * art_bpath_affine_transform: Affine transform an #ArtBpath. * @src: The source #ArtBpath. @@ -39,13 +38,13 @@ * Return value: the transformed #ArtBpath. **/ ArtBpath * -art_bpath_affine_transform (const ArtBpath *src, const double matrix[6]) +art_bpath_affine_transform (const ArtBpath *src, const gdouble matrix[6]) { - int i; - int size; + gint i; + gint size; ArtBpath *new; ArtPathcode code; - double x, y; + gdouble x, y; for (i = 0; src[i].code != ART_END; i++); size = i; diff --git a/libart_lgpl/art_bpath.h b/libart_lgpl/art_bpath.h index ce73c0b03d..e6362d41de 100644 --- a/libart_lgpl/art_bpath.h +++ b/libart_lgpl/art_bpath.h @@ -35,16 +35,16 @@ typedef struct _ArtBpath ArtBpath; struct _ArtBpath { /*< public >*/ ArtPathcode code; - double x1; - double y1; - double x2; - double y2; - double x3; - double y3; + gdouble x1; + gdouble y1; + gdouble x2; + gdouble y2; + gdouble x3; + gdouble y3; }; ArtBpath * -art_bpath_affine_transform (const ArtBpath *src, const double matrix[6]); +art_bpath_affine_transform (const ArtBpath *src, const gdouble matrix[6]); #ifdef __cplusplus } diff --git a/libart_lgpl/art_filterlevel.h b/libart_lgpl/art_filterlevel.h index 1f4be484b4..97d9abb400 100644 --- a/libart_lgpl/art_filterlevel.h +++ b/libart_lgpl/art_filterlevel.h @@ -60,7 +60,6 @@ typedef enum { */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libart_lgpl/art_gray_svp.c b/libart_lgpl/art_gray_svp.c index e5d5df9d74..f076a69f99 100644 --- a/libart_lgpl/art_gray_svp.c +++ b/libart_lgpl/art_gray_svp.c @@ -32,20 +32,20 @@ typedef struct _ArtGraySVPData ArtGraySVPData; struct _ArtGraySVPData { art_u8 *buf; - int rowstride; - int x0, x1; + gint rowstride; + gint x0, x1; }; static void -art_gray_svp_callback (void *callback_data, int y, - int start, ArtSVPRenderAAStep *steps, int n_steps) +art_gray_svp_callback (gpointer callback_data, gint y, + gint start, ArtSVPRenderAAStep *steps, gint n_steps) { ArtGraySVPData *data = (ArtGraySVPData *)callback_data; art_u8 *linebuf; - int run_x0, run_x1; - int running_sum = start; - int x0, x1; - int k; + gint run_x0, run_x1; + gint running_sum = start; + gint x0, x1; + gint k; #if 0 printf ("start = %d", start); @@ -110,8 +110,8 @@ art_gray_svp_callback (void *callback_data, int y, **/ void art_gray_svp_aa (const ArtSVP *svp, - int x0, int y0, int x1, int y1, - art_u8 *buf, int rowstride) + gint x0, gint y0, gint x1, gint y1, + art_u8 *buf, gint rowstride) { ArtGraySVPData data; diff --git a/libart_lgpl/art_gray_svp.h b/libart_lgpl/art_gray_svp.h index 52ab2239e3..1a3c5d9c9a 100644 --- a/libart_lgpl/art_gray_svp.h +++ b/libart_lgpl/art_gray_svp.h @@ -31,8 +31,8 @@ extern "C" { void art_gray_svp_aa (const ArtSVP *svp, - int x0, int y0, int x1, int y1, - art_u8 *buf, int rowstride); + gint x0, gint y0, gint x1, gint y1, + art_u8 *buf, gint rowstride); #ifdef __cplusplus } diff --git a/libart_lgpl/art_misc.c b/libart_lgpl/art_misc.c index 777ad702a6..713522b580 100644 --- a/libart_lgpl/art_misc.c +++ b/libart_lgpl/art_misc.c @@ -35,7 +35,7 @@ * Used for dealing with severe errors. **/ void -art_die (const char *fmt, ...) +art_die (const gchar *fmt, ...) { va_list ap; @@ -52,7 +52,7 @@ art_die (const char *fmt, ...) * Used for generating warnings. **/ void -art_warn (const char *fmt, ...) +art_warn (const gchar *fmt, ...) { va_list ap; @@ -61,17 +61,17 @@ art_warn (const char *fmt, ...) va_end (ap); } -void *art_alloc(size_t size) +gpointer art_alloc(gsize size) { return malloc(size); } -void art_free(void *ptr) +void art_free(gpointer ptr) { free(ptr); } -void *art_realloc(void *ptr, size_t size) +gpointer art_realloc(gpointer ptr, gsize size) { return realloc(ptr, size); } diff --git a/libart_lgpl/art_misc.h b/libart_lgpl/art_misc.h index b0a445b238..054b912dbd 100644 --- a/libart_lgpl/art_misc.h +++ b/libart_lgpl/art_misc.h @@ -29,9 +29,9 @@ #ifdef __cplusplus extern "C" { #endif -void *art_alloc(size_t size); -void art_free(void *ptr); -void *art_realloc(void *ptr, size_t size); +gpointer art_alloc(gsize size); +void art_free(gpointer ptr); +gpointer art_realloc(gpointer ptr, gsize size); #ifdef __cplusplus } #endif /* __cplusplus */ @@ -45,9 +45,11 @@ void *art_realloc(void *ptr, size_t size); /* This one must be used carefully - in particular, p and max should be variables. They can also be pstruct->el lvalues. */ -#define art_expand(p, type, max) do { if(max) { p = art_renew (p, type, max <<= 1); } else { max = 1; p = art_new(type, 1); } } while (0) +#define art_expand(p, type, max) \ + do { if(max) { p = art_renew (p, type, max <<= 1); } \ + else { max = 1; p = art_new(type, 1); } } while (0) -typedef int art_boolean; +typedef gint art_boolean; #define ART_FALSE 0 #define ART_TRUE 1 @@ -81,10 +83,10 @@ typedef guint16 art_u16; typedef guint32 art_u32; void ART_GNUC_NORETURN -art_die (const char *fmt, ...) ART_GNUC_PRINTF (1, 2); +art_die (const gchar *fmt, ...) ART_GNUC_PRINTF (1, 2); void -art_warn (const char *fmt, ...) ART_GNUC_PRINTF (1, 2); +art_warn (const gchar *fmt, ...) ART_GNUC_PRINTF (1, 2); #ifdef __cplusplus } diff --git a/libart_lgpl/art_point.h b/libart_lgpl/art_point.h index 1efcda67aa..a5486d22c6 100644 --- a/libart_lgpl/art_point.h +++ b/libart_lgpl/art_point.h @@ -20,6 +20,8 @@ #ifndef __ART_POINT_H__ #define __ART_POINT_H__ +#include <glib.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -28,7 +30,7 @@ typedef struct _ArtPoint ArtPoint; struct _ArtPoint { /*< public >*/ - double x, y; + gdouble x, y; }; #ifdef __cplusplus diff --git a/libart_lgpl/art_rect.c b/libart_lgpl/art_rect.c index bd1cd6e229..ec53d2d70f 100644 --- a/libart_lgpl/art_rect.c +++ b/libart_lgpl/art_rect.c @@ -54,7 +54,7 @@ art_irect_intersect (ArtIRect *dest, const ArtIRect *src1, const ArtIRect *src2) * * Return value: TRUE if @src is an empty rectangle, FALSE otherwise. **/ -int +gint art_irect_empty (const ArtIRect *src) { return (src->x1 <= src->x0 || src->y1 <= src->y0); } @@ -102,7 +102,7 @@ art_drect_union (ArtDRect *dest, const ArtDRect *src1, const ArtDRect *src2) { * * Return value: TRUE if @src is an empty rectangle, FALSE otherwise. **/ -int +gint art_drect_empty (const ArtDRect *src) { return (src->x1 <= src->x0 || src->y1 <= src->y0); } @@ -119,10 +119,12 @@ art_drect_empty (const ArtDRect *src) { * is a conservative approximation. **/ void -art_drect_affine_transform (ArtDRect *dst, const ArtDRect *src, const double matrix[6]) +art_drect_affine_transform (ArtDRect *dst, + const ArtDRect *src, + const gdouble matrix[6]) { - double x00, y00, x10, y10; - double x01, y01, x11, y11; + gdouble x00, y00, x10, y10; + gdouble x01, y01, x11, y11; x00 = src->x0 * matrix[0] + src->y0 * matrix[2] + matrix[4]; y00 = src->x0 * matrix[1] + src->y0 * matrix[3] + matrix[5]; diff --git a/libart_lgpl/art_rect.h b/libart_lgpl/art_rect.h index 247cbea3e9..fb3ebb762b 100644 --- a/libart_lgpl/art_rect.h +++ b/libart_lgpl/art_rect.h @@ -20,6 +20,8 @@ #ifndef __ART_RECT_H__ #define __ART_RECT_H__ +#include <glib.h> + #ifdef __cplusplus extern "C" { #endif @@ -29,12 +31,12 @@ typedef struct _ArtIRect ArtIRect; struct _ArtDRect { /*< public >*/ - double x0, y0, x1, y1; + gdouble x0, y0, x1, y1; }; struct _ArtIRect { /*< public >*/ - int x0, y0, x1, y1; + gint x0, y0, x1, y1; }; /* Make a copy of the rectangle. */ @@ -45,7 +47,7 @@ void art_irect_intersect (ArtIRect *dest, const ArtIRect *src1, const ArtIRect *src2); /* Return true if the rectangle is empty. */ -int art_irect_empty (const ArtIRect *src); +gint art_irect_empty (const ArtIRect *src); /* Make a copy of the rectangle. */ void art_drect_copy (ArtDRect *dest, const ArtDRect *src); @@ -55,11 +57,11 @@ void art_drect_union (ArtDRect *dest, const ArtDRect *src1, const ArtDRect *src2); /* Return true if the rectangle is empty. */ -int art_drect_empty (const ArtDRect *src); +gint art_drect_empty (const ArtDRect *src); void art_drect_affine_transform (ArtDRect *dst, const ArtDRect *src, - const double matrix[6]); + const gdouble matrix[6]); void art_drect_to_irect (ArtIRect *dst, ArtDRect *src); diff --git a/libart_lgpl/art_rect_svp.c b/libart_lgpl/art_rect_svp.c index d9819963a9..5d92100179 100644 --- a/libart_lgpl/art_rect_svp.c +++ b/libart_lgpl/art_rect_svp.c @@ -42,7 +42,7 @@ void art_drect_svp (ArtDRect *bbox, const ArtSVP *svp) { - int i; + gint i; if (svp->n_segs == 0) { @@ -54,7 +54,7 @@ art_drect_svp (ArtDRect *bbox, const ArtSVP *svp) } art_drect_copy (bbox, &svp->segs[0].bbox); - + for (i = 1; i < svp->n_segs; i++) { bbox->x0 = MIN (bbox->x0, svp->segs[i].bbox.x0); diff --git a/libart_lgpl/art_rect_uta.c b/libart_lgpl/art_rect_uta.c index cd002f81af..e7d1c77a5c 100644 --- a/libart_lgpl/art_rect_uta.c +++ b/libart_lgpl/art_rect_uta.c @@ -43,20 +43,20 @@ * Return value: An array containing the resulting rectangles. **/ ArtIRect * -art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height, - int *p_nrects) +art_rect_list_from_uta (ArtUta *uta, gint max_width, gint max_height, + gint *p_nrects) { ArtIRect *rects; - int n_rects, n_rects_max; - int x, y; - int width, height; - int ix; - int left_ix; + gint n_rects, n_rects_max; + gint x, y; + gint width, height; + gint ix; + gint left_ix; ArtUtaBbox *utiles; ArtUtaBbox bb; - int x0, y0, x1, y1; - int *glom; - int glom_rect; + gint x0, y0, x1, y1; + gint *glom; + gint glom_rect; n_rects = 0; n_rects_max = 1; @@ -96,7 +96,6 @@ art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height, } x1 = ((uta->x0 + x) << ART_UTILE_SHIFT) + ART_UTA_BBOX_X1(bb); - /* if rectangle nonempty */ if ((x1 ^ x0) | (y1 ^ y0)) { diff --git a/libart_lgpl/art_rect_uta.h b/libart_lgpl/art_rect_uta.h index 39a1880782..7b07d89ad9 100644 --- a/libart_lgpl/art_rect_uta.h +++ b/libart_lgpl/art_rect_uta.h @@ -28,8 +28,8 @@ extern "C" { #endif /* __cplusplus */ ArtIRect * -art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height, - int *p_nrects); +art_rect_list_from_uta (ArtUta *uta, gint max_width, gint max_height, + gint *p_nrects); #ifdef __cplusplus } diff --git a/libart_lgpl/art_render.c b/libart_lgpl/art_render.c index 8792908158..6c71e4a260 100644 --- a/libart_lgpl/art_render.c +++ b/libart_lgpl/art_render.c @@ -32,10 +32,10 @@ struct _ArtRenderPriv { ArtImageSource *image_source; - int n_mask_source; + gint n_mask_source; ArtMaskSource **mask_source; - int n_callbacks; + gint n_callbacks; ArtRenderCallback **callbacks; }; @@ -46,9 +46,9 @@ art_render_nop_done (ArtRenderCallback *self, ArtRender *render) static void art_render_clear_render_rgb8 (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { - int width = render->x1 - render->x0; + gint width = render->x1 - render->x0; art_u8 r, g, b; ArtPixMaxDepth color_max; @@ -64,12 +64,12 @@ art_render_clear_render_rgb8 (ArtRenderCallback *self, ArtRender *render, static void art_render_clear_render_8 (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { - int width = render->x1 - render->x0; - int i, j; - int n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE); - int ix; + gint width = render->x1 - render->x0; + gint i, j; + gint n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE); + gint ix; art_u8 color[ART_MAX_CHAN + 1]; for (j = 0; j < n_ch; j++) @@ -100,18 +100,18 @@ const ArtRenderCallback art_render_clear_8_obj = static void art_render_clear_render_16 (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { - int width = render->x1 - render->x0; - int i, j; - int n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE); - int ix; + gint width = render->x1 - render->x0; + gint i, j; + gint n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE); + gint ix; art_u16 *dest_16 = (art_u16 *)dest; art_u8 color[ART_MAX_CHAN + 1]; for (j = 0; j < n_ch; j++) { - int color_16 = render->clear_color[j]; + gint color_16 = render->clear_color[j]; color[j] = color_16; } @@ -135,31 +135,31 @@ const ArtRenderCallback art_render_clear_16_obj = lead to overflow. */ static void art_render_composite (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { ArtRenderMaskRun *run = render->run; art_u32 depth = render->depth; - int n_run = render->n_run; - int x0 = render->x0; - int x; - int run_x0, run_x1; + gint n_run = render->n_run; + gint x0 = render->x0; + gint x; + gint run_x0, run_x1; art_u8 *alpha_buf = render->alpha_buf; art_u8 *image_buf = render->image_buf; - int i, j; + gint i, j; art_u32 tmp; art_u32 run_alpha; art_u32 alpha; - int image_ix; + gint image_ix; art_u16 src[ART_MAX_CHAN + 1]; art_u16 dst[ART_MAX_CHAN + 1]; - int n_chan = render->n_chan; + gint n_chan = render->n_chan; ArtAlphaType alpha_type = render->alpha_type; - int n_ch = n_chan + (alpha_type != ART_ALPHA_NONE); - int dst_pixstride = n_ch * (depth >> 3); - int buf_depth = render->buf_depth; + gint n_ch = n_chan + (alpha_type != ART_ALPHA_NONE); + gint dst_pixstride = n_ch * (depth >> 3); + gint buf_depth = render->buf_depth; ArtAlphaType buf_alpha = render->buf_alpha; - int buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE); - int buf_pixstride = buf_n_ch * (buf_depth >> 3); + gint buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE); + gint buf_pixstride = buf_n_ch * (buf_depth >> 3); art_u8 *bufptr; art_u32 src_alpha; art_u32 src_mul; @@ -176,7 +176,7 @@ art_render_composite (ArtRenderCallback *self, ArtRender *render, if (tmp < 0x8100) continue; - run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */ + run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; bufptr = image_buf + (run_x0 - x0) * buf_pixstride; dstptr = dest + (run_x0 - x0) * dst_pixstride; for (x = run_x0; x < run_x1; x++) @@ -356,27 +356,27 @@ const ArtRenderCallback art_render_composite_obj = static void art_render_composite_8 (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { ArtRenderMaskRun *run = render->run; - int n_run = render->n_run; - int x0 = render->x0; - int x; - int run_x0, run_x1; + gint n_run = render->n_run; + gint x0 = render->x0; + gint x; + gint run_x0, run_x1; art_u8 *alpha_buf = render->alpha_buf; art_u8 *image_buf = render->image_buf; - int i, j; + gint i, j; art_u32 tmp; art_u32 run_alpha; art_u32 alpha; - int image_ix; - int n_chan = render->n_chan; + gint image_ix; + gint n_chan = render->n_chan; ArtAlphaType alpha_type = render->alpha_type; - int n_ch = n_chan + (alpha_type != ART_ALPHA_NONE); - int dst_pixstride = n_ch; + gint n_ch = n_chan + (alpha_type != ART_ALPHA_NONE); + gint dst_pixstride = n_ch; ArtAlphaType buf_alpha = render->buf_alpha; - int buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE); - int buf_pixstride = buf_n_ch; + gint buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE); + gint buf_pixstride = buf_n_ch; art_u8 *bufptr; art_u32 src_alpha; art_u32 src_mul; @@ -393,7 +393,7 @@ art_render_composite_8 (ArtRenderCallback *self, ArtRender *render, if (tmp < 0x10000) continue; - run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */ + run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; bufptr = image_buf + (run_x0 - x0) * buf_pixstride; dstptr = dest + (run_x0 - x0) * dst_pixstride; for (x = run_x0; x < run_x1; x++) @@ -497,7 +497,6 @@ const ArtRenderCallback art_render_composite_8_obj = art_render_nop_done }; - /* Assumes: * alpha_buf is NULL * buf_alpha = ART_ALPHA_NONE (source) @@ -506,18 +505,18 @@ const ArtRenderCallback art_render_composite_8_obj = */ static void art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { ArtRenderMaskRun *run = render->run; - int n_run = render->n_run; - int x0 = render->x0; - int x; - int run_x0, run_x1; + gint n_run = render->n_run; + gint x0 = render->x0; + gint x; + gint run_x0, run_x1; art_u8 *image_buf = render->image_buf; - int i, j; + gint i, j; art_u32 tmp; art_u32 run_alpha; - int image_ix; + gint image_ix; art_u8 *bufptr; art_u32 src_mul; art_u8 *dstptr; @@ -533,7 +532,7 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render, if (tmp < 0x10000) continue; - run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */ + run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; bufptr = image_buf + (run_x0 - x0) * 3; dstptr = dest + (run_x0 - x0) * 4; if (run_alpha == 0x10000) @@ -551,27 +550,27 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render, for (x = run_x0; x < run_x1; x++) { src_mul = run_alpha * 0x101; - + tmp = dstptr[3]; /* range 0..0xff */ dst_alpha = (tmp << 8) + tmp + (tmp >> 7); dst_mul = dst_alpha; /* dst_alpha is the alpha of the dest pixel, range 0..0x10000 */ - + dst_mul *= 0x101; - + dst_alpha += ((((0x10000 - dst_alpha) * run_alpha) >> 8) + 0x80) >> 8; if (dst_alpha == 0) dst_save_mul = 0xff; else /* (dst_alpha != 0) */ dst_save_mul = 0xff0000 / dst_alpha; - + for (j = 0; j < 3; j++) { art_u32 src, dst; art_u32 tmp; - + src = (bufptr[j] * src_mul + 0x8000) >> 16; dst = (dstptr[j] * dst_mul + 0x8000) >> 16; tmp = ((dst * (0x10000 - run_alpha) + 0x8000) >> 16) + src; @@ -579,7 +578,7 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render, dstptr[j] = (tmp * dst_save_mul + 0x8000) >> 16; } dstptr[3] = (dst_alpha * 0xff + 0x8000) >> 16; - + bufptr += 3; dstptr += 4; } @@ -587,7 +586,6 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render, } } - const ArtRenderCallback art_render_composite_8_opt1_obj = { art_render_composite_8_opt1, @@ -602,18 +600,18 @@ const ArtRenderCallback art_render_composite_8_opt1_obj = */ static void art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y) + art_u8 *dest, gint y) { ArtRenderMaskRun *run = render->run; - int n_run = render->n_run; - int x0 = render->x0; - int x; - int run_x0, run_x1; + gint n_run = render->n_run; + gint x0 = render->x0; + gint x; + gint run_x0, run_x1; art_u8 *image_buf = render->image_buf; - int i, j; + gint i, j; art_u32 tmp; art_u32 run_alpha; - int image_ix; + gint image_ix; art_u8 *bufptr; art_u32 src_alpha; art_u32 src_mul; @@ -630,7 +628,7 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, if (tmp < 0x10000) continue; - run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */ + run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; bufptr = image_buf + (run_x0 - x0) * 4; dstptr = dest + (run_x0 - x0) * 4; if (run_alpha == 0x10000) @@ -640,28 +638,28 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, src_alpha = (bufptr[3] << 8) + bufptr[3] + (bufptr[3] >> 7); /* src_alpha is the (alpha of the source pixel), range 0..0x10000 */ - + dst_alpha = (dstptr[3] << 8) + dstptr[3] + (dstptr[3] >> 7); /* dst_alpha is the alpha of the dest pixel, range 0..0x10000 */ - + dst_mul = dst_alpha*0x101; - + if (src_alpha >= 0x10000) dst_alpha = 0x10000; else dst_alpha += ((((0x10000 - dst_alpha) * src_alpha) >> 8) + 0x80) >> 8; - + if (dst_alpha == 0) dst_save_mul = 0xff; else /* dst_alpha != 0) */ dst_save_mul = 0xff0000 / dst_alpha; - + for (j = 0; j < 3; j++) { art_u32 src, dst; art_u32 tmp; - + src = (bufptr[j] << 8) | bufptr[j]; dst = (dstptr[j] * dst_mul + 0x8000) >> 16; tmp = ((dst * (0x10000 - src_alpha) + 0x8000) >> 16) + src; @@ -669,7 +667,7 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, dstptr[j] = (tmp * dst_save_mul + 0x8000) >> 16; } dstptr[3] = (dst_alpha * 0xff + 0x8000) >> 16; - + bufptr += 4; dstptr += 4; } @@ -683,23 +681,23 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, src_alpha = (tmp + (tmp >> 8) + (tmp >> 16)) >> 8; /* src_alpha is the (alpha of the source pixel * alpha), range 0..0x10000 */ - + src_mul = run_alpha * 0x101; - + tmp = dstptr[3]; /* range 0..0xff */ dst_alpha = (tmp << 8) + tmp + (tmp >> 7); dst_mul = dst_alpha; /* dst_alpha is the alpha of the dest pixel, range 0..0x10000 */ - + dst_mul *= 0x101; - + if (src_alpha >= 0x10000) dst_alpha = 0x10000; else dst_alpha += ((((0x10000 - dst_alpha) * src_alpha) >> 8) + 0x80) >> 8; - + if (dst_alpha == 0) { dst_save_mul = 0xff; @@ -708,12 +706,12 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, { dst_save_mul = 0xff0000 / dst_alpha; } - + for (j = 0; j < 3; j++) { art_u32 src, dst; art_u32 tmp; - + src = (bufptr[j] * src_mul + 0x8000) >> 16; dst = (dstptr[j] * dst_mul + 0x8000) >> 16; tmp = ((dst * (0x10000 - src_alpha) + 0x8000) >> 16) + src; @@ -721,7 +719,7 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render, dstptr[j] = (tmp * dst_save_mul + 0x8000) >> 16; } dstptr[3] = (dst_alpha * 0xff + 0x8000) >> 16; - + bufptr += 4; dstptr += 4; } @@ -735,4 +733,3 @@ const ArtRenderCallback art_render_composite_8_opt2_obj = art_render_nop_done }; - diff --git a/libart_lgpl/art_render.h b/libart_lgpl/art_render.h index 69e1d9346e..e97d3bbddc 100644 --- a/libart_lgpl/art_render.h +++ b/libart_lgpl/art_render.h @@ -76,13 +76,13 @@ typedef enum { } ArtImageSourceFlags; struct _ArtRenderMaskRun { - int x; - int alpha; + gint x; + gint alpha; }; struct _ArtRenderCallback { void (*render) (ArtRenderCallback *self, ArtRender *render, - art_u8 *dest, int y); + art_u8 *dest, gint y); void (*done) (ArtRenderCallback *self, ArtRender *render); }; @@ -90,12 +90,12 @@ struct _ArtImageSource { ArtRenderCallback super; void (*negotiate) (ArtImageSource *self, ArtRender *render, ArtImageSourceFlags *p_flags, - int *p_buf_depth, ArtAlphaType *p_alpha_type); + gint *p_buf_depth, ArtAlphaType *p_alpha_type); }; struct _ArtMaskSource { ArtRenderCallback super; - int (*can_drive) (ArtMaskSource *self, ArtRender *render); + gint (*can_drive) (ArtMaskSource *self, ArtRender *render); /* For each mask source, ::prepare() is invoked if it is not a driver, or ::invoke_driver() if it is. */ void (*invoke_driver) (ArtMaskSource *self, ArtRender *render); @@ -104,12 +104,12 @@ struct _ArtMaskSource { struct _ArtRender { /* parameters of destination image */ - int x0, y0; - int x1, y1; + gint x0, y0; + gint x1, y1; art_u8 *pixels; - int rowstride; - int n_chan; - int depth; + gint rowstride; + gint n_chan; + gint depth; ArtAlphaType alpha_type; art_boolean clear; @@ -123,18 +123,18 @@ struct _ArtRender { art_u8 *alpha_buf; /* parameters of intermediate buffer */ - int buf_depth; + gint buf_depth; ArtAlphaType buf_alpha; art_u8 *image_buf; /* driving alpha scanline data */ /* A "run" is a contiguous sequence of x values with the same alpha value. */ - int n_run; + gint n_run; ArtRenderMaskRun *run; /* A "span" is a contiguous sequence of x values with non-zero alpha. */ - int n_span; - int *span_x; + gint n_span; + gint *span_x; art_boolean need_span; }; diff --git a/libart_lgpl/art_rgb.c b/libart_lgpl/art_rgb.c index 05bfa02289..34e6d237f9 100644 --- a/libart_lgpl/art_rgb.c +++ b/libart_lgpl/art_rgb.c @@ -50,7 +50,7 @@ void art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n) { - int i; + gint i; if (r == g && g == b) { @@ -87,10 +87,10 @@ art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n) * The implementation of this routine is very highly optimized. **/ void -art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n) +art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n) { - int i; - unsigned int v1, v2, v3; + gint i; + guint v1, v2, v3; if (r == g && g == b) { @@ -157,10 +157,10 @@ art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n) * opacity @alpha. **/ void -art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n) +art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint alpha, gint n) { - int i; - int v; + gint i; + gint v; for (i = 0; i < n; i++) { diff --git a/libart_lgpl/art_rgb.h b/libart_lgpl/art_rgb.h index c195a5c43f..d7581b4402 100644 --- a/libart_lgpl/art_rgb.h +++ b/libart_lgpl/art_rgb.h @@ -27,11 +27,11 @@ extern "C" { #endif void -art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n); +art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n); void -art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, - int n); +art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint alpha, + gint n); #ifdef __cplusplus } diff --git a/libart_lgpl/art_rgb_affine.c b/libart_lgpl/art_rgb_affine.c index 1d826672d1..61cdb1e9a8 100644 --- a/libart_lgpl/art_rgb_affine.c +++ b/libart_lgpl/art_rgb_affine.c @@ -61,23 +61,23 @@ * implemented. **/ void -art_rgb_affine (art_u8 *dst, int x0, int y0, int x1, int y1, int dst_rowstride, +art_rgb_affine (art_u8 *dst, gint x0, gint y0, gint x1, gint y1, gint dst_rowstride, const art_u8 *src, - int src_width, int src_height, int src_rowstride, - const double affine[6], + gint src_width, gint src_height, gint src_rowstride, + const gdouble affine[6], ArtFilterLevel level, ArtAlphaGamma *alphagamma) { /* Note: this is a slow implementation, and is missing all filter levels other than NEAREST. It is here for clarity of presentation and to establish the interface. */ - int x, y; - double inv[6]; + gint x, y; + gdouble inv[6]; art_u8 *dst_p, *dst_linestart; const art_u8 *src_p; ArtPoint pt, src_pt; - int src_x, src_y; - int run_x0, run_x1; + gint src_x, src_y; + gint run_x0, run_x1; dst_linestart = dst; art_affine_invert (inv, affine); diff --git a/libart_lgpl/art_rgb_affine.h b/libart_lgpl/art_rgb_affine.h index 1bf146ae70..9f1414753a 100644 --- a/libart_lgpl/art_rgb_affine.h +++ b/libart_lgpl/art_rgb_affine.h @@ -31,10 +31,10 @@ extern "C" { #endif void -art_rgb_affine (art_u8 *dst, int x0, int y0, int x1, int y1, int dst_rowstride, +art_rgb_affine (art_u8 *dst, gint x0, gint y0, gint x1, gint y1, gint dst_rowstride, const art_u8 *src, - int src_width, int src_height, int src_rowstride, - const double affine[6], + gint src_width, gint src_height, gint src_rowstride, + const gdouble affine[6], ArtFilterLevel level, ArtAlphaGamma *alphagamma); diff --git a/libart_lgpl/art_rgb_affine_private.c b/libart_lgpl/art_rgb_affine_private.c index 679e114c14..9f2d12026f 100644 --- a/libart_lgpl/art_rgb_affine_private.c +++ b/libart_lgpl/art_rgb_affine_private.c @@ -40,14 +40,14 @@ #define EPSILON 1e-6 void -art_rgb_affine_run (int *p_x0, int *p_x1, int y, - int src_width, int src_height, - const double affine[6]) +art_rgb_affine_run (gint *p_x0, gint *p_x1, gint y, + gint src_width, gint src_height, + const gdouble affine[6]) { - int x0, x1; - double z; - double x_intercept; - int xi; + gint x0, x1; + gdouble z; + gdouble x_intercept; + gint xi; x0 = *p_x0; x1 = *p_x1; diff --git a/libart_lgpl/art_rgb_affine_private.h b/libart_lgpl/art_rgb_affine_private.h index edaf0e3aaa..a01ad770f1 100644 --- a/libart_lgpl/art_rgb_affine_private.h +++ b/libart_lgpl/art_rgb_affine_private.h @@ -23,14 +23,16 @@ /* This module handles compositing of affine-transformed rgb images over rgb pixel buffers. */ +#include <glib.h> + #ifdef __cplusplus extern "C" { #endif void -art_rgb_affine_run (int *p_x0, int *p_x1, int y, - int src_width, int src_height, - const double affine[6]); +art_rgb_affine_run (gint *p_x0, gint *p_x1, gint y, + gint src_width, gint src_height, + const gdouble affine[6]); #ifdef __cplusplus } diff --git a/libart_lgpl/art_rgb_rgba_affine.c b/libart_lgpl/art_rgb_rgba_affine.c index 41c7397270..a6da49ed91 100644 --- a/libart_lgpl/art_rgb_rgba_affine.c +++ b/libart_lgpl/art_rgb_rgba_affine.c @@ -64,27 +64,27 @@ **/ void art_rgb_rgba_affine (art_u8 *dst, - int x0, int y0, int x1, int y1, int dst_rowstride, + gint x0, gint y0, gint x1, gint y1, gint dst_rowstride, const art_u8 *src, - int src_width, int src_height, int src_rowstride, - const double affine[6], + gint src_width, gint src_height, gint src_rowstride, + const gdouble affine[6], ArtFilterLevel level, ArtAlphaGamma *alphagamma) { /* Note: this is a slow implementation, and is missing all filter levels other than NEAREST. It is here for clarity of presentation and to establish the interface. */ - int x, y; - double inv[6]; + gint x, y; + gdouble inv[6]; art_u8 *dst_p, *dst_linestart; const art_u8 *src_p; ArtPoint pt, src_pt; - int src_x, src_y; - int alpha; + gint src_x, src_y; + gint alpha; art_u8 bg_r, bg_g, bg_b; art_u8 fg_r, fg_g, fg_b; - int tmp; - int run_x0, run_x1; + gint tmp; + gint run_x0, run_x1; dst_linestart = dst; art_affine_invert (inv, affine); @@ -121,14 +121,14 @@ art_rgb_rgba_affine (art_u8 *dst, bg_r = dst_p[0]; bg_g = dst_p[1]; bg_b = dst_p[2]; - + tmp = (src_p[0] - bg_r) * alpha; fg_r = bg_r + ((tmp + (tmp >> 8) + 0x80) >> 8); tmp = (src_p[1] - bg_g) * alpha; fg_g = bg_g + ((tmp + (tmp >> 8) + 0x80) >> 8); tmp = (src_p[2] - bg_b) * alpha; fg_b = bg_b + ((tmp + (tmp >> 8) + 0x80) >> 8); - + dst_p[0] = fg_r; dst_p[1] = fg_g; dst_p[2] = fg_b; diff --git a/libart_lgpl/art_rgb_rgba_affine.h b/libart_lgpl/art_rgb_rgba_affine.h index 9428231798..154084b670 100644 --- a/libart_lgpl/art_rgb_rgba_affine.h +++ b/libart_lgpl/art_rgb_rgba_affine.h @@ -32,10 +32,10 @@ extern "C" { void art_rgb_rgba_affine (art_u8 *dst, - int x0, int y0, int x1, int y1, int dst_rowstride, + gint x0, gint y0, gint x1, gint y1, gint dst_rowstride, const art_u8 *src, - int src_width, int src_height, int src_rowstride, - const double affine[6], + gint src_width, gint src_height, gint src_rowstride, + const gdouble affine[6], ArtFilterLevel level, ArtAlphaGamma *alphagamma); diff --git a/libart_lgpl/art_rgb_svp.c b/libart_lgpl/art_rgb_svp.c index d03101653d..afd57aeed6 100644 --- a/libart_lgpl/art_rgb_svp.c +++ b/libart_lgpl/art_rgb_svp.c @@ -32,29 +32,29 @@ typedef struct _ArtRgbSVPAlphaData ArtRgbSVPAlphaData; struct _ArtRgbSVPData { art_u32 rgbtab[256]; art_u8 *buf; - int rowstride; - int x0, x1; + gint rowstride; + gint x0, x1; }; struct _ArtRgbSVPAlphaData { - int alphatab[256]; + gint alphatab[256]; art_u8 r, g, b, alpha; art_u8 *buf; - int rowstride; - int x0, x1; + gint rowstride; + gint x0, x1; }; static void -art_rgb_svp_callback (void *callback_data, int y, - int start, ArtSVPRenderAAStep *steps, int n_steps) +art_rgb_svp_callback (gpointer callback_data, gint y, + gint start, ArtSVPRenderAAStep *steps, gint n_steps) { ArtRgbSVPData *data = (ArtRgbSVPData *)callback_data; art_u8 *linebuf; - int run_x0, run_x1; + gint run_x0, run_x1; art_u32 running_sum = start; art_u32 rgb; - int x0, x1; - int k; + gint x0, x1; + gint k; linebuf = data->buf; x0 = data->x0; @@ -137,18 +137,18 @@ art_rgb_svp_callback (void *callback_data, int y, **/ void art_rgb_svp_aa (const ArtSVP *svp, - int x0, int y0, int x1, int y1, + gint x0, gint y0, gint x1, gint y1, art_u32 fg_color, art_u32 bg_color, - art_u8 *buf, int rowstride, + art_u8 *buf, gint rowstride, ArtAlphaGamma *alphagamma) { ArtRgbSVPData data; - int r_fg, g_fg, b_fg; - int r_bg, g_bg, b_bg; - int r, g, b; - int dr, dg, db; - int i; + gint r_fg, g_fg, b_fg; + gint r_bg, g_bg, b_bg; + gint r, g, b; + gint dr, dg, db; + gint i; if (alphagamma == NULL) { @@ -177,7 +177,7 @@ art_rgb_svp_aa (const ArtSVP *svp, } else { - int *table; + gint *table; art_u8 *invtab; table = alphagamma->table; @@ -216,18 +216,18 @@ art_rgb_svp_aa (const ArtSVP *svp, } static void -art_rgb_svp_alpha_callback (void *callback_data, int y, - int start, ArtSVPRenderAAStep *steps, int n_steps) +art_rgb_svp_alpha_callback (gpointer callback_data, gint y, + gint start, ArtSVPRenderAAStep *steps, gint n_steps) { ArtRgbSVPAlphaData *data = (ArtRgbSVPAlphaData *)callback_data; art_u8 *linebuf; - int run_x0, run_x1; + gint run_x0, run_x1; art_u32 running_sum = start; - int x0, x1; - int k; + gint x0, x1; + gint k; art_u8 r, g, b; - int *alphatab; - int alpha; + gint *alphatab; + gint alpha; linebuf = data->buf; x0 = data->x0; @@ -287,19 +287,19 @@ art_rgb_svp_alpha_callback (void *callback_data, int y, } static void -art_rgb_svp_alpha_opaque_callback (void *callback_data, int y, - int start, - ArtSVPRenderAAStep *steps, int n_steps) +art_rgb_svp_alpha_opaque_callback (gpointer callback_data, gint y, + gint start, + ArtSVPRenderAAStep *steps, gint n_steps) { ArtRgbSVPAlphaData *data = (ArtRgbSVPAlphaData *)callback_data; art_u8 *linebuf; - int run_x0, run_x1; + gint run_x0, run_x1; art_u32 running_sum = start; - int x0, x1; - int k; + gint x0, x1; + gint k; art_u8 r, g, b; - int *alphatab; - int alpha; + gint *alphatab; + gint alpha; linebuf = data->buf; x0 = data->x0; @@ -415,15 +415,15 @@ art_rgb_svp_alpha_opaque_callback (void *callback_data, int y, **/ void art_rgb_svp_alpha (const ArtSVP *svp, - int x0, int y0, int x1, int y1, + gint x0, gint y0, gint x1, gint y1, art_u32 rgba, - art_u8 *buf, int rowstride, + art_u8 *buf, gint rowstride, ArtAlphaGamma *alphagamma) { ArtRgbSVPAlphaData data; - int r, g, b, alpha; - int i; - int a, da; + gint r, g, b, alpha; + gint i; + gint a, da; r = rgba >> 24; g = (rgba >> 16) & 0xff; diff --git a/libart_lgpl/art_rgb_svp.h b/libart_lgpl/art_rgb_svp.h index c76aa40ef1..5d68616255 100644 --- a/libart_lgpl/art_rgb_svp.h +++ b/libart_lgpl/art_rgb_svp.h @@ -31,16 +31,16 @@ extern "C" { void art_rgb_svp_aa (const ArtSVP *svp, - int x0, int y0, int x1, int y1, + gint x0, gint y0, gint x1, gint y1, art_u32 fg_color, art_u32 bg_color, - art_u8 *buf, int rowstride, + art_u8 *buf, gint rowstride, ArtAlphaGamma *alphagamma); void art_rgb_svp_alpha (const ArtSVP *svp, - int x0, int y0, int x1, int y1, + gint x0, gint y0, gint x1, gint y1, art_u32 rgba, - art_u8 *buf, int rowstride, + art_u8 *buf, gint rowstride, ArtAlphaGamma *alphagamma); #ifdef __cplusplus diff --git a/libart_lgpl/art_svp.c b/libart_lgpl/art_svp.c index 09def996b6..69814cca00 100644 --- a/libart_lgpl/art_svp.c +++ b/libart_lgpl/art_svp.c @@ -24,18 +24,17 @@ #include "art_misc.h" - /** * art_svp_free: Free an #ArtSVP structure. * @svp: #ArtSVP to free. - * + * * Frees an #ArtSVP structure and all the segments in it. **/ void art_svp_free (ArtSVP *svp) { - int n_segs = svp->n_segs; - int i; + gint n_segs = svp->n_segs; + gint i; for (i = 0; i < n_segs; i++) art_free (svp->segs[i].points); @@ -52,12 +51,12 @@ art_svp_free (ArtSVP *svp) * art_svp_seg_compare: Compare two segments of an svp. * @seg1: First segment to compare. * @seg2: Second segment to compare. - * + * * Compares two segments of an svp. Return 1 if @seg2 is below or to the * right of @seg1, -1 otherwise. **/ -int -art_svp_seg_compare (const void *s1, const void *s2) +gint +art_svp_seg_compare (gconstpointer s1, gconstpointer s2) { const ArtSVPSeg *seg1 = s1; const ArtSVPSeg *seg2 = s2; diff --git a/libart_lgpl/art_svp.h b/libart_lgpl/art_svp.h index fde6c22e64..f1627c70ef 100644 --- a/libart_lgpl/art_svp.h +++ b/libart_lgpl/art_svp.h @@ -33,22 +33,22 @@ typedef struct _ArtSVP ArtSVP; typedef struct _ArtSVPSeg ArtSVPSeg; struct _ArtSVPSeg { - int n_points; - int dir; /* == 0 for "up", 1 for "down" */ + gint n_points; + gint dir; /* == 0 for "up", 1 for "down" */ ArtDRect bbox; ArtPoint *points; }; struct _ArtSVP { - int n_segs; + gint n_segs; ArtSVPSeg segs[1]; }; void art_svp_free (ArtSVP *svp); -int -art_svp_seg_compare (const void *s1, const void *s2); +gint +art_svp_seg_compare (gconstpointer s1, gconstpointer s2); #ifdef __cplusplus } diff --git a/libart_lgpl/art_svp_intersect.c b/libart_lgpl/art_svp_intersect.c index 470c16e7ff..f79216c13a 100644 --- a/libart_lgpl/art_svp_intersect.c +++ b/libart_lgpl/art_svp_intersect.c @@ -35,8 +35,6 @@ should not be necessary. */ #define CHEAP_SANITYCHECK -#define noVERBOSE - #include "art_misc.h" /* A priority queue - perhaps move to a separate file if it becomes @@ -48,15 +46,15 @@ typedef struct _ArtPriQ ArtPriQ; typedef struct _ArtPriPoint ArtPriPoint; struct _ArtPriQ { - int n_items; - int n_items_max; + gint n_items; + gint n_items_max; ArtPriPoint **items; }; struct _ArtPriPoint { - double x; - double y; - void *user_data; + gdouble x; + gdouble y; + gpointer user_data; }; static ArtPriQ * @@ -89,10 +87,10 @@ art_pri_empty (ArtPriQ *pq) http://www.cs.rutgers.edu/~chvatal/notes/pq.html#heap */ static void -art_pri_bubble_up (ArtPriQ *pq, int vacant, ArtPriPoint *missing) +art_pri_bubble_up (ArtPriQ *pq, gint vacant, ArtPriPoint *missing) { ArtPriPoint **items = pq->items; - int parent; + gint parent; parent = (vacant - 1) >> 1; while (vacant > 0 && (missing->y < items[parent]->y || @@ -120,8 +118,8 @@ static void art_pri_sift_down_from_root (ArtPriQ *pq, ArtPriPoint *missing) { ArtPriPoint **items = pq->items; - int vacant = 0, child = 2; - int n = pq->n_items; + gint vacant = 0, child = 2; + gint n = pq->n_items; while (child < n) { @@ -157,10 +155,10 @@ art_pri_choose (ArtPriQ *pq) static ArtPriPoint * art_pri_choose (ArtPriQ *pq) { - int i; - int best = 0; - double best_x, best_y; - double y; + gint i; + gint best = 0; + gdouble best_x, best_y; + gdouble y; ArtPriPoint *result; if (pq->n_items == 0) @@ -201,9 +199,9 @@ art_pri_insert (ArtPriQ *pq, ArtPriPoint *point) #include <stdio.h> static double -double_rand (double lo, double hi, int quant) +double_rand (gdouble lo, gdouble hi, gint quant) { - int tmp = rand () / (RAND_MAX * (1.0 / quant)) + 0.5; + gint tmp = rand () / (RAND_MAX * (1.0 / quant)) + 0.5; return lo + tmp * ((hi - lo) / quant); } @@ -256,14 +254,14 @@ art_pri_pt_pool_free (ArtPriPtPool *pool) art_free (pool); } -int -main (int argc, char **argv) +gint +main (gint argc, gchar **argv) { ArtPriPtPool *pool = art_pri_pt_pool_new (); ArtPriQ *pq; - int i, j; - const int n_iter = 1; - const int pq_size = 100; + gint i, j; + const gint n_iter = 1; + const gint pq_size = 100; for (j = 0; j < n_iter; j++) { @@ -274,7 +272,7 @@ main (int argc, char **argv) ArtPriPoint *pt = art_pri_pt_alloc (pool); pt->x = double_rand (0, 1, 100); pt->y = double_rand (0, 1, 100); - pt->user_data = (void *)i; + pt->user_data = (gpointer)i; art_pri_insert (pq, pt); } @@ -282,7 +280,7 @@ main (int argc, char **argv) { ArtPriPoint *pt = art_pri_choose (pq); if (n_iter == 1) - printf ("(%g, %g), %d\n", pt->x, pt->y, (int)pt->user_data); + printf ("(%g, %g), %d\n", pt->x, pt->y, (gint)pt->user_data); art_pri_pt_free (pool, pt); } @@ -307,21 +305,21 @@ struct _ArtSvpWriterRewind { ArtSvpWriter super; ArtWindRule rule; ArtSVP *svp; - int n_segs_max; - int *n_points_max; + gint n_segs_max; + gint *n_points_max; }; -static int -art_svp_writer_rewind_add_segment (ArtSvpWriter *self, int wind_left, - int delta_wind, double x, double y) +static gint +art_svp_writer_rewind_add_segment (ArtSvpWriter *self, gint wind_left, + gint delta_wind, gdouble x, gdouble y) { ArtSvpWriterRewind *swr = (ArtSvpWriterRewind *)self; ArtSVP *svp; ArtSVPSeg *seg; art_boolean left_filled, right_filled; - int wind_right = wind_left + delta_wind; - int seg_num; - const int init_n_points_max = 4; + gint wind_right = wind_left + delta_wind; + gint seg_num; + const gint init_n_points_max = 4; switch (swr->rule) { @@ -377,12 +375,12 @@ art_svp_writer_rewind_add_segment (ArtSvpWriter *self, int wind_left, } static void -art_svp_writer_rewind_add_point (ArtSvpWriter *self, int seg_id, - double x, double y) +art_svp_writer_rewind_add_point (ArtSvpWriter *self, gint seg_id, + gdouble x, gdouble y) { ArtSvpWriterRewind *swr = (ArtSvpWriterRewind *)self; ArtSVPSeg *seg; - int n_points; + gint n_points; if (seg_id < 0) /* omitted segment */ @@ -402,7 +400,7 @@ art_svp_writer_rewind_add_point (ArtSvpWriter *self, int seg_id, } static void -art_svp_writer_rewind_close_segment (ArtSvpWriter *self, int seg_id) +art_svp_writer_rewind_close_segment (ArtSvpWriter *self, gint seg_id) { /* Not needed for this simple implementation. A potential future optimization is to merge segments that can be merged safely. */ @@ -443,7 +441,7 @@ art_svp_writer_rewind_new (ArtWindRule rule) result->rule = rule; result->n_segs_max = 16; - result->svp = art_alloc (sizeof(ArtSVP) + + result->svp = art_alloc (sizeof(ArtSVP) + (result->n_segs_max - 1) * sizeof(ArtSVPSeg)); result->svp->n_segs = 0; result->n_points_max = art_new (int, result->n_segs_max); @@ -474,28 +472,28 @@ typedef struct _ArtActiveSeg ArtActiveSeg; #define ART_ACTIVE_FLAGS_IN_HORIZ 16 struct _ArtActiveSeg { - int flags; - int wind_left, delta_wind; + gint flags; + gint wind_left, delta_wind; ArtActiveSeg *left, *right; /* doubly linked list structure */ const ArtSVPSeg *in_seg; - int in_curs; + gint in_curs; - double x[2]; - double y0, y1; - double a, b, c; /* line equation; ax+by+c = 0 for the line, a^2 + b^2 = 1, + gdouble x[2]; + gdouble y0, y1; + gdouble a, b, c; /* line equation; ax+by+c = 0 for the line, a^2 + b^2 = 1, and a>0 */ /* bottom point and intersection point stack */ - int n_stack; - int n_stack_max; + gint n_stack; + gint n_stack_max; ArtPoint *stack; /* horiz commit list */ ArtActiveSeg *horiz_left, *horiz_right; - double horiz_x; - int horiz_delta_wind; - int seg_id; + gdouble horiz_x; + gint horiz_delta_wind; + gint seg_id; }; typedef struct _ArtIntersectCtx ArtIntersectCtx; @@ -508,12 +506,12 @@ struct _ArtIntersectCtx { ArtActiveSeg *active_head; - double y; + gdouble y; ArtActiveSeg *horiz_first; ArtActiveSeg *horiz_last; /* segment index of next input segment to be added to pri q */ - int in_curs; + gint in_curs; }; #define EPSILON_A 1e-5 /* Threshold for breaking lines at point insertions */ @@ -532,10 +530,10 @@ static void art_svp_intersect_setup_seg (ArtActiveSeg *seg, ArtPriPoint *pri_pt) { const ArtSVPSeg *in_seg = seg->in_seg; - int in_curs = seg->in_curs++; - double x0, y0, x1, y1; - double dx, dy, s; - double a, b, r2; + gint in_curs = seg->in_curs++; + gdouble x0, y0, x1, y1; + gdouble dx, dy, s; + gdouble a, b, r2; x0 = in_seg->points[in_curs].x; y0 = in_seg->points[in_curs].y; @@ -582,7 +580,6 @@ art_svp_intersect_add_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg) ArtActiveSeg *place; ArtActiveSeg *place_right = NULL; - #ifdef CHEAP_SANITYCHECK if (seg->flags & ART_ACTIVE_FLAGS_IN_HORIZ) { @@ -611,10 +608,10 @@ art_svp_intersect_add_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg) static void art_svp_intersect_push_pt (ArtIntersectCtx *ctx, ArtActiveSeg *seg, - double x, double y) + gdouble x, gdouble y) { ArtPriPoint *pri_pt; - int n_stack = seg->n_stack; + gint n_stack = seg->n_stack; if (n_stack == seg->n_stack_max) art_expand (seg->stack, ArtPoint, seg->n_stack_max); @@ -647,12 +644,12 @@ typedef enum { */ static double art_svp_intersect_break (ArtIntersectCtx *ctx, ArtActiveSeg *seg, - double x_ref, double y, ArtBreakFlags break_flags) + gdouble x_ref, gdouble y, ArtBreakFlags break_flags) { - double x0, y0, x1, y1; + gdouble x0, y0, x1, y1; const ArtSVPSeg *in_seg = seg->in_seg; - int in_curs = seg->in_curs; - double x; + gint in_curs = seg->in_curs; + gdouble x; x0 = in_seg->points[in_curs - 1].x; y0 = in_seg->points[in_curs - 1].y; @@ -691,22 +688,22 @@ art_svp_intersect_break (ArtIntersectCtx *ctx, ArtActiveSeg *seg, * NULL if the new point is leftmost. **/ static ArtActiveSeg * -art_svp_intersect_add_point (ArtIntersectCtx *ctx, double x, double y, +art_svp_intersect_add_point (ArtIntersectCtx *ctx, gdouble x, gdouble y, ArtActiveSeg *seg, ArtBreakFlags break_flags) { ArtActiveSeg *left, *right; - double x_min = x, x_max = x; + gdouble x_min = x, x_max = x; art_boolean left_live, right_live; - double d; - double new_x; + gdouble d; + gdouble new_x; ArtActiveSeg *test, *result = NULL; - double x_test; + gdouble x_test; left = seg; if (left == NULL) right = ctx->active_head; else - right = left->right; + right = left->right; left_live = (break_flags & ART_BREAK_LEFT) && (left != NULL); right_live = (break_flags & ART_BREAK_RIGHT) && (right != NULL); while (left_live || right_live) @@ -834,16 +831,15 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, ArtActiveSeg *left_seg, ArtActiveSeg *right_seg, ArtBreakFlags break_flags) { - double left_x0, left_y0, left_x1; - double left_y1 = left_seg->y1; - double right_y1 = right_seg->y1; - double d; + gdouble left_x0, left_y0, left_x1; + gdouble left_y1 = left_seg->y1; + gdouble right_y1 = right_seg->y1; + gdouble d; const ArtSVPSeg *in_seg; - int in_curs; - double d0, d1, t; - double x, y; /* intersection point */ - + gint in_curs; + gdouble d0, d1, t; + gdouble x, y; /* intersection point */ if (left_seg->y0 == right_seg->y0 && left_seg->x[0] == right_seg->x[0]) { @@ -855,7 +851,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, if (left_y1 < right_y1) { /* Test left (x1, y1) against right segment */ - double left_x1 = left_seg->x[1]; + gdouble left_x1 = left_seg->x[1]; if (left_x1 < right_seg->x[(right_seg->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] || @@ -867,7 +863,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, else if (d < EPSILON_A) { /* I'm unsure about the break flags here. */ - double right_x1 = art_svp_intersect_break (ctx, right_seg, + gdouble right_x1 = art_svp_intersect_break (ctx, right_seg, left_x1, left_y1, ART_BREAK_RIGHT); if (left_x1 <= right_x1) @@ -877,7 +873,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, else if (left_y1 > right_y1) { /* Test right (x1, y1) against left segment */ - double right_x1 = right_seg->x[1]; + gdouble right_x1 = right_seg->x[1]; if (right_x1 > left_seg->x[left_seg->flags & ART_ACTIVE_FLAGS_BNEG] || right_y1 == left_seg->y0) @@ -888,7 +884,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, else if (d > -EPSILON_A) { /* See above regarding break flags. */ - double left_x1 = art_svp_intersect_break (ctx, left_seg, + gdouble left_x1 = art_svp_intersect_break (ctx, left_seg, right_x1, right_y1, ART_BREAK_LEFT); if (left_x1 <= right_x1) @@ -897,8 +893,8 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, } else /* left_y1 == right_y1 */ { - double left_x1 = left_seg->x[1]; - double right_x1 = right_seg->x[1]; + gdouble left_x1 = left_seg->x[1]; + gdouble right_x1 = right_seg->x[1]; if (left_x1 <= right_x1) return ART_FALSE; @@ -910,7 +906,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, if (left_y1 < right_y1) { /* Test left (x1, y1) against right segment */ - double left_x1 = left_seg->x[1]; + gdouble left_x1 = left_seg->x[1]; if (left_x1 < right_seg->x[(right_seg->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] || @@ -921,7 +917,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, return ART_FALSE; else if (d < EPSILON_A) { - double right_x1 = art_svp_intersect_break (ctx, right_seg, + gdouble right_x1 = art_svp_intersect_break (ctx, right_seg, left_x1, left_y1, ART_BREAK_RIGHT); if (left_x1 <= right_x1) @@ -931,7 +927,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, else if (left_y1 > right_y1) { /* Test right (x1, y1) against left segment */ - double right_x1 = right_seg->x[1]; + gdouble right_x1 = right_seg->x[1]; if (right_x1 > left_seg->x[left_seg->flags & ART_ACTIVE_FLAGS_BNEG] || right_y1 == left_seg->y0) @@ -941,7 +937,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, return ART_FALSE; else if (d > -EPSILON_A) { - double left_x1 = art_svp_intersect_break (ctx, left_seg, + gdouble left_x1 = art_svp_intersect_break (ctx, left_seg, right_x1, right_y1, ART_BREAK_LEFT); if (left_x1 <= right_x1) @@ -949,9 +945,9 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx, } } else /* left_y1 == right_y1 */ - { - double left_x1 = left_seg->x[1]; - double right_x1 = right_seg->x[1]; + { + gdouble left_x1 = left_seg->x[1]; + gdouble right_x1 = right_seg->x[1]; if (left_x1 <= right_x1) return ART_FALSE; @@ -1168,7 +1164,7 @@ art_svp_intersect_insert_cross (ArtIntersectCtx *ctx, **/ static void art_svp_intersect_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg, - double x0, double x1) + gdouble x0, gdouble x1) { ArtActiveSeg *hs; @@ -1209,7 +1205,7 @@ art_svp_intersect_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg, for (left = seg->left; left != NULL; left = seg->left) { - int left_bneg = left->flags & ART_ACTIVE_FLAGS_BNEG; + gint left_bneg = left->flags & ART_ACTIVE_FLAGS_BNEG; if (left->x[left_bneg] <= x1) break; @@ -1236,7 +1232,7 @@ art_svp_intersect_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg, for (right = seg->right; right != NULL; right = seg->right) { - int right_bneg = right->flags & ART_ACTIVE_FLAGS_BNEG; + gint right_bneg = right->flags & ART_ACTIVE_FLAGS_BNEG; if (right->x[right_bneg ^ 1] >= x1) break; @@ -1291,7 +1287,7 @@ static void art_svp_intersect_process_intersection (ArtIntersectCtx *ctx, ArtActiveSeg *seg) { - int n_stack = --seg->n_stack; + gint n_stack = --seg->n_stack; seg->x[1] = seg->stack[n_stack - 1].x; seg->y1 = seg->stack[n_stack - 1].y; seg->x[0] = seg->stack[n_stack].x; @@ -1305,7 +1301,7 @@ art_svp_intersect_advance_cursor (ArtIntersectCtx *ctx, ArtActiveSeg *seg, ArtPriPoint *pri_pt) { const ArtSVPSeg *in_seg = seg->in_seg; - int in_curs = seg->in_curs; + gint in_curs = seg->in_curs; ArtSvpWriter *swr = seg->flags & ART_ACTIVE_FLAGS_OUT ? ctx->out : NULL; if (swr != NULL) @@ -1342,7 +1338,7 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg) { ArtActiveSeg *seg = art_new (ArtActiveSeg, 1); ArtActiveSeg *test; - double x0, y0; + gdouble x0, y0; ArtActiveSeg *beg_range; ArtActiveSeg *last = NULL; ArtActiveSeg *left, *right; @@ -1356,7 +1352,7 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg) seg->stack = art_new (ArtPoint, seg->n_stack_max); seg->horiz_delta_wind = 0; - + seg->wind_left = 0; pri_pt->user_data = seg; @@ -1372,8 +1368,8 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg) beg_range = NULL; for (test = ctx->active_head; test != NULL; test = test->right) { - double d; - int test_bneg = test->flags & ART_ACTIVE_FLAGS_BNEG; + gdouble d; + gint test_bneg = test->flags & ART_ACTIVE_FLAGS_BNEG; if (x0 < test->x[test_bneg]) { @@ -1386,7 +1382,8 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg) last = test; } - left = art_svp_intersect_add_point (ctx, x0, y0, last, ART_BREAK_LEFT | ART_BREAK_RIGHT); + left = art_svp_intersect_add_point (ctx, x0, y0, last, + ART_BREAK_LEFT | ART_BREAK_RIGHT); seg->left = left; if (left == NULL) { @@ -1408,35 +1405,6 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg) art_svp_intersect_insert_line (ctx, seg); } -#ifdef SANITYCHECK -static void -art_svp_intersect_sanitycheck_winding (ArtIntersectCtx *ctx) -{ -#if 0 - /* At this point, we seem to be getting false positives, so it's - turned off for now. */ - - ArtActiveSeg *seg; - int winding_number = 0; - - for (seg = ctx->active_head; seg != NULL; seg = seg->right) - { - /* Check winding number consistency. */ - if (seg->flags & ART_ACTIVE_FLAGS_OUT) - { - if (winding_number != seg->wind_left) - art_warn ("*** art_svp_intersect_sanitycheck_winding: seg %lx has wind_left of %d, expected %d\n", - (unsigned long) seg, seg->wind_left, winding_number); - winding_number = seg->wind_left + seg->delta_wind; - } - } - if (winding_number != 0) - art_warn ("*** art_svp_intersect_sanitycheck_winding: non-balanced winding number %d\n", - winding_number); -#endif -} -#endif - /** * art_svp_intersect_horiz_commit: Commit points in horiz list to output. * @ctx: Intersection context. @@ -1457,22 +1425,22 @@ static void art_svp_intersect_horiz_commit (ArtIntersectCtx *ctx) { ArtActiveSeg *seg; - int winding_number = 0; /* initialization just to avoid warning */ - int horiz_wind = 0; - double last_x = 0; /* initialization just to avoid warning */ + gint winding_number = 0; /* initialization just to avoid warning */ + gint horiz_wind = 0; + gdouble last_x = 0; /* initialization just to avoid warning */ /* Output points to svp writer. */ for (seg = ctx->horiz_first; seg != NULL;) { /* Find a cluster with common horiz_x, */ ArtActiveSeg *curs; - double x = seg->horiz_x; + gdouble x = seg->horiz_x; /* Generate any horizontal segments. */ if (horiz_wind != 0) { ArtSvpWriter *swr = ctx->out; - int seg_id; + gint seg_id; seg_id = swr->add_segment (swr, winding_number, horiz_wind, last_x, ctx->y); @@ -1552,9 +1520,6 @@ art_svp_intersect_horiz_commit (ArtIntersectCtx *ctx) } ctx->horiz_first = NULL; ctx->horiz_last = NULL; -#ifdef SANITYCHECK - art_svp_intersect_sanitycheck_winding (ctx); -#endif } #ifdef SANITYCHECK @@ -1563,7 +1528,7 @@ art_svp_intersect_sanitycheck (ArtIntersectCtx *ctx) { ArtActiveSeg *seg; ArtActiveSeg *last = NULL; - double d; + gdouble d; for (seg = ctx->active_head; seg != NULL; seg = seg->right) { @@ -1687,7 +1652,7 @@ art_svp_intersector (const ArtSVP *in, ArtSvpWriter *out) } else { - int n_stack = seg->n_stack; + gint n_stack = seg->n_stack; if (n_stack > 1) { diff --git a/libart_lgpl/art_svp_intersect.h b/libart_lgpl/art_svp_intersect.h index c73b3530c5..b585ed20f5 100644 --- a/libart_lgpl/art_svp_intersect.h +++ b/libart_lgpl/art_svp_intersect.h @@ -41,10 +41,10 @@ typedef enum { typedef struct _ArtSvpWriter ArtSvpWriter; struct _ArtSvpWriter { - int (*add_segment) (ArtSvpWriter *self, int wind_left, int delta_wind, - double x, double y); - void (*add_point) (ArtSvpWriter *self, int seg_id, double x, double y); - void (*close_segment) (ArtSvpWriter *self, int seg_id); + gint (*add_segment) (ArtSvpWriter *self, gint wind_left, gint delta_wind, + gdouble x, gdouble y); + void (*add_point) (ArtSvpWriter *self, gint seg_id, gdouble x, gdouble y); + void (*close_segment) (ArtSvpWriter *self, gint seg_id); }; ArtSvpWriter * @@ -54,8 +54,8 @@ ArtSVP * art_svp_writer_rewind_reap (ArtSvpWriter *self); #if 0 /* XXX already declared in art_svp.h */ -int -art_svp_seg_compare (const void *s1, const void *s2); +gint +art_svp_seg_compare (gconstpointer s1, gconstpointer s2); #endif void diff --git a/libart_lgpl/art_svp_ops.c b/libart_lgpl/art_svp_ops.c index 08991aac1b..9c5d461bfd 100644 --- a/libart_lgpl/art_svp_ops.c +++ b/libart_lgpl/art_svp_ops.c @@ -17,8 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#define noVERBOSE - /* Vector path set operations, over sorted vpaths. */ #include "config.h" @@ -56,8 +54,8 @@ static ArtSVP * art_svp_merge (const ArtSVP *svp1, const ArtSVP *svp2) { ArtSVP *svp_new; - int ix; - int ix1, ix2; + gint ix; + gint ix1, ix2; svp_new = (ArtSVP *)art_alloc (sizeof(ArtSVP) + (svp1->n_segs + svp2->n_segs - 1) * @@ -78,77 +76,6 @@ art_svp_merge (const ArtSVP *svp1, const ArtSVP *svp2) return svp_new; } -#ifdef VERBOSE - -#define XOFF 50 -#define YOFF 700 - -static void -print_ps_vpath (ArtVpath *vpath) -{ - int i; - - printf ("gsave %d %d translate 1 -1 scale\n", XOFF, YOFF); - for (i = 0; vpath[i].code != ART_END; i++) - { - switch (vpath[i].code) - { - case ART_MOVETO: - printf ("%g %g moveto\n", vpath[i].x, vpath[i].y); - break; - case ART_LINETO: - printf ("%g %g lineto\n", vpath[i].x, vpath[i].y); - break; - default: - break; - } - } - printf ("stroke grestore showpage\n"); -} - -#define DELT 4 - -static void -print_ps_svp (ArtSVP *vpath) -{ - int i, j; - - printf ("%% begin\n"); - for (i = 0; i < vpath->n_segs; i++) - { - printf ("%g setgray\n", vpath->segs[i].dir ? 0.7 : 0); - for (j = 0; j < vpath->segs[i].n_points; j++) - { - printf ("%g %g %s\n", - XOFF + vpath->segs[i].points[j].x, - YOFF - vpath->segs[i].points[j].y, - j ? "lineto" : "moveto"); - } - printf ("%g %g moveto %g %g lineto %g %g lineto %g %g lineto stroke\n", - XOFF + vpath->segs[i].points[0].x - DELT, - YOFF - DELT - vpath->segs[i].points[0].y, - XOFF + vpath->segs[i].points[0].x - DELT, - YOFF - vpath->segs[i].points[0].y, - XOFF + vpath->segs[i].points[0].x + DELT, - YOFF - vpath->segs[i].points[0].y, - XOFF + vpath->segs[i].points[0].x + DELT, - YOFF - DELT - vpath->segs[i].points[0].y); - printf ("%g %g moveto %g %g lineto %g %g lineto %g %g lineto stroke\n", - XOFF + vpath->segs[i].points[j - 1].x - DELT, - YOFF + DELT - vpath->segs[i].points[j - 1].y, - XOFF + vpath->segs[i].points[j - 1].x - DELT, - YOFF - vpath->segs[i].points[j - 1].y, - XOFF + vpath->segs[i].points[j - 1].x + DELT, - YOFF - vpath->segs[i].points[j - 1].y, - XOFF + vpath->segs[i].points[j - 1].x + DELT, - YOFF + DELT - vpath->segs[i].points[j - 1].y); - printf ("stroke\n"); - } - - printf ("showpage\n"); -} -#endif - #ifndef ART_USE_NEW_INTERSECTOR static ArtSVP * art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2) @@ -171,11 +98,6 @@ art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2) art_free (vpath2_p); svp_new = art_svp_merge (svp1_p, svp2_p); -#ifdef VERBOSE - print_ps_svp (svp1_p); - print_ps_svp (svp2_p); - print_ps_svp (svp_new); -#endif art_free (svp1_p); art_free (svp2_p); @@ -220,7 +142,7 @@ art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2) ArtSVP * art_svp_intersect (const ArtSVP *svp1, const ArtSVP *svp2) { -#ifdef ART_USE_NEW_INTERSECTOR +#ifdef ART_USE_NEW_INTERSECTOR ArtSVP *svp3, *svp_new; ArtSvpWriter *swr; diff --git a/libart_lgpl/art_svp_point.c b/libart_lgpl/art_svp_point.c index 4b41e8c402..8278bca55e 100644 --- a/libart_lgpl/art_svp_point.c +++ b/libart_lgpl/art_svp_point.c @@ -38,11 +38,11 @@ * * Return value: the winding number. **/ -int -art_svp_point_wind (ArtSVP *svp, double x, double y) +gint +art_svp_point_wind (ArtSVP *svp, gdouble x, gdouble y) { - int i, j; - int wind = 0; + gint i, j; + gint wind = 0; for (i = 0; i < svp->n_segs; i++) { @@ -57,7 +57,7 @@ art_svp_point_wind (ArtSVP *svp, double x, double y) wind += seg->dir ? 1 : -1; else if (seg->bbox.x0 <= x) { - double x0, y0, x1, y1, dx, dy; + gdouble x0, y0, x1, y1, dx, dy; for (j = 0; j < seg->n_points - 1; j++) { @@ -91,42 +91,42 @@ art_svp_point_wind (ArtSVP *svp, double x, double y) * * Return value: the distance. **/ -double -art_svp_point_dist (ArtSVP *svp, double x, double y) +gdouble +art_svp_point_dist (ArtSVP *svp, gdouble x, gdouble y) { - int i, j; - double dist_sq; - double best_sq = -1; + gint i, j; + gdouble dist_sq; + gdouble best_sq = -1; for (i = 0; i < svp->n_segs; i++) { ArtSVPSeg *seg = &svp->segs[i]; for (j = 0; j < seg->n_points - 1; j++) { - double x0 = seg->points[j].x; - double y0 = seg->points[j].y; - double x1 = seg->points[j + 1].x; - double y1 = seg->points[j + 1].y; + gdouble x0 = seg->points[j].x; + gdouble y0 = seg->points[j].y; + gdouble x1 = seg->points[j + 1].x; + gdouble y1 = seg->points[j + 1].y; - double dx = x1 - x0; - double dy = y1 - y0; + gdouble dx = x1 - x0; + gdouble dy = y1 - y0; - double dxx0 = x - x0; - double dyy0 = y - y0; + gdouble dxx0 = x - x0; + gdouble dyy0 = y - y0; - double dot = dxx0 * dx + dyy0 * dy; + gdouble dot = dxx0 * dx + dyy0 * dy; if (dot < 0) dist_sq = dxx0 * dxx0 + dyy0 * dyy0; else { - double rr = dx * dx + dy * dy; + gdouble rr = dx * dx + dy * dy; if (dot > rr) dist_sq = (x - x1) * (x - x1) + (y - y1) * (y - y1); else { - double perp = (y - y0) * dx - (x - x0) * dy; + gdouble perp = (y - y0) * dx - (x - x0) * dy; dist_sq = perp * perp / rr; } diff --git a/libart_lgpl/art_svp_point.h b/libart_lgpl/art_svp_point.h index c150d3e579..53faaba37e 100644 --- a/libart_lgpl/art_svp_point.h +++ b/libart_lgpl/art_svp_point.h @@ -28,11 +28,11 @@ extern "C" { #endif /* __cplusplus */ -int -art_svp_point_wind (ArtSVP *svp, double x, double y); +gint +art_svp_point_wind (ArtSVP *svp, gdouble x, gdouble y); -double -art_svp_point_dist (ArtSVP *svp, double x, double y); +gdouble +art_svp_point_dist (ArtSVP *svp, gdouble x, gdouble y); #ifdef __cplusplus } @@ -40,6 +40,3 @@ art_svp_point_dist (ArtSVP *svp, double x, double y); #endif /* __ART_SVP_H__ */ - - - diff --git a/libart_lgpl/art_svp_render_aa.c b/libart_lgpl/art_svp_render_aa.c index d696a51f68..e9ca3c9ba5 100644 --- a/libart_lgpl/art_svp_render_aa.c +++ b/libart_lgpl/art_svp_render_aa.c @@ -31,17 +31,17 @@ #include <stdio.h> -typedef double artfloat; +typedef gdouble artfloat; struct _ArtSVPRenderAAIter { const ArtSVP *svp; - int x0, x1; - int y; - int seg_ix; + gint x0, x1; + gint y; + gint seg_ix; - int *active_segs; - int n_active_segs; - int *cursor; + gint *active_segs; + gint n_active_segs; + gint *cursor; artfloat *seg_x; artfloat *seg_dx; @@ -49,12 +49,12 @@ struct _ArtSVPRenderAAIter { }; static void -art_svp_render_insert_active (int i, int *active_segs, int n_active_segs, +art_svp_render_insert_active (gint i, gint *active_segs, gint n_active_segs, artfloat *seg_x, artfloat *seg_dx) { - int j; + gint j; artfloat x; - int tmp1, tmp2; + gint tmp1, tmp2; /* this is a cheap hack to get ^'s sorted correctly */ x = seg_x[i] + 0.001 * seg_dx[i]; @@ -72,9 +72,9 @@ art_svp_render_insert_active (int i, int *active_segs, int n_active_segs, } static void -art_svp_render_delete_active (int *active_segs, int j, int n_active_segs) +art_svp_render_delete_active (gint *active_segs, gint j, gint n_active_segs) { - int k; + gint k; for (k = j; k < n_active_segs; k++) active_segs[k] = active_segs[k + 1]; @@ -129,7 +129,7 @@ art_svp_render_delete_active (int *active_segs, int j, int n_active_segs) ArtSVPRenderAAIter * art_svp_render_aa_iter (const ArtSVP *svp, - int x0, int y0, int x1, int y1) + gint x0, gint y0, gint x1, gint y1) { ArtSVPRenderAAIter *iter = art_new (ArtSVPRenderAAIter, 1); @@ -184,40 +184,40 @@ art_svp_render_aa_iter (const ArtSVP *svp, } void -art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, - ArtSVPRenderAAStep **p_steps, int *p_n_steps) +art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, gint *p_start, + ArtSVPRenderAAStep **p_steps, gint *p_n_steps) { const ArtSVP *svp = iter->svp; - int *active_segs = iter->active_segs; - int n_active_segs = iter->n_active_segs; - int *cursor = iter->cursor; + gint *active_segs = iter->active_segs; + gint n_active_segs = iter->n_active_segs; + gint *cursor = iter->cursor; artfloat *seg_x = iter->seg_x; artfloat *seg_dx = iter->seg_dx; - int i = iter->seg_ix; - int j; - int x0 = iter->x0; - int x1 = iter->x1; - int y = iter->y; - int seg_index; - - int x; + gint i = iter->seg_ix; + gint j; + gint x0 = iter->x0; + gint x1 = iter->x1; + gint y = iter->y; + gint seg_index; + + gint x; ArtSVPRenderAAStep *steps = iter->steps; - int n_steps; + gint n_steps; artfloat y_top, y_bot; artfloat x_top, x_bot; artfloat x_min, x_max; - int ix_min, ix_max; - artfloat delta; /* delta should be int too? */ - int last, this; - int xdelta; + gint ix_min, ix_max; + artfloat delta; /* delta should be gint too? */ + gint last, this; + gint xdelta; artfloat rslope, drslope; - int start; + gint start; const ArtSVPSeg *seg; - int curs; + gint curs; artfloat dy; - int sx; - + gint sx; + /* insert new active segments */ for (; i < svp->n_segs && svp->segs[i].bbox.y0 < y + 1; i++) { @@ -310,7 +310,7 @@ art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, if (ix_min >= x0) { ADD_STEP(ix_min, xdelta) - + x = ix_min + 1; } else @@ -339,7 +339,7 @@ art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, last = this; ADD_STEP(x, xdelta) - + if (x + 1 < x1) { xdelta = delta - last; @@ -433,26 +433,25 @@ art_svp_render_aa_iter_done (ArtSVPRenderAAIter *iter) * 0xff8000 represents 100% coverage. This format is designed so that * >> 16 results in a standard 0x00..0xff value range, with nice * rounding. - * + * **/ void art_svp_render_aa (const ArtSVP *svp, - int x0, int y0, int x1, int y1, - void (*callback) (void *callback_data, - int y, - int start, - ArtSVPRenderAAStep *steps, int n_steps), - void *callback_data) + gint x0, gint y0, gint x1, gint y1, + void (*callback) (gpointer callback_data, + gint y, + gint start, + ArtSVPRenderAAStep *steps, gint n_steps), + gpointer callback_data) { ArtSVPRenderAAIter *iter; - int y; - int start; + gint y; + gint start; ArtSVPRenderAAStep *steps; - int n_steps; + gint n_steps; iter = art_svp_render_aa_iter (svp, x0, y0, x1, y1); - for (y = y0; y < y1; y++) { art_svp_render_aa_iter_step (iter, &start, &steps, &n_steps); diff --git a/libart_lgpl/art_svp_render_aa.h b/libart_lgpl/art_svp_render_aa.h index c0c36874dc..5b5d7ace62 100644 --- a/libart_lgpl/art_svp_render_aa.h +++ b/libart_lgpl/art_svp_render_aa.h @@ -32,29 +32,29 @@ typedef struct _ArtSVPRenderAAStep ArtSVPRenderAAStep; typedef struct _ArtSVPRenderAAIter ArtSVPRenderAAIter; struct _ArtSVPRenderAAStep { - int x; - int delta; /* stored with 16 fractional bits */ + gint x; + gint delta; /* stored with 16 fractional bits */ }; ArtSVPRenderAAIter * art_svp_render_aa_iter (const ArtSVP *svp, - int x0, int y0, int x1, int y1); + gint x0, gint y0, gint x1, gint y1); void -art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, - ArtSVPRenderAAStep **p_steps, int *p_n_steps); +art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, gint *p_start, + ArtSVPRenderAAStep **p_steps, gint *p_n_steps); void art_svp_render_aa_iter_done (ArtSVPRenderAAIter *iter); void art_svp_render_aa (const ArtSVP *svp, - int x0, int y0, int x1, int y1, - void (*callback) (void *callback_data, - int y, - int start, - ArtSVPRenderAAStep *steps, int n_steps), - void *callback_data); + gint x0, gint y0, gint x1, gint y1, + void (*callback) (gpointer callback_data, + gint y, + gint start, + ArtSVPRenderAAStep *steps, gint n_steps), + gpointer callback_data); #ifdef __cplusplus } diff --git a/libart_lgpl/art_svp_vpath.c b/libart_lgpl/art_svp_vpath.c index 196711a400..47b1931140 100644 --- a/libart_lgpl/art_svp_vpath.c +++ b/libart_lgpl/art_svp_vpath.c @@ -30,12 +30,11 @@ #include "art_vpath.h" #include "art_svp.h" - /* reverse a list of points in place */ static void -reverse_points (ArtPoint *points, int n_points) +reverse_points (ArtPoint *points, gint n_points) { - int i; + gint i; ArtPoint tmp_p; for (i = 0; i < (n_points >> 1); i++) @@ -66,15 +65,15 @@ reverse_points (ArtPoint *points, int n_points) ArtSVP * art_svp_from_vpath (ArtVpath *vpath) { - int n_segs, n_segs_max; + gint n_segs, n_segs_max; ArtSVP *svp; - int dir; - int new_dir; - int i; + gint dir; + gint new_dir; + gint i; ArtPoint *points; - int n_points, n_points_max; - double x, y; - double x_min, x_max; + gint n_points, n_points_max; + gdouble x, y; + gdouble x_min, x_max; n_segs = 0; n_segs_max = 16; diff --git a/libart_lgpl/art_svp_vpath_stroke.c b/libart_lgpl/art_svp_vpath_stroke.c index 8d532f9743..c231048103 100644 --- a/libart_lgpl/art_svp_vpath_stroke.c +++ b/libart_lgpl/art_svp_vpath_stroke.c @@ -17,7 +17,6 @@ * Boston, MA 02111-1307, USA. */ - #include "config.h" #include "art_svp_vpath_stroke.h" @@ -48,18 +47,18 @@ curve to the right. */ static void -art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max, - double xc, double yc, - double x0, double y0, - double x1, double y1, - double radius, - double flatness) +art_svp_vpath_stroke_arc (ArtVpath **p_vpath, gint *pn, gint *pn_max, + gdouble xc, gdouble yc, + gdouble x0, gdouble y0, + gdouble x1, gdouble y1, + gdouble radius, + gdouble flatness) { - double theta; - double th_0, th_1; - int n_pts; - int i; - double aradius; + gdouble theta; + gdouble th_0, th_1; + gint n_pts; + gint i; + gdouble aradius; aradius = fabs (radius); theta = 2 * M_SQRT2 * sqrt (flatness / aradius); @@ -77,9 +76,6 @@ art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max, if (th_1 < th_0) th_1 += M_PI * 2; n_pts = ceil ((th_1 - th_0) / theta); } -#ifdef VERBOSE - printf ("start %f %f; th_0 = %f, th_1 = %f, r = %f, theta = %f\n", x0, y0, th_0, th_1, radius, theta); -#endif art_vpath_add_point (p_vpath, pn, pn_max, ART_LINETO, xc + x0, yc + y0); for (i = 1; i < n_pts; i++) @@ -88,15 +84,9 @@ art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max, art_vpath_add_point (p_vpath, pn, pn_max, ART_LINETO, xc + cos (theta) * aradius, yc + sin (theta) * aradius); -#ifdef VERBOSE - printf ("mid %f %f\n", cos (theta) * radius, sin (theta) * radius); -#endif } art_vpath_add_point (p_vpath, pn, pn_max, ART_LINETO, xc + x1, yc + y1); -#ifdef VERBOSE - printf ("end %f %f\n", x1, y1); -#endif } /* Assume that forw and rev are at point i0. Bring them to i1, @@ -113,24 +103,20 @@ art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max, Precondition: no zero-length vectors, otherwise a divide by zero will happen. */ static void -render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max, - ArtVpath **p_rev, int *pn_rev, int *pn_rev_max, - ArtVpath *vpath, int i0, int i1, int i2, +render_seg (ArtVpath **p_forw, gint *pn_forw, gint *pn_forw_max, + ArtVpath **p_rev, gint *pn_rev, gint *pn_rev_max, + ArtVpath *vpath, gint i0, gint i1, gint i2, ArtPathStrokeJoinType join, - double line_width, double miter_limit, double flatness) + gdouble line_width, gdouble miter_limit, gdouble flatness) { - double dx0, dy0; - double dx1, dy1; - double dlx0, dly0; - double dlx1, dly1; - double dmx, dmy; - double dmr2; - double scale; - double cross; - -#ifdef VERBOSE - printf ("join style = %d\n", join); -#endif + gdouble dx0, dy0; + gdouble dx1, dy1; + gdouble dlx0, dly0; + gdouble dlx1, dly1; + gdouble dmx, dmy; + gdouble dmr2; + gdouble scale; + gdouble cross; /* The vectors of the lines from i0 to i1 and i1 to i2. */ dx0 = vpath[i1].x - vpath[i0].x; @@ -151,19 +137,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max, dlx1 = dy1 * scale; dly1 = -dx1 * scale; -#ifdef VERBOSE - printf ("%% render_seg: (%g, %g) - (%g, %g) - (%g, %g)\n", - vpath[i0].x, vpath[i0].y, - vpath[i1].x, vpath[i1].y, - vpath[i2].x, vpath[i2].y); - - printf ("%% render_seg: d[xy]0 = (%g, %g), dl[xy]0 = (%g, %g)\n", - dx0, dy0, dlx0, dly0); - - printf ("%% render_seg: d[xy]1 = (%g, %g), dl[xy]1 = (%g, %g)\n", - dx1, dy1, dlx1, dly1); -#endif - /* now, forw's last point is expected to be colinear along d[xy]0 to point i0 - dl[xy]0, and rev with i0 + dl[xy]0. */ @@ -193,9 +166,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max, if (cross * cross < EPSILON_2 && dx0 * dx1 + dy0 * dy1 >= 0) { /* going straight */ -#ifdef VERBOSE - printf ("%% render_seg: straight\n"); -#endif art_vpath_add_point (p_forw, pn_forw, pn_forw_max, ART_LINETO, vpath[i1].x - dlx0, vpath[i1].y - dly0); art_vpath_add_point (p_rev, pn_rev, pn_rev_max, @@ -205,9 +175,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max, { /* left turn, forw is outside and rev is inside */ -#ifdef VERBOSE - printf ("%% render_seg: left\n"); -#endif if ( #ifdef NO_OPTIMIZE_INNER 0 && @@ -265,9 +232,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max, else { /* right turn, rev is outside and forw is inside */ -#ifdef VERBOSE - printf ("%% render_seg: right\n"); -#endif if ( #ifdef NO_OPTIMIZE_INNER @@ -328,15 +292,15 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max, /* caps i1, under the assumption of a vector from i0 */ static void -render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max, - ArtVpath *vpath, int i0, int i1, - ArtPathStrokeCapType cap, double line_width, double flatness) +render_cap (ArtVpath **p_result, gint *pn_result, gint *pn_result_max, + ArtVpath *vpath, gint i0, gint i1, + ArtPathStrokeCapType cap, gdouble line_width, gdouble flatness) { - double dx0, dy0; - double dlx0, dly0; - double scale; - int n_pts; - int i; + gdouble dx0, dy0; + gdouble dlx0, dly0; + gdouble scale; + gint n_pts; + gint i; dx0 = vpath[i1].x - vpath[i0].x; dy0 = vpath[i1].y - vpath[i0].y; @@ -347,10 +311,6 @@ render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max, dlx0 = dy0 * scale; dly0 = -dx0 * scale; -#ifdef VERBOSE - printf ("cap style = %d\n", cap); -#endif - switch (cap) { case ART_PATH_STROKE_CAP_BUTT: @@ -365,7 +325,7 @@ render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max, ART_LINETO, vpath[i1].x - dlx0, vpath[i1].y - dly0); for (i = 1; i < n_pts; i++) { - double theta, c_th, s_th; + gdouble theta, c_th, s_th; theta = M_PI * i / n_pts; c_th = cos (theta); @@ -410,21 +370,21 @@ ArtVpath * art_svp_vpath_stroke_raw (ArtVpath *vpath, ArtPathStrokeJoinType join, ArtPathStrokeCapType cap, - double line_width, - double miter_limit, - double flatness) + gdouble line_width, + gdouble miter_limit, + gdouble flatness) { - int begin_idx, end_idx; - int i; + gint begin_idx, end_idx; + gint i; ArtVpath *forw, *rev; - int n_forw, n_rev; - int n_forw_max, n_rev_max; + gint n_forw, n_rev; + gint n_forw_max, n_rev_max; ArtVpath *result; - int n_result, n_result_max; - double half_lw = 0.5 * line_width; - int closed; - int last, this, next, second; - double dx, dy; + gint n_result, n_result_max; + gdouble half_lw = 0.5 * line_width; + gint closed; + gint last, this, next, second; + gdouble dx, dy; n_forw_max = 16; forw = art_new (ArtVpath, n_forw_max); @@ -487,7 +447,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, vpath[this].x == vpath[begin_idx].x && vpath[this].y == vpath[begin_idx].y) { - int j; + gint j; /* path is closed, render join to beginning */ render_seg (&forw, &n_forw, &n_forw_max, @@ -495,9 +455,6 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, vpath, last, this, second, join, half_lw, miter_limit, flatness); -#ifdef VERBOSE - printf ("%% forw %d, rev %d\n", n_forw, n_rev); -#endif /* do forward path */ art_vpath_add_point (&result, &n_result, &n_result_max, ART_MOVETO, forw[n_forw - 1].x, @@ -519,7 +476,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, else { /* path is open */ - int j; + gint j; /* add to forw rather than result to ensure that forw has at least one point. */ @@ -556,65 +513,10 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, art_free (forw); art_free (rev); -#ifdef VERBOSE - printf ("%% n_result = %d\n", n_result); -#endif art_vpath_add_point (&result, &n_result, &n_result_max, ART_END, 0, 0); return result; } -#define noVERBOSE - -#ifdef VERBOSE - -#define XOFF 50 -#define YOFF 700 - -static void -print_ps_vpath (ArtVpath *vpath) -{ - int i; - - for (i = 0; vpath[i].code != ART_END; i++) - { - switch (vpath[i].code) - { - case ART_MOVETO: - printf ("%g %g moveto\n", XOFF + vpath[i].x, YOFF - vpath[i].y); - break; - case ART_LINETO: - printf ("%g %g lineto\n", XOFF + vpath[i].x, YOFF - vpath[i].y); - break; - default: - break; - } - } - printf ("stroke showpage\n"); -} - -static void -print_ps_svp (ArtSVP *vpath) -{ - int i, j; - - printf ("%% begin\n"); - for (i = 0; i < vpath->n_segs; i++) - { - printf ("%g setgray\n", vpath->segs[i].dir ? 0.7 : 0); - for (j = 0; j < vpath->segs[i].n_points; j++) - { - printf ("%g %g %s\n", - XOFF + vpath->segs[i].points[j].x, - YOFF - vpath->segs[i].points[j].y, - j ? "lineto" : "moveto"); - } - printf ("stroke\n"); - } - - printf ("showpage\n"); -} -#endif - /* Render a vector path into a stroked outline. Status of this routine: @@ -675,9 +577,9 @@ ArtSVP * art_svp_vpath_stroke (ArtVpath *vpath, ArtPathStrokeJoinType join, ArtPathStrokeCapType cap, - double line_width, - double miter_limit, - double flatness) + gdouble line_width, + gdouble miter_limit, + gdouble flatness) { #ifdef ART_USE_NEW_INTERSECTOR ArtVpath *vpath_stroke; @@ -686,22 +588,13 @@ art_svp_vpath_stroke (ArtVpath *vpath, vpath_stroke = art_svp_vpath_stroke_raw (vpath, join, cap, line_width, miter_limit, flatness); -#ifdef VERBOSE - print_ps_vpath (vpath_stroke); -#endif svp = art_svp_from_vpath (vpath_stroke); -#ifdef VERBOSE - print_ps_svp (svp); -#endif art_free (vpath_stroke); swr = art_svp_writer_rewind_new (ART_WIND_RULE_NONZERO); art_svp_intersector (svp, swr); svp2 = art_svp_writer_rewind_reap (swr); -#ifdef VERBOSE - print_ps_svp (svp2); -#endif art_svp_free (svp); return svp2; #else @@ -710,28 +603,13 @@ art_svp_vpath_stroke (ArtVpath *vpath, vpath_stroke = art_svp_vpath_stroke_raw (vpath, join, cap, line_width, miter_limit, flatness); -#ifdef VERBOSE - print_ps_vpath (vpath_stroke); -#endif vpath2 = art_vpath_perturb (vpath_stroke); -#ifdef VERBOSE - print_ps_vpath (vpath2); -#endif art_free (vpath_stroke); svp = art_svp_from_vpath (vpath2); -#ifdef VERBOSE - print_ps_svp (svp); -#endif art_free (vpath2); svp2 = art_svp_uncross (svp); -#ifdef VERBOSE - print_ps_svp (svp2); -#endif art_svp_free (svp); svp3 = art_svp_rewind_uncrossed (svp2, ART_WIND_RULE_NONZERO); -#ifdef VERBOSE - print_ps_svp (svp3); -#endif art_svp_free (svp2); return svp3; diff --git a/libart_lgpl/art_svp_vpath_stroke.h b/libart_lgpl/art_svp_vpath_stroke.h index c189a5bb2b..f945d7cba9 100644 --- a/libart_lgpl/art_svp_vpath_stroke.h +++ b/libart_lgpl/art_svp_vpath_stroke.h @@ -45,18 +45,18 @@ ArtSVP * art_svp_vpath_stroke (ArtVpath *vpath, ArtPathStrokeJoinType join, ArtPathStrokeCapType cap, - double line_width, - double miter_limit, - double flatness); + gdouble line_width, + gdouble miter_limit, + gdouble flatness); /* This version may have winding numbers exceeding 1. */ ArtVpath * art_svp_vpath_stroke_raw (ArtVpath *vpath, ArtPathStrokeJoinType join, ArtPathStrokeCapType cap, - double line_width, - double miter_limit, - double flatness); + gdouble line_width, + gdouble miter_limit, + gdouble flatness); #ifdef __cplusplus } diff --git a/libart_lgpl/art_uta.c b/libart_lgpl/art_uta.c index 10bd6ee3bd..4396e2b6c6 100644 --- a/libart_lgpl/art_uta.c +++ b/libart_lgpl/art_uta.c @@ -36,7 +36,7 @@ * Returns: the newly allocated #ArtUta. **/ ArtUta * -art_uta_new (int x0, int y0, int x1, int y1) +art_uta_new (gint x0, gint y0, gint x1, gint y1) { ArtUta *uta; @@ -64,7 +64,7 @@ art_uta_new (int x0, int y0, int x1, int y1) * Returns: the newly allocated #ArtUta. **/ ArtUta * -art_uta_new_coords (int x0, int y0, int x1, int y1) +art_uta_new_coords (gint x0, gint y0, gint x1, gint y1) { return art_uta_new (x0 >> ART_UTILE_SHIFT, y0 >> ART_UTILE_SHIFT, 1 + (x1 >> ART_UTILE_SHIFT), diff --git a/libart_lgpl/art_uta.h b/libart_lgpl/art_uta.h index e0247c3fc9..3101949bb2 100644 --- a/libart_lgpl/art_uta.h +++ b/libart_lgpl/art_uta.h @@ -45,18 +45,18 @@ typedef struct _ArtUta ArtUta; /* Coordinates are shifted right by ART_UTILE_SHIFT wrt the real coordinates. */ struct _ArtUta { - int x0; - int y0; - int width; - int height; + gint x0; + gint y0; + gint width; + gint height; ArtUtaBbox *utiles; }; ArtUta * -art_uta_new (int x0, int y0, int x1, int y1); +art_uta_new (gint x0, gint y0, gint x1, gint y1); ArtUta * -art_uta_new_coords (int x0, int y0, int x1, int y1); +art_uta_new_coords (gint x0, gint y0, gint x1, gint y1); void art_uta_free (ArtUta *uta); diff --git a/libart_lgpl/art_uta_rect.c b/libart_lgpl/art_uta_rect.c index 68a6053459..d92cf691b5 100644 --- a/libart_lgpl/art_uta_rect.c +++ b/libart_lgpl/art_uta_rect.c @@ -39,10 +39,10 @@ art_uta_from_irect (ArtIRect *bbox) ArtUta *uta; ArtUtaBbox *utiles; ArtUtaBbox bb; - int width, height; - int x, y; - int xf0, yf0, xf1, yf1; - int ix; + gint width, height; + gint x, y; + gint xf0, yf0, xf1, yf1; + gint ix; uta = art_new (ArtUta, 1); uta->x0 = bbox->x0 >> ART_UTILE_SHIFT; diff --git a/libart_lgpl/art_uta_vpath.c b/libart_lgpl/art_uta_vpath.c index d7df5ede8b..9d5af1e844 100644 --- a/libart_lgpl/art_uta_vpath.c +++ b/libart_lgpl/art_uta_vpath.c @@ -55,18 +55,18 @@ * details. **/ void -art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, - int *rbuf, int rbuf_rowstride) +art_uta_add_line (ArtUta *uta, gdouble x0, gdouble y0, gdouble x1, gdouble y1, + gint *rbuf, gint rbuf_rowstride) { - int xmin, ymin; - double xmax, ymax; - int xmaxf, ymaxf; - int xmaxc, ymaxc; - int xt0, yt0; - int xt1, yt1; - int xf0, yf0; - int xf1, yf1; - int ix, ix1; + gint xmin, ymin; + gdouble xmax, ymax; + gint xmaxf, ymaxf; + gint xmaxc, ymaxc; + gint xt0, yt0; + gint xt1, yt1; + gint xf0, yf0; + gint xf1, yf1; + gint ix, ix1; ArtUtaBbox bb; xmin = floor (MIN(x0, x1)); @@ -102,8 +102,8 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, } else { - double dx, dy; - int sx, sy; + gdouble dx, dy; + gint sx, sy; dx = x1 - x0; dy = y1 - y0; @@ -146,9 +146,9 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, else { /* Do a Bresenham-style traversal of the line */ - double dx_dy; - double x, y; - double xn, yn; + gdouble dx_dy; + gdouble x, y; + gdouble xn, yn; /* normalize coordinates to uta origin */ x0 -= uta->x0 << ART_UTILE_SHIFT; @@ -157,7 +157,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, y1 -= uta->y0 << ART_UTILE_SHIFT; if (dy < 0) { - double tmp; + gdouble tmp; tmp = x0; x0 = x1; @@ -173,27 +173,21 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, /* we leave sy alone, because it would always be 1, and we need it for the rbuf stuff. */ } - xt0 = ((int)floor (x0) >> ART_UTILE_SHIFT); - xt1 = ((int)floor (x1) >> ART_UTILE_SHIFT); + xt0 = ((gint)floor (x0) >> ART_UTILE_SHIFT); + xt1 = ((gint)floor (x1) >> ART_UTILE_SHIFT); /* now [xy]0 is above [xy]1 */ ix = yt0 * uta->width + xt0; ix1 = yt1 * uta->width + xt1; -#ifdef VERBOSE - printf ("%% ix = %d,%d; ix1 = %d,%d\n", xt0, yt0, xt1, yt1); -#endif dx_dy = dx / dy; x = x0; y = y0; while (ix != ix1) { - int dix; + gint dix; /* figure out whether next crossing is horizontal or vertical */ -#ifdef VERBOSE - printf ("%% %d,%d\n", xt0, yt0); -#endif yn = (yt0 + 1) << ART_UTILE_SHIFT; /* xn is the intercept with bottom edge of this tile. The @@ -201,7 +195,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, x1 when yn = y1. */ xn = x1 + dx_dy * (yn - y1); - if (xt0 != (int)floor (xn) >> ART_UTILE_SHIFT) + if (xt0 != (gint)floor (xn) >> ART_UTILE_SHIFT) { /* horizontal crossing */ xt0 += sx; @@ -211,7 +205,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, xn = xt0 << ART_UTILE_SHIFT; yn = y0 + (xn - x0) / dx_dy; - xf0 = (int)floor (x) & (ART_UTILE_SIZE - 1); + xf0 = (gint)floor (x) & (ART_UTILE_SIZE - 1); xf1 = ART_UTILE_SIZE; } else @@ -220,20 +214,20 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, yn = y0 + (xn - x0) / dx_dy; xf0 = 0; - xmaxc = (int)ceil (x); + xmaxc = (gint)ceil (x); xf1 = xmaxc - ((xt0 + 1) << ART_UTILE_SHIFT); } - ymaxf = (int)floor (yn); - ymaxc = (int)ceil (yn); + ymaxf = (gint)floor (yn); + ymaxc = (gint)ceil (yn); yf1 = (ymaxf & (ART_UTILE_SIZE - 1)) + ymaxc - ymaxf; } else { /* vertical crossing */ dix = uta->width; - xf0 = (int)floor (MIN(x, xn)) & (ART_UTILE_SIZE - 1); + xf0 = (gint)floor (MIN(x, xn)) & (ART_UTILE_SIZE - 1); xmax = MAX(x, xn); - xmaxc = (int)ceil (xmax); + xmaxc = (gint)ceil (xmax); xf1 = xmaxc - (xt0 << ART_UTILE_SHIFT); yf1 = ART_UTILE_SIZE; @@ -242,7 +236,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, yt0++; } - yf0 = (int)floor (y) & (ART_UTILE_SIZE - 1); + yf0 = (gint)floor (y) & (ART_UTILE_SIZE - 1); bb = uta->utiles[ix]; if (bb == 0) bb = ART_UTA_BBOX_CONS(xf0, yf0, xf1, yf1); @@ -260,8 +254,8 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, xmax = MAX(x, x1); xmaxc = ceil (xmax); ymaxc = ceil (y1); - xf0 = (int)floor (MIN(x1, x)) & (ART_UTILE_SIZE - 1); - yf0 = (int)floor (y) & (ART_UTILE_SIZE - 1); + xf0 = (gint)floor (MIN(x1, x)) & (ART_UTILE_SIZE - 1); + yf0 = (gint)floor (y) & (ART_UTILE_SIZE - 1); xf1 = xmaxc - (xt0 << ART_UTILE_SHIFT); yf1 = ymaxc - (yt0 << ART_UTILE_SHIFT); bb = uta->utiles[ix]; @@ -291,16 +285,16 @@ art_uta_from_vpath (const ArtVpath *vec) { ArtUta *uta; ArtIRect bbox; - int *rbuf; - int i; - double x, y; - int sum; - int xt, yt; + gint *rbuf; + gint i; + gdouble x, y; + gint sum; + gint xt, yt; ArtUtaBbox *utiles; ArtUtaBbox bb; - int width; - int height; - int ix; + gint width; + gint height; + gint ix; art_vpath_bbox_irect (vec, &bbox); diff --git a/libart_lgpl/art_uta_vpath.h b/libart_lgpl/art_uta_vpath.h index 5a55876018..3f50e3a746 100644 --- a/libart_lgpl/art_uta_vpath.h +++ b/libart_lgpl/art_uta_vpath.h @@ -34,8 +34,8 @@ art_uta_from_vpath (const ArtVpath *vec); /* This is a private function: */ void -art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, - int *rbuf, int rbuf_rowstride); +art_uta_add_line (ArtUta *uta, gdouble x0, gdouble y0, gdouble x1, gdouble y1, + gint *rbuf, gint rbuf_rowstride); #ifdef __cplusplus } diff --git a/libart_lgpl/art_vpath.c b/libart_lgpl/art_vpath.c index bfdb9acca5..395917915b 100644 --- a/libart_lgpl/art_vpath.c +++ b/libart_lgpl/art_vpath.c @@ -46,10 +46,10 @@ * desired. **/ void -art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max, - ArtPathcode code, double x, double y) +art_vpath_add_point (ArtVpath **p_vpath, gint *pn_points, gint *pn_points_max, + ArtPathcode code, gdouble x, gdouble y) { - int i; + gint i; i = (*pn_points)++; if (i == *pn_points_max) @@ -69,8 +69,8 @@ art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max, void art_vpath_bbox_drect (const ArtVpath *vec, ArtDRect *drect) { - int i; - double x0, y0, x1, y1; + gint i; + gdouble x0, y0, x1, y1; if (vec[0].code == ART_END) { diff --git a/libart_lgpl/art_vpath.h b/libart_lgpl/art_vpath.h index f5557f6005..7dadd2865d 100644 --- a/libart_lgpl/art_vpath.h +++ b/libart_lgpl/art_vpath.h @@ -34,15 +34,15 @@ typedef struct _ArtVpath ArtVpath; /* CURVETO is not allowed! */ struct _ArtVpath { ArtPathcode code; - double x; - double y; + gdouble x; + gdouble y; }; /* Some of the functions need to go into their own modules */ void -art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max, - ArtPathcode code, double x, double y); +art_vpath_add_point (ArtVpath **p_vpath, gint *pn_points, gint *pn_points_max, + ArtPathcode code, gdouble x, gdouble y); void art_vpath_bbox_drect (const ArtVpath *vec, ArtDRect *drect); diff --git a/libart_lgpl/art_vpath_bpath.c b/libart_lgpl/art_vpath_bpath.c index 3f9afe7229..a748dfbec5 100644 --- a/libart_lgpl/art_vpath_bpath.c +++ b/libart_lgpl/art_vpath_bpath.c @@ -33,19 +33,15 @@ /* level must be >= 1 */ ArtPoint * -art_bezier_to_vec (double x0, double y0, - double x1, double y1, - double x2, double y2, - double x3, double y3, +art_bezier_to_vec (gdouble x0, gdouble y0, + gdouble x1, gdouble y1, + gdouble x2, gdouble y2, + gdouble x3, gdouble y3, ArtPoint *p, - int level) + gint level) { - double x_m, y_m; + gdouble x_m, y_m; -#ifdef VERBOSE - printf ("bezier_to_vec: %g,%g %g,%g %g,%g %g,%g %d\n", - x0, y0, x1, y1, x2, y2, x3, y3, level); -#endif if (level == 1) { x_m = (x0 + 3 * (x1 + x2) + x3) * 0.125; y_m = (y0 + 3 * (y1 + y2) + y3) * 0.125; @@ -55,14 +51,11 @@ art_bezier_to_vec (double x0, double y0, p->x = x3; p->y = y3; p++; -#ifdef VERBOSE - printf ("-> (%g, %g) -> (%g, %g)\n", x_m, y_m, x3, y3); -#endif } else { - double xa1, ya1; - double xa2, ya2; - double xb1, yb1; - double xb2, yb2; + gdouble xa1, ya1; + gdouble xa2, ya2; + gdouble xb1, yb1; + gdouble xb2, yb2; xa1 = (x0 + x1) * 0.5; ya1 = (y0 + y1) * 0.5; @@ -74,10 +67,6 @@ art_bezier_to_vec (double x0, double y0, yb2 = (y2 + y3) * 0.5; x_m = (xa2 + xb1) * 0.5; y_m = (ya2 + yb1) * 0.5; -#ifdef VERBOSE - printf ("%g,%g %g,%g %g,%g %g,%g\n", xa1, ya1, xa2, ya2, - xb1, yb1, xb2, yb2); -#endif p = art_bezier_to_vec (x0, y0, xa1, ya1, xa2, ya2, x_m, y_m, p, level - 1); p = art_bezier_to_vec (x_m, y_m, xb1, yb1, xb2, yb2, x3, y3, p, level - 1); } @@ -88,7 +77,7 @@ art_bezier_to_vec (double x0, double y0, #define RENDER_SIZE (1 << (RENDER_LEVEL)) /** - * art_vpath_render_bez: Render a bezier segment into the vpath. + * art_vpath_render_bez: Render a bezier segment into the vpath. * @p_vpath: Where the pointer to the #ArtVpath structure is stored. * @pn_points: Pointer to the number of points in *@p_vpath. * @pn_points_max: Pointer to the number of points allocated. @@ -116,24 +105,24 @@ art_bezier_to_vec (double x0, double y0, * rendering. **/ static void -art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max, - double x0, double y0, - double x1, double y1, - double x2, double y2, - double x3, double y3, - double flatness) +art_vpath_render_bez (ArtVpath **p_vpath, gint *pn, gint *pn_max, + gdouble x0, gdouble y0, + gdouble x1, gdouble y1, + gdouble x2, gdouble y2, + gdouble x3, gdouble y3, + gdouble flatness) { - double x3_0, y3_0; - double z3_0_dot; - double z1_dot, z2_dot; - double z1_perp, z2_perp; - double max_perp_sq; - - double x_m, y_m; - double xa1, ya1; - double xa2, ya2; - double xb1, yb1; - double xb2, yb2; + gdouble x3_0, y3_0; + gdouble z3_0_dot; + gdouble z1_dot, z2_dot; + gdouble z1_perp, z2_perp; + gdouble max_perp_sq; + + gdouble x_m, y_m; + gdouble xa1, ya1; + gdouble xa2, ya2; + gdouble xb1, yb1; + gdouble xb2, yb2; /* It's possible to optimize this routine a fair amount. @@ -213,7 +202,6 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max, if (z2_dot + z2_dot > z3_0_dot) goto subdivide; - nosubdivide: /* don't subdivide */ art_vpath_add_point (p_vpath, pn, pn_max, @@ -232,10 +220,6 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max, yb2 = (y2 + y3) * 0.5; x_m = (xa2 + xb1) * 0.5; y_m = (ya2 + yb1) * 0.5; -#ifdef VERBOSE - printf ("%g,%g %g,%g %g,%g %g,%g\n", xa1, ya1, xa2, ya2, - xb1, yb1, xb2, yb2); -#endif art_vpath_render_bez (p_vpath, pn, pn_max, x0, y0, xa1, ya1, xa2, ya2, x_m, y_m, flatness); art_vpath_render_bez (p_vpath, pn, pn_max, @@ -255,12 +239,12 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max, * Return value: Newly allocated vpath. **/ ArtVpath * -art_bez_path_to_vec (const ArtBpath *bez, double flatness) +art_bez_path_to_vec (const ArtBpath *bez, gdouble flatness) { ArtVpath *vec; - int vec_n, vec_n_max; - int bez_index; - double x, y; + gint vec_n, vec_n_max; + gint bez_index; + gdouble x, y; vec_n = 0; vec_n_max = RENDER_SIZE; @@ -275,14 +259,6 @@ art_bez_path_to_vec (const ArtBpath *bez, double flatness) bez_index = 0; do { -#ifdef VERBOSE - printf ("%s %g %g\n", - bez[bez_index].code == ART_CURVETO ? "curveto" : - bez[bez_index].code == ART_LINETO ? "lineto" : - bez[bez_index].code == ART_MOVETO ? "moveto" : - bez[bez_index].code == ART_MOVETO_OPEN ? "moveto-open" : - "end", bez[bez_index].x3, bez[bez_index].y3); -#endif /* make sure space for at least one more code */ if (vec_n >= vec_n_max) art_expand (vec, ArtVpath, vec_n_max); @@ -305,12 +281,6 @@ art_bez_path_to_vec (const ArtBpath *bez, double flatness) vec_n++; break; case ART_CURVETO: -#ifdef VERBOSE - printf ("%g,%g %g,%g %g,%g %g,%g\n", x, y, - bez[bez_index].x1, bez[bez_index].y1, - bez[bez_index].x2, bez[bez_index].y2, - bez[bez_index].x3, bez[bez_index].y3); -#endif art_vpath_render_bez (&vec, &vec_n, &vec_n_max, x, y, bez[bez_index].x1, bez[bez_index].y1, diff --git a/libart_lgpl/art_vpath_bpath.h b/libart_lgpl/art_vpath_bpath.h index b5ca7c1939..5115ee58cf 100644 --- a/libart_lgpl/art_vpath_bpath.h +++ b/libart_lgpl/art_vpath_bpath.h @@ -27,14 +27,14 @@ extern "C" { #endif /* __cplusplus */ -ArtPoint *art_bezier_to_vec (double x0, double y0, - double x1, double y1, - double x2, double y2, - double x3, double y3, +ArtPoint *art_bezier_to_vec (gdouble x0, gdouble y0, + gdouble x1, gdouble y1, + gdouble x2, gdouble y2, + gdouble x3, gdouble y3, ArtPoint *p, - int level); + gint level); -ArtVpath *art_bez_path_to_vec (const ArtBpath *bez, double flatness); +ArtVpath *art_bez_path_to_vec (const ArtBpath *bez, gdouble flatness); #ifdef __cplusplus } diff --git a/libart_lgpl/art_vpath_dash.c b/libart_lgpl/art_vpath_dash.c index 3c98a96d9f..2c54aca4a6 100644 --- a/libart_lgpl/art_vpath_dash.c +++ b/libart_lgpl/art_vpath_dash.c @@ -29,14 +29,13 @@ #include "art_vpath.h" - /* Return the length of the largest subpath within vpath */ -static int +static gint art_vpath_dash_max_subpath (const ArtVpath *vpath) { - int max_subpath; - int i; - int start; + gint max_subpath; + gint i; + gint start; max_subpath = 0; start = 0; @@ -79,23 +78,23 @@ art_vpath_dash_max_subpath (const ArtVpath *vpath) ArtVpath * art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash) { - int max_subpath; - double *dists; + gint max_subpath; + gdouble *dists; ArtVpath *result; - int n_result, n_result_max; - int start, end; - int i; - double total_dist; + gint n_result, n_result_max; + gint start, end; + gint i; + gdouble total_dist; /* state while traversing dasharray - offset is offset of current dash value, toggle is 0 for "off" and 1 for "on", and phase is the distance in, >= 0, < dash->dash[offset]. */ - int offset, toggle; - double phase; + gint offset, toggle; + gdouble phase; /* initial values */ - int offset_init, toggle_init; - double phase_init; + gint offset_init, toggle_init; + gdouble phase_init; max_subpath = art_vpath_dash_max_subpath (vpath); dists = art_new (double, max_subpath); @@ -124,7 +123,7 @@ art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash) total_dist = 0; for (i = start; i < end - 1; i++) { - double dx, dy; + gdouble dx, dy; dx = vpath[i + 1].x - vpath[i].x; dy = vpath[i + 1].y - vpath[i].y; @@ -145,7 +144,7 @@ art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash) { /* subpath is composed of at least one dash - thus all generated pieces are open */ - double dist; + gdouble dist; phase = phase_init; offset = offset_init; @@ -160,8 +159,8 @@ art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash) if (dists[i - start] - dist > dash->dash[offset] - phase) { /* dash boundary is next */ - double a; - double x, y; + gdouble a; + gdouble x, y; dist += dash->dash[offset] - phase; a = dist / dists[i - start]; diff --git a/libart_lgpl/art_vpath_dash.h b/libart_lgpl/art_vpath_dash.h index 1ee7b33349..93ecea5e32 100644 --- a/libart_lgpl/art_vpath_dash.h +++ b/libart_lgpl/art_vpath_dash.h @@ -31,9 +31,9 @@ extern "C" { typedef struct _ArtVpathDash ArtVpathDash; struct _ArtVpathDash { - double offset; - int n_dash; - double *dash; + gdouble offset; + gint n_dash; + gdouble *dash; }; ArtVpath * diff --git a/libart_lgpl/art_vpath_svp.c b/libart_lgpl/art_vpath_svp.c index 000265c376..ceeea0ac4b 100644 --- a/libart_lgpl/art_vpath_svp.c +++ b/libart_lgpl/art_vpath_svp.c @@ -31,15 +31,15 @@ typedef struct _ArtVpathSVPEnd ArtVpathSVPEnd; struct _ArtVpathSVPEnd { - int seg_num; - int which; /* 0 = top, 1 = bottom */ - double x, y; + gint seg_num; + gint which; /* 0 = top, 1 = bottom */ + gdouble x, y; }; #define EPSILON 1e-6 -static int -art_vpath_svp_point_compare (double x1, double y1, double x2, double y2) +static gint +art_vpath_svp_point_compare (gdouble x1, gdouble y1, gdouble x2, gdouble y2) { if (y1 - EPSILON > y2) return 1; if (y1 + EPSILON < y2) return -1; @@ -48,8 +48,8 @@ art_vpath_svp_point_compare (double x1, double y1, double x2, double y2) return 0; } -static int -art_vpath_svp_compare (const void *s1, const void *s2) +static gint +art_vpath_svp_compare (gconstpointer s1, gconstpointer s2) { const ArtVpathSVPEnd *e1 = s1; const ArtVpathSVPEnd *e2 = s2; @@ -83,18 +83,18 @@ art_vpath_svp_compare (const void *s1, const void *s2) ArtVpath * art_vpath_from_svp (const ArtSVP *svp) { - int n_segs = svp->n_segs; + gint n_segs = svp->n_segs; ArtVpathSVPEnd *ends; ArtVpath *new; - int *visited; - int n_new, n_new_max; - int i, k; - int j = 0; /* Quiet compiler */ - int seg_num; - int first; - double last_x, last_y; - int n_points; - int pt_num; + gint *visited; + gint n_new, n_new_max; + gint i, k; + gint j = 0; /* Quiet compiler */ + gint seg_num; + gint first; + gdouble last_x, last_y; + gint n_points; + gint pt_num; last_x = 0; /* to eliminate "uninitialized" warning */ last_y = 0; @@ -102,7 +102,7 @@ art_vpath_from_svp (const ArtSVP *svp) ends = art_new (ArtVpathSVPEnd, n_segs * 2); for (i = 0; i < svp->n_segs; i++) { - int lastpt; + gint lastpt; ends[i * 2].seg_num = i; ends[i * 2].which = 0; diff --git a/libgnomecanvas/gailcanvas.c b/libgnomecanvas/gailcanvas.c index 02abd10deb..fb64204a65 100644 --- a/libgnomecanvas/gailcanvas.c +++ b/libgnomecanvas/gailcanvas.c @@ -84,9 +84,9 @@ gail_canvas_get_type (void) if (!type) { - GType parent_type = g_type_parent (GNOME_TYPE_CANVAS); + GType parent_type = g_type_parent (GNOME_TYPE_CANVAS); AtkObjectFactory *factory = atk_registry_get_factory ( - atk_get_default_registry (), + atk_get_default_registry (), parent_type); GType atkobject_parent_type = atk_object_factory_get_accessible_type (factory); GTypeQuery query; @@ -118,28 +118,28 @@ gail_canvas_get_type (void) static AtkObjectClass *parent_atk_object_class; /** - * Tell ATK how to create the appropriate AtkObject peers + * Tell ATK how to create the appropriate AtkObject peers **/ void gail_canvas_init (void) { atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS, + GNOME_TYPE_CANVAS, gail_canvas_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_GROUP, + GNOME_TYPE_CANVAS_GROUP, gail_canvas_group_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_TEXT, + GNOME_TYPE_CANVAS_TEXT, gail_canvas_text_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_RICH_TEXT, + GNOME_TYPE_CANVAS_RICH_TEXT, gail_canvas_text_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), GNOME_TYPE_CANVAS_WIDGET, gail_canvas_widget_factory_get_type()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_ITEM, + GNOME_TYPE_CANVAS_ITEM, gail_canvas_item_factory_get_type ()); } @@ -154,7 +154,7 @@ gail_canvas_class_init (GailCanvasClass *klass) class->initialize = gail_canvas_real_initialize; } -AtkObject* +AtkObject* gail_canvas_new (GtkWidget *widget) { GObject *object; @@ -170,7 +170,6 @@ gail_canvas_new (GtkWidget *widget) return accessible; } - static void gail_canvas_real_initialize (AtkObject *obj, gpointer data) @@ -197,7 +196,7 @@ gail_canvas_real_initialize (AtkObject *obj, obj->role = ATK_ROLE_LAYERED_PANE; } -static gint +static gint gail_canvas_get_n_children (AtkObject* obj) { GtkAccessible *accessible; @@ -221,7 +220,7 @@ gail_canvas_get_n_children (AtkObject* obj) return 1; } -static AtkObject* +static AtkObject* gail_canvas_ref_child (AtkObject *obj, gint i) { diff --git a/libgnomecanvas/gailcanvas.h b/libgnomecanvas/gailcanvas.h index 46cd7b7187..946ddc338a 100644 --- a/libgnomecanvas/gailcanvas.h +++ b/libgnomecanvas/gailcanvas.h @@ -1,4 +1,4 @@ -/* gailcanvas.h - code from GAIL, the +/* gailcanvas.h - code from GAIL, the * Gnome Accessibility Implementation Library * Copyright 2001-2006 Sun Microsystems Inc. * @@ -56,7 +56,6 @@ struct _GailCanvasFactoryClass AtkObjectFactoryClass parent_class; }; - GType gail_canvas_get_type (void); struct _GailCanvas; diff --git a/libgnomecanvas/gailcanvasgroup.c b/libgnomecanvas/gailcanvasgroup.c index 1750f679c2..8f0ee238ad 100644 --- a/libgnomecanvas/gailcanvasgroup.c +++ b/libgnomecanvas/gailcanvasgroup.c @@ -73,7 +73,6 @@ gail_canvas_group_get_n_children (AtkObject *obj) return g_list_length (group->item_list); } - static AtkObject * gail_canvas_group_ref_child (AtkObject *obj, gint i) diff --git a/libgnomecanvas/gailcanvasgroupfactory.c b/libgnomecanvas/gailcanvasgroupfactory.c index 10a7d2e056..79b687584f 100644 --- a/libgnomecanvas/gailcanvasgroupfactory.c +++ b/libgnomecanvas/gailcanvasgroupfactory.c @@ -32,7 +32,7 @@ gail_canvas_group_factory_get_type (void) { static GType type = 0; - if (!type) + if (!type) { static const GTypeInfo tinfo = { @@ -48,14 +48,14 @@ gail_canvas_group_factory_get_type (void) NULL /* value table */ }; type = g_type_register_static ( - ATK_TYPE_OBJECT_FACTORY, + ATK_TYPE_OBJECT_FACTORY, "GailCanvasGroupFactory" , &tinfo, 0); } return type; } -static void +static void gail_canvas_group_factory_class_init (GailCanvasGroupFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -64,7 +64,7 @@ gail_canvas_group_factory_class_init (GailCanvasGroupFactoryClass *klass) class->get_accessible_type = gail_canvas_group_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_group_factory_create_accessible (GObject *obj) { return gail_canvas_group_new (obj); diff --git a/libgnomecanvas/gailcanvasgroupfactory.h b/libgnomecanvas/gailcanvasgroupfactory.h index 7ba4014eb6..9c382aeabd 100644 --- a/libgnomecanvas/gailcanvasgroupfactory.h +++ b/libgnomecanvas/gailcanvasgroupfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_GROUP_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_GROUP_FACTORY)) #define GAIL_CANVAS_GROUP_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_GROUP_FACTORY, GailCanvasGroupFactoryClass)) - typedef struct _GailCanvasGroupFactory GailCanvasGroupFactory; typedef struct _GailCanvasGroupFactoryClass GailCanvasGroupFactoryClass; diff --git a/libgnomecanvas/gailcanvasitem.c b/libgnomecanvas/gailcanvasitem.c index 5ae7c8bee3..6fb5c7d316 100644 --- a/libgnomecanvas/gailcanvasitem.c +++ b/libgnomecanvas/gailcanvasitem.c @@ -25,35 +25,35 @@ #include <libgail-util/gailmisc.h> static void gail_canvas_item_initialize (AtkObject *obj, - gpointer data); + gpointer data); static AtkObject* gail_canvas_item_get_parent (AtkObject *obj); static gint gail_canvas_item_get_index_in_parent (AtkObject *obj); static AtkStateSet* gail_canvas_item_ref_state_set (AtkObject *obj); static void gail_canvas_item_component_interface_init (AtkComponentIface *iface); static guint gail_canvas_item_add_focus_handler (AtkComponent *component, - AtkFocusHandler handler); + AtkFocusHandler handler); static void gail_canvas_item_get_extents (AtkComponent *component, - gint *x, - gint *y, - gint *width, - gint *height, - AtkCoordType coord_type); + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coord_type); static gint gail_canvas_item_get_mdi_zorder (AtkComponent *component); static gboolean gail_canvas_item_grab_focus (AtkComponent *component); static void gail_canvas_item_remove_focus_handler (AtkComponent *component, - guint handler_id); + guint handler_id); static gboolean is_item_on_screen (GnomeCanvasItem *item); static void get_item_extents (GnomeCanvasItem *item, - gint *x, - gint *y, - gint *width, - gint *height); + gint *x, + gint *y, + gint *width, + gint *height); static gboolean is_item_in_window (GnomeCanvasItem *item, - gint x, - gint y, - gint width, - gint height); + gint x, + gint y, + gint width, + gint height); static AtkGObjectAccessibleClass *parent_class = NULL; @@ -85,7 +85,7 @@ gail_canvas_item_new (GObject *obj) static void gail_canvas_item_initialize (AtkObject *obj, - gpointer data) + gpointer data) { ATK_OBJECT_CLASS (parent_class)->initialize (obj, data); @@ -280,7 +280,7 @@ gail_canvas_item_get_extents (AtkComponent *component, atk_gobj = ATK_GOBJECT_ACCESSIBLE (component); obj = atk_gobject_accessible_get_object (atk_gobj); - if (obj == NULL) + if (obj == NULL) /* item is defunct */ return; @@ -290,7 +290,7 @@ gail_canvas_item_get_extents (AtkComponent *component, /* If this item has no parent canvas, something's broken */ g_return_if_fail (GTK_IS_WIDGET (item->canvas)); - get_item_extents (item, &local_x, &local_y, width, height); + get_item_extents (item, &local_x, &local_y, width, height); if (!is_item_in_window (item, local_x, local_y, *width, *height)) { *x = G_MININT; @@ -315,7 +315,7 @@ gail_canvas_item_get_extents (AtkComponent *component, static gint gail_canvas_item_get_mdi_zorder (AtkComponent *component) { - g_return_val_if_fail (ATK_OBJECT (component), -1); + g_return_val_if_fail (ATK_OBJECT (component), -1); return gail_canvas_item_get_index_in_parent (ATK_OBJECT (component)); } @@ -353,11 +353,11 @@ gail_canvas_item_remove_focus_handler (AtkComponent *component, g_signal_handler_disconnect (ATK_OBJECT (component), handler_id); } -static gboolean +static gboolean is_item_on_screen (GnomeCanvasItem *item) { gint x, y, width, height; - + get_item_extents (item, &x, &y, &width, &height); return is_item_in_window (item, x, y, width, height); } @@ -369,14 +369,14 @@ get_item_extents (GnomeCanvasItem *item, gint *width, gint *height) { - double bx1, by1, bx2, by2; - double i2c[6]; + gdouble bx1, by1, bx2, by2; + gdouble i2c[6]; ArtPoint p1, p2, p3, p4; ArtPoint q1, q2, q3, q4; - double min_x1, min_y1, min_x2, min_y2; - double max_x1, max_y1, max_x2, max_y2; - int x1, y1, x2, y2; - int scroll_x, scroll_y; + gdouble min_x1, min_y1, min_x2, min_y2; + gdouble max_x1, max_y1, max_x2, max_y2; + gint x1, y1, x2, y2; + gint scroll_x, scroll_y; /* Get the bounding box in item-relative coordinates */ @@ -392,7 +392,7 @@ get_item_extents (GnomeCanvasItem *item, /* Convert the bounding box to canvas pixel coordinates and find its minimum * surrounding rectangle. */ - + p1.x = p2.x = bx1; p1.y = p4.y = by1; p3.x = p4.x = bx2; @@ -489,9 +489,9 @@ is_item_in_window (GnomeCanvasItem *item, window = gtk_widget_get_window (widget); if (window) { - int window_width, window_height; - - gdk_window_get_geometry (window, NULL, NULL, + gint window_width, window_height; + + gdk_window_get_geometry (window, NULL, NULL, &window_width, &window_height, NULL); /* * Check whether rectangles intersect diff --git a/libgnomecanvas/gailcanvasitemfactory.c b/libgnomecanvas/gailcanvasitemfactory.c index 5f59ef2823..376e9178df 100644 --- a/libgnomecanvas/gailcanvasitemfactory.c +++ b/libgnomecanvas/gailcanvasitemfactory.c @@ -35,7 +35,7 @@ gail_canvas_item_factory_init (GailCanvasItemFactory *foo) ; } -static void +static void gail_canvas_item_factory_class_init (GailCanvasItemFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -44,7 +44,7 @@ gail_canvas_item_factory_class_init (GailCanvasItemFactoryClass *klass) class->get_accessible_type = gail_canvas_item_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_item_factory_create_accessible (GObject *obj) { return gail_canvas_item_new (obj); diff --git a/libgnomecanvas/gailcanvasitemfactory.h b/libgnomecanvas/gailcanvasitemfactory.h index dd55815cbe..b5bea16d5a 100644 --- a/libgnomecanvas/gailcanvasitemfactory.h +++ b/libgnomecanvas/gailcanvasitemfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_ITEM_FACTORY)) #define GAIL_CANVAS_ITEM_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_ITEM_FACTORY, GailCanvasItemFactoryClass)) - typedef struct _GailCanvasItemFactory GailCanvasItemFactory; typedef struct _GailCanvasItemFactoryClass GailCanvasItemFactoryClass; diff --git a/libgnomecanvas/gailcanvastext.c b/libgnomecanvas/gailcanvastext.c index 542683c6c3..98ace2d938 100644 --- a/libgnomecanvas/gailcanvastext.c +++ b/libgnomecanvas/gailcanvastext.c @@ -30,27 +30,27 @@ struct _GailCanvasText }; static void gail_canvas_text_text_interface_init (AtkTextIface *iface); -static gchar* gail_canvas_text_get_text (AtkText *text, +static gchar * gail_canvas_text_get_text (AtkText *text, gint start_offset, gint end_offset); -static gchar* gail_canvas_text_get_text_after_offset +static gchar * gail_canvas_text_get_text_after_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); -static gchar* gail_canvas_text_get_text_at_offset (AtkText *text, +static gchar * gail_canvas_text_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); -static gchar* gail_canvas_text_get_text_before_offset +static gchar * gail_canvas_text_get_text_before_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); -static gunichar gail_canvas_text_get_character_at_offset +static gunichar gail_canvas_text_get_character_at_offset (AtkText *text, gint offset); static gint gail_canvas_text_get_character_count (AtkText *text); @@ -60,7 +60,7 @@ static gboolean gail_canvas_text_set_caret_offset (AtkText static gint gail_canvas_text_get_offset_at_point (AtkText *text, gint x, gint y, - AtkCoordType coords); + AtkCoordType coords); static void gail_canvas_text_get_character_extents (AtkText *text, gint offset, gint *x, @@ -68,15 +68,15 @@ static void gail_canvas_text_get_character_extents (AtkText gint *width, gint *height, AtkCoordType coords); -static AtkAttributeSet* +static AtkAttributeSet* gail_canvas_text_get_run_attributes (AtkText *text, gint offset, gint *start_offset, gint *end_offset); -static AtkAttributeSet* +static AtkAttributeSet* gail_canvas_text_get_default_attributes (AtkText *text); static gint gail_canvas_text_get_n_selections (AtkText *text); -static gchar* gail_canvas_text_get_selection (AtkText *text, +static gchar * gail_canvas_text_get_selection (AtkText *text, gint selection_num, gint *start_pos, gint *end_pos); @@ -89,16 +89,16 @@ static gboolean gail_canvas_text_set_selection (AtkText gint selection_num, gint start_pos, gint end_pos); -static gchar* get_text_near_offset (AtkText *text, +static gchar * get_text_near_offset (AtkText *text, GailOffsetType function, AtkTextBoundary boundary_type, gint offset, gint *start_offset, gint *end_offset); -G_DEFINE_TYPE_WITH_CODE(GailCanvasText, - gail_canvas_text, - GAIL_TYPE_CANVAS_ITEM, +G_DEFINE_TYPE_WITH_CODE(GailCanvasText, + gail_canvas_text, + GAIL_TYPE_CANVAS_ITEM, G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, gail_canvas_text_text_interface_init);) @@ -167,7 +167,7 @@ gail_canvas_text_text_interface_init (AtkTextIface *iface) iface->get_default_attributes = gail_canvas_text_get_default_attributes; } -static gchar* +static gchar * gail_canvas_text_get_text (AtkText *text, gint start_offset, gint end_offset) @@ -187,7 +187,7 @@ gail_canvas_text_get_text (AtkText *text, return gtk_text_buffer_get_text (buffer, &start, &end, FALSE); } -static gchar* +static gchar * gail_canvas_text_get_text_after_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, @@ -195,11 +195,11 @@ gail_canvas_text_get_text_after_offset (AtkText *text, gint *end_offset) { return get_text_near_offset (text, GAIL_AFTER_OFFSET, - boundary_type, offset, + boundary_type, offset, start_offset, end_offset); } -static gchar* +static gchar * gail_canvas_text_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, @@ -207,11 +207,11 @@ gail_canvas_text_get_text_at_offset (AtkText *text, gint *end_offset) { return get_text_near_offset (text, GAIL_AT_OFFSET, - boundary_type, offset, + boundary_type, offset, start_offset, end_offset); } -static gchar* +static gchar * gail_canvas_text_get_text_before_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, @@ -219,7 +219,7 @@ gail_canvas_text_get_text_before_offset (AtkText *text, gint *end_offset) { return get_text_near_offset (text, GAIL_BEFORE_OFFSET, - boundary_type, offset, + boundary_type, offset, start_offset, end_offset); } @@ -352,7 +352,7 @@ gail_canvas_text_get_n_selections (AtkText *text) gail_text = GAIL_CANVAS_TEXT (text); g_return_val_if_fail (gail_text->textutil, -1); buffer = gail_text->textutil->buffer; - + gtk_text_buffer_get_selection_bounds (buffer, &start, &end); select_start = gtk_text_iter_get_offset (&start); select_end = gtk_text_iter_get_offset (&end); @@ -363,7 +363,7 @@ gail_canvas_text_get_n_selections (AtkText *text) return 0; } -static gchar* +static gchar * gail_canvas_text_get_selection (AtkText *text, gint selection_num, gint *start_pos, @@ -467,8 +467,6 @@ gail_canvas_text_remove_selection (AtkText *text, return FALSE; } - - static gboolean gail_canvas_text_set_selection (AtkText *text, gint selection_num, @@ -508,7 +506,7 @@ gail_canvas_text_set_selection (AtkText *text, return FALSE; } -static gchar* +static gchar * get_text_near_offset (AtkText *text, GailOffsetType function, AtkTextBoundary boundary_type, @@ -517,6 +515,6 @@ get_text_near_offset (AtkText *text, gint *end_offset) { return gail_text_util_get_text (GAIL_CANVAS_TEXT (text)->textutil, NULL, - function, boundary_type, offset, + function, boundary_type, offset, start_offset, end_offset); } diff --git a/libgnomecanvas/gailcanvastextfactory.c b/libgnomecanvas/gailcanvastextfactory.c index 987e385530..2cbb97c7bc 100644 --- a/libgnomecanvas/gailcanvastextfactory.c +++ b/libgnomecanvas/gailcanvastextfactory.c @@ -35,7 +35,7 @@ gail_canvas_text_factory_init (GailCanvasTextFactory *foo) ; } -static void +static void gail_canvas_text_factory_class_init (GailCanvasTextFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -44,7 +44,7 @@ gail_canvas_text_factory_class_init (GailCanvasTextFactoryClass *klass) class->get_accessible_type = gail_canvas_text_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_text_factory_create_accessible (GObject *obj) { return gail_canvas_text_new (obj); diff --git a/libgnomecanvas/gailcanvastextfactory.h b/libgnomecanvas/gailcanvastextfactory.h index 3d99f778e5..b568151476 100644 --- a/libgnomecanvas/gailcanvastextfactory.h +++ b/libgnomecanvas/gailcanvastextfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_TEXT_FACTORY)) #define GAIL_CANVAS_TEXT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_TEXT_FACTORY, GailCanvasTextFactoryClass)) - typedef struct _GailCanvasTextFactory GailCanvasTextFactory; typedef struct _GailCanvasTextFactoryClass GailCanvasTextFactoryClass; diff --git a/libgnomecanvas/gailcanvaswidget.c b/libgnomecanvas/gailcanvaswidget.c index c3d38f0699..7b49563322 100644 --- a/libgnomecanvas/gailcanvaswidget.c +++ b/libgnomecanvas/gailcanvaswidget.c @@ -59,7 +59,7 @@ gail_canvas_widget_class_init (GailCanvasWidgetClass *klass) class->ref_child = gail_canvas_widget_ref_child; } -static gint +static gint gail_canvas_widget_get_n_children (AtkObject *obj) { AtkGObjectAccessible *atk_gobj; diff --git a/libgnomecanvas/gailcanvaswidgetfactory.c b/libgnomecanvas/gailcanvaswidgetfactory.c index 5923c165d2..fa799c3642 100644 --- a/libgnomecanvas/gailcanvaswidgetfactory.c +++ b/libgnomecanvas/gailcanvaswidgetfactory.c @@ -34,7 +34,7 @@ gail_canvas_widget_factory_init (GailCanvasWidgetFactory *foo) ; } -static void +static void gail_canvas_widget_factory_class_init (GailCanvasWidgetFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -43,7 +43,7 @@ gail_canvas_widget_factory_class_init (GailCanvasWidgetFactoryClass *klass) class->get_accessible_type = gail_canvas_widget_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_widget_factory_create_accessible (GObject *obj) { return gail_canvas_widget_new (obj); diff --git a/libgnomecanvas/gailcanvaswidgetfactory.h b/libgnomecanvas/gailcanvaswidgetfactory.h index caca8131a2..6edf8cc888 100644 --- a/libgnomecanvas/gailcanvaswidgetfactory.h +++ b/libgnomecanvas/gailcanvaswidgetfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_WIDGET_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_WIDGET_FACTORY)) #define GAIL_CANVAS_WIDGET_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_WIDGET_FACTORY, GailCanvasWidgetFactoryClass)) - typedef struct _GailCanvasWidgetFactory GailCanvasWidgetFactory; typedef struct _GailCanvasWidgetFactoryClass GailCanvasWidgetFactoryClass; diff --git a/libgnomecanvas/gnome-canvas-bpath.c b/libgnomecanvas/gnome-canvas-bpath.c index f7f564a94d..a63500304b 100644 --- a/libgnomecanvas/gnome-canvas-bpath.c +++ b/libgnomecanvas/gnome-canvas-bpath.c @@ -45,8 +45,7 @@ static void gnome_canvas_bpath_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); - +static void gnome_canvas_bpath_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static GnomeCanvasShapeClass *parent_class; @@ -145,7 +144,6 @@ gnome_canvas_bpath_set_property (GObject *object, } } - static void gnome_canvas_bpath_get_property (GObject *object, guint param_id, @@ -167,9 +165,9 @@ gnome_canvas_bpath_get_property (GObject *object, } static void -gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_bpath_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { - if(GNOME_CANVAS_ITEM_CLASS(parent_class)->update) { + if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) { (* GNOME_CANVAS_ITEM_CLASS(parent_class)->update)(item, affine, clip_path, flags); } } diff --git a/libgnomecanvas/gnome-canvas-bpath.h b/libgnomecanvas/gnome-canvas-bpath.h index 42a06a8d19..b6488ffe1f 100644 --- a/libgnomecanvas/gnome-canvas-bpath.h +++ b/libgnomecanvas/gnome-canvas-bpath.h @@ -20,7 +20,6 @@ G_BEGIN_DECLS - /* Bpath item for the canvas. * * The following object arguments are available: @@ -38,21 +37,19 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_BPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_BPATH)) #define GNOME_IS_CANVAS_BPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_BPATH)) - typedef struct _GnomeCanvasBpath GnomeCanvasBpath; typedef struct _GnomeCanvasBpathPriv GnomeCanvasBpathPriv; typedef struct _GnomeCanvasBpathClass GnomeCanvasBpathClass; struct _GnomeCanvasBpath { GnomeCanvasShape item; - + }; struct _GnomeCanvasBpathClass { GnomeCanvasShapeClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_bpath_get_type (void) G_GNUC_CONST; diff --git a/libgnomecanvas/gnome-canvas-clipgroup.c b/libgnomecanvas/gnome-canvas-clipgroup.c index adfc749e47..6019d1cdf6 100644 --- a/libgnomecanvas/gnome-canvas-clipgroup.c +++ b/libgnomecanvas/gnome-canvas-clipgroup.c @@ -54,9 +54,9 @@ static void gnome_canvas_clipgroup_get_property (GObject *o GValue *value, GParamSpec *pspec); static void gnome_canvas_clipgroup_update (GnomeCanvasItem *item, - double *affine, + gdouble *affine, ArtSVP *clip_path, - int flags); + gint flags); /* * Generic clipping stuff @@ -166,7 +166,7 @@ gnome_canvas_clipgroup_destroy (GtkObject *object) gnome_canvas_path_def_unref (clipgroup->path); clipgroup->path = NULL; } - + if (clipgroup->svp) { art_svp_free (clipgroup->svp); clipgroup->svp = NULL; @@ -176,7 +176,6 @@ gnome_canvas_clipgroup_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } - static void gnome_canvas_clipgroup_set_property (GObject *object, guint param_id, @@ -235,13 +234,13 @@ gnome_canvas_clipgroup_get_property (GObject *object, break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } } static void -gnome_canvas_clipgroup_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_clipgroup_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasClipgroup *clipgroup; ArtSvpWriter *swr; @@ -266,13 +265,13 @@ gnome_canvas_clipgroup_update (GnomeCanvasItem *item, double *affine, ArtSVP *cl svp1 = art_svp_from_vpath (vpath); art_free (vpath); - + swr = art_svp_writer_rewind_new (clipgroup->wind); art_svp_intersector (svp1, swr); svp2 = art_svp_writer_rewind_reap (swr); art_svp_free (svp1); - + if (clip_path != NULL) { svp = art_svp_intersect (svp2, clip_path); art_svp_free (svp2); diff --git a/libgnomecanvas/gnome-canvas-clipgroup.h b/libgnomecanvas/gnome-canvas-clipgroup.h index e424497daa..292812d6b9 100644 --- a/libgnomecanvas/gnome-canvas-clipgroup.h +++ b/libgnomecanvas/gnome-canvas-clipgroup.h @@ -24,14 +24,12 @@ G_BEGIN_DECLS - #define GNOME_TYPE_CANVAS_CLIPGROUP (gnome_canvas_clipgroup_get_type ()) #define GNOME_CANVAS_CLIPGROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_CLIPGROUP, GnomeCanvasClipgroup)) #define GNOME_CANVAS_CLIPGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_CLIPGROUP, GnomeCanvasClipgroupClass)) #define GNOME_IS_CANVAS_CLIPGROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_CLIPGROUP)) #define GNOME_IS_CANVAS_CLIPGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_CLIPGROUP)) - typedef struct _GnomeCanvasClipgroup GnomeCanvasClipgroup; typedef struct _GnomeCanvasClipgroupClass GnomeCanvasClipgroupClass; @@ -48,11 +46,9 @@ struct _GnomeCanvasClipgroupClass { GnomeCanvasGroupClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_clipgroup_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-i18n.h b/libgnomecanvas/gnome-canvas-i18n.h index a768438c5f..b324c05c8f 100644 --- a/libgnomecanvas/gnome-canvas-i18n.h +++ b/libgnomecanvas/gnome-canvas-i18n.h @@ -42,7 +42,7 @@ G_BEGIN_DECLS # ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN # undef _ # define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String) -# else +# else # define _(String) gettext (String) # endif # ifdef gettext_noop diff --git a/libgnomecanvas/gnome-canvas-line.c b/libgnomecanvas/gnome-canvas-line.c index fa7c74ccc1..563758b277 100644 --- a/libgnomecanvas/gnome-canvas-line.c +++ b/libgnomecanvas/gnome-canvas-line.c @@ -47,7 +47,6 @@ #define NUM_ARROW_POINTS 6 /* number of points in an arrowhead */ #define NUM_STATIC_POINTS 256 /* number of static points to use to avoid allocating arrays */ - #define GROW_BOUNDS(bx1, by1, bx2, by2, x, y) { \ if (x < bx1) \ bx1 = x; \ @@ -62,7 +61,6 @@ by2 = y; \ } - enum { PROP_0, PROP_POINTS, @@ -84,7 +82,6 @@ enum { PROP_ARROW_SHAPE_C }; - static void gnome_canvas_line_class_init (GnomeCanvasLineClass *class); static void gnome_canvas_line_init (GnomeCanvasLine *line); static void gnome_canvas_line_destroy (GtkObject *object); @@ -97,20 +94,18 @@ static void gnome_canvas_line_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_line_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_line_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static void gnome_canvas_line_realize (GnomeCanvasItem *item); static void gnome_canvas_line_unrealize (GnomeCanvasItem *item); static void gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_line_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_line_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); + gint x, gint y, gint width, gint height); +static gdouble gnome_canvas_line_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); +static void gnome_canvas_line_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static void gnome_canvas_line_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); - static GnomeCanvasItemClass *parent_class; - GType gnome_canvas_line_get_type (void) { @@ -332,18 +327,18 @@ gnome_canvas_line_destroy (GtkObject *object) * points in the line is not zero. */ static void -get_bounds (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double *by2) +get_bounds (GnomeCanvasLine *line, gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2) { - double *coords; - double x1, y1, x2, y2; - double width; - int i; + gdouble *coords; + gdouble x1, y1, x2, y2; + gdouble width; + gint i; if (!line->coords) { *bx1 = *by1 = *bx2 = *by2 = 0.0; return; } - + /* Find bounding box of line's points */ x1 = x2 = line->coords[0]; @@ -370,7 +365,7 @@ get_bounds (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double if (line->join == GDK_JOIN_MITER) for (i = line->num_points, coords = line->coords; i >= 3; i--, coords += 2) { - double mx1, my1, mx2, my2; + gdouble mx1, my1, mx2, my2; if (gnome_canvas_get_miter_points (coords[0], coords[1], coords[2], coords[3], @@ -404,7 +399,7 @@ get_bounds (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double * not zero. Affine is the i2c transformation. */ static void -get_bounds_canvas (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double *by2, double affine[6]) +get_bounds_canvas (GnomeCanvasLine *line, gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2, gdouble affine[6]) { /* It would be possible to tighten the bounds somewhat by transforming the individual points before aggregating them into the bbox. But it hardly seems worth it. */ @@ -425,15 +420,15 @@ get_bounds_canvas (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, static void reconfigure_arrows (GnomeCanvasLine *line) { - double *poly, *coords; - double dx, dy, length; - double sin_theta, cos_theta, tmp; - double frac_height; /* Line width as fraction of arrowhead width */ - double backup; /* Distance to backup end points so the line ends in the middle of the arrowhead */ - double vx, vy; /* Position of arrowhead vertex */ - double shape_a, shape_b, shape_c; - double width; - int i; + gdouble *poly, *coords; + gdouble dx, dy, length; + gdouble sin_theta, cos_theta, tmp; + gdouble frac_height; /* Line width as fraction of arrowhead width */ + gdouble backup; /* Distance to backup end points so the line ends in the middle of the arrowhead */ + gdouble vx, vy; /* Position of arrowhead vertex */ + gdouble shape_a, shape_b, shape_c; + gdouble width; + gint i; if (line->num_points == 0) return; @@ -600,15 +595,15 @@ set_line_gc_foreground (GnomeCanvasLine *line) static void set_line_gc_width (GnomeCanvasLine *line) { - int width; + gint width; if (!line->gc) return; if (line->width_pixels) - width = (int) line->width; + width = (gint) line->width; else - width = (int) (line->width * line->item.canvas->pixels_per_unit + 0.5); + width = (gint) (line->width * line->item.canvas->pixels_per_unit + 0.5); gdk_gc_set_line_attributes (line->gc, width, @@ -619,7 +614,7 @@ set_line_gc_width (GnomeCanvasLine *line) /* Sets the stipple pattern for the line */ static void -set_stipple (GnomeCanvasLine *line, GdkBitmap *stipple, int reconfigure) +set_stipple (GnomeCanvasLine *line, GdkBitmap *stipple, gint reconfigure) { if (line->stipple && !reconfigure) g_object_unref (line->stipple); @@ -649,7 +644,7 @@ gnome_canvas_line_set_property (GObject *object, GdkColor color = { 0, 0, 0, 0, }; GdkColor *pcolor; gboolean color_changed; - int have_pixel; + gint have_pixel; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_LINE (object)); @@ -674,7 +669,7 @@ gnome_canvas_line_set_property (GObject *object, else { line->num_points = points->num_points; line->coords = g_new (double, 2 * line->num_points); - memcpy (line->coords, points->coords, 2 * line->num_points * sizeof (double)); + memcpy (line->coords, points->coords, 2 * line->num_points * sizeof (gdouble)); } /* Drop the arrowhead polygons if they exist -- they will be regenerated */ @@ -814,10 +809,10 @@ gnome_canvas_line_set_property (GObject *object, gnome_canvas_item_request_redraw_svp (item, line->fill_svp); - if (line->first_svp) + if (line->first_svp) gnome_canvas_item_request_redraw_svp (item, line->first_svp); - if (line->last_svp) + if (line->last_svp) gnome_canvas_item_request_redraw_svp (item, line->last_svp); } @@ -830,7 +825,7 @@ static GnomeCanvasPoints * get_points (GnomeCanvasLine *line) { GnomeCanvasPoints *points; - int start_ofs, end_ofs; + gint start_ofs, end_ofs; if (line->num_points == 0) return NULL; @@ -859,7 +854,7 @@ get_points (GnomeCanvasLine *line) memcpy (points->coords + 2 * start_ofs, line->coords + 2 * start_ofs, - 2 * (line->num_points - (start_ofs + end_ofs)) * sizeof (double)); + 2 * (line->num_points - (start_ofs + end_ofs)) * sizeof (gdouble)); return points; } @@ -912,11 +907,11 @@ gnome_canvas_line_get_property (GObject *object, case PROP_WIDTH_PIXELS: g_value_set_uint (value, line->width); break; - + case PROP_WIDTH_UNITS: g_value_set_double (value, line->width); break; - + case PROP_CAP_STYLE: g_value_set_enum (value, line->cap); break; @@ -981,14 +976,13 @@ gnome_canvas_line_render (GnomeCanvasItem *item, gnome_canvas_render_svp (buf, line->last_svp, line->fill_rgba); } - static ArtSVP * -svp_from_points (const double *item_coords, int num_points, const double affine[6]) +svp_from_points (const gdouble *item_coords, gint num_points, const gdouble affine[6]) { ArtVpath *vpath; ArtSVP *svp; - double x, y; - int i; + gdouble x, y; + gint i; vpath = art_new (ArtVpath, num_points + 2); @@ -1017,15 +1011,15 @@ svp_from_points (const double *item_coords, int num_points, const double affine[ } static void -gnome_canvas_line_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_line_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasLine *line; - int i; + gint i; ArtVpath *vpath; ArtPoint pi, pc; - double width; + gdouble width; ArtSVP *svp; - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; line = GNOME_CANVAS_LINE (item); @@ -1071,18 +1065,16 @@ gnome_canvas_line_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_pa if (line->first_arrow && line->first_coords) { svp = svp_from_points (line->first_coords, NUM_ARROW_POINTS, affine); - gnome_canvas_item_update_svp_clip (item, + gnome_canvas_item_update_svp_clip (item, &line->first_svp, svp, clip_path); } - if (line->last_arrow && line->last_coords) { svp = svp_from_points (line->last_coords, NUM_ARROW_POINTS, affine); - gnome_canvas_item_update_svp_clip (item, + gnome_canvas_item_update_svp_clip (item, &line->last_svp, svp, clip_path); } - } else { set_line_gc_foreground (line); set_line_gc_width (line); @@ -1129,17 +1121,17 @@ gnome_canvas_line_unrealize (GnomeCanvasItem *item) } static void -item_to_canvas (GnomeCanvas *canvas, double *item_coords, GdkPoint *canvas_coords, int num_points, - int *num_drawn_points, double i2c[6], int x, int y) +item_to_canvas (GnomeCanvas *canvas, gdouble *item_coords, GdkPoint *canvas_coords, gint num_points, + gint *num_drawn_points, gdouble i2c[6], gint x, gint y) { - int i; - int old_cx, old_cy; - int cx, cy; + gint i; + gint old_cx, old_cy; + gint cx, cy; ArtPoint pi, pc; #ifdef VERBOSE { - char str[128]; + gchar str[128]; art_affine_to_string (str, i2c); g_print ("line item_to_canvas %s\n", str); } @@ -1178,13 +1170,13 @@ item_to_canvas (GnomeCanvas *canvas, double *item_coords, GdkPoint *canvas_coord static void gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasLine *line; GdkPoint static_points[NUM_STATIC_POINTS]; GdkPoint *points; - int actual_num_points_drawn; - double i2c[6]; + gint actual_num_points_drawn; + gdouble i2c[6]; line = GNOME_CANVAS_LINE (item); @@ -1198,7 +1190,6 @@ gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, else points = g_new (GdkPoint, line->num_points); - gnome_canvas_item_i2c_affine (item, i2c); item_to_canvas (item->canvas, line->coords, points, line->num_points, @@ -1230,18 +1221,18 @@ gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, } static double -gnome_canvas_line_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_line_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasLine *line; - double *line_points = NULL, *coords; - double static_points[2 * NUM_STATIC_POINTS]; - double poly[10]; - double best, dist; - double dx, dy; - double width; - int num_points = 0, i; - int changed_miter_to_bevel; + gdouble *line_points = NULL, *coords; + gdouble static_points[2 * NUM_STATIC_POINTS]; + gdouble poly[10]; + gdouble best, dist; + gdouble dx, dy; + gdouble width; + gint num_points = 0, i; + gint changed_miter_to_bevel; #ifdef VERBOSE g_print ("gnome_canvas_line_point x, y = (%g, %g); cx, cy = (%d, %d)\n", x, y, cx, cy); @@ -1412,7 +1403,7 @@ done: } static void -gnome_canvas_line_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_line_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) { GnomeCanvasLine *line; diff --git a/libgnomecanvas/gnome-canvas-line.h b/libgnomecanvas/gnome-canvas-line.h index 4ab6cfa62d..f2a53c487c 100644 --- a/libgnomecanvas/gnome-canvas-line.h +++ b/libgnomecanvas/gnome-canvas-line.h @@ -35,13 +35,10 @@ #ifndef GNOME_CANVAS_LINE_H #define GNOME_CANVAS_LINE_H - #include <libgnomecanvas/gnome-canvas.h> - G_BEGIN_DECLS - /* Line item for the canvas. This is a polyline with configurable width, cap/join styles, and arrowheads. * If arrowheads are enabled, then three values are used to specify their shape: * @@ -64,7 +61,7 @@ G_BEGIN_DECLS * fill_stipple GdkBitmap* RW Stipple pattern for the line * width_pixels uint R Width of the line in pixels. The line width * will not be scaled when the canvas zoom factor changes. - * width_units double R Width of the line in canvas units. The line width + * width_units gdouble R Width of the line in canvas units. The line width * will be scaled when the canvas zoom factor changes. * cap_style GdkCapStyle RW Cap ("endpoint") style for the line. * join_style GdkJoinStyle RW Join ("vertex") style for the line. @@ -76,12 +73,11 @@ G_BEGIN_DECLS * smooth boolean RW Specifies whether to smooth the line using * parabolic splines. * spline_steps uint RW Specifies the number of steps to use when rendering curves. - * arrow_shape_a double RW First arrow shape specifier. - * arrow_shape_b double RW Second arrow shape specifier. - * arrow_shape_c double RW Third arrow shape specifier. + * arrow_shape_a gdouble RW First arrow shape specifier. + * arrow_shape_b gdouble RW Second arrow shape specifier. + * arrow_shape_c gdouble RW Third arrow shape specifier. */ - #define GNOME_TYPE_CANVAS_LINE (gnome_canvas_line_get_type ()) #define GNOME_CANVAS_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLine)) #define GNOME_CANVAS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLineClass)) @@ -89,14 +85,13 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_LINE)) #define GNOME_CANVAS_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLineClass)) - typedef struct _GnomeCanvasLine GnomeCanvasLine; typedef struct _GnomeCanvasLineClass GnomeCanvasLineClass; struct _GnomeCanvasLine { GnomeCanvasItem item; - double *coords; /* Array of coordinates for the line's points. X coords are in the + gdouble *coords; /* Array of coordinates for the line's points. X coords are in the * even indices, Y coords are in the odd indices. If the line has * arrowheads then the first and last points have been adjusted to * refer to the necks of the arrowheads rather than their tips. The @@ -104,8 +99,8 @@ struct _GnomeCanvasLine { * arrays, if they exist. */ - double *first_coords; /* Array of points describing polygon for the first arrowhead */ - double *last_coords; /* Array of points describing polygon for the last arrowhead */ + gdouble *first_coords; /* Array of points describing polygon for the first arrowhead */ + gdouble *last_coords; /* Array of points describing polygon for the last arrowhead */ GdkGC *gc; /* GC for drawing line */ @@ -115,11 +110,11 @@ struct _GnomeCanvasLine { ArtSVP *first_svp; /* The SVP for the first arrow */ /*AA*/ ArtSVP *last_svp; /* The SVP for the last arrow */ /*AA*/ - double width; /* Width of the line */ + gdouble width; /* Width of the line */ - double shape_a; /* Distance from tip of arrowhead to center */ - double shape_b; /* Distance from tip of arrowhead to trailing point, measured along shaft */ - double shape_c; /* Distance of trailing points from outside edge of shaft */ + gdouble shape_a; /* Distance from tip of arrowhead to center */ + gdouble shape_b; /* Distance from tip of arrowhead to trailing point, measured along shaft */ + gdouble shape_c; /* Distance of trailing points from outside edge of shaft */ GdkCapStyle cap; /* Cap style for line */ GdkJoinStyle join; /* Join style for line */ @@ -129,10 +124,10 @@ struct _GnomeCanvasLine { guint32 fill_rgba; /* RGBA color for outline */ /*AA*/ - int num_points; /* Number of points in the line */ + gint num_points; /* Number of points in the line */ guint fill_color; /* Fill color, RGBA */ - int spline_steps; /* Number of steps in each spline segment */ + gint spline_steps; /* Number of steps in each spline segment */ guint width_pixels : 1; /* Is the width specified in pixels or units? */ guint first_arrow : 1; /* Draw first arrowhead? */ @@ -144,11 +139,9 @@ struct _GnomeCanvasLineClass { GnomeCanvasItemClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_line_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-path-def.c b/libgnomecanvas/gnome-canvas-path-def.c index 11b0924689..02ff22b957 100644 --- a/libgnomecanvas/gnome-canvas-path-def.c +++ b/libgnomecanvas/gnome-canvas-path-def.c @@ -66,10 +66,10 @@ gnome_canvas_path_def_get_type (void) /** * gnome_canvas_path_def_new: - * + * * This function creates a new empty #gnome_canvas_path_def. * - * Returns: the new canvas path definition. + * Returns: the new canvas path definition. */ GnomeCanvasPathDef * gnome_canvas_path_def_new (void) @@ -289,7 +289,7 @@ gnome_canvas_path_def_ensure_space (GnomeCanvasPathDef * path, gint space) * array is freed and @dest is marked as non-static (editable), * regardless of the status of @src. */ -void +void gnome_canvas_path_def_copy (GnomeCanvasPathDef * dst, const GnomeCanvasPathDef * src) { g_return_if_fail (dst != NULL); @@ -305,7 +305,6 @@ gnome_canvas_path_def_copy (GnomeCanvasPathDef * dst, const GnomeCanvasPathDef * dst->sbpath = FALSE; } - /** * gnome_canvas_path_def_duplicate: * @path: a GnomeCanvasPathDef to duplicate @@ -407,7 +406,9 @@ gnome_canvas_path_def_split (const GnomeCanvasPathDef * path) while (p < path->end) { i = 1; - while ((path->bpath[p + i].code == ART_LINETO) || (path->bpath[p + i].code == ART_CURVETO)) i++; + while ((path->bpath[p + i].code == ART_LINETO) || + (path->bpath[p + i].code == ART_CURVETO)) + i++; new = gnome_canvas_path_def_new_sized (i + 1); memcpy (new->bpath, path->bpath + p, i * sizeof (ArtBpath)); new->end = i; @@ -424,7 +425,7 @@ gnome_canvas_path_def_split (const GnomeCanvasPathDef * path) /** * gnome_canvas_path_def_open_parts: * @path: a GnomeCanvasPathDef - * + * * This function creates a new GnomeCanvasPathDef that contains all of * the open segments on the passed @path. * @@ -496,7 +497,7 @@ gnome_canvas_path_def_open_parts (const GnomeCanvasPathDef * path) /** * gnome_canvas_path_def_closed_parts: * @path: a GnomeCanvasPathDef - * + * * This function returns a new GnomeCanvasPathDef that contains the * all of close parts of passed @path. * @@ -668,7 +669,6 @@ gnome_canvas_path_def_unref (GnomeCanvasPathDef * path) } } - /* Methods */ /** * gnome_canvas_path_def_reset: @@ -781,7 +781,6 @@ gnome_canvas_path_def_lineto (GnomeCanvasPathDef * path, gdouble x, gdouble y) path->end++; } - /** * gnome_canvas_path_def_lineto_moving: * @path: a GnomeCanvasPathDef @@ -793,7 +792,7 @@ gnome_canvas_path_def_lineto (GnomeCanvasPathDef * path, gdouble x, gdouble y) * can change the coordinates of loose endpoint as many times as you want, * the last ones set will be fixed, if you continue line. This is useful * for handling drawing with mouse. - */ + */ void gnome_canvas_path_def_lineto_moving (GnomeCanvasPathDef * path, gdouble x, gdouble y) { @@ -860,9 +859,15 @@ gnome_canvas_path_def_lineto_moving (GnomeCanvasPathDef * path, gdouble x, gdoub * * This function adds a bezier curve segment to the path definition. */ - + void -gnome_canvas_path_def_curveto (GnomeCanvasPathDef * path, gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2) +gnome_canvas_path_def_curveto (GnomeCanvasPathDef * path, + gdouble x0, + gdouble y0, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) { ArtBpath * bp; @@ -1073,7 +1078,7 @@ gnome_canvas_path_def_currentpoint (const GnomeCanvasPathDef * path, ArtPoint * } else { p->x = (path->bpath + path->end - 1)->x3; p->y = (path->bpath + path->end - 1)->y3; - } + } } /** @@ -1223,7 +1228,9 @@ sp_bpath_check_subpath (ArtBpath * bpath) len = 0; - for (i = 1; (bpath[i].code != ART_END) && (bpath[i].code != ART_MOVETO) && (bpath[i].code != ART_MOVETO_OPEN); i++) { + for (i = 1; (bpath[i].code != ART_END) && + (bpath[i].code != ART_MOVETO) && + (bpath[i].code != ART_MOVETO_OPEN); i++) { switch (bpath[i].code) { case ART_LINETO: case ART_CURVETO: @@ -1251,7 +1258,7 @@ sp_bpath_length (const ArtBpath * bpath) g_return_val_if_fail (bpath != NULL, FALSE); - for (l = 0; bpath[l].code != ART_END; l++) ; + for (l = 0; bpath[l].code != ART_END; l++); l++; @@ -1284,4 +1291,3 @@ sp_bpath_all_open (const ArtBpath * bpath) return TRUE; } - diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c index 9619e86df8..6a3d433c07 100644 --- a/libgnomecanvas/gnome-canvas-pixbuf.c +++ b/libgnomecanvas/gnome-canvas-pixbuf.c @@ -35,16 +35,16 @@ typedef struct { GdkPixbuf *pixbuf; /* Width value */ - double width; + gdouble width; /* Height value */ - double height; + gdouble height; /* X translation */ - double x; + gdouble x; /* Y translation */ - double y; + gdouble y; /* Whether dimensions are set and whether they are in pixels or units */ guint width_set : 1; @@ -53,7 +53,7 @@ typedef struct { guint height_in_pixels : 1; guint x_in_pixels : 1; guint y_in_pixels : 1; - + /* Whether the pixbuf has changed */ guint need_pixbuf_update : 1; @@ -93,15 +93,19 @@ static void gnome_canvas_pixbuf_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_pixbuf_update (GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); static void gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static double gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, +static gdouble gnome_canvas_pixbuf_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, GnomeCanvasItem **actual_item); static void gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static GnomeCanvasItemClass *parent_class; @@ -276,7 +280,8 @@ gnome_canvas_pixbuf_destroy (GtkObject *object) /* remember, destroy can be run multiple times! */ if (priv) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); if (priv->pixbuf) g_object_unref (priv->pixbuf); @@ -302,7 +307,7 @@ gnome_canvas_pixbuf_set_property (GObject *object, GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; GdkPixbuf *pixbuf; - double val; + gdouble val; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_PIXBUF (object)); @@ -495,7 +500,7 @@ gnome_canvas_pixbuf_get_property (GObject *object, * scaled by an affine transformation. */ static void -compute_xform_scaling (double *affine, ArtPoint *i_c, ArtPoint *j_c) +compute_xform_scaling (gdouble *affine, ArtPoint *i_c, ArtPoint *j_c) { ArtPoint orig, orig_c; ArtPoint i, j; @@ -526,16 +531,18 @@ compute_xform_scaling (double *affine, ArtPoint *i_c, ArtPoint *j_c) * args */ static void -compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double *i2c) +compute_viewport_affine (GnomeCanvasPixbuf *gcp, + gdouble *viewport_affine, + gdouble *i2c) { PixbufPrivate *priv; ArtPoint i_c, j_c; - double i_len, j_len; - double si_len, sj_len; - double ti_len, tj_len; - double scale[6], translate[6]; - double w, h; - double x, y; + gdouble i_len, j_len; + gdouble si_len, sj_len; + gdouble ti_len, tj_len; + gdouble scale[6], translate[6]; + gdouble w, h; + gdouble x, y; priv = gcp->priv; @@ -628,7 +635,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double case GTK_ANCHOR_NE: tj_len *= y; break; - + case GTK_ANCHOR_W: case GTK_ANCHOR_CENTER: case GTK_ANCHOR_E: @@ -649,7 +656,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double art_affine_scale (scale, si_len, sj_len); art_affine_translate (translate, ti_len, tj_len); - art_affine_multiply (viewport_affine, scale, translate); + art_affine_multiply (viewport_affine, scale, translate); } /* Computes the affine transformation with which the pixbuf needs to be @@ -658,9 +665,9 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double * by some other amount. */ static void -compute_render_affine (GnomeCanvasPixbuf *gcp, double *ra, double *i2c) +compute_render_affine (GnomeCanvasPixbuf *gcp, gdouble *ra, gdouble *i2c) { - double va[6]; + gdouble va[6]; compute_viewport_affine (gcp, va, i2c); #ifdef GNOME_CANVAS_PIXBUF_VERBOSE @@ -681,7 +688,7 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp, gdouble *i2c) { GnomeCanvasItem *item; PixbufPrivate *priv; - double ra[6]; + gdouble ra[6]; ArtDRect rect; item = GNOME_CANVAS_ITEM (gcp); @@ -723,7 +730,10 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp, gdouble *i2c) /* Update handler for the pixbuf canvas item */ static void -gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_pixbuf_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; @@ -765,9 +775,11 @@ gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_ priv->need_xform_update = FALSE; } #else /* ordinary update logic */ - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); recompute_bounding_box (gcp, affine); - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); priv->need_pixbuf_update = FALSE; priv->need_xform_update = FALSE; #endif @@ -778,21 +790,31 @@ gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_ /* Rendering */ /* This is private to libart, but we need it. Sigh. */ -extern void art_rgb_affine_run (int *p_x0, int *p_x1, int y, int src_width, int src_height, - const double affine[6]); +extern void art_rgb_affine_run (gint *p_x0, + gint *p_x1, + gint y, + gint src_width, + gint src_height, + const gdouble affine[6]); /* Fills the specified buffer with the transformed version of a pixbuf */ static void -transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstride, - GdkPixbuf *pixbuf, double *affine) +transform_pixbuf (guchar *dest, + gint x, + gint y, + gint width, + gint height, + gint rowstride, + GdkPixbuf *pixbuf, + gdouble *affine) { - int xx, yy; - double inv[6]; + gint xx, yy; + gdouble inv[6]; guchar *src, *d; ArtPoint src_p, dest_p; - int run_x1, run_x2; - int src_x, src_y; - int i; + gint run_x1, run_x2; + gint src_x, src_y; + gint i; art_affine_invert (inv, affine); @@ -831,15 +853,15 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri /* Draw handler for the pixbuf canvas item */ static void gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], render_affine[6]; + gdouble i2c[6], render_affine[6]; guchar *buf; GdkPixbuf *pixbuf; ArtIRect p_rect, a_rect, d_rect; - int w, h; + gint w, h; gcp = GNOME_CANVAS_PIXBUF (item); priv = gcp->priv; @@ -901,7 +923,7 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], render_affine[6]; + gdouble i2c[6], render_affine[6]; gcp = GNOME_CANVAS_PIXBUF (item); priv = gcp->priv; @@ -913,14 +935,13 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) compute_render_affine (gcp, render_affine, i2c); gnome_canvas_buf_ensure_buf (buf); - if ((fabs (render_affine[1]) < GNOME_CANVAS_EPSILON) && (fabs (render_affine[2]) < GNOME_CANVAS_EPSILON) && render_affine[0] > 0.0 && render_affine[3] > 0.0) { GdkPixbuf *dest_pixbuf; - int x0, y0, x1, y1; + gint x0, y0, x1, y1; dest_pixbuf = gdk_pixbuf_new_from_data (buf->buf, GDK_COLORSPACE_RGB, @@ -931,7 +952,6 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) buf->buf_rowstride, NULL, NULL); - x0 = floor (render_affine[4] - buf->rect.x0 + 0.5); y0 = floor (render_affine[5] - buf->rect.y0 + 0.5); @@ -942,12 +962,12 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) x0 = MIN (x0, buf->rect.x1 - buf->rect.x0); y0 = MAX (y0, 0); y0 = MIN (y0, buf->rect.y1 - buf->rect.y0); - + x1 = MAX (x1, 0); x1 = MIN (x1, buf->rect.x1 - buf->rect.x0); y1 = MAX (y1, 0); y1 = MIN (y1, buf->rect.y1 - buf->rect.y0); - + gdk_pixbuf_composite (priv->pixbuf, dest_pixbuf, x0, y0, @@ -991,15 +1011,19 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) /* Point handler for the pixbuf canvas item */ static double -gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) +gnome_canvas_pixbuf_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, + GnomeCanvasItem **actual_item) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], render_affine[6], inv[6]; + gdouble i2c[6], render_affine[6], inv[6]; ArtPoint c, p; - int px, py; - double no_hit; + gint px, py; + gdouble no_hit; guchar *src; GdkPixbuf *pixbuf; @@ -1045,11 +1069,15 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in /* Bounds handler for the pixbuf canvas item */ static void -gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], viewport_affine[6]; + gdouble i2c[6], viewport_affine[6]; ArtDRect rect; gcp = GNOME_CANVAS_PIXBUF (item); diff --git a/libgnomecanvas/gnome-canvas-pixbuf.h b/libgnomecanvas/gnome-canvas-pixbuf.h index 0554ab8624..f8f4d72ad4 100644 --- a/libgnomecanvas/gnome-canvas-pixbuf.h +++ b/libgnomecanvas/gnome-canvas-pixbuf.h @@ -23,7 +23,6 @@ #ifndef GNOME_CANVAS_PIXBUF_H #define GNOME_CANVAS_PIXBUF_H - #include <libgnomecanvas/gnome-canvas.h> G_BEGIN_DECLS @@ -37,7 +36,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_PIXBUF)) #define GNOME_CANVAS_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbufClass)) - typedef struct _GnomeCanvasPixbuf GnomeCanvasPixbuf; typedef struct _GnomeCanvasPixbufClass GnomeCanvasPixbufClass; @@ -52,7 +50,6 @@ struct _GnomeCanvasPixbufClass { GnomeCanvasItemClass parent_class; }; - GType gnome_canvas_pixbuf_get_type (void) G_GNUC_CONST; diff --git a/libgnomecanvas/gnome-canvas-polygon.c b/libgnomecanvas/gnome-canvas-polygon.c index 53c7965a88..e805a652e4 100644 --- a/libgnomecanvas/gnome-canvas-polygon.c +++ b/libgnomecanvas/gnome-canvas-polygon.c @@ -61,7 +61,7 @@ static void gnome_canvas_polygon_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_polygon_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_polygon_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static GnomeCanvasItemClass *parent_class; @@ -137,12 +137,11 @@ gnome_canvas_polygon_destroy (GtkObject *object) /* remember, destroy can be run multiple times! */ - if(poly->path_def) + if (poly->path_def) gnome_canvas_path_def_unref(poly->path_def); poly->path_def = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -150,8 +149,7 @@ gnome_canvas_polygon_destroy (GtkObject *object) static void set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) { - int i; - + gint i; if (poly->path_def) gnome_canvas_path_def_unref(poly->path_def); @@ -162,7 +160,6 @@ set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) return; } - /* Optomize the path def to the number of points */ poly->path_def = gnome_canvas_path_def_new_sized(points->num_points+1); @@ -173,9 +170,8 @@ set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) || (points->coords[1] != points->coords[2 * points->num_points - 1])); #endif - gnome_canvas_path_def_moveto (poly->path_def, points->coords[0], points->coords[1]); - + for (i = 1; i < points->num_points; i++) { gnome_canvas_path_def_lineto(poly->path_def, points->coords[i * 2], points->coords[(i * 2) + 1]); } @@ -185,7 +181,6 @@ set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (poly), poly->path_def); } - static void gnome_canvas_polygon_set_property (GObject *object, guint param_id, @@ -210,13 +205,12 @@ gnome_canvas_polygon_set_property (GObject *object, gnome_canvas_item_request_update (item); break; - default: + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } } - static void gnome_canvas_polygon_get_property (GObject *object, guint param_id, @@ -235,9 +229,8 @@ gnome_canvas_polygon_get_property (GObject *object, } } - static void -gnome_canvas_polygon_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_polygon_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { /* Since the path has already been defined just pass the update up. */ diff --git a/libgnomecanvas/gnome-canvas-polygon.h b/libgnomecanvas/gnome-canvas-polygon.h index 738f0f453d..36233aedc9 100644 --- a/libgnomecanvas/gnome-canvas-polygon.h +++ b/libgnomecanvas/gnome-canvas-polygon.h @@ -35,14 +35,12 @@ #ifndef GNOME_CANVAS_POLYGON_H #define GNOME_CANVAS_POLYGON_H - #include <libgnomecanvas/gnome-canvas.h> #include <libgnomecanvas/gnome-canvas-shape.h> #include <libgnomecanvas/gnome-canvas-path-def.h> G_BEGIN_DECLS - /* Polygon item for the canvas. A polygon is a bit different from rectangles and ellipses in that * points inside it will always be considered "inside", even if the fill color is not set. If you * want to have a hollow polygon, use a line item instead. @@ -66,7 +64,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_POLYGON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_POLYGON)) #define GNOME_CANVAS_POLYGON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_POLYGON, GnomeCanvasPolygonClass)) - typedef struct _GnomeCanvasPolygon GnomeCanvasPolygon; typedef struct _GnomeCanvasPolygonClass GnomeCanvasPolygonClass; @@ -80,7 +77,6 @@ struct _GnomeCanvasPolygonClass { GnomeCanvasShapeClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_polygon_get_type (void) G_GNUC_CONST; diff --git a/libgnomecanvas/gnome-canvas-rect-ellipse.c b/libgnomecanvas/gnome-canvas-rect-ellipse.c index 10136866ef..bf318506ab 100644 --- a/libgnomecanvas/gnome-canvas-rect-ellipse.c +++ b/libgnomecanvas/gnome-canvas-rect-ellipse.c @@ -38,7 +38,6 @@ #include "gnome-canvas-util.h" #include "gnome-canvas-shape.h" - #include <libart_lgpl/art_vpath.h> #include <libart_lgpl/art_svp.h> #include <libart_lgpl/art_svp_vpath.h> @@ -56,7 +55,6 @@ enum { PROP_Y2 }; - static void gnome_canvas_re_class_init (GnomeCanvasREClass *class); static void gnome_canvas_re_init (GnomeCanvasRE *re); static void gnome_canvas_re_destroy (GtkObject *object); @@ -69,12 +67,11 @@ static void gnome_canvas_re_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_rect_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); -static void gnome_canvas_ellipse_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_rect_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); +static void gnome_canvas_ellipse_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static GnomeCanvasItemClass *re_parent_class; - GType gnome_canvas_re_get_type (void) { @@ -248,8 +245,6 @@ gnome_canvas_re_get_property (GObject *object, /* Rectangle item */ static void gnome_canvas_rect_class_init (GnomeCanvasRectClass *class); - - GType gnome_canvas_rect_get_type (void) { @@ -287,22 +282,22 @@ gnome_canvas_rect_class_init (GnomeCanvasRectClass *class) } static void -gnome_canvas_rect_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ GnomeCanvasRE *re; +gnome_canvas_rect_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gint flags) +{ GnomeCanvasRE *re; GnomeCanvasPathDef *path_def; re = GNOME_CANVAS_RE(item); - if (re->path_dirty) { + if (re->path_dirty) { path_def = gnome_canvas_path_def_new (); - + gnome_canvas_path_def_moveto(path_def, re->x1, re->y1); gnome_canvas_path_def_lineto(path_def, re->x2, re->y1); gnome_canvas_path_def_lineto(path_def, re->x2, re->y2); gnome_canvas_path_def_lineto(path_def, re->x1, re->y2); - gnome_canvas_path_def_lineto(path_def, re->x1, re->y1); - gnome_canvas_path_def_closepath_current(path_def); + gnome_canvas_path_def_lineto(path_def, re->x1, re->y1); + gnome_canvas_path_def_closepath_current(path_def); gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (item), path_def); gnome_canvas_path_def_unref(path_def); re->path_dirty = 0; @@ -314,10 +309,8 @@ gnome_canvas_rect_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_ /* Ellipse item */ - static void gnome_canvas_ellipse_class_init (GnomeCanvasEllipseClass *class); - GType gnome_canvas_ellipse_get_type (void) { @@ -357,7 +350,7 @@ gnome_canvas_ellipse_class_init (GnomeCanvasEllipseClass *class) #define N_PTS 90 static void -gnome_canvas_ellipse_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) { +gnome_canvas_ellipse_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gint flags) { GnomeCanvasPathDef *path_def; GnomeCanvasRE *re; @@ -401,7 +394,7 @@ gnome_canvas_ellipse_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl cx - mx - dx2, cy - my + dy2, cx - rx, cy - dy1, cx - rx, cy); - + gnome_canvas_path_def_curveto (path_def, cx - rx, cy + dy1, cx - mx - dx2, cy + my - dy2, @@ -418,9 +411,9 @@ gnome_canvas_ellipse_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl cx + mx + dx2, cy + my - dy2, cx + rx, cy + dy1, cx + rx, cy); - + gnome_canvas_path_def_closepath_current(path_def); - + gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (item), path_def); gnome_canvas_path_def_unref(path_def); re->path_dirty = 0; diff --git a/libgnomecanvas/gnome-canvas-rect-ellipse.h b/libgnomecanvas/gnome-canvas-rect-ellipse.h index 494e6cf485..27f14be4c7 100644 --- a/libgnomecanvas/gnome-canvas-rect-ellipse.h +++ b/libgnomecanvas/gnome-canvas-rect-ellipse.h @@ -34,7 +34,6 @@ #ifndef GNOME_CANVAS_RECT_ELLIPSE_H #define GNOME_CANVAS_RECT_ELLIPSE_H - #include <libgnomecanvas/gnome-canvas.h> #include <libgnomecanvas/gnome-canvas-shape.h> @@ -43,16 +42,15 @@ G_BEGIN_DECLS - /* Base class for rectangle and ellipse item types. These are defined by their top-left and * bottom-right corners. Rectangles and ellipses share the following arguments: * * name type read/write description * ------------------------------------------------------------------------------------------ - * x1 double RW Leftmost coordinate of rectangle or ellipse - * y1 double RW Topmost coordinate of rectangle or ellipse - * x2 double RW Rightmost coordinate of rectangle or ellipse - * y2 double RW Bottommost coordinate of rectangle or ellipse + * x1 gdouble RW Leftmost coordinate of rectangle or ellipse + * y1 gdouble RW Topmost coordinate of rectangle or ellipse + * x2 gdouble RW Rightmost coordinate of rectangle or ellipse + * y2 gdouble RW Bottommost coordinate of rectangle or ellipse * fill_color string W X color specification for fill color, * or NULL pointer for no color (transparent) * fill_color_gdk GdkColor* RW Allocated GdkColor for fill @@ -63,11 +61,10 @@ G_BEGIN_DECLS * outline_stipple GdkBitmap* RW Stipple pattern for outline * width_pixels uint RW Width of the outline in pixels. The outline will * not be scaled when the canvas zoom factor is changed. - * width_units double RW Width of the outline in canvas units. The outline + * width_units gdouble RW Width of the outline in canvas units. The outline * will be scaled when the canvas zoom factor is changed. */ - #define GNOME_TYPE_CANVAS_RE (gnome_canvas_re_get_type ()) #define GNOME_CANVAS_RE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_RE, GnomeCanvasRE)) #define GNOME_CANVAS_RE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_RE, GnomeCanvasREClass)) @@ -75,32 +72,28 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_RE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_RE)) #define GNOME_CANVAS_RE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_RE, GnomeCanvasREClass)) - typedef struct _GnomeCanvasRE GnomeCanvasRE; typedef struct _GnomeCanvasREClass GnomeCanvasREClass; struct _GnomeCanvasRE { GnomeCanvasShape item; - double x1, y1, x2, y2; /* Corners of item */ + gdouble x1, y1, x2, y2; /* Corners of item */ - unsigned int path_dirty : 1; + guint path_dirty : 1; }; struct _GnomeCanvasREClass { GnomeCanvasShapeClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_re_get_type (void) G_GNUC_CONST; - /* Rectangle item. No configurable or queryable arguments are available (use those in * GnomeCanvasRE). */ - #define GNOME_TYPE_CANVAS_RECT (gnome_canvas_rect_get_type ()) #define GNOME_CANVAS_RECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_RECT, GnomeCanvasRect)) #define GNOME_CANVAS_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_RECT, GnomeCanvasRectClass)) @@ -108,7 +101,6 @@ GType gnome_canvas_re_get_type (void) G_GNUC_CONST; #define GNOME_IS_CANVAS_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_RECT)) #define GNOME_CANVAS_RECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_RECT, GnomeCanvasRectClass)) - typedef struct _GnomeCanvasRect GnomeCanvasRect; typedef struct _GnomeCanvasRectClass GnomeCanvasRectClass; @@ -120,16 +112,13 @@ struct _GnomeCanvasRectClass { GnomeCanvasREClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_rect_get_type (void) G_GNUC_CONST; - /* Ellipse item. No configurable or queryable arguments are available (use those in * GnomeCanvasRE). */ - #define GNOME_TYPE_CANVAS_ELLIPSE (gnome_canvas_ellipse_get_type ()) #define GNOME_CANVAS_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_ELLIPSE, GnomeCanvasEllipse)) #define GNOME_CANVAS_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ELLIPSE, GnomeCanvasEllipseClass)) @@ -137,7 +126,6 @@ GType gnome_canvas_rect_get_type (void) G_GNUC_CONST; #define GNOME_IS_CANVAS_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_ELLIPSE)) #define GNOME_CANVAS_ELLIPSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_ELLIPSE, GnomeCanvasEllipseClass)) - typedef struct _GnomeCanvasEllipse GnomeCanvasEllipse; typedef struct _GnomeCanvasEllipseClass GnomeCanvasEllipseClass; @@ -149,11 +137,9 @@ struct _GnomeCanvasEllipseClass { GnomeCanvasREClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_ellipse_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-rich-text.c b/libgnomecanvas/gnome-canvas-rich-text.c index 28bb2c50b6..b8fbae962d 100644 --- a/libgnomecanvas/gnome-canvas-rich-text.c +++ b/libgnomecanvas/gnome-canvas-rich-text.c @@ -38,14 +38,14 @@ struct _GnomeCanvasRichTextPrivate { GtkTextLayout *layout; GtkTextBuffer *buffer; - char *text; + gchar *text; /* Position at anchor */ - double x, y; + gdouble x, y; /* Dimensions */ - double width, height; + gdouble width, height; /* Top-left canvas coordinates for text */ - int cx, cy; + gint cx, cy; gboolean cursor_visible; gboolean cursor_blink; @@ -56,12 +56,12 @@ struct _GnomeCanvasRichTextPrivate { GtkJustification justification; GtkTextDirection direction; GtkAnchorType anchor; - int pixels_above_lines; - int pixels_below_lines; - int pixels_inside_wrap; - int left_margin; - int right_margin; - int indent; + gint pixels_above_lines; + gint pixels_below_lines; + gint pixels_inside_wrap; + gint left_margin; + gint right_margin; + gint indent; guint preblink_timeout; guint blink_timeout; @@ -73,7 +73,7 @@ struct _GnomeCanvasRichTextPrivate { gboolean just_selected_element; - int clicks; + gint clicks; guint click_timeout; }; @@ -115,35 +115,35 @@ static void gnome_canvas_rich_text_set_property(GObject *object, guint property_ const GValue *value, GParamSpec *pspec); static void gnome_canvas_rich_text_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_rich_text_update(GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_rich_text_realize(GnomeCanvasItem *item); static void gnome_canvas_rich_text_unrealize(GnomeCanvasItem *item); -static double gnome_canvas_rich_text_point(GnomeCanvasItem *item, - double x, double y, - int cx, int cy, +static gdouble gnome_canvas_rich_text_point(GnomeCanvasItem *item, + gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_rich_text_draw(GnomeCanvasItem *item, +static void gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); static void gnome_canvas_rich_text_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static gint gnome_canvas_rich_text_event(GnomeCanvasItem *item, +static gint gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event); -static void gnome_canvas_rich_text_get_bounds(GnomeCanvasItem *text, double *px1, double *py1, - double *px2, double *py2); +static void gnome_canvas_rich_text_get_bounds(GnomeCanvasItem *text, + gdouble *px1, gdouble *py1, + gdouble *px2, gdouble *py2); static void gnome_canvas_rich_text_ensure_layout(GnomeCanvasRichText *text); static void gnome_canvas_rich_text_destroy_layout(GnomeCanvasRichText *text); -static void gnome_canvas_rich_text_start_cursor_blink(GnomeCanvasRichText *text, gboolean delay); +static void gnome_canvas_rich_text_start_cursor_blink(GnomeCanvasRichText *text, + gboolean delay); static void gnome_canvas_rich_text_stop_cursor_blink(GnomeCanvasRichText *text); static void gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, GtkMovementStep step, gint count, gboolean extend_selection); - - static GtkTextBuffer *get_buffer(GnomeCanvasRichText *text); static gint blink_cb(gpointer data); @@ -170,8 +170,9 @@ gnome_canvas_rich_text_get_type(void) NULL /* value_table */ }; - rich_text_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasRichText", - &object_info, 0); + rich_text_type = g_type_register_static ( + GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasRichText", + &object_info, 0); } return rich_text_type; @@ -197,7 +198,7 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS(klass); GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass); GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS(klass); - + parent_class = g_type_class_peek_parent (klass); gobject_class->set_property = gnome_canvas_rich_text_set_property; @@ -417,7 +418,7 @@ gnome_canvas_rich_text_init(GnomeCanvasRichText *text) text->_priv->justification = GTK_JUSTIFY_LEFT; text->_priv->direction = gtk_widget_get_default_direction(); text->_priv->anchor = GTK_ANCHOR_NW; - + text->_priv->blink_timeout = 0; text->_priv->preblink_timeout = 0; @@ -506,7 +507,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, text->_priv->wrap_mode = g_value_get_enum (value); if (text->_priv->layout) { - text->_priv->layout->default_style->wrap_mode = + text->_priv->layout->default_style->wrap_mode = text->_priv->wrap_mode; gtk_text_layout_default_style_changed(text->_priv->layout); } @@ -534,7 +535,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_PIXELS_ABOVE_LINES: text->_priv->pixels_above_lines = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->pixels_above_lines = text->_priv->pixels_above_lines; @@ -543,7 +544,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_PIXELS_BELOW_LINES: text->_priv->pixels_below_lines = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->pixels_below_lines = text->_priv->pixels_below_lines; @@ -552,7 +553,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_PIXELS_INSIDE_WRAP: text->_priv->pixels_inside_wrap = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->pixels_inside_wrap = text->_priv->pixels_inside_wrap; @@ -561,7 +562,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_LEFT_MARGIN: text->_priv->left_margin = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->left_margin = text->_priv->left_margin; @@ -570,7 +571,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_RIGHT_MARGIN: text->_priv->right_margin = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->right_margin = text->_priv->right_margin; @@ -579,13 +580,13 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_INDENT: text->_priv->pixels_above_lines = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->indent = text->_priv->indent; gtk_text_layout_default_style_changed(text->_priv->layout); } break; - + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -724,7 +725,7 @@ gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, GtkTextIter insert, newplace; gtk_text_buffer_get_iter_at_mark( - get_buffer(text), &insert, + get_buffer(text), &insert, gtk_text_buffer_get_mark(get_buffer(text), "insert")); newplace = insert; @@ -747,7 +748,7 @@ gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, gnome_canvas_rich_text_move_iter_by_lines( text, &newplace, count); gtk_text_layout_move_iter_to_x( - text->_priv->layout, &newplace, + text->_priv->layout, &newplace, gnome_canvas_rich_text_get_cursor_x_position(text)); break; case GTK_MOVEMENT_DISPLAY_LINE_ENDS: @@ -759,7 +760,7 @@ gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, gnome_canvas_rich_text_move_iter_by_lines( text, &newplace, ++count); } - + if (count != 0) { gtk_text_layout_move_iter_to_line_end( text->_priv->layout, &newplace, count); @@ -842,7 +843,7 @@ gnome_canvas_rich_text_delete_from_cursor(GnomeCanvasRichText *text, /* Special case: If the user wants to delete a character and there is a selection, then delete the selection and return */ if (type == GTK_DELETE_CHARS) { - if (gtk_text_buffer_delete_selection(get_buffer(text), TRUE, + if (gtk_text_buffer_delete_selection(get_buffer(text), TRUE, text->_priv->editable)) return; } @@ -915,15 +916,15 @@ selection_motion_event_handler(GnomeCanvasRichText *text, GdkEvent *event, { GtkTextIter newplace; GtkTextMark *mark; - double newx, newy; + gdouble newx, newy; /* We only want to handle motion events... */ if (event->type != GDK_MOTION_NOTIFY) return FALSE; - newx = (event->motion.x - text->_priv->x) * + newx = (event->motion.x - text->_priv->x) * GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit; - newy = (event->motion.y - text->_priv->y) * + newy = (event->motion.y - text->_priv->y) * GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit; gtk_text_layout_get_iter_at_pixel(text->_priv->layout, &newplace, newx, newy); @@ -979,9 +980,9 @@ gnome_canvas_rich_text_emit_tag_changed(GnomeCanvasRichText *text, { g_signal_emit(G_OBJECT(text), signals[TAG_CHANGED], 0, tag); } /* gnome_canvas_rich_text_emit_tag_changed */ - + static gint -gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, +gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, GdkEventKey *event) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); @@ -1018,7 +1019,7 @@ gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, case GDK_Right: if (event->state & GDK_CONTROL_MASK) { gnome_canvas_rich_text_move_cursor( - text, GTK_MOVEMENT_WORDS, 1, + text, GTK_MOVEMENT_WORDS, 1, extend_selection); handled = TRUE; } @@ -1211,12 +1212,12 @@ gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, } gnome_canvas_rich_text_start_cursor_blink(text, TRUE); - + return TRUE; } /* gnome_canvas_rich_text_key_press_event */ static gint -gnome_canvas_rich_text_key_release_event(GnomeCanvasItem *item, +gnome_canvas_rich_text_key_release_event(GnomeCanvasItem *item, GdkEventKey *event) { return FALSE; @@ -1240,11 +1241,11 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); GtkTextIter iter; GdkEventType event_type; - double newx, newy; + gdouble newx, newy; newx = (event->x - text->_priv->x) * item->canvas->pixels_per_unit; newy = (event->y - text->_priv->y) * item->canvas->pixels_per_unit; - + gtk_text_layout_get_iter_at_pixel(text->_priv->layout, &iter, newx, newy); /* The canvas doesn't give us double- or triple-click events, so @@ -1289,7 +1290,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, #if 0 printf("double-click\n"); #endif - + gnome_canvas_rich_text_end_selection_drag(text, event); start = iter; @@ -1298,7 +1299,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, if (gtk_text_iter_inside_word(&start)) { if (!gtk_text_iter_starts_word(&start)) gtk_text_iter_backward_word_start(&start); - + if (!gtk_text_iter_ends_word(&end)) gtk_text_iter_forward_word_end(&end); } @@ -1360,7 +1361,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, gtk_clipboard_get (GDK_SELECTION_PRIMARY), &iter, text->_priv->editable); } - + return FALSE; } /* gnome_canvas_rich_text_button_press_event */ @@ -1369,11 +1370,11 @@ gnome_canvas_rich_text_button_release_event(GnomeCanvasItem *item, GdkEventButton *event) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - double newx, newy; + gdouble newx, newy; newx = (event->x - text->_priv->x) * item->canvas->pixels_per_unit; newy = (event->y - text->_priv->y) * item->canvas->pixels_per_unit; - + if (event->button == 1) { if (text->_priv->drag_start_x >= 0) { text->_priv->drag_start_x = -1; @@ -1433,7 +1434,7 @@ static gboolean get_event_coordinates(GdkEvent *event, gint *x, gint *y) { g_return_val_if_fail(event, FALSE); - + switch (event->type) { case GDK_MOTION_NOTIFY: *x = event->motion.x; @@ -1453,12 +1454,12 @@ get_event_coordinates(GdkEvent *event, gint *x, gint *y) } /* get_event_coordinates */ static void -emit_event_on_tags(GnomeCanvasRichText *text, GdkEvent *event, +emit_event_on_tags(GnomeCanvasRichText *text, GdkEvent *event, GtkTextIter *iter) { GSList *tags; GSList *i; - + tags = gtk_text_iter_get_tags(iter); i = tags; @@ -1469,7 +1470,7 @@ emit_event_on_tags(GnomeCanvasRichText *text, GdkEvent *event, /* The cursor has been moved to within this tag. Emit the tag_changed signal */ - if (event->type == GDK_BUTTON_RELEASE || + if (event->type == GDK_BUTTON_RELEASE || event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) { gnome_canvas_rich_text_emit_tag_changed( @@ -1486,7 +1487,7 @@ static gint gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - int x, y; + gint x, y; if (get_event_coordinates(event, &x, &y)) { GtkTextIter iter; @@ -1549,7 +1550,7 @@ gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event) /** * gnome_canvas_rich_text_cut_clipboard: * @text: a #GnomeCanvasRichText. - * + * * Copies the currently selected @text to clipboard, then deletes said text * if it's editable. **/ @@ -1564,7 +1565,6 @@ gnome_canvas_rich_text_cut_clipboard(GnomeCanvasRichText *text) text->_priv->editable); } /* gnome_canvas_rich_text_cut_clipboard */ - /** * gnome_canvas_rich_text_copy_clipboard: * @text: a #GnomeCanvasRichText. @@ -1581,7 +1581,6 @@ gnome_canvas_rich_text_copy_clipboard(GnomeCanvasRichText *text) gtk_clipboard_get (GDK_SELECTION_PRIMARY)); } /* gnome_canvas_rich_text_cut_clipboard */ - /** * gnome_canvas_rich_text_paste_clipboard: * @text: a #GnomeCanvasRichText. @@ -1721,12 +1720,12 @@ scale_fonts(GtkTextTag *tag, gpointer data) #endif g_object_set( - G_OBJECT(tag), "scale", + G_OBJECT(tag), "scale", text->_priv->layout->default_style->font_scale, NULL); } /* scale_fonts */ static void -changed_handler(GtkTextLayout *layout, gint start_y, +changed_handler(GtkTextLayout *layout, gint start_y, gint old_height, gint new_height, gpointer data) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(data); @@ -1735,11 +1734,11 @@ changed_handler(GtkTextLayout *layout, gint start_y, printf("Layout %p is being changed.\n", text->_priv->layout); #endif - if (text->_priv->layout->default_style->font_scale != + if (text->_priv->layout->default_style->font_scale != GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit) { GtkTextTagTable *tag_table; - text->_priv->layout->default_style->font_scale = + text->_priv->layout->default_style->font_scale = GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit; tag_table = gtk_text_buffer_get_tag_table(get_buffer(text)); @@ -1749,7 +1748,7 @@ changed_handler(GtkTextLayout *layout, gint start_y, } if (text->_priv->grow_height) { - int width, height; + gint width, height; gtk_text_layout_get_size(text->_priv->layout, &width, &height); @@ -1762,16 +1761,15 @@ changed_handler(GtkTextLayout *layout, gint start_y, g_idle_add(request_update, text); } /* changed_handler */ - /** * gnome_canvas_rich_text_set_buffer: * @text: a #GnomeCanvasRichText. * @buffer: a #GtkTextBuffer. * - * Sets the buffer field of the @text to @buffer. - **/ + * Sets the buffer field of the @text to @buffer. + **/ void -gnome_canvas_rich_text_set_buffer(GnomeCanvasRichText *text, +gnome_canvas_rich_text_set_buffer(GnomeCanvasRichText *text, GtkTextBuffer *buffer) { g_return_if_fail(GNOME_IS_CANVAS_RICH_TEXT(text)); @@ -1810,7 +1808,6 @@ get_buffer(GnomeCanvasRichText *text) return text->_priv->buffer; } /* get_buffer */ - /** * gnome_canvas_rich_text_get_buffer: * @text: a #GnomeCanvasRichText. @@ -1828,7 +1825,6 @@ gnome_canvas_rich_text_get_buffer(GnomeCanvasRichText *text) return get_buffer(text); } /* gnome_canvas_rich_text_get_buffer */ - /** * gnome_canvas_rich_text_get_iter_location: * @text: a #GnomeCanvasRichText. @@ -1848,7 +1844,6 @@ gnome_canvas_rich_text_get_iter_location (GnomeCanvasRichText *text, gtk_text_layout_get_iter_location (text->_priv->layout, iter, location); } - /** * gnome_canvas_rich_text_get_iter_at_location: * @text: a #GnomeCanvasRichText. @@ -1856,8 +1851,8 @@ gnome_canvas_rich_text_get_iter_location (GnomeCanvasRichText *text, * @x: x position, in buffer coordinates. * @y: y position, in buffer coordinates. * - * Retrieves the iterator at the buffer coordinates x and y. - **/ + * Retrieves the iterator at the buffer coordinates x and y. + **/ void gnome_canvas_rich_text_get_iter_at_location (GnomeCanvasRichText *text, GtkTextIter *iter, @@ -1874,7 +1869,6 @@ gnome_canvas_rich_text_get_iter_at_location (GnomeCanvasRichText *text, y); } - static void gnome_canvas_rich_text_set_attributes_from_style(GnomeCanvasRichText *text, GtkTextAttributes *values, @@ -1882,7 +1876,7 @@ gnome_canvas_rich_text_set_attributes_from_style(GnomeCanvasRichText *text, { values->appearance.bg_color = style->base[GTK_STATE_NORMAL]; values->appearance.fg_color = style->fg[GTK_STATE_NORMAL]; - + if (values->font) pango_font_description_free (values->font); @@ -1974,9 +1968,9 @@ gnome_canvas_rich_text_destroy_layout(GnomeCanvasRichText *text) } /* gnome_canvas_rich_text_destroy_layout */ static void -adjust_for_anchors(GnomeCanvasRichText *text, double *ax, double *ay) +adjust_for_anchors(GnomeCanvasRichText *text, gdouble *ax, gdouble *ay) { - double x, y; + gdouble x, y; x = text->_priv->x; y = text->_priv->y; @@ -2033,13 +2027,13 @@ adjust_for_anchors(GnomeCanvasRichText *text, double *ax, double *ay) } /* adjust_for_anchors */ static void -get_bounds(GnomeCanvasRichText *text, double *px1, double *py1, - double *px2, double *py2) +get_bounds(GnomeCanvasRichText *text, gdouble *px1, gdouble *py1, + gdouble *px2, gdouble *py2) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM(text); - double x, y; - double x1, x2, y1, y2; - int cx1, cx2, cy1, cy2; + gdouble x, y; + gdouble x1, x2, y1, y2; + gint cx1, cx2, cy1, cy2; adjust_for_anchors(text, &x, &y); @@ -2059,19 +2053,23 @@ get_bounds(GnomeCanvasRichText *text, double *px1, double *py1, *py2 = cy2; } /* get_bounds */ -static void gnome_canvas_rich_text_get_bounds(GnomeCanvasItem *item, double *px1, double *py1, - double *px2, double *py2) +static void +gnome_canvas_rich_text_get_bounds (GnomeCanvasItem *item, + gdouble *px1, + gdouble *py1, + gdouble *px2, + gdouble *py2) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); get_bounds (text, px1, py1, px2, py2); } static void -gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags) +gnome_canvas_rich_text_update(GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; GtkTextIter start; (* GNOME_CANVAS_ITEM_CLASS(parent_class)->update)( @@ -2086,15 +2084,15 @@ gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, gnome_canvas_update_bbox(item, x1, y1, x2, y2); } /* gnome_canvas_rich_text_update */ - + static double -gnome_canvas_rich_text_point(GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_rich_text_point(GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - double ax, ay; - double x1, x2, y1, y2; - double dx, dy; + gdouble ax, ay; + gdouble x1, x2, y1, y2; + gdouble dx, dy; *actual_item = item; @@ -2129,14 +2127,14 @@ gnome_canvas_rich_text_point(GnomeCanvasItem *item, double x, double y, static void gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); GtkStyle *style; GtkWidget *widget; - double i2w[6], w2c[6], i2c[6]; - double ax, ay; - int x1, y1, x2, y2; + gdouble i2w[6], w2c[6], i2c[6]; + gdouble ax, ay; + gint x1, y1, x2, y2; ArtPoint i1, i2; ArtPoint c1, c2; @@ -2182,9 +2180,9 @@ gnome_canvas_rich_text_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf) #if 0 static GtkTextTag * -gnome_canvas_rich_text_add_tag(GnomeCanvasRichText *text, char *tag_name, - int start_offset, int end_offset, - const char *first_property_name, ...) +gnome_canvas_rich_text_add_tag(GnomeCanvasRichText *text, gchar *tag_name, + gint start_offset, gint end_offset, + const gchar *first_property_name, ...) { GtkTextTag *tag; GtkTextIter start, end; diff --git a/libgnomecanvas/gnome-canvas-shape-private.h b/libgnomecanvas/gnome-canvas-shape-private.h index ffdd3ce24b..089b95c9a6 100644 --- a/libgnomecanvas/gnome-canvas-shape-private.h +++ b/libgnomecanvas/gnome-canvas-shape-private.h @@ -80,7 +80,7 @@ struct _GnomeCanvasShapePriv { guint outline_set : 1; /* Is outline color set? */ guint width_pixels : 1; /* Is outline width specified in pixels or units? */ - double width; /* Width of outline, in user coords */ + gdouble width; /* Width of outline, in user coords */ guint32 fill_rgba; /* Fill color, RGBA */ guint32 outline_rgba; /* Outline color, RGBA */ @@ -88,7 +88,7 @@ struct _GnomeCanvasShapePriv { GdkCapStyle cap; /* Cap style for line */ GdkJoinStyle join; /* Join style for line */ ArtWindRule wind; /* Winding rule */ - double miterlimit; /* Miter limit */ + gdouble miterlimit; /* Miter limit */ ArtVpathDash dash; /* Dashing pattern */ diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c index b951cbc014..2b606c1e5b 100644 --- a/libgnomecanvas/gnome-canvas-shape.c +++ b/libgnomecanvas/gnome-canvas-shape.c @@ -72,23 +72,23 @@ static void gnome_canvas_shape_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_shape_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static void gnome_canvas_shape_realize (GnomeCanvasItem *item); static void gnome_canvas_shape_unrealize (GnomeCanvasItem *item); static void gnome_canvas_shape_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_shape_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item); + gint x, gint y, gint width, gint height); +static gdouble gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); static void gnome_canvas_shape_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); static void gnome_canvas_shape_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static gulong get_pixel_from_rgba (GnomeCanvasItem *item, guint32 rgba_color); static guint32 get_rgba_from_color (GdkColor * color); static void set_gc_foreground (GdkGC *gc, gulong pixel); static void gcbp_ensure_gdk (GnomeCanvasShape * bpath); static void gcbp_destroy_gdk (GnomeCanvasShape * bpath); -static void set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, int reconfigure); +static void set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, gint reconfigure); static void gcbp_ensure_mask (GnomeCanvasShape * bpath, gint width, gint height); static void gcbp_draw_ctx_unref (GCBPDrawCtx * ctx); @@ -140,8 +140,6 @@ gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class) gobject_class->set_property = gnome_canvas_shape_set_property; gobject_class->get_property = gnome_canvas_shape_get_property; - - g_object_class_install_property (gobject_class, PROP_FILL_COLOR, g_param_spec_string ("fill_color", NULL, NULL, @@ -282,9 +280,9 @@ gnome_canvas_shape_destroy (GtkObject *object) if (priv->dash.dash) g_free (priv->dash.dash); if (priv->fill_svp) art_svp_free (priv->fill_svp); if (priv->outline_svp) art_svp_free (priv->outline_svp); - + g_free (shape->priv); - shape->priv = NULL; + shape->priv = NULL; } if (GTK_OBJECT_CLASS (parent_class)->destroy) @@ -294,16 +292,16 @@ gnome_canvas_shape_destroy (GtkObject *object) /** * gnome_canvas_shape_set_path_def: * @shape: a GnomeCanvasShape - * @def: a GnomeCanvasPathDef + * @def: a GnomeCanvasPathDef * * This function sets the the GnomeCanvasPathDef used by the * GnomeCanvasShape. Notice, that it does not request updates, as * it is meant to be used from item implementations, from inside * update queue. */ - + void -gnome_canvas_shape_set_path_def (GnomeCanvasShape *shape, GnomeCanvasPathDef *def) +gnome_canvas_shape_set_path_def (GnomeCanvasShape *shape, GnomeCanvasPathDef *def) { GnomeCanvasShapePriv *priv; @@ -470,7 +468,7 @@ gnome_canvas_shape_set_property (GObject *object, priv->join = g_value_get_enum (value); gnome_canvas_item_request_update (item); break; - + case PROP_MITERLIMIT: priv->miterlimit = g_value_get_double (value); gnome_canvas_item_request_update (item); @@ -486,7 +484,7 @@ gnome_canvas_shape_set_property (GObject *object, priv->dash.n_dash = dash->n_dash; if (dash->dash != NULL) { priv->dash.dash = g_new (double, dash->n_dash); - memcpy (priv->dash.dash, dash->dash, dash->n_dash * sizeof (double)); + memcpy (priv->dash.dash, dash->dash, dash->n_dash * sizeof (gdouble)); } } gnome_canvas_item_request_update (item); @@ -498,7 +496,7 @@ gnome_canvas_shape_set_property (GObject *object, } /* Allocates a GdkColor structure filled with the specified pixel, and - * puts it into the specified value for returning it in the get_property + * puts it into the specified value for returning it in the get_property * method. */ @@ -524,12 +522,12 @@ get_color_value (GnomeCanvasShape *shape, gulong pixel, GValue *value) * * Returns: a #GnomeCanvasPathDef or NULL if none is set for the shape. */ - + GnomeCanvasPathDef * gnome_canvas_shape_get_path_def (GnomeCanvasShape *shape) { GnomeCanvasShapePriv *priv; - + g_return_val_if_fail (shape != NULL, NULL); g_return_val_if_fail (GNOME_IS_CANVAS_SHAPE (shape), NULL); @@ -539,7 +537,7 @@ gnome_canvas_shape_get_path_def (GnomeCanvasShape *shape) gnome_canvas_path_def_ref (priv->path); return priv->path; } - + return NULL; } @@ -570,7 +568,7 @@ gnome_canvas_shape_get_property (GObject *object, get_color_value (shape, 0, value); } break; - + case PROP_OUTLINE_COLOR_GDK: if (gdk) { get_color_value (shape, gdk->outline_pixel, value); @@ -630,7 +628,7 @@ gnome_canvas_shape_get_property (GObject *object, case PROP_DASH: g_value_set_pointer (value, &priv->dash); break; - + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -706,10 +704,10 @@ gnome_canvas_shape_render (GnomeCanvasItem *item, static void gnome_canvas_shape_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, - int y, - int width, - int height) + gint x, + gint y, + gint width, + gint height) { static GdkPoint * dpoints = NULL; static gint num_dpoints = 0; @@ -836,14 +834,14 @@ gnome_canvas_shape_ensure_gdk_points (GnomeCanvasShapePrivGdk *gdk, gint num) } static void -gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP * clip, int flags) +gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, gdouble * affine, ArtSVP * clip, gint flags) { GnomeCanvasShapePriv * priv; GnomeCanvasShapePrivGdk * gdk; - int x1 = 0, y1 = 0, x2 = 0, y2 = 0; + gint x1 = 0, y1 = 0, x2 = 0, y2 = 0; gboolean bbox_set = FALSE; gint width = 0; /* silence gcc */ - + g_assert (!((GnomeCanvasItem *) shape)->canvas->aa); priv = shape->priv; @@ -854,14 +852,14 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP GdkLineStyle style; if (priv->width_pixels) { - width = (int) floor (priv->width + 0.5); + width = (gint) floor (priv->width + 0.5); /* Never select 0 pixels unless the user asked for it, * since that is the X11 zero width lines are non-specified */ if (priv->width_pixels != 0 && width == 0) { width = 1; } } else { - width = (int) floor ((priv->width * priv->scale) + 0.5); + width = (gint) floor ((priv->width * priv->scale) + 0.5); /* Never select 0 pixels unless the user asked for it, * since that is the X11 zero width lines are non-speciifed */ if (priv->width != 0 && width == 0) { @@ -894,14 +892,14 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP } /* Set line width, cap, join */ - if(gdk->outline_gc) { - + if (gdk->outline_gc) { + gdk_gc_set_line_attributes (gdk->outline_gc, width, style, priv->cap, priv->join); - + /* Colors and stipples */ set_gc_foreground (gdk->outline_gc, gdk->outline_pixel); set_stipple (gdk->outline_gc, &gdk->outline_stipple, gdk->outline_stipple, TRUE); @@ -911,7 +909,7 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP if (priv->fill_set) { /* Colors and stipples */ - if(gdk->fill_gc) { + if (gdk->fill_gc) { set_gc_foreground (gdk->fill_gc, gdk->fill_pixel); set_stipple (gdk->fill_gc, &gdk->fill_stipple, gdk->fill_stipple, TRUE); } @@ -978,7 +976,7 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP path = (GnomeCanvasPathDef *) clist->data; bpath = gnome_canvas_path_def_bpath (path); vpath = art_bez_path_to_vec (bpath, 0.1); - for (len = 0; vpath[len].code != ART_END; len++) ; + for (len = 0; vpath[len].code != ART_END; len++); gnome_canvas_shape_ensure_gdk_points (gdk, len); for (i = 0; i < len; i++) { @@ -1020,13 +1018,13 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP path = (GnomeCanvasPathDef *) olist->data; bpath = gnome_canvas_path_def_bpath (path); vpath = art_bez_path_to_vec (bpath, 0.1); - for (len = 0; vpath[len].code != ART_END; len++) ; + for (len = 0; vpath[len].code != ART_END; len++); gnome_canvas_shape_ensure_gdk_points (gdk, len); for (i = 0; i < len; i++) { gdk->points[pos + i].x = (gint) floor (vpath[i].x + 0.5); gdk->points[pos + i].y = (gint) floor (vpath[i].y + 0.5); - + if (bbox_set) { x1 = MIN (x1, gdk->points[pos + i].x); x2 = MAX (x2, gdk->points[pos + i].x); @@ -1055,7 +1053,7 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP if (bbox_set) { if (priv->outline_set) { - int stroke_border = (priv->join == GDK_JOIN_MITER) + gint stroke_border = (priv->join == GDK_JOIN_MITER) ? ceil (10.43*width/2) /* 10.43 is the miter limit for X11 */ : ceil (width/2); x1 -= stroke_border; @@ -1063,16 +1061,16 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP y1 -= stroke_border; y2 += stroke_border; } - + gnome_canvas_update_bbox (GNOME_CANVAS_ITEM (shape), x1, y1, x2 + 1, y2 + 1); } - + } static void -gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_shape_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasShape * shape; GnomeCanvasShapePriv * priv; @@ -1094,7 +1092,7 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p if (item->canvas->aa) { gnome_canvas_item_reset_bounds (item); } - + /* Clipped fill SVP */ if ((priv->fill_set) && (priv->path) && (gnome_canvas_path_def_any_closed (priv->path))) { @@ -1152,9 +1150,9 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p } else { width = priv->width * priv->scale; } - + if (width < 0.5) width = 0.5; - + /* Render full path until vpath */ abp = art_bpath_affine_transform (gnome_canvas_path_def_bpath (priv->path), affine); @@ -1167,11 +1165,11 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p if (priv->dash.dash != NULL) { ArtVpath *old = vpath; - + vpath = art_vpath_dash (old, &priv->dash); art_free (old); } - + /* Stroke vpath to SVP */ svp = art_svp_vpath_stroke (vpath, @@ -1196,19 +1194,19 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p } /* Gdk requires additional handling */ - + if (!item->canvas->aa) { gnome_canvas_shape_update_gdk (shape, affine, clip_path, flags); } } static double -gnome_canvas_shape_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasShape *shape; - double dist; - int wind; + gdouble dist; + gint wind; #if 0 /* fixme: This is just for debugging, canvas should ensure that */ @@ -1288,7 +1286,7 @@ set_gc_foreground (GdkGC *gc, gulong pixel) /* Sets the stipple pattern for the specified gc */ static void -set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, int reconfigure) +set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, gint reconfigure) { if (*internal_stipple && !reconfigure) g_object_unref (*internal_stipple); @@ -1471,14 +1469,14 @@ gcbp_draw_ctx_unref (GCBPDrawCtx * ctx) g_object_unref (ctx->mask); if (ctx->clip) g_object_unref (ctx->clip); - + g_object_set_data (G_OBJECT (ctx->canvas), "BpathDrawCtx", NULL); g_free (ctx); } } static void -gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_shape_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) { GnomeCanvasShape * shape; GnomeCanvasShapePriv * priv; @@ -1505,9 +1503,9 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double } else { width = priv->width * priv->scale; } - + if (width < 0.5) width = 0.5; - + /* Render full path until vpath */ vpath = art_bez_path_to_vec (gnome_canvas_path_def_bpath (priv->path), 0.1); @@ -1517,11 +1515,11 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double if (priv->dash.dash != NULL) { ArtVpath *old = vpath; - + vpath = art_vpath_dash (old, &priv->dash); art_free (old); } - + /* Stroke vpath to SVP */ svp = art_svp_vpath_stroke (vpath, @@ -1547,13 +1545,13 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double svp = art_svp_from_vpath (vpath); art_free (vpath); - + swr = art_svp_writer_rewind_new (shape->priv->wind); art_svp_intersector (svp, swr); - + svp2 = art_svp_writer_rewind_reap (swr); art_svp_free (svp); - + art_drect_svp (&bbox, svp2); art_svp_free (svp2); } diff --git a/libgnomecanvas/gnome-canvas-shape.h b/libgnomecanvas/gnome-canvas-shape.h index b91578ba6b..5defd38ca4 100644 --- a/libgnomecanvas/gnome-canvas-shape.h +++ b/libgnomecanvas/gnome-canvas-shape.h @@ -19,7 +19,6 @@ G_BEGIN_DECLS - /* Shape item for the canvas. * * The following object arguments are available: @@ -36,13 +35,13 @@ G_BEGIN_DECLS * outline_stipple GdkBitmap* RW Stipple pattern for outline * width_pixels uint RW Width of the outline in pixels. The outline will * not be scaled when the canvas zoom factor is changed. - * width_units double RW Width of the outline in canvas units. The outline + * width_units gdouble RW Width of the outline in canvas units. The outline * will be scaled when the canvas zoom factor is changed. * cap_style GdkCapStyle RW Cap ("endpoint") style for the bpath. * join_style GdkJoinStyle RW Join ("vertex") style for the bpath. * wind ArtWindRule RW Winding rule for the bpath. * dash ArtVpathDash RW Dashing pattern - * miterlimit double RW Minimum angle between segments, where miter join + * miterlimit gdouble RW Minimum angle between segments, where miter join * rule is applied. */ @@ -52,7 +51,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_SHAPE)) #define GNOME_IS_CANVAS_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_SHAPE)) - typedef struct _GnomeCanvasShape GnomeCanvasShape; typedef struct _GnomeCanvasShapePriv GnomeCanvasShapePriv; typedef struct _GnomeCanvasShapeClass GnomeCanvasShapeClass; @@ -67,7 +65,6 @@ struct _GnomeCanvasShapeClass { GnomeCanvasItemClass parent_class; }; - /* WARNING! These are not usable from modifying shapes from user programs */ /* These are meant, to set master shape from subclass ::update method */ void gnome_canvas_shape_set_path_def (GnomeCanvasShape *shape, GnomeCanvasPathDef *def); diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c index d54dee84ba..f1d0238099 100644 --- a/libgnomecanvas/gnome-canvas-text.c +++ b/libgnomecanvas/gnome-canvas-text.c @@ -64,7 +64,7 @@ enum { PROP_FONT, PROP_FONT_DESC, PROP_FAMILY, PROP_FAMILY_SET, - + /* Style */ PROP_ATTRIBUTES, PROP_STYLE, PROP_STYLE_SET, @@ -103,7 +103,6 @@ struct _GnomeCanvasTextPrivate { FT_Bitmap bitmap; }; - static void gnome_canvas_text_class_init (GnomeCanvasTextClass *class); static void gnome_canvas_text_init (GnomeCanvasText *text); static void gnome_canvas_text_destroy (GtkObject *object); @@ -116,23 +115,27 @@ static void gnome_canvas_text_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_text_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_text_update (GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_text_realize (GnomeCanvasItem *item); static void gnome_canvas_text_unrealize (GnomeCanvasItem *item); static void gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, + gint x, gint y, gint width, gint height); +static gdouble gnome_canvas_text_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, GnomeCanvasItem **actual_item); static void gnome_canvas_text_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static void gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); static void gnome_canvas_text_set_markup (GnomeCanvasText *textitem, const gchar *markup); static void gnome_canvas_text_set_font_desc (GnomeCanvasText *textitem, - PangoFontDescription *font_desc); + PangoFontDescription *font_desc); static void gnome_canvas_text_apply_font_desc (GnomeCanvasText *textitem); static void gnome_canvas_text_apply_attributes (GnomeCanvasText *textitem); @@ -146,11 +149,11 @@ static GnomeCanvasItemClass *parent_class; /** * gnome_canvas_text_get_type: - * @void: - * + * @void: + * * Registers the &GnomeCanvasText class if necessary, and returns the type ID * associated to it. - * + * * Return value: The type ID of the &GnomeCanvasText class. **/ GType @@ -230,7 +233,6 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - /* Font */ g_object_class_install_property (gobject_class, @@ -240,7 +242,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Font description as a string", NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_FONT_DESC, @@ -258,7 +260,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Name of the font family, e.g. Sans, Helvetica, Times, Monospace", NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + /* Style */ g_object_class_install_property (gobject_class, @@ -266,7 +268,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) g_param_spec_boxed ("attributes", NULL, NULL, PANGO_TYPE_ATTR_LIST, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_STYLE, @@ -276,7 +278,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) PANGO_TYPE_STYLE, PANGO_STYLE_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_VARIANT, @@ -286,7 +288,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) PANGO_TYPE_VARIANT, PANGO_VARIANT_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_WEIGHT, @@ -297,8 +299,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) G_MAXINT, PANGO_WEIGHT_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - - + g_object_class_install_property (gobject_class, PROP_STRETCH, @@ -308,18 +309,19 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) PANGO_TYPE_STRETCH, PANGO_STRETCH_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_SIZE, g_param_spec_int ("size", "Font size", - "Font size (as a multiple of PANGO_SCALE, eg. 12*PANGO_SCALE for a 12pt font size)", + "Font size (as a multiple of PANGO_SCALE, " + "eg. 12*PANGO_SCALE for a 12pt font size)", 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_SIZE_POINTS, @@ -329,8 +331,8 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - + G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (gobject_class, PROP_RISE, @@ -341,7 +343,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_STRIKETHROUGH, @@ -350,7 +352,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Whether to strike through the text", FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_UNDERLINE, @@ -370,8 +372,8 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) 0.0, G_MAXDOUBLE, 1.0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - + G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (gobject_class, PROP_ANCHOR, @@ -464,40 +466,43 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) G_PARAM_READABLE)); /* Style props are set (explicitly applied) or not */ -#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (gobject_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)) +#define ADD_SET_PROP(propname, propval, nick, blurb) \ + g_object_class_install_property ( \ + gobject_class, propval, g_param_spec_boolean ( \ + propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)) ADD_SET_PROP ("family_set", PROP_FAMILY_SET, "Font family set", - "Whether this tag affects the font family"); - + "Whether this tag affects the font family"); + ADD_SET_PROP ("style_set", PROP_STYLE_SET, "Font style set", "Whether this tag affects the font style"); - + ADD_SET_PROP ("variant_set", PROP_VARIANT_SET, "Font variant set", "Whether this tag affects the font variant"); - + ADD_SET_PROP ("weight_set", PROP_WEIGHT_SET, "Font weight set", "Whether this tag affects the font weight"); - + ADD_SET_PROP ("stretch_set", PROP_STRETCH_SET, "Font stretch set", "Whether this tag affects the font stretch"); - + ADD_SET_PROP ("size_set", PROP_SIZE_SET, "Font size set", "Whether this tag affects the font size"); - + ADD_SET_PROP ("rise_set", PROP_RISE_SET, "Rise set", "Whether this tag affects the rise"); - + ADD_SET_PROP ("strikethrough_set", PROP_STRIKETHROUGH_SET, "Strikethrough set", "Whether this tag affects strikethrough"); - + ADD_SET_PROP ("underline_set", PROP_UNDERLINE_SET, "Underline set", "Whether this tag affects underlining"); @@ -506,7 +511,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Scale set", "Whether this tag affects font scaling"); #undef ADD_SET_PROP - + object_class->destroy = gnome_canvas_text_destroy; item_class->update = gnome_canvas_text_update; @@ -533,15 +538,15 @@ gnome_canvas_text_init (GnomeCanvasText *text) text->layout = NULL; text->font_desc = NULL; - + text->underline = PANGO_UNDERLINE_NONE; text->strikethrough = FALSE; text->rise = 0; - + text->underline_set = FALSE; text->strike_set = FALSE; text->rise_set = FALSE; - + text->priv = g_new (GnomeCanvasTextPrivate, 1); text->priv->bitmap.buffer = NULL; text->priv->render_dirty = 1; @@ -565,7 +570,7 @@ gnome_canvas_text_destroy (GtkObject *object) if (text->layout) g_object_unref (G_OBJECT (text->layout)); text->layout = NULL; - + if (text->font_desc) { pango_font_description_free (text->font_desc); text->font_desc = NULL; @@ -574,36 +579,41 @@ gnome_canvas_text_destroy (GtkObject *object) if (text->attr_list) pango_attr_list_unref (text->attr_list); text->attr_list = NULL; - + if (text->stipple) g_object_unref (text->stipple); text->stipple = NULL; if (text->priv && text->priv->bitmap.buffer) { - g_free (text->priv->bitmap.buffer); + g_free (text->priv->bitmap.buffer); } g_free (text->priv); text->priv = NULL; - + if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } static void -get_bounds (GnomeCanvasText *text, double *px1, double *py1, double *px2, double *py2) +get_bounds (GnomeCanvasText *text, + gdouble *px1, + gdouble *py1, + gdouble *px2, + gdouble *py2) { GnomeCanvasItem *item; - double wx, wy; + gdouble wx, wy; item = GNOME_CANVAS_ITEM (text); /* Get canvas pixel coordinates for text position */ - wx = text->x; wy = text->y; gnome_canvas_item_i2w (item, &wx, &wy); - gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); + gnome_canvas_w2c ( + item->canvas, wx + text->xofs, wy + text->yofs, + &text->cx, &text->cy); /* Get canvas pixel coordinates for clip rectangle position */ @@ -691,7 +701,7 @@ set_text_gc_foreground (GnomeCanvasText *text) /* Sets the stipple pattern for the text */ static void -set_stipple (GnomeCanvasText *text, GdkBitmap *stipple, int reconfigure) +set_stipple (GnomeCanvasText *text, GdkBitmap *stipple, gint reconfigure) { if (text->stipple && !reconfigure) g_object_unref (text->stipple); @@ -750,7 +760,7 @@ gnome_canvas_text_set_property (GObject *object, GdkColor color = { 0, 0, 0, 0, }; GdkColor *pcolor; gboolean color_changed; - int have_pixel; + gint have_pixel; PangoAlignment align; g_return_if_fail (object != NULL); @@ -761,27 +771,26 @@ gnome_canvas_text_set_property (GObject *object, color_changed = FALSE; have_pixel = FALSE; - if (!text->layout) { - PangoContext *gtk_context, *context; + PangoContext *gtk_context, *context; gtk_context = gtk_widget_get_pango_context (GTK_WIDGET (item->canvas)); - - if (item->canvas->aa) { + + if (item->canvas->aa) { PangoFontMap *fontmap; PangoLanguage *language; gint pixels, mm; - double dpi_x; - double dpi_y; - + gdouble dpi_x; + gdouble dpi_y; + pixels = gdk_screen_width (); mm = gdk_screen_width_mm (); - dpi_x = (((double) pixels * 25.4) / (double) mm); - + dpi_x = (((gdouble) pixels * 25.4) / (gdouble) mm); + pixels = gdk_screen_height (); mm = gdk_screen_height_mm (); - dpi_y = (((double) pixels * 25.4) / (double) mm); + dpi_y = (((gdouble) pixels * 25.4) / (gdouble) mm); /* XXX This used to call pango_ft2_get_context(). * Is there a better way to do this? */ @@ -795,15 +804,14 @@ gnome_canvas_text_set_property (GObject *object, pango_context_get_base_dir (gtk_context)); pango_context_set_font_description (context, pango_context_get_font_description (gtk_context)); - + } else context = gtk_context; - text->layout = pango_layout_new (context); - - if (item->canvas->aa) - g_object_unref (G_OBJECT (context)); + + if (item->canvas->aa) + g_object_unref (G_OBJECT (context)); } switch (param_id) { @@ -831,7 +839,7 @@ gnome_canvas_text_set_property (GObject *object, break; case PROP_FONT: { - const char *font_name; + const gchar *font_name; PangoFontDescription *font_desc; font_name = g_value_get_string (value); @@ -839,7 +847,7 @@ gnome_canvas_text_set_property (GObject *object, font_desc = pango_font_description_from_string (font_name); else font_desc = NULL; - + gnome_canvas_text_set_font_desc (text, font_desc); if (font_desc) pango_font_description_free (font_desc); @@ -891,7 +899,7 @@ gnome_canvas_text_set_property (GObject *object, g_value_get_double (value) * PANGO_SCALE); break; } - + gnome_canvas_text_apply_font_desc (text); text->priv->render_dirty = 1; break; @@ -910,29 +918,29 @@ gnome_canvas_text_set_property (GObject *object, case PROP_SCALE: text->scale = g_value_get_double (value); text->scale_set = TRUE; - + gnome_canvas_text_apply_font_desc (text); text->priv->render_dirty = 1; break; - + case PROP_SCALE_SET: text->scale_set = g_value_get_boolean (value); - + gnome_canvas_text_apply_font_desc (text); text->priv->render_dirty = 1; - break; - + break; + case PROP_UNDERLINE: text->underline = g_value_get_enum (value); text->underline_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; case PROP_UNDERLINE_SET: text->underline_set = g_value_get_boolean (value); - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -940,14 +948,14 @@ gnome_canvas_text_set_property (GObject *object, case PROP_STRIKETHROUGH: text->strikethrough = g_value_get_boolean (value); text->strike_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; case PROP_STRIKETHROUGH_SET: text->strike_set = g_value_get_boolean (value); - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -955,14 +963,14 @@ gnome_canvas_text_set_property (GObject *object, case PROP_RISE: text->rise = g_value_get_int (value); text->rise_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; case PROP_RISE_SET: text->rise_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -973,7 +981,7 @@ gnome_canvas_text_set_property (GObject *object, text->attr_list = g_value_peek_pointer (value); pango_attr_list_ref (text->attr_list); - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -987,31 +995,31 @@ gnome_canvas_text_set_property (GObject *object, switch (text->justification) { case GTK_JUSTIFY_LEFT: - align = PANGO_ALIGN_LEFT; + align = PANGO_ALIGN_LEFT; break; case GTK_JUSTIFY_CENTER: - align = PANGO_ALIGN_CENTER; + align = PANGO_ALIGN_CENTER; break; case GTK_JUSTIFY_RIGHT: - align = PANGO_ALIGN_RIGHT; + align = PANGO_ALIGN_RIGHT; break; default: - /* GTK_JUSTIFY_FILL isn't supported yet. */ - align = PANGO_ALIGN_LEFT; + /* GTK_JUSTIFY_FILL isn't supported yet. */ + align = PANGO_ALIGN_LEFT; break; - } + } pango_layout_set_alignment (text->layout, align); - text->priv->render_dirty = 1; + text->priv->render_dirty = 1; break; case PROP_CLIP_WIDTH: text->clip_width = fabs (g_value_get_double (value)); - text->priv->render_dirty = 1; + text->priv->render_dirty = 1; break; case PROP_CLIP_HEIGHT: text->clip_height = fabs (g_value_get_double (value)); - text->priv->render_dirty = 1; + text->priv->render_dirty = 1; break; case PROP_CLIP: @@ -1028,7 +1036,7 @@ gnome_canvas_text_set_property (GObject *object, break; case PROP_FILL_COLOR: { - const char *color_name; + const gchar *color_name; color_name = g_value_get_string (value); if (color_name) { @@ -1090,14 +1098,14 @@ gnome_canvas_text_set_property (GObject *object, /* Calculate text dimensions */ if (text->layout) - pango_layout_get_pixel_size (text->layout, + pango_layout_get_pixel_size (text->layout, &text->max_width, &text->height); else { text->max_width = 0; text->height = 0; } - + gnome_canvas_item_request_update (item); } @@ -1138,7 +1146,7 @@ gnome_canvas_text_get_property (GObject *object, case PROP_SIZE: case PROP_SIZE_POINTS: ensure_font (text); - + switch (param_id) { case PROP_FONT: { @@ -1146,14 +1154,14 @@ gnome_canvas_text_get_property (GObject *object, * here, we could just hand off string ownership */ gchar *str; - + str = pango_font_description_to_string (text->font_desc); g_value_set_string (value, str); g_free (str); break; } - + case PROP_FONT_DESC: g_value_set_boxed (value, text->font_desc); break; @@ -1161,29 +1169,32 @@ gnome_canvas_text_get_property (GObject *object, case PROP_FAMILY: g_value_set_string (value, pango_font_description_get_family (text->font_desc)); break; - + case PROP_STYLE: g_value_set_enum (value, pango_font_description_get_style (text->font_desc)); break; - + case PROP_VARIANT: g_value_set_enum (value, pango_font_description_get_variant (text->font_desc)); break; - + case PROP_WEIGHT: g_value_set_int (value, pango_font_description_get_weight (text->font_desc)); break; - + case PROP_STRETCH: g_value_set_enum (value, pango_font_description_get_stretch (text->font_desc)); break; - + case PROP_SIZE: g_value_set_int (value, pango_font_description_get_size (text->font_desc)); break; - + case PROP_SIZE_POINTS: - g_value_set_double (value, ((double)pango_font_description_get_size (text->font_desc)) / (double)PANGO_SCALE); + g_value_set_double ( + value, ((gdouble) + pango_font_description_get_size (text->font_desc)) / + (gdouble)PANGO_SCALE); break; } break; @@ -1195,7 +1206,8 @@ gnome_canvas_text_get_property (GObject *object, case PROP_STRETCH_SET: case PROP_SIZE_SET: { - PangoFontMask set_mask = text->font_desc ? pango_font_description_get_set_fields (text->font_desc) : 0; + PangoFontMask set_mask = text->font_desc ? + pango_font_description_get_set_fields (text->font_desc) : 0; PangoFontMask test_mask = get_property_font_set_mask (param_id); g_value_set_boolean (value, (set_mask & test_mask) != 0); @@ -1208,28 +1220,28 @@ gnome_canvas_text_get_property (GObject *object, case PROP_SCALE_SET: g_value_set_boolean (value, text->scale_set); break; - + case PROP_UNDERLINE: g_value_set_enum (value, text->underline); break; case PROP_UNDERLINE_SET: g_value_set_boolean (value, text->underline_set); break; - + case PROP_STRIKETHROUGH: g_value_set_boolean (value, text->strikethrough); break; case PROP_STRIKETHROUGH_SET: g_value_set_boolean (value, text->strike_set); break; - + case PROP_RISE: g_value_set_int (value, text->rise); break; case PROP_RISE_SET: g_value_set_boolean (value, text->rise_set); break; - + case PROP_ATTRIBUTES: g_value_set_boxed (value, text->attr_list); break; @@ -1340,14 +1352,14 @@ gnome_canvas_text_apply_attributes (GnomeCanvasText *text) attr_list = pango_attr_list_copy (text->attr_list); else attr_list = pango_attr_list_new (); - + if (text->underline_set) add_attr (attr_list, pango_attr_underline_new (text->underline)); if (text->strike_set) add_attr (attr_list, pango_attr_strikethrough_new (text->strikethrough)); if (text->rise_set) add_attr (attr_list, pango_attr_rise_new (text->rise)); - + pango_layout_set_attributes (text->layout, attr_list); pango_attr_list_unref (attr_list); } @@ -1402,10 +1414,13 @@ gnome_canvas_text_set_markup (GnomeCanvasText *textitem, /* Update handler for the text item */ static void -gnome_canvas_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_text_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { GnomeCanvasText *text; - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; text = GNOME_CANVAS_TEXT (item); @@ -1458,7 +1473,7 @@ gnome_canvas_text_unrealize (GnomeCanvasItem *item) /* Draw handler for the text item */ static void gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasText *text; GdkRectangle rect; @@ -1480,29 +1495,27 @@ gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, if (text->stipple) gnome_canvas_set_stipple_origin (item->canvas, text->gc); - gdk_draw_layout (drawable, text->gc, text->cx - x, text->cy - y, text->layout); if (text->clip) gdk_gc_set_clip_rectangle (text->gc, NULL); } - /* Render handler for the text item */ static void gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) { GnomeCanvasText *text; guint32 fg_color; - int render_x = 0, render_y = 0; /* offsets for text rendering, + gint render_x = 0, render_y = 0; /* offsets for text rendering, * for clipping rectangles */ - int x, y; - int w, h; + gint x, y; + gint w, h; guchar *dst, *src; - int src_dx, src_dy; - int i, alpha; - int bm_rows, bm_width; - + gint src_dx, src_dy; + gint i, alpha; + gint bm_rows, bm_width; + text = GNOME_CANVAS_TEXT (item); if (!text->text) @@ -1514,16 +1527,17 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) bm_rows = (text->clip) ? text->clip_cheight : text->height; bm_width = (text->clip) ? text->clip_cwidth : text->max_width; - if(text->priv->render_dirty || + if (text->priv->render_dirty || bm_rows != text->priv->bitmap.rows || - bm_width != text->priv->bitmap.width) { - if(text->priv->bitmap.buffer) { + bm_width != text->priv->bitmap.width) { + if (text->priv->bitmap.buffer) { g_free(text->priv->bitmap.buffer); } text->priv->bitmap.rows = bm_rows; text->priv->bitmap.width = bm_width; text->priv->bitmap.pitch = (text->priv->bitmap.width+3)&~3; - text->priv->bitmap.buffer = g_malloc0 (text->priv->bitmap.rows * text->priv->bitmap.pitch); + text->priv->bitmap.buffer = g_malloc0 ( + text->priv->bitmap.rows * text->priv->bitmap.pitch); text->priv->bitmap.num_grays = 256; text->priv->bitmap.pixel_mode = ft_pixel_mode_grays; @@ -1536,7 +1550,7 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) if the glyph falls in the bounding box before rasterizing it. */ - if(text->clip) { + if (text->clip) { render_x = text->cx - text->clip_cx; render_y = text->cy - text->clip_cy; } @@ -1553,16 +1567,16 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) x = text->cx - buf->rect.x0; y = text->cy - buf->rect.y0; } - + w = text->priv->bitmap.width; h = text->priv->bitmap.rows; src_dx = src_dy = 0; - + if (x + w > buf->rect.x1 - buf->rect.x0) { w = buf->rect.x1 - buf->rect.x0 - x; } - + if (y + h > buf->rect.y1 - buf->rect.y0) { h = buf->rect.y1 - buf->rect.y0 - y; } @@ -1572,13 +1586,13 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) src_dx += - x; x = 0; } - + if (y < 0) { h -= -y; src_dy += - y; y = 0; } - + dst = buf->buf + y * buf->buf_rowstride + x * 3; src = text->priv->bitmap.buffer + src_dy * text->priv->bitmap.pitch + src_dx; @@ -1596,21 +1610,21 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) dst += buf->buf_rowstride - w*3; src += text->priv->bitmap.pitch - w; } - + buf->is_bg = 0; return; } /* Point handler for the text item */ static double -gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasText *text; PangoLayoutIter *iter; - int x1, y1, x2, y2; - int dx, dy; - double dist, best; + gint x1, y1, x2, y2; + gint dx, dy; + gdouble dist, best; text = GNOME_CANVAS_TEXT (item); @@ -1626,10 +1640,10 @@ gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, iter = pango_layout_get_iter (text->layout); do { - PangoRectangle log_rect; + PangoRectangle log_rect; pango_layout_iter_get_line_extents (iter, NULL, &log_rect); - + x1 = text->cx + PANGO_PIXELS (log_rect.x); y1 = text->cy + PANGO_PIXELS (log_rect.y); x2 = x1 + PANGO_PIXELS (log_rect.width); @@ -1676,20 +1690,24 @@ gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, dist = sqrt (dx * dx + dy * dy); if (dist < best) best = dist; - + } while (pango_layout_iter_next_line(iter)); pango_layout_iter_free(iter); - + return best / item->canvas->pixels_per_unit; } /* Bounds handler for the text item */ static void -gnome_canvas_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_text_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { GnomeCanvasText *text; - double width, height; + gdouble width, height; text = GNOME_CANVAS_TEXT (item); @@ -1749,5 +1767,5 @@ gnome_canvas_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double } *x2 = *x1 + width; - *y2 = *y1 + height; + *y2 = *y1 + height; } diff --git a/libgnomecanvas/gnome-canvas-text.h b/libgnomecanvas/gnome-canvas-text.h index ed86633371..64eda6a9d4 100644 --- a/libgnomecanvas/gnome-canvas-text.h +++ b/libgnomecanvas/gnome-canvas-text.h @@ -36,13 +36,10 @@ #ifndef GNOME_CANVAS_TEXT_H #define GNOME_CANVAS_TEXT_H - #include <libgnomecanvas/gnome-canvas.h> - G_BEGIN_DECLS - /* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction. * * A clipping rectangle may be specified for the text. The rectangle is anchored at the text's anchor @@ -64,34 +61,34 @@ G_BEGIN_DECLS * text string RW The string of the text label * markup string W A Pango markup string for the text label * - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point + * x gdouble RW X coordinate of anchor point + * y gdouble RW Y coordinate of anchor point * * font string W A string describing the font - * font_desc PangoFontDescription* RW Pointer to a PangoFontDescriptor + * font_desc PangoFontDescription* RW Pointer to a PangoFontDescriptor * attributes PangoAttrList* RW Pointer to a Pango attribute list * style PangoStyle RW Pango style of font to use [*] * variant PangoVariant RW Pango variant of font to use [*] - * weight int RW Pango weight of font to use [*] + * weight gint RW Pango weight of font to use [*] * stretch PangoStretch RW Pango stretch of font to use [*] - * size int RW Size (in pixels) of font [*] - * size_points double RW Size (in points) of font - * scale double RW Ratio to scale font [*] + * size gint RW Size (in pixels) of font [*] + * size_points gdouble RW Size (in points) of font + * scale gdouble RW Ratio to scale font [*] * * anchor GtkAnchorType RW Anchor side for the text * justification GtkJustification RW Justification for multiline text - * clip_width double RW Width of clip rectangle - * clip_height double RW Height of clip rectangle + * clip_width gdouble RW Width of clip rectangle + * clip_height gdouble RW Height of clip rectangle * clip boolean RW Use clipping rectangle? - * x_offset double RW Horizontal offset distance from anchor position - * y_offset double RW Vertical offset distance from anchor position + * x_offset gdouble RW Horizontal offset distance from anchor position + * y_offset gdouble RW Vertical offset distance from anchor position * - * text_width double R Used to query the width of the rendered text - * text_height double R Used to query the rendered height of the text + * text_width gdouble R Used to query the width of the rendered text + * text_height gdouble R Used to query the rendered height of the text * * fill_color string W X color specification for text * fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor - * fill_color_rgba guint RW RGBA value used for AA color. + * fill_color_rgba guint RW RGBA value used for AA color. * fill_stipple GdkBitmap* RW Stipple pattern for filling the text */ @@ -102,7 +99,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_TEXT)) #define GNOME_CANVAS_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_TEXT, GnomeCanvasTextClass)) - typedef struct _GnomeCanvasText GnomeCanvasText; typedef struct _GnomeCanvasTextClass GnomeCanvasTextClass; @@ -115,33 +111,33 @@ struct _GnomeCanvasText { PangoAttrList *attr_list; /* Attribute list of the text (caching) */ PangoUnderline underline; gboolean strikethrough; - int rise; - double scale; - - char *text; /* Text to display */ + gint rise; + gdouble scale; + + gchar *text; /* Text to display */ GdkBitmap *stipple; /* Stipple for text */ GdkGC *gc; /* GC for drawing text */ PangoLayout *layout; /* The PangoLayout containing the text */ gulong pixel; /* Fill color */ - double x, y; /* Position at anchor */ + gdouble x, y; /* Position at anchor */ - double clip_width; /* Width of optional clip rectangle */ - double clip_height; /* Height of optional clip rectangle */ + gdouble clip_width; /* Width of optional clip rectangle */ + gdouble clip_height; /* Height of optional clip rectangle */ - double xofs, yofs; /* Text offset distance from anchor position */ + gdouble xofs, yofs; /* Text offset distance from anchor position */ - double affine[6]; /* The item -> canvas affine */ /*AA*/ + gdouble affine[6]; /* The item -> canvas affine */ /*AA*/ GtkAnchorType anchor; /* Anchor side for text */ GtkJustification justification; /* Justification for text */ - int cx, cy; /* Top-left canvas coordinates for text */ - int clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ - int clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ - int max_width; /* Maximum width of text lines */ - int height; /* Rendered text height in pixels */ + gint cx, cy; /* Top-left canvas coordinates for text */ + gint clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ + gint clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ + gint max_width; /* Maximum width of text lines */ + gint height; /* Rendered text height in pixels */ guint32 rgba; /* RGBA color for text */ /*AA*/ @@ -153,18 +149,16 @@ struct _GnomeCanvasText { guint scale_set : 1; /* Apply specified font scaling ratio? */ - GnomeCanvasTextPrivate *priv; + GnomeCanvasTextPrivate *priv; }; struct _GnomeCanvasTextClass { GnomeCanvasItemClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_text_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-util.c b/libgnomecanvas/gnome-canvas-util.c index d306292144..3df31e0766 100644 --- a/libgnomecanvas/gnome-canvas-util.c +++ b/libgnomecanvas/gnome-canvas-util.c @@ -54,15 +54,15 @@ /** * gnome_canvas_points_new: * @num_points: The number of points to allocate space for in the array. - * + * * Creates a structure that should be used to pass an array of points to * items. - * + * * Return value: A newly-created array of points. It should be filled in * by the user. **/ GnomeCanvasPoints * -gnome_canvas_points_new (int num_points) +gnome_canvas_points_new (gint num_points) { GnomeCanvasPoints *points; @@ -79,9 +79,9 @@ gnome_canvas_points_new (int num_points) /** * gnome_canvas_points_ref: * @points: A canvas points structure. - * + * * Increases the reference count of the specified points structure. - * + * * Return value: The canvas points structure itself. **/ GnomeCanvasPoints * @@ -96,7 +96,7 @@ gnome_canvas_points_ref (GnomeCanvasPoints *points) /** * gnome_canvas_points_free: * @points: A canvas points structure. - * + * * Decreases the reference count of the specified points structure. If it * reaches zero, then the structure is freed. **/ @@ -125,26 +125,26 @@ gnome_canvas_points_free (GnomeCanvasPoints *points) * @my1: The Y coordinate of the first miter point is returned here. * @mx2: The X coordinate of the second miter point is returned here. * @my2: The Y coordinate of the second miter point is returned here. - * + * * Given three points forming an angle, computes the coordinates of the inside * and outside points of the mitered corner formed by a line of a given width at * that angle. - * + * * Return value: FALSE if the angle is less than 11 degrees (this is the same * threshold as X uses. If this occurs, the return points are not modified. * Otherwise, returns TRUE. **/ -int -gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, double x3, double y3, - double width, - double *mx1, double *my1, double *mx2, double *my2) +gint +gnome_canvas_get_miter_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3, + gdouble width, + gdouble *mx1, gdouble *my1, gdouble *mx2, gdouble *my2) { - double theta1; /* angle of segment p2-p1 */ - double theta2; /* angle of segment p2-p3 */ - double theta; /* angle between line segments */ - double theta3; /* angle that bisects theta1 and theta2 and points to p1 */ - double dist; /* distance of miter points from p2 */ - double dx, dy; /* x and y offsets corresponding to dist */ + gdouble theta1; /* angle of segment p2-p1 */ + gdouble theta2; /* angle of segment p2-p3 */ + gdouble theta; /* angle between line segments */ + gdouble theta3; /* angle that bisects theta1 and theta2 and points to p1 */ + gdouble dist; /* distance of miter points from p2 */ + gdouble dx, dy; /* x and y offsets corresponding to dist */ #define ELEVEN_DEGREES (11.0 * G_PI / 180.0) @@ -203,16 +203,16 @@ gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, doubl * @by1: Y coordinate of first butt point is returned here * @bx2: X coordinate of second butt point is returned here * @by2: Y coordinate of second butt point is returned here - * + * * Computes the butt points of a line segment. **/ void -gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, - double width, int project, - double *bx1, double *by1, double *bx2, double *by2) +gnome_canvas_get_butt_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, + gdouble width, gint project, + gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2) { - double length; - double dx, dy; + gdouble length; + gdouble dx, dy; width *= 0.5; dx = x2 - x1; @@ -247,20 +247,20 @@ gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, * @num_points: Number of points in the polygon * @x: X coordinate of the point * @y: Y coordinate of the point - * + * * Computes the distance between a point and a polygon. - * + * * Return value: The distance from the point to the polygon, or zero if the * point is inside the polygon. **/ -double -gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) +gdouble +gnome_canvas_polygon_to_point (gdouble *poly, gint num_points, gdouble x, gdouble y) { - double best; - int intersections; - int i; - double *p; - double dx, dy; + gdouble best; + gint intersections; + gint i; + gdouble *p; + gdouble dx, dy; /* Iterate through all the edges in the polygon, updating best and intersections. * @@ -273,7 +273,7 @@ gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) intersections = 0; for (i = num_points, p = poly; i > 1; i--, p += 2) { - double px, py, dist; + gdouble px, py, dist; /* Compute the point on the current edge closest to the point and update the * intersection count. This must be done separately for vertical edges, horizontal @@ -311,8 +311,8 @@ gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) intersections++; } } else { - double m1, b1, m2, b2; - int lower; + gdouble m1, b1, m2, b2; + gint lower; /* Diagonal edge. Convert the edge to a line equation (y = m1*x + b1), then * compute a line perpendicular to this edge but passing through the point, @@ -385,7 +385,7 @@ void gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba) { guint32 fg_color, bg_color; - int alpha; + gint alpha; if (buf->is_bg) { bg_color = buf->bg_color; @@ -394,9 +394,9 @@ gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba) fg_color = rgba >> 8; else { /* composite over background color */ - int bg_r, bg_g, bg_b; - int fg_r, fg_g, fg_b; - int tmp; + gint bg_r, bg_g, bg_b; + gint fg_r, fg_g, fg_b; + gint tmp; bg_r = (bg_color >> 16) & 0xff; fg_r = (rgba >> 24) & 0xff; @@ -506,7 +506,7 @@ gnome_canvas_update_svp_clip (GnomeCanvas *canvas, ArtSVP **p_svp, ArtSVP *new_s /** * gnome_canvas_item_reset_bounds: * @item: A canvas item - * + * * Resets the bounding box of a canvas item to an empty rectangle. **/ void @@ -579,7 +579,7 @@ gnome_canvas_item_update_svp_clip (GnomeCanvasItem *item, ArtSVP **p_svp, ArtSVP * @svp: the svp that needs to be redrawn * * Request redraw of the svp if in aa mode, or the entire item in in xlib mode. - **/ + **/ void gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) { @@ -593,7 +593,7 @@ gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) gnome_canvas_request_redraw_uta (canvas, uta); } } else { - gnome_canvas_request_redraw (canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw (canvas, item->x1, item->y1, item->x2, item->y2); } } @@ -608,7 +608,7 @@ gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) * Sets the bbox to the new value, requesting full repaint. **/ void -gnome_canvas_update_bbox (GnomeCanvasItem *item, int x1, int y1, int x2, int y2) +gnome_canvas_update_bbox (GnomeCanvasItem *item, gint x1, gint y1, gint x2, gint y2) { gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); item->x1 = x1; @@ -628,7 +628,7 @@ void gnome_canvas_buf_ensure_buf (GnomeCanvasBuf *buf) { guchar *bufptr; - int y; + gint y; if (!buf->is_buf) { bufptr = buf->buf; diff --git a/libgnomecanvas/gnome-canvas-util.h b/libgnomecanvas/gnome-canvas-util.h index cfd32c336e..5ba0481399 100644 --- a/libgnomecanvas/gnome-canvas-util.h +++ b/libgnomecanvas/gnome-canvas-util.h @@ -39,7 +39,6 @@ #include <libart_lgpl/art_vpath.h> #include <libart_lgpl/art_svp_vpath_stroke.h> - G_BEGIN_DECLS typedef struct _GnomeCanvasPoints GnomeCanvasPoints; @@ -49,14 +48,13 @@ typedef struct _GnomeCanvasPoints GnomeCanvasPoints; * number of points, so the array is 2*num_points elements big. */ struct _GnomeCanvasPoints { - double *coords; - int num_points; - int ref_count; + gdouble *coords; + gint num_points; + gint ref_count; }; - /* Allocate a new GnomeCanvasPoints structure with enough space for the specified number of points */ -GnomeCanvasPoints *gnome_canvas_points_new (int num_points); +GnomeCanvasPoints *gnome_canvas_points_new (gint num_points); /* Increate ref count */ GnomeCanvasPoints *gnome_canvas_points_ref (GnomeCanvasPoints *points); @@ -71,9 +69,9 @@ void gnome_canvas_points_free (GnomeCanvasPoints *points); * If the angle is less than 11 degrees, then FALSE is returned and the return points are not * modified. Otherwise, TRUE is returned. */ -int gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, double x3, double y3, - double width, - double *mx1, double *my1, double *mx2, double *my2); +gint gnome_canvas_get_miter_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3, + gdouble width, + gdouble *mx1, gdouble *my1, gdouble *mx2, gdouble *my2); /* Compute the butt points of a line segment. If project is FALSE, then the results are as follows: * @@ -92,15 +90,14 @@ int gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, d * | * -------------------* (bx2, by2) */ -void gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, - double width, int project, - double *bx1, double *by1, double *bx2, double *by2); +void gnome_canvas_get_butt_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, + gdouble width, gint project, + gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2); /* Calculate the distance from a polygon to a point. The polygon's X coordinates are in the even * indices of the poly array, and the Y coordinates are in the odd indices. */ -double gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y); - +gdouble gnome_canvas_polygon_to_point (gdouble *poly, gint num_points, gdouble x, gdouble y); /* Render the svp over the buf. */ void gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba); @@ -139,7 +136,7 @@ void gnome_canvas_item_update_svp_clip (GnomeCanvasItem *item, ArtSVP **p_svp, A void gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp); /* Sets the bbox to the new value, requesting full repaint. */ -void gnome_canvas_update_bbox (GnomeCanvasItem *item, int x1, int y1, int x2, int y2); +void gnome_canvas_update_bbox (GnomeCanvasItem *item, gint x1, gint y1, gint x2, gint y2); /* Ensure that the buffer is in RGB format, suitable for compositing. */ void gnome_canvas_buf_ensure_buf (GnomeCanvasBuf *buf); diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c index d94942c8a5..f47180ff98 100644 --- a/libgnomecanvas/gnome-canvas-widget.c +++ b/libgnomecanvas/gnome-canvas-widget.c @@ -47,7 +47,6 @@ enum { PROP_SIZE_PIXELS }; - static void gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class); static void gnome_canvas_widget_init (GnomeCanvasWidget *witem); static void gnome_canvas_widget_destroy (GtkObject *object); @@ -60,21 +59,20 @@ static void gnome_canvas_widget_set_property (GObject *object, const GValue *value, GParamSpec *pspec); -static void gnome_canvas_widget_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); -static double gnome_canvas_widget_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_widget_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); +static void gnome_canvas_widget_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); +static gdouble gnome_canvas_widget_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); +static void gnome_canvas_widget_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static void gnome_canvas_widget_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); static void gnome_canvas_widget_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, - int width, int height); + gint x, gint y, + gint width, gint height); static GnomeCanvasItemClass *parent_class; - GType gnome_canvas_widget_get_type (void) { @@ -205,7 +203,7 @@ static void recalc_bounds (GnomeCanvasWidget *witem) { GnomeCanvasItem *item; - double wx, wy; + gdouble wx, wy; item = GNOME_CANVAS_ITEM (witem); @@ -299,8 +297,8 @@ gnome_canvas_widget_set_property (GObject *object, GnomeCanvasItem *item; GnomeCanvasWidget *witem; GObject *obj; - int update; - int calc_bounds; + gint update; + gint calc_bounds; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_WIDGET (object)); @@ -333,49 +331,49 @@ gnome_canvas_widget_set_property (GObject *object, break; case PROP_X: - if (witem->x != g_value_get_double (value)) + if (witem->x != g_value_get_double (value)) { - witem->x = g_value_get_double (value); + witem->x = g_value_get_double (value); calc_bounds = TRUE; } break; case PROP_Y: - if (witem->y != g_value_get_double (value)) + if (witem->y != g_value_get_double (value)) { - witem->y = g_value_get_double (value); + witem->y = g_value_get_double (value); calc_bounds = TRUE; } break; case PROP_WIDTH: - if (witem->width != fabs (g_value_get_double (value))) + if (witem->width != fabs (g_value_get_double (value))) { - witem->width = fabs (g_value_get_double (value)); + witem->width = fabs (g_value_get_double (value)); update = TRUE; } break; case PROP_HEIGHT: - if (witem->height != fabs (g_value_get_double (value))) + if (witem->height != fabs (g_value_get_double (value))) { - witem->height = fabs (g_value_get_double (value)); + witem->height = fabs (g_value_get_double (value)); update = TRUE; } break; case PROP_ANCHOR: - if (witem->anchor != g_value_get_enum (value)) + if (witem->anchor != g_value_get_enum (value)) { - witem->anchor = g_value_get_enum (value); + witem->anchor = g_value_get_enum (value); update = TRUE; } break; case PROP_SIZE_PIXELS: - if (witem->size_pixels != g_value_get_boolean (value)) + if (witem->size_pixels != g_value_get_boolean (value)) { - witem->size_pixels = g_value_get_boolean (value); + witem->size_pixels = g_value_get_boolean (value); update = TRUE; } break; @@ -441,7 +439,7 @@ gnome_canvas_widget_get_property (GObject *object, } static void -gnome_canvas_widget_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_widget_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasWidget *witem; @@ -452,11 +450,11 @@ gnome_canvas_widget_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_ if (witem->widget) { if (witem->size_pixels) { - witem->cwidth = (int) (witem->width + 0.5); - witem->cheight = (int) (witem->height + 0.5); + witem->cwidth = (gint) (witem->width + 0.5); + witem->cheight = (gint) (witem->height + 0.5); } else { - witem->cwidth = (int) (witem->width * item->canvas->pixels_per_unit + 0.5); - witem->cheight = (int) (witem->height * item->canvas->pixels_per_unit + 0.5); + witem->cwidth = (gint) (witem->width * item->canvas->pixels_per_unit + 0.5); + witem->cheight = (gint) (witem->height * item->canvas->pixels_per_unit + 0.5); } gtk_widget_set_size_request (witem->widget, witem->cwidth, witem->cheight); @@ -477,7 +475,7 @@ gnome_canvas_widget_render (GnomeCanvasItem *item, witem = GNOME_CANVAS_WIDGET (item); - if (witem->widget) + if (witem->widget) gtk_widget_queue_draw (witem->widget); #endif @@ -486,8 +484,8 @@ gnome_canvas_widget_render (GnomeCanvasItem *item, static void gnome_canvas_widget_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, - int width, int height) + gint x, gint y, + gint width, gint height) { #if 0 GnomeCanvasWidget *witem; @@ -500,12 +498,12 @@ gnome_canvas_widget_draw (GnomeCanvasItem *item, } static double -gnome_canvas_widget_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_widget_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasWidget *witem; - double x1, y1, x2, y2; - double dx, dy; + gdouble x1, y1, x2, y2; + gdouble dx, dy; witem = GNOME_CANVAS_WIDGET (item); @@ -541,7 +539,7 @@ gnome_canvas_widget_point (GnomeCanvasItem *item, double x, double y, } static void -gnome_canvas_widget_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_widget_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) { GnomeCanvasWidget *witem; diff --git a/libgnomecanvas/gnome-canvas-widget.h b/libgnomecanvas/gnome-canvas-widget.h index f7517c3832..32514aad6e 100644 --- a/libgnomecanvas/gnome-canvas-widget.h +++ b/libgnomecanvas/gnome-canvas-widget.h @@ -34,23 +34,20 @@ #ifndef GNOME_CANVAS_WIDGET_H #define GNOME_CANVAS_WIDGET_H - #include <libgnomecanvas/gnome-canvas.h> - G_BEGIN_DECLS - /* Widget item for canvas. The widget is positioned with respect to an anchor point. * The following object arguments are available: * * name type read/write description * ------------------------------------------------------------------------------------------ * widget GtkWidget* RW Pointer to the widget - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point - * width double RW Width of widget (see below) - * height double RW Height of widget (see below) + * x gdouble RW X coordinate of anchor point + * y gdouble RW Y coordinate of anchor point + * width gdouble RW Width of widget (see below) + * height gdouble RW Height of widget (see below) * anchor GtkAnchorType RW Anchor side for widget * size_pixels boolean RW Specifies whether the widget size * is specified in pixels or canvas units. @@ -59,7 +56,6 @@ G_BEGIN_DECLS * Otherwise, it will be scaled. */ - #define GNOME_TYPE_CANVAS_WIDGET (gnome_canvas_widget_get_type ()) #define GNOME_CANVAS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_WIDGET, GnomeCanvasWidget)) #define GNOME_CANVAS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_WIDGET, GnomeCanvasWidgetClass)) @@ -67,7 +63,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_WIDGET)) #define GNOME_CANVAS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_WIDGET, GnomeCanvasWidgetClass)) - typedef struct _GnomeCanvasWidget GnomeCanvasWidget; typedef struct _GnomeCanvasWidgetClass GnomeCanvasWidgetClass; @@ -76,12 +71,12 @@ struct _GnomeCanvasWidget { GtkWidget *widget; /* The child widget */ - double x, y; /* Position at anchor */ - double width, height; /* Dimensions of widget */ + gdouble x, y; /* Position at anchor */ + gdouble width, height; /* Dimensions of widget */ GtkAnchorType anchor; /* Anchor side for widget */ - int cx, cy; /* Top-left canvas coordinates for widget */ - int cwidth, cheight; /* Size of widget in pixels */ + gint cx, cy; /* Top-left canvas coordinates for widget */ + gint cwidth, cheight; /* Size of widget in pixels */ guint destroy_id; /* Signal connection id for destruction of child widget */ @@ -93,11 +88,9 @@ struct _GnomeCanvasWidgetClass { GnomeCanvasItemClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_widget_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index 4f8f24b7dc..1ca6e5f32f 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -26,8 +26,9 @@ /* * GnomeCanvas widget - Tk-like canvas widget for Gnome * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is - * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. + * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas + * widget. Tk is copyrighted by the Regents of the University of California, + * Sun Microsystems, and other parties. * * * Authors: Federico Mena <federico@nuclecu.unam.mx> @@ -37,17 +38,20 @@ /* * TO-DO list for the canvas: * - * - Allow to specify whether GnomeCanvasImage sizes are in units or pixels (scale or don't scale). + * - Allow to specify whether GnomeCanvasImage sizes are in units or pixels + * (scale or don't scale). * - * - Implement a flag for gnome_canvas_item_reparent() that tells the function to keep the item - * visually in the same place, that is, to keep it in the same place with respect to the canvas - * origin. + * - Implement a flag for gnome_canvas_item_reparent() that tells the function + * to keep the item visually in the same place, that is, to keep it in the + * same place with respect to the canvas origin. * * - GC put functions for items. * * - Widget item (finish it). * - * - GList *gnome_canvas_gimme_all_items_contained_in_this_area (GnomeCanvas *canvas, Rectangle area); + * - GList * + * gnome_canvas_gimme_all_items_contained_in_this_area (GnomeCanvas *canvas, + * Rectangle area); * * - Retrofit all the primitive items with microtile support. * @@ -95,7 +99,6 @@ /* We must run our idle update handler *before* GDK wants to redraw. */ #define CANVAS_IDLE_PRIORITY (GDK_PRIORITY_REDRAW - 5) - static void gnome_canvas_request_update (GnomeCanvas *canvas); static void group_add (GnomeCanvasGroup *group, GnomeCanvasItem *item); @@ -103,13 +106,18 @@ static void group_remove (GnomeCanvasGroup *group, GnomeCanvasItem *item); static void add_idle (GnomeCanvas *canvas); - /*** GnomeCanvasItem ***/ /* Some convenience stuff */ -#define GCI_UPDATE_MASK (GNOME_CANVAS_UPDATE_REQUESTED | GNOME_CANVAS_UPDATE_AFFINE | GNOME_CANVAS_UPDATE_CLIP | GNOME_CANVAS_UPDATE_VISIBILITY) +#define GCI_UPDATE_MASK \ + (GNOME_CANVAS_UPDATE_REQUESTED | \ + GNOME_CANVAS_UPDATE_AFFINE | \ + GNOME_CANVAS_UPDATE_CLIP | \ + GNOME_CANVAS_UPDATE_VISIBILITY) #define GCI_EPSILON 1e-18 -#define GCI_PRINT_MATRIX(s,a) g_print ("%s %g %g %g %g %g %g\n", s, (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]) +#define GCI_PRINT_MATRIX(s,a) \ + g_print ("%s %g %g %g %g %g %g\n", \ + s, (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]) enum { ITEM_PROP_0, @@ -123,13 +131,12 @@ enum { static void gnome_canvas_item_class_init (GnomeCanvasItemClass *class); static void gnome_canvas_item_init (GnomeCanvasItem *item); -static int emit_event (GnomeCanvas *canvas, GdkEvent *event); +static gint emit_event (GnomeCanvas *canvas, GdkEvent *event); static guint item_signals[ITEM_LAST_SIGNAL]; static GtkObjectClass *item_parent_class; - /** * gnome_canvas_item_get_type: * @@ -191,7 +198,9 @@ gnome_canvas_item_init (GnomeCanvasItem *item) * Return value: The newly-created item. **/ GnomeCanvasItem * -gnome_canvas_item_new (GnomeCanvasGroup *parent, GType type, const gchar *first_arg_name, ...) +gnome_canvas_item_new (GnomeCanvasGroup *parent, + GType type, + const gchar *first_arg_name, ...) { GnomeCanvasItem *item; va_list args; @@ -208,7 +217,6 @@ gnome_canvas_item_new (GnomeCanvasGroup *parent, GType type, const gchar *first_ return item; } - /* Performs post-creation operations on a canvas item (adding it to its parent * group, etc.) */ @@ -217,7 +225,8 @@ item_post_create_setup (GnomeCanvasItem *item) { group_add (GNOME_CANVAS_GROUP (item->parent), item); - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); item->canvas->need_repick = TRUE; } @@ -295,13 +304,14 @@ gnome_canvas_item_construct (GnomeCanvasItem *item, GnomeCanvasGroup *parent, item_post_create_setup (item); } - /* If the item is visible, requests a redraw of it. */ static void redraw_if_visible (GnomeCanvasItem *item) { if (item->flags & GNOME_CANVAS_ITEM_VISIBLE) - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2 + 1, item->y2 + 1); } /* Standard object dispose function for canvas items */ @@ -389,7 +399,10 @@ gnome_canvas_item_unmap (GnomeCanvasItem *item) /* Update handler for canvas items */ static void -gnome_canvas_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_item_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { item->flags &= ~GNOME_CANVAS_ITEM_NEED_UPDATE; item->flags &= ~GNOME_CANVAS_ITEM_NEED_AFFINE; @@ -413,13 +426,16 @@ gnome_canvas_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_pa */ static void -gnome_canvas_item_invoke_update (GnomeCanvasItem *item, double *p2cpx, ArtSVP *clip_path, int flags) +gnome_canvas_item_invoke_update (GnomeCanvasItem *item, + gdouble *p2cpx, + ArtSVP *clip_path, + gint flags) { - int child_flags; + gint child_flags; gdouble i2cpx[6]; #ifdef HACKISH_AFFINE - double i2w[6], w2c[6], i2c[6]; + gdouble i2w[6], w2c[6], i2c[6]; #endif child_flags = flags; @@ -481,7 +497,12 @@ gnome_canvas_item_invoke_update (GnomeCanvasItem *item, double *p2cpx, ArtSVP *c */ static double -gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_item_invoke_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, + GnomeCanvasItem **actual_item) { /* Calculate x & y in item local coordinates */ @@ -501,7 +522,7 @@ gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int c } #ifdef HACKISH_AFFINE - double i2w[6], w2c[6], i2c[6], c2i[6]; + gdouble i2w[6], w2c[6], i2c[6], c2i[6]; ArtPoint c, i; #endif @@ -526,11 +547,12 @@ gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int c /** * gnome_canvas_item_set: * @item: A canvas item. - * @first_arg_name: The list of object argument name/value pairs used to configure the item. + * @first_arg_name: The list of object argument name/value pairs used to + * configure the item. * @Varargs: * - * Configures a canvas item. The arguments in the item are set to the specified - * values, and the item is repainted as appropriate. + * Configures a canvas item. The arguments in the item are set to the + * specified values, and the item is repainted as appropriate. **/ void gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) @@ -542,7 +564,6 @@ gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) va_end (args); } - /** * gnome_canvas_item_set_valist: * @item: A canvas item. @@ -553,21 +574,17 @@ gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) * values, and the item is repainted as appropriate. **/ void -gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name, va_list args) +gnome_canvas_item_set_valist (GnomeCanvasItem *item, + const gchar *first_arg_name, + va_list args) { g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); g_object_set_valist (G_OBJECT (item), first_arg_name, args); -#if 0 - /* I commented this out, because item implementations have to schedule update/redraw */ - redraw_if_visible (item); -#endif - item->canvas->need_repick = TRUE; } - /** * gnome_canvas_item_affine_relative: * @item: A canvas item. @@ -578,7 +595,7 @@ gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name **/ #define GCIAR_EPSILON 1e-6 void -gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6]) +gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const gdouble affine[6]) { gdouble i2p[6]; @@ -615,7 +632,7 @@ gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6] * matrix. NULL affine is treated as identity. **/ void -gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double i2p[6]) +gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const gdouble i2p[6]) { g_return_if_fail (item != NULL); g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -656,7 +673,6 @@ gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double i2p[6]) item->canvas->need_repick = TRUE; } - /** * gnome_canvas_item_move: * @item: A canvas item. @@ -669,9 +685,9 @@ gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double i2p[6]) * most probably does not do, what you want. **/ void -gnome_canvas_item_move (GnomeCanvasItem *item, double dx, double dy) +gnome_canvas_item_move (GnomeCanvasItem *item, gdouble dx, gdouble dy) { - double translate[6]; + gdouble translate[6]; g_return_if_fail (item != NULL); g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -733,7 +749,6 @@ put_item_after (GList *link, GList *before) return TRUE; } - /** * gnome_canvas_item_raise: * @item: A canvas item. @@ -744,7 +759,7 @@ put_item_after (GList *link, GList *before) * stack, then the item is put at the top. **/ void -gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) +gnome_canvas_item_raise (GnomeCanvasItem *item, gint positions) { GList *link, *before; GnomeCanvasGroup *parent; @@ -771,7 +786,6 @@ gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) } } - /** * gnome_canvas_item_lower: * @item: A canvas item. @@ -782,7 +796,7 @@ gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) * stack, then the item is put at the bottom. **/ void -gnome_canvas_item_lower (GnomeCanvasItem *item, int positions) +gnome_canvas_item_lower (GnomeCanvasItem *item, gint positions) { GList *link, *before; GnomeCanvasGroup *parent; @@ -809,7 +823,6 @@ gnome_canvas_item_lower (GnomeCanvasItem *item, int positions) } } - /** * gnome_canvas_item_raise_to_top: * @item: A canvas item. @@ -837,7 +850,6 @@ gnome_canvas_item_raise_to_top (GnomeCanvasItem *item) } } - /** * gnome_canvas_item_lower_to_bottom: * @item: A canvas item. @@ -865,7 +877,6 @@ gnome_canvas_item_lower_to_bottom (GnomeCanvasItem *item) } } - /** * gnome_canvas_item_show: * @item: A canvas item. @@ -879,12 +890,13 @@ gnome_canvas_item_show (GnomeCanvasItem *item) if (!(item->flags & GNOME_CANVAS_ITEM_VISIBLE)) { item->flags |= GNOME_CANVAS_ITEM_VISIBLE; - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2 + 1, item->y2 + 1); item->canvas->need_repick = TRUE; } } - /** * gnome_canvas_item_hide: * @item: A canvas item. @@ -899,12 +911,13 @@ gnome_canvas_item_hide (GnomeCanvasItem *item) if (item->flags & GNOME_CANVAS_ITEM_VISIBLE) { item->flags &= ~GNOME_CANVAS_ITEM_VISIBLE; - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2 + 1, item->y2 + 1); item->canvas->need_repick = TRUE; } } - /** * gnome_canvas_item_grab: * @item: A canvas item. @@ -918,20 +931,26 @@ gnome_canvas_item_hide (GnomeCanvasItem *item) * If @cursor is not NULL, then that cursor is used while the grab is active. * The @etime parameter is the timestamp required for grabbing the mouse. * - * Return value: If an item was already grabbed, it returns %GDK_GRAB_ALREADY_GRABBED. If - * the specified item was hidden by calling gnome_canvas_item_hide(), then it - * returns %GDK_GRAB_NOT_VIEWABLE. Else, it returns the result of calling - * gdk_pointer_grab(). + * Return value: If an item was already grabbed, it returns + * %GDK_GRAB_ALREADY_GRABBED. If the specified item was hidden by calling + * gnome_canvas_item_hide(), then it returns %GDK_GRAB_NOT_VIEWABLE. Else, + * it returns the result of calling gdk_pointer_grab(). **/ -int -gnome_canvas_item_grab (GnomeCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime) +gint +gnome_canvas_item_grab (GnomeCanvasItem *item, + guint event_mask, + GdkCursor *cursor, + guint32 etime) { GtkLayout *layout; GdkWindow *bin_window; - int retval; + gint retval; - g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE); - g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), GDK_GRAB_NOT_VIEWABLE); + g_return_val_if_fail ( + GNOME_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE); + g_return_val_if_fail ( + gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), + GDK_GRAB_NOT_VIEWABLE); if (item->canvas->grabbed_item) return GDK_GRAB_ALREADY_GRABBED; @@ -959,7 +978,6 @@ gnome_canvas_item_grab (GnomeCanvasItem *item, guint event_mask, GdkCursor *curs return retval; } - /** * gnome_canvas_item_ungrab: * @item: A canvas item that holds a grab. @@ -981,7 +999,6 @@ gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime) gdk_pointer_ungrab (etime); } - /** * gnome_canvas_item_i2w_affine: * @item: A canvas item @@ -991,7 +1008,7 @@ gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime) * world coordinates. **/ void -gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]) +gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, gdouble affine[6]) { g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); g_return_if_fail (affine != NULL); @@ -1022,9 +1039,9 @@ gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]) * coordinates. **/ void -gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) +gnome_canvas_item_w2i (GnomeCanvasItem *item, gdouble *x, gdouble *y) { - double affine[6], inv[6]; + gdouble affine[6], inv[6]; ArtPoint w, i; g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -1040,7 +1057,6 @@ gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) *y = i.y; } - /** * gnome_canvas_item_i2w: * @item: A canvas item. @@ -1051,9 +1067,9 @@ gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) * coordinates. **/ void -gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y) +gnome_canvas_item_i2w (GnomeCanvasItem *item, gdouble *x, gdouble *y) { - double affine[6]; + gdouble affine[6]; ArtPoint w, i; g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -1077,9 +1093,9 @@ gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y) * canvas pixel coordinates. **/ void -gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]) +gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, gdouble affine[6]) { - double i2w[6], w2c[6]; + gdouble i2w[6], w2c[6]; gnome_canvas_item_i2w_affine (item, i2w); gnome_canvas_w2c_affine (item->canvas, w2c); @@ -1087,7 +1103,7 @@ gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]) } /* Returns whether the item is an inferior of or is equal to the parent. */ -static int +static gint is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) { for (; item; item = item->parent) @@ -1175,23 +1191,22 @@ gnome_canvas_item_grab_focus (GnomeCanvasItem *item) item->canvas->focused_item = item; gtk_widget_grab_focus (GTK_WIDGET (item->canvas)); - if (focused_item) { + if (focused_item) { GtkLayout *layout; GdkWindow *bin_window; layout = GTK_LAYOUT (item->canvas); bin_window = gtk_layout_get_bin_window (layout); - ev.focus_change.type = GDK_FOCUS_CHANGE; + ev.focus_change.type = GDK_FOCUS_CHANGE; ev.focus_change.window = bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = TRUE; + ev.focus_change.send_event = FALSE; + ev.focus_change.in = TRUE; - emit_event (item->canvas, &ev); - } + emit_event (item->canvas, &ev); + } } - /** * gnome_canvas_item_get_bounds: * @item: A canvas item. @@ -1204,13 +1219,17 @@ gnome_canvas_item_grab_focus (GnomeCanvasItem *item) * coordinate system of the item's parent. **/ void -gnome_canvas_item_get_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_item_get_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { - double tx1, ty1, tx2, ty2; + gdouble tx1, ty1, tx2, ty2; ArtPoint p1, p2, p3, p4; ArtPoint q1, q2, q3, q4; - double min_x1, min_y1, min_x2, min_y2; - double max_x1, max_y1, max_x2, max_y2; + gdouble min_x1, min_y1, min_x2, min_y2; + gdouble max_x1, max_y1, max_x2, max_y2; g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -1292,7 +1311,6 @@ gnome_canvas_item_get_bounds (GnomeCanvasItem *item, double *x1, double *y1, dou *y2 = ty2; } - /** * gnome_canvas_item_request_update * @item: A canvas item. @@ -1319,17 +1337,15 @@ gnome_canvas_item_request_update (GnomeCanvasItem *item) /*** GnomeCanvasGroup ***/ - enum { GROUP_PROP_0, GROUP_PROP_X, GROUP_PROP_Y }; - static void gnome_canvas_group_class_init (GnomeCanvasGroupClass *class); static void gnome_canvas_group_init (GnomeCanvasGroup *group); -static void gnome_canvas_group_set_property(GObject *object, +static void gnome_canvas_group_set_property(GObject *object, guint param_id, const GValue *value, GParamSpec *pspec); @@ -1340,26 +1356,28 @@ static void gnome_canvas_group_get_property(GObject *object, static void gnome_canvas_group_destroy (GtkObject *object); -static void gnome_canvas_group_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_group_update (GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_group_realize (GnomeCanvasItem *item); static void gnome_canvas_group_unrealize (GnomeCanvasItem *item); static void gnome_canvas_group_map (GnomeCanvasItem *item); static void gnome_canvas_group_unmap (GnomeCanvasItem *item); -static void gnome_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, +static void gnome_canvas_group_draw (GnomeCanvasItem *item, + GdkDrawable *drawable, + gint x, gint y, + gint width, gint height); +static gdouble gnome_canvas_group_point (GnomeCanvasItem *item, + gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_group_bounds (GnomeCanvasItem *item, double *x1, double *y1, - double *x2, double *y2); +static void gnome_canvas_group_bounds (GnomeCanvasItem *item, + gdouble *x1, gdouble *y1, + gdouble *x2, gdouble *y2); static void gnome_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); - static GnomeCanvasItemClass *group_parent_class; - /** * gnome_canvas_group_get_type: * @@ -1387,8 +1405,9 @@ gnome_canvas_group_get_type (void) NULL /* value_table */ }; - canvas_group_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasGroup", - &object_info, 0); + canvas_group_type = g_type_register_static ( + GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasGroup", + &object_info, 0); } return canvas_group_type; @@ -1450,7 +1469,7 @@ gnome_canvas_group_init (GnomeCanvasGroup *group) } /* Translate handler for canvas groups */ -static double * +static gdouble * gnome_canvas_ensure_translate (GnomeCanvasItem *item) { if (item->xform == NULL) { @@ -1472,7 +1491,7 @@ gnome_canvas_group_set_property (GObject *gobject, guint param_id, const GValue *value, GParamSpec *pspec) { GnomeCanvasItem *item; - double *xlat; + gdouble *xlat; g_return_if_fail (GNOME_IS_CANVAS_GROUP (gobject)); @@ -1552,7 +1571,10 @@ gnome_canvas_group_destroy (GtkObject *object) /* Update handler for canvas groups */ static void -gnome_canvas_group_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_group_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { GnomeCanvasGroup *group; GList *list; @@ -1668,7 +1690,7 @@ gnome_canvas_group_unmap (GnomeCanvasItem *item) /* Draw handler for canvas groups */ static void gnome_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasGroup *group; GList *list; @@ -1697,16 +1719,20 @@ gnome_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable, /* Point handler for canvas groups */ static double -gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) +gnome_canvas_group_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, + GnomeCanvasItem **actual_item) { GnomeCanvasGroup *group; GList *list; GnomeCanvasItem *child, *point_item; - int x1, y1, x2, y2; - double gx, gy; - double dist, best; - int has_point; + gint x1, y1, x2, y2; + gdouble gx, gy; + gdouble dist, best; + gint has_point; group = GNOME_CANVAS_GROUP (item); @@ -1740,7 +1766,7 @@ gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, int cx, int if (has_point && point_item - && ((int) (dist * item->canvas->pixels_per_unit + 0.5) + && ((gint) (dist * item->canvas->pixels_per_unit + 0.5) <= item->canvas->close_enough)) { best = dist; *actual_item = point_item; @@ -1752,14 +1778,18 @@ gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, int cx, int /* Bounds handler for canvas groups */ static void -gnome_canvas_group_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_group_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { GnomeCanvasGroup *group; GnomeCanvasItem *child; GList *list; - double tx1, ty1, tx2, ty2; - double minx, miny, maxx, maxy; - int set; + gdouble tx1, ty1, tx2, ty2; + gdouble minx, miny, maxx, maxy; + gint set; group = GNOME_CANVAS_GROUP (item); @@ -1900,10 +1930,8 @@ group_remove (GnomeCanvasGroup *group, GnomeCanvasItem *item) } } - /*** GnomeCanvas ***/ - enum { DRAW_BACKGROUND, RENDER_BACKGROUND, @@ -1936,11 +1964,10 @@ static gint gnome_canvas_focus_out (GtkWidget *widget, static void gnome_canvas_request_update_real (GnomeCanvas *canvas); static void gnome_canvas_draw_background (GnomeCanvas *canvas, GdkDrawable *drawable, - int x, - int y, - int width, - int height); - + gint x, + gint y, + gint width, + gint height); static GtkLayoutClass *canvas_parent_class; @@ -1986,7 +2013,7 @@ gnome_canvas_get_type (void) } static void -gnome_canvas_get_property (GObject *object, +gnome_canvas_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) @@ -2005,7 +2032,7 @@ gnome_canvas_get_property (GObject *object, } static void -gnome_canvas_set_property (GObject *object, +gnome_canvas_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) @@ -2071,7 +2098,7 @@ gnome_canvas_class_init (GnomeCanvasClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, PROP_FOCUSED_ITEM, - g_param_spec_object ("focused_item", NULL, NULL, + g_param_spec_object ("focused_item", NULL, NULL, GNOME_TYPE_CANVAS_ITEM, (G_PARAM_READABLE | G_PARAM_WRITABLE))); @@ -2143,12 +2170,13 @@ gnome_canvas_init (GnomeCanvas *canvas) gtk_layout_set_hadjustment (GTK_LAYOUT (canvas), NULL); gtk_layout_set_vadjustment (GTK_LAYOUT (canvas), NULL); - /* Disable the gtk+ double buffering since the canvas uses it's own. */ + /* Disable the gtk+ gdouble buffering since the canvas uses it's own. */ gtk_widget_set_double_buffered (GTK_WIDGET (canvas), FALSE); - + /* Create the root item as a special case */ - canvas->root = GNOME_CANVAS_ITEM (g_object_new (gnome_canvas_group_get_type (), NULL)); + canvas->root = GNOME_CANVAS_ITEM ( + g_object_new (gnome_canvas_group_get_type (), NULL)); canvas->root->canvas = canvas; g_object_ref_sink (canvas->root); @@ -2242,7 +2270,7 @@ gnome_canvas_new (void) /** * gnome_canvas_new_aa: * - * Creates a new empty canvas in antialiased mode. + * Creates a new empty canvas in antialiased mode. * * Return value: A newly-created antialiased canvas. **/ @@ -2367,7 +2395,7 @@ gnome_canvas_unrealize (GtkWidget *widget) * keep as much as possible of the canvas scrolling region in view. */ static void -scroll_to (GnomeCanvas *canvas, int cx, int cy) +scroll_to (GnomeCanvas *canvas, gint cx, gint cy) { GtkWidget *widget; GtkLayout *layout; @@ -2375,10 +2403,10 @@ scroll_to (GnomeCanvas *canvas, int cx, int cy) GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; guint layout_width, layout_height; - int scroll_width, scroll_height; - int right_limit, bottom_limit; - int old_zoom_xofs, old_zoom_yofs; - int canvas_width, canvas_height; + gint scroll_width, scroll_height; + gint right_limit, bottom_limit; + gint old_zoom_xofs, old_zoom_yofs; + gint canvas_width, canvas_height; widget = GTK_WIDGET (canvas); gtk_widget_get_allocation (widget, &allocation); @@ -2391,10 +2419,12 @@ scroll_to (GnomeCanvas *canvas, int cx, int cy) canvas_width = allocation.width; canvas_height = allocation.height; - scroll_width = floor ((canvas->scroll_x2 - canvas->scroll_x1) * canvas->pixels_per_unit - + 0.5); - scroll_height = floor ((canvas->scroll_y2 - canvas->scroll_y1) * canvas->pixels_per_unit - + 0.5); + scroll_width = + floor ((canvas->scroll_x2 - canvas->scroll_x1) * + canvas->pixels_per_unit + 0.5); + scroll_height = + floor ((canvas->scroll_y2 - canvas->scroll_y1) * + canvas->pixels_per_unit + 0.5); right_limit = scroll_width - canvas_width; bottom_limit = scroll_height - canvas_height; @@ -2455,8 +2485,8 @@ scroll_to (GnomeCanvas *canvas, int cx, int cy) if (vadjustment) gtk_adjustment_set_value (vadjustment, cy); - if ((scroll_width != (int) layout_width) - || (scroll_height != (int) layout_height)) + if ((scroll_width != (gint) layout_width) + || (scroll_height != (gint) layout_height)) gtk_layout_set_size (GTK_LAYOUT (canvas), scroll_width, scroll_height); } @@ -2501,7 +2531,7 @@ gnome_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation) * item, or focused item, as appropriate. */ -static int +static gint emit_event (GnomeCanvas *canvas, GdkEvent *event) { GdkEvent *ev; @@ -2617,7 +2647,7 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) g_signal_emit (item, item_signals[ITEM_EVENT], 0, ev, &finished); - + parent = item->parent; g_object_unref (G_OBJECT (item)); @@ -2632,13 +2662,13 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) /* Re-picks the current item in the canvas, based on the event's coordinates. * Also emits enter/leave events for items as appropriate. */ -static int +static gint pick_current_item (GnomeCanvas *canvas, GdkEvent *event) { - int button_down; - double x, y; - int cx, cy; - int retval; + gint button_down; + gdouble x, y; + gint cx, cy; + gint retval; retval = FALSE; @@ -2707,8 +2737,8 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event) /* canvas pixel coords */ - cx = (int) (x + 0.5); - cy = (int) (y + 0.5); + cx = (gint) (x + 0.5); + cy = (gint) (y + 0.5); /* world coords */ @@ -2777,8 +2807,8 @@ gnome_canvas_button (GtkWidget *widget, GdkEventButton *event) GnomeCanvas *canvas; GtkLayout *layout; GdkWindow *bin_window; - int mask; - int retval; + gint mask; + gint retval; g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); @@ -2878,12 +2908,12 @@ static gboolean gnome_canvas_key (GtkWidget *widget, GdkEventKey *event) { GnomeCanvas *canvas; - + g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); canvas = GNOME_CANVAS (widget); - + if (!emit_event (canvas, (GdkEvent *) event)) { GtkWidgetClass *widget_class; @@ -2903,7 +2933,6 @@ gnome_canvas_key (GtkWidget *widget, GdkEventKey *event) return TRUE; } - /* Crossing event handler for the canvas */ static gint gnome_canvas_crossing (GtkWidget *widget, GdkEventCrossing *event) @@ -3031,7 +3060,9 @@ gnome_canvas_paint_rect (GnomeCanvas *canvas, gint x0, gint y0, gint x1, gint y1 buf.rect.y1 = draw_y2; style = gtk_widget_get_style (widget); color = &style->bg[GTK_STATE_NORMAL]; - buf.bg_color = (((color->red & 0xff00) << 8) | (color->green & 0xff00) | (color->blue >> 8)); + buf.bg_color = + (((color->red & 0xff00) << 8) | + (color->green & 0xff00) | (color->blue >> 8)); buf.is_bg = 1; buf.is_buf = 0; @@ -3104,7 +3135,7 @@ gnome_canvas_expose (GtkWidget *widget, GdkEventExpose *event) GdkWindow *bin_window; GdkRectangle *rects; gint n_rects; - int i; + gint i; canvas = GNOME_CANVAS (widget); @@ -3225,7 +3256,7 @@ paint (GnomeCanvas *canvas) static void gnome_canvas_draw_background (GnomeCanvas *canvas, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GtkStyle *style; @@ -3317,7 +3348,7 @@ add_idle (GnomeCanvas *canvas) canvas, NULL); -/* canvas->idle_id = gtk_idle_add (idle_handler, canvas); */ +/* canvas->idle_id = gtk_idle_add (idle_handler, canvas); */ } /** @@ -3336,7 +3367,6 @@ gnome_canvas_root (GnomeCanvas *canvas) return GNOME_CANVAS_GROUP (canvas->root); } - /** * gnome_canvas_set_scroll_region: * @canvas: A canvas. @@ -3350,15 +3380,19 @@ gnome_canvas_root (GnomeCanvas *canvas) * is adjusted as appropriate to display as much of the new region as possible. **/ void -gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, double x2, double y2) +gnome_canvas_set_scroll_region (GnomeCanvas *canvas, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) { GtkLayout *layout; GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; gdouble hadjustment_value; gdouble vadjustment_value; - double wxofs, wyofs; - int xofs, yofs; + gdouble wxofs, wyofs; + gint xofs, yofs; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3398,7 +3432,6 @@ gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, doubl #endif } - /** * gnome_canvas_get_scroll_region: * @canvas: A canvas. @@ -3410,7 +3443,11 @@ gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, doubl * Queries the scrolling region of a canvas. **/ void -gnome_canvas_get_scroll_region (GnomeCanvas *canvas, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_get_scroll_region (GnomeCanvas *canvas, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3432,14 +3469,15 @@ gnome_canvas_get_scroll_region (GnomeCanvas *canvas, double *x1, double *y1, dou * @canvas: A canvas. * @center_scroll_region: Whether to center the scrolling region in the canvas * window when it is smaller than the canvas' allocation. - * + * * When the scrolling region of the canvas is smaller than the canvas window, * e.g. the allocation of the canvas, it can be either centered on the window * or simply made to be on the upper-left corner on the window. This function * lets you configure this property. **/ void -gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scroll_region) +gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, + gboolean center_scroll_region) { GtkLayout *layout; GtkAdjustment *hadjustment; @@ -3464,10 +3502,10 @@ gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scro /** * gnome_canvas_get_center_scroll_region: * @canvas: A canvas. - * + * * Returns whether the canvas is set to center the scrolling region in the window * if the former is smaller than the canvas' allocation. - * + * * Return value: Whether the scroll region is being centered in the canvas window. **/ gboolean @@ -3495,14 +3533,14 @@ gnome_canvas_get_center_scroll_region (GnomeCanvas *canvas) * window is used as the anchor point. **/ void -gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) +gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, gdouble n) { GtkLayout *layout; GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; - double ax, ay; - int x1, y1; - int anchor_x, anchor_y; + gdouble ax, ay; + gint x1, y1; + gint anchor_x, anchor_y; g_return_if_fail (GNOME_IS_CANVAS (canvas)); g_return_if_fail (n > GNOME_CANVAS_EPSILON); @@ -3522,17 +3560,21 @@ gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) anchor_x = anchor_y = 0; /* Find the coordinates of the anchor point in units. */ - if(hadjustment) { + if (hadjustment) { gdouble value = gtk_adjustment_get_value (hadjustment); - ax = (value + anchor_x) / canvas->pixels_per_unit + canvas->scroll_x1 + canvas->zoom_xofs; + ax = (value + anchor_x) / canvas->pixels_per_unit + + canvas->scroll_x1 + canvas->zoom_xofs; } else { - ax = (0.0 + anchor_x) / canvas->pixels_per_unit + canvas->scroll_x1 + canvas->zoom_xofs; + ax = (0.0 + anchor_x) / canvas->pixels_per_unit + + canvas->scroll_x1 + canvas->zoom_xofs; } - if(vadjustment) { + if (vadjustment) { gdouble value = gtk_adjustment_get_value (vadjustment); - ay = (value + anchor_y) / canvas->pixels_per_unit + canvas->scroll_y1 + canvas->zoom_yofs; + ay = (value + anchor_y) / canvas->pixels_per_unit + + canvas->scroll_y1 + canvas->zoom_yofs; } else { - ay = (0.0 + anchor_y) / canvas->pixels_per_unit + canvas->scroll_y1 + canvas->zoom_yofs; + ay = (0.0 + anchor_y) / canvas->pixels_per_unit + + canvas->scroll_y1 + canvas->zoom_yofs; } /* Now calculate the new offset of the upper left corner. */ @@ -3563,7 +3605,7 @@ gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) * scrollbars to the canvas layout's scrolling adjusments. **/ void -gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy) +gnome_canvas_scroll_to (GnomeCanvas *canvas, gint cx, gint cy) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3580,7 +3622,7 @@ gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy) * pixel units. **/ void -gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, int *cx, int *cy) +gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, gint *cx, gint *cy) { GtkLayout *layout; GtkAdjustment *adjustment; @@ -3637,18 +3679,18 @@ gnome_canvas_update_now (GnomeCanvas *canvas) * coordinates. **/ GnomeCanvasItem * -gnome_canvas_get_item_at (GnomeCanvas *canvas, double x, double y) +gnome_canvas_get_item_at (GnomeCanvas *canvas, gdouble x, gdouble y) { GnomeCanvasItem *item; - double dist; - int cx, cy; + gdouble dist; + gint cx, cy; g_return_val_if_fail (GNOME_IS_CANVAS (canvas), NULL); gnome_canvas_w2c (canvas, x, y, &cx, &cy); dist = gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy, &item); - if ((int) (dist * canvas->pixels_per_unit + 0.5) <= canvas->close_enough) + if ((gint) (dist * canvas->pixels_per_unit + 0.5) <= canvas->close_enough) return item; else return NULL; @@ -3681,11 +3723,11 @@ uta_union_clip (ArtUta *uta1, ArtUta *uta2, ArtIRect *clip) { ArtUta *uta; ArtUtaBbox *utiles; - int clip_x1, clip_y1, clip_x2, clip_y2; - int union_x1, union_y1, union_x2, union_y2; - int new_x1, new_y1, new_x2, new_y2; - int x, y; - int ofs, ofs1, ofs2; + gint clip_x1, clip_y1, clip_x2, clip_y2; + gint union_x1, union_y1, union_x2, union_y2; + gint new_x1, new_y1, new_x2, new_y2; + gint x, y; + gint ofs, ofs1, ofs2; g_assert (clip != NULL); @@ -3872,7 +3914,6 @@ gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, } } - /** * gnome_canvas_request_redraw: * @canvas: A canvas. @@ -3887,7 +3928,7 @@ gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, * @x1 and @y1, but not @x2 and @y2. To be used only by item implementations. **/ void -gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2) +gnome_canvas_request_redraw (GnomeCanvas *canvas, gint x1, gint y1, gint x2, gint y2) { ArtUta *uta; ArtIRect bbox; @@ -3914,7 +3955,6 @@ gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2 } } - /** * gnome_canvas_w2c_affine: * @canvas: A canvas. @@ -3924,9 +3964,9 @@ gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2 * pixel coordinates. **/ void -gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]) +gnome_canvas_w2c_affine (GnomeCanvas *canvas, gdouble affine[6]) { - double zooom; + gdouble zooom; g_return_if_fail (GNOME_IS_CANVAS (canvas)); g_return_if_fail (affine != NULL); @@ -3952,9 +3992,9 @@ gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]) * Converts world coordinates into canvas pixel coordinates. **/ void -gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy) +gnome_canvas_w2c (GnomeCanvas *canvas, gdouble wx, gdouble wy, gint *cx, gint *cy) { - double affine[6]; + gdouble affine[6]; ArtPoint w, c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3982,9 +4022,13 @@ gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy) * greater precision. **/ void -gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, double *cy) +gnome_canvas_w2c_d (GnomeCanvas *canvas, + gdouble wx, + gdouble wy, + gdouble *cx, + gdouble *cy) { - double affine[6]; + gdouble affine[6]; ArtPoint w, c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3999,7 +4043,6 @@ gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, doubl *cy = c.y; } - /** * gnome_canvas_c2w: * @canvas: A canvas. @@ -4011,9 +4054,9 @@ gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, doubl * Converts canvas pixel coordinates to world coordinates. **/ void -gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) +gnome_canvas_c2w (GnomeCanvas *canvas, gint cx, gint cy, gdouble *wx, gdouble *wy) { - double affine[6], inv[6]; + gdouble affine[6], inv[6]; ArtPoint w, c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -4029,7 +4072,6 @@ gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) *wy = w.y; } - /** * gnome_canvas_window_to_world: * @canvas: A canvas. @@ -4043,8 +4085,8 @@ gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) * example. **/ void -gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, - double *worldx, double *worldy) +gnome_canvas_window_to_world (GnomeCanvas *canvas, gdouble winx, gdouble winy, + gdouble *worldx, gdouble *worldy) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -4057,7 +4099,6 @@ gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, / canvas->pixels_per_unit); } - /** * gnome_canvas_world_to_window: * @canvas: A canvas. @@ -4069,8 +4110,8 @@ gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, * Converts world coordinates into window-relative coordinates. **/ void -gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, - double *winx, double *winy) +gnome_canvas_world_to_window (GnomeCanvas *canvas, gdouble worldx, gdouble worldy, + gdouble *winx, gdouble *winy) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -4081,8 +4122,6 @@ gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, *winy = (canvas->pixels_per_unit)*(worldy - canvas->scroll_y1) + canvas->zoom_yofs; } - - /** * gnome_canvas_get_color: * @canvas: A canvas. @@ -4097,8 +4136,8 @@ gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, * Return value: TRUE if @spec is non-NULL and the color is allocated. If @spec * is NULL, then returns FALSE. **/ -int -gnome_canvas_get_color (GnomeCanvas *canvas, const char *spec, GdkColor *color) +gint +gnome_canvas_get_color (GnomeCanvas *canvas, const gchar *spec, GdkColor *color) { GdkColormap *colormap; @@ -4152,7 +4191,6 @@ gnome_canvas_get_color_pixel (GnomeCanvas *canvas, guint rgba) return color.pixel; } - /** * gnome_canvas_set_stipple_origin: * @canvas: A canvas. @@ -4194,7 +4232,7 @@ gnome_canvas_set_dither (GnomeCanvas *canvas, GdkRgbDither dither) * @canvas: A canvas. * * Returns the type of dithering used to render an antialiased canvas. - * + * * Return value: The dither setting. **/ GdkRgbDither @@ -4213,11 +4251,11 @@ boolean_handled_accumulator (GSignalInvocationHint *ihint, { gboolean continue_emission; gboolean signal_handled; - + signal_handled = g_value_get_boolean (handler_return); g_value_set_boolean (return_accu, signal_handled); continue_emission = !signal_handled; - + return continue_emission; } diff --git a/libgnomecanvas/gnome-canvas.h b/libgnomecanvas/gnome-canvas.h index 559bd9c8fb..7d01321ff3 100644 --- a/libgnomecanvas/gnome-canvas.h +++ b/libgnomecanvas/gnome-canvas.h @@ -47,11 +47,9 @@ G_BEGIN_DECLS - /* "Small" value used by canvas stuff */ #define GNOME_CANVAS_EPSILON 1e-10 - /* Macros for building colors that fit in a 32-bit integer. The values are in * [0, 255]. */ @@ -64,8 +62,7 @@ G_BEGIN_DECLS #define GNOME_CANVAS_COLOR_A(r, g, b, a) ((((unsigned int) (r) & 0xff) << 24) \ | (((unsigned int) (g) & 0xff) << 16) \ | (((unsigned int) (b) & 0xff) << 8) \ - | ((unsigned int) (a) & 0xff)) - + | ((guint) (a) & 0xff)) typedef struct _GnomeCanvas GnomeCanvas; typedef struct _GnomeCanvasClass GnomeCanvasClass; @@ -74,7 +71,6 @@ typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass; typedef struct _GnomeCanvasGroup GnomeCanvasGroup; typedef struct _GnomeCanvasGroupClass GnomeCanvasGroupClass; - /* GnomeCanvasItem - base item class for canvas items * * All canvas items are derived from GnomeCanvasItem. The only information a @@ -120,7 +116,7 @@ typedef struct { ArtIRect rect; /* Rowstride for the buffer */ - int buf_rowstride; + gint buf_rowstride; /* Background color, given as 0xrrggbb */ guint32 bg_color; @@ -128,13 +124,12 @@ typedef struct { /* Invariant: at least one of the following flags is true. */ /* Set when the render rectangle area is the solid color bg_color */ - unsigned int is_bg : 1; + guint is_bg : 1; /* Set when the render rectangle area is represented by the buf */ - unsigned int is_buf : 1; + guint is_buf : 1; } GnomeCanvasBuf; - #define GNOME_TYPE_CANVAS_ITEM (gnome_canvas_item_get_type ()) #define GNOME_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItem)) #define GNOME_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItemClass)) @@ -142,7 +137,6 @@ typedef struct { #define GNOME_IS_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_ITEM)) #define GNOME_CANVAS_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItemClass)) - struct _GnomeCanvasItem { GtkObject object; @@ -157,10 +151,10 @@ struct _GnomeCanvasItem { * flags contains AFFINE_FULL, a six-element array containing an affine * transformation. */ - double *xform; + gdouble *xform; /* Bounding box for this item (in canvas coordinates) */ - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; /* XXX GtkObject flags are sealed now, so we have to provide * our own. This breaks ABI compatibility with upstream. */ @@ -176,7 +170,7 @@ struct _GnomeCanvasItemClass { * affine, if used, is a pointer to a 6-element array of doubles. The * update method also recomputes the bounding box of the item. */ - void (* update) (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); + void (* update) (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); /* Realize an item -- create GCs, etc. */ void (* realize) (GnomeCanvasItem *item); @@ -198,7 +192,7 @@ struct _GnomeCanvasItemClass { * drawn. (width, height) are the dimensions of the drawable. */ void (* draw) (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); /* Render the item over the buffer given. The buf data structure * contains both a pointer to a packed 24-bit RGB array, and the @@ -214,13 +208,13 @@ struct _GnomeCanvasItemClass { * being a canvas group. (cx, cy) are the canvas pixel coordinates that * correspond to the item-relative coordinates (x, y). */ - double (* point) (GnomeCanvasItem *item, double x, double y, int cx, int cy, + gdouble (* point) (GnomeCanvasItem *item, gdouble x, gdouble y, gint cx, gint cy, GnomeCanvasItem **actual_item); /* Fetch the item's bounding box (need not be exactly tight). This * should be in item-relative coordinates. */ - void (* bounds) (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); + void (* bounds) (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); /* Signal: an event occurred for an item of this type. The (x, y) * coordinates are in the canvas world coordinate system. @@ -231,7 +225,6 @@ struct _GnomeCanvasItemClass { gpointer spare_vmethods [4]; }; - GType gnome_canvas_item_get_type (void) G_GNUC_CONST; /* Create a canvas item using the standard Gtk argument mechanism. The item is @@ -255,23 +248,23 @@ void gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name, va_list args); /* Move an item by the specified amount */ -void gnome_canvas_item_move (GnomeCanvasItem *item, double dx, double dy); +void gnome_canvas_item_move (GnomeCanvasItem *item, gdouble dx, gdouble dy); /* Apply a relative affine transformation to the item. */ -void gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6]); +void gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const gdouble affine[6]); /* Apply an absolute affine transformation to the item. */ -void gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double affine[6]); +void gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const gdouble affine[6]); /* Raise an item in the z-order of its parent group by the specified number of * positions. */ -void gnome_canvas_item_raise (GnomeCanvasItem *item, int positions); +void gnome_canvas_item_raise (GnomeCanvasItem *item, gint positions); /* Lower an item in the z-order of its parent group by the specified number of * positions. */ -void gnome_canvas_item_lower (GnomeCanvasItem *item, int positions); +void gnome_canvas_item_lower (GnomeCanvasItem *item, gint positions); /* Raise an item to the top of its parent group's z-order. */ void gnome_canvas_item_raise_to_top (GnomeCanvasItem *item); @@ -294,7 +287,7 @@ void gnome_canvas_item_hide (GnomeCanvasItem *item); * grab. Time is a proper X event time parameter. Returns the same values as * XGrabPointer(). */ -int gnome_canvas_item_grab (GnomeCanvasItem *item, unsigned int event_mask, +gint gnome_canvas_item_grab (GnomeCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime); /* Ungrabs the mouse -- the specified item must be the same that was passed to @@ -305,24 +298,24 @@ void gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime); /* These functions convert from a coordinate system to another. "w" is world * coordinates and "i" is item coordinates. */ -void gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y); -void gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y); +void gnome_canvas_item_w2i (GnomeCanvasItem *item, gdouble *x, gdouble *y); +void gnome_canvas_item_i2w (GnomeCanvasItem *item, gdouble *x, gdouble *y); /* Gets the affine transform that converts from item-relative coordinates to * world coordinates. */ -void gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]); +void gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, gdouble affine[6]); /* Gets the affine transform that converts from item-relative coordinates to * canvas pixel coordinates. */ -void gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]); +void gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, gdouble affine[6]); /* Remove the item from its parent group and make the new group its parent. The * item will be put on top of all the items in the new group. The item's * coordinates relative to its new parent to *not* change -- this means that the * item could potentially move on the screen. - * + * * The item and the group must be in the same canvas. An item cannot be * reparented to a group that is the item itself or that is an inferior of the * item. @@ -339,14 +332,13 @@ void gnome_canvas_item_grab_focus (GnomeCanvasItem *item); * box is in the coordinate system of the item's parent. */ void gnome_canvas_item_get_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); /* Request that the update method eventually get called. This should be used * only by item implementations. */ void gnome_canvas_item_request_update (GnomeCanvasItem *item); - /* GnomeCanvasGroup - a group of canvas items * * A group is a node in the hierarchical tree of groups/items inside a canvas. @@ -363,11 +355,10 @@ void gnome_canvas_item_request_update (GnomeCanvasItem *item); * * name type read/write description * -------------------------------------------------------------------------------- - * x double RW X coordinate of group's origin - * y double RW Y coordinate of group's origin + * x gdouble RW X coordinate of group's origin + * y gdouble RW Y coordinate of group's origin */ - #define GNOME_TYPE_CANVAS_GROUP (gnome_canvas_group_get_type ()) #define GNOME_CANVAS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_GROUP, GnomeCanvasGroup)) #define GNOME_CANVAS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_GROUP, GnomeCanvasGroupClass)) @@ -375,7 +366,6 @@ void gnome_canvas_item_request_update (GnomeCanvasItem *item); #define GNOME_IS_CANVAS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_GROUP)) #define GNOME_CANVAS_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_GROUP, GnomeCanvasGroupClass)) - struct _GnomeCanvasGroup { GnomeCanvasItem item; @@ -388,13 +378,10 @@ struct _GnomeCanvasGroupClass { GnomeCanvasItemClass parent_class; }; - GType gnome_canvas_group_get_type (void) G_GNUC_CONST; - /*** GnomeCanvas ***/ - #define GNOME_TYPE_CANVAS (gnome_canvas_get_type ()) #define GNOME_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS, GnomeCanvas)) #define GNOME_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS, GnomeCanvasClass)) @@ -402,7 +389,6 @@ GType gnome_canvas_group_get_type (void) G_GNUC_CONST; #define GNOME_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS)) #define GNOME_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS, GnomeCanvasClass)) - struct _GnomeCanvas { GtkLayout layout; @@ -431,11 +417,11 @@ struct _GnomeCanvas { GdkEvent pick_event; /* Scrolling region */ - double scroll_x1, scroll_y1; - double scroll_x2, scroll_y2; + gdouble scroll_x1, scroll_y1; + gdouble scroll_x2, scroll_y2; /* Scaling factor to be used for display */ - double pixels_per_unit; + gdouble pixels_per_unit; /* Idle handler ID */ guint idle_id; @@ -446,46 +432,46 @@ struct _GnomeCanvas { /* Area that is being redrawn. Contains (x1, y1) but not (x2, y2). * Specified in canvas pixel coordinates. */ - int redraw_x1, redraw_y1; - int redraw_x2, redraw_y2; + gint redraw_x1, redraw_y1; + gint redraw_x2, redraw_y2; /* Offsets of the temprary drawing pixmap */ - int draw_xofs, draw_yofs; + gint draw_xofs, draw_yofs; /* Internal pixel offsets when zoomed out */ - int zoom_xofs, zoom_yofs; + gint zoom_xofs, zoom_yofs; /* Last known modifier state, for deferred repick when a button is down */ - int state; + gint state; /* Event mask specified when grabbing an item */ guint grabbed_event_mask; /* Tolerance distance for picking items */ - int close_enough; + gint close_enough; /* Whether the canvas should center the scroll region in the middle of * the window if the scroll region is smaller than the window. */ - unsigned int center_scroll_region : 1; + guint center_scroll_region : 1; /* Whether items need update at next idle loop iteration */ - unsigned int need_update : 1; + guint need_update : 1; /* Whether the canvas needs redrawing at the next idle loop iteration */ - unsigned int need_redraw : 1; + guint need_redraw : 1; /* Whether current item will be repicked at next idle loop iteration */ - unsigned int need_repick : 1; + guint need_repick : 1; /* For use by internal pick_current_item() function */ - unsigned int left_grabbed_item : 1; + guint left_grabbed_item : 1; /* For use by internal pick_current_item() function */ - unsigned int in_repick : 1; + guint in_repick : 1; /* Whether the canvas is in antialiased mode or not */ - unsigned int aa : 1; + guint aa : 1; /* Which dither mode to use for antialiased mode drawing */ GdkRgbDither dither; @@ -498,7 +484,7 @@ struct _GnomeCanvasClass { * for non-antialiased canvases. */ void (* draw_background) (GnomeCanvas *canvas, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); /* Render the background for the buffer given. The buf data structure * contains both a pointer to a packed 24-bit RGB array, and the @@ -513,7 +499,6 @@ struct _GnomeCanvasClass { gpointer spare_vmethods [4]; }; - GType gnome_canvas_get_type (void) G_GNUC_CONST; /* Creates a new canvas. You should check that the canvas is created with the @@ -537,11 +522,11 @@ GnomeCanvasGroup *gnome_canvas_root (GnomeCanvas *canvas); /* Sets the limits of the scrolling region, in world coordinates */ void gnome_canvas_set_scroll_region (GnomeCanvas *canvas, - double x1, double y1, double x2, double y2); + gdouble x1, gdouble y1, gdouble x2, gdouble y2); /* Gets the limits of the scrolling region, in world coordinates */ void gnome_canvas_get_scroll_region (GnomeCanvas *canvas, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); /* Whether the canvas centers the scroll region if it is smaller than the window */ void gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scroll_region); @@ -550,16 +535,16 @@ void gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center gboolean gnome_canvas_get_center_scroll_region (GnomeCanvas *canvas); /* Sets the number of pixels that correspond to one unit in world coordinates */ -void gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n); +void gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, gdouble n); /* Scrolls the canvas to the specified offsets, given in canvas pixel coordinates */ -void gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy); +void gnome_canvas_scroll_to (GnomeCanvas *canvas, gint cx, gint cy); /* Returns the scroll offsets of the canvas in canvas pixel coordinates. You * can specify NULL for any of the values, in which case that value will not be * queried. */ -void gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, int *cx, int *cy); +void gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, gint *cx, gint *cy); /* Requests that the canvas be repainted immediately instead of in the idle * loop. @@ -569,7 +554,7 @@ void gnome_canvas_update_now (GnomeCanvas *canvas); /* Returns the item that is at the specified position in world coordinates, or * NULL if no item is there. */ -GnomeCanvasItem *gnome_canvas_get_item_at (GnomeCanvas *canvas, double x, double y); +GnomeCanvasItem *gnome_canvas_get_item_at (GnomeCanvas *canvas, gdouble x, gdouble y); /* For use only by item type implementations. Request that the canvas eventually * redraw the specified region. The region is specified as a microtile @@ -581,42 +566,41 @@ void gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, ArtUta *uta); * eventually redraw the specified region, specified in canvas pixel * coordinates. The region contains (x1, y1) but not (x2, y2). */ -void gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2); +void gnome_canvas_request_redraw (GnomeCanvas *canvas, gint x1, gint y1, gint x2, gint y2); /* Gets the affine transform that converts world coordinates into canvas pixel * coordinates. */ -void gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]); +void gnome_canvas_w2c_affine (GnomeCanvas *canvas, gdouble affine[6]); /* These functions convert from a coordinate system to another. "w" is world * coordinates, "c" is canvas pixel coordinates (pixel coordinates that are * (0,0) for the upper-left scrolling limit and something else for the * lower-left scrolling limit). */ -void gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy); -void gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, double *cy); -void gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy); +void gnome_canvas_w2c (GnomeCanvas *canvas, gdouble wx, gdouble wy, gint *cx, gint *cy); +void gnome_canvas_w2c_d (GnomeCanvas *canvas, gdouble wx, gdouble wy, gdouble *cx, gdouble *cy); +void gnome_canvas_c2w (GnomeCanvas *canvas, gint cx, gint cy, gdouble *wx, gdouble *wy); /* This function takes in coordinates relative to the GTK_LAYOUT * (canvas)->bin_window and converts them to world coordinates. */ void gnome_canvas_window_to_world (GnomeCanvas *canvas, - double winx, double winy, double *worldx, double *worldy); + gdouble winx, gdouble winy, gdouble *worldx, gdouble *worldy); /* This is the inverse of gnome_canvas_window_to_world() */ void gnome_canvas_world_to_window (GnomeCanvas *canvas, - double worldx, double worldy, double *winx, double *winy); + gdouble worldx, gdouble worldy, gdouble *winx, gdouble *winy); /* Takes a string specification for a color and allocates it into the specified * GdkColor. If the string is null, then it returns FALSE. Otherwise, it * returns TRUE. */ -int gnome_canvas_get_color (GnomeCanvas *canvas, const char *spec, GdkColor *color); +gint gnome_canvas_get_color (GnomeCanvas *canvas, const gchar *spec, GdkColor *color); /* Allocates a color from the RGB value passed into this function. */ gulong gnome_canvas_get_color_pixel (GnomeCanvas *canvas, guint rgba); - /* Sets the stipple origin of the specified gc so that it will be aligned with * all the stipples used in the specified canvas. This is intended for use only diff --git a/libgnomecanvas/libgnomecanvastypes.c b/libgnomecanvas/libgnomecanvastypes.c index 9ea59664c8..c7c4fcf3cf 100644 --- a/libgnomecanvas/libgnomecanvastypes.c +++ b/libgnomecanvas/libgnomecanvastypes.c @@ -35,7 +35,7 @@ gnome_canvas_points_get_type (void) if (!type_canvas_points) type_canvas_points = g_boxed_type_register_static - ("GnomeCanvasPoints", + ("GnomeCanvasPoints", (GBoxedCopyFunc) gnome_canvas_points_ref, (GBoxedFreeFunc) gnome_canvas_points_unref); diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c index 667ee085be..4a0527d934 100644 --- a/mail/em-filter-editor.c +++ b/mail/em-filter-editor.c @@ -167,10 +167,12 @@ em_filter_editor_construct (EMFilterEditor *fe, GtkWidget *combobox; gint i; GtkTreeViewColumn *column; + GtkTreeModel *model; GSList *sources = NULL; - combobox = e_builder_get_widget (builder, "filter_source_combobox"); - gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combobox)))); + combobox = e_builder_get_widget (builder, "filter_source_combobox"); + model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox)); + gtk_list_store_clear (GTK_LIST_STORE (model)); for (i = 0; source_names[i].source; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), source_names[i].name); @@ -182,7 +184,9 @@ em_filter_editor_construct (EMFilterEditor *fe, g_object_set_data_full (G_OBJECT (combobox), "sources", sources, free_sources); gtk_widget_show (combobox); - e_rule_editor_construct ((ERuleEditor *) fe, (ERuleContext *) fc, builder, source_names[0].source, _("_Filter Rules")); + e_rule_editor_construct ( + (ERuleEditor *) fe, (ERuleContext *) fc, + builder, source_names[0].source, _("_Filter Rules")); /* Show the Enabled column, we support it here */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (E_RULE_EDITOR (fe)->list), 0); diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index e32d319eac..9ecca7b60b 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -220,7 +220,8 @@ validate(EFilterRule *fr, EAlert **alert) /* We have to have at least one source set in the "specific" case. Do not translate this string! */ - if (((EMVFolderRule *)fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && ((EMVFolderRule *)fr)->sources == NULL) { + if (((EMVFolderRule *)fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && + ((EMVFolderRule *)fr)->sources == NULL) { if (alert) *alert = e_alert_new ("mail:vfolder-no-source", NULL); return 0; @@ -394,8 +395,11 @@ static struct { static void set_sensitive(struct _source_data *data) { - gtk_widget_set_sensitive((GtkWidget *)data->buttons[BUTTON_ADD], TRUE); - gtk_widget_set_sensitive((GtkWidget *)data->buttons[BUTTON_REMOVE], data->current != NULL); + gtk_widget_set_sensitive ( + GTK_WIDGET (data->buttons[BUTTON_ADD]), TRUE); + gtk_widget_set_sensitive ( + GTK_WIDGET (data->buttons[BUTTON_REMOVE]), + data->current != NULL); } static void @@ -621,18 +625,27 @@ get_widget(EFilterRule *fr, ERuleContext *rc) g_signal_connect(data->list, "cursor-changed", G_CALLBACK(select_source), data); rb = (GtkRadioButton *)e_builder_get_widget (builder, "local_rb"); - g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + g_signal_connect ( + rb, "toggled", + G_CALLBACK (select_source_with_changed), data); rb = (GtkRadioButton *)e_builder_get_widget (builder, "remote_rb"); - g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + g_signal_connect ( + rb, "toggled", + G_CALLBACK (select_source_with_changed), data); rb = (GtkRadioButton *)e_builder_get_widget (builder, "local_and_remote_rb"); - g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + g_signal_connect ( + rb, "toggled", + G_CALLBACK (select_source_with_changed), data); - rb = (GtkRadioButton *)e_builder_get_widget (builder, "specific_rb"); - g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + rb = (GtkRadioButton *) e_builder_get_widget (builder, "specific_rb"); + g_signal_connect ( + rb, "toggled", + G_CALLBACK (select_source_with_changed), data); - data->source_selector = (GtkWidget *)e_builder_get_widget (builder, "source_selector"); + data->source_selector = (GtkWidget *) + e_builder_get_widget (builder, "source_selector"); rb = g_slist_nth_data(gtk_radio_button_get_group (rb), vr->with); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE); diff --git a/mail/mail-config.h b/mail/mail-config.h index 4b67fbd222..eee2958a1e 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -66,35 +66,41 @@ typedef enum { MAIL_CONFIG_XMAILER_RUPERT_APPROVED = 4 } MailConfigXMailerDisplayStyle; +GType evolution_mail_config_get_type (void); + /* Configuration */ -void mail_config_init (void); -void mail_config_write (void); +void mail_config_init (void); +void mail_config_write (void); -GConfClient *mail_config_get_gconf_client (void); +GConfClient * mail_config_get_gconf_client (void); /* General Accessor functions */ -void mail_config_service_set_save_passwd (EAccountService *service, gboolean save_passwd); +void mail_config_service_set_save_passwd + (EAccountService *service, + gboolean save_passwd); /* accounts */ -EAccount *mail_config_get_account_by_source_url (const gchar *url); -EAccount *mail_config_get_account_by_transport_url (const gchar *url); +EAccount * mail_config_get_account_by_source_url + (const gchar *url); +EAccount * mail_config_get_account_by_transport_url + (const gchar *url); -gint mail_config_get_address_count (void); +gint mail_config_get_address_count (void); -EAccountService *mail_config_get_default_transport (void); +EAccountService * + mail_config_get_default_transport (void); /* static utility functions */ -gchar *mail_config_folder_to_cachename (CamelFolder *folder, const gchar *prefix); -gchar *mail_config_folder_to_safe_url (CamelFolder *folder); - -gint mail_config_get_sync_timeout (void); +gchar * mail_config_folder_to_cachename (CamelFolder *folder, + const gchar *prefix); +gchar * mail_config_folder_to_safe_url (CamelFolder *folder); -void mail_config_reload_junk_headers (void); -gboolean mail_config_get_lookup_book (void); -gboolean mail_config_get_lookup_book_local_only (void); +gint mail_config_get_sync_timeout (void); -GType evolution_mail_config_get_type (void); +void mail_config_reload_junk_headers (void); +gboolean mail_config_get_lookup_book (void); +gboolean mail_config_get_lookup_book_local_only (void); G_END_DECLS diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index 9fe9870c73..91da8f45ef 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -80,9 +80,11 @@ create_task_sources (EShellBackend *shell_backend, group = E_SOURCE_GROUP (g->data); - if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group))) + if (!*on_this_computer && !strcmp (base_uri_proto, + e_source_group_peek_base_uri (group))) *on_this_computer = g_object_ref (group); - else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group))) + else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, + e_source_group_peek_base_uri (group))) *on_the_web = g_object_ref (group); } } diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 75787ced9a..d0e3ffa0e9 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -952,7 +952,7 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content shell_view = e_shell_content_get_shell_view (shell_content); shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); view_collection = shell_view_class->view_collection; - + shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index d9f2c80538..8839341451 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -129,7 +129,7 @@ e_mail_shell_settings_init (EShell *shell) e_shell_settings_install_property_for_key ( "mail-magic-spacebar", "/apps/evolution/mail/display/magic_spacebar"); - + e_shell_settings_install_property_for_key ( "mail-global-view-setting", "/apps/evolution/mail/display/global_view_setting"); diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 168965f02b..80163a4713 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -921,7 +921,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, e_mutual_binding_new ( shell_settings, "mail-magic-spacebar", widget, "active"); - + widget = e_builder_get_widget (prefs->builder, "view-check"); e_mutual_binding_new ( shell_settings, "mail-global-view-setting", diff --git a/shell/main.c b/shell/main.c index afa2ea5689..3a885f59f2 100644 --- a/shell/main.c +++ b/shell/main.c @@ -491,7 +491,7 @@ main (gint argc, gchar **argv) _e_win32_register_mailer (); _e_win32_register_addressbook (); } - + if (register_handlers) exit (0); @@ -509,7 +509,7 @@ main (gint argc, gchar **argv) _e_win32_unset_default_mailer (); exit (0); } - + if (unregister_handlers) { _e_win32_unregister_mailer(); _e_win32_unregister_addressbook(); diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index 833c19b652..e81d6d4d60 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -48,7 +48,6 @@ #include <glib/gi18n.h> #include <glib/gstdio.h> - #include <camel/camel.h> /* FIXME: this is where camel_init is defined; it shouldn't include everything else */ /* private NSS defines used by PSM */ diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 0b0c0f4a59..7d0f079cb6 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -187,13 +187,17 @@ etgl_double_click (GtkObject *object, gint model_row, gint model_col, GdkEvent * } static gboolean -etgl_key_press (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) +etgl_key_press (GtkObject *object, + gint row, + gint col, + GdkEvent *event, + ETableGroupLeaf *etgl) { if (row < E_TABLE_SUBSET(etgl->ets)->n_map && row >= 0) - return e_table_group_key_press (E_TABLE_GROUP(etgl), - E_TABLE_SUBSET(etgl->ets)->map_table[row], - col, - event); + return e_table_group_key_press ( + E_TABLE_GROUP(etgl), + E_TABLE_SUBSET(etgl->ets)->map_table[row], + col, event); else return FALSE; } @@ -219,7 +223,11 @@ etgl_right_click (GtkObject *object, gint view_row, gint model_col, GdkEvent *ev } static gboolean -etgl_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) +etgl_click (GtkObject *object, + gint row, + gint col, + GdkEvent *event, + ETableGroupLeaf *etgl) { if (row < E_TABLE_SUBSET(etgl->ets)->n_map) return e_table_group_click (E_TABLE_GROUP(etgl), @@ -349,7 +357,9 @@ etgl_increment (ETableGroup *etg, gint position, gint amount) ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_increment (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount); + e_table_subset_variable_increment ( + E_TABLE_SUBSET_VARIABLE (etgl->ets), + position, amount); } } @@ -359,7 +369,9 @@ etgl_decrement (ETableGroup *etg, gint position, gint amount) ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_decrement (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount); + e_table_subset_variable_decrement ( + E_TABLE_SUBSET_VARIABLE (etgl->ets), + position, amount); } } @@ -377,7 +389,9 @@ etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); if (direction == E_FOCUS_END) { - e_table_item_set_cursor (etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->ets)) - 1); + e_table_item_set_cursor ( + etgl->item, view_col, + e_table_model_row_count (E_TABLE_MODEL(etgl->ets)) - 1); } else { e_table_item_set_cursor (etgl->item, view_col, 0); } @@ -421,7 +435,13 @@ etgl_get_mouse_over (ETableGroup *etg, gint *row, gint *col) } static void -etgl_get_cell_geometry (ETableGroup *etg, gint *row, gint *col, gint *x, gint *y, gint *width, gint *height) +etgl_get_cell_geometry (ETableGroup *etg, + gint *row, + gint *col, + gint *x, + gint *y, + gint *width, + gint *height) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); @@ -429,7 +449,10 @@ etgl_get_cell_geometry (ETableGroup *etg, gint *row, gint *col, gint *x, gint *y } static void -etgl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +etgl_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { ETableGroup *etg = E_TABLE_GROUP (object); ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); diff --git a/widgets/table/gal-a11y-e-table-factory.c b/widgets/table/gal-a11y-e-table-factory.c index f459f3b67c..5e99c13bb9 100644 --- a/widgets/table/gal-a11y-e-table-factory.c +++ b/widgets/table/gal-a11y-e-table-factory.c @@ -26,7 +26,6 @@ #include "gal-a11y-e-table.h" #include "gal-a11y-e-table-factory.h" -#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETableFactoryClass)) static AtkObjectFactoryClass *parent_class; #define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY) diff --git a/widgets/table/gal-a11y-e-tree-factory.c b/widgets/table/gal-a11y-e-tree-factory.c index 8dc06e2936..e3cf441974 100644 --- a/widgets/table/gal-a11y-e-tree-factory.c +++ b/widgets/table/gal-a11y-e-tree-factory.c @@ -25,7 +25,6 @@ #include "gal-a11y-e-tree.h" #include "gal-a11y-e-tree-factory.h" -#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETreeFactoryClass)) static AtkObjectFactoryClass *parent_class; #define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY) diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index e4ab873d9d..5f3b88d366 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -48,15 +48,26 @@ struct _ETextModelPrivate { GString *text; }; -static void e_text_model_dispose (GObject *object); +static void e_text_model_dispose (GObject *object); -static gint e_text_model_real_validate_position (ETextModel *, gint pos); -static const gchar *e_text_model_real_get_text (ETextModel *model); -static gint e_text_model_real_get_text_length (ETextModel *model); -static void e_text_model_real_set_text (ETextModel *model, const gchar *text); -static void e_text_model_real_insert (ETextModel *model, gint postion, const gchar *text); -static void e_text_model_real_insert_length (ETextModel *model, gint postion, const gchar *text, gint length); -static void e_text_model_real_delete (ETextModel *model, gint postion, gint length); +static gint e_text_model_real_validate_position + (ETextModel *, gint pos); +static const gchar * + e_text_model_real_get_text (ETextModel *model); +static gint e_text_model_real_get_text_length + (ETextModel *model); +static void e_text_model_real_set_text (ETextModel *model, + const gchar *text); +static void e_text_model_real_insert (ETextModel *model, + gint postion, + const gchar *text); +static void e_text_model_real_insert_length (ETextModel *model, + gint postion, + const gchar *text, + gint length); +static void e_text_model_real_delete (ETextModel *model, + gint postion, + gint length); G_DEFINE_TYPE (ETextModel, e_text_model, G_TYPE_OBJECT) @@ -219,7 +230,10 @@ e_text_model_real_insert (ETextModel *model, gint position, const gchar *text) } static void -e_text_model_real_insert_length (ETextModel *model, gint position, const gchar *text, gint length) +e_text_model_real_insert_length (ETextModel *model, + gint position, + const gchar *text, + gint length) { EReposInsertShift repos; gint model_len = e_text_model_real_get_text_length (model); @@ -392,7 +406,10 @@ e_text_model_insert (ETextModel *model, gint position, const gchar *text) } void -e_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length) +e_text_model_insert_length (ETextModel *model, + gint position, + const gchar *text, + gint length) { g_return_if_fail (model != NULL); g_return_if_fail (E_IS_TEXT_MODEL (model)); diff --git a/widgets/text/gal-a11y-e-text-factory.c b/widgets/text/gal-a11y-e-text-factory.c index 2df9241014..d68e2ce549 100644 --- a/widgets/text/gal-a11y-e-text-factory.c +++ b/widgets/text/gal-a11y-e-text-factory.c @@ -25,7 +25,6 @@ #include "gal-a11y-e-text-factory.h" #include "gal-a11y-e-text.h" -#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETextFactoryClass)) static AtkObjectFactoryClass *parent_class; #define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY) diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c index e368e7d68b..9145ed8b41 100644 --- a/widgets/text/gal-a11y-e-text.c +++ b/widgets/text/gal-a11y-e-text.c @@ -33,13 +33,11 @@ #include "gal-a11y-e-text.h" #include "gal-a11y-e-text-factory.h" -#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETextClass)) static GObjectClass *parent_class; static AtkComponentIface *component_parent_iface; static GType parent_type; static gint priv_offset; static GQuark quark_accessible_object = 0; -#define GET_PRIVATE(object) ((GalA11yETextPrivate *) (((gchar *) object) + priv_offset)) #define PARENT_TYPE (parent_type) struct _GalA11yETextPrivate { @@ -63,7 +61,8 @@ et_get_extents (AtkComponent *component, gint *height, AtkCoordType coord_type) { - EText *item = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component))); + EText *item = E_TEXT (atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (component))); gdouble real_width; gdouble real_height; gint fake_width; @@ -92,7 +91,8 @@ et_get_extents (AtkComponent *component, static const gchar * et_get_full_text (AtkText *text) { - EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text))); + EText *etext = E_TEXT (atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (text))); ETextModel *model; const gchar *full_text; @@ -107,7 +107,8 @@ static void et_set_full_text (AtkEditableText *text, const gchar *full_text) { - EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text))); + EText *etext = E_TEXT (atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (text))); ETextModel *model; g_object_get (etext, "model", &model, NULL); @@ -655,7 +656,8 @@ et_get_offset_at_point (AtkText *text, static gint et_get_n_selections (AtkText *text) { - EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text))); + EText *etext = E_TEXT (atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (text))); if (etext->selection_start != etext->selection_end) return 1; @@ -836,7 +838,9 @@ et_insert_text (AtkEditableText *text, if (full_text == NULL) return; - result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position); + result = g_strdup_printf ( + "%.*s%.*s%s", *position, full_text, + length, string, full_text + *position); et_set_full_text (text, result); @@ -1033,21 +1037,18 @@ et_class_init (GalA11yETextClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object"); - parent_class = g_type_class_ref (PARENT_TYPE); - component_parent_iface = g_type_interface_peek(parent_class, ATK_TYPE_COMPONENT); - object_class->dispose = et_dispose; - atk_class->initialize = et_real_initialize; + quark_accessible_object = + g_quark_from_static_string ("gtk-accessible-object"); + parent_class = g_type_class_ref (PARENT_TYPE); + component_parent_iface = + g_type_interface_peek (parent_class, ATK_TYPE_COMPONENT); + object_class->dispose = et_dispose; + atk_class->initialize = et_real_initialize; } static void et_init (GalA11yEText *a11y) { -#if 0 - GalA11yETextPrivate *priv; - - priv = GET_PRIVATE (a11y); -#endif } /** @@ -1096,11 +1097,13 @@ gal_a11y_e_text_get_type (void) NULL }; - factory = atk_registry_get_factory (atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM); + factory = atk_registry_get_factory ( + atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM); parent_type = atk_object_factory_get_accessible_type (factory); - type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yEText", &info, 0, - sizeof (GalA11yETextPrivate), &priv_offset); + type = gal_a11y_type_register_static_with_private ( + PARENT_TYPE, "GalA11yEText", &info, 0, + sizeof (GalA11yETextPrivate), &priv_offset); g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info); g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info); |