a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * SVG <inkscape:tag> implementation
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Theodore Janeczko
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Liam P. White
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Copyright (C) Theodore Janeczko 2012-2014 <flutterguy317@gmail.com>
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Released under GNU GPL, read the file 'COPYING' for more information
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Move this SPItem into or after another SPItem in the doc
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * \param target - the SPItem to move into or after
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * \param intoafter - move to after the target (false), move inside (sublayer) of the target (true)
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. Whitevoid SPTag::moveTo(SPObject *target, gboolean intoafter) {
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL );
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White // Move to ourself ignore
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White // Assume move to the "first" in the top node, find the top node
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White while (target_ref->parent() != target_ref->root()) {
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White // Move this inside of the target at the end
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White } else if (target_ref->parent() != our_ref->parent()) {
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White // Change in parent, need to remove and add
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White target_ref->parent()->addChild(our_ref, target_ref);
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White } else if (!first) {
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White // Same parent, just move
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White our_ref->parent()->changeOrder(our_ref, target_ref);
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Reads the Inkscape::XML::Node, and initializes SPTag variables. For this to get called,
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * our name must be associated with a repr via "sp_object_type_register". Best done through
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * sp-object-repr.cpp's repr_name_entries array.
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. WhiteSPTag::build(SPDocument *document, Inkscape::XML::Node *repr)
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Sets a specific value in the SPTag.
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. WhiteSPTag::set(unsigned int key, gchar const *value)
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White //if ( _expanded != isexpanded ){
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Receives update notifications.
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG |
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White /* do something to trigger redisplay, updates? */
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White * Writes its settings to an incoming repr object, if any.
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. WhiteSPTag::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White // Inkscape-only object, not copied during an "plain SVG" dump:
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White repr->setAttribute("inkscape:expanded", "true");
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White repr->setAttribute("inkscape:expanded", NULL);
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White Local Variables:
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White c-file-style:"stroustrup"
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White indent-tabs-mode:nil
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White fill-column:99
a73b1f7fc9a9ba7e0d68f33292a885da6c2981d0Liam P. White// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :