From 926f61aaa35537e5d1681c21d4cc37b9af380df2 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Wed, 1 Oct 2025 23:05:49 +0200 Subject: [PATCH] use logdomain. --- src/lib/aqdiagram/draw/context_cairo.c | 62 +++++++++++++------------- src/lib/aqdiagram/draw/w_drawable.c | 6 +-- src/lib/aqdiagram/draw/w_label.c | 8 ++-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/lib/aqdiagram/draw/context_cairo.c b/src/lib/aqdiagram/draw/context_cairo.c index 0eec12f..c287361 100644 --- a/src/lib/aqdiagram/draw/context_cairo.c +++ b/src/lib/aqdiagram/draw/context_cairo.c @@ -87,12 +87,12 @@ AQDG_DRAW_CONTEXT *AQDG_Draw_ContextCairo_Pdf_new(const char *fileName, int w, i xg->surface=cairo_pdf_surface_create(fileName, w, h); if (xg->surface==NULL) { - DBG_ERROR(0, "Unable to create surface"); + DBG_ERROR(AQDG_LOGDOMAIN, "Unable to create surface"); } xg->cr=cairo_create(xg->surface); if (xg->cr==NULL) { - DBG_ERROR(0, "Could not create cairo context"); + DBG_ERROR(AQDG_LOGDOMAIN, "Could not create cairo context"); } /* set virtual functions */ @@ -133,12 +133,12 @@ AQDG_DRAW_CONTEXT *AQDG_Draw_ContextCairo_Ps_new(const char *fileName, int w, in xg->surface=cairo_ps_surface_create(fileName, w, h); if (xg->surface==NULL) { - DBG_ERROR(0, "Unable to create surface"); + DBG_ERROR(AQDG_LOGDOMAIN, "Unable to create surface"); } xg->cr=cairo_create(xg->surface); if (xg->cr==NULL) { - DBG_ERROR(0, "Could not create cairo context"); + DBG_ERROR(AQDG_LOGDOMAIN, "Could not create cairo context"); } /* set virtual functions */ @@ -181,12 +181,12 @@ AQDG_DRAW_CONTEXT *AQDG_Draw_ContextCairo_Png_new(const char *fileName, int w, i xg->surface=cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h); if (xg->surface==NULL) { - DBG_ERROR(0, "Unable to create surface"); + DBG_ERROR(AQDG_LOGDOMAIN, "Unable to create surface"); } xg->cr=cairo_create(xg->surface); if (xg->cr==NULL) { - DBG_ERROR(0, "Could not create cairo context"); + DBG_ERROR(AQDG_LOGDOMAIN, "Could not create cairo context"); } /* set virtual functions */ @@ -246,7 +246,7 @@ int _penCreate(AQDG_DRAW_CONTEXT *g, uint32_t frontColour, int lineWidth, int da xg=_ensureCairoSurface(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } @@ -257,7 +257,7 @@ int _penCreate(AQDG_DRAW_CONTEXT *g, uint32_t frontColour, int lineWidth, int da AQDG_Draw_Pen_SetDashType(pen, dashType); AQDG_Draw_Pen_List_Add(pen, xg->penList); - DBG_ERROR(NULL, "Created pen %d", xg->lastPenId); + DBG_DEBUG(AQDG_LOGDOMAIN, "Created pen %d", xg->lastPenId); return xg->lastPenId; } @@ -270,13 +270,13 @@ int _penRelease(AQDG_DRAW_CONTEXT *g, int penId) xg=_ensureCairoSurface(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); if (pen==NULL) { - DBG_INFO(0, "Pen %d not found", penId); + DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId); return GWEN_ERROR_NOT_FOUND; } @@ -294,13 +294,13 @@ int _drawLine(AQDG_DRAW_CONTEXT *g, int penId, int xStart, int yStart, int xEnd, xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); if (pen==NULL) { - DBG_ERROR(0, "Pen %d not found", penId); + DBG_ERROR(AQDG_LOGDOMAIN, "Pen %d not found", penId); return GWEN_ERROR_NOT_FOUND; } @@ -324,13 +324,13 @@ int _drawRect(AQDG_DRAW_CONTEXT *g, int penId, int x, int y, int w, int h) xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); if (pen==NULL) { - DBG_INFO(0, "Pen %d not found", penId); + DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId); return GWEN_ERROR_NOT_FOUND; } @@ -354,13 +354,13 @@ int _drawFilledRect(AQDG_DRAW_CONTEXT *g, int penId, int x, int y, int w, int h) xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); if (pen==NULL) { - DBG_INFO(0, "Pen %d not found", penId); + DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId); return GWEN_ERROR_NOT_FOUND; } @@ -385,7 +385,7 @@ int _fontCreate(AQDG_DRAW_CONTEXT *g, const char *face, int fontSize, int fontSl xg=_ensureCairoSurface(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } @@ -410,13 +410,13 @@ int _fontRelease(AQDG_DRAW_CONTEXT *g, int fontId) xg=_ensureCairoSurface(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); if (font==NULL) { - DBG_INFO(0, "Font %d not found", fontId); + DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId); return GWEN_ERROR_NOT_FOUND; } @@ -436,14 +436,14 @@ int _drawText(AQDG_DRAW_CONTEXT *g, int penId, int fontId, int direction, int x, xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } /* get and handle pen */ pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); if (pen==NULL) { - DBG_INFO(0, "Pen %d not found", penId); + DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId); return GWEN_ERROR_NOT_FOUND; } @@ -452,7 +452,7 @@ int _drawText(AQDG_DRAW_CONTEXT *g, int penId, int fontId, int direction, int x, /* get and handle font */ font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); if (font==NULL) { - DBG_INFO(0, "Font %d not found", fontId); + DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId); return GWEN_ERROR_NOT_FOUND; } _setFont(xg->cr, font); @@ -460,7 +460,7 @@ int _drawText(AQDG_DRAW_CONTEXT *g, int penId, int fontId, int direction, int x, cairo_text_extents(xg->cr, text, &te); /* TODO: translate pos and rotate according to given direction (use cairo_save and cairo_restore) */ - /*DBG_ERROR(NULL, "te.x_bearing=%f, te.y_bearing=%f", te.x_bearing, te.y_bearing);*/ + /*DBG_ERROR(AQDG_LOGDOMAIN, "te.x_bearing=%f, te.y_bearing=%f", te.x_bearing, te.y_bearing);*/ cairo_move_to(xg->cr, x, y-te.y_bearing); cairo_show_text(xg->cr, text); @@ -477,14 +477,14 @@ int _getTextWidth(AQDG_DRAW_CONTEXT *g, int fontId, const char *text) xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } /* get and handle font */ font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); if (font==NULL) { - DBG_INFO(0, "Font %d not found", fontId); + DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId); return GWEN_ERROR_NOT_FOUND; } @@ -505,14 +505,14 @@ int _getTextHeight(AQDG_DRAW_CONTEXT *g, int fontId, const char *text) xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } /* get and handle font */ font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); if (font==NULL) { - DBG_INFO(0, "Font %d not found", fontId); + DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId); return GWEN_ERROR_NOT_FOUND; } @@ -531,7 +531,7 @@ int _finish(AQDG_DRAW_CONTEXT *g) xg=_ensureFullCairoContext(g); if (xg==NULL) { - DBG_INFO(NULL, "here"); + DBG_INFO(AQDG_LOGDOMAIN, "here"); return GWEN_ERROR_INVALID; } @@ -541,7 +541,7 @@ int _finish(AQDG_DRAW_CONTEXT *g) cairo_surface_flush(xg->surface); st=cairo_surface_write_to_png(xg->surface, xg->fileName); if (st!=CAIRO_STATUS_SUCCESS) { - DBG_ERROR(0, "Cairo Status: %d (%s)", st, cairo_status_to_string(st)); + DBG_ERROR(AQDG_LOGDOMAIN, "Cairo Status: %d (%s)", st, cairo_status_to_string(st)); } } @@ -573,7 +573,7 @@ AQDG_DRAW_CONTEXT_CAIRO *_ensureFullCairoContext(const AQDG_DRAW_CONTEXT *g) xg=_ensureCairoSurface(g); if (xg) { if (xg->cr==NULL) { - DBG_INFO(0, "Graphics context not active, call \"AQDG_Draw_Context_BeginDraw()\" first"); + DBG_INFO(AQDG_LOGDOMAIN, "Graphics context not active, call \"AQDG_Draw_Context_BeginDraw()\" first"); return NULL; } return xg; @@ -592,7 +592,7 @@ AQDG_DRAW_CONTEXT_CAIRO *_ensureCairoSurface(const AQDG_DRAW_CONTEXT *g) xg=GWEN_INHERIT_GETDATA(AQDG_DRAW_CONTEXT, AQDG_DRAW_CONTEXT_CAIRO, g); if (xg) { if (xg->surface==NULL) { - DBG_ERROR(0, "No surface created"); + DBG_ERROR(AQDG_LOGDOMAIN, "No surface created"); return NULL; } } diff --git a/src/lib/aqdiagram/draw/w_drawable.c b/src/lib/aqdiagram/draw/w_drawable.c index fc96bf0..f8f6cef 100644 --- a/src/lib/aqdiagram/draw/w_drawable.c +++ b/src/lib/aqdiagram/draw/w_drawable.c @@ -305,7 +305,7 @@ int AQDG_DrawableWidget_DrawBackground(AQDG_OBJECT *object) xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_DRAWABLE, object); if (xo) { #if 0 - DBG_ERROR(NULL, "Drawing background with pen %d to %d/%d %d/%d", + DBG_ERROR(AQDG_LOGDOMAIN, "Drawing background with pen %d to %d/%d %d/%d", xo->backgroundPenId, AQDG_Object_GetAbsoluteX(object), AQDG_Object_GetAbsoluteY(object), @@ -443,7 +443,7 @@ int AQDG_DrawableWidget_GetTextWidth(AQDG_OBJECT *object) w=AQDG_Draw_Context_GetTextWidth(xo->drawContext, xo->fontId, xo->text); if (w<0) { - DBG_INFO(NULL, "here (%d)", w); + DBG_INFO(AQDG_LOGDOMAIN, "here (%d)", w); return 0; } return w; @@ -467,7 +467,7 @@ int AQDG_DrawableWidget_GetTextHeight(AQDG_OBJECT *object) h=AQDG_Draw_Context_GetTextHeight(xo->drawContext, xo->fontId, xo->text); if (h<0) { - DBG_INFO(NULL, "here (%d)", h); + DBG_INFO(AQDG_LOGDOMAIN, "here (%d)", h); return 0; } return h; diff --git a/src/lib/aqdiagram/draw/w_label.c b/src/lib/aqdiagram/draw/w_label.c index ab4a2e1..797de6c 100644 --- a/src/lib/aqdiagram/draw/w_label.c +++ b/src/lib/aqdiagram/draw/w_label.c @@ -85,7 +85,7 @@ int _calcXPos(AQDG_OBJECT *object, uint32_t opts, int tw) w=AQDG_Object_GetWidth(object)-AQDG_Object_GetBorderLeft(object)-AQDG_Object_GetBorderRight(object); if (w<0) { - DBG_ERROR(NULL, "Width smaller than borders (%d)", w); + DBG_ERROR(AQDG_LOGDOMAIN, "Width smaller than borders (%d)", w); return AQDG_Object_GetBorderLeft(object); } @@ -103,7 +103,7 @@ int _calcXPos(AQDG_OBJECT *object, uint32_t opts, int tw) } if (x