~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/xml/repr-util.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <math.h>
21
21
 
22
22
#if HAVE_STRING_H
23
 
# include <string.h>
 
23
# include <cstring>
24
24
#endif
25
25
 
26
26
#if HAVE_STDLIB_H
27
 
# include <stdlib.h>
 
27
# include <cstdlib>
28
28
#endif
29
29
 
30
30
 
149
149
static void
150
150
sp_xml_ns_register_defaults()
151
151
{
152
 
    static SPXMLNs defaults[9];
 
152
    static SPXMLNs defaults[10];
153
153
 
154
154
    defaults[0].uri = g_quark_from_static_string(SP_SODIPODI_NS_URI);
155
155
    defaults[0].prefix = g_quark_from_static_string("sodipodi");
194
194
 
195
195
    defaults[8].uri = g_quark_from_static_string("http://inkscape.sourceforge.net/DTD/s odipodi-0.dtd");
196
196
    defaults[8].prefix = g_quark_from_static_string("sodipodi");
197
 
    defaults[8].next = NULL;
 
197
    defaults[8].next = &defaults[9];
 
198
 
 
199
    // This namespace URI is being phased out by Creative Commons
 
200
 
 
201
    defaults[9].uri = g_quark_from_static_string(SP_OLD_CC_NS_URI);
 
202
    defaults[9].prefix = g_quark_from_static_string("cc");
 
203
    defaults[9].next = NULL;
198
204
 
199
205
    namespaces = &defaults[0];
200
206
}
570
576
    return true;
571
577
}
572
578
 
 
579
unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point val)
 
580
{
 
581
    g_return_val_if_fail(repr != NULL, FALSE);
 
582
    g_return_val_if_fail(key != NULL, FALSE);
 
583
 
 
584
    Inkscape::SVGOStringStream os;
 
585
    os << val[Geom::X] << "," << val[Geom::Y];
 
586
 
 
587
    repr->setAttribute(key, os.str().c_str());
 
588
    return true;
 
589
}
 
590
 
 
591
unsigned int
 
592
sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val)
 
593
{
 
594
    g_return_val_if_fail(repr != NULL, FALSE);
 
595
    g_return_val_if_fail(key != NULL, FALSE);
 
596
    g_return_val_if_fail(val != NULL, FALSE);
 
597
 
 
598
    gchar const *v = repr->attribute(key);
 
599
 
 
600
    gchar ** strarray = g_strsplit(v, ",", 2);
 
601
 
 
602
    if (strarray && strarray[0] && strarray[1]) {
 
603
        double newx, newy;
 
604
        newx = g_ascii_strtod(strarray[0], NULL);
 
605
        newy = g_ascii_strtod(strarray[1], NULL);
 
606
        g_strfreev (strarray);
 
607
        *val = Geom::Point(newx, newy);
 
608
        return TRUE;
 
609
    }
 
610
 
 
611
    g_strfreev (strarray);
 
612
    return FALSE;
 
613
}
573
614
 
574
615
/*
575
616
  Local Variables: