summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3f58f91)
raw | patch | inline | side by side (parent: 3f58f91)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 3 Nov 2007 17:38:18 +0000 (17:38 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 3 Nov 2007 17:38:18 +0000 (17:38 +0000) |
index 859bf8230785c5b1a2b4167606215d9ca4f0daef..03a27b6da5bb7e9478b0d2269b765395379d8916 100644 (file)
#include "live_effects/lpe-gears.h"
#include "live_effects/lpe-curvestitch.h"
+#include "nodepath.h"
+
namespace Inkscape {
namespace LivePathEffect {
tooltips = NULL;
lpeobj = lpeobject;
oncanvasedit_it = param_map.begin();
- straight_original_path = false;
}
Effect::~Effect()
}
-Inkscape::XML::Node *
+Inkscape::XML::Node *
Effect::getRepr()
{
return SP_OBJECT_REPR(lpeobj);
}
-SPDocument *
+SPDocument *
Effect::getSPDoc()
{
if (SP_OBJECT_DOCUMENT(lpeobj) == NULL) g_message("Effect::getSPDoc() returns NULL");
return SP_OBJECT_DOCUMENT(lpeobj);
}
+Parameter *
+Effect::getParameter(const char * key)
+{
+ Glib::ustring stringkey(key);
+
+ param_map_type::iterator it = param_map.find(stringkey);
+ if (it != param_map.end()) {
+ return it->second;
+ } else {
+ return NULL;
+ }
+}
+
Parameter *
Effect::getNextOncanvasEditableParam()
{
// do nothing for simple effects
}
+void
+Effect::setup_notepath(Inkscape::NodePath::Path *np)
+{
+ np->show_helperpath = true;
+ np->helperpath_rgba = 0xff0000ff;
+ np->helperpath_width = 1.0;
+}
+
} /* namespace LivePathEffect */
index 07dd72e47ebb9299057593ce060393a150ccc85e..221f94b4026f8276b0e4d27eca7d0e51f050be9e 100644 (file)
class Node;
}
+namespace NodePath {
+ class Path ;
+}
+
namespace LivePathEffect {
enum EffectType {
Inkscape::XML::Node * getRepr();
SPDocument * getSPDoc();
LivePathEffectObject * getLPEObj() {return lpeobj;};
+ Parameter * getParameter(const char * key);
void readallParameters(Inkscape::XML::Node * repr);
void setParameter(const gchar * key, const gchar * new_value);
void editNextParamOncanvas(SPItem * item, SPDesktop * desktop);
- bool straight_original_path;
+ virtual void setup_notepath(Inkscape::NodePath::Path *np);
protected:
Effect(LivePathEffectObject *lpeobject);
index 30500e3ab28582457e20b6a1bac1e18612d7e021..d5bb8e5ef1ea919d46e067960aff24593f2d90f2 100644 (file)
#include <2geom/bezier-to-sbasis.h>
#include <2geom/path.h>
+#include "nodepath.h"
+
using std::vector;
using namespace Geom;
{
registerParameter( dynamic_cast<Parameter *>(&teeth) );
registerParameter( dynamic_cast<Parameter *>(&phi) );
-
- straight_original_path = true;
}
LPEGears::~LPEGears()
return path_out;
}
+void
+LPEGears::setup_notepath(Inkscape::NodePath::Path *np)
+{
+ Effect::setup_notepath(np);
+ np->straight_path = true;
+}
} // namespace LivePathEffect
} /* namespace Inkscape */
index c3cea92301554c40ae954c5807e0d1fe177156fd..4109c2ed004b23fed687c36b5c196462031847f6 100644 (file)
std::vector<Geom::Path> doEffect (std::vector<Geom::Path> & path_in);
+ void setup_notepath(Inkscape::NodePath::Path *np);
+
private:
ScalarParam teeth;
ScalarParam phi;
index a41d5f7c6907d337023fdb27c6577ab799fd889c..614f799c0c2166f362aa57f409342afed8c352d0 100644 (file)
namespace Inkscape {
+namespace NodePath {
+ class Path ;
+}
+
namespace LivePathEffect {
class Effect;
virtual Glib::ustring * param_getTooltip() { return ¶m_tooltip; };
virtual void param_editOncanvas(SPItem * item, SPDesktop * dt) { return; };
+ virtual void param_setup_notepath(Inkscape::NodePath::Path *np) { return; };
Glib::ustring param_key;
Inkscape::UI::Widget::Registry * param_wr;
index 68f7be4a946a05a79bc2d962ea91ece3e5362c0f..53e15c9a5dc3b65eadb0a35fdaf94871c9693a13 100644 (file)
#include "node-context.h"
#include "desktop-handles.h"
#include "selection.h"
+#include "nodepath.h"
namespace Inkscape {
shape_editor->set_item_livepatheffect_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str());
}
+void
+PathParam::param_setup_notepath(Inkscape::NodePath::Path *np)
+{
+ np->show_helperpath = true;
+ np->helperpath_rgba = 0x009000ff;
+ np->helperpath_width = 1.0;
+}
+
void
PathParam::param_write_to_repr(const char * svgd)
{
index 23f168c48c88775fea95894e54d9132f7c62c467..2f8c766bd6338d61795153346dd668e27e751d89 100644 (file)
void param_set_and_write_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > newpath);
void param_editOncanvas(SPItem * item, SPDesktop * dt);
+ void param_setup_notepath(Inkscape::NodePath::Path *np);
sigc::signal <void> signal_path_pasted;
sigc::signal <void> signal_path_changed;
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 02b91eab06d863a27745f35a4c865171c7fede17..5b75651955e7ecb93ec57c55afcb62a175e7dc7a 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
#include <vector>
#include <algorithm>
#include "live_effects/lpeobject.h"
+#include "live_effects/parameter/parameter.h"
class NR::Matrix;
@@ -218,17 +219,18 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object,
if (repr_key_in) { // apparantly the object is an LPEObject
np->repr_key = g_strdup(repr_key_in);
np->repr_nodetypes_key = g_strconcat(np->repr_key, "-nodetypes", NULL);
- np->show_helperpath = true;
+ Inkscape::LivePathEffect::Parameter *lpeparam = LIVEPATHEFFECT(object)->lpe->getParameter(repr_key_in);
+ if (lpeparam) {
+ lpeparam->param_setup_notepath(np);
+ }
} else {
np->repr_nodetypes_key = g_strdup("sodipodi:nodetypes");
if ( SP_SHAPE(np->object)->path_effect_href ) {
np->repr_key = g_strdup("inkscape:original-d");
- np->show_helperpath = true;
+
LivePathEffectObject *lpeobj = sp_shape_get_livepatheffectobject(SP_SHAPE(np->object));
- // ENHANCE THIS. Probably it is much nicer to have a virtual method in Effect class that modifies nodepath to its likings.
- // so something like: "lpe->adjust_nodepath(np);"
if (lpeobj && lpeobj->lpe) {
- np->straight_path = lpeobj->lpe->straight_original_path;
+ lpeobj->lpe->setup_notepath(np);
}
} else {
np->repr_key = g_strdup("d");
SPCurve *helper_curve = sp_curve_copy(np->curve);
sp_curve_transform(helper_curve, np->i2d );
np->helper_path = sp_canvas_bpath_new(sp_desktop_controls(desktop), helper_curve);
- sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(np->helper_path), 0xff0000ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(np->helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(np->helper_path), 0, SP_WIND_RULE_NONZERO);
sp_canvas_item_show(np->helper_path);
sp_curve_unref(helper_curve);
diff --git a/src/nodepath.h b/src/nodepath.h
index 6ed9e22256ac7fd6566bd13cd69f2a5f2ca7fc86..ee828f4aca4d245a4a955c6b45e77c607b1f1de6 100644 (file)
--- a/src/nodepath.h
+++ b/src/nodepath.h
#include <list>
+class SPObject;
class SPDesktop;
class SPPath;
class SPKnot;
SPCanvasItem *helper_path;
SPCurve *curve;
bool show_helperpath;
+ guint32 helperpath_rgba;
+ gdouble helperpath_width;
/// true if we changed repr, to tell this change from an external one such as from undo, simplify, or another desktop
unsigned int local_change;
bool show_handles;
/// true if the path cannot contain curves, just straight lines
- // FIXME: NOT IMPLEMENTED YET
bool straight_path;
/// active_node points to the node that is currently mouseovered (= NULL if