~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/sp-spiral.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "display/curve.h"
24
24
#include <glibmm/i18n.h>
25
25
#include "xml/repr.h"
 
26
#include "document.h"
26
27
 
27
28
#include "sp-spiral.h"
28
29
 
36
37
 
37
38
static gchar * sp_spiral_description (SPItem * item);
38
39
static void sp_spiral_snappoints(SPItem const *item, SnapPointsIter p);
 
40
 
39
41
static void sp_spiral_set_shape (SPShape *shape);
 
42
static void sp_spiral_update_patheffect (SPShape *shape, bool write);
40
43
 
41
44
static NR::Point sp_spiral_get_tangent (SPSpiral const *spiral, gdouble t);
42
45
 
94
97
        item_class->description = sp_spiral_description;
95
98
        item_class->snappoints = sp_spiral_snappoints;
96
99
 
97
 
        shape_class->set_shape = sp_spiral_set_shape;
 
100
    shape_class->set_shape = sp_spiral_set_shape;
 
101
    shape_class->update_patheffect = sp_spiral_update_patheffect;
98
102
}
99
103
 
100
104
/**
139
143
        SPSpiral *spiral = SP_SPIRAL (object);
140
144
 
141
145
        if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
142
 
                repr = sp_repr_new ("svg:path");
 
146
                Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
 
147
                repr = xml_doc->createElement("svg:path");
143
148
        }
144
149
 
145
150
        if (flags & SP_OBJECT_WRITE_EXT) {
291
296
                ((SPObjectClass *) parent_class)->update (object, ctx, flags);
292
297
}
293
298
 
 
299
static void
 
300
sp_spiral_update_patheffect(SPShape *shape, bool write)
 
301
{
 
302
    sp_spiral_set_shape(shape);
 
303
 
 
304
    if (write) {
 
305
        Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
 
306
        if ( shape->curve != NULL ) {
 
307
            NArtBpath *abp = sp_curve_first_bpath(shape->curve);
 
308
            if (abp) {
 
309
                gchar *str = sp_svg_write_path(abp);
 
310
                repr->setAttribute("d", str);
 
311
                g_free(str);
 
312
            } else {
 
313
                repr->setAttribute("d", "");
 
314
            }
 
315
        } else {
 
316
            repr->setAttribute("d", NULL);
 
317
        }
 
318
    }
 
319
 
 
320
    ((SPObject *)shape)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 
321
}
 
322
 
294
323
/**
295
324
 * Return textual description of spiral.
296
325
 */
434
463
                sp_spiral_fit_and_draw (spiral, c, (1.0 - t)/(SAMPLE_SIZE - 1.0),
435
464
                                        darray, hat1, hat2, &t);
436
465
 
437
 
        sp_shape_set_curve_insync ((SPShape *) spiral, c, TRUE);
438
 
        sp_curve_unref (c);
 
466
    sp_shape_perform_path_effect(c, SP_SHAPE (spiral));
 
467
    sp_shape_set_curve_insync ((SPShape *) spiral, c, TRUE);
 
468
    sp_curve_unref (c);
439
469
}
440
470
 
441
471
/**