作図ソフト dia の改良版
リビジョン | 9c6a0d8867d4e308449c6ab74c83b57f3963630d (tree) |
---|---|
日時 | 2014-10-04 18:43:24 |
作者 | Hans Breuer <hans@breu...> |
コミッター | Hans Breuer |
[warningectomy] implicit conversion from enumeration type DiaSvgLineDefaults
Actually a design change: formerly we were relying on weak typing of enums,
i.e. assigning values from the wrong enum to e.g. to type 'LineJoin'. Now
*_DEFAULT variants are part of the main enum, e.g LineJoin and has to be
handled explicitely on the consumer level, here mostly renderers.
Removes the following warnings:
dia_svg.c:71:56: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineCaps' [-Wenum-conversion]
dia_svg.c:72:58: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineJoin' [-Wenum-conversion]
dia_svg.c:73:60: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineStyle' [-Wenum-conversion]
dia_svg.c:484:19: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineJoin' [-Wenum-conversion]
dia_svg.c:496:18: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineCaps' [-Wenum-conversion]
dia_svg.c:694:17: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineStyle' [-Wenum-conversion]
shape_info.c:121:32: warning: comparison of constant -1 with expression of type 'Alignment' is always false [-Wtautological-constant-out-of-range-compare]
shape_info.c:911:2: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineCaps' [-Wenum-conversion]
shape_info.c:911:28: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineJoin' [-Wenum-conversion]
shape_info.c:911:54: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineStyle' [-Wenum-conversion]
custom_object.c:926:26: warning: comparison of constant 'DIA_SVG_LINECAPS_DEFAULT' (20) with expression of type 'LineCaps' is always false [-Wtautological-constant-out-of-range-compare]
custom_object.c:928:39: warning: comparison of constant 'DIA_SVG_LINECAPS_DEFAULT' (20) with expression of type 'LineCaps' is always true [-Wtautological-constant-out-of-range-compare]
custom_object.c:932:26: warning: comparison of constant 'DIA_SVG_LINEJOIN_DEFAULT' (20) with expression of type 'LineJoin' is always false [-Wtautological-constant-out-of-range-compare]
custom_object.c:934:38: warning: comparison of constant 'DIA_SVG_LINEJOIN_DEFAULT' (20) with expression of type 'LineJoin' is always true [-Wtautological-constant-out-of-range-compare]
custom_object.c:938:28: warning: comparison of constant 'DIA_SVG_LINESTYLE_DEFAULT' (20) with expression of type 'LineStyle' is always false [-Wtautological-constant-out-of-range-compare]
custom_object.c:940:40: warning: comparison of constant 'DIA_SVG_LINESTYLE_DEFAULT' (20) with expression of type 'LineStyle' is always true [-Wtautological-constant-out-of-range-compare]
svg-import.c:468:25: warning: comparison of constant 'DIA_SVG_LINESTYLE_DEFAULT' (20) with expression of type 'LineStyle' is always true [-Wtautological-constant-out-of-range-compare]
svg-import.c:524:24: warning: comparison of constant 'DIA_SVG_LINEJOIN_DEFAULT' (20) with expression of type 'LineJoin' is always true [-Wtautological-constant-out-of-range-compare]
svg-import.c:530:23: warning: comparison of constant 'DIA_SVG_LINECAPS_DEFAULT' (20) with expression of type 'LineCaps' is always true [-Wtautological-constant-out-of-range-compare]
@@ -2,19 +2,22 @@ | ||
2 | 2 | #define DIA_ENUMS_H |
3 | 3 | |
4 | 4 | typedef enum { |
5 | - LINECAPS_BUTT, | |
5 | + LINECAPS_DEFAULT = -1, /* default usually butt, this is unset */ | |
6 | + LINECAPS_BUTT = 0, | |
6 | 7 | LINECAPS_ROUND, |
7 | 8 | LINECAPS_PROJECTING |
8 | 9 | } LineCaps; |
9 | 10 | |
10 | 11 | typedef enum { |
11 | - LINEJOIN_MITER, | |
12 | + LINEJOIN_DEFAULT = -1, /* default usually miter, this is unset */ | |
13 | + LINEJOIN_MITER = 0, | |
12 | 14 | LINEJOIN_ROUND, |
13 | 15 | LINEJOIN_BEVEL |
14 | 16 | } LineJoin; |
15 | 17 | |
16 | 18 | typedef enum { |
17 | - LINESTYLE_SOLID, | |
19 | + LINESTYLE_DEFAULT = -1, /* default usually solid, this is unset */ | |
20 | + LINESTYLE_SOLID = 0, | |
18 | 21 | LINESTYLE_DASHED, |
19 | 22 | LINESTYLE_DASH_DOT, |
20 | 23 | LINESTYLE_DASH_DOT_DOT, |
@@ -68,9 +68,9 @@ dia_svg_style_init(DiaSvgStyle *gs, DiaSvgStyle *parent_style) | ||
68 | 68 | */ |
69 | 69 | gs->fill = parent_style ? parent_style->fill : DIA_SVG_COLOUR_DEFAULT; |
70 | 70 | gs->fill_opacity = parent_style ? parent_style->fill_opacity : 1.0; |
71 | - gs->linecap = parent_style ? parent_style->linecap : DIA_SVG_LINECAPS_DEFAULT; | |
72 | - gs->linejoin = parent_style ? parent_style->linejoin : DIA_SVG_LINEJOIN_DEFAULT; | |
73 | - gs->linestyle = parent_style ? parent_style->linestyle : DIA_SVG_LINESTYLE_DEFAULT; | |
71 | + gs->linecap = parent_style ? parent_style->linecap : LINECAPS_DEFAULT; | |
72 | + gs->linejoin = parent_style ? parent_style->linejoin : LINEJOIN_DEFAULT; | |
73 | + gs->linestyle = parent_style ? parent_style->linestyle : LINESTYLE_DEFAULT; | |
74 | 74 | gs->font = (parent_style && parent_style->font) ? dia_font_ref(parent_style->font) : NULL; |
75 | 75 | gs->font_height = parent_style ? parent_style->font_height : 0.8; |
76 | 76 | gs->alignment = parent_style ? parent_style->alignment : ALIGN_LEFT; |
@@ -481,7 +481,7 @@ _parse_linejoin (DiaSvgStyle *s, const char *val) | ||
481 | 481 | else if (!strncmp(val, "bevel", 5)) |
482 | 482 | s->linejoin = LINEJOIN_BEVEL; |
483 | 483 | else if (!strncmp(val, "default", 7)) |
484 | - s->linejoin = DIA_SVG_LINEJOIN_DEFAULT; | |
484 | + s->linejoin = LINEJOIN_DEFAULT; | |
485 | 485 | } |
486 | 486 | static void |
487 | 487 | _parse_linecap (DiaSvgStyle *s, const char *val) |
@@ -493,7 +493,7 @@ _parse_linecap (DiaSvgStyle *s, const char *val) | ||
493 | 493 | else if (!strncmp(val, "square", 6) || !strncmp(val, "projecting", 10)) |
494 | 494 | s->linecap = LINECAPS_PROJECTING; |
495 | 495 | else if (!strncmp(val, "default", 7)) |
496 | - s->linecap = DIA_SVG_LINECAPS_DEFAULT; | |
496 | + s->linecap = LINECAPS_DEFAULT; | |
497 | 497 | } |
498 | 498 | |
499 | 499 | /*! |
@@ -691,7 +691,7 @@ dia_svg_parse_style_string (DiaSvgStyle *s, real user_scale, const gchar *str) | ||
691 | 691 | else if (!strncmp(ptr, "dotted", 6)) |
692 | 692 | s->linestyle = LINESTYLE_DOTTED; |
693 | 693 | else if (!strncmp(ptr, "default", 7)) |
694 | - s->linestyle = DIA_SVG_LINESTYLE_DEFAULT; | |
694 | + s->linestyle = LINESTYLE_DEFAULT; | |
695 | 695 | /* XXX: deal with a real pattern */ |
696 | 696 | } else if (!strncmp("stroke-dashlength:", ptr, 18)) { |
697 | 697 | ptr += 18; |
@@ -33,14 +33,6 @@ enum DiaSvgColours | ||
33 | 33 | DIA_SVG_COLOUR_DEFAULT = -5 |
34 | 34 | }; |
35 | 35 | |
36 | -/* these should be changed if they ever cause a conflict */ | |
37 | -enum DiaSvgLineDefaults | |
38 | -{ | |
39 | - DIA_SVG_LINECAPS_DEFAULT = 20, | |
40 | - DIA_SVG_LINEJOIN_DEFAULT = 20, | |
41 | - DIA_SVG_LINESTYLE_DEFAULT = 20 | |
42 | -}; | |
43 | - | |
44 | 36 | typedef struct _DiaSvgStyle DiaSvgStyle; |
45 | 37 | struct _DiaSvgStyle { |
46 | 38 | real line_width; |
@@ -312,6 +312,7 @@ set_linecaps (DiaRenderer *object, LineCaps mode) | ||
312 | 312 | renderer->cap_style = GDK_CAP_ROUND; |
313 | 313 | } else { |
314 | 314 | switch(mode) { |
315 | + case LINECAPS_DEFAULT: | |
315 | 316 | case LINECAPS_BUTT: |
316 | 317 | renderer->cap_style = GDK_CAP_BUTT; |
317 | 318 | break; |
@@ -340,6 +341,7 @@ set_linejoin (DiaRenderer *object, LineJoin mode) | ||
340 | 341 | renderer->join_style = GDK_JOIN_ROUND; |
341 | 342 | } else { |
342 | 343 | switch(mode) { |
344 | + case LINEJOIN_DEFAULT: | |
343 | 345 | case LINEJOIN_MITER: |
344 | 346 | renderer->join_style = GDK_JOIN_MITER; |
345 | 347 | break; |
@@ -374,6 +376,7 @@ dia_gdk_renderer_set_dashes(DiaGdkRenderer *renderer, int offset) | ||
374 | 376 | int hole_width; |
375 | 377 | |
376 | 378 | switch(renderer->saved_line_style) { |
379 | + case LINESTYLE_DEFAULT: | |
377 | 380 | case LINESTYLE_SOLID: |
378 | 381 | break; |
379 | 382 | case LINESTYLE_DASHED: |
@@ -435,6 +438,7 @@ set_linestyle (DiaRenderer *object, LineStyle mode, real length) | ||
435 | 438 | |
436 | 439 | renderer->saved_line_style = mode; |
437 | 440 | switch(mode) { |
441 | + case LINESTYLE_DEFAULT: | |
438 | 442 | case LINESTYLE_SOLID: |
439 | 443 | renderer->line_style = GDK_LINE_SOLID; |
440 | 444 | break; |
@@ -142,6 +142,7 @@ dia_line_preview_expose(GtkWidget *widget, GdkEventExpose *event) | ||
142 | 142 | /* increase line width */ |
143 | 143 | gdk_gc_get_values(gc, &gcvalues); |
144 | 144 | switch (line->lstyle) { |
145 | + case LINESTYLE_DEFAULT: | |
145 | 146 | case LINESTYLE_SOLID: |
146 | 147 | gdk_gc_set_line_attributes(gc, line_width, GDK_LINE_SOLID, |
147 | 148 | gcvalues.cap_style, gcvalues.join_style); |
@@ -923,21 +923,21 @@ custom_draw_element(GraphicElement* el, Custom *custom, DiaRenderer *renderer, | ||
923 | 923 | renderer_ops->set_linewidth(renderer, |
924 | 924 | custom->border_width*(*cur_line)); |
925 | 925 | } |
926 | - if ((el->any.s.linecap == DIA_SVG_LINECAPS_DEFAULT && (*cur_caps) != LINECAPS_BUTT) || | |
926 | + if ((el->any.s.linecap == LINECAPS_DEFAULT && (*cur_caps) != LINECAPS_BUTT) || | |
927 | 927 | el->any.s.linecap != (*cur_caps)) { |
928 | - (*cur_caps) = (el->any.s.linecap!=DIA_SVG_LINECAPS_DEFAULT) ? | |
928 | + (*cur_caps) = (el->any.s.linecap!=LINECAPS_DEFAULT) ? | |
929 | 929 | el->any.s.linecap : LINECAPS_BUTT; |
930 | 930 | renderer_ops->set_linecaps(renderer, (*cur_caps)); |
931 | 931 | } |
932 | - if ((el->any.s.linejoin==DIA_SVG_LINEJOIN_DEFAULT && (*cur_join)!=LINEJOIN_MITER) || | |
932 | + if ((el->any.s.linejoin==LINEJOIN_DEFAULT && (*cur_join)!=LINEJOIN_MITER) || | |
933 | 933 | el->any.s.linejoin != (*cur_join)) { |
934 | - (*cur_join) = (el->any.s.linejoin!=DIA_SVG_LINEJOIN_DEFAULT) ? | |
934 | + (*cur_join) = (el->any.s.linejoin!=LINEJOIN_DEFAULT) ? | |
935 | 935 | el->any.s.linejoin : LINEJOIN_MITER; |
936 | 936 | renderer_ops->set_linejoin(renderer, (*cur_join)); |
937 | 937 | } |
938 | - if ((el->any.s.linestyle == DIA_SVG_LINESTYLE_DEFAULT && | |
938 | + if ((el->any.s.linestyle == LINESTYLE_DEFAULT && | |
939 | 939 | (*cur_style) != custom->line_style) || el->any.s.linestyle != (*cur_style)) { |
940 | - (*cur_style) = (el->any.s.linestyle!=DIA_SVG_LINESTYLE_DEFAULT) ? | |
940 | + (*cur_style) = (el->any.s.linestyle!=LINESTYLE_DEFAULT) ? | |
941 | 941 | el->any.s.linestyle : custom->line_style; |
942 | 942 | renderer_ops->set_linestyle(renderer, (*cur_style), |
943 | 943 | custom->dashlength*(*cur_dash)); |
@@ -908,7 +908,7 @@ load_shape_info(const gchar *filename, ShapeInfo *preload) | ||
908 | 908 | } else if (node->ns == svg_ns && !xmlStrcmp(node->name, (const xmlChar *)"svg")) { |
909 | 909 | DiaSvgStyle s = { |
910 | 910 | 1.0, DIA_SVG_COLOUR_FOREGROUND, 1.0, DIA_SVG_COLOUR_NONE, 1.0, |
911 | - DIA_SVG_LINECAPS_DEFAULT, DIA_SVG_LINEJOIN_DEFAULT, DIA_SVG_LINESTYLE_DEFAULT, 1.0 | |
911 | + LINECAPS_DEFAULT, LINEJOIN_DEFAULT, LINESTYLE_DEFAULT, 1.0 | |
912 | 912 | }; |
913 | 913 | |
914 | 914 | dia_svg_parse_style(node, &s, -1); |
@@ -388,6 +388,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
388 | 388 | DIAG_NOTE(g_message("set_linecaps %d", mode)); |
389 | 389 | |
390 | 390 | switch(mode) { |
391 | + case LINECAPS_DEFAULT: | |
391 | 392 | case LINECAPS_BUTT: |
392 | 393 | cairo_set_line_cap (renderer->cr, CAIRO_LINE_CAP_BUTT); |
393 | 394 | break; |
@@ -411,6 +412,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
411 | 412 | DIAG_NOTE(g_message("set_join %d", mode)); |
412 | 413 | |
413 | 414 | switch(mode) { |
415 | + case LINEJOIN_DEFAULT: | |
414 | 416 | case LINEJOIN_MITER: |
415 | 417 | cairo_set_line_join (renderer->cr, CAIRO_LINE_JOIN_MITER); |
416 | 418 | break; |
@@ -438,6 +440,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
438 | 440 | ensure_minimum_one_device_unit(renderer, &dash_length); |
439 | 441 | /* line type */ |
440 | 442 | switch (mode) { |
443 | + case LINESTYLE_DEFAULT: | |
441 | 444 | case LINESTYLE_SOLID: |
442 | 445 | cairo_set_dash (renderer->cr, NULL, 0, 0); |
443 | 446 | break; |
@@ -582,6 +582,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
582 | 582 | |
583 | 583 | switch(mode) |
584 | 584 | { |
585 | + case LINECAPS_DEFAULT: | |
585 | 586 | case LINECAPS_BUTT: |
586 | 587 | cap = 2; |
587 | 588 | break; |
@@ -606,6 +607,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
606 | 607 | |
607 | 608 | switch(mode) |
608 | 609 | { |
610 | + case LINEJOIN_DEFAULT: | |
609 | 611 | case LINEJOIN_MITER: |
610 | 612 | join = 2; |
611 | 613 | break; |
@@ -645,6 +647,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
645 | 647 | case LINESTYLE_DOTTED: |
646 | 648 | style = 3; |
647 | 649 | break; |
650 | + case LINESTYLE_DEFAULT: | |
648 | 651 | case LINESTYLE_SOLID: |
649 | 652 | default: |
650 | 653 | style = 1; |
@@ -288,6 +288,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
288 | 288 | gchar *value = NULL; |
289 | 289 | |
290 | 290 | switch(mode) { |
291 | + case LINECAPS_DEFAULT: | |
291 | 292 | case LINECAPS_BUTT: |
292 | 293 | value = "butt"; |
293 | 294 | break; |
@@ -312,6 +313,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
312 | 313 | gchar *value = NULL; |
313 | 314 | |
314 | 315 | switch(mode) { |
316 | + case LINEJOIN_DEFAULT: | |
315 | 317 | case LINEJOIN_MITER: |
316 | 318 | value = "miter"; |
317 | 319 | break; |
@@ -337,6 +339,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
337 | 339 | |
338 | 340 | /* line type */ |
339 | 341 | switch (mode) { |
342 | + case LINESTYLE_DEFAULT: | |
340 | 343 | case LINESTYLE_SOLID: |
341 | 344 | value = "solid"; |
342 | 345 | break; |
@@ -203,6 +203,7 @@ set_linecaps(DiaRenderer *object, LineCaps mode) | ||
203 | 203 | DIAG_NOTE(g_message("set_linecaps %d", mode)); |
204 | 204 | |
205 | 205 | switch(mode) { |
206 | + case LINECAPS_DEFAULT: | |
206 | 207 | case LINECAPS_BUTT: |
207 | 208 | break; |
208 | 209 | case LINECAPS_ROUND: |
@@ -220,6 +221,7 @@ set_linejoin(DiaRenderer *object, LineJoin mode) | ||
220 | 221 | DIAG_NOTE(g_message("set_join %d", mode)); |
221 | 222 | |
222 | 223 | switch(mode) { |
224 | + case LINEJOIN_DEFAULT: | |
223 | 225 | case LINEJOIN_MITER: |
224 | 226 | break; |
225 | 227 | case LINEJOIN_ROUND: |
@@ -240,6 +242,7 @@ set_linestyle(DiaRenderer *object, LineStyle mode, real dash_length) | ||
240 | 242 | |
241 | 243 | /* line type */ |
242 | 244 | switch (mode) { |
245 | + case LINESTYLE_DEFAULT: | |
243 | 246 | case LINESTYLE_SOLID: |
244 | 247 | fprintf(renderer->file, "LT;\n"); |
245 | 248 | break; |
@@ -175,6 +175,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
175 | 175 | renderer->cap_style = ART_PATH_STROKE_CAP_ROUND; |
176 | 176 | } else { |
177 | 177 | switch(mode) { |
178 | + case LINECAPS_DEFAULT: | |
178 | 179 | case LINECAPS_BUTT: |
179 | 180 | renderer->cap_style = ART_PATH_STROKE_CAP_BUTT; |
180 | 181 | break; |
@@ -198,6 +199,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
198 | 199 | renderer->join_style = ART_PATH_STROKE_JOIN_ROUND; |
199 | 200 | } else { |
200 | 201 | switch(mode) { |
202 | + case LINEJOIN_DEFAULT: | |
201 | 203 | case LINEJOIN_MITER: |
202 | 204 | renderer->join_style = ART_PATH_STROKE_JOIN_MITER; |
203 | 205 | break; |
@@ -237,6 +239,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real length) | ||
237 | 239 | dot_length = 255.0; |
238 | 240 | |
239 | 241 | switch(mode) { |
242 | + case LINESTYLE_DEFAULT: | |
240 | 243 | case LINESTYLE_SOLID: |
241 | 244 | renderer->dash_enabled = 0; |
242 | 245 | break; |
@@ -1161,7 +1164,7 @@ get_text_width(DiaRenderer *object, | ||
1161 | 1164 | if (length != g_utf8_strlen(text, -1)) { |
1162 | 1165 | char *othertx; |
1163 | 1166 | int ulen; |
1164 | - /* A couple UTF8-chars: æblegrød Š Ť Ž ę ć ń уфхц??ОПРЄ є ?? Њ Ћ ?? */ | |
1167 | + | |
1165 | 1168 | ulen = g_utf8_offset_to_pointer(text, length)-text; |
1166 | 1169 | if (!g_utf8_validate(text, ulen, NULL)) { |
1167 | 1170 | g_warning ("Text at char %d not valid\n", length); |
@@ -1424,3 +1427,4 @@ dia_libart_renderer_class_init (DiaLibartRendererClass *klass) | ||
1424 | 1427 | } |
1425 | 1428 | |
1426 | 1429 | #endif |
1430 | + |
@@ -507,3 +507,4 @@ new_libart_renderer(DiaTransform *transform, int interactive) | ||
507 | 507 | } |
508 | 508 | |
509 | 509 | #endif |
510 | + |
@@ -250,6 +250,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
250 | 250 | return; |
251 | 251 | |
252 | 252 | switch(mode) { |
253 | + case LINECAPS_DEFAULT: | |
253 | 254 | case LINECAPS_BUTT: |
254 | 255 | fprintf(renderer->file, "linecap:=butt;\n"); |
255 | 256 | break; |
@@ -276,6 +277,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
276 | 277 | return; |
277 | 278 | |
278 | 279 | switch(mode) { |
280 | + case LINEJOIN_DEFAULT: | |
279 | 281 | case LINEJOIN_MITER: |
280 | 282 | fprintf(renderer->file, "linejoin:=mitered;\n"); |
281 | 283 | break; |
@@ -314,6 +316,7 @@ draw_with_linestyle(MetapostRenderer *renderer) | ||
314 | 316 | gchar hole_width_buf[DTOSTR_BUF_SIZE]; |
315 | 317 | |
316 | 318 | switch(renderer->saved_line_style) { |
319 | + case LINESTYLE_DEFAULT: | |
317 | 320 | case LINESTYLE_SOLID: |
318 | 321 | break; |
319 | 322 | case LINESTYLE_DASHED: |
@@ -378,6 +378,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
378 | 378 | /* int ps_mode; */ |
379 | 379 | |
380 | 380 | switch(mode) { |
381 | + case LINEJOIN_DEFAULT: | |
381 | 382 | case LINEJOIN_MITER: |
382 | 383 | fprintf(renderer->file, "\\pgfsetmiterjoin\n"); |
383 | 384 | break; |
@@ -409,6 +410,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
409 | 410 | dot_length = dash_length * 0.2; |
410 | 411 | |
411 | 412 | switch(mode) { |
413 | + case LINESTYLE_DEFAULT: | |
412 | 414 | case LINESTYLE_SOLID: |
413 | 415 | fprintf(renderer->file, "\\pgfsetdash{}{0pt}\n"); |
414 | 416 | break; |
@@ -160,6 +160,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
160 | 160 | int ps_mode; |
161 | 161 | |
162 | 162 | switch(mode) { |
163 | + case LINECAPS_DEFAULT: | |
163 | 164 | case LINECAPS_BUTT: |
164 | 165 | ps_mode = 0; |
165 | 166 | break; |
@@ -183,6 +184,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
183 | 184 | int ps_mode; |
184 | 185 | |
185 | 186 | switch(mode) { |
187 | + case LINEJOIN_DEFAULT: | |
186 | 188 | case LINEJOIN_MITER: |
187 | 189 | ps_mode = 0; |
188 | 190 | break; |
@@ -215,6 +217,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
215 | 217 | dot_length = dash_length*0.2; /* dot = 20% of len */ |
216 | 218 | |
217 | 219 | switch(mode) { |
220 | + case LINESTYLE_DEFAULT: | |
218 | 221 | case LINESTYLE_SOLID: |
219 | 222 | fprintf(renderer->file, "[] 0 sd\n"); |
220 | 223 | break; |
@@ -275,6 +275,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
275 | 275 | int ps_mode; |
276 | 276 | |
277 | 277 | switch(mode) { |
278 | + case LINECAPS_DEFAULT: | |
278 | 279 | case LINECAPS_BUTT: |
279 | 280 | ps_mode = 0; |
280 | 281 | break; |
@@ -298,6 +299,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
298 | 299 | int ps_mode; |
299 | 300 | |
300 | 301 | switch(mode) { |
302 | + case LINEJOIN_DEFAULT: | |
301 | 303 | case LINEJOIN_MITER: |
302 | 304 | ps_mode = 0; |
303 | 305 | break; |
@@ -330,6 +332,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
330 | 332 | dot_length = dash_length * 0.2; |
331 | 333 | |
332 | 334 | switch(mode) { |
335 | + case LINESTYLE_DEFAULT: | |
333 | 336 | case LINESTYLE_SOLID: |
334 | 337 | fprintf(renderer->file, "\\psset{linestyle=solid}\n"); |
335 | 338 | break; |
@@ -206,6 +206,7 @@ set_linecaps(DiaRenderer *renderer, LineCaps mode) | ||
206 | 206 | break; |
207 | 207 | case LINECAPS_PROJECTING: |
208 | 208 | break; |
209 | + case LINECAPS_DEFAULT: | |
209 | 210 | default: |
210 | 211 | PyErr_Warn (PyExc_RuntimeWarning, "DiaPyRenderer : Unsupported fill mode specified!\n"); |
211 | 212 | } |
@@ -246,6 +247,7 @@ set_linejoin(DiaRenderer *renderer, LineJoin mode) | ||
246 | 247 | break; |
247 | 248 | case LINEJOIN_BEVEL: |
248 | 249 | break; |
250 | + case LINEJOIN_DEFAULT: | |
249 | 251 | default: |
250 | 252 | PyErr_Warn (PyExc_RuntimeWarning, "DiaPyRenderer : Unsupported fill mode specified!\n"); |
251 | 253 | } |
@@ -291,6 +293,7 @@ set_linestyle(DiaRenderer *renderer, LineStyle mode, real dash_length) | ||
291 | 293 | break; |
292 | 294 | case LINESTYLE_DOTTED: |
293 | 295 | break; |
296 | + case LINESTYLE_DEFAULT: | |
294 | 297 | default: |
295 | 298 | PyErr_Warn (PyExc_RuntimeWarning, "DiaPyRenderer : Unsupported fill mode specified!\n"); |
296 | 299 | } |
@@ -465,7 +465,7 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style, | ||
465 | 465 | rprop->real_data = gs->line_width * scale; |
466 | 466 | |
467 | 467 | lsprop = g_ptr_array_index(props,2); |
468 | - if (gs->linestyle != DIA_SVG_LINESTYLE_DEFAULT) | |
468 | + if (gs->linestyle != LINESTYLE_DEFAULT) | |
469 | 469 | lsprop->style = gs->linestyle; |
470 | 470 | else if (init) |
471 | 471 | lsprop->style = LINESTYLE_SOLID; |
@@ -521,13 +521,13 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style, | ||
521 | 521 | } |
522 | 522 | |
523 | 523 | eprop = g_ptr_array_index(props,5); |
524 | - if (gs->linejoin != DIA_SVG_LINEJOIN_DEFAULT) | |
524 | + if (gs->linejoin != LINEJOIN_DEFAULT) | |
525 | 525 | eprop->enum_data = gs->linejoin; |
526 | 526 | else |
527 | 527 | eprop->common.experience |= PXP_NOTSET; |
528 | 528 | |
529 | 529 | eprop = g_ptr_array_index(props,6); |
530 | - if (gs->linecap != DIA_SVG_LINECAPS_DEFAULT) | |
530 | + if (gs->linecap != LINECAPS_DEFAULT) | |
531 | 531 | eprop->enum_data = gs->linecap; |
532 | 532 | else |
533 | 533 | eprop->common.experience |= PXP_NOTSET; |
@@ -458,6 +458,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
458 | 458 | /* line type */ |
459 | 459 | renderer->fnPenStyle &= ~(PS_STYLE_MASK); |
460 | 460 | switch (mode) { |
461 | + case LINESTYLE_DEFAULT: | |
461 | 462 | case LINESTYLE_SOLID: |
462 | 463 | renderer->fnPenStyle |= PS_SOLID; |
463 | 464 | break; |
@@ -491,6 +492,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
491 | 492 | case LINESTYLE_DOTTED: |
492 | 493 | renderer->nLineWidth = MIN(renderer->nLineWidth, 1); |
493 | 494 | case LINESTYLE_SOLID: |
495 | + case LINESTYLE_DEFAULT: | |
494 | 496 | break; |
495 | 497 | } |
496 | 498 | } |
@@ -340,6 +340,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
340 | 340 | DIAG_NOTE(g_message("set_linecaps %d", mode)); |
341 | 341 | |
342 | 342 | switch(mode) { |
343 | + case LINECAPS_DEFAULT: | |
343 | 344 | case LINECAPS_BUTT: |
344 | 345 | break; |
345 | 346 | case LINECAPS_ROUND: |
@@ -347,7 +348,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode) | ||
347 | 348 | case LINECAPS_PROJECTING: |
348 | 349 | break; |
349 | 350 | default: |
350 | - g_warning("WpgRenderer : Unsupported fill mode specified!\n"); | |
351 | + g_warning("WpgRenderer : Unsupported line-caps mode specified!\n"); | |
351 | 352 | } |
352 | 353 | } |
353 | 354 |
@@ -357,6 +358,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
357 | 358 | DIAG_NOTE(g_message("set_join %d", mode)); |
358 | 359 | |
359 | 360 | switch(mode) { |
361 | + case LINEJOIN_DEFAULT: | |
360 | 362 | case LINEJOIN_MITER: |
361 | 363 | break; |
362 | 364 | case LINEJOIN_ROUND: |
@@ -364,7 +366,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode) | ||
364 | 366 | case LINEJOIN_BEVEL: |
365 | 367 | break; |
366 | 368 | default: |
367 | - g_warning("WpgRenderer : Unsupported fill mode specified!\n"); | |
369 | + g_warning("WpgRenderer : Unsupported line-join mode specified!\n"); | |
368 | 370 | } |
369 | 371 | } |
370 | 372 |
@@ -377,6 +379,7 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length) | ||
377 | 379 | |
378 | 380 | /* line type */ |
379 | 381 | switch (mode) { |
382 | + case LINESTYLE_DEFAULT: | |
380 | 383 | case LINESTYLE_SOLID: |
381 | 384 | renderer->LineAttr.Type = WPG_LA_SOLID; |
382 | 385 | break; |