index ed2eb62fe286c62ed912ff29128a999ae4855b24..dc43af0d5073023a93f7fbfaeef94c7fee01e999 100644 (file)
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include "live_effects/effect.h"
+
#include "display/display-forward.h"
#include "xml/node-event-vector.h"
#include "sp-object.h"
#include "document.h"
#include <glibmm/i18n.h>
-#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
#include "live_effects/parameter/parameter.h"
#include <glibmm/ustring.h>
#include "live_effects/n-art-bpath-2geom.h"
#include "display/curve.h"
-#include <2geom/sbasis-to-bezier.h>
#include <gtkmm.h>
#include <exception>
+#include <2geom/sbasis-to-bezier.h>
+#include <2geom/matrix.h>
+
+
// include effects:
#include "live_effects/lpe-skeletalstrokes.h"
#include "live_effects/lpe-pathalongpath.h"
+//here!!
+#include "live_effects/lpe-sketch.h"
+#include "live_effects/lpe-vonkoch.h"
+#include "live_effects/lpe-knot.h"
#include "live_effects/lpe-slant.h"
#include "live_effects/lpe-test-doEffect-stack.h"
#include "live_effects/lpe-gears.h"
const Util::EnumData<EffectType> LPETypeData[INVALID_LPE] = {
// {constant defined in effect.h, N_("name of your effect"), "name of your effect in SVG"}
{PATH_ALONG_PATH, N_("Bend Path"), "bend_path"},
- {SKELETAL_STROKES, N_("Pattern along path"), "skeletal"},
+ {SKELETAL_STROKES, N_("Pattern Along Path"), "skeletal"},
+ {SKETCH, N_("Sketch"), "sketch"},
+ {VONKOCH, N_("VonKoch"), "vonkoch"},
+ {KNOT, N_("Knot"), "knot"},
#ifdef LPE_ENABLE_TEST_EFFECTS
{SLANT, N_("Slant"), "slant"},
{DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"},
#endif
{GEARS, N_("Gears"), "gears"},
- {CURVE_STITCH, N_("Stitch subpaths"), "curvestitching"},
+ {CURVE_STITCH, N_("Stitch Sub-Paths"), "curvestitching"},
};
const Util::EnumDataConverter<EffectType> LPETypeConverter(LPETypeData, INVALID_LPE);
case PATH_ALONG_PATH:
neweffect = (Effect*) new LPEPathAlongPath(lpeobj);
break;
+//here!!
+ case SKETCH:
+ neweffect = (Effect*) new LPESketch(lpeobj);
+ break;
+ case VONKOCH:
+ neweffect = (Effect*) new LPEVonKoch(lpeobj);
+ break;
+ case KNOT:
+ neweffect = (Effect*) new LPEKnot(lpeobj);
+ break;
#ifdef LPE_ENABLE_TEST_EFFECTS
case SLANT:
neweffect = (Effect*) new LPESlant(lpeobj);
Effect::Effect(LivePathEffectObject *lpeobject)
{
- vbox = NULL;
- tooltips = NULL;
lpeobj = lpeobject;
oncanvasedit_it = 0;
}
Effect::~Effect()
{
- if (tooltips) {
- delete tooltips;
- }
}
-Glib::ustring
+Glib::ustring
Effect::getName()
{
if (lpeobj->effecttype_set && lpeobj->effecttype < INVALID_LPE)
return Glib::ustring( _("No effect") );
}
+void
+Effect::doBeforeEffect (SPLPEItem *lpeitem)
+{
+ //Do nothing for simple effects
+}
+
+
/*
* Here be the doEffect function chain:
*/
param_vector.push_back(param);
}
+/**
+* This *creates* a new widget, management of deletion should be done by the caller
+*/
Gtk::Widget *
-Effect::getWidget()
+Effect::newWidget(Gtk::Tooltips * tooltips)
{
- if (!vbox) {
- vbox = Gtk::manage( new Gtk::VBox() ); // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
- //if (!tooltips)
- tooltips = new Gtk::Tooltips();
-
- vbox->set_border_width(5);
-
- std::vector<Parameter *>::iterator it = param_vector.begin();
- while (it != param_vector.end()) {
- Parameter * param = *it;
- Gtk::Widget * widg = param->param_getWidget();
- Glib::ustring * tip = param->param_getTooltip();
- if (widg) {
- vbox->pack_start(*widg, true, true, 2);
- if (tip != NULL) {
- tooltips->set_tip(*widg, *tip);
- }
- }
+ // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
+ Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() );
+
+ vbox->set_border_width(5);
- it++;
+ std::vector<Parameter *>::iterator it = param_vector.begin();
+ while (it != param_vector.end()) {
+ Parameter * param = *it;
+ Gtk::Widget * widg = param->param_newWidget(tooltips);
+ Glib::ustring * tip = param->param_getTooltip();
+ if (widg) {
+ vbox->pack_start(*widg, true, true, 2);
+ if (tip != NULL) {
+ tooltips->set_tip(*widg, *tip);
+ }
}
+
+ it++;
}
return dynamic_cast<Gtk::Widget *>(vbox);
}
void
-Effect::setup_notepath(Inkscape::NodePath::Path *np)
+Effect::setup_nodepath(Inkscape::NodePath::Path *np)
{
np->show_helperpath = true;
np->helperpath_rgba = 0xff0000ff;
np->helperpath_width = 1.0;
}
+void
+Effect::transform_multiply(Geom::Matrix const& postmul, bool set)
+{
+ // cycle through all parameters. Most parameters will not need transformation, but path and point params do.
+ for (std::vector<Parameter *>::iterator it = param_vector.begin(); it != param_vector.end(); it++) {
+ Parameter * param = *it;
+ param->param_transform_multiply(postmul, set);
+ }
+}
} /* namespace LivePathEffect */