From 4dce10cb650189b3b317d037766518e36175055e Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Fri, 1 Mar 2013 13:12:24 +0100 Subject: [PATCH] adg: removed AdgPattern cairo-gobject yet wraps cairo_pattern_t, so there is no need to duplicate it (and makes bindings life easier). --- configure.ac | 6 +++-- docs/adg/adg-docs.xml | 1 - po-properties/it.po | 10 +++---- src/adg.h.in | 3 +-- src/adg/Makefile.am | 2 -- src/adg/adg-dress-builtins.c | 1 - src/adg/adg-fill-style-private.h | 4 +-- src/adg/adg-fill-style.c | 8 +++--- src/adg/adg-fill-style.h | 12 ++++----- src/adg/adg-hatch.c | 1 - src/adg/adg-internal.h | 2 +- src/adg/adg-pattern.c | 58 ---------------------------------------- src/adg/adg-pattern.h | 44 ------------------------------ src/adg/adg-ruled-fill.c | 6 ++--- src/adg/tests/test-fill-style.c | 6 ++--- 15 files changed, 29 insertions(+), 135 deletions(-) delete mode 100644 src/adg/adg-pattern.c delete mode 100644 src/adg/adg-pattern.h diff --git a/configure.ac b/configure.ac index 5521b52f..e6449ea7 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,7 @@ m4_define([cpml_lt_version],[1:1:0]) m4_define([gtkdoc_prereq],[1.12])dnl Support introspection annotations m4_define([gobject_prereq],[2.10.1]) m4_define([cairo_prereq],[1.7.4]) +m4_define([cairo_gobject_prereq],cairo_prereq) m4_define([gtk2_prereq],[2.12.0]) m4_define([gtk3_prereq],[3.0.0]) m4_define([pangocairo_prereq],[1.18.0]) @@ -131,6 +132,7 @@ AC_CONFIG_COMMANDS([default], PKG_CHECK_MODULES([GLIB],[glib-2.0]) PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= ]gobject_prereq) PKG_CHECK_MODULES([CAIRO],[cairo >= ]cairo_prereq) +PKG_CHECK_MODULES([CAIRO_GOBJECT],[cairo-gobject >= ]cairo_gobject_prereq) # Check for optional packages @@ -341,8 +343,8 @@ AC_SUBST([CPML_CFLAGS]) AC_SUBST([CPML_LIBS]) dnl ADG compiler flags and library dependencies -ADG_CFLAGS="$GOBJECT_CFLAGS" -ADG_LIBS="$GOBJECT_LIBS" +ADG_CFLAGS="$CAIRO_GOBJECT_CFLAGS" +ADG_LIBS="$CAIRO_GOBJECT_LIBS" AM_COND_IF([HAVE_PANGO], [ADG_CFLAGS="$PANGO_CFLAGS $ADG_CFLAGS" ADG_LIBS="$PANGO_LIBS $ADG_LIBS"]) diff --git a/docs/adg/adg-docs.xml b/docs/adg/adg-docs.xml index 546661be..cf99d3a6 100644 --- a/docs/adg/adg-docs.xml +++ b/docs/adg/adg-docs.xml @@ -27,7 +27,6 @@ - diff --git a/po-properties/it.po b/po-properties/it.po index 5cb9d6a1..5298d43a 100644 --- a/po-properties/it.po +++ b/po-properties/it.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: adg 1.0.x\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-15 20:50+0100\n" +"POT-Creation-Date: 2013-03-01 13:10+0100\n" "PO-Revision-Date: 2013-02-15 15:37+0100\n" "Last-Translator: Nicola Fontana \n" "Language-Team: \n" @@ -607,11 +607,11 @@ msgstr "" "Specifica come le trasformazioni locali dell'entità corrente e dei suoi " "progenitori devono essere combinate per ottenere la matrice locale" -#: src/adg/adg-fill-style.c:107 +#: src/adg/adg-fill-style.c:106 msgid "Pattern" msgstr "Pattern" -#: src/adg/adg-fill-style.c:108 +#: src/adg/adg-fill-style.c:107 msgid "The cairo pattern set for this entity" msgstr "Il pattern cairo impostato per questa entità" @@ -731,11 +731,11 @@ msgstr "Mappa di Render" msgid "The transformation to be applied on the canvas before rendering it" msgstr "La trasformazione da applicare al canvas prima del rendering" -#: src/adg/adg-hatch.c:93 +#: src/adg/adg-hatch.c:92 msgid "Fill Dress" msgstr "Vestito Riempimento" -#: src/adg/adg-hatch.c:94 +#: src/adg/adg-hatch.c:93 msgid "The dress to use for filling this entity" msgstr "Il vestito da usare per riempire questa entità" diff --git a/src/adg.h.in b/src/adg.h.in index b7ca9077..cf854156 100644 --- a/src/adg.h.in +++ b/src/adg.h.in @@ -21,7 +21,7 @@ #ifndef __ADG_H__ #define __ADG_H__ -#include +#include #include #include "adg/adg-forward-declarations.h" @@ -29,7 +29,6 @@ #include "adg/adg-utils.h" #include "adg/adg-pair.h" #include "adg/adg-matrix.h" -#include "adg/adg-pattern.h" #include "adg/adg-primitive.h" #include "adg/adg-segment.h" #include "adg/adg-entity.h" diff --git a/src/adg/Makefile.am b/src/adg/Makefile.am index b395984c..b07f38a3 100644 --- a/src/adg/Makefile.am +++ b/src/adg/Makefile.am @@ -35,7 +35,6 @@ h_sources= adg-adim.h \ adg-model.h \ adg-pair.h \ adg-path.h \ - adg-pattern.h \ adg-point.h \ adg-primitive.h \ adg-projection.h \ @@ -112,7 +111,6 @@ c_sources= adg-adim.c \ adg-model.c \ adg-pair.c \ adg-path.c \ - adg-pattern.c \ adg-point.c \ adg-primitive.c \ adg-projection.c \ diff --git a/src/adg/adg-dress-builtins.c b/src/adg/adg-dress-builtins.c index 7b845da2..e8977c47 100644 --- a/src/adg/adg-dress-builtins.c +++ b/src/adg/adg-dress-builtins.c @@ -38,7 +38,6 @@ #include "adg-model.h" #include "adg-trail.h" #include "adg-marker.h" -#include "adg-pattern.h" #include "adg-dress.h" #include "adg-color-style.h" #include "adg-dash.h" diff --git a/src/adg/adg-fill-style-private.h b/src/adg/adg-fill-style-private.h index ce9a2133..670b8fbd 100644 --- a/src/adg/adg-fill-style-private.h +++ b/src/adg/adg-fill-style-private.h @@ -26,8 +26,8 @@ G_BEGIN_DECLS typedef struct _AdgFillStylePrivate AdgFillStylePrivate; struct _AdgFillStylePrivate { - AdgPattern *pattern; - CpmlExtents extents; + cairo_pattern_t *pattern; + CpmlExtents extents; }; G_END_DECLS diff --git a/src/adg/adg-fill-style.c b/src/adg/adg-fill-style.c index 6a8e9565..c277db1b 100644 --- a/src/adg/adg-fill-style.c +++ b/src/adg/adg-fill-style.c @@ -53,7 +53,6 @@ #include "adg-internal.h" #include "adg-style.h" -#include "adg-pattern.h" #include "adg-fill-style.h" #include "adg-fill-style-private.h" @@ -106,7 +105,7 @@ adg_fill_style_class_init(AdgFillStyleClass *klass) param = g_param_spec_boxed("pattern", P_("Pattern"), P_("The cairo pattern set for this entity"), - ADG_TYPE_PATTERN, + CAIRO_GOBJECT_TYPE_PATTERN, G_PARAM_READWRITE); g_object_class_install_property(gobject_class, PROP_PATTERN, param); } @@ -190,7 +189,8 @@ _adg_set_property(GObject *object, guint prop_id, * Since: 1.0 **/ void -adg_fill_style_set_pattern(AdgFillStyle *fill_style, AdgPattern *pattern) +adg_fill_style_set_pattern(AdgFillStyle *fill_style, + cairo_pattern_t *pattern) { g_return_if_fail(ADG_IS_FILL_STYLE(fill_style)); g_object_set(fill_style, "pattern", pattern, NULL); @@ -206,7 +206,7 @@ adg_fill_style_set_pattern(AdgFillStyle *fill_style, AdgPattern *pattern) * * Since: 1.0 **/ -AdgPattern * +cairo_pattern_t * adg_fill_style_get_pattern(AdgFillStyle *fill_style) { AdgFillStylePrivate *data; diff --git a/src/adg/adg-fill-style.h b/src/adg/adg-fill-style.h index 6de8cb03..c21de79d 100644 --- a/src/adg/adg-fill-style.h +++ b/src/adg/adg-fill-style.h @@ -58,12 +58,12 @@ struct _AdgFillStyleClass { GType adg_fill_style_get_type (void) G_GNUC_CONST; -void adg_fill_style_set_pattern (AdgFillStyle *fill_style, - AdgPattern *pattern); -AdgPattern * adg_fill_style_get_pattern (AdgFillStyle *fill_style); -void adg_fill_style_set_extents (AdgFillStyle *fill_style, - const CpmlExtents *extents); -const CpmlExtents *adg_fill_style_get_extents (AdgFillStyle *fill_style); +void adg_fill_style_set_pattern (AdgFillStyle *fill_style, + cairo_pattern_t *pattern); +cairo_pattern_t * adg_fill_style_get_pattern (AdgFillStyle *fill_style); +void adg_fill_style_set_extents (AdgFillStyle *fill_style, + const CpmlExtents *extents); +const CpmlExtents *adg_fill_style_get_extents (AdgFillStyle *fill_style); G_END_DECLS diff --git a/src/adg/adg-hatch.c b/src/adg/adg-hatch.c index c02e8ab6..0bc6fe0e 100644 --- a/src/adg/adg-hatch.c +++ b/src/adg/adg-hatch.c @@ -42,7 +42,6 @@ #include "adg-model.h" #include "adg-trail.h" #include "adg-stroke.h" -#include "adg-pattern.h" #include "adg-style.h" #include "adg-fill-style.h" #include "adg-dress.h" diff --git a/src/adg/adg-internal.h b/src/adg/adg-internal.h index b22c3301..32b953e4 100644 --- a/src/adg/adg-internal.h +++ b/src/adg/adg-internal.h @@ -33,7 +33,7 @@ #include #define G_LOG_DOMAIN PACKAGE -#include +#include #include /* The following headers are autogenerated, so they could be hosted diff --git a/src/adg/adg-pattern.c b/src/adg/adg-pattern.c deleted file mode 100644 index 337ef18c..00000000 --- a/src/adg/adg-pattern.c +++ /dev/null @@ -1,58 +0,0 @@ -/* ADG - Automatic Drawing Generation - * Copyright (C) 2007,2008,2009,2010,2011,2012 Nicola Fontana - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -/** - * SECTION:adg-pattern - * @Section_Id:AdgPattern - * @title: AdgPattern - * @short_description: A wrapper for #cairo_pattern_t - * - * AdgPattern is a wrapper in #GType syntax of the #cairo_pattern_t struct. - * - * Since: 1.0 - **/ - -/** - * AdgPattern: - * - * Another name for #cairo_pattern_t: check its documentation for the - * fields description and visibility details. - * - * Since: 1.0 - **/ - - -#include "adg-internal.h" - -#include "adg-pattern.h" - - -GType -adg_pattern_get_type(void) -{ - static GType pattern_type = 0; - - if (G_UNLIKELY(pattern_type == 0)) - pattern_type = g_boxed_type_register_static("AdgPattern", - (GBoxedCopyFunc) cairo_pattern_reference, - (GBoxedFreeFunc) cairo_pattern_destroy); - - return pattern_type; -} diff --git a/src/adg/adg-pattern.h b/src/adg/adg-pattern.h deleted file mode 100644 index 494bde51..00000000 --- a/src/adg/adg-pattern.h +++ /dev/null @@ -1,44 +0,0 @@ -/* ADG - Automatic Drawing Generation - * Copyright (C) 2007,2008,2009,2010,2011,2012 Nicola Fontana - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -#if !defined(__ADG_H__) -#error "Only can be included directly." -#endif - - -#ifndef __ADG_PATTERN_H__ -#define __ADG_PATTERN_H__ - - -G_BEGIN_DECLS - -#define _AdgPattern _cairo_pattern -#define ADG_TYPE_PATTERN (adg_pattern_get_type()) - - -typedef struct _AdgPattern AdgPattern; - - -GType adg_pattern_get_type (void) G_GNUC_CONST; - -G_END_DECLS - - -#endif /* __ADG_PATTERN_H__ */ diff --git a/src/adg/adg-ruled-fill.c b/src/adg/adg-ruled-fill.c index 7241a4c0..a414df6f 100644 --- a/src/adg/adg-ruled-fill.c +++ b/src/adg/adg-ruled-fill.c @@ -40,16 +40,16 @@ #include "adg-internal.h" -#include "adg-pattern.h" #include "adg-dress.h" #include "adg-dress-builtins.h" #include "adg-style.h" #include "adg-fill-style.h" -#include #include "adg-ruled-fill.h" #include "adg-ruled-fill-private.h" +#include + #define _ADG_OLD_STYLE_CLASS ((AdgStyleClass *) adg_ruled_fill_parent_class) #define _ADG_OLD_FILL_STYLE_CLASS ((AdgFillStyleClass *) adg_ruled_fill_parent_class) @@ -328,7 +328,7 @@ static void _adg_apply(AdgStyle *style, AdgEntity *entity, cairo_t *cr) { AdgFillStyle *fill_style; - AdgPattern *pattern; + cairo_pattern_t *pattern; const CpmlExtents *extents; fill_style = (AdgFillStyle *) style; diff --git a/src/adg/tests/test-fill-style.c b/src/adg/tests/test-fill-style.c index 4a2af83a..9e550b4a 100644 --- a/src/adg/tests/test-fill-style.c +++ b/src/adg/tests/test-fill-style.c @@ -25,9 +25,9 @@ static void _adg_test_pattern(void) { AdgFillStyle *fill_style; - AdgPattern *valid_pattern_1, *valid_pattern_2; - const AdgPattern *pattern; - AdgPattern *pattern_dup; + cairo_pattern_t *valid_pattern_1, *valid_pattern_2; + const cairo_pattern_t *pattern; + cairo_pattern_t *pattern_dup; fill_style = ADG_FILL_STYLE(adg_ruled_fill_new()); valid_pattern_1 = cairo_pattern_create_rgba(0, 0, 0, 0); -- 2.11.4.GIT