From 908e4c8485a7078f80ab2ccee50cf4a1749967de Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 24 Jun 2007 14:30:51 +0000 Subject: [PATCH] Some code adjustments. git-svn-id: svn+ssh://saetta.homelinux.org/svn/libreptool/trunk@19 3191ed1d-3fce-41bb-ab4a-0cebc0943b59 --- ChangeLog | 7 +++++++ src/Makefile.am | 3 ++- src/rptcommon.c | 2 +- src/rptcommon.h | 2 +- src/rptobject.c | 2 +- src/rptobjecttext.c | 15 +++++++++++++-- src/rptprint.c | 11 +++++++++-- src/rptreport.c | 2 +- 8 files changed, 35 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f579af5..44492fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-24 Andrea Zagli + + * src/rptobjtext.c: setted default font + * src/rptcommon.h: + * src/rptcommon.c: + * src/rptprint.c: changed font->size to gint + 2007-05-20 Andrea Zagli * src/rptreport.h: diff --git a/src/Makefile.am b/src/Makefile.am index cee7233..e378d6a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,8 @@ LIBS = $(REPTOOL_LIBS) \ -lfl -AM_CPPFLAGS = $(REPTOOL_CFLAGS) +AM_CPPFLAGS = $(REPTOOL_CFLAGS) \ + -DG_LOG_DOMAIN=\"libreptool\" lib_LTLIBRARIES = libreptool.la diff --git a/src/rptcommon.c b/src/rptcommon.c index f1e31b3..aef9839 100644 --- a/src/rptcommon.c +++ b/src/rptcommon.c @@ -164,7 +164,7 @@ RptFont font = (RptFont *)g_malloc0 (sizeof (RptFont)); font->name = g_strdup ("sans"); - font->size = 12.0; + font->size = 12; font->bold = FALSE; font->italic = FALSE; font->underline = PANGO_UNDERLINE_NONE; diff --git a/src/rptcommon.h b/src/rptcommon.h index c3e4f03..08d34e3 100644 --- a/src/rptcommon.h +++ b/src/rptcommon.h @@ -77,7 +77,7 @@ typedef struct _RptRotation RptRotation; struct _RptFont { gchar *name; - gdouble size; + gint size; gboolean bold; gboolean italic; PangoUnderline underline; diff --git a/src/rptobject.c b/src/rptobject.c index d3a888a..70f9a2f 100644 --- a/src/rptobject.c +++ b/src/rptobject.c @@ -118,7 +118,7 @@ rpt_object_init (RptObject *rpt_object) RptObject *rpt_object_new (const gchar *name, RptPoint position) { - RptObject *rpt_object = RPT_OBJECT (g_object_new (rpt_object_get_type (), NULL));; + RptObject *rpt_object = RPT_OBJECT (g_object_new (rpt_object_get_type (), NULL)); g_object_set (rpt_object, "name", name, diff --git a/src/rptobjecttext.c b/src/rptobjecttext.c index 26a8905..afad6fc 100644 --- a/src/rptobjecttext.c +++ b/src/rptobjecttext.c @@ -174,13 +174,24 @@ rpt_obj_text_init (RptObjText *rpt_obj_text) { RptObjTextPrivate *priv = RPT_OBJ_TEXT_GET_PRIVATE (rpt_obj_text); - priv->size = (RptSize *)g_malloc0 (sizeof (RptSize)); + RptFont *font; + RptColor *color; + + priv->size = g_new0 (RptSize, 1); priv->size->width = 0.0; priv->size->height = 0.0; + color = g_new0 (RptColor, 1); + color->a = 1.0; + + font = g_new0 (RptFont, 1); + font->name = g_strdup ("Sans"); + font->size = 12; + font->color = color; + priv->rotation = NULL; priv->border = NULL; - priv->font = NULL; + priv->font = font; priv->align = NULL; priv->background_color = NULL; } diff --git a/src/rptprint.c b/src/rptprint.c index a25b014..ff2ad49 100644 --- a/src/rptprint.c +++ b/src/rptprint.c @@ -698,7 +698,7 @@ rpt_print_text_xml (RptPrint *rpt_print, xmlNode *xnode) } if (font->size > 0) { - str_font = g_strconcat (str_font, g_strdup_printf (" %f", font->size), NULL); + str_font = g_strconcat (str_font, g_strdup_printf (" %d", font->size), NULL); } else { @@ -1056,7 +1056,14 @@ rpt_print_line (RptPrint *rpt_print, const RptPoint *from_p, const RptPoint *to_ { /* TO DO */ /*cairo_set_line_width (priv->cr, stroke.width);*/ - cairo_set_source_rgba (priv->cr, stroke->color->r, stroke->color->g, stroke->color->b, stroke->color->a); + if (stroke->color != NULL) + { + cairo_set_source_rgba (priv->cr, stroke->color->r, stroke->color->g, stroke->color->b, stroke->color->a); + } + else + { + cairo_set_source_rgba (priv->cr, 0.0, 0.0, 0.0, 1.0); + } if (stroke->style != NULL) { gdouble *dash = rpt_common_style_to_array (stroke->style); diff --git a/src/rptreport.c b/src/rptreport.c index 868345e..ba68447 100644 --- a/src/rptreport.c +++ b/src/rptreport.c @@ -1558,7 +1558,7 @@ rpt_report_section_create (RptReport *rpt_report, RptReportSection section) break; case RPTREPORT_SECTION_BODY: - g_warning ("Body cannot be created."); + /*g_warning ("Body cannot be created.");*/ break; } } -- 2.49.0