summaryrefslogtreecommitdiffstats
path: root/src/sp-tag-use-reference.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-01-30 08:33:01 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-01-30 08:33:01 +0000
commit267299811df952d08324a39008f52c19641de9e0 (patch)
tree28fef736a52cb7a72119d119be8eb663ad20a77f /src/sp-tag-use-reference.cpp
parentTranslations: update inkscape.pot (diff)
downloadinkscape-267299811df952d08324a39008f52c19641de9e0.tar.gz
inkscape-267299811df952d08324a39008f52c19641de9e0.zip
Move classes derived from SPObject to own directory.
A lot of header clean-up.
Diffstat (limited to 'src/sp-tag-use-reference.cpp')
-rw-r--r--src/sp-tag-use-reference.cpp137
1 files changed, 0 insertions, 137 deletions
diff --git a/src/sp-tag-use-reference.cpp b/src/sp-tag-use-reference.cpp
deleted file mode 100644
index bb03c120a..000000000
--- a/src/sp-tag-use-reference.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * The reference corresponding to href of <inkscape:tagref> element.
- *
- * Copyright (C) Theodore Janeczko 2012-2014 <flutterguy317@gmail.com>
- *
- * Released under GNU GPL, read the file 'COPYING' for more information.
- */
-
-#include "sp-tag-use-reference.h"
-
-#include <cstring>
-#include <string>
-
-#include "bad-uri-exception.h"
-#include "livarot/Path.h"
-#include "preferences.h"
-#include "sp-shape.h"
-#include "sp-text.h"
-#include "uri.h"
-
-
-bool SPTagUseReference::_acceptObject(SPObject * const obj) const
-{
- if (SP_IS_ITEM(obj)) {
- return URIReference::_acceptObject(obj);
- } else {
- return false;
- }
-}
-
-
-static void sp_usepath_href_changed(SPObject *old_ref, SPObject *ref, SPTagUsePath *offset);
-static void sp_usepath_delete_self(SPObject *deleted, SPTagUsePath *offset);
-
-SPTagUsePath::SPTagUsePath(SPObject* i_owner):SPTagUseReference(i_owner)
-{
- owner=i_owner;
- originalPath = NULL;
- sourceDirty=false;
- sourceHref = NULL;
- sourceRepr = NULL;
- sourceObject = NULL;
- _changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_usepath_href_changed), this)); // listening to myself, this should be virtual instead
-
- user_unlink = NULL;
-}
-
-SPTagUsePath::~SPTagUsePath(void)
-{
- delete originalPath;
- originalPath = NULL;
-
- _changed_connection.disconnect(); // to do before unlinking
-
- quit_listening();
- unlink();
-}
-
-void
-SPTagUsePath::link(char *to)
-{
- if ( to == NULL ) {
- quit_listening();
- unlink();
- } else {
- if ( !sourceHref || ( strcmp(to, sourceHref) != 0 ) ) {
- g_free(sourceHref);
- sourceHref = g_strdup(to);
- try {
- attach(Inkscape::URI(to));
- } catch (Inkscape::BadURIException &e) {
- /* TODO: Proper error handling as per
- * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing.
- */
- g_warning("%s", e.what());
- detach();
- }
- }
- }
-}
-
-void
-SPTagUsePath::unlink(void)
-{
- g_free(sourceHref);
- sourceHref = NULL;
- detach();
-}
-
-void
-SPTagUsePath::start_listening(SPObject* to)
-{
- if ( to == NULL ) {
- return;
- }
- sourceObject = to;
- sourceRepr = to->getRepr();
- _delete_connection = to->connectDelete(sigc::bind(sigc::ptr_fun(&sp_usepath_delete_self), this));
-}
-
-void
-SPTagUsePath::quit_listening(void)
-{
- if ( sourceObject == NULL ) {
- return;
- }
- _delete_connection.disconnect();
- sourceRepr = NULL;
- sourceObject = NULL;
-}
-
-static void
-sp_usepath_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPTagUsePath *offset)
-{
- offset->quit_listening();
- SPItem *refobj = offset->getObject();
- if ( refobj ) {
- offset->start_listening(refobj);
- }
-}
-
-static void
-sp_usepath_delete_self(SPObject */*deleted*/, SPTagUsePath *offset)
-{
- offset->owner->deleteObject();
-}
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :