livepatheffect-editor.cpp revision b4998608f5fbde14c744b6ab8020664300e11f80
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/**
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * \brief LivePathEffect dialog
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm *
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Authors:
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Johan Engelen <j.b.c.engelen@utwente.nl>
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm *
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Copyright (C) 2007 Author
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm *
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Released under GNU GPL. Read the file 'COPYING' for more information.
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm */
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#ifdef HAVE_CONFIG_H
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm# include <config.h>
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#endif
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include <glibmm/i18n.h>
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "livepatheffect-editor.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "verbs.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "selection.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "sp-shape.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "sp-path.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "live_effects/effect.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "live_effects/lpeobject.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "gtkmm/widget.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include <vector>
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "inkscape.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "desktop-handles.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "desktop.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "document-private.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "xml/node.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm#include "xml/document.h"
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmnamespace Inkscape {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmclass Application;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmnamespace UI {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmnamespace Dialog {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/*####################
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Callback functions
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm */
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmstatic void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm lpeeditor->onSelectionChanged(selection);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/*#######################
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * LivePathEffectEditor
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm */
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_bLivePathEffectEditor::LivePathEffectEditor()
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b : UI::Widget::Panel("", "dialogs.livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_apply(_("_Apply"), _("Apply chosen effect to selection")),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove(_("_Remove"), _("Remove effect from selection")),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectwidget(NULL),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm explain_label("", Gtk::ALIGN_CENTER),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_frame(_("Apply new effect")),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_frame(_("Current effect")),
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen current_desktop(NULL)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b Gtk::Box *contents = _getContents();
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b contents->set_spacing(4);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_hbox.set_spacing(4);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.set_spacing(4);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_hbox.pack_start(combo_effecttype, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_hbox.pack_start(button_apply, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_frame.add(effectapplication_hbox);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.pack_start(explain_label, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.pack_end(button_remove, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_frame.add(effectcontrol_vbox);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
b4998608f5fbde14c744b6ab8020664300e11f80jucablues contents->pack_start(effectapplication_frame, false, false);
b4998608f5fbde14c744b6ab8020664300e11f80jucablues contents->pack_start(effectcontrol_frame, false, false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // connect callback functions to buttons
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_apply.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onApply));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onRemove));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm show_all_children();
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen button_remove.hide();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::~LivePathEffectEditor()
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (effectwidget) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.remove(*effectwidget);
c0cd5511d3b975ebe07d019c1f5528108725e438johanengelen delete effectwidget;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectwidget = NULL;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (current_desktop) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm selection_changed_connection.disconnect();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::showParams(LivePathEffect::Effect* effect)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen if (effectwidget) {
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen effectcontrol_vbox.remove(*effectwidget);
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen delete effectwidget;
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen effectwidget = NULL;
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen }
fdad0bc3aa765bdc61fe39e8c4da03f717525dccjohanengelen
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen explain_label.set_markup("<b>" + effect->getName() + "</b>");
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen effectwidget = effect->newWidget(&tooltips);
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen if (effectwidget) {
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen effectcontrol_vbox.pack_start(*effectwidget, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen button_remove.show();
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen effectcontrol_vbox.show_all_children();
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen // fixme: add resizing of dialog
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::showText(Glib::ustring const &str)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (effectwidget) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.remove(*effectwidget);
c0cd5511d3b975ebe07d019c1f5528108725e438johanengelen delete effectwidget;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectwidget = NULL;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm explain_label.set_label(str);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove.hide();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // fixme: do resizing of dialog ?
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::set_sensitize_all(bool sensitive)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm combo_effecttype.set_sensitive(sensitive);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_apply.set_sensitive(sensitive);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove.set_sensitive(sensitive);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( sel && !sel->isEmpty() ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SPItem *item = sel->singleItem();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( item ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( SP_IS_SHAPE(item) ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SPShape *shape = SP_SHAPE(item);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm LivePathEffectObject *lpeobj = sp_shape_get_livepatheffectobject(shape);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm set_sensitize_all(true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (lpeobj) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (lpeobj->lpe) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm showParams(lpeobj->lpe);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm } else {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm showText(_("Unknown effect is applied"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm } else {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm showText(_("No effect applied"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove.set_sensitive(false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm } else {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm showText(_("Item is not a shape or path"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm set_sensitize_all(false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm } else {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm showText(_("Only one item can be selected"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm set_sensitize_all(false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm } else {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm showText(_("Empty selection"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm set_sensitize_all(false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::setDesktop(SPDesktop *desktop)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
1e7c268648bcbae15fc13b8c94dee677b401d9b3gustav_b Panel::setDesktop(desktop);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( desktop == current_desktop ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm return;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (current_desktop) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm selection_changed_connection.disconnect();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm current_desktop = desktop;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (desktop) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::Selection *selection = sp_desktop_selection(desktop);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm selection_changed_connection = selection->connectChanged(
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sigc::bind (sigc::ptr_fun(&lpeeditor_selection_changed), this ) );
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm onSelectionChanged(selection);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm } else {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm onSelectionChanged(NULL);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/*########################################################################
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm# BUTTON CLICK HANDLERS (callbacks)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm########################################################################*/
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm// TODO: factor out the effect applying code which can be called from anywhere. (selection-chemistry.cpp also needs it)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::onApply()
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::Selection *sel = _getSelection();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( sel && !sel->isEmpty() ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SPItem *item = sel->singleItem();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( item && SP_IS_SHAPE(item) ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SPDocument *doc = current_desktop->doc();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm const Util::EnumData<LivePathEffect::EffectType>* data = combo_effecttype.get_active_data();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (!data) return;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm repr->setAttribute("effect", data->key.c_str() );
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc))->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm const gchar * repr_id = repr->attribute("id");
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::GC::release(repr);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm gchar *href = g_strdup_printf("#%s", repr_id);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sp_shape_set_path_effect(SP_SHAPE(item), href);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm g_free(href);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // make sure there is an original-d for paths!!!
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( SP_IS_PATH(item) ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::XML::Node *pathrepr = SP_OBJECT_REPR(item);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( ! pathrepr->attribute("inkscape:original-d") ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm pathrepr->setAttribute("inkscape:original-d", pathrepr->attribute("d"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen LivePathEffectObject *lpeobj = sp_shape_get_livepatheffectobject(SP_SHAPE(item));
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen if (lpeobj && lpeobj->lpe) {
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen lpeobj->lpe->resetDefaults(item);
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen }
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm _("Create and apply path effect"));
3ae3dd4eb0191cc986a035c790b8b97e6c6e4ee4johanengelen
3ae3dd4eb0191cc986a035c790b8b97e6c6e4ee4johanengelen onSelectionChanged(sel);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmvoid
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::onRemove()
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm{
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::Selection *sel = _getSelection();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( sel && !sel->isEmpty() ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SPItem *item = sel->singleItem();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if ( item && SP_IS_SHAPE(item) ) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sp_shape_remove_path_effect(SP_SHAPE(item));
b4998608f5fbde14c744b6ab8020664300e11f80jucablues showText(_("No effect applied"));
b4998608f5fbde14c744b6ab8020664300e11f80jucablues button_remove.set_sensitive(false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm _("Remove path effect") );
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm}
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm} // namespace Dialog
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm} // namespace UI
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm} // namespace Inkscape
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm