dia r3918 - in branches/dia-0-96: . doc/en doc/eu doc/pl lib objects/custom plug-ins/dxf plug-ins/vdx
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r3918 - in branches/dia-0-96: . doc/en doc/eu doc/pl lib objects/custom plug-ins/dxf plug-ins/vdx
- Date: Sun, 16 Mar 2008 13:02:49 +0000 (GMT)
Author: hans
Date: Sun Mar 16 13:02:48 2008
New Revision: 3918
URL: http://svn.gnome.org/viewvc/dia?rev=3918&view=rev
Log:
2008-03-16 Hans Breuer <hans breuer org>
* lib/libdia.def : added missing exports
[merged from svn://svn.gnome.org/svn/dia/branches/dia_0_96 revision 3657]
2007-03-29 Lars Clausen <lars raeder dk>
* NEWS:
* RELEASE-PROCESS:
* config.h.win32:
* doc/en/dia.xml:
* doc/pl/dia.xml:
* doc/eu/dia.xml:
* configure.in: Release 0.96.1 is a brown-bag release for empty
initial line problem in shapes, and a couple other bugs.
* app/diapsrenderer.c (draw_text_line): Use language-independent
float conversion in new text rendering code. Fixes bug #424052.
* plug-ins/vdx/vdx-import.c: Updated to version 0.9.4 to fix shape
problems and text errors. Fixes bug #417956.
* lib/text.c (text_key_event): Treat keypad enter like return.
Fixes bug #423480.
* plug-ins/dxf/dxf-import.c: Load closed polyline as polygon,
patch from Ben Abbott fixes font height problems. Fixes bug #421250.
2007-03-28 Lars Clausen <lars raeder dk>
* objects/custom/custom_object.c (custom_update_data): Use newer
way to get text ascent. Fixes bug #423351.
[end merge]
Modified:
branches/dia-0-96/ChangeLog
branches/dia-0-96/NEWS
branches/dia-0-96/config.h.win32
branches/dia-0-96/configure.in
branches/dia-0-96/doc/en/dia.xml
branches/dia-0-96/doc/eu/dia.xml
branches/dia-0-96/doc/pl/dia.xml
branches/dia-0-96/lib/libdia.def
branches/dia-0-96/lib/text.c
branches/dia-0-96/objects/custom/custom_object.c
branches/dia-0-96/plug-ins/dxf/dxf-import.c
branches/dia-0-96/plug-ins/vdx/vdx-import.c
Modified: branches/dia-0-96/NEWS
==============================================================================
--- branches/dia-0-96/NEWS (original)
+++ branches/dia-0-96/NEWS Sun Mar 16 13:02:48 2008
@@ -1,3 +1,8 @@
+dia-0.96.1: 29-Mar-2007
+
+ * Brown-bag release with five bugfixes, one of them critical: Empty
+ initial lines in shapes crashes Dia (#421250).
+
dia-0.96: 25-Mar-2007
* Final release of 0.96.
Modified: branches/dia-0-96/config.h.win32
==============================================================================
--- branches/dia-0-96/config.h.win32 (original)
+++ branches/dia-0-96/config.h.win32 Sun Mar 16 13:02:48 2008
@@ -18,7 +18,7 @@
#undef LOCALEDIR /* needs to be calculated at runtime */
/* NOT: #define LOCALEDIR "../lib/locale" */
-#define VERSION "0.96"
+#define VERSION "0.96.1"
/*
* We are linking libxml as DLL with either msvc or mingw, but this
Modified: branches/dia-0-96/configure.in
==============================================================================
--- branches/dia-0-96/configure.in (original)
+++ branches/dia-0-96/configure.in Sun Mar 16 13:02:48 2008
@@ -1,6 +1,6 @@
dnl Process this -*- autoconf -*- file with autoconf to produce a
dnl configure script.
-AC_INIT(dia, 0.96, http://bugzilla.gnome.org/enter_bug.cgi?product=dia)
+AC_INIT(dia, 0.96.1, http://bugzilla.gnome.org/enter_bug.cgi?product=dia)
AC_CONFIG_SRCDIR(app/diagram.c)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
Modified: branches/dia-0-96/doc/en/dia.xml
==============================================================================
--- branches/dia-0-96/doc/en/dia.xml (original)
+++ branches/dia-0-96/doc/en/dia.xml Sun Mar 16 13:02:48 2008
@@ -8,7 +8,7 @@
[
- <!ENTITY VERSION "0.96">
+ <!ENTITY VERSION "0.96.1">
<!ENTITY INTRODUCTION SYSTEM "intro.xml">
Modified: branches/dia-0-96/doc/eu/dia.xml
==============================================================================
--- branches/dia-0-96/doc/eu/dia.xml (original)
+++ branches/dia-0-96/doc/eu/dia.xml Sun Mar 16 13:02:48 2008
@@ -4,7 +4,7 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "../../dtd/docbookx.dtd" [
- <!ENTITY VERSION "0.96">
+ <!ENTITY VERSION "0.96.1">
<!ENTITY INTRODUCTION SYSTEM "intro.xml">
Modified: branches/dia-0-96/doc/pl/dia.xml
==============================================================================
--- branches/dia-0-96/doc/pl/dia.xml (original)
+++ branches/dia-0-96/doc/pl/dia.xml Sun Mar 16 13:02:48 2008
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "../../dtd/docbookx.dtd"[
-<!ENTITY VERSION "0.96">
+<!ENTITY VERSION "0.96.1">
<!ENTITY INTRODUCTION SYSTEM "intro.xml">
<!ENTITY QUICKSTART SYSTEM "usage-quickstart.xml">
<!ENTITY CANVAS SYSTEM "usage-canvas.xml">
Modified: branches/dia-0-96/lib/libdia.def
==============================================================================
--- branches/dia-0-96/lib/libdia.def (original)
+++ branches/dia-0-96/lib/libdia.def Sun Mar 16 13:02:48 2008
@@ -217,8 +217,10 @@
dia_font_ref
dia_font_set_any_family
dia_font_set_weight_from_string
+ dia_font_set_slant
dia_font_set_slant_from_string
dia_font_set_height
+ dia_font_set_weight
dia_font_copy
dia_font_string_width
@@ -637,6 +639,7 @@
text_distance_from
text_draw
text_get_attributes
+ text_get_ascent
text_get_descent
text_get_line
text_get_line_strlen
Modified: branches/dia-0-96/lib/text.c
==============================================================================
--- branches/dia-0-96/lib/text.c (original)
+++ branches/dia-0-96/lib/text.c Sun Mar 16 13:02:48 2008
@@ -884,6 +884,7 @@
text_delete_backward(text);
break;
case GDK_Return:
+ case GDK_KP_Enter:
return_val = TRUE;
*change = text_create_change(text, TYPE_SPLIT_ROW, 'Q',
text->cursor_pos, text->cursor_row);
Modified: branches/dia-0-96/objects/custom/custom_object.c
==============================================================================
--- branches/dia-0-96/objects/custom/custom_object.c (original)
+++ branches/dia-0-96/objects/custom/custom_object.c Sun Mar 16 13:02:48 2008
@@ -977,14 +977,13 @@
txs = text_get_string_copy(custom->text);
if ((tb.bottom+tb.top)/2 > elem->corner.y + elem->height)
- p.y = tb.top +
- dia_font_ascent(txs,custom->text->font, custom->text->height);
+ p.y = tb.top + text_get_ascent(custom->text);
else if ((tb.bottom+tb.top)/2 < elem->corner.y)
p.y = tb.bottom + custom->text->height * (custom->text->numlines - 1);
else
p.y = (tb.top + tb.bottom -
custom->text->height * custom->text->numlines) / 2 +
- dia_font_ascent(txs,custom->text->font, custom->text->height);
+ text_get_ascent(custom->text);
text_set_position(custom->text, &p);
g_free(txs);
}
@@ -1190,16 +1189,13 @@
/* align the text to be close to the shape ... */
if ((tb.bottom+tb.top)/2 > elem->corner.y + elem->height)
- p.y = tb.top +
- dia_font_ascent(text->string,
- text->object->font, text->object->height);
+ p.y = tb.top + text_get_ascent(text->object);
else if ((tb.bottom+tb.top)/2 < elem->corner.y)
p.y = tb.bottom + text->object->height * (text->object->numlines - 1);
else
p.y = (tb.top + tb.bottom -
text->object->height * text->object->numlines) / 2 +
- dia_font_ascent(text->string,
- text->object->font, text->object->height);
+ text_get_ascent(text->object);
text_set_position(text->object, &p);
return;
}
Modified: branches/dia-0-96/plug-ins/dxf/dxf-import.c
==============================================================================
--- branches/dia-0-96/plug-ins/dxf/dxf-import.c (original)
+++ branches/dia-0-96/plug-ins/dxf/dxf-import.c Sun Mar 16 13:02:48 2008
@@ -552,10 +552,7 @@
if( closed )
{
- ++points;
- p = g_realloc( p, sizeof( Point ) * points );
- p[points-1].x = p[0].x;
- p[points-1].y = p[0].y;
+ otype = object_get_type("Standard - Polygon");
}
pcd->num_points = points;
@@ -941,7 +938,7 @@
height = atof(data->value) * coord_scale * measure_scale;
/*printf( "text height %f\n", height );*/
break;
- case 62:
+ case 62:
colour = atoi(data->value);
text_colour.red = acad_pal[colour].r / 255.0;
text_colour.green = acad_pal[colour].g / 255.0;
@@ -994,7 +991,7 @@
} while(codedxf != 0);
setlocale(LC_NUMERIC,old_locale);
- location.y += y_offset * height;
+ location.y += y_offset * height;
text_obj = otype->ops->create(&location, otype->default_user_data,
&h1, &h2);
@@ -1010,6 +1007,7 @@
tprop->attr.position.y = location.y;
attributes_get_default_font(&tprop->attr.font, &tprop->attr.height);
+ tprop->attr.height = height;
tprop->attr.color = text_colour;
text_obj->ops->set_props(text_obj, props);
Modified: branches/dia-0-96/plug-ins/vdx/vdx-import.c
==============================================================================
--- branches/dia-0-96/plug-ins/vdx/vdx-import.c (original)
+++ branches/dia-0-96/plug-ins/vdx/vdx-import.c Sun Mar 16 13:02:48 2008
@@ -97,7 +97,11 @@
&h1, &h2);
props = prop_list_from_descs(vdx_line_prop_descs, pdtpp_true);
- g_assert(props->len == 4);
+ if (props->len != 4)
+ {
+ g_debug("create_standard_line() - props->len != 4");
+ return 0;
+ }
ptprop = g_ptr_array_index(props,0);
ptprop->point_data = points[0];
@@ -216,8 +220,12 @@
if (theDoc->Colors && i < theDoc->Colors->len)
return g_array_index(theDoc->Colors, Color, i);
}
- message_warning(_("Couldn't read color: %s\n"), s);
- g_debug("Couldn't read color: %s", s);
+ /* Colour 0 is always black, so don't warn (OmniGraffle) */
+ if (*s != '0')
+ {
+ message_warning(_("Couldn't read color: %s\n"), s);
+ g_debug("Couldn't read color: %s", s);
+ }
return c;
}
@@ -381,7 +389,13 @@
{
struct vdx_any *Any = (struct vdx_any *)p;
GSList *child;
- g_assert(p);
+
+ if (!p)
+ {
+ g_debug("find_child called with p=0");
+ return 0;
+ }
+
for(child = Any->children; child; child = child->next)
{
struct vdx_any *Any_child = (struct vdx_any *)child->data;
@@ -403,7 +417,12 @@
struct vdx_any *Any = (struct vdx_any *)p;
GSList *child;
gboolean found_given = FALSE;
- g_assert(p);
+
+ if (!p)
+ {
+ g_debug("find_child_next() called with p=0");
+ return 0;
+ }
for(child = Any->children; child; child = child->next)
{
struct vdx_any *Any_child = (struct vdx_any *)child->data;
@@ -448,14 +467,17 @@
{
struct vdx_StyleSheet theSheet;
struct vdx_any *Any;
- if (!theDoc->StyleSheets)
- {
- g_debug("Unknown stylesheet reference");
- return 0;
- }
while(1)
{
- g_assert(theDoc->StyleSheets && style < theDoc->StyleSheets->len);
+ if (!theDoc->StyleSheets || style >= theDoc->StyleSheets->len)
+ {
+ /* Ignore style 0 for OmniGraffle */
+ if (style)
+ {
+ g_debug("Unknown stylesheet reference: %d", style);
+ }
+ return 0;
+ }
theSheet = g_array_index(theDoc->StyleSheets,
struct vdx_StyleSheet, style);
Any = find_child(type, &theSheet);
@@ -486,7 +508,12 @@
struct vdx_Shape *Shape;
struct vdx_Shapes *SubShapes;
GSList *child;
- g_assert(Shapes);
+
+ if (!Shapes)
+ {
+ g_debug("get_shape_by_id() called with Shapes=0");
+ return 0;
+ }
/* A Master has a list of Shapes */
for(child = Shapes->children; child; child = child->next)
@@ -529,7 +556,12 @@
struct vdx_Master theMaster;
struct vdx_Shapes *Shapes;
- g_assert(master < theDoc->Masters->len);
+ if (!theDoc->Masters || master >= theDoc->Masters->len)
+ {
+ g_debug("Unknown master reference");
+ return 0;
+ }
+
if (theDoc->debug_comments)
g_debug("Looking for Master %d Shape %d", master, shape);
theMaster = g_array_index(theDoc->Masters,
@@ -586,7 +618,11 @@
ColorProperty *cprop = 0;
unsigned int debug_id;
- g_assert(props->len == 2);
+ if (props->len != 2)
+ {
+ g_debug("vdx_simple_properties() - props->len != 4");
+ return;
+ }
if (Line)
{
@@ -711,6 +747,12 @@
double sin_theta, cos_theta;
/* Remove the offset of the rotation pin from the object */
+ if (!XForm)
+ {
+ g_debug("apply_XForm() called with XForm=0");
+ return q;
+ }
+
q.x -= XForm->LocPinX;
q.y -= XForm->LocPinY;
@@ -771,6 +813,11 @@
double size = 0;
unsigned int type = 0;
+ if (!Line)
+ {
+ g_debug("make_arrow() called with Line=0");
+ return 0;
+ }
a->type = ARROW_FILLED_TRIANGLE;
if (start_end == 's')
@@ -823,17 +870,18 @@
struct vdx_ArcTo *ArcTo;
struct vdx_any *Any;
Point *points, p;
- unsigned int num_points = 0;
+ unsigned int num_points = 1;
unsigned int count = 0;
Arrow* start_arrow_p = NULL;
Arrow* end_arrow_p = NULL;
gboolean done = FALSE;
if (theDoc->debug_comments) g_debug("plot_polyline()");
- if ((Geom->NoFill || (Fill && !Fill->FillPattern)) &&
- (Geom->NoLine || (Line && !Line->LinePattern)))
+ if (!Geom || ((Geom->NoFill || (Fill && !Fill->FillPattern)) &&
+ (Geom->NoLine || (Line && !Line->LinePattern))))
{
*more = 0;
+ if (theDoc->debug_comments) g_debug("Nothing to plot");
return 0;
}
@@ -854,6 +902,12 @@
LineTo = (struct vdx_LineTo*)(item->data);
if (LineTo->Del) continue;
p.x = LineTo->X; p.y = LineTo->Y;
+ if (!count)
+ {
+ /* Use current as start point */
+ points[count++] =
+ dia_point(apply_XForm(*current, XForm), theDoc);
+ }
break;
case vdx_types_MoveTo:
MoveTo = (struct vdx_MoveTo*)(item->data);
@@ -867,11 +921,6 @@
done = TRUE;
break;
}
- else
- {
- num_points--;
- continue;
- }
}
break;
default:
@@ -908,7 +957,8 @@
if (count > 2)
{
- if (Geom->NoFill)
+ /* If we had to break the Geom partway, it's not a polygon */
+ if (Geom->NoFill || done)
{
/* Yes, it is end_arrow followed by start_arrow */
newobj = create_standard_polyline(count, points,
@@ -928,6 +978,7 @@
}
else
{
+ /* Don't plot lines with only one point */
if (theDoc->debug_comments)
g_debug("Empty polyline");
}
@@ -1017,6 +1068,12 @@
Point perp;
double length;
+ if (!EllipticalArcTo || !ArcTo || !Start)
+ {
+ g_debug("arc_to_ellipticalarc() called with null parameters");
+ return FALSE;
+ }
+
EllipticalArcTo->type = vdx_types_EllipticalArcTo;
EllipticalArcTo->children = 0;
@@ -1082,6 +1139,12 @@
double a, b, c, d, e, f, g; /* Scratch variables */
+ if (!p1 || !p2)
+ {
+ g_debug("ellipticalarc_to_bezier() called with null parameters");
+ return FALSE;
+ }
+
/* We assume the arc is not degenerate:
p0 != p4 != p3 != p0, 0 < D < infty
*/
@@ -1423,7 +1486,7 @@
if (!all_lines)
{
/* It's a Bezier */
- if (Geom->NoFill)
+ if (Geom && Geom->NoFill)
{
/* Yes, it is end then start arrow */
newobj = create_standard_bezierline(num_points, bezpoints,
@@ -1450,7 +1513,7 @@
if (count > 2)
{
- if (Geom->NoFill)
+ if (Geom && Geom->NoFill)
{
/* Yes, it is end_arrow followed by start_arrow */
newobj = create_standard_polyline(count, points,
@@ -1498,6 +1561,12 @@
{
float sum = 0.0;
+ if (! knot)
+ {
+ g_debug("NURBS_N() called with knot=0");
+ return sum;
+ }
+
if (k == 0)
{
if (knot[i] <= u && u < knot[i+1])
@@ -1542,7 +1611,13 @@
float bottom = 0;
unsigned int i;
float N_i_k;
- Point p;
+ Point p = {0, 0};
+
+ if (!knot || !weight || !control)
+ {
+ g_debug("NURBS_C() called with null parameters");
+ return p;
+ }
for(i=0; i<=n; i++)
{
@@ -1608,8 +1683,8 @@
unsigned int steps = 40;
float start_u, step_u;
- if(theDoc->debug_comments)
- g_debug("plot_nurbs()");
+ if (theDoc->debug_comments)
+ g_debug("plot_nurbs(), current x=%f y=%f", current->x, current->y);
item = *more;
Any = (struct vdx_any *)(item->data);
@@ -1620,6 +1695,8 @@
current->x = MoveTo->X;
current->y = MoveTo->Y;
begin = *current;
+ if (theDoc->debug_comments)
+ g_debug("MoveTo x=%f y=%f", begin.x, begin.y);
item = item->next;
Any = (struct vdx_any *)(item->data);
*more = item;
@@ -1627,6 +1704,7 @@
if (Any->type == vdx_types_NURBSTo)
{
+ if (theDoc->debug_comments) g_debug("NURBSTo");
NURBSTo = (struct vdx_NURBSTo*)(item->data);
/* E holds the NURBS formula */
@@ -1688,25 +1766,25 @@
i = 0;
while(c && *c && i < n)
{
- g_assert(c);
+ if (!c) break;
control[i].x = atof(++c);
current->x = control[i].x;
/* xType = 0 means X is proportion of Width */
if (xType == 0) control[i].x *= XForm->Width;
c = strchr(c, ',');
- g_assert(c);
+ if (!c) break;
control[i].y = atof(++c);
current->y = control[i].y;
/* yType = 0 means Y is proportion of Height */
if (yType == 0) control[i].y *= XForm->Height;
c = strchr(c, ',');
- g_assert(c);
+ if (!c) break;
knot[i] = atof(++c);
c = strchr(c, ',');
- g_assert(c);
+ if (!c) break;
weight[i] = atof(++c);
c = strchr(c, ',');
i++;
@@ -1717,6 +1795,7 @@
{
if (Any->type == vdx_types_SplineStart)
{
+ if (theDoc->debug_comments) g_debug("SplineStart");
SplineStart = (struct vdx_SplineStart*)(item->data);
item2 = item;
n = 1;
@@ -1829,7 +1908,8 @@
{
points[num_points-1] = dia_point(apply_XForm(end, XForm), theDoc);
if (theDoc->debug_comments)
- g_debug("Point %d VDX x=%f y=%f", num_points-1, end.x, end.y);
+ g_debug("End Point %d VDX x=%f y=%f", num_points-1, end.x, end.y);
+ *current = end;
}
if (theDoc->debug_comments)
@@ -1875,6 +1955,12 @@
char buf[4]; /* For 4 decoded 6-bit chunks */
unsigned int buf_len = 0;
+ if (!filename || !b64)
+ {
+ g_debug("write_base64_file() called with null parameters");
+ return;
+ }
+
f = g_fopen(filename, "w+b");
if (!f)
{
@@ -2068,6 +2154,7 @@
{
const GSList *item;
gboolean all_lines = TRUE; /* Flag for line/polyline */
+ gboolean has_nurbs = FALSE; /* Flag for NURBS */
unsigned int num_steps = 0; /* Flag for poly */
struct vdx_any *last_point = 0;
unsigned int dia_type_choice = vdx_dia_any;
@@ -2076,7 +2163,7 @@
struct vdx_ArcTo *ArcTo;
/* Is it disabled? */
- if (Geom->NoShow)
+ if (!Geom || Geom->NoShow)
{
if (theDoc->debug_comments)
g_debug("NoShow");
@@ -2103,6 +2190,11 @@
if (ArcTo->Del) continue;
all_lines = FALSE;
break;
+ case vdx_types_NURBSTo:
+ case vdx_types_SplineKnot:
+ has_nurbs = TRUE;
+ all_lines = FALSE;
+ break;
default:
all_lines = FALSE;
}
@@ -2141,7 +2233,7 @@
if (Geom->NoFill) { dia_type_choice = vdx_dia_bezier; }
else { dia_type_choice = vdx_dia_beziergon; }
/* Unless it's a spline */
- if (last_point->type == vdx_types_SplineKnot)
+ if (last_point->type == vdx_types_SplineKnot || has_nurbs)
dia_type_choice = vdx_dia_nurbs;
}
@@ -2203,8 +2295,13 @@
double height;
char *font_name = 0;
DiaFontStyle style = 0;
+ DiaFont *font = 0;
- if (!Char || !text) { g_debug("Not enough info for text"); return 0; }
+ if (!Text || !Char || !text || !XForm)
+ {
+ g_debug("Not enough info for text");
+ return 0;
+ }
p.x = 0; p.y = 0;
/* Setup position for horizontal alignment */
@@ -2316,11 +2413,17 @@
font_name = FaceName.Name;
}
}
- tprop->attr.font = dia_font_new(font_name, style, height);
+
+ font = dia_font_new_from_legacy_name(font_name);
+ dia_font_set_weight(font, DIA_FONT_STYLE_GET_WEIGHT(style));
+ dia_font_set_slant(font, DIA_FONT_STYLE_GET_SLANT(style));
+ dia_font_set_height(font, height);
+ tprop->attr.font = font;
+
if (theDoc->debug_comments)
- g_debug("Text: %s at %f,%f v=%d h=%d s=%.2x",
+ g_debug("Text: %s at %f,%f v=%d h=%d s=%.2x f=%s",
tprop->text_data, p.x, p.y,
- eprop->enum_data, tprop->attr.alignment, style);
+ eprop->enum_data, tprop->attr.alignment, style, font_name);
tprop->attr.height = height;
tprop->attr.color = Char->Color;
@@ -2359,6 +2462,11 @@
const GSList *more = 0;
Point current = {0, 0};
+ if (!Shape)
+ {
+ g_debug("vdx_plot_shape() called with Shape=0");
+ return 0;
+ }
theDoc->shape_id = Shape->ID;
if (Shape->Del)
{
@@ -2701,6 +2809,12 @@
/* What layers are on this page? */
+ if (!PageSheet)
+ {
+ g_debug("vdx_setup_layers() called with PageSheet=0");
+ return;
+ }
+
for (child = PageSheet->children; child; child = child->next)
{
if (!child || !child->data) continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]