index e74729b3599e899b9ffafae5e297aec0c8f89490..1214a1766db3281d66926d12c91bcd9475159468 100644 (file)
#include "live_effects/parameter/path.h"
#include "live_effects/effect.h"
-#include "libnr/n-art-bpath-2geom.h"
#include "svg/svg.h"
#include <2geom/svg-path-parser.h>
#include <2geom/sbasis-to-bezier.h>
const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
Effect* effect, const gchar * default_value)
: Parameter(label, tip, key, wr, effect),
+ changed(true),
_pathvector(),
_pwd2(),
must_recalculate_pwd2(false),
_pathvector = sp_svg_read_pathv(strvalue);
}
- signal_path_changed.emit();
+ emit_changed();
return true;
}
{
// If not already in nodecontext, goto it!
if (!tools_isactive(dt, TOOLS_NODES)) {
- tools_switch_current(TOOLS_NODES);
+ tools_switch(dt, TOOLS_NODES);
}
- ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor;
+ ShapeEditor * shape_editor = dt->event_context->shape_editor;
if (!href) {
shape_editor->set_item_lpe_path_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str());
} else {
@@ -255,12 +255,12 @@ PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpa
} else {
_pwd2 = newpath;
must_recalculate_pwd2 = false;
- signal_path_changed.emit();
+ emit_changed();
}
}
/*
- * This method sets new path data.
+ * This method sets new path data.
* If this PathParam refers to another path, this link is removed (and replaced with explicit path data).
*
* If write_to_svg = true :
@@ -283,7 +283,7 @@ PathParam::set_new_value (std::vector<Geom::Path> const &newpath, bool write_to_
param_write_to_repr(svgd);
g_free(svgd);
} else {
- signal_path_changed.emit();
+ emit_changed();
}
}
}
}
+void
+PathParam::emit_changed()
+{
+ changed = true;
+ signal_path_changed.emit();
+}
+
void
PathParam::start_listening(SPObject * to)
{
}
must_recalculate_pwd2 = true;
- signal_path_changed.emit();
+ emit_changed();
SP_OBJECT(param_effect->getLPEObj())->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
void
PathParam::paste_param_path(const char *svgd)
{
- if (svgd == "")
- return;
-
- // remove possible link to path
- remove_link();
+ // only recognize a non-null, non-empty string
+ if (svgd && *svgd) {
+ // remove possible link to path
+ remove_link();
- param_write_to_repr(svgd);
- signal_path_pasted.emit();
+ param_write_to_repr(svgd);
+ signal_path_pasted.emit();
+ }
}
void
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
Glib::ustring svgd = cm->getPathParameter();
paste_param_path(svgd.data());
- sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Paste path parameter"));
}
// check if linking to object to which LPE is applied (maybe delegated to PathReference
param_write_to_repr(pathid.c_str());
- sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Link path parameter to path"));
}
}