[dia] warnings: fix some enum warnings
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] warnings: fix some enum warnings
- Date: Sat, 30 Nov 2019 16:20:52 +0000 (UTC)
commit 54008afb8eed43c7b5abba240e15c07ef33e5cf1
Author: Zander Brown <zbrown gnome org>
Date: Sat Nov 30 15:53:05 2019 +0000
warnings: fix some enum warnings
plug-ins/pstricks/render_pstricks.c | 238 ++++++++++++++++++++----------------
plug-ins/wpg/wpg-import.c | 170 +++++++++++++-------------
plug-ins/wpg/wpg.c | 68 ++++++-----
plug-ins/xfig/xfig-import.c | 88 ++++++-------
4 files changed, 299 insertions(+), 265 deletions(-)
---
diff --git a/plug-ins/pstricks/render_pstricks.c b/plug-ins/pstricks/render_pstricks.c
index 9f381311..d41bf08e 100644
--- a/plug-ins/pstricks/render_pstricks.c
+++ b/plug-ins/pstricks/render_pstricks.c
@@ -394,38 +394,41 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length)
/* dot = 20% of len - for some reason not the usual 10% */
dot_length = dash_length * 0.2;
- switch(mode) {
+ switch (mode) {
case LINESTYLE_DEFAULT:
case LINESTYLE_SOLID:
- fprintf(renderer->file, "\\psset{linestyle=solid}\n");
- break;
+ fprintf(renderer->file, "\\psset{linestyle=solid}\n");
+ break;
case LINESTYLE_DASHED:
- pstricks_dtostr(dash_length_buf, dash_length);
- fprintf(renderer->file, "\\psset{linestyle=dashed,dash=%s %s}\n",
- dash_length_buf, dash_length_buf);
- break;
+ pstricks_dtostr(dash_length_buf, dash_length);
+ fprintf (renderer->file, "\\psset{linestyle=dashed,dash=%s %s}\n",
+ dash_length_buf, dash_length_buf);
+ break;
case LINESTYLE_DASH_DOT:
- hole_width = (dash_length - dot_length) / 2.0;
- pstricks_dtostr(hole_width_buf,hole_width);
- pstricks_dtostr(dot_length_buf, dot_length);
- pstricks_dtostr(dash_length_buf, dash_length);
- fprintf(renderer->file, "\\psset{linestyle=dashed,dash=%s %s %s %s}\n",
- dash_length_buf, hole_width_buf, dot_length_buf, hole_width_buf );
- break;
+ hole_width = (dash_length - dot_length) / 2.0;
+ pstricks_dtostr(hole_width_buf,hole_width);
+ pstricks_dtostr(dot_length_buf, dot_length);
+ pstricks_dtostr(dash_length_buf, dash_length);
+ fprintf(renderer->file, "\\psset{linestyle=dashed,dash=%s %s %s %s}\n",
+ dash_length_buf, hole_width_buf, dot_length_buf, hole_width_buf );
+ break;
case LINESTYLE_DASH_DOT_DOT:
- hole_width = (dash_length - 2.0*dot_length) / 3.0;
- pstricks_dtostr(hole_width_buf,hole_width);
- pstricks_dtostr(dot_length_buf,dot_length);
- pstricks_dtostr(dash_length_buf, dash_length);
- fprintf(renderer->file, "\\psset{linestyle=dashed,dash=%s %s %s %s %s %s}\n",
- dash_length_buf, hole_width_buf, dot_length_buf, hole_width_buf,
- dot_length_buf, hole_width_buf );
- break;
+ hole_width = (dash_length - 2.0*dot_length) / 3.0;
+ pstricks_dtostr(hole_width_buf,hole_width);
+ pstricks_dtostr(dot_length_buf,dot_length);
+ pstricks_dtostr(dash_length_buf, dash_length);
+ fprintf(renderer->file, "\\psset{linestyle=dashed,dash=%s %s %s %s %s %s}\n",
+ dash_length_buf, hole_width_buf, dot_length_buf, hole_width_buf,
+ dot_length_buf, hole_width_buf );
+ break;
case LINESTYLE_DOTTED:
- pstricks_dtostr(dot_length_buf, dot_length);
- fprintf(renderer->file, "\\psset{linestyle=dotted,dotsep=%s}\n", dot_length_buf);
- break;
- }
+ pstricks_dtostr(dot_length_buf, dot_length);
+ fprintf(renderer->file, "\\psset{linestyle=dotted,dotsep=%s}\n", dot_length_buf);
+ break;
+ default:
+ g_warning ("Unknown mode %i", mode);
+ break;
+ }
}
static void
@@ -647,70 +650,82 @@ draw_ellipse(DiaRenderer *self,
pstricks_ellipse(renderer,center,width,height,stroke,FALSE);
}
+
static void
-pstricks_bezier(PstricksRenderer *renderer,
- BezPoint *points,
- gint numpoints,
- Color *fill,
- Color *stroke,
- gboolean closed)
+pstricks_bezier (PstricksRenderer *renderer,
+ BezPoint *points,
+ gint numpoints,
+ Color *fill,
+ Color *stroke,
+ gboolean closed)
{
- gint i;
- gchar p1x_buf[DTOSTR_BUF_SIZE];
- gchar p1y_buf[DTOSTR_BUF_SIZE];
- gchar p2x_buf[DTOSTR_BUF_SIZE];
- gchar p2y_buf[DTOSTR_BUF_SIZE];
- gchar p3x_buf[DTOSTR_BUF_SIZE];
- gchar p3y_buf[DTOSTR_BUF_SIZE];
+ gint i;
+ gchar p1x_buf[DTOSTR_BUF_SIZE];
+ gchar p1y_buf[DTOSTR_BUF_SIZE];
+ gchar p2x_buf[DTOSTR_BUF_SIZE];
+ gchar p2y_buf[DTOSTR_BUF_SIZE];
+ gchar p3x_buf[DTOSTR_BUF_SIZE];
+ gchar p3y_buf[DTOSTR_BUF_SIZE];
+
+ if (fill) {
+ set_fill_color (renderer,fill);
+ }
- if (fill)
- set_fill_color(renderer,fill);
- if (stroke)
- set_line_color(renderer,stroke);
-
- fprintf(renderer->file, "\\pscustom{\n");
-
- if (points[0].type != BEZ_MOVE_TO)
- g_warning("first BezPoint must be a BEZ_MOVE_TO");
-
- fprintf(renderer->file, "\\newpath\n\\moveto(%s,%s)\n",
- pstricks_dtostr(p1x_buf,points[0].p1.x),
- pstricks_dtostr(p1y_buf,points[0].p1.y) );
-
- for (i = 1; i < numpoints; i++)
- switch (points[i].type) {
- case BEZ_MOVE_TO:
- fprintf(renderer->file, "\\moveto(%s,%s)\n",
- pstricks_dtostr(p1x_buf,points[i].p1.x),
- pstricks_dtostr(p1y_buf,points[i].p1.y) );
- break;
- case BEZ_LINE_TO:
- fprintf(renderer->file, "\\lineto(%s,%s)\n",
- pstricks_dtostr(p1x_buf,points[i].p1.x),
- pstricks_dtostr(p1y_buf,points[i].p1.y) );
- break;
- case BEZ_CURVE_TO:
- fprintf(renderer->file, "\\curveto(%s,%s)(%s,%s)(%s,%s)\n",
- pstricks_dtostr(p1x_buf,points[i].p1.x),
- pstricks_dtostr(p1y_buf,points[i].p1.y),
- pstricks_dtostr(p2x_buf,points[i].p2.x),
- pstricks_dtostr(p2y_buf,points[i].p2.y),
- pstricks_dtostr(p3x_buf,points[i].p3.x),
- pstricks_dtostr(p3y_buf,points[i].p3.y) );
- break;
- }
+ if (stroke) {
+ set_line_color (renderer,stroke);
+ }
- if (closed)
- fprintf(renderer->file, "\\closepath\n");
+ fprintf(renderer->file, "\\pscustom{\n");
- if (fill && stroke)
- fprintf(renderer->file, "\\fill[fillstyle=eofill,fillcolor=diafillcolor,linecolor=dialinecolor]}\n");
- else if (fill)
- fprintf(renderer->file, "\\fill[fillstyle=eofill,fillcolor=diafillcolor,linecolor=diafillcolor]}\n");
- else
- fprintf(renderer->file, "\\stroke}\n");
+ if (points[0].type != BEZ_MOVE_TO) {
+ g_warning("first BezPoint must be a BEZ_MOVE_TO");
+ }
+
+ fprintf (renderer->file, "\\newpath\n\\moveto(%s,%s)\n",
+ pstricks_dtostr (p1x_buf, points[0].p1.x),
+ pstricks_dtostr (p1y_buf, points[0].p1.y) );
+
+ for (i = 1; i < numpoints; i++) {
+ switch (points[i].type) {
+ case BEZ_MOVE_TO:
+ fprintf (renderer->file, "\\moveto(%s,%s)\n",
+ pstricks_dtostr (p1x_buf,points[i].p1.x),
+ pstricks_dtostr (p1y_buf,points[i].p1.y) );
+ break;
+ case BEZ_LINE_TO:
+ fprintf (renderer->file, "\\lineto(%s,%s)\n",
+ pstricks_dtostr (p1x_buf, points[i].p1.x),
+ pstricks_dtostr (p1y_buf, points[i].p1.y) );
+ break;
+ case BEZ_CURVE_TO:
+ fprintf (renderer->file, "\\curveto(%s,%s)(%s,%s)(%s,%s)\n",
+ pstricks_dtostr (p1x_buf, points[i].p1.x),
+ pstricks_dtostr (p1y_buf, points[i].p1.y),
+ pstricks_dtostr (p2x_buf, points[i].p2.x),
+ pstricks_dtostr (p2y_buf, points[i].p2.y),
+ pstricks_dtostr (p3x_buf, points[i].p3.x),
+ pstricks_dtostr (p3y_buf, points[i].p3.y) );
+ break;
+ default:
+ g_warning ("Unknown type %i", points[i].type);
+ break;
+ }
+ }
+
+ if (closed) {
+ fprintf(renderer->file, "\\closepath\n");
+ }
+
+ if (fill && stroke) {
+ fprintf (renderer->file, "\\fill[fillstyle=eofill,fillcolor=diafillcolor,linecolor=dialinecolor]}\n");
+ } else if (fill) {
+ fprintf (renderer->file, "\\fill[fillstyle=eofill,fillcolor=diafillcolor,linecolor=diafillcolor]}\n");
+ } else {
+ fprintf (renderer->file, "\\stroke}\n");
+ }
}
+
static void
draw_bezier(DiaRenderer *self,
BezPoint *points,
@@ -782,41 +797,48 @@ tex_escape_string(const gchar *src, DiaContext *ctx)
return p;
}
+
static void
-draw_string(DiaRenderer *self,
- const char *text,
- Point *pos, Alignment alignment,
- Color *color)
+draw_string (DiaRenderer *self,
+ const char *text,
+ Point *pos,
+ Alignment 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);
+ gchar *escaped = NULL;
+ gchar px_buf[DTOSTR_BUF_SIZE];
+ gchar py_buf[DTOSTR_BUF_SIZE];
- /* only escape the string if it is not starting with \tex */
- if (strncmp (text, "\\tex", 4) != 0)
- escaped = tex_escape_string(text, renderer->ctx);
+ /* only escape the string if it is not starting with \tex */
+ if (strncmp (text, "\\tex", 4) != 0)
+ escaped = tex_escape_string (text, renderer->ctx);
- set_fill_color(renderer,color);
+ set_fill_color (renderer,color);
- fprintf(renderer->file,"\\rput");
- switch (alignment) {
+ fprintf (renderer->file,"\\rput");
+ switch (alignment) {
case ALIGN_LEFT:
- fprintf(renderer->file,"[l]");
- break;
+ fprintf(renderer->file,"[l]");
+ break;
case ALIGN_CENTER:
- break;
+ break;
case ALIGN_RIGHT:
- fprintf(renderer->file,"[r]");
- break;
- }
- fprintf(renderer->file,"(%s,%s){\\psscalebox{1 -1}{%s}}\n",
- pstricks_dtostr(px_buf,pos->x),
- pstricks_dtostr(py_buf,pos->y),
- escaped ? escaped : text);
- g_free(escaped);
+ fprintf(renderer->file,"[r]");
+ break;
+ default:
+ g_warning ("Unknown alignment %i", alignment);
+ break;
+ }
+ fprintf (renderer->file,
+ "(%s,%s){\\psscalebox{1 -1}{%s}}\n",
+ pstricks_dtostr (px_buf,pos->x),
+ pstricks_dtostr (py_buf,pos->y),
+ escaped ? escaped : text);
+ g_free (escaped);
}
+
static void
draw_image(DiaRenderer *self,
Point *point,
diff --git a/plug-ins/wpg/wpg-import.c b/plug-ins/wpg/wpg-import.c
index 75105f1f..359b8aac 100644
--- a/plug-ins/wpg/wpg-import.c
+++ b/plug-ins/wpg/wpg-import.c
@@ -241,70 +241,73 @@ import_object(DiaRenderer* self, DiagramData *dia,
Point *points = NULL;
switch (type) {
- case WPG_LINE:
- iNum = 2;
- pts = (WPGPoint*)pData;
- points = _make_points (renderer, pts, iNum);
- dia_renderer_draw_line (self, &points[0], &points[1], &renderer->stroke);
- break;
- case WPG_POLYLINE:
- pInt16 = (gint16*)pData;
- iNum = pInt16[0];
- pts = (WPGPoint*)(pData + sizeof(gint16));
- points = _make_points (renderer, pts, iNum);
- dia_renderer_draw_polyline (self, points, iNum, &renderer->stroke);
- break;
- case WPG_RECTANGLE:
- points = _make_rect (renderer, (WPGPoint*)pData);
- _do_rect (renderer, points);
- break;
- case WPG_POLYGON:
- pInt16 = (gint16*)pData;
- iNum = pInt16[0];
- pts = (WPGPoint*)(pData + sizeof(gint16));
- points = _make_points (renderer, pts, iNum);
- _do_polygon (renderer, points, iNum);
- break;
- case WPG_ELLIPSE:
- {
- WPGEllipse* pEll = (WPGEllipse*)pData;
- _do_ellipse (renderer, pEll);
- }
- break;
- case WPG_POLYCURVE:
- iPre51 = *((gint32*)pData);
- pInt16 = (gint16*)pData;
- iNum = pInt16[2];
- pts = (WPGPoint*)(pData + 3*sizeof(gint16));
- dia_log_message ("WPG POLYCURVE Num pts %d Pre51 %d", iNum, iPre51);
- _do_bezier (renderer, pts, iNum);
- break;
- case WPG_FILLATTR:
- case WPG_LINEATTR:
- case WPG_COLORMAP:
- case WPG_MARKERATTR:
- case WPG_POLYMARKER:
- case WPG_TEXTSTYLE:
- case WPG_START:
- case WPG_END:
- case WPG_OUTPUTATTR:
- case WPG_STARTFIGURE:
- case WPG_STARTCHART:
- case WPG_PLANPERFECT:
- case WPG_STARTWPG2:
- case WPG_POSTSCRIPT1:
- case WPG_POSTSCRIPT2:
- /* these are no objects, silence GCC */
- break;
- case WPG_BITMAP1:
- case WPG_TEXT:
- case WPG_BITMAP2:
- /* these objects are handled directly below, silence GCC */
- break;
- case WPG_GRAPHICSTEXT2:
- case WPG_GRAPHICSTEXT3:
- /* these objects actually might get implemented some day, silence GCC */
- break;
+ case WPG_LINE:
+ iNum = 2;
+ pts = (WPGPoint*)pData;
+ points = _make_points (renderer, pts, iNum);
+ dia_renderer_draw_line (self, &points[0], &points[1], &renderer->stroke);
+ break;
+ case WPG_POLYLINE:
+ pInt16 = (gint16*)pData;
+ iNum = pInt16[0];
+ pts = (WPGPoint*)(pData + sizeof(gint16));
+ points = _make_points (renderer, pts, iNum);
+ dia_renderer_draw_polyline (self, points, iNum, &renderer->stroke);
+ break;
+ case WPG_RECTANGLE:
+ points = _make_rect (renderer, (WPGPoint*)pData);
+ _do_rect (renderer, points);
+ break;
+ case WPG_POLYGON:
+ pInt16 = (gint16*)pData;
+ iNum = pInt16[0];
+ pts = (WPGPoint*)(pData + sizeof(gint16));
+ points = _make_points (renderer, pts, iNum);
+ _do_polygon (renderer, points, iNum);
+ break;
+ case WPG_ELLIPSE:
+ {
+ WPGEllipse* pEll = (WPGEllipse*)pData;
+ _do_ellipse (renderer, pEll);
+ }
+ break;
+ case WPG_POLYCURVE:
+ iPre51 = *((gint32*)pData);
+ pInt16 = (gint16*)pData;
+ iNum = pInt16[2];
+ pts = (WPGPoint*)(pData + 3*sizeof(gint16));
+ dia_log_message ("WPG POLYCURVE Num pts %d Pre51 %d", iNum, iPre51);
+ _do_bezier (renderer, pts, iNum);
+ break;
+ case WPG_FILLATTR:
+ case WPG_LINEATTR:
+ case WPG_COLORMAP:
+ case WPG_MARKERATTR:
+ case WPG_POLYMARKER:
+ case WPG_TEXTSTYLE:
+ case WPG_START:
+ case WPG_END:
+ case WPG_OUTPUTATTR:
+ case WPG_STARTFIGURE:
+ case WPG_STARTCHART:
+ case WPG_PLANPERFECT:
+ case WPG_STARTWPG2:
+ case WPG_POSTSCRIPT1:
+ case WPG_POSTSCRIPT2:
+ /* these are no objects, silence GCC */
+ break;
+ case WPG_BITMAP1:
+ case WPG_TEXT:
+ case WPG_BITMAP2:
+ /* these objects are handled directly below, silence GCC */
+ break;
+ case WPG_GRAPHICSTEXT2:
+ case WPG_GRAPHICSTEXT3:
+ /* these objects actually might get implemented some day, silence GCC */
+ break;
+ default:
+ g_warning ("Uknown type %i", type);
+ break;
} /* switch */
g_free (points);
DIAG_NOTE(g_message("Type %d Num pts %d Size %d", type, iNum, iSize));
@@ -322,24 +325,27 @@ _make_stroke (WpgImportRenderer *ren)
ren->stroke.blue = c.b / 255.0;
ren->stroke.alpha = 1.0;
switch (ren->LineAttr.Type) {
- case WPG_LA_SOLID:
- dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_SOLID, 0.0);
- break;
- case WPG_LA_MEDIUMDASH:
- dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASHED, 0.66);
- break;
- case WPG_LA_SHORTDASH:
- dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASHED, 0.33);
- break;
- case WPG_LA_DASHDOT:
- dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASH_DOT, 1.0);
- break;
- case WPG_LA_DASHDOTDOT:
- dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASH_DOT_DOT, 1.0);
- break;
- case WPG_LA_DOTS:
- dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DOTTED, 1.0);
- break;
+ case WPG_LA_SOLID:
+ dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_SOLID, 0.0);
+ break;
+ case WPG_LA_MEDIUMDASH:
+ dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASHED, 0.66);
+ break;
+ case WPG_LA_SHORTDASH:
+ dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASHED, 0.33);
+ break;
+ case WPG_LA_DASHDOT:
+ dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASH_DOT, 1.0);
+ break;
+ case WPG_LA_DASHDOTDOT:
+ dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DASH_DOT_DOT, 1.0);
+ break;
+ case WPG_LA_DOTS:
+ dia_renderer_set_linestyle (DIA_RENDERER (ren), LINESTYLE_DOTTED, 1.0);
+ break;
+ default:
+ g_warning ("Unknown type %i", ren->LineAttr.Type);
+ break;
}
dia_renderer_set_linewidth (DIA_RENDERER (ren),
diff --git a/plug-ins/wpg/wpg.c b/plug-ins/wpg/wpg.c
index cded1a07..2b7b33c8 100644
--- a/plug-ins/wpg/wpg.c
+++ b/plug-ins/wpg/wpg.c
@@ -748,32 +748,33 @@ draw_bezier(DiaRenderer *self,
*/
pts[0].x = SCX( points[0].p1.x);
pts[0].y = SCY(-points[0].p1.y);
- for (i = 1; i < numpoints; i++)
- {
- switch (points[i].type)
- {
- case BEZ_MOVE_TO:
- case BEZ_LINE_TO:
- /* just the point */
- pts[i*3-2].x = pts[i*3-1].x = pts[i*3].x = SCX( points[i].p1.x);
- pts[i*3-2].y = pts[i*3-1].y = pts[i*3].y = SCY(-points[i].p1.y);
- break;
- case BEZ_CURVE_TO:
- /* first control point */
- pts[i*3-2].x = SCX( points[i].p1.x);
- pts[i*3-2].y = SCY(-points[i].p1.y);
- /* second control point */
- pts[i*3-1].x = SCX( points[i].p2.x);
- pts[i*3-1].y = SCY(-points[i].p2.y);
- /* this segments end point */
- pts[i*3].x = SCX( points[i].p3.x);
- pts[i*3].y = SCY(-points[i].p3.y);
- break;
+ for (i = 1; i < numpoints; i++) {
+ switch (points[i].type) {
+ case BEZ_MOVE_TO:
+ case BEZ_LINE_TO:
+ /* just the point */
+ pts[i*3-2].x = pts[i*3-1].x = pts[i*3].x = SCX( points[i].p1.x);
+ pts[i*3-2].y = pts[i*3-1].y = pts[i*3].y = SCY(-points[i].p1.y);
+ break;
+ case BEZ_CURVE_TO:
+ /* first control point */
+ pts[i*3-2].x = SCX( points[i].p1.x);
+ pts[i*3-2].y = SCY(-points[i].p1.y);
+ /* second control point */
+ pts[i*3-1].x = SCX( points[i].p2.x);
+ pts[i*3-1].y = SCY(-points[i].p2.y);
+ /* this segments end point */
+ pts[i*3].x = SCX( points[i].p3.x);
+ pts[i*3].y = SCY(-points[i].p3.y);
+ break;
+ default:
+ g_warning ("Unknown type %i", points[i].type);
+ break;
}
}
- fwrite_le(pts, sizeof(gint16), 2*(numpoints*3-2), renderer->file);
- g_free(pts);
+ fwrite_le (pts, sizeof (gint16), 2 * (numpoints*3-2), renderer->file);
+ g_free (pts);
}
static gpointer parent_class = NULL;
@@ -826,15 +827,18 @@ draw_string(DiaRenderer *self,
renderer->TextStyle.YAlign = 3; /* bottom ??? */
switch (alignment) {
- case ALIGN_LEFT:
- renderer->TextStyle.XAlign = 0;
- break;
- case ALIGN_CENTER:
- renderer->TextStyle.XAlign = 1;
- break;
- case ALIGN_RIGHT:
- renderer->TextStyle.XAlign = 2;
- break;
+ case ALIGN_LEFT:
+ renderer->TextStyle.XAlign = 0;
+ break;
+ case ALIGN_CENTER:
+ renderer->TextStyle.XAlign = 1;
+ break;
+ case ALIGN_RIGHT:
+ renderer->TextStyle.XAlign = 2;
+ break;
+ default:
+ g_warning ("Unknown alignment %i", alignment);
+ break;
}
renderer->TextStyle.Color = LookupColor(renderer, colour);
diff --git a/plug-ins/xfig/xfig-import.c b/plug-ins/xfig/xfig-import.c
index a362606a..6a64785d 100644
--- a/plug-ins/xfig/xfig-import.c
+++ b/plug-ins/xfig/xfig-import.c
@@ -174,61 +174,63 @@ fig_line_style_to_dia(int line_style, DiaContext *ctx)
}
static void
-fig_simple_properties(DiaObject *obj,
- int line_style,
- float dash_length,
- int thickness,
- int pen_color,
- int fill_color,
- int area_fill,
- DiaContext *ctx)
+fig_simple_properties (DiaObject *obj,
+ int line_style,
+ float dash_length,
+ int thickness,
+ int pen_color,
+ int fill_color,
+ int area_fill,
+ DiaContext *ctx)
{
- GPtrArray *props = prop_list_from_descs(xfig_simple_prop_descs_line,
+ GPtrArray *props = prop_list_from_descs (xfig_simple_prop_descs_line,
pdtpp_true);
- RealProperty *rprop;
- ColorProperty *cprop;
+ RealProperty *rprop;
+ ColorProperty *cprop;
- g_assert(props->len == 2);
+ g_assert(props->len == 2);
- rprop = g_ptr_array_index(props,0);
- rprop->real_data = thickness/FIG_ALT_UNIT;
+ rprop = g_ptr_array_index (props, 0);
+ rprop->real_data = thickness / FIG_ALT_UNIT;
- cprop = g_ptr_array_index(props,1);
- cprop->color_data = fig_color(pen_color, ctx);
+ cprop = g_ptr_array_index (props,1);
+ cprop->color_data = fig_color (pen_color, ctx);
- if (line_style != -1) {
- LinestyleProperty *lsprop =
- (LinestyleProperty *)make_new_prop("line_style",
- PROP_TYPE_LINESTYLE,
- PROP_FLAG_DONT_SAVE);
- lsprop->dash = dash_length/FIG_ALT_UNIT;
- lsprop->style = fig_line_style_to_dia(line_style, ctx);
+ if (line_style != -1) {
+ LinestyleProperty *lsprop =
+ (LinestyleProperty *) make_new_prop ("line_style",
+ PROP_TYPE_LINESTYLE,
+ PROP_FLAG_DONT_SAVE);
+ lsprop->dash = dash_length / FIG_ALT_UNIT;
+ lsprop->style = fig_line_style_to_dia (line_style, ctx);
- g_ptr_array_add(props,lsprop);
- }
-
- if (area_fill == -1) {
- BoolProperty *bprop =
- (BoolProperty *)make_new_prop("show_background",
- PROP_TYPE_BOOL,PROP_FLAG_DONT_SAVE);
- bprop->bool_data = FALSE;
-
- g_ptr_array_add(props,bprop);
- } else {
- ColorProperty *cprop =
- (ColorProperty *)make_new_prop("fill_colour",
- PROP_TYPE_COLOUR,
- PROP_FLAG_DONT_SAVE);
- cprop->color_data = fig_area_fill_color(area_fill, fill_color, ctx);
+ g_ptr_array_add (props, lsprop);
+ }
- g_ptr_array_add(props,cprop);
- }
+ if (area_fill == -1) {
+ BoolProperty *bprop =
+ (BoolProperty *) make_new_prop ("show_background",
+ PROP_TYPE_BOOL,
+ PROP_FLAG_DONT_SAVE);
+ bprop->bool_data = FALSE;
+
+ g_ptr_array_add (props, bprop);
+ } else {
+ ColorProperty *prop =
+ (ColorProperty *) make_new_prop ("fill_colour",
+ PROP_TYPE_COLOUR,
+ PROP_FLAG_DONT_SAVE);
+ prop->color_data = fig_area_fill_color (area_fill, fill_color, ctx);
+
+ g_ptr_array_add (props, prop);
+ }
- obj->ops->set_props(obj, props);
- prop_list_free(props);
+ dia_object_set_properties (obj, props);
+ prop_list_free (props);
}
+
static int
fig_read_n_points(FILE *file, int n, Point **points, DiaContext *ctx)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]