diff options
| author | Jabiertxof <jtx@jtx> | 2017-01-02 20:18:59 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-01-02 20:18:59 +0000 |
| commit | ea0de461574893c3b21e4653d0185cec501e0efe (patch) | |
| tree | 14f010634714b3f26ca1b75245c237bafe9e8e85 /src/live_effects/parameter | |
| parent | Fixing paths (diff) | |
| download | inkscape-ea0de461574893c3b21e4653d0185cec501e0efe.tar.gz inkscape-ea0de461574893c3b21e4653d0185cec501e0efe.zip | |
Remove clone original code
(bzr r15295.1.47)
Diffstat (limited to 'src/live_effects/parameter')
| -rw-r--r-- | src/live_effects/parameter/item-reference.cpp | 44 | ||||
| -rw-r--r-- | src/live_effects/parameter/item-reference.h | 56 | ||||
| -rw-r--r-- | src/live_effects/parameter/item.cpp | 246 | ||||
| -rw-r--r-- | src/live_effects/parameter/item.h | 79 | ||||
| -rw-r--r-- | src/live_effects/parameter/originalitem.cpp | 148 | ||||
| -rw-r--r-- | src/live_effects/parameter/originalitem.h | 49 |
6 files changed, 0 insertions, 622 deletions
diff --git a/src/live_effects/parameter/item-reference.cpp b/src/live_effects/parameter/item-reference.cpp deleted file mode 100644 index a775d93b7..000000000 --- a/src/live_effects/parameter/item-reference.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The reference corresponding to href of LPE Item parameter. - * - * Copyright (C) 2008 Johan Engelen - * - * Released under GNU GPL, read the file 'COPYING' for more information. - */ - -#include "live_effects/parameter/item-reference.h" - -#include "sp-shape.h" -#include "sp-text.h" -#include "sp-item-group.h" - -namespace Inkscape { -namespace LivePathEffect { - -bool ItemReference::_acceptObject(SPObject * const obj) const -{ - if (SP_IS_SHAPE(obj) || SP_IS_TEXT(obj) || SP_IS_GROUP(obj)) { - /* Refuse references to lpeobject */ - if (obj == getOwner()) { - return false; - } - // TODO: check whether the referred item has this LPE applied, if so: deny deny deny! - return URIReference::_acceptObject(obj); - } else { - return false; - } -} - -} // namespace LivePathEffect -} // namespace Inkscape - -/* - 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 : diff --git a/src/live_effects/parameter/item-reference.h b/src/live_effects/parameter/item-reference.h deleted file mode 100644 index 91231455a..000000000 --- a/src/live_effects/parameter/item-reference.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef SEEN_LPE_ITEM_REFERENCE_H -#define SEEN_LPE_ITEM_REFERENCE_H - -/* - * Copyright (C) 2008-2012 Authors - * Authors: Johan Engelen - * Abhishek Sharma - * - * Released under GNU GPL, read the file 'COPYING' for more information. - */ - -#include <uri-references.h> - -class SPItem; -namespace Inkscape { -namespace XML { class Node; } - -namespace LivePathEffect { - -/** - * The reference corresponding to href of LPE ItemParam. - */ -class ItemReference : public Inkscape::URIReference { -public: - ItemReference(SPObject *owner) : URIReference(owner) {} - - SPItem *getObject() const { - return (SPItem *)URIReference::getObject(); - } - -protected: - virtual bool _acceptObject(SPObject * const obj) const; - -private: - ItemReference(const ItemReference&); - ItemReference& operator=(const ItemReference&); -}; - -} // namespace LivePathEffect - -} // namespace Inkscape - - - -#endif /* !SEEN_LPE_PATH_REFERENCE_H */ - -/* - 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 : diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp deleted file mode 100644 index 8caea4e26..000000000 --- a/src/live_effects/parameter/item.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl> - * Abhishek Sharma - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "ui/widget/point.h" -#include <glibmm/i18n.h> - -#include "live_effects/parameter/item.h" -#include "live_effects/effect.h" -#include "svg/svg.h" - -#include "widgets/icon.h" -#include <gtk/gtk.h> -#include "selection-chemistry.h" -#include "xml/repr.h" -#include "desktop.h" -#include "inkscape.h" -#include "message-stack.h" - -// clipboard support -#include "ui/clipboard.h" -// required for linking to other paths -#include "uri.h" - -#include <gtkmm/button.h> -#include <gtkmm/label.h> -#include "ui/icon-names.h" - -namespace Inkscape { - -namespace LivePathEffect { - -ItemParam::ItemParam( const Glib::ustring& label, const Glib::ustring& tip, - const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, const gchar * default_value) - : Parameter(label, tip, key, wr, effect), - changed(true), - href(NULL), - ref( (SPObject*)effect->getLPEObj() ) -{ - defvalue = g_strdup(default_value); - ref_changed_connection = ref.changedSignal().connect(sigc::mem_fun(*this, &ItemParam::ref_changed)); -} - -ItemParam::~ItemParam() -{ - remove_link(); - g_free(defvalue); -} - -void -ItemParam::param_set_default() -{ - param_readSVGValue(defvalue); -} - - -void -ItemParam::param_set_and_write_default() -{ - param_write_to_repr(defvalue); -} - -bool -ItemParam::param_readSVGValue(const gchar * strvalue) -{ - if (strvalue) { - remove_link(); - if (strvalue[0] == '#') { - if (href) - g_free(href); - href = g_strdup(strvalue); - try { - ref.attach(Inkscape::URI(href)); - //lp:1299948 - SPItem* i = ref.getObject(); - if (i) { - linked_modified_callback(i, SP_OBJECT_MODIFIED_FLAG); - } // else: document still processing new events. Repr of the linked object not created yet. - } catch (Inkscape::BadURIException &e) { - g_warning("%s", e.what()); - ref.detach(); - } - } - emit_changed(); - return true; - } - - return false; -} - -gchar * -ItemParam::param_getSVGValue() const -{ - return g_strdup(href); -} - -Gtk::Widget * -ItemParam::param_newWidget() -{ - Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox()); - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) ); - Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); - Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); - pLabel->set_tooltip_text(param_tooltip); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &ItemParam::on_link_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Link to item on clipboard")); - - static_cast<Gtk::HBox*>(_widget)->show_all_children(); - - return dynamic_cast<Gtk::Widget *> (_widget); -} - -void -ItemParam::emit_changed() -{ - changed = true; - signal_item_changed.emit(); -} - - -void -ItemParam::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathVector> &hp_vec) -{ -} - - -void -ItemParam::start_listening(SPObject * to) -{ - if ( to == NULL ) { - return; - } - linked_delete_connection = to->connectDelete(sigc::mem_fun(*this, &ItemParam::linked_delete)); - linked_modified_connection = to->connectModified(sigc::mem_fun(*this, &ItemParam::linked_modified)); - if (SP_IS_ITEM(to)) { - linked_transformed_connection = SP_ITEM(to)->connectTransformed(sigc::mem_fun(*this, &ItemParam::linked_transformed)); - } - linked_modified(to, SP_OBJECT_MODIFIED_FLAG); // simulate linked_modified signal, so that path data is updated -} - -void -ItemParam::quit_listening(void) -{ - linked_modified_connection.disconnect(); - linked_delete_connection.disconnect(); - linked_transformed_connection.disconnect(); -} - -void -ItemParam::ref_changed(SPObject */*old_ref*/, SPObject *new_ref) -{ - quit_listening(); - if ( new_ref ) { - start_listening(new_ref); - } -} - -void -ItemParam::remove_link() -{ - if (href) { - ref.detach(); - g_free(href); - href = NULL; - } -} - -void -ItemParam::linked_delete(SPObject */*deleted*/) -{ - quit_listening(); - remove_link(); -} - -void ItemParam::linked_modified(SPObject *linked_obj, guint flags) -{ - linked_modified_callback(linked_obj, flags); -} - -void ItemParam::linked_transformed(Geom::Affine const *rel_transf, SPItem *moved_item) -{ - linked_transformed_callback(rel_transf, moved_item); -} - -void -ItemParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/) -{ - emit_changed(); - SP_OBJECT(param_effect->getLPEObj())->requestModified(SP_OBJECT_MODIFIED_FLAG); -} - -void -ItemParam::on_link_button_click() -{ - Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); - const gchar * iid = cm->getFirstObjectID(); - if (!iid) { - return; - } - - Glib::ustring itemid(iid); - - if (itemid.empty()) { - return; - } - - // add '#' at start to make it an uri. - itemid.insert(itemid.begin(), '#'); - if ( href && strcmp(itemid.c_str(), href) == 0 ) { - // no change, do nothing - return; - } else { - // TODO: - // check if id really exists in document, or only in clipboard document: if only in clipboard then invalid - // check if linking to object to which LPE is applied (maybe delegated to PathReference - - param_write_to_repr(itemid.c_str()); - DocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, - _("Link item parameter to path")); - } -} - -} /* namespace LivePathEffect */ - -} /* namespace Inkscape */ - -/* - 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 : diff --git a/src/live_effects/parameter/item.h b/src/live_effects/parameter/item.h deleted file mode 100644 index 6c719d451..000000000 --- a/src/live_effects/parameter/item.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_ITEM_H -#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_ITEM_H - -/* - * Inkscape::LivePathEffectParameters - * -* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl> - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include <glib.h> - - -#include "live_effects/parameter/parameter.h" -#include "live_effects/parameter/item-reference.h" -#include <stddef.h> -#include <sigc++/sigc++.h> - -namespace Inkscape { - -namespace LivePathEffect { - -class ItemParam : public Parameter { -public: - ItemParam ( const Glib::ustring& label, - const Glib::ustring& tip, - const Glib::ustring& key, - Inkscape::UI::Widget::Registry* wr, - Effect* effect, - const gchar * default_value = ""); - virtual ~ItemParam(); - virtual Gtk::Widget * param_newWidget(); - - virtual bool param_readSVGValue(const gchar * strvalue); - virtual gchar * param_getSVGValue() const; - - virtual void param_set_default(); - void param_set_and_write_default(); - virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec); - - sigc::signal <void> signal_item_pasted; - sigc::signal <void> signal_item_changed; - bool changed; /* this gets set whenever the path is changed (this is set to true, and then the signal_item_changed signal is emitted). - * the user must set it back to false if she wants to use it sensibly */ -protected: - - gchar * href; // contains link to other object, e.g. "#path2428", NULL if ItemParam contains pathdata itself - ItemReference ref; - sigc::connection ref_changed_connection; - sigc::connection linked_delete_connection; - sigc::connection linked_modified_connection; - sigc::connection linked_transformed_connection; - void ref_changed(SPObject *old_ref, SPObject *new_ref); - void remove_link(); - void start_listening(SPObject * to); - void quit_listening(void); - void linked_delete(SPObject *deleted); - void linked_modified(SPObject *linked_obj, guint flags); - void linked_transformed(Geom::Affine const *rel_transf, SPItem *moved_item); - virtual void linked_modified_callback(SPObject *linked_obj, guint flags); - virtual void linked_transformed_callback(Geom::Affine const * /*rel_transf*/, SPItem * /*moved_item*/) {}; - void on_link_button_click(); - - void emit_changed(); - - gchar * defvalue; - -private: - ItemParam(const ItemParam&); - ItemParam& operator=(const ItemParam&); -}; - - -} //namespace LivePathEffect - -} //namespace Inkscape - -#endif diff --git a/src/live_effects/parameter/originalitem.cpp b/src/live_effects/parameter/originalitem.cpp deleted file mode 100644 index 07c8bd27c..000000000 --- a/src/live_effects/parameter/originalitem.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) Johan Engelen 2012 <j.b.c.engelen@alumnus.utwente.nl> - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gtkmm/box.h> -#include "live_effects/parameter/originalitem.h" - -#include "widgets/icon.h" -#include <glibmm/i18n.h> -#include <gtkmm/button.h> -#include <gtkmm/label.h> - -#include "uri.h" -#include "sp-shape.h" -#include "sp-text.h" -#include "display/curve.h" -#include "live_effects/effect.h" - -#include "inkscape.h" -#include "desktop.h" -#include "selection.h" -#include "ui/icon-names.h" - -namespace Inkscape { - -namespace LivePathEffect { - -OriginalItemParam::OriginalItemParam( const Glib::ustring& label, const Glib::ustring& tip, - const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect) - : ItemParam(label, tip, key, wr, effect, "") -{ -} - -OriginalItemParam::~OriginalItemParam() -{ - -} - -Gtk::Widget * -OriginalItemParam::param_newWidget() -{ - Gtk::HBox *_widget = Gtk::manage(new Gtk::HBox()); - - { // Label - Gtk::Label *pLabel = Gtk::manage(new Gtk::Label(param_label)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); - pLabel->set_tooltip_text(param_tooltip); - } - - { // Paste item to link button - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) ); - Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalItemParam::on_link_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Link to item")); - } - - { // Select original button - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon("edit-select-original", Inkscape::ICON_SIZE_BUTTON) ); - Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalItemParam::on_select_original_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Select original")); - } - - static_cast<Gtk::HBox*>(_widget)->show_all_children(); - - return dynamic_cast<Gtk::Widget *> (_widget); -} - -void -OriginalItemParam::param_write(const gchar * iid) -{ - Glib::ustring itemid(iid); - - if (itemid.empty()) { - return; - } - // add '#' at start to make it an uri. - itemid.insert(itemid.begin(), '#'); - if ( href && strcmp(itemid.c_str(), href) == 0 ) { - // no change, do nothing - return; - } else { - param_write_to_repr(itemid.c_str()); - } -} - -void -OriginalItemParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/) -{ - if (!inverse) { - emit_changed(); - LivePathEffectObject* lpeobj = param_effect->getLPEObj(); - SP_OBJECT(lpeobj)->requestModified(SP_OBJECT_MODIFIED_FLAG); - } -} - -void -OriginalItemParam::linked_transformed_callback(Geom::Affine const * /*rel_transf*/, SPItem * /*moved_item*/) -{ -/** \todo find good way to compensate for referenced item transform, like done for normal clones. - * See sp-use.cpp: sp_use_move_compensate */ -} - - -void -OriginalItemParam::on_select_original_button_click() -{ - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPItem *original = ref.getObject(); - if (desktop == NULL || original == NULL) { - return; - } - Inkscape::Selection *selection = desktop->getSelection(); - selection->clear(); - selection->set(original); -} - -} /* namespace LivePathEffect */ - -} /* namespace Inkscape */ - -/* - 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 : diff --git a/src/live_effects/parameter/originalitem.h b/src/live_effects/parameter/originalitem.h deleted file mode 100644 index 86e223cea..000000000 --- a/src/live_effects/parameter/originalitem.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_ORIGINAL_ITEM_H -#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_ORIGINAL_ITEM_H - -/* - * Inkscape::LiveItemEffectParameters - * -* Copyright (C) Johan Engelen 2012 <j.b.c.engelen@alumnus.utwente.nl> - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "live_effects/parameter/item.h" - -namespace Inkscape { - -namespace LivePathEffect { - -class OriginalItemParam: public ItemParam { -public: - OriginalItemParam ( const Glib::ustring& label, - const Glib::ustring& tip, - const Glib::ustring& key, - Inkscape::UI::Widget::Registry* wr, - Effect* effect); - virtual ~OriginalItemParam(); - void setInverse(bool inversed) { inverse = inversed; } - bool linksToItem() const { return (href != NULL); } - SPItem * getObject() const { return ref.getObject(); } - void param_write(const gchar * iid); - virtual Gtk::Widget * param_newWidget(); - -protected: - virtual void linked_modified_callback(SPObject *linked_obj, guint flags); - virtual void linked_transformed_callback(Geom::Affine const *rel_transf, SPItem *moved_item); - - void on_select_original_button_click(); - -private: - bool inverse; - OriginalItemParam(const OriginalItemParam&); - OriginalItemParam& operator=(const OriginalItemParam&); -}; - - -} //namespace LivePathEffect - -} //namespace Inkscape - -#endif |
