~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/extension/patheffect.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Authors:
 
3
 *   Ted Gould <ted@gould.cx>
 
4
 *
 
5
 * Copyright (C) 2006 Authors
 
6
 *
 
7
 * Released under GNU GPL, read the file 'COPYING' for more information
 
8
 */
 
9
 
 
10
#include "document-private.h"
 
11
#include "sp-object.h"
 
12
 
 
13
#include "patheffect.h"
 
14
#include "db.h"
 
15
 
 
16
namespace Inkscape {
 
17
namespace Extension {
 
18
 
 
19
PathEffect::PathEffect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp)
 
20
    : Extension(in_repr, in_imp)
 
21
{
 
22
 
 
23
}
 
24
 
 
25
PathEffect::~PathEffect (void)
 
26
{
 
27
 
 
28
}
 
29
 
 
30
void
 
31
PathEffect::processPath (SPDocument * /*doc*/, Inkscape::XML::Node * /*path*/, Inkscape::XML::Node * /*def*/)
 
32
{
 
33
 
 
34
 
 
35
}
 
36
 
 
37
void
 
38
PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path)
 
39
{
 
40
    gchar const * patheffectlist = path->attribute("inkscape:path-effects");
 
41
    if (patheffectlist == NULL)
 
42
        return;
 
43
 
 
44
    gchar ** patheffects = g_strsplit(patheffectlist, ";", 128);
 
45
    Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc));
 
46
 
 
47
    for (int i = 0; patheffects[i] != NULL && i < 128; i++) {
 
48
        gchar * patheffect = patheffects[i];
 
49
 
 
50
        // This is weird, they should all be references... but anyway
 
51
        if (patheffect[0] != '#') continue;
 
52
 
 
53
        Inkscape::XML::Node * prefs = sp_repr_lookup_child(defs, "id", &(patheffect[1]));
 
54
        if (prefs == NULL) {
 
55
 
 
56
            continue;
 
57
        }
 
58
 
 
59
        gchar const * ext_id = prefs->attribute("extension");
 
60
        if (ext_id == NULL) {
 
61
 
 
62
            continue;
 
63
        }
 
64
 
 
65
        Inkscape::Extension::PathEffect * peffect;
 
66
        peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id));
 
67
        if (peffect != NULL) {
 
68
 
 
69
            continue;
 
70
        }
 
71
 
 
72
        peffect->processPath(doc, path, prefs);
 
73
    }
 
74
 
 
75
    g_strfreev(patheffects);
 
76
    return;
 
77
}
 
78
 
 
79
 
 
80
} }  /* namespace Inkscape, Extension */
 
81
 
 
82
/*
 
83
  Local Variables:
 
84
  mode:c++
 
85
  c-file-style:"stroustrup"
 
86
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
87
  indent-tabs-mode:nil
 
88
  fill-column:99
 
89
  End:
 
90
*/
 
91
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :