[dia] fixup some debug messages
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] fixup some debug messages
- Date: Thu, 29 Aug 2019 15:48:05 +0000 (UTC)
commit 4796dfc780de8aa6e09742057dd9a7bbc833e691
Author: Zander Brown <zbrown gnome org>
Date: Wed Aug 28 17:58:18 2019 +0100
fixup some debug messages
app/disp_callbacks.c | 13 ++--
app/interface.c | 31 +++++++---
lib/plug-ins.c | 44 ++++++-------
objects/custom/shape_info.c | 84 +++++++++++++------------
plug-ins/drs/dia-render-script-import.c | 39 ++++++------
plug-ins/python/pydia-property.c | 106 ++++++++++++++++++++------------
plug-ins/svg/svg-import.c | 69 +++++++++++++--------
7 files changed, 226 insertions(+), 160 deletions(-)
---
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index ad856d7c..442c6fa2 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -751,14 +751,15 @@ ddisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_FOCUS_CHANGE: {
- GdkEventFocus *focus = (GdkEventFocus*)event;
- hold_remove_handler();
- if (focus->in) {
- display_set_active(ddisp);
- ddisplay_do_update_menu_sensitivity(ddisp);
- }
+ GdkEventFocus *focus = (GdkEventFocus*) event;
+ hold_remove_handler ();
+ if (focus->in) {
+ display_set_active (ddisp);
+ ddisplay_do_update_menu_sensitivity (ddisp);
+ }
break;
}
+
case GDK_2BUTTON_PRESS:
display_set_active(ddisp);
hold_remove_handler();
diff --git a/app/interface.c b/app/interface.c
index 7b9414b2..925745dc 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define G_LOG_DOMAIN "Dia"
+
#include <config.h>
#include <gtk/gtk.h>
@@ -359,7 +361,7 @@ canvas_configure_event (GtkWidget *widget,
/* Only do this when size is really changing */
if (width != cevent->width || height != cevent->height) {
- g_print ("Canvas size change...\n");
+ g_debug ("%s: Canvas size change...", G_STRLOC);
ddisplay_resize_canvas (ddisp, cevent->width, cevent->height);
ddisplay_update_scrollbars(ddisp);
/* on resize stop further propagation - does not help */
@@ -481,6 +483,7 @@ _ddisplay_setup_rulers (DDisplay *ddisp, GtkWidget *shell, GtkWidget *table)
gtk_table_attach (GTK_TABLE (table), ddisp->vrule, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
}
+
static void
_ddisplay_setup_events (DDisplay *ddisp, GtkWidget *shell)
{
@@ -489,15 +492,24 @@ _ddisplay_setup_events (DDisplay *ddisp, GtkWidget *shell)
GDK_POINTER_MOTION_HINT_MASK |
GDK_FOCUS_CHANGE_MASK);
- g_signal_connect (G_OBJECT (shell), "focus_out_event",
- G_CALLBACK (ddisplay_focus_out_event), ddisp);
- g_signal_connect (G_OBJECT (shell), "focus_in_event",
- G_CALLBACK (ddisplay_focus_in_event), ddisp);
- g_signal_connect (G_OBJECT (shell), "realize",
- G_CALLBACK (ddisplay_realize), ddisp);
- g_signal_connect (G_OBJECT (shell), "unrealize",
- G_CALLBACK (ddisplay_unrealize), ddisp);
+ g_signal_connect (G_OBJECT (shell),
+ "focus_out_event",
+ G_CALLBACK (ddisplay_focus_out_event),
+ ddisp);
+ g_signal_connect (G_OBJECT (shell),
+ "focus_in_event",
+ G_CALLBACK (ddisplay_focus_in_event),
+ ddisp);
+ g_signal_connect (G_OBJECT (shell),
+ "realize",
+ G_CALLBACK (ddisplay_realize),
+ ddisp);
+ g_signal_connect (G_OBJECT (shell),
+ "unrealize",
+ G_CALLBACK (ddisplay_unrealize),
+ ddisp);
}
+
static void
_ddisplay_setup_scrollbars (DDisplay *ddisp, GtkWidget *table, int width, int height)
{
@@ -546,6 +558,7 @@ _ddisplay_setup_navigation (DDisplay *ddisp, GtkWidget *table, gboolean top_left
if (!ddisp->origin)
ddisp->origin = g_object_ref (navigation_button);
}
+
/**
* @param ddisp The diagram display object that a window is created for
* @param title
diff --git a/lib/plug-ins.c b/lib/plug-ins.c
index 478e845a..4efd07c9 100644
--- a/lib/plug-ins.c
+++ b/lib/plug-ins.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define G_LOG_DOMAIN "Dia"
+
#include <config.h>
#include <stdlib.h>
@@ -76,7 +78,7 @@ gboolean
dia_plugin_info_init(PluginInfo *info,
const gchar *name,
const gchar *description,
- PluginCanUnloadFunc can_unload_func,
+ PluginCanUnloadFunc can_unload_func,
PluginUnloadFunc unload_func)
{
g_free(info->name);
@@ -168,7 +170,7 @@ dia_plugin_load(PluginInfo *info)
if (info->is_loaded)
return;
-
+
#ifdef G_OS_WIN32
/* suppress the systems error dialog, we can handle a plug-in not loadable */
error_mode = SetErrorMode (SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
@@ -253,7 +255,7 @@ dia_register_plugin(const gchar *filename)
GList *tmp;
PluginInfo *info;
- g_debug("Loading %s\n", filename);
+ g_debug ("%s: Loading %s", G_STRLOC, filename);
/* check if plugin has already been registered */
for (tmp = plugins; tmp != NULL; tmp = tmp->next) {
@@ -285,7 +287,7 @@ dia_register_plugin(const gchar *filename)
typedef void (*ForEachInDirDoFunc)(const gchar *name);
typedef gboolean (*ForEachInDirFilterFunc)(const gchar *name);
-static void
+static void
for_each_in_dir(const gchar *directory, ForEachInDirDoFunc dofunc,
ForEachInDirFilterFunc filter)
{
@@ -313,14 +315,14 @@ for_each_in_dir(const gchar *directory, ForEachInDirDoFunc dofunc,
g_dir_close(dp);
}
-static gboolean
+static gboolean
directory_filter(const gchar *name)
{
return g_file_test (name, G_FILE_TEST_IS_DIR);
}
-static gboolean
-dia_plugin_filter(const gchar *name)
+static gboolean
+dia_plugin_filter(const gchar *name)
{
return g_str_has_suffix(name, G_MODULE_SUFFIX)
&& g_file_test(name, G_FILE_TEST_IS_REGULAR);
@@ -329,7 +331,7 @@ dia_plugin_filter(const gchar *name)
void
dia_register_plugins_in_dir(const gchar *directory)
{
- g_debug("Registering plugins in %s\n", directory);
+ g_debug ("%s: Registering plugins in %s", G_STRLOC, directory);
for_each_in_dir(directory, dia_register_plugin, dia_plugin_filter);
for_each_in_dir(directory, dia_register_plugins_in_dir, directory_filter);
@@ -419,7 +421,7 @@ ensure_pluginrc(void)
pluginrc = diaXmlParseFile(filename, ctx, FALSE);
else
pluginrc = NULL;
-
+
g_free(filename);
if (!pluginrc) {
@@ -447,8 +449,8 @@ plugin_load_inhibited(const gchar *filename)
xmlNodePtr node;
ensure_pluginrc();
- for (node = pluginrc->xmlRootNode->xmlChildrenNode;
- node != NULL;
+ for (node = pluginrc->xmlRootNode->xmlChildrenNode;
+ node != NULL;
node = node->next) {
xmlChar *node_filename;
@@ -461,8 +463,8 @@ plugin_load_inhibited(const gchar *filename)
xmlNodePtr node2;
xmlFree(node_filename);
- for (node2 = node->xmlChildrenNode;
- node2 != NULL;
+ for (node2 = node->xmlChildrenNode;
+ node2 != NULL;
node2 = node2->next) {
if (xmlIsBlankNode(node2)) continue;
if (node2->type == XML_ELEMENT_NODE &&
@@ -491,8 +493,8 @@ info_fill_from_pluginrc(PluginInfo *info)
info->unload_func = NULL;
ensure_pluginrc();
- for (node = pluginrc->xmlRootNode->xmlChildrenNode;
- node != NULL;
+ for (node = pluginrc->xmlRootNode->xmlChildrenNode;
+ node != NULL;
node = node->next) {
xmlChar *node_filename;
@@ -505,8 +507,8 @@ info_fill_from_pluginrc(PluginInfo *info)
xmlNodePtr node2;
xmlFree(node_filename);
- for (node2 = node->xmlChildrenNode;
- node2 != NULL;
+ for (node2 = node->xmlChildrenNode;
+ node2 != NULL;
node2 = node2->next) {
gchar *content;
@@ -557,8 +559,8 @@ dia_pluginrc_write(void)
if (info->inhibit_load)
(void)xmlNewChild(pluginnode, NULL, (const xmlChar *)"inhibit-load", NULL);
- for (node = pluginrc->xmlRootNode->xmlChildrenNode;
- node != NULL;
+ for (node = pluginrc->xmlRootNode->xmlChildrenNode;
+ node != NULL;
node = node->next) {
xmlChar *node_filename;
@@ -583,9 +585,9 @@ dia_pluginrc_write(void)
}
filename = dia_config_filename("pluginrc");
-
+
xmlDiaSaveFile(filename, pluginrc);
-
+
g_free(filename);
free_pluginrc();
}
diff --git a/objects/custom/shape_info.c b/objects/custom/shape_info.c
index c73c6ada..9b28bedf 100644
--- a/objects/custom/shape_info.c
+++ b/objects/custom/shape_info.c
@@ -21,6 +21,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
+#define G_LOG_DOMAIN "DiaCustom"
+
#include <config.h>
#include <stdlib.h>
@@ -100,7 +103,7 @@ shape_info_getbyname(const gchar *name)
/*!
* \brief After loading and before drawing ShapeInfo needs to be realised
* @param : the shape to realise
- *
+ *
* Puts the ShapeInfo into a form suitable for actual use (lazy loading)
*
* \extends _ShapeInfo
@@ -109,7 +112,7 @@ void
shape_info_realise(ShapeInfo* info)
{
GList* tmp;
-
+
for (tmp = info->display_list; tmp != NULL; tmp = tmp->next) {
GraphicElement *el = tmp->data;
if (el->type == GE_TEXT) {
@@ -130,7 +133,7 @@ shape_info_realise(ShapeInfo* info)
}
text_calc_boundingbox(el->text.object, &el->text.text_bounds);
}
- }
+ }
}
real
@@ -138,7 +141,7 @@ shape_info_get_default_width(ShapeInfo *info)
{
if (info->default_width == 0.0)
info->default_width = DEFAULT_WIDTH;
-
+
return( info->default_width );
}
@@ -147,7 +150,7 @@ shape_info_get_default_height(ShapeInfo *info)
{
if (info->default_height == 0.0)
info->default_height = DEFAULT_HEIGHT;
-
+
return( info->default_height );
}
@@ -205,10 +208,10 @@ is_subshape(xmlNode* node)
if (xmlHasProp(node, (const xmlChar*)"subshape")) {
xmlChar* value = xmlGetProp(node, (const xmlChar*)"subshape");
-
+
if (!strcmp((const char*)value, "true"))
res = TRUE;
-
+
xmlFree(value);
}
@@ -217,7 +220,7 @@ is_subshape(xmlNode* node)
/*!
* \brief Parse the SVG node from a shape file
- *
+ *
* Fill the ShapeInfo display list with GraphicElement each got from
* a single node within the shape's SVG part.
*
@@ -283,7 +286,7 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
}
xmlFree(str);
val = 0;
- if (arr->len % 2 == 1)
+ if (arr->len % 2 == 1)
g_array_append_val(arr, val);
poly = g_malloc0(sizeof(GraphicElementPoly) + arr->len/2*sizeof(Point));
el = (GraphicElement *)poly;
@@ -314,7 +317,7 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
}
xmlFree(str);
val = 0;
- if (arr->len % 2 == 1)
+ if (arr->len % 2 == 1)
g_array_append_val(arr, val);
poly = g_malloc0(sizeof(GraphicElementPoly) + arr->len/2*sizeof(Point));
el = (GraphicElement *)poly;
@@ -495,8 +498,11 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
image->image = dia_image_load(imgfn);
}
- if (!image->image)
- g_debug("failed to load image file %s", imgfn ? imgfn : "(data:)");
+ if (!image->image) {
+ g_debug ("%s: failed to load image file %s",
+ G_STRLOC,
+ imgfn ? imgfn : "(data:)");
+ }
g_free(imgfn);
xmlFree(str);
}
@@ -513,9 +519,9 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
ShapeInfo* tmpinfo = g_new0(ShapeInfo, 1);
xmlChar *v_anchor_attr = xmlGetProp(node, (const xmlChar*)"v_anchor");
xmlChar *h_anchor_attr = xmlGetProp(node, (const xmlChar*)"h_anchor");
-
+
parse_svg_node(tmpinfo, node, svg_ns, &s, filename);
-
+
tmpinfo->shape_bounds.top = DBL_MAX;
tmpinfo->shape_bounds.left = DBL_MAX;
tmpinfo->shape_bounds.bottom = -DBL_MAX;
@@ -523,18 +529,18 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
update_bounds( tmpinfo );
update_bounds( info );
-
+
subshape->half_width = (tmpinfo->shape_bounds.right-tmpinfo->shape_bounds.left) / 2.0;
subshape->half_height = (tmpinfo->shape_bounds.bottom-tmpinfo->shape_bounds.top) / 2.0;
subshape->center.x = tmpinfo->shape_bounds.left + subshape->half_width;
subshape->center.y = tmpinfo->shape_bounds.top + subshape->half_height;
-
+
subshape->type = GE_SUBSHAPE;
subshape->display_list = tmpinfo->display_list;
subshape->v_anchor_method = OFFSET_METHOD_FIXED;
subshape->h_anchor_method = OFFSET_METHOD_FIXED;
subshape->default_scale = 0.0;
-
+
if (!v_anchor_attr || !strcmp((const char*)v_anchor_attr,"fixed.top"))
subshape->v_anchor_method = OFFSET_METHOD_FIXED;
else if (v_anchor_attr && !strcmp((const char*)v_anchor_attr,"fixed.bottom"))
@@ -544,7 +550,7 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
else
fprintf( stderr, "illegal v_anchor `%s', defaulting to fixed.top\n",
v_anchor_attr );
-
+
if (!h_anchor_attr || !strcmp((const char*)h_anchor_attr,"fixed.left"))
subshape->h_anchor_method = OFFSET_METHOD_FIXED;
else if (h_anchor_attr && !strcmp((const char*)h_anchor_attr,"fixed.right"))
@@ -554,15 +560,15 @@ parse_svg_node(ShapeInfo *info, xmlNodePtr node, xmlNsPtr svg_ns,
else
fprintf( stderr, "illegal h_anchor `%s', defaulting to fixed.left\n",
h_anchor_attr );
-
+
info->subshapes = g_list_append(info->subshapes, subshape);
-
+
/* gfree( tmpinfo );*/
xmlFree(v_anchor_attr);
xmlFree(h_anchor_attr);
-
+
el = (GraphicElement *)subshape;
- }
+ }
}
if (el) {
el->any.s = s;
@@ -661,22 +667,22 @@ update_bounds(ShapeInfo *info)
break;
}
}
-
+
{
real width = info->shape_bounds.right-info->shape_bounds.left;
real height = info->shape_bounds.bottom-info->shape_bounds.top;
-
+
if (info->default_width > 0.0 && info->default_height == 0.0) {
info->default_height = (info->default_width / width) * height;
} else if (info->default_height > 0.0 && info->default_width == 0.0) {
- info->default_width = (info->default_height / height) * width;
+ info->default_width = (info->default_height / height) * width;
}
}
}
/*!
* \brief Contructor for ShapeInfo from file
- *
+ *
* Load the full shape info from file potentially reusing the preloaded
* ShapeInfo loaded by shape_typeinfo_load()
*
@@ -692,7 +698,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
ShapeInfo *info;
gchar *tmp;
int i;
-
+
if (!doc) {
g_warning("Custom shape parser error for %s\n%s", filename,
error_xml ? error_xml->message : "");
@@ -723,14 +729,14 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
if (preload)
info = preload;
- else
+ else
info = g_new0(ShapeInfo, 1);
info->loaded = TRUE;
info->shape_bounds.top = DBL_MAX;
info->shape_bounds.left = DBL_MAX;
info->shape_bounds.bottom = -DBL_MAX;
info->shape_bounds.right = -DBL_MAX;
- info->aspect_type = SHAPE_ASPECT_FREE;
+ info->aspect_type = SHAPE_ASPECT_FREE;
info->default_width = 0.0;
info->default_height = 0.0;
info->main_cp = -1;
@@ -742,7 +748,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
if (node->type != XML_ELEMENT_NODE) continue;
if (node->ns == shape_ns && !xmlStrcmp(node->name, (const xmlChar *)"name")) {
tmp = (gchar *) xmlNodeGetContent(node);
- if (preload) {
+ if (preload) {
if (strcmp (tmp, info->name) != 0)
g_warning ("Shape(preload) '%s' can't change name '%s'", info->name, tmp);
/* the key name is already used as key in name_to_info */
@@ -753,7 +759,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
xmlFree(tmp);
} else if (node->ns == shape_ns && !xmlStrcmp(node->name, (const xmlChar *)"icon")) {
tmp = (gchar *) xmlNodeGetContent(node);
- if (preload) {
+ if (preload) {
if (strstr (info->icon, tmp) == NULL) /* the left including the absolute path */
g_warning ("Shape(preload) '%s' can't change icon '%s'", info->icon, tmp);
/* the key name is already used as key in name_to_info */
@@ -766,8 +772,8 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
GArray *arr = g_array_new(FALSE, FALSE, sizeof(Point));
xmlNodePtr pt_node;
- for (pt_node = node->xmlChildrenNode;
- pt_node != NULL;
+ for (pt_node = node->xmlChildrenNode;
+ pt_node != NULL;
pt_node = pt_node->next) {
if (xmlIsBlankNode(pt_node)) continue;
@@ -806,7 +812,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
info->object_flags |= DIA_OBJECT_CAN_PARENT;
} else if (node->ns == shape_ns && !xmlStrcmp(node->name, (const xmlChar *)"textbox")) {
xmlChar *str;
-
+
str = xmlGetProp(node, (const xmlChar *)"x1");
if (str) {
info->text_bounds.left = g_ascii_strtod((gchar *) str, NULL);
@@ -838,7 +844,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
info->text_align = ALIGN_CENTER;
str = xmlGetProp(node, (const xmlChar *)"align");
if (str) {
- if (!xmlStrcmp(str, (const xmlChar *)"left"))
+ if (!xmlStrcmp(str, (const xmlChar *)"left"))
info->text_align = ALIGN_LEFT;
else if (!xmlStrcmp(str, (const xmlChar *)"right"))
info->text_align = ALIGN_RIGHT;
@@ -877,12 +883,12 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
xmlFree(tmp);
}
} else if (node->ns == shape_ns && (!xmlStrcmp(node->name, (const xmlChar *)"default-width") ||
!xmlStrcmp(node->name, (const xmlChar *)"default-height"))) {
-
+
int j = 0;
DiaUnitDef ud;
-
+
gdouble val = 0.0;
-
+
int unit_ssize = 0;
int ssize = 0;
tmp = (gchar *) xmlNodeGetContent(node);
@@ -903,7 +909,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload)
} else {
info->default_height = val;
}
-
+
xmlFree(tmp);
} else if (node->ns == svg_ns && !xmlStrcmp(node->name, (const xmlChar *)"svg")) {
DiaSvgStyle s = {
diff --git a/plug-ins/drs/dia-render-script-import.c b/plug-ins/drs/dia-render-script-import.c
index 00bdf148..829ddbbc 100644
--- a/plug-ins/drs/dia-render-script-import.c
+++ b/plug-ins/drs/dia-render-script-import.c
@@ -19,7 +19,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*! \file dia-render-script-import.c import of dia-render-script either to
+#define G_LOG_DOMAIN "DiaRS"
+
+/*! \file dia-render-script-import.c import of dia-render-script either to
* diagram with objects or maybe as one object */
#include <config.h>
@@ -37,7 +39,7 @@
/*!
* \defgroup DiaRenderScriptImport Dia Render Script Import
* \ingroup ImportFilters
- * \brief Importing _Layer, _DiaObject from their XML representation saved with _DrsRenderer
+ * \brief Importing _Layer, _DiaObject from their XML representation saved with _DrsRenderer
*/
static real
@@ -72,7 +74,7 @@ _parse_points (xmlNodePtr node, const char *attrib)
{
xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
GArray *arr = NULL;
-
+
if (str) {
gint i;
gchar **split = g_strsplit ((gchar *)str, " ", -1);
@@ -97,7 +99,7 @@ _parse_bezpoints (xmlNodePtr node, const char *attrib)
{
xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
GArray *arr = NULL;
-
+
if (str) {
gint i;
gchar **split = g_strsplit ((gchar *)str, " ", -1);
@@ -111,7 +113,7 @@ _parse_bezpoints (xmlNodePtr node, const char *attrib)
val = split[i];
pt->type = val[0] == 'M' ? BEZ_MOVE_TO : (val[0] == 'L' ? BEZ_LINE_TO : BEZ_CURVE_TO);
ep = (gchar *)val + 1;
-
+
pt->p1.x = ep ? g_ascii_strtod (ep, &ep) : 0;
pt->p1.y = ep ? ++ep, g_ascii_strtod (ep, &ep) : 0;
if (pt->type == BEZ_CURVE_TO) {
@@ -120,7 +122,7 @@ _parse_bezpoints (xmlNodePtr node, const char *attrib)
pt->p3.x = ep ? ++ep, g_ascii_strtod (ep, &ep) : 0;
pt->p3.y = ep ? ++ep, g_ascii_strtod (ep, &ep) : 0;
}
- }
+ }
g_strfreev(split);
xmlFree(str);
}
@@ -138,8 +140,8 @@ _parse_color (xmlNodePtr node, const char *attrib)
if (n > 2) {
val = g_new (Color, 1);
- val->red = r / 255.0;
- val->green = g / 255.0;
+ val->red = r / 255.0;
+ val->green = g / 255.0;
val->blue = b / 255.0;
val->alpha = a / 255.0;
}
@@ -370,7 +372,7 @@ find_child_named (xmlNodePtr node, const char *name)
/*!
* \brief Parse _DiaObject from the given node
* Fill a GList* with objects which is to be put in a
- * diagram or a group by the caller.
+ * diagram or a group by the caller.
* Can be called recursively to allow groups in groups.
* This is only using the render branch of the file, if the
* object type is not registered with Dia. Otherwise the objects
@@ -384,7 +386,7 @@ read_items (xmlNodePtr startnode, DiaContext *ctx)
GList *items = NULL;
for (node = startnode; node != NULL; node = node->next) {
- if (xmlIsBlankNode(node))
+ if (xmlIsBlankNode(node))
continue;
if (node->type != XML_ELEMENT_NODE)
continue;
@@ -392,7 +394,7 @@ read_items (xmlNodePtr startnode, DiaContext *ctx)
xmlChar *sType = xmlGetProp(node, (const xmlChar *)"type");
const DiaObjectType *ot = object_get_type ((gchar *)sType);
xmlNodePtr props = NULL, render = NULL;
-
+
props = find_child_named (node, "properties");
render = find_child_named (node, "render");
@@ -412,8 +414,8 @@ read_items (xmlNodePtr startnode, DiaContext *ctx)
Handle *handle1,*handle2;
DiaObject *o;
- o = ot->ops->create(&startpoint,
- ot->default_user_data,
+ o = ot->ops->create(&startpoint,
+ ot->default_user_data,
&handle1,&handle2);
if (o) {
object_load_props (o, props, ctx);
@@ -421,13 +423,14 @@ read_items (xmlNodePtr startnode, DiaContext *ctx)
}
} else if (render) {
DiaObject *o = _render_object (render, ctx);
- if (o)
- items = g_list_append (items, o);
+ if (o) {
+ items = g_list_append (items, o);
+ }
} else {
- g_debug ("DRS-Import: %s?", node->name);
+ g_debug ("%s: DRS-Import: %s?", G_STRLOC, node->name);
}
} else {
- g_debug ("DRS-Import: %s?", node->name);
+ g_debug ("%s: DRS-Import: %s?", G_STRLOC, node->name);
}
}
return items;
@@ -441,7 +444,7 @@ read_items (xmlNodePtr startnode, DiaContext *ctx)
* \ingroup DiaRenderScriptImport
*/
gboolean
-import_drs (const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data)
+import_drs (const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data)
{
GList *item, *items;
xmlDocPtr doc = xmlParseFile(filename);
diff --git a/plug-ins/python/pydia-property.c b/plug-ins/python/pydia-property.c
index 6f8d98bf..6922630b 100644
--- a/plug-ins/python/pydia-property.c
+++ b/plug-ins/python/pydia-property.c
@@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define G_LOG_DOMAIN "DiaPython"
+
#include <config.h>
#include <Python.h>
@@ -314,8 +316,9 @@ PyDia_set_Color (Property *prop, PyObject *val)
p->color_data.blue = color.blue / 65535.0;
p->color_data.alpha = 1.0;
return 0;
- } else
- g_debug("Failed to parse color string '%s'", str);
+ } else {
+ g_debug ("%s: Failed to parse color string '%s'", G_STRLOC, str);
+ }
} else if (PyTuple_Check (val)) {
int i, len = PyTuple_Size(val);
real f[3];
@@ -512,10 +515,13 @@ PyDia_set_BezPointArray(Property *prop, PyObject *val)
bpt.p3.x = PyFloat_AsDouble(PyTuple_GetItem(o, 5));
bpt.p3.y = PyFloat_AsDouble(PyTuple_GetItem(o, 6));
} else {
- if (0 == i && tp != BEZ_MOVE_TO)
- g_debug("First bezpoint must be BEZ_MOVE_TO");
- if (0 < i && tp != BEZ_LINE_TO)
- g_debug("Further bezpoint must be BEZ_LINE_TO or BEZ_CURVE_TO");
+ if (0 == i && tp != BEZ_MOVE_TO) {
+ g_debug ("%s: First bezpoint must be BEZ_MOVE_TO", G_STRLOC);
+ }
+ if (0 < i && tp != BEZ_LINE_TO) {
+ g_debug ("%s: Further bezpoint must be BEZ_LINE_TO or BEZ_CURVE_TO",
+ G_STRLOC);
+ }
bpt.type = (0 == i) ? BEZ_MOVE_TO : BEZ_LINE_TO;
/* not strictly needed */
@@ -665,7 +671,7 @@ PyDia_set_Array (Property *prop, PyObject *val)
setters[i] = (PyDiaPropSetFunc)prop_type_map[j].propset;
}
if (!setters[i]) {
- g_debug("No setter for '%s'", ex->descr->type);
+ g_debug ("%s: No setter for '%s'", G_STRLOC, ex->descr->type);
g_free(setters);
return -1;
}
@@ -689,28 +695,33 @@ PyDia_set_Array (Property *prop, PyObject *val)
GPtrArray *record = g_ptr_array_new();
guint j;
if (!PyTuple_Check(t) || PyTuple_Size(t) != num_props) {
- g_debug("PyDia_set_Array: %s.", !PyTuple_Check(t) ? "no tuple" : " wrong size");
- ret = -1;
- break;
+ g_debug ("%s: PyDia_set_Array: %s.",
+ G_STRLOC,
+ !PyTuple_Check(t) ? "no tuple" : " wrong size");
+ ret = -1;
+ break;
}
g_ptr_array_set_size(record, 0);
for (j = 0; j < num_props; j++) {
- Property *ex = g_ptr_array_index(p->ex_props, j);
- Property *inner = ex->ops->copy(ex);
- PyObject *v = PyTuple_GetItem(t, j);
-
- if (0 != setters[j] (inner, v)) {
- if (Py_None == v) {
- /* use just the defaults, setters don't need to handle this */
- } else {
- g_debug ("Failed to set '%s::%s' from '%s'",
- p->common.descr->name, inner->descr->name, v->ob_type->tp_name);
- inner->ops->free(inner);
- ret = -1;
- break;
- }
- }
- g_ptr_array_add(record, inner);
+ Property *ex = g_ptr_array_index (p->ex_props, j);
+ Property *inner = ex->ops->copy (ex);
+ PyObject *v = PyTuple_GetItem (t, j);
+
+ if (0 != setters[j] (inner, v)) {
+ if (Py_None == v) {
+ /* use just the defaults, setters don't need to handle this */
+ } else {
+ g_debug ("%s: Failed to set '%s::%s' from '%s'",
+ G_STRLOC,
+ p->common.descr->name,
+ inner->descr->name,
+ v->ob_type->tp_name);
+ inner->ops->free (inner);
+ ret = -1;
+ break;
+ }
+ }
+ g_ptr_array_add (record, inner);
}
g_ptr_array_add(p->records, record);
if (ret != 0)
@@ -821,11 +832,16 @@ PyDiaProperty_GetAttr(PyDiaProperty *self, gchar *attr)
int i;
ensure_quarks();
- for (i = 0; i < G_N_ELEMENTS(prop_type_map); i++)
- if (prop_type_map[i].quark == self->property->type_quark)
- return prop_type_map[i].propget(self->property);
- if (0 == (PROP_FLAG_WIDGET_ONLY & self->property->descr->flags))
- g_debug ("No handler for type '%s'", self->property->descr->type);
+ for (i = 0; i < G_N_ELEMENTS (prop_type_map); i++) {
+ if (prop_type_map[i].quark == self->property->type_quark) {
+ return prop_type_map[i].propget (self->property);
+ }
+ }
+ if (0 == (PROP_FLAG_WIDGET_ONLY & self->property->descr->flags)) {
+ g_debug ("%s: No handler for type '%s'",
+ G_STRLOC,
+ self->property->descr->type);
+ }
Py_INCREF(Py_None);
return Py_None;
@@ -861,24 +877,32 @@ int PyDiaProperty_ApplyToObject (DiaObject *object,
prop_list_free (plist);
return 0;
} else {
- g_debug("PyDiaProperty_ApplyToObject : no property conversion %s -> %s",
- inprop->descr->type, prop->descr->type);
+ g_debug ("%s: PyDiaProperty_ApplyToObject : no property conversion %s -> %s",
+ G_STRLOC,
+ inprop->descr->type,
+ prop->descr->type);
}
} else {
int i;
ensure_quarks();
for (i = 0; i < G_N_ELEMENTS(prop_type_map); i++) {
if (prop_type_map[i].quark == prop->type_quark) {
- if (!prop_type_map[i].propset)
- g_debug("Setter for '%s' not implemented.", prop_type_map[i].type);
- else if (0 == prop_type_map[i].propset(prop, val))
- ret = 0;
- break;
+ if (!prop_type_map[i].propset) {
+ g_debug ("%s: Setter for '%s' not implemented.",
+ G_STRLOC,
+ prop_type_map[i].type);
+ } else if (0 == prop_type_map[i].propset(prop, val)) {
+ ret = 0;
+ }
+ break;
}
}
- if (ret != 0)
- g_debug("PyDiaProperty_ApplyToObject : no conversion %s -> %s",
- key, prop->descr->type);
+ if (ret != 0) {
+ g_debug ("%s: PyDiaProperty_ApplyToObject : no conversion %s -> %s",
+ G_STRLOC,
+ key,
+ prop->descr->type);
+ }
}
if (0 == ret) {
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index 039c5e3a..27cb5fcb 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define G_LOG_DOMAIN "DiaSVG"
+
#include <config.h>
#include <stdio.h>
@@ -1443,34 +1445,49 @@ _node_read_viewbox (xmlNodePtr root, DiaMatrix **mat)
y1 = g_ascii_strtod (vals[1], NULL);
x2 = g_ascii_strtod (vals[2], NULL);
y2 = g_ascii_strtod (vals[3], NULL);
- g_debug ("viewBox(%f %f %f %f) = (%f,%f)\n", x1, y1, x2, y2, width, height);
+ g_debug ("%s: viewBox(%f %f %f %f) = (%f,%f)",
+ G_STRLOC,
+ x1,
+ y1,
+ x2,
+ y2,
+ width,
+ height);
/* some basic sanity check */
if (x2 > x1 && y2 > y1 && width > 0 && height > 0) {
- if (!percent) {
- /* viwBox is x-min y-min width height - so only use the latter for scaling */
- xs = (real)x2 / width;
- ys = (real)y2 / height;
- } else {
- xs = ys = DEFAULT_SVG_SCALE * (100.0 / sqrt(width*height));
- }
- /* plausibility check, strictly speaking these are not required to be the same
- * /or/ are they and Dia is writing a bogus viewBox?
- */
- if (fabs((fabs (xs/ys) - 1.0) < 0.1) && fabs((fabs (ys/xs) - 1.0) < 0.1)) {
- user_scale = xs;
- g_debug ("viewBox(%f %f %f %f) scaling (%f,%f) -> %f\n", x1, y1, x2, y2, xs, ys, user_scale);
- } else {
- /* the bigger the scale the smaller the objects */
- user_scale = MAX(xs, ys);
-#if 0 /* need to think about - might fly with preserveAspectRatio handling */
- if (mat) {
- DiaMatrix *m = g_new0 (DiaMatrix, 1);
- m->xx = xs > ys ? xs/ys : 1.0;
- m->yy = ys > xs ? ys/xs : 1.0;
- *mat = m;
- }
-#endif
- }
+ if (!percent) {
+ /* viwBox is x-min y-min width height - so only use the latter for scaling */
+ xs = (real) x2 / width;
+ ys = (real) y2 / height;
+ } else {
+ xs = ys = DEFAULT_SVG_SCALE * (100.0 / sqrt(width*height));
+ }
+ /* plausibility check, strictly speaking these are not required to be the same
+ * /or/ are they and Dia is writing a bogus viewBox?
+ */
+ if (fabs ((fabs (xs/ys) - 1.0) < 0.1) && fabs ((fabs (ys/xs) - 1.0) < 0.1)) {
+ user_scale = xs;
+ g_debug ("%s: viewBox(%f %f %f %f) scaling (%f,%f) -> %f",
+ G_STRLOC,
+ x1,
+ y1,
+ x2,
+ y2,
+ xs,
+ ys,
+ user_scale);
+ } else {
+ /* the bigger the scale the smaller the objects */
+ user_scale = MAX (xs, ys);
+ #if 0 /* need to think about - might fly with preserveAspectRatio handling */
+ if (mat) {
+ DiaMatrix *m = g_new0 (DiaMatrix, 1);
+ m->xx = xs > ys ? xs/ys : 1.0;
+ m->yy = ys > xs ? ys/xs : 1.0;
+ *mat = m;
+ }
+ #endif
+ }
}
}
g_strfreev (vals);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]