[dia/zbrown/test-build: 5/7] enums: now Alignment → DiaAlignment
- From: Zander Brown <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/zbrown/test-build: 5/7] enums: now Alignment → DiaAlignment
- Date: Mon, 27 Sep 2021 08:21:40 +0000 (UTC)
commit 9b27dbe8403ba3bc89892e8c4e5d0dfdada3747e
Author: Zander Brown <zbrown gnome org>
Date: Mon Sep 27 02:45:54 2021 +0100
enums: now Alignment → DiaAlignment
Yet another boring touches everything commit
lib/dia-enums.h | 10 ++--
lib/dia_svg.c | 16 +++---
lib/dia_svg.h | 2 +-
lib/diaimportrenderer.c | 27 +++++-----
lib/diapathrenderer.c | 18 +++----
lib/diarenderer.c | 71 +++++++++++++-----------
lib/diarenderer.h | 12 ++---
lib/diasvgrenderer.c | 65 ++++++++++++----------
lib/diatransformrenderer.c | 16 +++---
lib/properties.c | 6 +--
lib/properties.h | 6 +--
lib/renderer/diacairo-interactive.c | 10 ++--
lib/renderer/diacairo-renderer.c | 21 ++++----
lib/standard-path.c | 5 +-
lib/text.c | 46 ++++++++--------
lib/text.h | 20 ++++---
lib/textattr.h | 2 +-
lib/textline.c | 11 ++--
lib/textline.h | 4 +-
lib/widgets.c | 22 +++++---
lib/widgets.h | 8 +--
objects/AADL/aadlbox.c | 2 +-
objects/Database/database.h | 4 +-
objects/Database/reference.c | 67 ++++++++++++++---------
objects/Database/table.c | 11 ++--
objects/ER/attribute.c | 2 +-
objects/ER/entity.c | 2 +-
objects/ER/relationship.c | 10 ++--
objects/FS/flow-ortho.c | 19 +++++--
objects/FS/flow.c | 22 +++++---
objects/FS/function.c | 20 +++++--
objects/GRAFCET/action.c | 9 ++--
objects/GRAFCET/action_text_draw.c | 14 ++---
objects/GRAFCET/boolequation.c | 16 ++++--
objects/GRAFCET/step.c | 2 +-
objects/Istar/actor.c | 7 ++-
objects/Istar/goal.c | 2 +-
objects/Istar/link.c | 6 ++-
objects/Istar/other.c | 10 ++--
objects/Jackson/domain.c | 9 ++--
objects/Jackson/phenomenon.c | 6 ++-
objects/Jackson/requirement.c | 2 +-
objects/KAOS/goal.c | 2 +-
objects/KAOS/metaandorrel.c | 2 +-
objects/KAOS/metabinrel.c | 18 ++++---
objects/KAOS/other.c | 10 ++--
objects/Misc/measure.c | 2 +-
objects/SADT/annotation.c | 13 ++---
objects/SADT/box.c | 15 +++---
objects/UML/activity.c | 4 +-
objects/UML/actor.c | 6 ++-
objects/UML/association.c | 31 ++++++-----
objects/UML/class.c | 56 ++++++++++++++-----
objects/UML/classicon.c | 2 +-
objects/UML/component.c | 4 +-
objects/UML/component_feature.c | 2 +-
objects/UML/constraint.c | 2 +-
objects/UML/dependency.c | 8 +--
objects/UML/generalization.c | 11 ++--
objects/UML/implements.c | 2 +-
objects/UML/large_package.c | 4 +-
objects/UML/message.c | 2 +-
objects/UML/node.c | 7 ++-
objects/UML/note.c | 2 +-
objects/UML/object.c | 16 +++---
objects/UML/realizes.c | 11 ++--
objects/UML/small_package.c | 4 +-
objects/UML/state.c | 4 +-
objects/UML/transition.c | 4 +-
objects/UML/usecase.c | 2 +-
objects/chronogram/chronoline.c | 2 +-
objects/chronogram/chronoref.c | 2 +-
objects/custom/custom_object.c | 15 +++---
objects/custom/shape_info.c | 22 ++++----
objects/flowchart/box.c | 35 +++++++-----
objects/flowchart/diamond.c | 32 ++++++-----
objects/flowchart/ellipse.c | 27 ++++++----
objects/flowchart/parallelogram.c | 32 ++++++-----
objects/network/basestation.c | 13 +++--
objects/network/radiocell.c | 16 +++---
objects/standard/textobj.c | 26 +++++----
plug-ins/cgm/cgm.c | 22 ++++----
plug-ins/drs/dia-render-script-import.c | 28 ++++++----
plug-ins/drs/dia-render-script-renderer.c | 16 +++---
plug-ins/dxf/dxf-export.c | 90 +++++++++++++++++++------------
plug-ins/dxf/dxf-import.c | 12 ++---
plug-ins/hpgl/hpgl.c | 16 +++---
plug-ins/metapost/render_metapost.c | 28 +++++-----
plug-ins/pdf/pdf-import.cpp | 8 +--
plug-ins/pgf/render_pgf.c | 33 ++++++------
plug-ins/postscript/diapsrenderer.c | 28 +++++-----
plug-ins/pstricks/render_pstricks.c | 33 ++++++------
plug-ins/python/pydia-render.c | 18 +++----
plug-ins/svg/render_svg.c | 52 ++++++++++--------
plug-ins/vdx/vdx-export.c | 22 ++++----
plug-ins/vdx/vdx-import.c | 20 +++----
plug-ins/wmf/wmf.cpp | 57 ++++++++++----------
plug-ins/wpg/wpg-import.c | 7 +--
plug-ins/wpg/wpg.c | 17 +++---
plug-ins/xfig/xfig-export.c | 12 ++---
100 files changed, 942 insertions(+), 685 deletions(-)
---
diff --git a/lib/dia-enums.h b/lib/dia-enums.h
index da9f9985f..736aba8bb 100644
--- a/lib/dia-enums.h
+++ b/lib/dia-enums.h
@@ -51,11 +51,11 @@ typedef enum /*< enum >*/ {
DIA_FILL_STYLE_SOLID
} DiaFillStyle;
-typedef enum {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT
-} Alignment;
+typedef enum /*< enum >*/ {
+ DIA_ALIGN_LEFT,
+ DIA_ALIGN_CENTRE,
+ DIA_ALIGN_RIGHT
+} DiaAlignment;
typedef enum {
TEXTFIT_NEVER,
diff --git a/lib/dia_svg.c b/lib/dia_svg.c
index bc3633a20..a76d38491 100644
--- a/lib/dia_svg.c
+++ b/lib/dia_svg.c
@@ -73,7 +73,7 @@ dia_svg_style_init(DiaSvgStyle *gs, DiaSvgStyle *parent_style)
gs->linestyle = parent_style ? parent_style->linestyle : DIA_LINE_STYLE_DEFAULT;
gs->font = (parent_style && parent_style->font) ? g_object_ref (parent_style->font) : NULL;
gs->font_height = parent_style ? parent_style->font_height : 0.8;
- gs->alignment = parent_style ? parent_style->alignment : ALIGN_LEFT;
+ gs->alignment = parent_style ? parent_style->alignment : DIA_ALIGN_LEFT;
gs->stop_color = parent_style ? parent_style->stop_color : 0x000000; /* default black */
gs->stop_opacity = parent_style ? parent_style->stop_opacity : 1.0;
@@ -569,14 +569,16 @@ _style_adjust_font (DiaSvgStyle *s, const char *family, const char *style, const
static void
_parse_text_align (DiaSvgStyle *s, const char *ptr)
{
- if (!strncmp(ptr, "start", 5))
- s->alignment = ALIGN_LEFT;
- else if (!strncmp(ptr, "end", 3))
- s->alignment = ALIGN_RIGHT;
- else if (!strncmp(ptr, "middle", 6))
- s->alignment = ALIGN_CENTER;
+ if (!strncmp (ptr, "start", 5)) {
+ s->alignment = DIA_ALIGN_LEFT;
+ } else if (!strncmp (ptr, "end", 3)) {
+ s->alignment = DIA_ALIGN_RIGHT;
+ } else if (!strncmp (ptr, "middle", 6)) {
+ s->alignment = DIA_ALIGN_CENTRE;
+ }
}
+
/*!
* \brief Parse SVG/CSS style string
*
diff --git a/lib/dia_svg.h b/lib/dia_svg.h
index 16cc8ab4b..050e7f3bb 100644
--- a/lib/dia_svg.h
+++ b/lib/dia_svg.h
@@ -48,7 +48,7 @@ struct _DiaSvgStyle {
DiaFont *font;
double font_height;
- Alignment alignment;
+ DiaAlignment alignment;
gint32 stop_color;
double stop_opacity;
diff --git a/lib/diaimportrenderer.c b/lib/diaimportrenderer.c
index 161ec455a..6ae02eaac 100644
--- a/lib/diaimportrenderer.c
+++ b/lib/diaimportrenderer.c
@@ -68,11 +68,11 @@ static void draw_beziergon (DiaRenderer *renderer,
int numpoints,
Color *fill,
Color *stroke);
-static void draw_string (DiaRenderer *renderer,
- const gchar *text,
- Point *pos,
- Alignment alignment,
- Color *color);
+static void draw_string (DiaRenderer *renderer,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color);
static void draw_image (DiaRenderer *renderer,
Point *point,
real width, real height,
@@ -448,17 +448,16 @@ draw_ellipse (DiaRenderer *renderer,
}
-/*!
- * \brief Draw a string
- * Creates a _Text object with the properties given by _DiaImportRenderer::set_font().
- * \memberof _DiaImportRenderer
+/*
+ * Creates a #Text object with the properties given by #DiaImportRenderer
+ * dia_renderer_set_font().
*/
static void
-draw_string (DiaRenderer *renderer,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *renderer,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer);
DiaObject *object = create_standard_text (pos->x, pos->y);
diff --git a/lib/diapathrenderer.c b/lib/diapathrenderer.c
index d4712285a..ee29fe86d 100644
--- a/lib/diapathrenderer.c
+++ b/lib/diapathrenderer.c
@@ -647,18 +647,18 @@ draw_text (DiaRenderer *self,
}
}
-/*!
- * \brief Convert the string back to a _Text object and render that
- * \memberof _DiaPathRenderer
+
+/*
+ * Convert the string back to a #Text object and render that
*/
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
- if (text && strlen(text)) {
+ if (text && strlen (text)) {
Text *text_obj;
DiaFont *font;
double font_height;
diff --git a/lib/diarenderer.c b/lib/diarenderer.c
index 503ca8440..46408e8ef 100644
--- a/lib/diarenderer.c
+++ b/lib/diarenderer.c
@@ -116,19 +116,23 @@ static void draw_beziergon (DiaRenderer *renderer,
int numpoints,
Color *fill,
Color *stroke);
-static void draw_string (DiaRenderer *renderer,
- const gchar *text,
- Point *pos,
- Alignment alignment,
- Color *color);
-static void draw_image (DiaRenderer *renderer,
- Point *point,
- real width, real height,
- DiaImage *image);
-static void draw_text (DiaRenderer *renderer,
- Text *text);
-static void draw_text_line (DiaRenderer *renderer,
- TextLine *text_line, Point *pos, Alignment alignment, Color *color);
+static void draw_string (DiaRenderer *renderer,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color);
+static void draw_image (DiaRenderer *renderer,
+ Point *point,
+ double width,
+ double height,
+ DiaImage *image);
+static void draw_text (DiaRenderer *renderer,
+ Text *text);
+static void draw_text_line (DiaRenderer *renderer,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color);
static void draw_rotated_text (DiaRenderer *renderer, Text *text,
Point *center, real angle);
static void draw_rotated_image (DiaRenderer *renderer,
@@ -612,19 +616,21 @@ draw_ellipse (DiaRenderer *renderer, Point *center,
*/
-/*!
- * \brief Draw a string
- * \memberof _DiaRenderer \pure
+/*
+ * Draw a string
*/
static void
-draw_string (DiaRenderer *renderer,
- const gchar *text, Point *pos, Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *renderer,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
g_warning ("%s::draw_string not implemented!",
G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (renderer)));
}
+
/*!
* \brief Draw an image (pixbuf)
* \memberof _DiaRenderer \pure
@@ -714,9 +720,9 @@ draw_rotated_text (DiaRenderer *renderer,
sy = (tx_bb.bottom - tx_bb.top) / (bz_bb.bottom - bz_bb.top);
/* move center to origin */
- if (ALIGN_LEFT == text->alignment) {
+ if (DIA_ALIGN_LEFT == text->alignment) {
t.x0 = -bz_bb.left;
- } else if (ALIGN_RIGHT == text->alignment) {
+ } else if (DIA_ALIGN_RIGHT == text->alignment) {
t.x0 = - bz_bb.right;
} else {
t.x0 = -(bz_bb.left + bz_bb.right) / 2.0;
@@ -726,9 +732,9 @@ draw_rotated_text (DiaRenderer *renderer,
dia_matrix_set_angle_and_scales (&m, G_PI * angle / 180.0, sx, sx);
dia_matrix_multiply (&m, &t, &m);
/* move back center from origin */
- if (ALIGN_LEFT == text->alignment) {
+ if (DIA_ALIGN_LEFT == text->alignment) {
t.x0 = tx_bb.left;
- } else if (ALIGN_RIGHT == text->alignment) {
+ } else if (DIA_ALIGN_RIGHT == text->alignment) {
t.x0 = tx_bb.right;
} else {
t.x0 = (tx_bb.left + tx_bb.right) / 2.0;
@@ -803,12 +809,13 @@ draw_rotated_image (DiaRenderer *renderer,
}
}
+
/**
* draw_text_line:
* @renderer: the #DiaRenderer
* @text_line: the #TextLine to draw
* @pos: where to draw @text_line
- * @alignment: text #Alignment
+ * @alignment: text #DiaAlignment
* @color: text #Color
*
* Default implementation of draw_text_line
@@ -817,11 +824,11 @@ draw_rotated_image (DiaRenderer *renderer,
* dia_renderer_set_font() and dia_renderer_draw_string().
*/
static void
-draw_text_line (DiaRenderer *renderer,
- TextLine *text_line,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_text_line (DiaRenderer *renderer,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
dia_renderer_set_font (renderer,
text_line_get_font (text_line),
@@ -2391,9 +2398,9 @@ dia_renderer_draw_ellipse (DiaRenderer *self,
void
dia_renderer_draw_string (DiaRenderer *self,
- const gchar *text,
+ const char *text,
Point *pos,
- Alignment alignment,
+ DiaAlignment alignment,
Color *color)
{
g_return_if_fail (DIA_IS_RENDERER (self));
@@ -2473,7 +2480,7 @@ void
dia_renderer_draw_text_line (DiaRenderer *self,
TextLine *text_line,
Point *pos,
- Alignment alignment,
+ DiaAlignment alignment,
Color *color)
{
g_return_if_fail (DIA_IS_RENDERER (self));
diff --git a/lib/diarenderer.h b/lib/diarenderer.h
index 7d6e98ae3..998aecba4 100644
--- a/lib/diarenderer.h
+++ b/lib/diarenderer.h
@@ -172,9 +172,9 @@ struct _DiaRendererClass
Color *fill,
Color *stroke);
void (*draw_string) (DiaRenderer *renderer,
- const gchar *text,
+ const char *text,
Point *pos,
- Alignment alignment,
+ DiaAlignment alignment,
Color *color);
void (*draw_image) (DiaRenderer *renderer,
Point *point,
@@ -204,7 +204,7 @@ struct _DiaRendererClass
void (*draw_text_line) (DiaRenderer *renderer,
TextLine *text_line,
Point *pos,
- Alignment alignment,
+ DiaAlignment alignment,
Color *color);
void (*draw_rect) (DiaRenderer *renderer,
Point *ul_corner,
@@ -339,9 +339,9 @@ void dia_renderer_draw_ellipse (DiaRenderer *self,
Color *fill,
Color *stroke);
void dia_renderer_draw_string (DiaRenderer *self,
- const gchar *text,
+ const char *text,
Point *pos,
- Alignment alignment,
+ DiaAlignment alignment,
Color *color);
void dia_renderer_draw_image (DiaRenderer *self,
Point *point,
@@ -366,7 +366,7 @@ void dia_renderer_draw_text (DiaRenderer *self,
void dia_renderer_draw_text_line (DiaRenderer *self,
TextLine *text_line,
Point *pos,
- Alignment alignment,
+ DiaAlignment alignment,
Color *color);
void dia_renderer_draw_rect (DiaRenderer *self,
Point *ul_corner,
diff --git a/lib/diasvgrenderer.c b/lib/diasvgrenderer.c
index 43333c76d..ff89931e4 100644
--- a/lib/diasvgrenderer.c
+++ b/lib/diasvgrenderer.c
@@ -53,9 +53,13 @@
#define DTOSTR_BUF_SIZE G_ASCII_DTOSTR_BUF_SIZE
#define dia_svg_dtostr(buf,d) \
g_ascii_formatd(buf,sizeof(buf),"%g",(d)*renderer->scale)
-static void
-draw_text_line(DiaRenderer *self, TextLine *text_line,
- Point *pos, Alignment alignment, Color *colour);
+
+
+static void draw_text_line (DiaRenderer *self,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour);
/*!
* \brief Initialize to SVG rendering defaults
@@ -778,16 +782,16 @@ draw_beziergon (DiaRenderer *self,
_bezier(self, points, numpoints, fill, stroke, TRUE);
}
-/*!
- * \brief Draw a text element by delegating to draw_text_line()
- * \memberof _DiaSvgRenderer
+
+/*
+ * Draw a text element by delegating to draw_text_line()
*/
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
TextLine *text_line;
DiaFont *font;
@@ -800,18 +804,21 @@ draw_string (DiaRenderer *self,
text_line_destroy (text_line);
}
-/*!
- * \brief Draw a text element (single line)
- * \memberof _DiaSvgRenderer
+
+/*
+ * Draw a text element (single line)
*/
static void
-draw_text_line(DiaRenderer *self, TextLine *text_line,
- Point *pos, Alignment alignment, Color *colour)
+draw_text_line (DiaRenderer *self,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
xmlNodePtr node;
- real saved_width;
- gchar d_buf[DTOSTR_BUF_SIZE];
+ double saved_width;
+ char d_buf[DTOSTR_BUF_SIZE];
DiaFont *font;
GString *style;
@@ -833,17 +840,17 @@ draw_text_line(DiaRenderer *self, TextLine *text_line,
/* This is going to break for non-LTR texts, as SVG thinks 'start' is
* 'right' for those. */
switch (alignment) {
- case ALIGN_LEFT:
- g_string_append (style, "; text-anchor:start");
- break;
- case ALIGN_CENTER:
- g_string_append (style, "; text-anchor:middle");
- break;
- case ALIGN_RIGHT:
- g_string_append (style, "; text-anchor:end");
- break;
- default:
- break;
+ case DIA_ALIGN_LEFT:
+ g_string_append (style, "; text-anchor:start");
+ break;
+ case DIA_ALIGN_CENTRE:
+ g_string_append (style, "; text-anchor:middle");
+ break;
+ case DIA_ALIGN_RIGHT:
+ g_string_append (style, "; text-anchor:end");
+ break;
+ default:
+ break;
}
font = text_line_get_font(text_line);
diff --git a/lib/diatransformrenderer.c b/lib/diatransformrenderer.c
index 158290d24..748f1a43a 100644
--- a/lib/diatransformrenderer.c
+++ b/lib/diatransformrenderer.c
@@ -493,16 +493,16 @@ draw_rotated_text (DiaRenderer *self, Text *text, Point *center, real angle)
}
}
-/*!
- * \brief Convert the string back to a _Text object and render that
- * \memberof _DiaTransformRenderer
+
+/*
+ * Convert the string back to a _Text object and render that
*/
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
if (text && strlen (text)) {
Text *text_obj;
diff --git a/lib/properties.c b/lib/properties.c
index 726731c4e..14fc65b86 100644
--- a/lib/properties.c
+++ b/lib/properties.c
@@ -57,9 +57,9 @@ stdprops_init(void)
PropNumData prop_std_line_width_data = { 0.0, 10.0, 0.01 };
PropNumData prop_std_text_height_data = { 0.1, 10.0, 0.1 };
PropEnumData prop_std_text_align_data[] = {
- { N_("Left"), ALIGN_LEFT },
- { N_("Center"), ALIGN_CENTER },
- { N_("Right"), ALIGN_RIGHT },
+ { N_("Left"), DIA_ALIGN_LEFT },
+ { N_("Center"), DIA_ALIGN_CENTRE },
+ { N_("Right"), DIA_ALIGN_RIGHT },
{ NULL, 0 }
};
/* how the text box interacts with it's containing shape */
diff --git a/lib/properties.h b/lib/properties.h
index 0cb295b3d..2615cd6e1 100644
--- a/lib/properties.h
+++ b/lib/properties.h
@@ -609,9 +609,9 @@ void stdprops_init(void);
static PropNumData prop_std_line_width_data = { 0.0f, 10.0f, 0.01f };
static PropNumData prop_std_text_height_data = { 0.1f, 10.0f, 0.1f };
static PropEnumData prop_std_text_align_data[] = {
- { N_("Left"), ALIGN_LEFT },
- { N_("Center"), ALIGN_CENTER },
- { N_("Right"), ALIGN_RIGHT },
+ { N_("Left"), DIA_ALIGN_LEFT },
+ { N_("Center"), DIA_ALIGN_CENTRE },
+ { N_("Right"), DIA_ALIGN_RIGHT },
{ NULL, 0 }
};
static PropEnumData prop_std_text_fitting_data[] = {
diff --git a/lib/renderer/diacairo-interactive.c b/lib/renderer/diacairo-interactive.c
index a1fcc19c7..b09f77e2f 100644
--- a/lib/renderer/diacairo-interactive.c
+++ b/lib/renderer/diacairo-interactive.c
@@ -272,11 +272,11 @@ calculate_relative_luminance (const Color *c)
}
static void
-dia_cairo_interactive_renderer_draw_text_line (DiaRenderer *self,
- TextLine *text_line,
- Point *pos,
- Alignment alignment,
- Color *color)
+dia_cairo_interactive_renderer_draw_text_line (DiaRenderer *self,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
DiaCairoInteractiveRenderer *interactive = DIA_CAIRO_INTERACTIVE_RENDERER (self);
diff --git a/lib/renderer/diacairo-renderer.c b/lib/renderer/diacairo-renderer.c
index c29fe82a1..c5e77734a 100644
--- a/lib/renderer/diacairo-renderer.c
+++ b/lib/renderer/diacairo-renderer.c
@@ -1009,12 +1009,13 @@ dia_cairo_renderer_draw_beziergon (DiaRenderer *self,
}
}
+
static void
-dia_cairo_renderer_draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+dia_cairo_renderer_draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
int len = strlen (text);
@@ -1034,8 +1035,9 @@ dia_cairo_renderer_draw_string (DiaRenderer *self,
color->alpha);
cairo_save (renderer->cr);
/* alignment calculation done by pangocairo? */
- pango_layout_set_alignment (renderer->layout, alignment == ALIGN_CENTER ? PANGO_ALIGN_CENTER :
- alignment == ALIGN_RIGHT ? PANGO_ALIGN_RIGHT :
PANGO_ALIGN_LEFT);
+ pango_layout_set_alignment (renderer->layout, alignment == DIA_ALIGN_CENTRE ?
+ PANGO_ALIGN_CENTER : alignment == DIA_ALIGN_RIGHT ?
+ PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT);
pango_layout_set_text (renderer->layout, text, len);
{
PangoLayoutIter *iter = pango_layout_get_iter (renderer->layout);
@@ -1044,8 +1046,9 @@ dia_cairo_renderer_draw_string (DiaRenderer *self,
PangoRectangle extents;
int shift;
pango_layout_iter_get_line_extents (iter, NULL, &extents);
- shift = alignment == ALIGN_CENTER ? PANGO_RBEARING (extents)/2 :
- alignment == ALIGN_RIGHT ? PANGO_RBEARING (extents) : 0;
+ shift = alignment == DIA_ALIGN_CENTRE ?
+ PANGO_RBEARING (extents) / 2: alignment == DIA_ALIGN_RIGHT ?
+ PANGO_RBEARING (extents) : 0;
shift /= FONT_SIZE_TWEAK;
bline /= FONT_SIZE_TWEAK;
cairo_move_to (renderer->cr,
diff --git a/lib/standard-path.c b/lib/standard-path.c
index 573c392da..bbc58d2e2 100644
--- a/lib/standard-path.c
+++ b/lib/standard-path.c
@@ -1148,8 +1148,9 @@ text_to_path (const Text *text, GArray *points)
pango_layout_set_indent (layout, 0);
pango_layout_set_justify (layout, FALSE);
pango_layout_set_alignment (layout,
- text->alignment == ALIGN_LEFT ? PANGO_ALIGN_LEFT :
- text->alignment == ALIGN_RIGHT ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_CENTER);
+ text->alignment == DIA_ALIGN_LEFT ?
+ PANGO_ALIGN_LEFT : text->alignment == DIA_ALIGN_RIGHT ?
+ PANGO_ALIGN_RIGHT : PANGO_ALIGN_CENTER);
str = text_get_string_copy (text);
pango_layout_set_text (layout, str, -1);
diff --git a/lib/text.c b/lib/text.c
index f1920785f..3717cab8f 100644
--- a/lib/text.c
+++ b/lib/text.c
@@ -367,12 +367,12 @@ text_set_string (Text *text, const char *string)
Text *
-new_text (const char *string,
- DiaFont *font,
- double height,
- Point *pos,
- Color *color,
- Alignment align)
+new_text (const char *string,
+ DiaFont *font,
+ double height,
+ Point *pos,
+ Color *color,
+ DiaAlignment align)
{
Text *text;
@@ -405,12 +405,12 @@ new_text (const char *string,
* new_text_default:
* @pos: the #Point the text is located
* @color: the #Color of the text
- * @align: the #Alignment of the text
+ * @align: the #DiaAlignment of the text
*
* Fallback function returning a default initialized text object.
*/
Text *
-new_text_default (Point *pos, Color *color, Alignment align)
+new_text_default (Point *pos, Color *color, DiaAlignment align)
{
Text *text;
DiaFont *font;
@@ -519,7 +519,7 @@ text_set_color (Text *text, Color *col)
void
-text_set_alignment (Text *text, Alignment align)
+text_set_alignment (Text *text, DiaAlignment align)
{
text->alignment = align;
}
@@ -539,12 +539,12 @@ text_calc_boundingbox (Text *text, DiaRectangle *box)
box->left = text->position.x;
switch (text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
box->left -= text->max_width / 2.0;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
box->left -= text->max_width;
break;
default:
@@ -631,12 +631,12 @@ text_distance_from (Text *text, Point *point)
left = text->position.x;
switch (text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
left -= text_get_line_width (text, line) / 2.0;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
left -= text_get_line_width (text, line);
break;
default:
@@ -680,12 +680,12 @@ text_draw (Text *text, DiaRenderer *renderer)
curs_x = text->position.x + str_width_first;
switch (text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
curs_x -= str_width_whole / 2.0;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
curs_x -= str_width_whole;
break;
default:
@@ -810,12 +810,12 @@ text_set_cursor (Text *text,
text_get_line_strlen (text, row));
start_x = text->position.x;
switch (text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
start_x -= str_width_whole / 2.0;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
start_x -= str_width_whole;
break;
default:
@@ -1249,7 +1249,7 @@ data_text (AttributeNode text_attr, DiaContext *ctx)
double height;
Point pos = { 0.0, 0.0 };
Color col;
- Alignment align;
+ DiaAlignment align;
AttributeNode attr;
Text *text;
@@ -1282,7 +1282,7 @@ data_text (AttributeNode text_attr, DiaContext *ctx)
data_color (attribute_first_data (attr), &col, ctx);
}
- align = ALIGN_LEFT;
+ align = DIA_ALIGN_LEFT;
attr = composite_find_attribute (text_attr, "alignment");
if (attr != NULL) {
align = data_enum (attribute_first_data (attr), ctx);
diff --git a/lib/text.h b/lib/text.h
index e328d6a8c..2f4768b5a 100644
--- a/lib/text.h
+++ b/lib/text.h
@@ -63,7 +63,7 @@ struct _Text {
double height;
Point position;
Color color;
- Alignment alignment;
+ DiaAlignment alignment;
/* Cursor pos: */
int cursor_pos;
@@ -79,11 +79,15 @@ struct _Text {
/* makes an internal copy of the string */
/*! \brief Text object creation \memberof _Text */
-Text *new_text(const char *string, DiaFont *font, double height,
- Point *pos, Color *color, Alignment align);
-Text *new_text_default (Point *pos,
- Color *color,
- Alignment align);
+Text *new_text (const char *string,
+ DiaFont *font,
+ double height,
+ Point *pos,
+ Color *color,
+ DiaAlignment align);
+Text *new_text_default (Point *pos,
+ Color *color,
+ DiaAlignment align);
void text_destroy (Text *text);
Text *text_copy (Text *text);
char *text_get_line (const Text *text,
@@ -100,8 +104,8 @@ void text_set_position (Text *text,
Point *pos);
void text_set_color (Text *text,
Color *col);
-void text_set_alignment (Text *text,
- Alignment align);
+void text_set_alignment (Text *text,
+ DiaAlignment align);
double text_distance_from (Text *text,
Point *point);
void text_calc_boundingbox(Text *text, DiaRectangle *box);
diff --git a/lib/textattr.h b/lib/textattr.h
index 993f7fc80..7942d66ec 100644
--- a/lib/textattr.h
+++ b/lib/textattr.h
@@ -28,7 +28,7 @@ struct _TextAttributes {
real height;
Point position;
Color color;
- Alignment alignment;
+ DiaAlignment alignment;
};
diff --git a/lib/textline.c b/lib/textline.c
index 359a1312e..e27a87fc6 100644
--- a/lib/textline.c
+++ b/lib/textline.c
@@ -193,7 +193,7 @@ text_line_get_descent(const TextLine *text_line)
* @text_line: a line of text
* @alignment: how to align it.
*
- * Calculate #TextLine adjustment for #Alignment
+ * Calculate #TextLine adjustment for #DiaAlignment
*
* Return the amount this text line would need to be shifted in order to
* implement the given alignment.
@@ -205,15 +205,16 @@ text_line_get_descent(const TextLine *text_line)
* Since: dawn-of-time
*/
double
-text_line_get_alignment_adjustment (TextLine *text_line, Alignment alignment)
+text_line_get_alignment_adjustment (TextLine *text_line, DiaAlignment alignment)
{
text_line_cache_values (text_line);
+
switch (alignment) {
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
return text_line->width / 2;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
return text_line->width;
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
default:
return 0.0;
}
diff --git a/lib/textline.h b/lib/textline.h
index f94a74853..8dfb8f721 100644
--- a/lib/textline.h
+++ b/lib/textline.h
@@ -81,7 +81,7 @@ void text_line_adjust_glyphs(TextLine *line,
real scale);
void text_line_adjust_layout_line(TextLine *line, PangoLayoutLine *layoutline,
real scale);
-real text_line_get_alignment_adjustment(TextLine *text_line,
- Alignment alignment);
+double text_line_get_alignment_adjustment (TextLine *text_line,
+ DiaAlignment alignment);
#endif
diff --git a/lib/widgets.c b/lib/widgets.c
index ceb803ca7..cf8b7bc43 100644
--- a/lib/widgets.c
+++ b/lib/widgets.c
@@ -43,24 +43,30 @@ dia_alignment_selector_new (void)
{
GtkWidget *omenu = dia_option_menu_new ();
- dia_option_menu_add_item (DIA_OPTION_MENU (omenu), _("Left"), ALIGN_LEFT);
- dia_option_menu_add_item (DIA_OPTION_MENU (omenu), _("Center"), ALIGN_CENTER);
- dia_option_menu_add_item (DIA_OPTION_MENU (omenu), _("Right"), ALIGN_RIGHT);
+ dia_option_menu_add_item (DIA_OPTION_MENU (omenu),
+ _("Left"),
+ DIA_ALIGN_LEFT);
+ dia_option_menu_add_item (DIA_OPTION_MENU (omenu),
+ _("Center"),
+ DIA_ALIGN_CENTRE);
+ dia_option_menu_add_item (DIA_OPTION_MENU (omenu),
+ _("Right"),
+ DIA_ALIGN_RIGHT);
return omenu;
}
-Alignment
-dia_alignment_selector_get_alignment(GtkWidget *as)
+DiaAlignment
+dia_alignment_selector_get_alignment (GtkWidget *as)
{
- return (Alignment) dia_option_menu_get_active (DIA_OPTION_MENU (as));
+ return (DiaAlignment) dia_option_menu_get_active (DIA_OPTION_MENU (as));
}
void
-dia_alignment_selector_set_alignment (GtkWidget *as,
- Alignment align)
+dia_alignment_selector_set_alignment (GtkWidget *as,
+ DiaAlignment align)
{
dia_option_menu_set_active (DIA_OPTION_MENU (as), align);
}
diff --git a/lib/widgets.h b/lib/widgets.h
index 3064f1e49..a1314f29a 100644
--- a/lib/widgets.h
+++ b/lib/widgets.h
@@ -26,10 +26,10 @@
G_BEGIN_DECLS
/* DiaAlignmentSelector: */
-GtkWidget *dia_alignment_selector_new (void);
-Alignment dia_alignment_selector_get_alignment (GtkWidget *as);
-void dia_alignment_selector_set_alignment (GtkWidget *as,
- Alignment align);
+GtkWidget *dia_alignment_selector_new (void);
+DiaAlignment dia_alignment_selector_get_alignment (GtkWidget *as);
+void dia_alignment_selector_set_alignment (GtkWidget *as,
+ DiaAlignment align);
/* **** Util functions for Gtk stuff **** */
diff --git a/objects/AADL/aadlbox.c b/objects/AADL/aadlbox.c
index 8e5e4136a..2f06552b8 100644
--- a/objects/AADL/aadlbox.c
+++ b/objects/AADL/aadlbox.c
@@ -914,7 +914,7 @@ DiaObject *aadlbox_create(Point *startpoint, void *user_data,
/* The text position is recalculated later */
p.x = 0.0;
p.y = 0.0;
- aadlbox->name = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
+ aadlbox->name = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_LEFT);
g_clear_object (&font);
element_init(elem, 8, 0); /* 8 handles and 0 connection */
diff --git a/objects/Database/database.h b/objects/Database/database.h
index 2ac1dfe65..a14de80b3 100644
--- a/objects/Database/database.h
+++ b/objects/Database/database.h
@@ -152,10 +152,10 @@ struct _TableReference {
double sp_desc_width; /* start-point */
Point sp_desc_pos; /* start-point */
- Alignment sp_desc_text_align; /* start-point */
+ DiaAlignment sp_desc_text_align; /* start-point */
double ep_desc_width; /* end-point */
Point ep_desc_pos; /* end-point */
- Alignment ep_desc_text_align; /* end-point */
+ DiaAlignment ep_desc_text_align; /* end-point */
};
G_END_DECLS
diff --git a/objects/Database/reference.c b/objects/Database/reference.c
index 10b4942e4..dc9e5523d 100644
--- a/objects/Database/reference.c
+++ b/objects/Database/reference.c
@@ -50,10 +50,20 @@ static void reference_get_props (TableReference *, GPtrArray *);
static void reference_set_props (TableReference *, GPtrArray *);
static void reference_update_data (TableReference *);
static DiaObject * reference_load (ObjectNode obj_node, int version,DiaContext *ctx);
-static void update_desc_data (Point *, Alignment *,
- Point *, Point *, Orientation, real, real);
-static void get_desc_bbox (DiaRectangle *, gchar *, real, Point *, Alignment,
- DiaFont *, real);
+static void update_desc_data (Point *,
+ DiaAlignment *,
+ Point *,
+ Point *,
+ Orientation,
+ double,
+ double);
+static void get_desc_bbox (DiaRectangle *,
+ char *,
+ double,
+ Point *,
+ DiaAlignment,
+ DiaFont *,
+ double);
static DiaObjectChange *reference_add_segment_cb (DiaObject *,
Point *,
gpointer);
@@ -467,13 +477,17 @@ reference_update_data (TableReference * ref)
rectangle_union (&orth->object.bounding_box, &rect);
}
+
static void
-update_desc_data (Point * desc_pos, Alignment * desc_align,
- Point * end_point, Point * nearest_point,
- Orientation orientation, real line_width,
- real font_height)
+update_desc_data (Point *desc_pos,
+ DiaAlignment *desc_align,
+ Point *end_point,
+ Point *nearest_point,
+ Orientation orientation,
+ double line_width,
+ double font_height)
{
- real dist = font_height/4.0 + line_width/2.0;
+ double dist = font_height/4.0 + line_width/2.0;
*desc_pos = *end_point;
@@ -483,17 +497,17 @@ update_desc_data (Point * desc_pos, Alignment * desc_align,
desc_pos->y -= dist;
if (end_point->x <= nearest_point->x) {
desc_pos->x += dist;
- *desc_align = ALIGN_LEFT;
+ *desc_align = DIA_ALIGN_LEFT;
} else {
desc_pos->x -= dist;
- *desc_align = ALIGN_RIGHT;
+ *desc_align = DIA_ALIGN_RIGHT;
}
break;
case VERTICAL:
/* for vertical lines the label is at the right side of it */
desc_pos->x += dist;
- *desc_align = ALIGN_LEFT;
+ *desc_align = DIA_ALIGN_LEFT;
if (end_point->y <= nearest_point->y)
desc_pos->y += font_height;
else
@@ -505,12 +519,17 @@ update_desc_data (Point * desc_pos, Alignment * desc_align,
}
}
+
static void
-get_desc_bbox (DiaRectangle * r, gchar * string, real string_width,
- Point * pos, Alignment align,
- DiaFont * font, real font_height)
+get_desc_bbox (DiaRectangle *r,
+ char *string,
+ double string_width,
+ Point *pos,
+ DiaAlignment align,
+ DiaFont *font,
+ double font_height)
{
- real width;
+ double width;
g_assert (r != NULL);
g_assert (string != NULL);
@@ -518,17 +537,15 @@ get_desc_bbox (DiaRectangle * r, gchar * string, real string_width,
width = string_width;
- g_assert (align == ALIGN_LEFT || align == ALIGN_RIGHT);
- if (align == ALIGN_LEFT)
- {
+ g_return_if_fail (align == DIA_ALIGN_LEFT || align == DIA_ALIGN_RIGHT);
+
+ if (align == DIA_ALIGN_LEFT) {
r->left = pos->x;
r->right = r->left + width;
- }
- else
- {
- r->right = pos->x;
- r->left = r->right - width;
- }
+ } else {
+ r->right = pos->x;
+ r->left = r->right - width;
+ }
r->top = pos->y;
r->top -= dia_font_ascent (string, font, font_height);
diff --git a/objects/Database/table.c b/objects/Database/table.c
index 1d9b6dbcf..8a0cf8d42 100644
--- a/objects/Database/table.c
+++ b/objects/Database/table.c
@@ -592,7 +592,7 @@ table_draw_namebox (Table *table, DiaRenderer *renderer, Element *elem)
dia_renderer_draw_string (renderer,
table->name,
&startP,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&table->text_color);
}
@@ -605,7 +605,7 @@ table_draw_namebox (Table *table, DiaRenderer *renderer, Element *elem)
table->tagging_comment,
TABLE_COMMENT_MAXWIDTH,
&startP,
- ALIGN_CENTER);
+ DIA_ALIGN_CENTRE);
}
return endP.y;
@@ -775,16 +775,17 @@ table_draw_attributesbox (Table *table,
dia_renderer_draw_string (renderer,
attr->name,
&startP,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
text_color);
}
+
if (IS_NOT_EMPTY (attr->type)) {
startTypeP = startP;
startTypeP.x += table->maxwidth_attr_name + TABLE_ATTR_NAME_TYPE_GAP;
dia_renderer_draw_string (renderer,
attr->type,
&startTypeP,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
text_color);
}
@@ -801,7 +802,7 @@ table_draw_attributesbox (Table *table,
table->tagging_comment,
TABLE_COMMENT_MAXWIDTH,
&startP,
- ALIGN_LEFT);
+ DIA_ALIGN_LEFT);
startP.x -= TABLE_ATTR_COMMENT_OFFSET;
startP.y += table->comment_font_height/2;
}
diff --git a/objects/ER/attribute.c b/objects/ER/attribute.c
index aaa3559e5..5a98672ad 100644
--- a/objects/ER/attribute.c
+++ b/objects/ER/attribute.c
@@ -308,7 +308,7 @@ attribute_draw (Attribute *attribute, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
attribute->name,
&p,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&color_black);
if (attribute->key || attribute->weakkey) {
diff --git a/objects/ER/entity.c b/objects/ER/entity.c
index b00a9dce9..1865ea388 100644
--- a/objects/ER/entity.c
+++ b/objects/ER/entity.c
@@ -295,7 +295,7 @@ entity_draw (Entity *entity, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
entity->name,
&p,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&color_black);
}
diff --git a/objects/ER/relationship.c b/objects/ER/relationship.c
index b9db86114..8e568110f 100644
--- a/objects/ER/relationship.c
+++ b/objects/ER/relationship.c
@@ -256,7 +256,7 @@ relationship_draw (Relationship *relationship, DiaRenderer *renderer)
Point p;
Element *elem;
double diff;
- Alignment left_align;
+ DiaAlignment left_align;
assert(relationship != NULL);
assert(renderer != NULL);
@@ -289,13 +289,13 @@ relationship_draw (Relationship *relationship, DiaRenderer *renderer)
lc.y = corners[1].y - 0.3;
rc.x = corners[3].x + 0.2;
rc.y = corners[3].y + 0.3 + relationship->font_height;
- left_align = ALIGN_LEFT;
+ left_align = DIA_ALIGN_LEFT;
} else {
lc.x = corners[0].x - CARDINALITY_DISTANCE;
lc.y = corners[0].y - 0.3;
rc.x = corners[2].x + CARDINALITY_DISTANCE;
rc.y = corners[2].y - 0.3;
- left_align = ALIGN_RIGHT;
+ left_align = DIA_ALIGN_RIGHT;
}
if (relationship->identifying) {
@@ -323,7 +323,7 @@ relationship_draw (Relationship *relationship, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
relationship->right_cardinality,
&rc,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&color_black);
p.x = elem->corner.x + elem->width / 2.0;
@@ -335,7 +335,7 @@ relationship_draw (Relationship *relationship, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
relationship->name,
&p,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&color_black);
}
diff --git a/objects/FS/flow-ortho.c b/objects/FS/flow-ortho.c
index bf68e56e5..ea2e073a8 100644
--- a/objects/FS/flow-ortho.c
+++ b/objects/FS/flow-ortho.c
@@ -456,7 +456,12 @@ orthflow_create(Point *startpoint,
orthflow->textpos = p;
font = dia_font_new_from_style(DIA_FONT_SANS, ORTHFLOW_FONTHEIGHT);
- orthflow->text = new_text ("", font, ORTHFLOW_FONTHEIGHT, &p, &color_black, ALIGN_CENTER);
+ orthflow->text = new_text ("",
+ font,
+ ORTHFLOW_FONTHEIGHT,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
#if 0
@@ -610,9 +615,15 @@ orthflow_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
orthflow->text = data_text(attribute_first_data(attr), ctx);
else { /* paranoid */
- DiaFont *font = dia_font_new_from_style(DIA_FONT_SANS, ORTHFLOW_FONTHEIGHT);
-
- orthflow->text = new_text ("", font, ORTHFLOW_FONTHEIGHT, &obj->position, &color_black, ALIGN_CENTER);
+ DiaFont *font = dia_font_new_from_style (DIA_FONT_SANS,
+ ORTHFLOW_FONTHEIGHT);
+
+ orthflow->text = new_text ("",
+ font,
+ ORTHFLOW_FONTHEIGHT,
+ &obj->position,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
}
diff --git a/objects/FS/flow.c b/objects/FS/flow.c
index 152536caf..def2f2edf 100644
--- a/objects/FS/flow.c
+++ b/objects/FS/flow.c
@@ -410,9 +410,14 @@ flow_create(Point *startpoint,
point_add( &p, &conn->endpoints[0] ) ;
flow->textpos = p;
- font = dia_font_new_from_style(DIA_FONT_SANS, FLOW_FONTHEIGHT);
-
- flow->text = new_text ("", font, FLOW_FONTHEIGHT, &p, &color_black, ALIGN_CENTER);
+ font = dia_font_new_from_style (DIA_FONT_SANS, FLOW_FONTHEIGHT);
+
+ flow->text = new_text ("",
+ font,
+ FLOW_FONTHEIGHT,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
flow->text_handle.id = HANDLE_MOVE_TEXT;
@@ -549,9 +554,14 @@ flow_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
flow->text = data_text(attribute_first_data(attr), ctx);
else { /* pathologic */
- DiaFont *font = dia_font_new_from_style(DIA_FONT_SANS, FLOW_FONTHEIGHT);
-
- flow->text = new_text ("", font, FLOW_FONTHEIGHT, &obj->position, &color_black, ALIGN_CENTER);
+ DiaFont *font = dia_font_new_from_style (DIA_FONT_SANS, FLOW_FONTHEIGHT);
+
+ flow->text = new_text ("",
+ font,
+ FLOW_FONTHEIGHT,
+ &obj->position,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
}
diff --git a/objects/FS/function.c b/objects/FS/function.c
index 23e479f39..f7125c5dc 100644
--- a/objects/FS/function.c
+++ b/objects/FS/function.c
@@ -482,7 +482,7 @@ function_create(Point *startpoint,
elem->corner = *startpoint;
- font = dia_font_new_from_style (DIA_FONT_SANS,FUNCTION_FONTHEIGHT);
+ font = dia_font_new_from_style (DIA_FONT_SANS, FUNCTION_FONTHEIGHT);
pkg->is_wish = FALSE;
pkg->is_user = FALSE;
@@ -490,8 +490,12 @@ function_create(Point *startpoint,
/* The text position is recalculated later */
p.x = 0.0;
p.y = 0.0;
- pkg->text = new_text ("", font, FUNCTION_FONTHEIGHT, &p, &color_black,
- ALIGN_CENTER);
+ pkg->text = new_text ("",
+ font,
+ FUNCTION_FONTHEIGHT,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init (elem, 8, NUM_CONNECTIONS);
@@ -598,8 +602,14 @@ function_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
pkg->text = data_text(attribute_first_data(attr), ctx);
else { /* paranoid */
- DiaFont *font = dia_font_new_from_style (DIA_FONT_SANS,FUNCTION_FONTHEIGHT);
- pkg->text = new_text ("", font, FUNCTION_FONTHEIGHT, &obj->position, &color_black, ALIGN_CENTER);
+ DiaFont *font = dia_font_new_from_style (DIA_FONT_SANS,
+ FUNCTION_FONTHEIGHT);
+ pkg->text = new_text ("",
+ font,
+ FUNCTION_FONTHEIGHT,
+ &obj->position,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
}
diff --git a/objects/GRAFCET/action.c b/objects/GRAFCET/action.c
index 2f6963c9b..4f72ab991 100644
--- a/objects/GRAFCET/action.c
+++ b/objects/GRAFCET/action.c
@@ -411,10 +411,13 @@ action_create(Point *startpoint,
action->cps = connpointline_create(obj,0);
pos = conn->endpoints[1];
- action_font = dia_font_new_from_style(ACTION_FONT,ACTION_FONT_HEIGHT);
- action->text = new_text ("", action_font, ACTION_FONT_HEIGHT,
+ action_font = dia_font_new_from_style (ACTION_FONT, ACTION_FONT_HEIGHT);
+ action->text = new_text ("",
+ action_font,
+ ACTION_FONT_HEIGHT,
&pos, /* never used */
- &color_black, ALIGN_LEFT);
+ &color_black,
+ DIA_ALIGN_LEFT);
g_clear_object (&action_font);
action->macro_call = FALSE;
diff --git a/objects/GRAFCET/action_text_draw.c b/objects/GRAFCET/action_text_draw.c
index eb432dab3..e3d2f18ae 100644
--- a/objects/GRAFCET/action_text_draw.c
+++ b/objects/GRAFCET/action_text_draw.c
@@ -81,12 +81,12 @@ action_text_draw (Text *text, DiaRenderer *renderer)
curs_y = text->position.y - text->ascent;
switch (text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
curs_x -= str_width_whole / 2.0; /* undefined behaviour ! */
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
curs_x -= str_width_whole; /* undefined behaviour ! */
break;
default:
@@ -108,17 +108,17 @@ action_text_draw (Text *text, DiaRenderer *renderer)
void
action_text_calc_boundingbox (Text *text, DiaRectangle *box)
{
- real width;
+ double width;
int i;
box->left = text->position.x;
switch (text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
box->left -= text->max_width / 2.0;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
box->left -= text->max_width;
break;
default:
diff --git a/objects/GRAFCET/boolequation.c b/objects/GRAFCET/boolequation.c
index edb4f4cfe..3b6dfda3e 100644
--- a/objects/GRAFCET/boolequation.c
+++ b/objects/GRAFCET/boolequation.c
@@ -113,7 +113,7 @@ textblock_draw (Block *block, Boolequation *booleq, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
block->d.text,
&block->pos,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&booleq->color);
}
@@ -216,7 +216,7 @@ opblock_draw (Block *block, Boolequation *booleq, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
opstring (block->d.operator),
&block->pos,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&booleq->color);
}
@@ -393,8 +393,16 @@ parensblock_draw (Block *block, Boolequation *booleq, DiaRenderer *renderer)
pt.y = block->pos.y;
pt.x = block->d.inside->ur.x;
- dia_renderer_draw_string (renderer,"(",&block->pos,ALIGN_LEFT,&booleq->color);
- dia_renderer_draw_string (renderer,")",&pt,ALIGN_LEFT,&booleq->color);
+ dia_renderer_draw_string (renderer,
+ "(",
+ &block->pos,
+ DIA_ALIGN_LEFT,
+ &booleq->color);
+ dia_renderer_draw_string (renderer,
+ ")",
+ &pt,
+ DIA_ALIGN_LEFT,
+ &booleq->color);
}
diff --git a/objects/GRAFCET/step.c b/objects/GRAFCET/step.c
index 4a45165d4..5d3fce847 100644
--- a/objects/GRAFCET/step.c
+++ b/objects/GRAFCET/step.c
@@ -436,7 +436,7 @@ step_draw (Step *step, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
step->id,
&step->G,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&step->font_color);
if (step->active) {
dia_renderer_draw_ellipse (renderer,
diff --git a/objects/Istar/actor.c b/objects/Istar/actor.c
index 88111aa04..5680c21c9 100644
--- a/objects/Istar/actor.c
+++ b/objects/Istar/actor.c
@@ -484,7 +484,12 @@ actor_create(Point *startpoint,
p = *startpoint;
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + ACTOR_FONT / 2;
- actor->text = new_text ("", font, ACTOR_FONT, &p, &ACTOR_FG_COLOR, ALIGN_CENTER);
+ actor->text = new_text ("",
+ font,
+ ACTOR_FONT,
+ &p,
+ &ACTOR_FG_COLOR,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init (elem, 8, NUM_CONNECTIONS);
diff --git a/objects/Istar/goal.c b/objects/Istar/goal.c
index 51c193eb8..ea0afd704 100644
--- a/objects/Istar/goal.c
+++ b/objects/Istar/goal.c
@@ -566,7 +566,7 @@ goal_create(Point *startpoint,
goal->text = new_text ("", font,
DEFAULT_FONT, &p,
&color_black,
- ALIGN_CENTER);
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/Istar/link.c b/objects/Istar/link.c
index 8bd77c0d5..0373d37c5 100644
--- a/objects/Istar/link.c
+++ b/objects/Istar/link.c
@@ -518,7 +518,11 @@ link_draw (Link *link, DiaRenderer *renderer)
/** drawing decoration **/
dia_renderer_set_font (renderer, link_font, LINK_FONTHEIGHT);
if ((annot != NULL) && strlen (annot) != 0) {
- dia_renderer_draw_string (renderer, annot, &pa, ALIGN_CENTER, &color_black);
+ dia_renderer_draw_string (renderer,
+ annot,
+ &pa,
+ DIA_ALIGN_CENTRE,
+ &color_black);
}
g_clear_pointer (&annot, g_free);
diff --git a/objects/Istar/other.c b/objects/Istar/other.c
index 5c3b1e0df..d5c57914e 100644
--- a/objects/Istar/other.c
+++ b/objects/Istar/other.c
@@ -588,10 +588,12 @@ other_create(Point *startpoint,
font = dia_font_new_from_style( DIA_FONT_SANS, DEFAULT_FONT);
- other->text = new_text("", font,
- DEFAULT_FONT, &p,
- &color_black,
- ALIGN_CENTER);
+ other->text = new_text ("",
+ font,
+ DEFAULT_FONT,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init(elem, 8, 0);
diff --git a/objects/Jackson/domain.c b/objects/Jackson/domain.c
index 805003d2d..426d10998 100644
--- a/objects/Jackson/domain.c
+++ b/objects/Jackson/domain.c
@@ -434,8 +434,11 @@ jackson_box_draw (Box *box, DiaRenderer *renderer)
if (s != NULL) {
dia_renderer_draw_rect (renderer, &b3, &b1,
NULL, &JACKSON_BOX_FG_COLOR);
- dia_renderer_draw_string (renderer, s, &b2,
- ALIGN_RIGHT, &box->text->color);
+ dia_renderer_draw_string (renderer,
+ s,
+ &b2,
+ DIA_ALIGN_RIGHT,
+ &box->text->color);
}
text_draw (box->text, renderer);
@@ -681,7 +684,7 @@ jackson_box_create (Point *startpoint,
box->text = new_text ("", font,
DEFAULT_FONT, &p,
&color_black,
- ALIGN_CENTER);
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init (elem, 8, 0);
diff --git a/objects/Jackson/phenomenon.c b/objects/Jackson/phenomenon.c
index 54335f538..f0be86a70 100644
--- a/objects/Jackson/phenomenon.c
+++ b/objects/Jackson/phenomenon.c
@@ -301,7 +301,11 @@ message_draw (Message *message, DiaRenderer *renderer)
dia_renderer_set_font (renderer, message_font, MESSAGE_FONTHEIGHT);
if (mname && strlen (mname) != 0) {
- dia_renderer_draw_string (renderer, mname, &message->text_pos, ALIGN_CENTER, &color_black);
+ dia_renderer_draw_string (renderer,
+ mname,
+ &message->text_pos,
+ DIA_ALIGN_CENTRE,
+ &color_black);
}
g_clear_pointer (&mname, g_free);
diff --git a/objects/Jackson/requirement.c b/objects/Jackson/requirement.c
index c1417c85e..fe091f0bf 100644
--- a/objects/Jackson/requirement.c
+++ b/objects/Jackson/requirement.c
@@ -361,7 +361,7 @@ req_create(Point *startpoint,
p.x += REQ_WIDTH/2.0;
p.y += REQ_HEIGHT/2.0;
- req->text = new_text ("", font, REQ_FONT, &p, &color_black, ALIGN_CENTER);
+ req->text = new_text ("", font, REQ_FONT, &p, &color_black, DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init (elem, 8, NUM_CONNECTIONS);
diff --git a/objects/KAOS/goal.c b/objects/KAOS/goal.c
index 4366efa0a..86c935d3c 100644
--- a/objects/KAOS/goal.c
+++ b/objects/KAOS/goal.c
@@ -721,7 +721,7 @@ goal_create(Point *startpoint,
goal->text = new_text ("", font,
DEFAULT_FONT, &p,
&color_black,
- ALIGN_CENTER);
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init(elem, 8, 0);
diff --git a/objects/KAOS/metaandorrel.c b/objects/KAOS/metaandorrel.c
index d8a18d349..6c89ae8d5 100644
--- a/objects/KAOS/metaandorrel.c
+++ b/objects/KAOS/metaandorrel.c
@@ -495,7 +495,7 @@ maor_draw (Maor *maor, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
mname,
&maor->text_pos,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&color_black);
}
diff --git a/objects/KAOS/metabinrel.c b/objects/KAOS/metabinrel.c
index 78dc88251..31be0c98b 100644
--- a/objects/KAOS/metabinrel.c
+++ b/objects/KAOS/metabinrel.c
@@ -456,13 +456,17 @@ mbr_draw (Mbr *mbr, DiaRenderer *renderer)
annot = compute_text (mbr);
dia_renderer_set_font (renderer, mbr_font, MBR_DECFONTHEIGHT);
- if (annot && strlen(annot) != 0) {
- pa1.x=mbr->pm.x-mbr->text_width/2;
- pa1.y=mbr->pm.y-mbr->text_ascent +0.1; /* with some fix... */
- pa2.x=pa1.x+mbr->text_width;
- pa2.y=pa1.y+MBR_DECFONTHEIGHT +0.1; /* with some fix... */
- dia_renderer_draw_rect (renderer,&pa1,&pa2,&color_white, NULL);
- dia_renderer_draw_string (renderer,annot,&mbr->pm,ALIGN_CENTER,&MBR_FG_COLOR);
+ if (annot && strlen (annot) != 0) {
+ pa1.x = mbr->pm.x - mbr->text_width / 2;
+ pa1.y = mbr->pm.y - mbr->text_ascent + 0.1; /* with some fix... */
+ pa2.x = pa1.x + mbr->text_width;
+ pa2.y = pa1.y + MBR_DECFONTHEIGHT + 0.1; /* with some fix... */
+ dia_renderer_draw_rect (renderer, &pa1, &pa2, &color_white, NULL);
+ dia_renderer_draw_string (renderer,
+ annot,
+ &mbr->pm,
+ DIA_ALIGN_CENTRE,
+ &MBR_FG_COLOR);
}
g_clear_pointer (&annot, g_free);
diff --git a/objects/KAOS/other.c b/objects/KAOS/other.c
index 0833ac2bc..af7793189 100644
--- a/objects/KAOS/other.c
+++ b/objects/KAOS/other.c
@@ -657,10 +657,12 @@ other_create(Point *startpoint,
font = dia_font_new_from_style( DIA_FONT_SANS , DEFAULT_FONT);
- other->text = new_text("", font,
- DEFAULT_FONT, &p,
- &color_black,
- ALIGN_CENTER);
+ other->text = new_text ("",
+ font,
+ DEFAULT_FONT,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init(elem, 8, 1);
diff --git a/objects/Misc/measure.c b/objects/Misc/measure.c
index d134dbaa4..74b2054cc 100644
--- a/objects/Misc/measure.c
+++ b/objects/Misc/measure.c
@@ -282,7 +282,7 @@ measure_draw (Measure *measure, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
measure->name,
&measure->text_pos,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&measure->line_color);
}
diff --git a/objects/SADT/annotation.c b/objects/SADT/annotation.c
index 0dcd5b8a6..4be7d60d7 100644
--- a/objects/SADT/annotation.c
+++ b/objects/SADT/annotation.c
@@ -350,12 +350,13 @@ annotation_create(Point *startpoint,
annotation->line_color = color_black;
- font = dia_font_new_from_style(DIA_FONT_SANS,ANNOTATION_FONTHEIGHT);
- annotation->text = new_text("", font,
- ANNOTATION_FONTHEIGHT,
- &conn->endpoints[1],
- &color_black,
- ALIGN_CENTER);
+ font = dia_font_new_from_style (DIA_FONT_SANS, ANNOTATION_FONTHEIGHT);
+ annotation->text = new_text ("",
+ font,
+ ANNOTATION_FONTHEIGHT,
+ &conn->endpoints[1],
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
offs.x = .3 * ANNOTATION_FONTHEIGHT;
diff --git a/objects/SADT/box.c b/objects/SADT/box.c
index 91db72625..f1f3df27e 100644
--- a/objects/SADT/box.c
+++ b/objects/SADT/box.c
@@ -326,7 +326,8 @@ sadtbox_draw (Box *box, DiaRenderer *renderer)
pos.y -= .3 * idfontheight;
dia_renderer_draw_string (renderer,
box->id,
- &pos, ALIGN_RIGHT,
+ &pos,
+ DIA_ALIGN_RIGHT,
&box->text->color);
}
@@ -553,12 +554,14 @@ sadtbox_create(Point *startpoint,
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + /*default_properties.font_size*/ 0.8 / 2;
- font = dia_font_new_from_style( DIA_FONT_SANS|DIA_FONT_BOLD ,0.8);
+ font = dia_font_new_from_style (DIA_FONT_SANS|DIA_FONT_BOLD, 0.8);
- box->text = new_text("", font,
- 0.8, &p,
- &color_black,
- ALIGN_CENTER);
+ box->text = new_text ("",
+ font,
+ 0.8,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
box->id = g_strdup("A0"); /* should be made better.
diff --git a/objects/UML/activity.c b/objects/UML/activity.c
index dbbaaaf9c..d51ad541a 100644
--- a/objects/UML/activity.c
+++ b/objects/UML/activity.c
@@ -303,9 +303,9 @@ state_create_activity(Point *startpoint,
p.x += STATE_WIDTH/2.0;
p.y += STATE_HEIGHT/2.0;
- state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
+ state->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_CENTRE);
g_clear_object (&font);
- element_init(elem, 8, NUM_CONNECTIONS);
+ element_init (elem, 8, NUM_CONNECTIONS);
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &state->connections[i];
diff --git a/objects/UML/actor.c b/objects/UML/actor.c
index 1731ad2d9..4d4326553 100644
--- a/objects/UML/actor.c
+++ b/objects/UML/actor.c
@@ -359,7 +359,11 @@ actor_create(Point *startpoint,
p.y += ACTOR_HEIGHT - dia_font_descent(_("Actor"),font, 0.8);
actor->text = new_text (_("Actor"),
- font, 0.8, &p, &color_black, ALIGN_CENTER);
+ font,
+ 0.8,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/UML/association.c b/objects/UML/association.c
index bf367bc93..76a640996 100644
--- a/objects/UML/association.c
+++ b/objects/UML/association.c
@@ -94,7 +94,7 @@ typedef struct _AssociationEnd {
double role_descent;
double multi_ascent;
double multi_descent;
- Alignment text_align;
+ DiaAlignment text_align;
UMLVisibility visibility; /* This value is only relevant if role is not null */
int arrow;
@@ -123,7 +123,7 @@ struct _Association {
OrthConn orth;
Point text_pos;
- Alignment text_align;
+ DiaAlignment text_align;
double text_width;
double ascent;
double descent;
@@ -393,8 +393,9 @@ assoc_get_direction_poly (Association *assoc, Point* poly)
if (assoc->show_direction) {
if (assoc->direction == ASSOC_RIGHT) {
poly[0].x = assoc->text_pos.x + assoc->text_width + 0.1;
- if (assoc->text_align == ALIGN_CENTER)
- poly[0].x -= assoc->text_width/2.0;
+ if (assoc->text_align == DIA_ALIGN_CENTRE) {
+ poly[0].x -= assoc->text_width / 2.0;
+ }
poly[0].y = assoc->text_pos.y;
poly[1].x = poly[0].x;
poly[1].y = poly[0].y - assoc->font_height*0.5;
@@ -403,8 +404,9 @@ assoc_get_direction_poly (Association *assoc, Point* poly)
return TRUE;
} else if (assoc->direction == ASSOC_LEFT) {
poly[0].x = assoc->text_pos.x - 0.2;
- if (assoc->text_align == ALIGN_CENTER)
- poly[0].x -= assoc->text_width/2.0;
+ if (assoc->text_align == DIA_ALIGN_CENTRE) {
+ poly[0].x -= assoc->text_width / 2.0;
+ }
poly[0].y = assoc->text_pos.y;
poly[1].x = poly[0].x;
poly[1].y = poly[0].y - assoc->font_height*0.5;
@@ -654,10 +656,10 @@ association_update_data_end(Association *assoc, int endnum)
case HORIZONTAL:
end->text_pos.y -= end->role_descent;
if (points[fp].x < points[sp].x) {
- end->text_align = ALIGN_LEFT;
+ end->text_align = DIA_ALIGN_LEFT;
end->text_pos.x += (get_aggregate_pos_diff (end, assoc) + ASSOCIATION_END_SPACE);
} else {
- end->text_align = ALIGN_RIGHT;
+ end->text_align = DIA_ALIGN_RIGHT;
end->text_pos.x -= (get_aggregate_pos_diff (end, assoc) + ASSOCIATION_END_SPACE);
}
break;
@@ -677,14 +679,14 @@ association_update_data_end(Association *assoc, int endnum)
}
}
- end->text_align = ALIGN_LEFT;
+ end->text_align = DIA_ALIGN_LEFT;
break;
default:
g_return_if_reached ();
}
/* Add the text recangle to the bounding box: */
rect.left = end->text_pos.x
- - (end->text_align == ALIGN_LEFT ? 0 : end->text_width);
+ - (end->text_align == DIA_ALIGN_LEFT ? 0 : end->text_width);
rect.right = rect.left + end->text_width;
rect.top = end->text_pos.y - end->role_ascent;
rect.bottom = rect.top + 2*assoc->font_height;
@@ -762,12 +764,12 @@ association_update_data(Association *assoc)
switch (dir) {
case HORIZONTAL:
- assoc->text_align = ALIGN_CENTER;
+ assoc->text_align = DIA_ALIGN_CENTRE;
assoc->text_pos.x = 0.5*(points[i].x+points[i+1].x);
assoc->text_pos.y = points[i].y - assoc->descent;
break;
case VERTICAL:
- assoc->text_align = ALIGN_LEFT;
+ assoc->text_align = DIA_ALIGN_LEFT;
assoc->text_pos.x = points[i].x + 0.1;
assoc->text_pos.y = 0.5*(points[i].y+points[i+1].y) - assoc->descent;
break;
@@ -777,8 +779,9 @@ association_update_data(Association *assoc)
/* Add the text recangle to the bounding box: */
rect.left = assoc->text_pos.x;
- if (assoc->text_align == ALIGN_CENTER)
- rect.left -= assoc->text_width/2.0;
+ if (assoc->text_align == DIA_ALIGN_CENTRE) {
+ rect.left -= assoc->text_width / 2.0;
+ }
rect.right = rect.left + assoc->text_width;
rect.top = assoc->text_pos.y - assoc->ascent;
rect.bottom = rect.top + assoc->font_height;
diff --git a/objects/UML/class.c b/objects/UML/class.c
index 702d0865b..95a42b8bb 100644
--- a/objects/UML/class.c
+++ b/objects/UML/class.c
@@ -851,11 +851,19 @@ umlclass_draw_namebox (UMLClass *umlclass,
/* stereotype: */
if (umlclass->stereotype != NULL && umlclass->stereotype[0] != '\0') {
- gchar *String = umlclass->stereotype_string;
- ascent = dia_font_ascent (String, umlclass->normal_font, umlclass->font_height);
+ char *string = umlclass->stereotype_string;
+ ascent = dia_font_ascent (string,
+ umlclass->normal_font,
+ umlclass->font_height);
StartPoint.y += ascent;
- dia_renderer_set_font (renderer, umlclass->normal_font, umlclass->font_height);
- dia_renderer_draw_string (renderer, String, &StartPoint, ALIGN_CENTER, text_color);
+ dia_renderer_set_font (renderer,
+ umlclass->normal_font,
+ umlclass->font_height);
+ dia_renderer_draw_string (renderer,
+ string,
+ &StartPoint,
+ DIA_ALIGN_CENTRE,
+ text_color);
StartPoint.y += umlclass->font_height - ascent;
}
@@ -872,7 +880,11 @@ umlclass_draw_namebox (UMLClass *umlclass,
StartPoint.y += ascent;
dia_renderer_set_font (renderer, font, font_height);
- dia_renderer_draw_string (renderer, umlclass->name, &StartPoint, ALIGN_CENTER, text_color);
+ dia_renderer_draw_string (renderer,
+ umlclass->name,
+ &StartPoint,
+ DIA_ALIGN_CENTRE,
+ text_color);
StartPoint.y += font_height - ascent;
}
@@ -886,7 +898,7 @@ umlclass_draw_namebox (UMLClass *umlclass,
umlclass->comment_tagging,
umlclass->comment_line_length,
&StartPoint,
- ALIGN_CENTER);
+ DIA_ALIGN_CENTRE);
}
return Yoffset;
}
@@ -956,7 +968,11 @@ umlclass_draw_attributebox (UMLClass *umlclass,
ascent = dia_font_ascent (attstr, font, font_height);
StartPoint.y += ascent;
dia_renderer_set_font (renderer, font, font_height);
- dia_renderer_draw_string (renderer, attstr, &StartPoint, ALIGN_LEFT, text_color);
+ dia_renderer_draw_string (renderer,
+ attstr,
+ &StartPoint,
+ DIA_ALIGN_LEFT,
+ text_color);
StartPoint.y += font_height - ascent;
if (attr->class_scope) {
@@ -979,7 +995,7 @@ umlclass_draw_attributebox (UMLClass *umlclass,
umlclass->comment_tagging,
umlclass->comment_line_length,
&StartPoint,
- ALIGN_LEFT);
+ DIA_ALIGN_LEFT);
StartPoint.y += umlclass->comment_font_height/2;
}
list = g_list_next (list);
@@ -1107,7 +1123,11 @@ umlclass_draw_operationbox (UMLClass *umlclass,
} else {
StartPoint.y += font_height;
}
- dia_renderer_draw_string (renderer, part_opstr, &StartPoint, ALIGN_LEFT, text_color);
+ dia_renderer_draw_string (renderer,
+ part_opstr,
+ &StartPoint,
+ DIA_ALIGN_LEFT,
+ text_color);
if (op->class_scope) {
uml_underline_text (renderer,
StartPoint,
@@ -1123,7 +1143,11 @@ umlclass_draw_operationbox (UMLClass *umlclass,
}
} else {
StartPoint.y += ascent;
- dia_renderer_draw_string (renderer, opstr, &StartPoint, ALIGN_LEFT, text_color);
+ dia_renderer_draw_string (renderer,
+ opstr,
+ &StartPoint,
+ DIA_ALIGN_LEFT,
+ text_color);
if (op->class_scope) {
uml_underline_text (renderer,
StartPoint,
@@ -1148,8 +1172,8 @@ umlclass_draw_operationbox (UMLClass *umlclass,
umlclass->comment_tagging,
umlclass->comment_line_length,
&StartPoint,
- ALIGN_LEFT);
- StartPoint.y += umlclass->comment_font_height/2;
+ DIA_ALIGN_LEFT);
+ StartPoint.y += umlclass->comment_font_height / 2;
}
list = g_list_next (list);
@@ -1211,11 +1235,15 @@ umlclass_draw_template_parameters_box (UMLClass *umlclass,
i = 0;
list = umlclass->formal_params;
while (list != NULL) {
- gchar *paramstr = uml_formal_parameter_get_string ((UMLFormalParameter *) list->data);
+ char *paramstr = uml_formal_parameter_get_string ((UMLFormalParameter *) list->data);
ascent = dia_font_ascent (paramstr, font, font_height);
TextInsert.y += ascent;
- dia_renderer_draw_string (renderer, paramstr, &TextInsert, ALIGN_LEFT, text_color);
+ dia_renderer_draw_string (renderer,
+ paramstr,
+ &TextInsert,
+ DIA_ALIGN_LEFT,
+ text_color);
TextInsert.y += font_height - ascent;
list = g_list_next (list);
diff --git a/objects/UML/classicon.c b/objects/UML/classicon.c
index 6d555e993..712b215d2 100644
--- a/objects/UML/classicon.c
+++ b/objects/UML/classicon.c
@@ -451,7 +451,7 @@ classicon_create(Point *startpoint,
/* The text position is recalculated later */
p.x = 0.0;
p.y = 0.0;
- cicon->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
+ cicon->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_CENTRE);
g_clear_object (&font);
diff --git a/objects/UML/component.c b/objects/UML/component.c
index 357aa22ee..5486dd07e 100644
--- a/objects/UML/component.c
+++ b/objects/UML/component.c
@@ -276,7 +276,7 @@ component_draw (Component *cmp, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
cmp->st_stereotype,
&p1,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&cmp->text->color);
}
@@ -408,7 +408,7 @@ component_create(Point *startpoint,
p.x += COMPONENT_CWIDTH + COMPONENT_MARGIN_X;
p.y += 2*COMPONENT_CHEIGHT;
- cmp->text = new_text ("", font, 0.8, &p, &color_black, ALIGN_LEFT);
+ cmp->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_LEFT);
g_clear_object (&font);
diff --git a/objects/UML/component_feature.c b/objects/UML/component_feature.c
index 47a266376..1683f37d2 100644
--- a/objects/UML/component_feature.c
+++ b/objects/UML/component_feature.c
@@ -403,7 +403,7 @@ compfeat_create(Point *startpoint,
COMPPROP_FONTHEIGHT,
&p,
&compfeat->line_color,
- ALIGN_CENTER);
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
compfeat->text_handle.id = HANDLE_MOVE_TEXT;
diff --git a/objects/UML/constraint.c b/objects/UML/constraint.c
index d8ebdc884..cb32b997c 100644
--- a/objects/UML/constraint.c
+++ b/objects/UML/constraint.c
@@ -277,7 +277,7 @@ constraint_draw (Constraint *constraint, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
constraint->brtext,
&constraint->text_pos,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&constraint->text_color);
}
diff --git a/objects/UML/dependency.c b/objects/UML/dependency.c
index a0869a3ef..7676dfc76 100644
--- a/objects/UML/dependency.c
+++ b/objects/UML/dependency.c
@@ -42,7 +42,7 @@ struct _Dependency {
OrthConn orth;
Point text_pos;
- Alignment text_align;
+ DiaAlignment text_align;
real text_width;
Color text_color;
@@ -334,7 +334,7 @@ dependency_update_data(Dependency *dep)
switch (dep->orth.orientation[i]) {
case HORIZONTAL:
- dep->text_align = ALIGN_CENTER;
+ dep->text_align = DIA_ALIGN_CENTRE;
dep->text_pos.x = 0.5*(points[i].x+points[i+1].x);
dep->text_pos.y = points[i].y;
if (dep->name)
@@ -343,7 +343,7 @@ dependency_update_data(Dependency *dep)
dep->font_height);
break;
case VERTICAL:
- dep->text_align = ALIGN_LEFT;
+ dep->text_align = DIA_ALIGN_LEFT;
dep->text_pos.x = points[i].x + 0.1;
dep->text_pos.y =
0.5*(points[i].y+points[i+1].y);
@@ -358,7 +358,7 @@ dependency_update_data(Dependency *dep)
/* Add the text recangle to the bounding box: */
rect.left = dep->text_pos.x;
- if (dep->text_align == ALIGN_CENTER)
+ if (dep->text_align == DIA_ALIGN_CENTRE)
rect.left -= dep->text_width/2.0;
rect.right = rect.left + dep->text_width;
rect.top = dep->text_pos.y;
diff --git a/objects/UML/generalization.c b/objects/UML/generalization.c
index 69cf30a8c..52a1f8f20 100644
--- a/objects/UML/generalization.c
+++ b/objects/UML/generalization.c
@@ -41,7 +41,7 @@ struct _Generalization {
OrthConn orth;
Point text_pos;
- Alignment text_align;
+ DiaAlignment text_align;
real text_width;
DiaFont *font;
@@ -345,12 +345,12 @@ generalization_update_data(Generalization *genlz)
switch (genlz->orth.orientation[i]) {
case HORIZONTAL:
- genlz->text_align = ALIGN_CENTER;
+ genlz->text_align = DIA_ALIGN_CENTRE;
genlz->text_pos.x = 0.5*(points[i].x+points[i+1].x);
genlz->text_pos.y = points[i].y - descent;
break;
case VERTICAL:
- genlz->text_align = ALIGN_LEFT;
+ genlz->text_align = DIA_ALIGN_LEFT;
genlz->text_pos.x = points[i].x + 0.1;
genlz->text_pos.y = 0.5*(points[i].y+points[i+1].y) - descent;
break;
@@ -360,8 +360,9 @@ generalization_update_data(Generalization *genlz)
/* Add the text recangle to the bounding box: */
rect.left = genlz->text_pos.x;
- if (genlz->text_align == ALIGN_CENTER)
- rect.left -= genlz->text_width/2.0;
+ if (genlz->text_align == DIA_ALIGN_CENTRE) {
+ rect.left -= genlz->text_width / 2.0;
+ }
rect.right = rect.left + genlz->text_width;
rect.top = genlz->text_pos.y - ascent;
rect.bottom = rect.top + 2*genlz->font_height;
diff --git a/objects/UML/implements.c b/objects/UML/implements.c
index c5b0233d4..105dd949f 100644
--- a/objects/UML/implements.c
+++ b/objects/UML/implements.c
@@ -287,7 +287,7 @@ implements_draw (Implements *implements, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
implements->text,
&implements->text_pos,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&implements->text_color);
}
}
diff --git a/objects/UML/large_package.c b/objects/UML/large_package.c
index b401051c9..becef5748 100644
--- a/objects/UML/large_package.c
+++ b/objects/UML/large_package.c
@@ -290,7 +290,7 @@ largepackage_draw (LargePackage *pkg, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
pkg->st_stereotype,
&p1,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&pkg->text_color);
}
p1.y += pkg->font_height;
@@ -299,7 +299,7 @@ largepackage_draw (LargePackage *pkg, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
pkg->name,
&p1,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&pkg->text_color);
}
}
diff --git a/objects/UML/message.c b/objects/UML/message.c
index 4ffa4da60..d0b5ae8e7 100644
--- a/objects/UML/message.c
+++ b/objects/UML/message.c
@@ -356,7 +356,7 @@ message_draw (Message *message, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
mname, /*message->text,*/
&message->text_pos,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&message->text_color);
}
diff --git a/objects/UML/node.c b/objects/UML/node.c
index f771faa6a..710e20655 100644
--- a/objects/UML/node.c
+++ b/objects/UML/node.c
@@ -345,7 +345,12 @@ static DiaObject *node_create(Point *startpoint, void *user_data, Handle **handl
/* The text position is recalculated later */
p.x = 0.0;
p.y = 0.0;
- node->name = new_text ("", font, NODE_FONTHEIGHT, &p, &color_black, ALIGN_LEFT);
+ node->name = new_text ("",
+ font,
+ NODE_FONTHEIGHT,
+ &p,
+ &color_black,
+ DIA_ALIGN_LEFT);
g_clear_object (&font);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/UML/note.c b/objects/UML/note.c
index f42567874..f3fc18542 100644
--- a/objects/UML/note.c
+++ b/objects/UML/note.c
@@ -319,7 +319,7 @@ note_create(Point *startpoint,
p.x += note->line_width/2.0 + NOTE_MARGIN_X;
p.y += note->line_width/2.0 + NOTE_CORNER + dia_font_ascent("A",font, 0.8);
- note->text = new_text ("", font, 0.8, &p, &color_black, ALIGN_LEFT);
+ note->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_LEFT);
g_clear_object (&font);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/UML/object.c b/objects/UML/object.c
index 237dba64c..135c2e946 100644
--- a/objects/UML/object.c
+++ b/objects/UML/object.c
@@ -203,7 +203,7 @@ objet_get_props (Objet * objet, GPtrArray *props)
{
text_get_attributes (objet->text, &objet->text_attrs);
/* the aligement is _not_ part of the deal */
- objet->text_attrs.alignment = ALIGN_CENTER;
+ objet->text_attrs.alignment = DIA_ALIGN_CENTRE;
g_clear_pointer (&objet->attrib, g_free);
objet->attrib = text_get_string_copy (objet->attributes);
@@ -221,11 +221,11 @@ objet_set_props(Objet *objet, GPtrArray *props)
apply_textstr_properties(props,objet->attributes,"attrib",objet->attrib);
/* also update our text object with the new color (font + height) */
/* the aligement is _not_ part of the deal */
- objet->text_attrs.alignment = ALIGN_CENTER;
+ objet->text_attrs.alignment = DIA_ALIGN_CENTRE;
apply_textattr_properties(props,objet->text,"text",&objet->text_attrs);
- objet->text_attrs.alignment = ALIGN_LEFT;
+ objet->text_attrs.alignment = DIA_ALIGN_LEFT;
apply_textattr_properties(props,objet->attributes,"attrib",&objet->text_attrs);
- objet->text_attrs.alignment = ALIGN_CENTER;
+ objet->text_attrs.alignment = DIA_ALIGN_CENTRE;
g_clear_pointer (&objet->st_stereotype, g_free);
objet_update_data(objet);
}
@@ -328,7 +328,7 @@ objet_draw (Objet *ob, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
ob->st_stereotype,
&ob->st_pos,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&ob->text_attrs.color);
}
@@ -336,7 +336,7 @@ objet_draw (Objet *ob, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
ob->exstate,
&ob->ex_pos,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&ob->text_attrs.color);
}
@@ -490,9 +490,9 @@ objet_create(Point *startpoint,
/* The text position is recalculated later */
p.x = 0.0;
p.y = 0.0;
- ob->attributes = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
+ ob->attributes = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_LEFT);
ob->attrib = NULL;
- ob->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
+ ob->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_CENTRE);
text_get_attributes(ob->text,&ob->text_attrs);
g_clear_object (&font);
diff --git a/objects/UML/realizes.c b/objects/UML/realizes.c
index 43906f7ff..ad2dd62d2 100644
--- a/objects/UML/realizes.c
+++ b/objects/UML/realizes.c
@@ -40,7 +40,7 @@ struct _Realizes {
OrthConn orth;
Point text_pos;
- Alignment text_align;
+ DiaAlignment text_align;
real text_width;
Color text_color;
@@ -328,7 +328,7 @@ realizes_update_data(Realizes *realize)
switch (realize->orth.orientation[i]) {
case HORIZONTAL:
- realize->text_align = ALIGN_CENTER;
+ realize->text_align = DIA_ALIGN_CENTRE;
realize->text_pos.x = 0.5*(points[i].x+points[i+1].x);
realize->text_pos.y = points[i].y;
if (realize->name)
@@ -336,7 +336,7 @@ realizes_update_data(Realizes *realize)
dia_font_descent (realize->name,realize->font, realize->font_height);
break;
case VERTICAL:
- realize->text_align = ALIGN_LEFT;
+ realize->text_align = DIA_ALIGN_LEFT;
realize->text_pos.x = points[i].x + 0.1;
realize->text_pos.y = 0.5*(points[i].y+points[i+1].y);
if (realize->name)
@@ -349,8 +349,9 @@ realizes_update_data(Realizes *realize)
/* Add the text recangle to the bounding box: */
rect.left = realize->text_pos.x;
- if (realize->text_align == ALIGN_CENTER)
- rect.left -= realize->text_width/2.0;
+ if (realize->text_align == DIA_ALIGN_CENTRE) {
+ rect.left -= realize->text_width / 2.0;
+ }
rect.right = rect.left + realize->text_width;
rect.top = realize->text_pos.y;
if (realize->name)
diff --git a/objects/UML/small_package.c b/objects/UML/small_package.c
index 752b591d2..017704c82 100644
--- a/objects/UML/small_package.c
+++ b/objects/UML/small_package.c
@@ -281,7 +281,7 @@ smallpackage_draw (SmallPackage *pkg, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
pkg->st_stereotype,
&p1,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&pkg->text->color);
}
}
@@ -361,7 +361,7 @@ smallpackage_create(Point *startpoint,
p.x += SMALLPACKAGE_MARGIN_X;
p.y += SMALLPACKAGE_MARGIN_Y+ dia_font_ascent("A",font, 0.8);
- pkg->text = new_text ("", font, 0.8, &p, &color_black, ALIGN_LEFT);
+ pkg->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_LEFT);
g_clear_object (&font);
element_init (elem, 8, NUM_CONNECTIONS);
diff --git a/objects/UML/state.c b/objects/UML/state.c
index 32208f13f..9f7e7f582 100644
--- a/objects/UML/state.c
+++ b/objects/UML/state.c
@@ -258,7 +258,7 @@ state_draw_action_string (State *state,
dia_renderer_draw_string (renderer,
action_text,
&pos,
- ALIGN_LEFT,
+ DIA_ALIGN_LEFT,
&state->text->color);
g_clear_pointer (&action_text, g_free);
}
@@ -447,7 +447,7 @@ state_create(Point *startpoint,
p.x += STATE_WIDTH/2.0;
p.y += STATE_HEIGHT/2.0;
- state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
+ state->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_CENTRE);
g_clear_object (&font);
diff --git a/objects/UML/transition.c b/objects/UML/transition.c
index db0805a08..0cdf19add 100644
--- a/objects/UML/transition.c
+++ b/objects/UML/transition.c
@@ -397,7 +397,7 @@ transition_draw (Transition *transition, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
text,
&transition->guard_text_pos,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&transition->text_color);
g_clear_pointer (&text, g_free);
}
@@ -408,7 +408,7 @@ transition_draw (Transition *transition, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
text,
&transition->trigger_text_pos,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&transition->text_color);
g_clear_pointer (&text, g_free);
}
diff --git a/objects/UML/usecase.c b/objects/UML/usecase.c
index 429af7cb1..fdfae143c 100644
--- a/objects/UML/usecase.c
+++ b/objects/UML/usecase.c
@@ -419,7 +419,7 @@ usecase_create(Point *startpoint,
p.x += USECASE_WIDTH/2.0;
p.y += USECASE_HEIGHT/2.0;
- usecase->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
+ usecase->text = new_text ("", font, 0.8, &p, &color_black, DIA_ALIGN_CENTRE);
g_clear_object (&font);
usecase->text_outside = 0;
diff --git a/objects/chronogram/chronoline.c b/objects/chronogram/chronoline.c
index 1be0059f2..4b2f923e1 100644
--- a/objects/chronogram/chronoline.c
+++ b/objects/chronogram/chronoline.c
@@ -503,7 +503,7 @@ chronoline_draw (Chronoline *chronoline, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
chronoline->name,
&p3,
- ALIGN_RIGHT,
+ DIA_ALIGN_RIGHT,
&chronoline->font_color);
}
diff --git a/objects/chronogram/chronoref.c b/objects/chronogram/chronoref.c
index fd61254b1..98945e26e 100644
--- a/objects/chronogram/chronoref.c
+++ b/objects/chronogram/chronoref.c
@@ -323,7 +323,7 @@ chronoref_draw(Chronoref *chronoref, DiaRenderer *renderer)
dia_renderer_draw_string (renderer,
time,
&p3,
- ALIGN_CENTER,
+ DIA_ALIGN_CENTRE,
&chronoref->font_color);
}
}
diff --git a/objects/custom/custom_object.c b/objects/custom/custom_object.c
index 16bb33a4a..bc460530c 100644
--- a/objects/custom/custom_object.c
+++ b/objects/custom/custom_object.c
@@ -1457,13 +1457,13 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
DiaRectangle tb;
transform_rect (custom, &info->text_bounds, &tb);
switch (custom->text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
p.x = tb.left+custom->padding;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
p.x = tb.right-custom->padding;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
p.x = (tb.left + tb.right) / 2;
break;
default:
@@ -1639,9 +1639,10 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
element_update_handles(elem);
}
+
/* reposition the text element to the new text bounding box ... */
static void
-custom_reposition_text(Custom *custom, GraphicElementText *text)
+custom_reposition_text (Custom *custom, GraphicElementText *text)
{
Element *elem = &custom->element;
Point p;
@@ -1649,13 +1650,13 @@ custom_reposition_text(Custom *custom, GraphicElementText *text)
transform_rect (custom, &text->text_bounds, &tb);
switch (text->object->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
p.x = tb.left;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
p.x = tb.right;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
p.x = (tb.left + tb.right) / 2;
break;
default:
diff --git a/objects/custom/shape_info.c b/objects/custom/shape_info.c
index dc548e731..b7059c524 100644
--- a/objects/custom/shape_info.c
+++ b/objects/custom/shape_info.c
@@ -46,7 +46,7 @@
#include "units.h"
#define FONT_HEIGHT_DEFAULT 1
-#define TEXT_ALIGNMENT_DEFAULT ALIGN_CENTER
+#define TEXT_ALIGNMENT_DEFAULT DIA_ALIGN_CENTRE
static ShapeInfo *load_shape_info(const gchar *filename, ShapeInfo *preload);
static void update_bounds(ShapeInfo *info);
@@ -857,19 +857,21 @@ load_shape_info (const gchar *filename, ShapeInfo *preload)
str = xmlGetProp(node, (const xmlChar *)"resize");
if (str) {
info->resize_with_text = TRUE;
- if (!xmlStrcmp(str,(const xmlChar *)"no"))
+ if (!xmlStrcmp (str, (const xmlChar *) "no")) {
info->resize_with_text = FALSE;
- xmlFree(str);
+ }
}
- info->text_align = ALIGN_CENTER;
- str = xmlGetProp(node, (const xmlChar *)"align");
+ dia_clear_xml_string (&str);
+ info->text_align = DIA_ALIGN_CENTRE;
+ str = xmlGetProp (node, (const xmlChar *) "align");
if (str) {
- if (!xmlStrcmp(str, (const xmlChar *)"left"))
- info->text_align = ALIGN_LEFT;
- else if (!xmlStrcmp(str, (const xmlChar *)"right"))
- info->text_align = ALIGN_RIGHT;
- xmlFree(str);
+ if (!xmlStrcmp (str, (const xmlChar *) "left")) {
+ info->text_align = DIA_ALIGN_LEFT;
+ } else if (!xmlStrcmp (str, (const xmlChar *) "right")) {
+ info->text_align = DIA_ALIGN_RIGHT;
+ }
}
+ dia_clear_xml_string (&str);
info->has_text = TRUE;
} else if (node->ns == shape_ns && !xmlStrcmp(node->name, (const xmlChar *)"aspectratio")) {
tmp = (gchar *) xmlGetProp(node, (const xmlChar *)"type");
diff --git a/objects/flowchart/box.c b/objects/flowchart/box.c
index f11c595cb..94c653e8a 100644
--- a/objects/flowchart/box.c
+++ b/objects/flowchart/box.c
@@ -451,19 +451,20 @@ box_update_data(Box *box, AnchorShape horiz, AnchorShape vert)
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 - box->text->height * box->text->numlines / 2 +
box->text->ascent;
+
switch (box->text->alignment) {
- case ALIGN_LEFT:
- p.x -= (elem->width - box->padding*2 + box->border_width)/2;
+ case DIA_ALIGN_LEFT:
+ p.x -= (elem->width - box->padding * 2 + box->border_width) / 2;
break;
- case ALIGN_RIGHT:
- p.x += (elem->width - box->padding*2 + box->border_width)/2;
+ case DIA_ALIGN_RIGHT:
+ p.x += (elem->width - box->padding * 2 + box->border_width) / 2;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
default:
break;
}
- text_set_position(box->text, &p);
+ text_set_position (box->text, &p);
radius = box->corner_radius;
radius = MIN(radius, elem->width/2);
@@ -601,8 +602,12 @@ box_create(Point *startpoint,
p = *startpoint;
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + font_height / 2;
- box->text = new_text ("", font, font_height, &p, &box->border_color,
- ALIGN_CENTER);
+ box->text = new_text ("",
+ font,
+ font_height,
+ &p,
+ &box->border_color,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
/* new default: let the user decide the size */
@@ -732,11 +737,15 @@ box_load(ObjectNode obj_node, int version,DiaContext *ctx)
box->padding = data_real(attribute_first_data(attr), ctx);
box->text = NULL;
- attr = object_find_attribute(obj_node, "text");
- if (attr != NULL)
- box->text = data_text(attribute_first_data(attr), ctx);
- else /* paranoid */
- box->text = new_text_default(&obj->position, &box->border_color, ALIGN_CENTER);
+ attr = object_find_attribute (obj_node, "text");
+ if (attr != NULL) {
+ box->text = data_text (attribute_first_data (attr), ctx);
+ } else {
+ /* paranoid */
+ box->text = new_text_default (&obj->position,
+ &box->border_color,
+ DIA_ALIGN_CENTRE);
+ }
/* old default: only growth, manual shrink */
box->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/flowchart/diamond.c b/objects/flowchart/diamond.c
index 7b004e595..d6595ec1e 100644
--- a/objects/flowchart/diamond.c
+++ b/objects/flowchart/diamond.c
@@ -469,13 +469,13 @@ diamond_update_data(Diamond *diamond, AnchorShape horiz, AnchorShape vert)
p.y += elem->height / 2.0 - diamond->text->height*diamond->text->numlines/2 +
diamond->text->ascent;
switch (diamond->text->alignment) {
- case ALIGN_LEFT:
- p.x -= width/2;
+ case DIA_ALIGN_LEFT:
+ p.x -= width / 2;
break;
- case ALIGN_RIGHT:
- p.x += width/2;
+ case DIA_ALIGN_RIGHT:
+ p.x += width / 2;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
default:
break;
}
@@ -570,8 +570,12 @@ diamond_create(Point *startpoint,
p = *startpoint;
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + font_height / 2;
- diamond->text = new_text ("", font, font_height, &p, &diamond->border_color,
- ALIGN_CENTER);
+ diamond->text = new_text ("",
+ font,
+ font_height,
+ &p,
+ &diamond->border_color,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
/* new default: let the user decide the size */
@@ -699,11 +703,15 @@ diamond_load(ObjectNode obj_node, int version,DiaContext *ctx)
diamond->padding = data_real(attribute_first_data(attr), ctx);
diamond->text = NULL;
- attr = object_find_attribute(obj_node, "text");
- if (attr != NULL)
- diamond->text = data_text(attribute_first_data(attr), ctx);
- else /* paranoid */
- diamond->text = new_text_default(&obj->position, &diamond->border_color, ALIGN_CENTER);
+ attr = object_find_attribute (obj_node, "text");
+ if (attr != NULL) {
+ diamond->text = data_text (attribute_first_data (attr), ctx);
+ } else {
+ /* paranoid */
+ diamond->text = new_text_default (&obj->position,
+ &diamond->border_color,
+ DIA_ALIGN_CENTRE);
+ }
/* old default: only growth, manual shrink */
diamond->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/flowchart/ellipse.c b/objects/flowchart/ellipse.c
index fab04d5aa..dc329ef01 100644
--- a/objects/flowchart/ellipse.c
+++ b/objects/flowchart/ellipse.c
@@ -470,13 +470,13 @@ ellipse_update_data(Ellipse *ellipse, AnchorShape horiz, AnchorShape vert)
p.y += elem->height / 2.0 - ellipse->text->height*ellipse->text->numlines/2 +
ellipse->text->ascent;
switch (ellipse->text->alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
p.x -= (elem->width - 2*(ellipse->padding + ellipse->border_width))/2;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
p.x += (elem->width - 2*(ellipse->padding + ellipse->border_width))/2;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
break;
default:
g_return_if_reached ();
@@ -549,8 +549,12 @@ ellipse_create(Point *startpoint,
p = *startpoint;
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + font_height / 2;
- ellipse->text = new_text ("", font, font_height, &p, &ellipse->border_color,
- ALIGN_CENTER);
+ ellipse->text = new_text ("",
+ font,
+ font_height,
+ &p,
+ &ellipse->border_color,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
/* new default: let the user decide the size */
@@ -677,11 +681,14 @@ ellipse_load(ObjectNode obj_node, int version,DiaContext *ctx)
ellipse->padding = data_real(attribute_first_data(attr), ctx);
ellipse->text = NULL;
- attr = object_find_attribute(obj_node, "text");
- if (attr != NULL)
- ellipse->text = data_text(attribute_first_data(attr), ctx);
- else
- ellipse->text = new_text_default(&obj->position, &ellipse->border_color, ALIGN_CENTER);
+ attr = object_find_attribute (obj_node, "text");
+ if (attr != NULL) {
+ ellipse->text = data_text (attribute_first_data (attr), ctx);
+ } else {
+ ellipse->text = new_text_default (&obj->position,
+ &ellipse->border_color,
+ DIA_ALIGN_CENTRE);
+ }
/* old default: only growth, manual shrink */
ellipse->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/flowchart/parallelogram.c b/objects/flowchart/parallelogram.c
index ffb29a103..ddc8bb9bb 100644
--- a/objects/flowchart/parallelogram.c
+++ b/objects/flowchart/parallelogram.c
@@ -482,13 +482,13 @@ pgram_update_data(Pgram *pgram, AnchorShape horiz, AnchorShape vert)
p.y += elem->height / 2.0 - pgram->text->height * pgram->text->numlines / 2 +
pgram->text->ascent;
switch (pgram->text->alignment) {
- case ALIGN_LEFT:
- p.x -= avail_width/2;
+ case DIA_ALIGN_LEFT:
+ p.x -= avail_width / 2;
break;
- case ALIGN_RIGHT:
- p.x += avail_width/2;
+ case DIA_ALIGN_RIGHT:
+ p.x += avail_width / 2;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
break;
default:
g_return_if_reached ();
@@ -624,8 +624,12 @@ pgram_create(Point *startpoint,
p = *startpoint;
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + font_height / 2;
- pgram->text = new_text ("", font, font_height, &p, &pgram->border_color,
- ALIGN_CENTER);
+ pgram->text = new_text ("",
+ font,
+ font_height,
+ &p,
+ &pgram->border_color,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
/* new default: let the user decide the size */
@@ -760,11 +764,15 @@ pgram_load(ObjectNode obj_node, int version,DiaContext *ctx)
pgram->padding = data_real(attribute_first_data(attr), ctx);
pgram->text = NULL;
- attr = object_find_attribute(obj_node, "text");
- if (attr != NULL)
- pgram->text = data_text(attribute_first_data(attr), ctx);
- else /* paranoid */
- pgram->text = new_text_default(&obj->position, &pgram->border_color, ALIGN_CENTER);
+ attr = object_find_attribute (obj_node, "text");
+ if (attr != NULL) {
+ pgram->text = data_text (attribute_first_data (attr), ctx);
+ } else {
+ /* paranoid */
+ pgram->text = new_text_default (&obj->position,
+ &pgram->border_color,
+ DIA_ALIGN_CENTRE);
+ }
/* old default: only growth, manual shrink */
pgram->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/network/basestation.c b/objects/network/basestation.c
index 731fddf0c..507697e05 100644
--- a/objects/network/basestation.c
+++ b/objects/network/basestation.c
@@ -390,11 +390,14 @@ basestation_create(Point *startpoint,
font = dia_font_new_from_style (DIA_FONT_MONOSPACE, 0.8);
p = *startpoint;
- p.y += BASESTATION_HEIGHT -
- dia_font_descent(_("Base Station"), font, 0.8);
-
- basestation->text = new_text(_("Base Station"),
- font, 0.8, &p, &color_black, ALIGN_CENTER);
+ p.y += BASESTATION_HEIGHT - dia_font_descent (_("Base Station"), font, 0.8);
+
+ basestation->text = new_text (_("Base Station"),
+ font,
+ 0.8,
+ &p,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
basestation->line_colour = color_black;
basestation->fill_colour = color_white;
diff --git a/objects/network/radiocell.c b/objects/network/radiocell.c
index c01274e54..93de8911f 100644
--- a/objects/network/radiocell.c
+++ b/objects/network/radiocell.c
@@ -331,12 +331,16 @@ radiocell_create(Point *startpoint,
radiocell->fill_colour = color_white;
radiocell->line_colour = color_black;
radiocell->line_width = RADIOCELL_LINEWIDTH;
- attributes_get_default_line_style(&radiocell->line_style,
- &radiocell->dashlength);
-
- font = dia_font_new_from_style(DIA_FONT_MONOSPACE, RADIOCELL_FONTHEIGHT);
- radiocell->text = new_text ("", font, RADIOCELL_FONTHEIGHT, startpoint,
- &color_black, ALIGN_CENTER);
+ attributes_get_default_line_style (&radiocell->line_style,
+ &radiocell->dashlength);
+
+ font = dia_font_new_from_style (DIA_FONT_MONOSPACE, RADIOCELL_FONTHEIGHT);
+ radiocell->text = new_text ("",
+ font,
+ RADIOCELL_FONTHEIGHT,
+ startpoint,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
polyshape_init(poly, 6);
diff --git a/objects/standard/textobj.c b/objects/standard/textobj.c
index 04a40b912..690184f21 100644
--- a/objects/standard/textobj.c
+++ b/objects/standard/textobj.c
@@ -70,9 +70,9 @@ struct _Textobj {
};
static struct _TextobjProperties {
- Alignment alignment;
+ DiaAlignment alignment;
Valign vert_align;
-} default_properties = { ALIGN_LEFT, VALIGN_FIRST_LINE } ;
+} default_properties = { DIA_ALIGN_LEFT, VALIGN_FIRST_LINE };
static real textobj_distance_from(Textobj *textobj, Point *point);
static void textobj_select(Textobj *textobj, Point *clicked_point,
@@ -377,11 +377,13 @@ textobj_update_data (Textobj *textobj)
to2.y += textobj->margin; /* down */
else if (VALIGN_BOTTOM == textobj->vert_align)
to2.y -= textobj->margin; /* up */
- if (ALIGN_LEFT == textobj->text->alignment)
+
+ if (DIA_ALIGN_LEFT == textobj->text->alignment) {
to2.x += textobj->margin; /* right */
- else if (ALIGN_RIGHT == textobj->text->alignment)
+ } else if (DIA_ALIGN_RIGHT == textobj->text->alignment) {
to2.x -= textobj->margin; /* left */
- text_set_position(textobj->text, &to2);
+ }
+ text_set_position (textobj->text, &to2);
/* always use the unrotated box ... */
text_calc_boundingbox(textobj->text, &tx_bb);
@@ -521,13 +523,17 @@ textobj_load(ObjectNode obj_node, int version, DiaContext *ctx)
object_load(obj, obj_node, ctx);
- attr = object_find_attribute(obj_node, "text");
+ attr = object_find_attribute (obj_node, "text");
if (attr != NULL) {
- textobj->text = data_text(attribute_first_data(attr), ctx);
+ textobj->text = data_text (attribute_first_data (attr), ctx);
} else {
- DiaFont* font = dia_font_new_from_style(DIA_FONT_MONOSPACE,1.0);
- textobj->text = new_text ("", font, 1.0,
- &startpoint, &color_black, ALIGN_CENTER);
+ DiaFont *font = dia_font_new_from_style (DIA_FONT_MONOSPACE, 1.0);
+ textobj->text = new_text ("",
+ font,
+ 1.0,
+ &startpoint,
+ &color_black,
+ DIA_ALIGN_CENTRE);
g_clear_object (&font);
}
diff --git a/plug-ins/cgm/cgm.c b/plug-ins/cgm/cgm.c
index cb7600c9a..ed3ead78c 100644
--- a/plug-ins/cgm/cgm.c
+++ b/plug-ins/cgm/cgm.c
@@ -948,17 +948,17 @@ draw_beziergon (DiaRenderer *self,
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
CgmRenderer *renderer = CGM_RENDERER (self);
double x = pos->x, y = swap_y (renderer, pos->y);
- gint len, chunk;
- const gint maxfirstchunk = 255 - 2 * REALSIZE - 2 - 1;
- const gint maxappendchunk = 255 - 2 - 1;
+ int len, chunk;
+ const int maxfirstchunk = 255 - 2 * REALSIZE - 2 - 1;
+ const int maxappendchunk = 255 - 2 - 1;
/* check for empty strings */
len = strlen (text);
@@ -969,13 +969,13 @@ draw_string (DiaRenderer *self,
write_text_attributes (renderer, colour);
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
x -= dia_font_string_width (text, renderer->font,
renderer->tcurrent.font_height) / 2;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
x -= dia_font_string_width (text, renderer->font,
renderer->tcurrent.font_height);
break;
diff --git a/plug-ins/drs/dia-render-script-import.c b/plug-ins/drs/dia-render-script-import.c
index 143bbc249..2f0f9ad7e 100644
--- a/plug-ins/drs/dia-render-script-import.c
+++ b/plug-ins/drs/dia-render-script-import.c
@@ -230,22 +230,28 @@ _parse_fillstyle (xmlNodePtr node, const char *attrib)
}
-static Alignment
+static DiaAlignment
_parse_alignment (xmlNodePtr node, const char *attrib)
{
- xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
- Alignment val = ALIGN_LEFT;
+ xmlChar *str = xmlGetProp (node, (const xmlChar *) attrib);
+ DiaAlignment val = DIA_ALIGN_LEFT;
+
if (str) {
- if (strcmp ((const char *)str, "center") == 0)
- val = ALIGN_CENTER;
- else if (strcmp ((const char *)str, "right") == 0)
- val = ALIGN_RIGHT;
- else if (strcmp ((const char *)str, "left") != 0)
+ if (g_strcmp0 ((const char *) str, "center") == 0) {
+ val = DIA_ALIGN_CENTRE;
+ } else if (g_strcmp0 ((const char *) str, "right") == 0) {
+ val = DIA_ALIGN_RIGHT;
+ } else if (g_strcmp0 ((const char *) str, "left") != 0) {
g_warning ("unknown alignment: %s", str);
- xmlFree(str);
+ }
}
+
+ dia_clear_xml_string (&str);
+
return val;
}
+
+
static DiaFont *
_parse_font (xmlNodePtr node)
{
@@ -381,9 +387,9 @@ _render_object (xmlNodePtr render, DiaContext *ctx)
if (fill || stroke) {
dia_renderer_draw_rounded_rect (ir, &ul, &lr, fill, stroke, r);
}
- } else if ( xmlStrcmp (node->name, (const xmlChar *) "string") == 0) {
+ } else if (xmlStrcmp (node->name, (const xmlChar *) "string") == 0) {
Point pos = _parse_point (node, "pos");
- Alignment align = _parse_alignment (node, "alignment");
+ DiaAlignment align = _parse_alignment (node, "alignment");
xmlChar *text = xmlNodeGetContent (node);
if (text) {
dia_renderer_draw_string (ir, (const char*) text, &pos, align, fill);
diff --git a/plug-ins/drs/dia-render-script-renderer.c b/plug-ins/drs/dia-render-script-renderer.c
index cec32f05d..c49a5aee8 100644
--- a/plug-ins/drs/dia-render-script-renderer.c
+++ b/plug-ins/drs/dia-render-script-renderer.c
@@ -708,11 +708,11 @@ draw_rounded_polyline (DiaRenderer *self,
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
DrsRenderer *renderer = DRS_RENDERER (self);
xmlNodePtr node;
@@ -722,13 +722,13 @@ draw_string (DiaRenderer *self,
_node_set_point (node, "pos", pos);
_node_set_color (node, "fill", color);
switch (alignment) {
- case ALIGN_LEFT :
+ case DIA_ALIGN_LEFT:
align = "left";
break;
- case ALIGN_RIGHT :
+ case DIA_ALIGN_RIGHT:
align = "right";
break;
- case ALIGN_CENTER :
+ case DIA_ALIGN_CENTRE:
align = "center";
break;
default:
diff --git a/plug-ins/dxf/dxf-export.c b/plug-ins/dxf/dxf-export.c
index fd561f0e3..fbd3faa61 100644
--- a/plug-ins/dxf/dxf-export.c
+++ b/plug-ins/dxf/dxf-export.c
@@ -486,48 +486,72 @@ draw_ellipse(DiaRenderer *self,
fprintf(renderer->file, " 62\n%d\n", dxf_color (color));
}
+
static void
-draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
- DxfRenderer *renderer = DXF_RENDERER(self);
- gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
-
- fprintf(renderer->file, " 0\nTEXT\n");
- fprintf(renderer->file, " 8\n%s\n", renderer->layername);
- fprintf(renderer->file, " 6\n%s\n", renderer->lcurrent.style);
- fprintf(renderer->file, " 10\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", pos->x));
- fprintf(renderer->file, " 20\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", (-1)*pos->y));
- fprintf(renderer->file, " 40\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g",
renderer->tcurrent.font_height)); /* Text height */
- fprintf(renderer->file, " 50\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", 0.0)); /* Text rotation */
- switch(alignment) {
- case ALIGN_LEFT :
- fprintf(renderer->file, " 72\n%d\n", 0);
- break;
- case ALIGN_RIGHT :
- fprintf(renderer->file, " 72\n%d\n", 2);
- break;
- case ALIGN_CENTER :
+ DxfRenderer *renderer = DXF_RENDERER (self);
+ char buf[G_ASCII_DTOSTR_BUF_SIZE];
+
+ fprintf (renderer->file, " 0\nTEXT\n");
+ fprintf (renderer->file, " 8\n%s\n", renderer->layername);
+ fprintf (renderer->file, " 6\n%s\n", renderer->lcurrent.style);
+ fprintf (renderer->file,
+ " 10\n%s\n",
+ g_ascii_formatd (buf, sizeof(buf),
+ "%g",
+ pos->x));
+ fprintf (renderer->file,
+ " 20\n%s\n",
+ g_ascii_formatd (buf, sizeof(buf),
+ "%g",
+ (-1)*pos->y));
+ fprintf (renderer->file,
+ " 40\n%s\n",
+ g_ascii_formatd (buf, sizeof(buf),
+ "%g",
+ renderer->tcurrent.font_height)); /* Text height */
+ fprintf (renderer->file,
+ " 50\n%s\n",
+ g_ascii_formatd (buf, sizeof(buf),
+ "%g",
+ 0.0)); /* Text rotation */
+ switch (alignment) {
+ case DIA_ALIGN_LEFT:
+ fprintf (renderer->file, " 72\n%d\n", 0);
+ break;
+ case DIA_ALIGN_RIGHT:
+ fprintf (renderer->file, " 72\n%d\n", 2);
+ break;
+ case DIA_ALIGN_CENTRE:
default:
- fprintf(renderer->file, " 72\n%d\n", 1);
- break;
- }
- fprintf(renderer->file, " 7\n%s\n", "0"); /* Text style */
- fprintf(renderer->file, " 1\n%s\n", text);
- fprintf(renderer->file, " 39\n%d\n", (int)(MAGIC_THICKNESS_FACTOR*renderer->lcurrent.width)); /*
Thickness */
- fprintf(renderer->file, " 62\n%d\n", dxf_color(colour));
+ fprintf (renderer->file, " 72\n%d\n", 1);
+ break;
+ }
+
+ fprintf (renderer->file, " 7\n%s\n", "0"); /* Text style */
+ fprintf (renderer->file, " 1\n%s\n", text);
+ fprintf (renderer->file,
+ " 39\n%d\n",
+ (int) (MAGIC_THICKNESS_FACTOR * renderer->lcurrent.width)); /* Thickness */
+ fprintf (renderer->file, " 62\n%d\n", dxf_color(colour));
}
+
static void
-draw_image(DiaRenderer *self,
- Point *point,
- real width, real height,
- DiaImage *image)
+draw_image (DiaRenderer *self,
+ Point *point,
+ double width,
+ double height,
+ DiaImage *image)
{
}
+
static void
dxf_renderer_class_init (DxfRendererClass *klass)
{
diff --git a/plug-ins/dxf/dxf-import.c b/plug-ins/dxf/dxf-import.c
index 9d64f754a..43719995d 100644
--- a/plug-ins/dxf/dxf-import.c
+++ b/plug-ins/dxf/dxf-import.c
@@ -857,9 +857,9 @@ read_entity_text_dxf (FILE *filedxf, DxfData *data, DiagramData *dia)
/* text data */
Point location = {0, 0};
- real height = text_scale * coord_scale * measure_scale;
- real y_offset = 0;
- Alignment textalignment = ALIGN_LEFT;
+ double height = text_scale * coord_scale * measure_scale;
+ double y_offset = 0;
+ DiaAlignment textalignment = DIA_ALIGN_LEFT;
char *textvalue = NULL, *textp;
DiaObjectType *otype = object_get_type("Standard - Text");
@@ -924,13 +924,13 @@ read_entity_text_dxf (FILE *filedxf, DxfData *data, DiagramData *dia)
case 72:
switch (atoi (data->value)) {
case 0:
- textalignment = ALIGN_LEFT;
+ textalignment = DIA_ALIGN_LEFT;
break;
case 1:
- textalignment = ALIGN_CENTER;
+ textalignment = DIA_ALIGN_CENTRE;
break;
case 2:
- textalignment = ALIGN_RIGHT;
+ textalignment = DIA_ALIGN_RIGHT;
break;
case 3:
/* FIXME - it's not clear what these are */
diff --git a/plug-ins/hpgl/hpgl.c b/plug-ins/hpgl/hpgl.c
index de6673c20..cbd9908b2 100644
--- a/plug-ins/hpgl/hpgl.c
+++ b/plug-ins/hpgl/hpgl.c
@@ -528,11 +528,11 @@ draw_ellipse(DiaRenderer *object,
static void
-draw_string (DiaRenderer *object,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *object,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
real width, height;
@@ -545,13 +545,13 @@ draw_string (DiaRenderer *object,
hpgl_scale (renderer, pos->x), hpgl_scale (renderer, -pos->y));
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
fprintf (renderer->file, "LO1;\n");
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
fprintf (renderer->file, "LO4;\n");
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
fprintf (renderer->file, "LO7;\n");
break;
default:
diff --git a/plug-ins/metapost/render_metapost.c b/plug-ins/metapost/render_metapost.c
index 3d67d0c53..a76633b12 100644
--- a/plug-ins/metapost/render_metapost.c
+++ b/plug-ins/metapost/render_metapost.c
@@ -785,19 +785,19 @@ draw_beziergon (DiaRenderer *self,
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
MetapostRenderer *renderer = METAPOST_RENDERER (self);
- gchar height_buf[DTOSTR_BUF_SIZE];
- gchar px_buf[DTOSTR_BUF_SIZE];
- gchar py_buf[DTOSTR_BUF_SIZE];
- gchar red_buf[DTOSTR_BUF_SIZE];
- gchar green_buf[DTOSTR_BUF_SIZE];
- gchar blue_buf[DTOSTR_BUF_SIZE];
+ char height_buf[DTOSTR_BUF_SIZE];
+ char px_buf[DTOSTR_BUF_SIZE];
+ char py_buf[DTOSTR_BUF_SIZE];
+ char red_buf[DTOSTR_BUF_SIZE];
+ char green_buf[DTOSTR_BUF_SIZE];
+ char blue_buf[DTOSTR_BUF_SIZE];
set_line_color (renderer, color);
@@ -805,13 +805,13 @@ draw_string (DiaRenderer *self,
* at top of MetaPost file (see export_metapost) to correctly
* align text. See bug # 332554 */
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
fprintf (renderer->file," draw");
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
fprintf (renderer->file," draw hcentered");
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
fprintf (renderer->file," draw rjust");
break;
default:
diff --git a/plug-ins/pdf/pdf-import.cpp b/plug-ins/pdf/pdf-import.cpp
index 0676348ca..d3977c33f 100644
--- a/plug-ins/pdf/pdf-import.cpp
+++ b/plug-ins/pdf/pdf-import.cpp
@@ -363,9 +363,9 @@ public :
// state->getFont()->getWMode()
#if 0
if (shift == 0) //FIXME:
- this->alignment = ALIGN_LEFT;
+ this->alignment = DIA_ALIGN_LEFT;
else
- this->alignment = ALIGN_CENTER;
+ this->alignment = DIA_ALIGN_CENTRE;
#endif
}
void saveState(GfxState *state)
@@ -452,7 +452,7 @@ private :
DiaLineCaps line_caps;
Color fill_color;
- Alignment alignment;
+ DiaAlignment alignment;
// multiply with to get from PDF to Dia
double scale;
@@ -491,7 +491,7 @@ DiaOutputDev::DiaOutputDev (DiagramData *_dia, int _n) :
line_join(DIA_LINE_JOIN_MITER),
line_caps(DIA_LINE_CAPS_PROJECTING),
fill_color(attributes_get_background ()),
- alignment(ALIGN_LEFT),
+ alignment(DIA_ALIGN_LEFT),
scale(2.54/72.0),
objects(NULL),
pageNum(0),
diff --git a/plug-ins/pgf/render_pgf.c b/plug-ins/pgf/render_pgf.c
index 8ccee50d5..01d063055 100644
--- a/plug-ins/pgf/render_pgf.c
+++ b/plug-ins/pgf/render_pgf.c
@@ -124,10 +124,11 @@ static void draw_beziergon(DiaRenderer *self,
int numpoints,
Color *fill,
Color *stroke);
-static void draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *color);
+static void draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color);
static void draw_image(DiaRenderer *self,
Point *point,
real width, real height,
@@ -1289,31 +1290,31 @@ tex_escape_string(const gchar *src, DiaContext *ctx)
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
- PgfRenderer *renderer = PGF_RENDERER(self);
- gchar *escaped = tex_escape_string (text, renderer->ctx);
- gchar px_buf[DTOSTR_BUF_SIZE];
- gchar py_buf[DTOSTR_BUF_SIZE];
+ PgfRenderer *renderer = PGF_RENDERER (self);
+ char *escaped = tex_escape_string (text, renderer->ctx);
+ char px_buf[DTOSTR_BUF_SIZE];
+ char py_buf[DTOSTR_BUF_SIZE];
set_line_color (renderer,color);
set_fill_color (renderer,color);
fprintf (renderer->file,"\\node");
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
fprintf (renderer->file,
"[anchor=base west,inner sep=0pt,outer sep=0pt,color=dialinecolor]");
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
fprintf (renderer->file,
"[anchor=base,inner sep=0pt, outer sep=0pt,color=dialinecolor]");
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
fprintf (renderer->file,
"[anchor=base east,inner sep=0pt, outer sep=0pt,color=dialinecolor]");
break;
diff --git a/plug-ins/postscript/diapsrenderer.c b/plug-ins/postscript/diapsrenderer.c
index 8e23710cb..613aee8a3 100644
--- a/plug-ins/postscript/diapsrenderer.c
+++ b/plug-ins/postscript/diapsrenderer.c
@@ -622,24 +622,24 @@ ps_convert_string (const char *text, DiaContext *ctx)
static void
put_text_alignment (DiaPsRenderer *renderer,
- Alignment alignment,
+ DiaAlignment alignment,
Point *pos)
{
- gchar px_buf[DTOSTR_BUF_SIZE];
- gchar py_buf[DTOSTR_BUF_SIZE];
+ char px_buf[DTOSTR_BUF_SIZE];
+ char py_buf[DTOSTR_BUF_SIZE];
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
fprintf (renderer->file, "%s %s m\n",
psrenderer_dtostr (px_buf, pos->x),
psrenderer_dtostr (py_buf, pos->y) );
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
fprintf (renderer->file, "dup sw 2 div %s ex sub %s m\n",
psrenderer_dtostr (px_buf, pos->x),
psrenderer_dtostr (py_buf, pos->y) );
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
fprintf (renderer->file, "dup sw %s ex sub %s m\n",
psrenderer_dtostr (px_buf, pos->x),
psrenderer_dtostr (py_buf, pos->y) );
@@ -651,17 +651,19 @@ put_text_alignment (DiaPsRenderer *renderer,
static void
-draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
- DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+ DiaPsRenderer *renderer = DIA_PS_RENDERER (self);
Point pos_adj;
- gchar *buffer;
+ char *buffer;
- if (1 > strlen(text))
+ if (1 > strlen (text)) {
return;
+ }
lazy_setcolor(renderer,color);
diff --git a/plug-ins/pstricks/render_pstricks.c b/plug-ins/pstricks/render_pstricks.c
index da006df85..13c216ad2 100644
--- a/plug-ins/pstricks/render_pstricks.c
+++ b/plug-ins/pstricks/render_pstricks.c
@@ -113,10 +113,11 @@ static void draw_beziergon(DiaRenderer *self,
int numpoints,
Color *fill,
Color *stroke);
-static void draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *color);
+static void draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color);
static void draw_image(DiaRenderer *self,
Point *point,
real width, real height,
@@ -806,16 +807,16 @@ tex_escape_string(const gchar *src, DiaContext *ctx)
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
- PstricksRenderer *renderer = PSTRICKS_RENDERER(self);
- gchar *escaped = NULL;
- gchar px_buf[DTOSTR_BUF_SIZE];
- gchar py_buf[DTOSTR_BUF_SIZE];
+ PstricksRenderer *renderer = PSTRICKS_RENDERER (self);
+ char *escaped = NULL;
+ char px_buf[DTOSTR_BUF_SIZE];
+ char py_buf[DTOSTR_BUF_SIZE];
/* only escape the string if it is not starting with \tex */
if (strncmp (text, "\\tex", 4) != 0)
@@ -825,12 +826,12 @@ draw_string (DiaRenderer *self,
fprintf (renderer->file,"\\rput");
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
fprintf(renderer->file,"[l]");
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
fprintf(renderer->file,"[r]");
break;
default:
diff --git a/plug-ins/python/pydia-render.c b/plug-ins/python/pydia-render.c
index 37ae853a1..e9a75205c 100644
--- a/plug-ins/python/pydia-render.c
+++ b/plug-ins/python/pydia-render.c
@@ -1072,7 +1072,7 @@ draw_beziergon (DiaRenderer *renderer,
* @renderer: the #DiaRenderer
* @text: the string to draw
* @pos: #Point where to draw @text
- * @alignment: the @text #Alignment
+ * @alignment: the @text #DiaAlignment
* @colour: the #Color of @text
*
* Draw string
@@ -1081,20 +1081,20 @@ draw_beziergon (DiaRenderer *renderer,
* will be generated when called.
*/
static void
-draw_string (DiaRenderer *renderer,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *renderer,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
PyObject *func, *res, *arg, *self = PYDIA_RENDERER (renderer);
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
break;
default:
break;
diff --git a/plug-ins/svg/render_svg.c b/plug-ins/svg/render_svg.c
index 261a8a66e..176247d47 100644
--- a/plug-ins/svg/render_svg.c
+++ b/plug-ins/svg/render_svg.c
@@ -108,12 +108,16 @@ static void draw_layer (DiaRenderer *self,
static void draw_object (DiaRenderer *renderer,
DiaObject *object,
DiaMatrix *matrix);
-static void draw_string (DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *colour);
-static void draw_text_line (DiaRenderer *self, TextLine *text_line,
- Point *pos, Alignment alignment, Color *colour);
+static void draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour);
+static void draw_text_line (DiaRenderer *self,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour);
static void draw_text (DiaRenderer *self, Text *text);
static void draw_rotated_text (DiaRenderer *self, Text *text, Point *center, real angle);
static void draw_rotated_image (DiaRenderer *self, Point *point,
@@ -416,7 +420,7 @@ node_set_text_style (xmlNodePtr node,
DiaSvgRenderer *renderer,
DiaFont *font,
double font_height,
- Alignment alignment,
+ DiaAlignment alignment,
Color *colour)
{
double saved_width;
@@ -440,13 +444,13 @@ node_set_text_style (xmlNodePtr node,
* 'right' for those.
*/
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
g_string_append (style, ";text-anchor:start");
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
g_string_append (style, ";text-anchor:middle");
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
g_string_append (style, ";text-anchor:end");
break;
default:
@@ -501,11 +505,11 @@ _adjust_space_preserve (xmlNodePtr node,
* \memberof _SvgRenderer
*/
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
xmlNodePtr node;
@@ -530,19 +534,21 @@ draw_string (DiaRenderer *self,
}
-/*!
- * \brief Support rendering of the _TextLine object
- * \memberof _SvgRenderer
+/*
+ * Support rendering of the #TextLine object
*/
static void
-draw_text_line(DiaRenderer *self, TextLine *text_line,
- Point *pos, Alignment alignment, Color *colour)
+draw_text_line (DiaRenderer *self,
+ TextLine *text_line,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
xmlNodePtr node;
- DiaFont *font = text_line_get_font(text_line); /* no reference? */
- real font_height = text_line_get_height(text_line);
- gchar d_buf[G_ASCII_DTOSTR_BUF_SIZE];
+ DiaFont *font = text_line_get_font (text_line); /* no reference? */
+ double font_height = text_line_get_height (text_line);
+ char d_buf[G_ASCII_DTOSTR_BUF_SIZE];
node = xmlNewChild(renderer->root, renderer->svg_name_space, (const xmlChar *)"text",
(xmlChar *) text_line_get_string(text_line));
diff --git a/plug-ins/vdx/vdx-export.c b/plug-ins/vdx/vdx-export.c
index 84e07d176..e22869e3c 100644
--- a/plug-ins/vdx/vdx-export.c
+++ b/plug-ins/vdx/vdx-export.c
@@ -1240,22 +1240,24 @@ draw_ellipse (DiaRenderer *self,
g_slist_free(Shape.any.children);
}
+
/** Render a Dia string
* @param self a renderer
* @param text the string
* @param pos start (or centre etc.)
* @param alignment alignment
* @param color line colour
- * @todo Alignment, colour
+ * @todo DiaAlignment, colour
* @bug Bounding box incorrect
*/
-
-static void draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *color)
+static void
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
- VDXRenderer *renderer = VDX_RENDERER(self);
+ VDXRenderer *renderer = VDX_RENDERER (self);
Point a;
struct vdx_Shape Shape;
struct vdx_XForm XForm;
@@ -1303,13 +1305,13 @@ static void draw_string(DiaRenderer *self,
text_width *= 1.2;
a.y += dia_font_descent(text, renderer->font, renderer->fontheight);
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
/* nothing to do this appears to be default */
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
a.x -= text_width / 2.0;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
a.x -= text_width;
break;
default:
diff --git a/plug-ins/vdx/vdx-import.c b/plug-ins/vdx/vdx-import.c
index 5425aa4a3..9078a7898 100644
--- a/plug-ins/vdx/vdx-import.c
+++ b/plug-ins/vdx/vdx-import.c
@@ -2223,7 +2223,7 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm,
GPtrArray *props;
TextProperty *tprop;
Valign vert_align;
- Alignment alignment;
+ DiaAlignment alignment;
EnumProperty *eprop = 0;
struct vdx_FontEntry FontEntry;
struct vdx_FaceName FaceName;
@@ -2243,17 +2243,17 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm,
p.x = 0; p.y = 0;
/* Setup position for horizontal alignment */
- alignment = ALIGN_LEFT;
- if (Para && Para->HorzAlign == 1)
- {
- alignment = ALIGN_CENTER;
- p.x += XForm->Width/2.0;
+ alignment = DIA_ALIGN_LEFT;
+ if (Para && Para->HorzAlign == 1) {
+ alignment = DIA_ALIGN_CENTRE;
+ p.x += XForm->Width / 2.0;
}
- if (Para && Para->HorzAlign == 2)
- {
- alignment = ALIGN_RIGHT;
- p.x += XForm->Width;
+
+ if (Para && Para->HorzAlign == 2) {
+ alignment = DIA_ALIGN_RIGHT;
+ p.x += XForm->Width;
}
+
/* And for vertical */
vert_align = VALIGN_TOP;
if (TextBlock && TextBlock->VerticalAlign == 0)
diff --git a/plug-ins/wmf/wmf.cpp b/plug-ins/wmf/wmf.cpp
index 45d179ee6..e35880046 100644
--- a/plug-ins/wmf/wmf.cpp
+++ b/plug-ins/wmf/wmf.cpp
@@ -1015,39 +1015,42 @@ draw_beziergon (DiaRenderer *self,
}
#endif
+
static void
-draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
- WmfRenderer *renderer = WMF_RENDERER (self);
- int len;
- W32::HGDIOBJ hOld;
- W32::COLORREF rgb = W32COLOR(colour);
+ WmfRenderer *renderer = WMF_RENDERER (self);
+ int len;
+ W32::HGDIOBJ hOld;
+ W32::COLORREF rgb = W32COLOR (colour);
+
+ DIAG_NOTE (renderer, "draw_string %f,%f %s\n", pos->x, pos->y, text);
- DIAG_NOTE(renderer, "draw_string %f,%f %s\n",
- pos->x, pos->y, text);
-
- W32::SetTextColor(renderer->hFileDC, rgb);
-
- switch (alignment) {
- case ALIGN_LEFT:
- W32::SetTextAlign(renderer->hFileDC, TA_LEFT+TA_BASELINE);
- break;
- case ALIGN_CENTER:
- W32::SetTextAlign(renderer->hFileDC, TA_CENTER+TA_BASELINE);
- break;
- case ALIGN_RIGHT:
- W32::SetTextAlign(renderer->hFileDC, TA_RIGHT+TA_BASELINE);
- break;
+ W32::SetTextColor (renderer->hFileDC, rgb);
+
+ switch (alignment) {
+ case DIA_ALIGN_LEFT:
+ W32::SetTextAlign (renderer->hFileDC, TA_LEFT+TA_BASELINE);
+ break;
+ case DIA_ALIGN_CENTRE:
+ W32::SetTextAlign (renderer->hFileDC, TA_CENTER+TA_BASELINE);
+ break;
+ case DIA_ALIGN_RIGHT:
+ W32::SetTextAlign (renderer->hFileDC, TA_RIGHT+TA_BASELINE);
+ break;
}
+
/* work out size of first chunk of text */
- len = strlen(text);
- if (!len)
- return; /* nothing to do */
+ len = strlen (text);
+ if (!len) {
+ return; /* nothing to do */
+ }
- hOld = W32::SelectObject(renderer->hFileDC, renderer->hFont);
+ hOld = W32::SelectObject (renderer->hFileDC, renderer->hFont);
{
// one way to go, but see below ...
char* scp = NULL;
diff --git a/plug-ins/wpg/wpg-import.c b/plug-ins/wpg/wpg-import.c
index 938fe9568..e278457ef 100644
--- a/plug-ins/wpg/wpg-import.c
+++ b/plug-ins/wpg/wpg-import.c
@@ -59,7 +59,7 @@ struct _WpgImportRenderer {
Color stroke;
Color fill;
Color text_color;
- Alignment text_align;
+ DiaAlignment text_align;
};
typedef struct _WpgImportRendererClass WpgImportRendererClass;
@@ -471,8 +471,9 @@ _do_textstyle (WpgImportRenderer *ren, WPGTextStyle *ts)
ren->text_color.blue = c.b / 255.0;
ren->text_color.alpha = 1.0;
- ren->text_align = ts->XAlign == 0 ? ALIGN_LEFT :
- ts->XAlign == 1 ? ALIGN_CENTER : ALIGN_RIGHT;
+ ren->text_align = ts->XAlign == 0 ?
+ DIA_ALIGN_LEFT : ts->XAlign == 1 ?
+ DIA_ALIGN_CENTRE : DIA_ALIGN_RIGHT;
/* select font */
height = ts->Height / WPU_PER_DCM;
if (ts->Font == 0x0DF0)
diff --git a/plug-ins/wpg/wpg.c b/plug-ins/wpg/wpg.c
index 048326965..b65722f6d 100644
--- a/plug-ins/wpg/wpg.c
+++ b/plug-ins/wpg/wpg.c
@@ -817,11 +817,14 @@ draw_beziergon (DiaRenderer *self,
if (stroke) /* XXX: still not closing the path */
draw_bezier (self, points, numpoints, stroke);
}
+
+
static void
-draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *colour)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *colour)
{
WpgRenderer *renderer = WPG_RENDERER (self);
gint16 len;
@@ -837,13 +840,13 @@ draw_string(DiaRenderer *self,
renderer->TextStyle.YAlign = 3; /* bottom ??? */
switch (alignment) {
- case ALIGN_LEFT:
+ case DIA_ALIGN_LEFT:
renderer->TextStyle.XAlign = 0;
break;
- case ALIGN_CENTER:
+ case DIA_ALIGN_CENTRE:
renderer->TextStyle.XAlign = 1;
break;
- case ALIGN_RIGHT:
+ case DIA_ALIGN_RIGHT:
renderer->TextStyle.XAlign = 2;
break;
default:
diff --git a/plug-ins/xfig/xfig-export.c b/plug-ins/xfig/xfig-export.c
index 6b33416bc..46c93373d 100644
--- a/plug-ins/xfig/xfig-export.c
+++ b/plug-ins/xfig/xfig-export.c
@@ -1103,14 +1103,14 @@ draw_beziergon (DiaRenderer *self,
static void
-draw_string (DiaRenderer *self,
- const char *text,
- Point *pos,
- Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ DiaAlignment alignment,
+ Color *color)
{
guchar *figtext = NULL;
- DiaXfigRenderer *renderer = DIA_XFIG_RENDERER(self);
+ DiaXfigRenderer *renderer = DIA_XFIG_RENDERER (self);
char d_buf[DTOSTR_BUF_SIZE];
if (renderer->color_pass) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]