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

« back to all changes in this revision

Viewing changes to src/sp-use.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:
16
16
#ifdef HAVE_CONFIG_H
17
17
# include <config.h>
18
18
#endif
 
19
 
 
20
#include <cstring>
 
21
#include <string>
 
22
 
19
23
#include <libnr/nr-matrix-ops.h>
20
24
#include <libnr/nr-matrix-fns.h>
21
25
#include "libnr/nr-matrix-translate-ops.h"
48
52
static void sp_use_modified(SPObject *object, guint flags);
49
53
 
50
54
static void sp_use_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags);
 
55
static void sp_use_snappoints(SPItem const *item, SnapPointsIter p);
51
56
static void sp_use_print(SPItem *item, SPPrintContext *ctx);
52
57
static gchar *sp_use_description(SPItem *item);
53
58
static NRArenaItem *sp_use_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags);
107
112
    item_class->print = sp_use_print;
108
113
    item_class->show = sp_use_show;
109
114
    item_class->hide = sp_use_hide;
 
115
    item_class->snappoints = sp_use_snappoints;
110
116
}
111
117
 
112
118
static void
241
247
    SPUse *use = SP_USE(object);
242
248
 
243
249
    if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
244
 
        repr = sp_repr_new("svg:use");
 
250
        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
 
251
        repr = xml_doc->createElement("svg:use");
245
252
    }
246
253
 
247
254
    if (((SPObjectClass *) (parent_class))->write) {
444
451
 * clone's transform.
445
452
 */
446
453
static void
447
 
sp_use_move_compensate(NR::Matrix const *mp, SPItem *original, SPUse *self)
 
454
sp_use_move_compensate(NR::Matrix const *mp, SPItem */*original*/, SPUse *self)
448
455
{
449
456
    // the clone is orphaned; or this is not a real use, but a clone of another use;
450
457
    // we skip it, otherwise duplicate compensation will occur
494
501
}
495
502
 
496
503
static void
497
 
sp_use_href_changed(SPObject *old_ref, SPObject *ref, SPUse *use)
 
504
sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use)
498
505
{
499
506
    SPItem *item = SP_ITEM(use);
500
507
 
535
542
}
536
543
 
537
544
static void
538
 
sp_use_delete_self(SPObject *deleted, SPUse *self)
 
545
sp_use_delete_self(SPObject */*deleted*/, SPUse *self)
539
546
{
540
547
    // always delete uses which are used in flowtext
541
548
    if (SP_OBJECT_PARENT(self) && SP_IS_FLOWREGION(SP_OBJECT_PARENT(self))) {
652
659
 
653
660
    Inkscape::XML::Node *parent = sp_repr_parent(repr);
654
661
    SPDocument *document = SP_OBJECT(use)->document;
 
662
    Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
655
663
 
656
664
    // Track the ultimate source of a chain of uses.
657
665
    SPItem *orig = sp_use_root(use);
661
669
 
662
670
    Inkscape::XML::Node *copy = NULL;
663
671
    if (SP_IS_SYMBOL(orig)) { // make a group, copy children
664
 
        copy = sp_repr_new("svg:g");
 
672
        copy = xml_doc->createElement("svg:g");
665
673
        for (Inkscape::XML::Node *child = SP_OBJECT_REPR(orig)->firstChild() ; child != NULL; child = child->next()) {
666
 
                Inkscape::XML::Node *newchild = child->duplicate();
 
674
                Inkscape::XML::Node *newchild = child->duplicate(xml_doc);
667
675
                copy->appendChild(newchild);
668
676
        }
669
677
    } else { // just copy
670
 
        copy = SP_OBJECT_REPR(orig)->duplicate();
 
678
        copy = SP_OBJECT_REPR(orig)->duplicate(xml_doc);
671
679
    }
672
680
 
673
681
    // Add the duplicate repr just after the existing one.
725
733
    return ref;
726
734
}
727
735
 
 
736
static void
 
737
sp_use_snappoints(SPItem const *item, SnapPointsIter p)
 
738
{
 
739
    g_assert (item != NULL);
 
740
    g_assert (SP_IS_ITEM(item));
 
741
    g_assert (SP_IS_USE(item));
 
742
    
 
743
    SPUse *use = SP_USE(item);
 
744
    SPItem *root = sp_use_root(use);
 
745
    
 
746
    SPItemClass const &item_class = *(SPItemClass const *) G_OBJECT_GET_CLASS(root);
 
747
    if (item_class.snappoints) {
 
748
        item_class.snappoints(root, p);
 
749
    }
 
750
}
 
751
 
728
752
 
729
753
/*
730
754
  Local Variables: