作図ソフト dia の改良版
修订版 | 3a03fdd1aca8dea0157d7d096f31613377acfd31 (tree) |
---|---|
时间 | 2007-03-29 19:23:40 |
作者 | Lars Clausen <lclausen@src....> |
Commiter | Lars Clausen |
Version 0.96.1
svn path=/branches/dia_0_96/; revision=3657
@@ -1,7 +1,30 @@ | ||
1 | -2007-03-26 Hans Breuer <hans@breuer.org> | |
1 | +2007-03-29 Lars Clausen <lars@raeder.dk> | |
2 | 2 | |
3 | - * bindings/* : dia/lib bindings with the help of SWIG, for details | |
4 | - see: http://mail.gnome.org/archives/dia-list/2007-March/msg00092.html | |
3 | + * NEWS: | |
4 | + * RELEASE-PROCESS: | |
5 | + * config.h.win32: | |
6 | + * doc/en/dia.xml: | |
7 | + * doc/pl/dia.xml: | |
8 | + * doc/eu/dia.xml: | |
9 | + * configure.in: Release 0.96.1 is a brown-bag release for empty | |
10 | + initial line problem in shapes, and a couple other bugs. | |
11 | + | |
12 | + * app/diapsrenderer.c (draw_text_line): Use language-independent | |
13 | + float conversion in new text rendering code. Fixes bug #424052. | |
14 | + | |
15 | + * plug-ins/vdx/vdx-import.c: Updated to version 0.9.4 to fix shape | |
16 | + problems and text errors. Fixes bug #417956. | |
17 | + | |
18 | + * lib/text.c (text_key_event): Treat keypad enter like return. | |
19 | + Fixes bug #423480. | |
20 | + | |
21 | + * plug-ins/dxf/dxf-import.c: Load closed polyline as polygon, | |
22 | + patch from Ben Abbott fixes font height problems. Fixes bug #421250. | |
23 | + | |
24 | +2007-03-28 Lars Clausen <lars@raeder.dk> | |
25 | + | |
26 | + * objects/custom/custom_object.c (custom_update_data): Use newer | |
27 | + way to get text ascent. Fixes bug #423351. | |
5 | 28 | |
6 | 29 | 2007-03-25 Lars Clausen <lars@raeder.dk> |
7 | 30 |
@@ -1,3 +1,8 @@ | ||
1 | +dia-0.96.1: 29-Mar-2007 | |
2 | + | |
3 | + * Brown-bag release with five bugfixes, one of them critical: Empty | |
4 | + initial lines in shapes crashes Dia (#421250). | |
5 | + | |
1 | 6 | dia-0.96: 25-Mar-2007 |
2 | 7 | |
3 | 8 | * Final release of 0.96. |
@@ -719,6 +719,7 @@ draw_text_line(DiaRenderer *self, | ||
719 | 719 | gchar *text = text_line_get_string(text_line); |
720 | 720 | int n_chars = g_utf8_strlen(text, -1); |
721 | 721 | real adjust; |
722 | + gchar sw_buf[DTOSTR_BUF_SIZE]; | |
722 | 723 | |
723 | 724 | if (1 > n_chars) |
724 | 725 | return; |
@@ -743,7 +744,8 @@ draw_text_line(DiaRenderer *self, | ||
743 | 744 | width = text_line_get_width(text_line); |
744 | 745 | |
745 | 746 | /* Find the difference in length */ |
746 | - fprintf(renderer->file, "dup sw %f exch sub \n", width); | |
747 | + fprintf(renderer->file, "dup sw %s exch sub \n", | |
748 | + psrenderer_dtostr(sw_buf, (gdouble) width)); | |
747 | 749 | |
748 | 750 | /* Divide by number of chars and set up for ashow */ |
749 | 751 | fprintf(renderer->file, "%d div exch 0.0 exch \n", n_chars); |
@@ -18,7 +18,7 @@ | ||
18 | 18 | #undef LOCALEDIR /* needs to be calculated at runtime */ |
19 | 19 | /* NOT: #define LOCALEDIR "../lib/locale" */ |
20 | 20 | |
21 | -#define VERSION "0.96" | |
21 | +#define VERSION "0.96.1" | |
22 | 22 | |
23 | 23 | /* |
24 | 24 | * We are linking libxml as DLL with either msvc or mingw, but this |
@@ -1,6 +1,6 @@ | ||
1 | 1 | dnl Process this -*- autoconf -*- file with autoconf to produce a |
2 | 2 | dnl configure script. |
3 | -AC_INIT(dia, 0.96, http://bugzilla.gnome.org/enter_bug.cgi?product=dia) | |
3 | +AC_INIT(dia, 0.96.1, http://bugzilla.gnome.org/enter_bug.cgi?product=dia) | |
4 | 4 | AC_CONFIG_SRCDIR(app/diagram.c) |
5 | 5 | AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION) |
6 | 6 |
@@ -8,7 +8,7 @@ | ||
8 | 8 | |
9 | 9 | [ |
10 | 10 | |
11 | - <!ENTITY VERSION "0.96"> | |
11 | + <!ENTITY VERSION "0.96.1"> | |
12 | 12 | |
13 | 13 | <!ENTITY INTRODUCTION SYSTEM "intro.xml"> |
14 | 14 |
@@ -4,7 +4,7 @@ | ||
4 | 4 | |
5 | 5 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "../../dtd/docbookx.dtd" [ |
6 | 6 | |
7 | - <!ENTITY VERSION "0.96"> | |
7 | + <!ENTITY VERSION "0.96.1"> | |
8 | 8 | |
9 | 9 | <!ENTITY INTRODUCTION SYSTEM "intro.xml"> |
10 | 10 |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
2 | 2 | |
3 | 3 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "../../dtd/docbookx.dtd"[ |
4 | -<!ENTITY VERSION "0.96"> | |
4 | +<!ENTITY VERSION "0.96.1"> | |
5 | 5 | <!ENTITY INTRODUCTION SYSTEM "intro.xml"> |
6 | 6 | <!ENTITY QUICKSTART SYSTEM "usage-quickstart.xml"> |
7 | 7 | <!ENTITY CANVAS SYSTEM "usage-canvas.xml"> |
@@ -884,6 +884,7 @@ text_key_event(Focus *focus, guint keyval, const gchar *str, int strlen, | ||
884 | 884 | text_delete_backward(text); |
885 | 885 | break; |
886 | 886 | case GDK_Return: |
887 | + case GDK_KP_Enter: | |
887 | 888 | return_val = TRUE; |
888 | 889 | *change = text_create_change(text, TYPE_SPLIT_ROW, 'Q', |
889 | 890 | text->cursor_pos, text->cursor_row); |
@@ -552,10 +552,7 @@ DiaObject *read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *d | ||
552 | 552 | |
553 | 553 | if( closed ) |
554 | 554 | { |
555 | - ++points; | |
556 | - p = g_realloc( p, sizeof( Point ) * points ); | |
557 | - p[points-1].x = p[0].x; | |
558 | - p[points-1].y = p[0].y; | |
555 | + otype = object_get_type("Standard - Polygon"); | |
559 | 556 | } |
560 | 557 | |
561 | 558 | pcd->num_points = points; |
@@ -941,7 +938,7 @@ DiaObject *read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia) | ||
941 | 938 | height = atof(data->value) * coord_scale * measure_scale; |
942 | 939 | /*printf( "text height %f\n", height );*/ |
943 | 940 | break; |
944 | - case 62: | |
941 | + case 62: | |
945 | 942 | colour = atoi(data->value); |
946 | 943 | text_colour.red = acad_pal[colour].r / 255.0; |
947 | 944 | text_colour.green = acad_pal[colour].g / 255.0; |
@@ -994,7 +991,7 @@ DiaObject *read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia) | ||
994 | 991 | } while(codedxf != 0); |
995 | 992 | setlocale(LC_NUMERIC,old_locale); |
996 | 993 | |
997 | - location.y += y_offset * height; | |
994 | + location.y += y_offset * height; | |
998 | 995 | |
999 | 996 | text_obj = otype->ops->create(&location, otype->default_user_data, |
1000 | 997 | &h1, &h2); |
@@ -1010,6 +1007,7 @@ DiaObject *read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia) | ||
1010 | 1007 | tprop->attr.position.y = location.y; |
1011 | 1008 | |
1012 | 1009 | attributes_get_default_font(&tprop->attr.font, &tprop->attr.height); |
1010 | + tprop->attr.height = height; | |
1013 | 1011 | tprop->attr.color = text_colour; |
1014 | 1012 | |
1015 | 1013 | text_obj->ops->set_props(text_obj, props); |
@@ -97,7 +97,11 @@ create_standard_line(Point *points, | ||
97 | 97 | &h1, &h2); |
98 | 98 | |
99 | 99 | props = prop_list_from_descs(vdx_line_prop_descs, pdtpp_true); |
100 | - g_assert(props->len == 4); | |
100 | + if (props->len != 4) | |
101 | + { | |
102 | + g_debug("create_standard_line() - props->len != 4"); | |
103 | + return 0; | |
104 | + } | |
101 | 105 | |
102 | 106 | ptprop = g_ptr_array_index(props,0); |
103 | 107 | ptprop->point_data = points[0]; |
@@ -216,8 +220,12 @@ vdx_parse_color(const char *s, const VDXDocument *theDoc) | ||
216 | 220 | if (theDoc->Colors && i < theDoc->Colors->len) |
217 | 221 | return g_array_index(theDoc->Colors, Color, i); |
218 | 222 | } |
219 | - message_warning(_("Couldn't read color: %s\n"), s); | |
220 | - g_debug("Couldn't read color: %s", s); | |
223 | + /* Colour 0 is always black, so don't warn (OmniGraffle) */ | |
224 | + if (*s != '0') | |
225 | + { | |
226 | + message_warning(_("Couldn't read color: %s\n"), s); | |
227 | + g_debug("Couldn't read color: %s", s); | |
228 | + } | |
221 | 229 | return c; |
222 | 230 | } |
223 | 231 |
@@ -381,7 +389,13 @@ find_child(unsigned int type, const void *p) | ||
381 | 389 | { |
382 | 390 | struct vdx_any *Any = (struct vdx_any *)p; |
383 | 391 | GSList *child; |
384 | - g_assert(p); | |
392 | + | |
393 | + if (!p) | |
394 | + { | |
395 | + g_debug("find_child called with p=0"); | |
396 | + return 0; | |
397 | + } | |
398 | + | |
385 | 399 | for(child = Any->children; child; child = child->next) |
386 | 400 | { |
387 | 401 | struct vdx_any *Any_child = (struct vdx_any *)child->data; |
@@ -403,7 +417,12 @@ find_child_next(unsigned int type, const void *p, const void *given) | ||
403 | 417 | struct vdx_any *Any = (struct vdx_any *)p; |
404 | 418 | GSList *child; |
405 | 419 | gboolean found_given = FALSE; |
406 | - g_assert(p); | |
420 | + | |
421 | + if (!p) | |
422 | + { | |
423 | + g_debug("find_child_next() called with p=0"); | |
424 | + return 0; | |
425 | + } | |
407 | 426 | for(child = Any->children; child; child = child->next) |
408 | 427 | { |
409 | 428 | struct vdx_any *Any_child = (struct vdx_any *)child->data; |
@@ -448,14 +467,17 @@ get_style_child(unsigned int type, unsigned int style, VDXDocument* theDoc) | ||
448 | 467 | { |
449 | 468 | struct vdx_StyleSheet theSheet; |
450 | 469 | struct vdx_any *Any; |
451 | - if (!theDoc->StyleSheets) | |
452 | - { | |
453 | - g_debug("Unknown stylesheet reference"); | |
454 | - return 0; | |
455 | - } | |
456 | 470 | while(1) |
457 | 471 | { |
458 | - g_assert(theDoc->StyleSheets && style < theDoc->StyleSheets->len); | |
472 | + if (!theDoc->StyleSheets || style >= theDoc->StyleSheets->len) | |
473 | + { | |
474 | + /* Ignore style 0 for OmniGraffle */ | |
475 | + if (style) | |
476 | + { | |
477 | + g_debug("Unknown stylesheet reference: %d", style); | |
478 | + } | |
479 | + return 0; | |
480 | + } | |
459 | 481 | theSheet = g_array_index(theDoc->StyleSheets, |
460 | 482 | struct vdx_StyleSheet, style); |
461 | 483 | Any = find_child(type, &theSheet); |
@@ -486,7 +508,12 @@ get_shape_by_id(unsigned int id, struct vdx_Shapes *Shapes, unsigned int depth) | ||
486 | 508 | struct vdx_Shape *Shape; |
487 | 509 | struct vdx_Shapes *SubShapes; |
488 | 510 | GSList *child; |
489 | - g_assert(Shapes); | |
511 | + | |
512 | + if (!Shapes) | |
513 | + { | |
514 | + g_debug("get_shape_by_id() called with Shapes=0"); | |
515 | + return 0; | |
516 | + } | |
490 | 517 | |
491 | 518 | /* A Master has a list of Shapes */ |
492 | 519 | for(child = Shapes->children; child; child = child->next) |
@@ -529,7 +556,12 @@ get_master_shape(unsigned int master, unsigned int shape, VDXDocument* theDoc) | ||
529 | 556 | struct vdx_Master theMaster; |
530 | 557 | struct vdx_Shapes *Shapes; |
531 | 558 | |
532 | - g_assert(master < theDoc->Masters->len); | |
559 | + if (!theDoc->Masters || master >= theDoc->Masters->len) | |
560 | + { | |
561 | + g_debug("Unknown master reference"); | |
562 | + return 0; | |
563 | + } | |
564 | + | |
533 | 565 | if (theDoc->debug_comments) |
534 | 566 | g_debug("Looking for Master %d Shape %d", master, shape); |
535 | 567 | theMaster = g_array_index(theDoc->Masters, |
@@ -586,7 +618,11 @@ vdx_simple_properties(DiaObject *obj, | ||
586 | 618 | ColorProperty *cprop = 0; |
587 | 619 | unsigned int debug_id; |
588 | 620 | |
589 | - g_assert(props->len == 2); | |
621 | + if (props->len != 2) | |
622 | + { | |
623 | + g_debug("vdx_simple_properties() - props->len != 4"); | |
624 | + return; | |
625 | + } | |
590 | 626 | |
591 | 627 | if (Line) |
592 | 628 | { |
@@ -711,6 +747,12 @@ apply_XForm(Point p, const struct vdx_XForm *XForm) | ||
711 | 747 | double sin_theta, cos_theta; |
712 | 748 | |
713 | 749 | /* Remove the offset of the rotation pin from the object */ |
750 | + if (!XForm) | |
751 | + { | |
752 | + g_debug("apply_XForm() called with XForm=0"); | |
753 | + return q; | |
754 | + } | |
755 | + | |
714 | 756 | q.x -= XForm->LocPinX; |
715 | 757 | q.y -= XForm->LocPinY; |
716 | 758 |
@@ -771,6 +813,11 @@ make_arrow(const struct vdx_Line *Line, char start_end, | ||
771 | 813 | double size = 0; |
772 | 814 | unsigned int type = 0; |
773 | 815 | |
816 | + if (!Line) | |
817 | + { | |
818 | + g_debug("make_arrow() called with Line=0"); | |
819 | + return 0; | |
820 | + } | |
774 | 821 | a->type = ARROW_FILLED_TRIANGLE; |
775 | 822 | |
776 | 823 | if (start_end == 's') |
@@ -823,17 +870,18 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
823 | 870 | struct vdx_ArcTo *ArcTo; |
824 | 871 | struct vdx_any *Any; |
825 | 872 | Point *points, p; |
826 | - unsigned int num_points = 0; | |
873 | + unsigned int num_points = 1; | |
827 | 874 | unsigned int count = 0; |
828 | 875 | Arrow* start_arrow_p = NULL; |
829 | 876 | Arrow* end_arrow_p = NULL; |
830 | 877 | gboolean done = FALSE; |
831 | 878 | |
832 | 879 | if (theDoc->debug_comments) g_debug("plot_polyline()"); |
833 | - if ((Geom->NoFill || (Fill && !Fill->FillPattern)) && | |
834 | - (Geom->NoLine || (Line && !Line->LinePattern))) | |
880 | + if (!Geom || ((Geom->NoFill || (Fill && !Fill->FillPattern)) && | |
881 | + (Geom->NoLine || (Line && !Line->LinePattern)))) | |
835 | 882 | { |
836 | 883 | *more = 0; |
884 | + if (theDoc->debug_comments) g_debug("Nothing to plot"); | |
837 | 885 | return 0; |
838 | 886 | } |
839 | 887 |
@@ -854,6 +902,12 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
854 | 902 | LineTo = (struct vdx_LineTo*)(item->data); |
855 | 903 | if (LineTo->Del) continue; |
856 | 904 | p.x = LineTo->X; p.y = LineTo->Y; |
905 | + if (!count) | |
906 | + { | |
907 | + /* Use current as start point */ | |
908 | + points[count++] = | |
909 | + dia_point(apply_XForm(*current, XForm), theDoc); | |
910 | + } | |
857 | 911 | break; |
858 | 912 | case vdx_types_MoveTo: |
859 | 913 | MoveTo = (struct vdx_MoveTo*)(item->data); |
@@ -867,11 +921,6 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
867 | 921 | done = TRUE; |
868 | 922 | break; |
869 | 923 | } |
870 | - else | |
871 | - { | |
872 | - num_points--; | |
873 | - continue; | |
874 | - } | |
875 | 924 | } |
876 | 925 | break; |
877 | 926 | default: |
@@ -908,7 +957,8 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
908 | 957 | |
909 | 958 | if (count > 2) |
910 | 959 | { |
911 | - if (Geom->NoFill) | |
960 | + /* If we had to break the Geom partway, it's not a polygon */ | |
961 | + if (Geom->NoFill || done) | |
912 | 962 | { |
913 | 963 | /* Yes, it is end_arrow followed by start_arrow */ |
914 | 964 | newobj = create_standard_polyline(count, points, |
@@ -928,6 +978,7 @@ plot_polyline(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
928 | 978 | } |
929 | 979 | else |
930 | 980 | { |
981 | + /* Don't plot lines with only one point */ | |
931 | 982 | if (theDoc->debug_comments) |
932 | 983 | g_debug("Empty polyline"); |
933 | 984 | } |
@@ -1017,6 +1068,12 @@ arc_to_ellipticalarc(struct vdx_ArcTo *ArcTo, const Point *Start, | ||
1017 | 1068 | Point perp; |
1018 | 1069 | double length; |
1019 | 1070 | |
1071 | + if (!EllipticalArcTo || !ArcTo || !Start) | |
1072 | + { | |
1073 | + g_debug("arc_to_ellipticalarc() called with null parameters"); | |
1074 | + return FALSE; | |
1075 | + } | |
1076 | + | |
1020 | 1077 | EllipticalArcTo->type = vdx_types_EllipticalArcTo; |
1021 | 1078 | EllipticalArcTo->children = 0; |
1022 | 1079 |
@@ -1082,6 +1139,12 @@ ellipticalarc_to_bezier(Point p0, Point p3, Point p4, double C, double D, | ||
1082 | 1139 | |
1083 | 1140 | double a, b, c, d, e, f, g; /* Scratch variables */ |
1084 | 1141 | |
1142 | + if (!p1 || !p2) | |
1143 | + { | |
1144 | + g_debug("ellipticalarc_to_bezier() called with null parameters"); | |
1145 | + return FALSE; | |
1146 | + } | |
1147 | + | |
1085 | 1148 | /* We assume the arc is not degenerate: |
1086 | 1149 | p0 != p4 != p3 != p0, 0 < D < infty |
1087 | 1150 | */ |
@@ -1423,7 +1486,7 @@ plot_bezier(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1423 | 1486 | if (!all_lines) |
1424 | 1487 | { |
1425 | 1488 | /* It's a Bezier */ |
1426 | - if (Geom->NoFill) | |
1489 | + if (Geom && Geom->NoFill) | |
1427 | 1490 | { |
1428 | 1491 | /* Yes, it is end then start arrow */ |
1429 | 1492 | newobj = create_standard_bezierline(num_points, bezpoints, |
@@ -1450,7 +1513,7 @@ plot_bezier(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1450 | 1513 | |
1451 | 1514 | if (count > 2) |
1452 | 1515 | { |
1453 | - if (Geom->NoFill) | |
1516 | + if (Geom && Geom->NoFill) | |
1454 | 1517 | { |
1455 | 1518 | /* Yes, it is end_arrow followed by start_arrow */ |
1456 | 1519 | newobj = create_standard_polyline(count, points, |
@@ -1498,6 +1561,12 @@ NURBS_N(unsigned int i, unsigned int k, float u, unsigned int n, | ||
1498 | 1561 | { |
1499 | 1562 | float sum = 0.0; |
1500 | 1563 | |
1564 | + if (! knot) | |
1565 | + { | |
1566 | + g_debug("NURBS_N() called with knot=0"); | |
1567 | + return sum; | |
1568 | + } | |
1569 | + | |
1501 | 1570 | if (k == 0) |
1502 | 1571 | { |
1503 | 1572 | if (knot[i] <= u && u < knot[i+1]) |
@@ -1542,7 +1611,13 @@ NURBS_C(unsigned int k, float u, unsigned int n, | ||
1542 | 1611 | float bottom = 0; |
1543 | 1612 | unsigned int i; |
1544 | 1613 | float N_i_k; |
1545 | - Point p; | |
1614 | + Point p = {0, 0}; | |
1615 | + | |
1616 | + if (!knot || !weight || !control) | |
1617 | + { | |
1618 | + g_debug("NURBS_C() called with null parameters"); | |
1619 | + return p; | |
1620 | + } | |
1546 | 1621 | |
1547 | 1622 | for(i=0; i<=n; i++) |
1548 | 1623 | { |
@@ -1608,8 +1683,8 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1608 | 1683 | unsigned int steps = 40; |
1609 | 1684 | float start_u, step_u; |
1610 | 1685 | |
1611 | - if(theDoc->debug_comments) | |
1612 | - g_debug("plot_nurbs()"); | |
1686 | + if (theDoc->debug_comments) | |
1687 | + g_debug("plot_nurbs(), current x=%f y=%f", current->x, current->y); | |
1613 | 1688 | |
1614 | 1689 | item = *more; |
1615 | 1690 | Any = (struct vdx_any *)(item->data); |
@@ -1620,6 +1695,8 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1620 | 1695 | current->x = MoveTo->X; |
1621 | 1696 | current->y = MoveTo->Y; |
1622 | 1697 | begin = *current; |
1698 | + if (theDoc->debug_comments) | |
1699 | + g_debug("MoveTo x=%f y=%f", begin.x, begin.y); | |
1623 | 1700 | item = item->next; |
1624 | 1701 | Any = (struct vdx_any *)(item->data); |
1625 | 1702 | *more = item; |
@@ -1627,6 +1704,7 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1627 | 1704 | |
1628 | 1705 | if (Any->type == vdx_types_NURBSTo) |
1629 | 1706 | { |
1707 | + if (theDoc->debug_comments) g_debug("NURBSTo"); | |
1630 | 1708 | NURBSTo = (struct vdx_NURBSTo*)(item->data); |
1631 | 1709 | |
1632 | 1710 | /* E holds the NURBS formula */ |
@@ -1688,25 +1766,25 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1688 | 1766 | i = 0; |
1689 | 1767 | while(c && *c && i < n) |
1690 | 1768 | { |
1691 | - g_assert(c); | |
1769 | + if (!c) break; | |
1692 | 1770 | control[i].x = atof(++c); |
1693 | 1771 | current->x = control[i].x; |
1694 | 1772 | /* xType = 0 means X is proportion of Width */ |
1695 | 1773 | if (xType == 0) control[i].x *= XForm->Width; |
1696 | 1774 | c = strchr(c, ','); |
1697 | 1775 | |
1698 | - g_assert(c); | |
1776 | + if (!c) break; | |
1699 | 1777 | control[i].y = atof(++c); |
1700 | 1778 | current->y = control[i].y; |
1701 | 1779 | /* yType = 0 means Y is proportion of Height */ |
1702 | 1780 | if (yType == 0) control[i].y *= XForm->Height; |
1703 | 1781 | c = strchr(c, ','); |
1704 | 1782 | |
1705 | - g_assert(c); | |
1783 | + if (!c) break; | |
1706 | 1784 | knot[i] = atof(++c); |
1707 | 1785 | c = strchr(c, ','); |
1708 | 1786 | |
1709 | - g_assert(c); | |
1787 | + if (!c) break; | |
1710 | 1788 | weight[i] = atof(++c); |
1711 | 1789 | c = strchr(c, ','); |
1712 | 1790 | i++; |
@@ -1717,6 +1795,7 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1717 | 1795 | { |
1718 | 1796 | if (Any->type == vdx_types_SplineStart) |
1719 | 1797 | { |
1798 | + if (theDoc->debug_comments) g_debug("SplineStart"); | |
1720 | 1799 | SplineStart = (struct vdx_SplineStart*)(item->data); |
1721 | 1800 | item2 = item; |
1722 | 1801 | n = 1; |
@@ -1829,7 +1908,8 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
1829 | 1908 | { |
1830 | 1909 | points[num_points-1] = dia_point(apply_XForm(end, XForm), theDoc); |
1831 | 1910 | if (theDoc->debug_comments) |
1832 | - g_debug("Point %d VDX x=%f y=%f", num_points-1, end.x, end.y); | |
1911 | + g_debug("End Point %d VDX x=%f y=%f", num_points-1, end.x, end.y); | |
1912 | + *current = end; | |
1833 | 1913 | } |
1834 | 1914 | |
1835 | 1915 | if (theDoc->debug_comments) |
@@ -1875,6 +1955,12 @@ write_base64_file(const char *filename, const char *b64) | ||
1875 | 1955 | char buf[4]; /* For 4 decoded 6-bit chunks */ |
1876 | 1956 | unsigned int buf_len = 0; |
1877 | 1957 | |
1958 | + if (!filename || !b64) | |
1959 | + { | |
1960 | + g_debug("write_base64_file() called with null parameters"); | |
1961 | + return; | |
1962 | + } | |
1963 | + | |
1878 | 1964 | f = g_fopen(filename, "w+b"); |
1879 | 1965 | if (!f) |
1880 | 1966 | { |
@@ -2068,6 +2154,7 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
2068 | 2154 | { |
2069 | 2155 | const GSList *item; |
2070 | 2156 | gboolean all_lines = TRUE; /* Flag for line/polyline */ |
2157 | + gboolean has_nurbs = FALSE; /* Flag for NURBS */ | |
2071 | 2158 | unsigned int num_steps = 0; /* Flag for poly */ |
2072 | 2159 | struct vdx_any *last_point = 0; |
2073 | 2160 | unsigned int dia_type_choice = vdx_dia_any; |
@@ -2076,7 +2163,7 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
2076 | 2163 | struct vdx_ArcTo *ArcTo; |
2077 | 2164 | |
2078 | 2165 | /* Is it disabled? */ |
2079 | - if (Geom->NoShow) | |
2166 | + if (!Geom || Geom->NoShow) | |
2080 | 2167 | { |
2081 | 2168 | if (theDoc->debug_comments) |
2082 | 2169 | g_debug("NoShow"); |
@@ -2103,6 +2190,11 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
2103 | 2190 | if (ArcTo->Del) continue; |
2104 | 2191 | all_lines = FALSE; |
2105 | 2192 | break; |
2193 | + case vdx_types_NURBSTo: | |
2194 | + case vdx_types_SplineKnot: | |
2195 | + has_nurbs = TRUE; | |
2196 | + all_lines = FALSE; | |
2197 | + break; | |
2106 | 2198 | default: |
2107 | 2199 | all_lines = FALSE; |
2108 | 2200 | } |
@@ -2141,7 +2233,7 @@ plot_geom(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm, | ||
2141 | 2233 | if (Geom->NoFill) { dia_type_choice = vdx_dia_bezier; } |
2142 | 2234 | else { dia_type_choice = vdx_dia_beziergon; } |
2143 | 2235 | /* Unless it's a spline */ |
2144 | - if (last_point->type == vdx_types_SplineKnot) | |
2236 | + if (last_point->type == vdx_types_SplineKnot || has_nurbs) | |
2145 | 2237 | dia_type_choice = vdx_dia_nurbs; |
2146 | 2238 | } |
2147 | 2239 |
@@ -2203,8 +2295,13 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm, | ||
2203 | 2295 | double height; |
2204 | 2296 | char *font_name = 0; |
2205 | 2297 | DiaFontStyle style = 0; |
2298 | + DiaFont *font = 0; | |
2206 | 2299 | |
2207 | - if (!Char || !text) { g_debug("Not enough info for text"); return 0; } | |
2300 | + if (!Text || !Char || !text || !XForm) | |
2301 | + { | |
2302 | + g_debug("Not enough info for text"); | |
2303 | + return 0; | |
2304 | + } | |
2208 | 2305 | p.x = 0; p.y = 0; |
2209 | 2306 | |
2210 | 2307 | /* Setup position for horizontal alignment */ |
@@ -2316,11 +2413,17 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm, | ||
2316 | 2413 | font_name = FaceName.Name; |
2317 | 2414 | } |
2318 | 2415 | } |
2319 | - tprop->attr.font = dia_font_new(font_name, style, height); | |
2416 | + | |
2417 | + font = dia_font_new_from_legacy_name(font_name); | |
2418 | + dia_font_set_weight(font, DIA_FONT_STYLE_GET_WEIGHT(style)); | |
2419 | + dia_font_set_slant(font, DIA_FONT_STYLE_GET_SLANT(style)); | |
2420 | + dia_font_set_height(font, height); | |
2421 | + tprop->attr.font = font; | |
2422 | + | |
2320 | 2423 | if (theDoc->debug_comments) |
2321 | - g_debug("Text: %s at %f,%f v=%d h=%d s=%.2x", | |
2424 | + g_debug("Text: %s at %f,%f v=%d h=%d s=%.2x f=%s", | |
2322 | 2425 | tprop->text_data, p.x, p.y, |
2323 | - eprop->enum_data, tprop->attr.alignment, style); | |
2426 | + eprop->enum_data, tprop->attr.alignment, style, font_name); | |
2324 | 2427 | |
2325 | 2428 | tprop->attr.height = height; |
2326 | 2429 | tprop->attr.color = Char->Color; |
@@ -2359,6 +2462,11 @@ vdx_plot_shape(struct vdx_Shape *Shape, GSList *objects, | ||
2359 | 2462 | const GSList *more = 0; |
2360 | 2463 | Point current = {0, 0}; |
2361 | 2464 | |
2465 | + if (!Shape) | |
2466 | + { | |
2467 | + g_debug("vdx_plot_shape() called with Shape=0"); | |
2468 | + return 0; | |
2469 | + } | |
2362 | 2470 | theDoc->shape_id = Shape->ID; |
2363 | 2471 | if (Shape->Del) |
2364 | 2472 | { |
@@ -2701,6 +2809,12 @@ vdx_setup_layers(struct vdx_PageSheet* PageSheet, VDXDocument* theDoc, | ||
2701 | 2809 | |
2702 | 2810 | /* What layers are on this page? */ |
2703 | 2811 | |
2812 | + if (!PageSheet) | |
2813 | + { | |
2814 | + g_debug("vdx_setup_layers() called with PageSheet=0"); | |
2815 | + return; | |
2816 | + } | |
2817 | + | |
2704 | 2818 | for (child = PageSheet->children; child; child = child->next) |
2705 | 2819 | { |
2706 | 2820 | if (!child || !child->data) continue; |