path.cpp revision 4738512f05259cc6016d0d3aea12ea6c55c9e438
/*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/parameter/path.h"
#include "live_effects/effect.h"
#include <gtk/gtkstock.h>
#include "selection-chemistry.h"
#include "desktop.h"
#include "inkscape.h"
#include "message-stack.h"
#include "verbs.h"
#include "document.h"
// needed for on-canvas editting:
#include "tools-switch.h"
#include "shape-editor.h"
#include "node-context.h"
#include "desktop-handles.h"
#include "selection.h"
#include "nodepath.h"
// clipboard support
#include "ui/clipboard.h"
// required for linking to other paths
#include "uri.h"
#include "sp-shape.h"
#include "sp-text.h"
#include "ui/tool/node-tool.h"
#include "ui/tool/multi-path-manipulator.h"
#include "ui/tool/shape-record.h"
namespace Inkscape {
namespace LivePathEffect {
changed(true),
_pathvector(),
_pwd2(),
must_recalculate_pwd2(false),
{
oncanvas_editable = true;
ref_changed_connection = ref.changedSignal().connect(sigc::mem_fun(*this, &PathParam::ref_changed));
}
{
remove_link();
}
{
return _pathvector;
}
{
ensure_pwd2();
return _pwd2;
}
void
{
}
void
{
}
bool
{
if (strvalue) {
_pathvector.clear();
remove_link();
must_recalculate_pwd2 = true;
if (strvalue[0] == '#') {
if (href)
// Now do the attaching, which emits the changed signal.
try {
} catch (Inkscape::BadURIException &e) {
}
} else {
}
emit_changed();
return true;
}
return false;
}
gchar *
PathParam::param_getSVGValue() const
{
if (href) {
return href;
} else {
return svgd;
}
}
{
Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "tool-node-editor", Inkscape::ICON_SIZE_BUTTON) );
}
void
{
// TODO remove the tools_switch atrocity.
}
ShapeRecord r;
r.role = SHAPE_ROLE_LPE_PARAM;
if (!href) {
} else {
}
}
void
{
// TODO this method should not exist at all!
}
void
{
}
/*
* Only applies transform when not referring to other path!
*/
void
{
// only apply transform when not referring to other path
if (!href) {
}
}
/*
* See comments for set_new_value(std::vector<Geom::Path>).
*/
void
PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpath, bool write_to_svg)
{
remove_link();
if (write_to_svg) {
// After the whole "writing to svg avalanche of function calling": force value upon pwd2 and don't recalculate.
must_recalculate_pwd2 = false;
} else {
must_recalculate_pwd2 = false;
emit_changed();
}
}
/*
* 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 :
* The new path data is written to SVG. In this case the signal_path_changed signal
* is not directly emited in this method, because writing to SVG
* triggers the LPEObject to which this belongs to call Effect::setParameter which calls
* PathParam::readSVGValue, which finally emits the signal_path_changed signal.
* If write_to_svg = false :
* The new path data is not written to SVG. This method will emit the signal_path_changed signal.
*/
void
{
remove_link();
must_recalculate_pwd2 = true;
if (write_to_svg) {
} else {
emit_changed();
}
}
void
{
if (must_recalculate_pwd2) {
for (unsigned int i=0; i < _pathvector.size(); i++) {
}
must_recalculate_pwd2 = false;
}
}
void
{
changed = true;
}
void
{
return;
}
linked_modified_connection = to->connectModified(sigc::mem_fun(*this, &PathParam::linked_modified));
linked_modified(to, SP_OBJECT_MODIFIED_FLAG); // simulate linked_modified signal, so that path data is updated
}
void
PathParam::quit_listening(void)
{
}
void
{
if ( new_ref ) {
}
}
void
{
if (href) {
}
}
void
{
remove_link();
set_new_value (_pathvector, true);
}
void
{
if (SP_IS_SHAPE(linked_obj)) {
}
if (SP_IS_TEXT(linked_obj)) {
}
// curve invalid, set default value
} else {
}
must_recalculate_pwd2 = true;
emit_changed();
}
/* CALLBACK FUNCTIONS FOR THE BUTTONS */
void
{
}
}
void
{
// only recognize a non-null, non-empty string
// remove possible link to path
remove_link();
}
}
void
{
_("Paste path parameter"));
}
void
{
cm->copyPathParameter(this);
}
void
{
if (pathid == "") {
return;
}
// add '#' at start to make it an uri.
// 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
_("Link path 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 :