summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-11-09 05:13:46 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-11-09 05:13:46 +0000
commit4b236f3f1e3fe5374e18dac9e6c35567d9dc0995 (patch)
treed6a8f361b37294feb8da05c2ce61271e5137a237 /src/live_effects
parentRemove FIXME from refactoring (diff)
parentFix bug in previous commit. Add test against it (diff)
downloadinkscape-4b236f3f1e3fe5374e18dac9e6c35567d9dc0995.tar.gz
inkscape-4b236f3f1e3fe5374e18dac9e6c35567d9dc0995.zip
Update to trunk r13690
(bzr r13341.5.22)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/effect.cpp35
-rw-r--r--src/live_effects/effect.h8
-rw-r--r--src/live_effects/lpe-bspline.cpp156
-rw-r--r--src/live_effects/lpe-bspline.h8
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp120
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h3
-rw-r--r--src/live_effects/lpe-lattice2.cpp2
-rw-r--r--src/live_effects/lpe-perspective-envelope.cpp6
-rw-r--r--src/live_effects/lpe-powerstroke.cpp2
-rw-r--r--src/live_effects/lpe-roughen.cpp29
-rw-r--r--src/live_effects/lpe-roughen.h2
-rw-r--r--src/live_effects/lpe-simplify.cpp4
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp42
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.h2
-rw-r--r--src/live_effects/parameter/parameter.cpp2
15 files changed, 167 insertions, 254 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index b002eaf7f..349caafd9 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -75,8 +75,6 @@
#include <glibmm/i18n.h>
#include "ui/tools/pen-tool.h"
#include "ui/tools-switch.h"
-#include "message-stack.h"
-#include "desktop.h"
#include "knotholder.h"
#include "sp-lpe-item.h"
#include "live_effects/lpeobject.h"
@@ -370,6 +368,7 @@ Effect::Effect(LivePathEffectObject *lpeobject)
{
registerParameter( dynamic_cast<Parameter *>(&is_visible) );
is_visible.widget_is_visible = false;
+ current_zoom = 0.0;
}
Effect::~Effect()
@@ -398,6 +397,36 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/)
{
}
+void
+Effect::setSelectedNodePoints(std::vector<Geom::Point> sNP)
+{
+ selectedNodesPoints = sNP;
+}
+
+void
+Effect::setCurrentZoom(double cZ)
+{
+ current_zoom = cZ;
+}
+
+bool
+Effect::isNodePointSelected(Geom::Point const &nodePoint) const
+{
+ if (selectedNodesPoints.size() > 0) {
+ for (std::vector<Geom::Point>::const_iterator i = selectedNodesPoints.begin();
+ i != selectedNodesPoints.end(); ++i) {
+ Geom::Point p = *i;
+ std::cout << p << "p\n";
+ p[Geom::X] = Inkscape::Util::Quantity::convert(p[Geom::X], "px", *defaultUnit);
+ p[Geom::Y] = Inkscape::Util::Quantity::convert(p[Geom::Y], "px", *defaultUnit);
+ if (Geom::are_near(p, nodePoint, 0.01)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
/**
* Is performed each time before the effect is updated.
*/
@@ -419,6 +448,7 @@ void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/)
void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
{
sp_lpe_item = const_cast<SPLPEItem *>(lpeitem);
+ defaultUnit = &sp_lpe_item->document->getDefaultUnit()->abbr;
/*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve();
pathvector_before_effect = sp_curve->get_pathvector();*/
doOnApply(lpeitem);
@@ -427,6 +457,7 @@ void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem)
{
sp_lpe_item = const_cast<SPLPEItem *>(lpeitem);
+ defaultUnit = &sp_lpe_item->document->getDefaultUnit()->abbr;
//printf("(SPLPEITEM*) %p\n", sp_lpe_item);
sp_curve = SP_SHAPE(sp_lpe_item)->getCurve();
pathvector_before_effect = sp_curve->get_pathvector();
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index a486e8491..7da76b267 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -13,6 +13,7 @@
#include "parameter/bool.h"
#include "effect-enum.h"
+
#define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this.
class SPDocument;
@@ -57,7 +58,9 @@ public:
//of indirection is needed. We first call these methods, then the below.
void doOnApply_impl(SPLPEItem const* lpeitem);
void doBeforeEffect_impl(SPLPEItem const* lpeitem);
-
+ void setCurrentZoom(double cZ);
+ void setSelectedNodePoints(std::vector<Geom::Point> sNP);
+ bool isNodePointSelected(Geom::Point const &nodePoint) const;
virtual void doOnApply (SPLPEItem const* lpeitem);
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
@@ -156,6 +159,9 @@ protected:
bool concatenate_before_pwd2;
SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
+ Glib::ustring const * defaultUnit; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
+ double current_zoom;
+ std::vector<Geom::Point> selectedNodesPoints;
SPCurve * sp_curve;
std::vector<Geom::Path> pathvector_before_effect;
private:
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index 7703b8221..fdaeaf897 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -24,11 +24,6 @@
#include "live_effects/lpeobject.h"
#include "live_effects/parameter/parameter.h"
#include "ui/widget/scalar.h"
-#include "ui/tool/node.h"
-#include "ui/tools/node-tool.h"
-#include "ui/tool/control-point-selection.h"
-#include "ui/tool/selectable-control-point.h"
-#include "selection.h"
#include "xml/repr.h"
#include "svg/svg.h"
#include "sp-path.h"
@@ -36,7 +31,6 @@
#include "document-private.h"
#include "document.h"
#include "document-undo.h"
-#include "desktop-handles.h"
#include "verbs.h"
#include "sp-lpe-item.h"
#include "sp-namedview.h"
@@ -47,7 +41,6 @@
// For handling un-continuous paths:
#include "message-stack.h"
#include "inkscape.h"
-#include "desktop.h"
using Inkscape::DocumentUndo;
@@ -64,7 +57,7 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject)
// initialise your parameters here:
//testpointA(_("Test Point A"), _("Test A"), "ptA", &wr, this,
//Geom::Point(100,100)),
- steps(_("Steps whith CTRL:"), _("Change number of steps whith CTRL pressed"), "steps", &wr, this, 2),
+ steps(_("Steps with CTRL:"), _("Change number of steps with CTRL pressed"), "steps", &wr, this, 2),
ignoreCusp(_("Ignore cusp nodes"), _("Change ignoring cusp nodes"), "ignoreCusp", &wr, this, true),
onlySelected(_("Change only selected nodes"), _("Change only selected nodes"), "onlySelected", &wr, this, false),
showHelper(_("Show helper paths"), _("Show helper paths"), "showHelper", &wr, this, false),
@@ -87,7 +80,7 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject)
LPEBSpline::~LPEBSpline() {}
-void LPEBSpline::doBeforeEffect (SPLPEItem const* lpeitem)
+void LPEBSpline::doBeforeEffect (SPLPEItem const* /*lpeitem*/)
{
if(!hp.empty()){
hp.clear();
@@ -127,12 +120,8 @@ void LPEBSpline::doEffect(SPCurve *curve)
Geom::PathVector const original_pathv = curve->get_pathvector();
curve->reset();
double radiusHelperNodes = 6.0;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop){
- radiusHelperNodes /= SP_ACTIVE_DESKTOP->current_zoom();
- SPNamedView *nv = sp_desktop_namedview(desktop);
- radiusHelperNodes = Inkscape::Util::Quantity::convert(radiusHelperNodes, "px", nv->doc_units->abbr);
- }
+ radiusHelperNodes /= current_zoom;
+ radiusHelperNodes = Inkscape::Util::Quantity::convert(radiusHelperNodes, "px", *defaultUnit);
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
path_it != original_pathv.end(); ++path_it) {
if (path_it->empty())
@@ -165,16 +154,8 @@ void LPEBSpline::doEffect(SPCurve *curve)
curve_endit = path_it->end_open();
}
}
- //Si la curva está cerrada calculamos el punto donde
- //deveria estar el nodo BSpline de cierre/inicio de la curva
- //en posible caso de que se cierre con una linea recta creando un nodo
- //BSPline
nCurve->moveto(curve_it1->initialPoint());
- //Recorremos todos los segmentos menos el último
while (curve_it1 != curve_endit) {
- //previousPointAt3 = pointAt3;
- //Calculamos los puntos que dividirían en tres segmentos iguales el path
- //recto de entrada y de salida
SPCurve *in = new SPCurve();
in->moveto(curve_it1->initialPoint());
in->lineto(curve_it1->finalPoint());
@@ -260,10 +241,7 @@ void LPEBSpline::doEffect(SPCurve *curve)
SBasisHelper = lineHelper->first_segment()->toSBasis();
lineHelper->reset();
delete lineHelper;
- //almacenamos el punto del anterior bucle -o el de cierre- que nos hara de
- //principio de curva
previousNode = node;
- //Y este hará de final de curva
node = SBasisHelper.valueAt(0.5);
Geom::CubicBezier const *cubic2 = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if((cubic && are_near((*cubic)[0],(*cubic)[1])) || (cubic2 && are_near((*cubic2)[2],(*cubic2)[3]))) {
@@ -274,12 +252,6 @@ void LPEBSpline::doEffect(SPCurve *curve)
if(!are_near(node,curve_it1->finalPoint()) && showHelper){
drawHandle(node, radiusHelperNodes);
}
- //La curva BSpline se forma calculando el centro del segmanto de unión
- //de el punto situado en las 2/3 partes de el segmento de entrada
- //con el punto situado en la posición 1/3 del segmento de salida
- //Estos dos puntos ademas estan posicionados en el lugas correspondiente
- //de los manejadores de la curva
- //aumentamos los valores para el siguiente paso en el bucle
++curve_it1;
++curve_it2;
}
@@ -293,7 +265,7 @@ void LPEBSpline::doEffect(SPCurve *curve)
}
if(showHelper){
Geom::PathVector const pathv = curve->get_pathvector();
- hp.push_back(pathv[0]);
+ hp.push_back(pathv[0]);
}
}
@@ -314,7 +286,6 @@ LPEBSpline::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::
{
hp_vec.push_back(hp);
}
-
Gtk::Widget *LPEBSpline::newWidget()
{
// use manage here, because after deletion of Effect object, others might
@@ -332,12 +303,12 @@ Gtk::Widget *LPEBSpline::newWidget()
Gtk::Button *defaultWeight =
Gtk::manage(new Gtk::Button(Glib::ustring(_("Default weight"))));
defaultWeight->signal_clicked()
- .connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &LPEBSpline::toDefaultWeight), widg));
+ .connect(sigc::mem_fun(*this, &LPEBSpline::toDefaultWeight));
buttons->pack_start(*defaultWeight, true, true, 2);
Gtk::Button *makeCusp =
Gtk::manage(new Gtk::Button(Glib::ustring(_("Make cusp"))));
makeCusp->signal_clicked()
- .connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &LPEBSpline::toMakeCusp), widg));
+ .connect(sigc::mem_fun(*this, &LPEBSpline::toMakeCusp));
buttons->pack_start(*makeCusp, true, true, 2);
vbox->pack_start(*buttons, true, true, 2);
}
@@ -381,24 +352,14 @@ Gtk::Widget *LPEBSpline::newWidget()
return dynamic_cast<Gtk::Widget *>(vbox);
}
-void LPEBSpline::toDefaultWeight(Gtk::Widget *widgWeight)
+void LPEBSpline::toDefaultWeight()
{
- weight.param_set_value(defaultStartPower);
changeWeight(defaultStartPower);
- Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widgWeight);
- std::vector< Gtk::Widget* > childList = scalarParameter->get_children();
- Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]);
- entryWidg->set_text("defaultStartPower");
}
-void LPEBSpline::toMakeCusp(Gtk::Widget *widgWeight)
+void LPEBSpline::toMakeCusp()
{
- weight.param_set_value(noPower);
changeWeight(noPower);
- Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widgWeight);
- std::vector< Gtk::Widget* > childList = scalarParameter->get_children();
- Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]);
- entryWidg->set_text("noPower");
}
void LPEBSpline::toWeight()
@@ -408,91 +369,34 @@ void LPEBSpline::toWeight()
void LPEBSpline::changeWeight(double weightValue)
{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
- GSList *items = (GSList *)selection->itemList();
- SPItem *item = (SPItem *)g_slist_nth(items, 0)->data;
- SPPath *path = SP_PATH(item);
+ SPPath *path = SP_PATH(sp_lpe_item);
SPCurve *curve = path->get_curve_for_edit();
LPEBSpline::doBSplineFromWidget(curve, weightValue);
gchar *str = sp_svg_write_path(curve->get_pathvector());
path->getRepr()->setAttribute("inkscape:original-d", str);
- if (INK_IS_NODE_TOOL(desktop->event_context)) {
- Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(desktop->event_context);
- nt->desktop->updateNow();
- }
- g_free(str);
- curve->unref();
- desktop->clearWaitingCursor();
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_LPE,
- _("Modified the weight of the BSpline"));
-}
-
-bool LPEBSpline::nodeIsSelected(Geom::Point nodePoint)
-{
- using Geom::X;
- using Geom::Y;
-
- if (points.size() > 0) {
- for (std::vector<Geom::Point>::iterator i = points.begin();
- i != points.end(); ++i) {
- Geom::Point p = *i;
- if (Geom::are_near(p, nodePoint, handleCubicGap)) {
- return true;
- } else {
- }
- }
- }
- return false;
}
void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
{
using Geom::X;
using Geom::Y;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (INK_IS_NODE_TOOL(desktop->event_context)) {
- Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(desktop->event_context);
- Inkscape::UI::ControlPointSelection::Set &selection =
- nt->_selected_nodes->allPoints();
- points.clear();
- std::vector<Geom::Point>::iterator pbegin;
- for (Inkscape::UI::ControlPointSelection::Set::iterator i =
- selection.begin();
- i != selection.end(); ++i) {
- if ((*i)->selected()) {
- Inkscape::UI::Node *n = dynamic_cast<Inkscape::UI::Node *>(*i);
- pbegin = points.begin();
- points.insert(pbegin, desktop->doc2dt(n->position()));
- }
- }
- }
- //bool hasNodesSelected = LPEBspline::hasNodesSelected();
+
if (curve->get_segment_count() < 1)
return;
// Make copy of old path as it is changed during processing
Geom::PathVector const original_pathv = curve->get_pathvector();
curve->reset();
- //Recorremos todos los paths a los que queremos aplicar el efecto, hasta el
- //penúltimo
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
path_it != original_pathv.end(); ++path_it) {
- //Si está vacío...
- if (path_it->empty())
+
+ if (path_it->empty()){
continue;
- //Itreadores
-
- Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
- Geom::Path::const_iterator curve_it2 =
- ++(path_it->begin()); // outgoing curve
- Geom::Path::const_iterator curve_endit =
- path_it->end_default(); // this determines when the loop has to stop
- //Creamos las lineas rectas que unen todos los puntos del trazado y donde se
- //calcularán
- //los puntos clave para los manejadores.
- //Esto hace que la curva BSpline no pierda su condición aunque se trasladen
- //dichos manejadores
+ }
+ Geom::Path::const_iterator curve_it1 = path_it->begin();
+ Geom::Path::const_iterator curve_it2 = ++(path_it->begin());
+ Geom::Path::const_iterator curve_endit = path_it->end_default();
+
SPCurve *nCurve = new SPCurve();
Geom::Point pointAt0(0, 0);
Geom::Point pointAt1(0, 0);
@@ -515,16 +419,8 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
curve_endit = path_it->end_open();
}
}
- //Si la curva está cerrada calculamos el punto donde
- //deveria estar el nodo BSpline de cierre/inicio de la curva
- //en posible caso de que se cierre con una linea recta creando un nodo
- //BSPline
nCurve->moveto(curve_it1->initialPoint());
- //Recorremos todos los segmentos menos el último
while (curve_it1 != curve_endit) {
- //previousPointAt3 = pointAt3;
- //Calculamos los puntos que dividirían en tres segmentos iguales el path
- //recto de entrada y de salida
SPCurve *in = new SPCurve();
in->moveto(curve_it1->initialPoint());
in->lineto(curve_it1->finalPoint());
@@ -572,7 +468,7 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
} else {
if (cubic) {
if (!ignoreCusp || !Geom::are_near((*cubic)[1], pointAt0)) {
- if (nodeIsSelected(pointAt0)) {
+ if (isNodePointSelected(pointAt0)) {
pointAt1 = SBasisIn.valueAt(weightValue);
if (weightValue != noPower) {
pointAt1 =
@@ -585,7 +481,7 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
pointAt1 = in->first_segment()->initialPoint();
}
if (!ignoreCusp || !Geom::are_near((*cubic)[2], pointAt3)) {
- if (nodeIsSelected(pointAt3)) {
+ if (isNodePointSelected(pointAt3)) {
pointAt2 = SBasisIn.valueAt(1 - weightValue);
if (weightValue != noPower) {
pointAt2 =
@@ -599,14 +495,14 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
}
} else {
if (!ignoreCusp && weightValue != noPower) {
- if (nodeIsSelected(pointAt0)) {
+ if (isNodePointSelected(pointAt0)) {
pointAt1 = SBasisIn.valueAt(weightValue);
pointAt1 =
Geom::Point(pointAt1[X] + handleCubicGap, pointAt1[Y] + handleCubicGap);
} else {
pointAt1 = in->first_segment()->initialPoint();
}
- if (nodeIsSelected(pointAt3)) {
+ if (isNodePointSelected(pointAt3)) {
pointAt2 = SBasisIn.valueAt(weightValue);
pointAt2 =
Geom::Point(pointAt2[X] + handleCubicGap, pointAt2[Y] + handleCubicGap);
@@ -621,14 +517,7 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
}
in->reset();
delete in;
- //La curva BSpline se forma calculando el centro del segmanto de unión
- //de el punto situado en las 2/3 partes de el segmento de entrada
- //con el punto situado en la posición 1/3 del segmento de salida
- //Estos dos puntos ademas estan posicionados en el lugas correspondiente
- //de
- //los manejadores de la curva
nCurve->curveto(pointAt1, pointAt2, pointAt3);
- //aumentamos los valores para el siguiente paso en el bucle
++curve_it1;
++curve_it2;
}
@@ -638,7 +527,6 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
} else {
nCurve->move_endpoints(path_it->begin()->initialPoint(), pointAt3);
}
- //y cerramos la curva
if (path_it->closed()) {
nCurve->closepath_current();
}
diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h
index 169658b94..8751a5720 100644
--- a/src/live_effects/lpe-bspline.h
+++ b/src/live_effects/lpe-bspline.h
@@ -26,20 +26,18 @@ public:
virtual void doEffect(SPCurve *curve);
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
void drawHandle(Geom::Point p, double radiusHelperNodes);
- void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec);
virtual void doBSplineFromWidget(SPCurve *curve, double value);
- virtual bool nodeIsSelected(Geom::Point nodePoint);
+ void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec);
virtual Gtk::Widget *newWidget();
virtual void changeWeight(double weightValue);
- virtual void toDefaultWeight(Gtk::Widget *widgWeight);
- virtual void toMakeCusp(Gtk::Widget *widgWeight);
+ virtual void toDefaultWeight();
+ virtual void toMakeCusp();
virtual void toWeight();
// TODO make this private
ScalarParam steps;
private:
- std::vector<Geom::Point> points;
BoolParam ignoreCusp;
BoolParam onlySelected;
BoolParam showHelper;
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index a3964f553..c491ea858 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -28,12 +28,7 @@
#include "live_effects/parameter/filletchamferpointarray.h"
// for programmatically updating knots
-#include "selection.h"
#include "ui/tools-switch.h"
-#include "ui/tool/control-point-selection.h"
-#include "ui/tool/selectable-control-point.h"
-#include "ui/tool/node.h"
-#include "ui/tools/node-tool.h"
#include <util/units.h>
// TODO due to internal breakage in glibmm headers, this must be last:
@@ -65,12 +60,15 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
unit(_("Unit"), _("Unit"), "unit", &wr, this),
method(_("Method"), _("Fillets methods"), "method", FMConverter, &wr, this, FM_AUTO),
radius(_("Radius (unit or %)"), _("Radius, in unit or %"), "radius", &wr, this, 0.),
+ chamfer_steps(_("Chamfer steps"), _("Chamfer steps"), "chamfer_steps", &wr, this, 0),
+
helper_size(_("Helper size with direction"), _("Helper size with direction"), "helper_size", &wr, this, 0)
{
registerParameter(&fillet_chamfer_values);
registerParameter(&unit);
registerParameter(&method);
registerParameter(&radius);
+ registerParameter(&chamfer_steps);
registerParameter(&helper_size);
registerParameter(&flexible);
registerParameter(&use_knot_distance);
@@ -81,9 +79,13 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
radius.param_set_range(0., infinity());
radius.param_set_increments(1, 1);
radius.param_set_digits(4);
+ chamfer_steps.param_set_range(0, infinity());
+ chamfer_steps.param_set_increments(1, 1);
+ chamfer_steps.param_set_digits(0);
helper_size.param_set_range(0, infinity());
helper_size.param_set_increments(5, 5);
helper_size.param_set_digits(0);
+ fillet_chamfer_values.set_chamfer_steps(3);
}
LPEFilletChamfer::~LPEFilletChamfer() {}
@@ -112,6 +114,16 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
Gtk::Entry *entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]);
entryWidg->set_width_chars(6);
}
+ } else if (param->param_key == "chamfer_steps") {
+ Inkscape::UI::Widget::Scalar *widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
+ widgRegistered->signal_value_changed().connect(sigc::mem_fun(*this, &LPEFilletChamfer::chamfer));
+ widg = widgRegistered;
+ if (widg) {
+ Gtk::HBox *scalarParameter = dynamic_cast<Gtk::HBox *>(widg);
+ std::vector<Gtk::Widget *> childList = scalarParameter->get_children();
+ Gtk::Entry *entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]);
+ entryWidg->set_width_chars(3);
+ }
} else if (param->param_key == "flexible") {
Gtk::CheckButton *widgRegistered = Gtk::manage(dynamic_cast<Gtk::CheckButton *>(widg));
widgRegistered->signal_clicked().connect(sigc::mem_fun(*this, &LPEFilletChamfer::toggleFlexFixed));
@@ -142,26 +154,20 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
++it;
}
- Gtk::HBox *filletButtonsContainer = Gtk::manage(new Gtk::HBox(true, 0));
+ Gtk::VBox *buttonsContainer = Gtk::manage(new Gtk::VBox(true, 0));
Gtk::Button *fillet = Gtk::manage(new Gtk::Button(Glib::ustring(_("Fillet"))));
fillet->signal_clicked().connect(sigc::mem_fun(*this, &LPEFilletChamfer::fillet));
- filletButtonsContainer->pack_start(*fillet, true, true, 2);
+ buttonsContainer->pack_start(*fillet, true, true, 2);
Gtk::Button *inverse = Gtk::manage(new Gtk::Button(Glib::ustring(_("Inverse fillet"))));
inverse->signal_clicked().connect(sigc::mem_fun(*this, &LPEFilletChamfer::inverse));
- filletButtonsContainer->pack_start(*inverse, true, true, 2);
+ buttonsContainer->pack_start(*inverse, true, true, 2);
- Gtk::HBox *chamferButtonsContainer = Gtk::manage(new Gtk::HBox(true, 0));
Gtk::Button *chamfer = Gtk::manage(new Gtk::Button(Glib::ustring(_("Chamfer"))));
chamfer->signal_clicked().connect(sigc::mem_fun(*this, &LPEFilletChamfer::chamfer));
+ buttonsContainer->pack_start(*chamfer, true, true, 2);
- chamferButtonsContainer->pack_start(*chamfer, true, true, 2);
- Gtk::Button *doubleChamfer = Gtk::manage(new Gtk::Button(Glib::ustring(_("Double chamfer"))));
- doubleChamfer->signal_clicked().connect(sigc::mem_fun(*this, &LPEFilletChamfer::doubleChamfer));
- chamferButtonsContainer->pack_start(*doubleChamfer, true, true, 2);
-
- vbox->pack_start(*filletButtonsContainer, true, true, 2);
- vbox->pack_start(*chamferButtonsContainer, true, true, 2);
+ vbox->pack_start(*buttonsContainer, true, true, 2);
return vbox;
}
@@ -212,8 +218,7 @@ void LPEFilletChamfer::updateFillet()
{
double power = 0;
if (!flexible) {
- Inkscape::Util::Unit const *doc_units = SP_ACTIVE_DESKTOP->namedview->doc_units;
- power = Inkscape::Util::Quantity::convert(radius, unit.get_abbreviation(), doc_units->abbr) * -1;
+ power = Inkscape::Util::Quantity::convert(radius, unit.get_abbreviation(), *defaultUnit) * -1;
} else {
power = radius;
}
@@ -235,14 +240,9 @@ void LPEFilletChamfer::inverse()
void LPEFilletChamfer::chamfer()
{
+ fillet_chamfer_values.set_chamfer_steps(chamfer_steps + 3);
Piecewise<D2<SBasis> > const &pwd2 = fillet_chamfer_values.get_pwd2();
- doChangeType(path_from_piecewise(pwd2, tolerance), 3);
-}
-
-void LPEFilletChamfer::doubleChamfer()
-{
- Piecewise<D2<SBasis> > const &pwd2 = fillet_chamfer_values.get_pwd2();
- doChangeType(path_from_piecewise(pwd2, tolerance), 4);
+ doChangeType(path_from_piecewise(pwd2, tolerance), chamfer_steps + 3);
}
void LPEFilletChamfer::refreshKnots()
@@ -256,35 +256,8 @@ void LPEFilletChamfer::refreshKnots()
}
}
-bool LPEFilletChamfer::nodeIsSelected(Geom::Point nodePoint, std::vector<Geom::Point> point)
-{
- if (point.size() > 0) {
- for (std::vector<Geom::Point>::iterator i = point.begin(); i != point.end();
- ++i) {
- Geom::Point p = *i;
- if (Geom::are_near(p, nodePoint, 2)) {
- return true;
- }
- }
- }
- return false;
-}
void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pathv, double power)
{
- std::vector<Geom::Point> point;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (INK_IS_NODE_TOOL(desktop->event_context)) {
- Inkscape::UI::Tools::NodeTool *nodeTool = INK_NODE_TOOL(desktop->event_context);
- Inkscape::UI::ControlPointSelection::Set &selection = nodeTool->_selected_nodes->allPoints();
- std::vector<Geom::Point>::iterator pBegin;
- for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection.begin(); i != selection.end(); ++i) {
- if ((*i)->selected()) {
- Inkscape::UI::Node *n = dynamic_cast<Inkscape::UI::Node *>(*i);
- pBegin = point.begin();
- point.insert(pBegin, desktop->doc2dt(n->position()));
- }
- }
- }
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
std::vector<Geom::Point> result;
std::vector<Geom::Path> original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv);
@@ -319,7 +292,7 @@ void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pa
if (filletChamferData[counter][Y] == 0) {
powerend = filletChamferData[counter][X];
}
- if (only_selected && !nodeIsSelected(curve_it1->initialPoint(), point)) {
+ if (only_selected && !isNodePointSelected(curve_it1->initialPoint())) {
powerend = filletChamferData[counter][X];
}
result.push_back(Point(powerend, filletChamferData[counter][Y]));
@@ -333,24 +306,6 @@ void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pa
void LPEFilletChamfer::doChangeType(std::vector<Geom::Path> const& original_pathv, int type)
{
- std::vector<Geom::Point> point;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (INK_IS_NODE_TOOL(desktop->event_context)) {
- Inkscape::UI::Tools::NodeTool *nodeTool =
- INK_NODE_TOOL(desktop->event_context);
- Inkscape::UI::ControlPointSelection::Set &selection =
- nodeTool->_selected_nodes->allPoints();
- std::vector<Geom::Point>::iterator pBegin;
- for (Inkscape::UI::ControlPointSelection::Set::iterator i =
- selection.begin();
- i != selection.end(); ++i) {
- if ((*i)->selected()) {
- Inkscape::UI::Node *n = dynamic_cast<Inkscape::UI::Node *>(*i);
- pBegin = point.begin();
- point.insert(pBegin, desktop->doc2dt(n->position()));
- }
- }
- }
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
std::vector<Geom::Point> result;
std::vector<Geom::Path> original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv);
@@ -373,9 +328,8 @@ void LPEFilletChamfer::doChangeType(std::vector<Geom::Path> const& original_path
bool toggle = true;
if (filletChamferData[counter][Y] == 0 ||
(ignore_radius_0 && (filletChamferData[counter][X] == 0 ||
- filletChamferData[counter][X] == counter)) ||
- (only_selected &&
- !nodeIsSelected(curve_it1->initialPoint(), point))) {
+ filletChamferData[counter][X] == counter)) ||
+ (only_selected && !isNodePointSelected(curve_it1->initialPoint()))) {
toggle = false;
}
if (toggle) {
@@ -597,11 +551,19 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
} else {
type = std::abs(filletChamferData[counter + 1][Y]);
}
- if (type == 3 || type == 4) {
- if (type == 4) {
- Geom::Point central = middle_point(startArcPoint, endArcPoint);
- LineSegment chamferCenter(central, curve_it1->finalPoint());
- path_out.appendNew<Geom::LineSegment>(chamferCenter.pointAt(0.5));
+ if (type >= 3) {
+ unsigned int chamferSubs = type-2;
+ Geom::Path path_chamfer;
+ path_chamfer.start(path_out.finalPoint());
+ if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){
+ path_chamfer.appendNew<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ } else {
+ path_chamfer.appendNew<Geom::CubicBezier>(handle1, handle2, endArcPoint);
+ }
+ double chamfer_stepsTime = 1.0/chamferSubs;
+ for(unsigned int i = 1; i < chamferSubs; i++){
+ Geom::Point chamferStep = path_chamfer.pointAt(chamfer_stepsTime * i);
+ path_out.appendNew<Geom::LineSegment>(chamferStep);
}
path_out.appendNew<Geom::LineSegment>(endArcPoint);
} else if (type == 2) {
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index 873684101..e3589197c 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -57,12 +57,10 @@ public:
void toggleFlexFixed();
void chamfer();
void fillet();
- void doubleChamfer();
void inverse();
void updateFillet();
void doUpdateFillet(std::vector<Geom::Path> const& original_pathv, double power);
void doChangeType(std::vector<Geom::Path> const& original_pathv, int type);
- bool nodeIsSelected(Geom::Point nodePoint, std::vector<Geom::Point> points);
void refreshKnots();
FilletChamferPointArrayParam fillet_chamfer_values;
@@ -77,6 +75,7 @@ private:
UnitParam unit;
EnumParam<FilletMethod> method;
ScalarParam radius;
+ ScalarParam chamfer_steps;
ScalarParam helper_size;
LPEFilletChamfer(const LPEFilletChamfer &);
diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp
index 7036b0cfa..e1cd91340 100644
--- a/src/live_effects/lpe-lattice2.cpp
+++ b/src/live_effects/lpe-lattice2.cpp
@@ -394,7 +394,7 @@ LPELattice2::resetGrid()
grid_point32x33x34x35.param_set_and_write_default();
//todo:this hack is only to reposition the knots on reser grid button
//Better update path effect in LPEITEM
- SPDesktop * desktop = INKSCAPE.active_desktop();
+ SPDesktop * desktop = SP_ACTIVE_DESKTOP;
tools_switch(desktop, TOOLS_SELECT);
tools_switch(desktop, TOOLS_NODES);
}
diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp
index c070cf17b..b5ef26e2f 100644
--- a/src/live_effects/lpe-perspective-envelope.cpp
+++ b/src/live_effects/lpe-perspective-envelope.cpp
@@ -193,8 +193,8 @@ LPEPerspectiveEnvelope::project_point(Geom::Point p){
double height = boundingbox_Y.extent();
double delta_x = boundingbox_X.min() - p[X];
double delta_y = boundingbox_Y.max() - p[Y];
- Geom::Coord xratio = (delta_x * sgn(delta_x)) / width;
- Geom::Coord yratio = (delta_y * sgn(delta_y)) / height;
+ Geom::Coord xratio = (delta_x * -1) / width;
+ Geom::Coord yratio = delta_y / height;
Geom::Line* horiz = new Geom::Line();
Geom::Line* vert = new Geom::Line();
vert->setPoints (pointAtRatio(yratio,Down_Left_Point,Up_Left_Point),pointAtRatio(yratio,Down_Right_Point,Up_Right_Point));
@@ -337,7 +337,7 @@ LPEPerspectiveEnvelope::resetGrid()
Down_Left_Point.param_set_and_write_default();
//todo:this hack is only to reposition the knots on reser grid button
//Better update path effect in LPEITEM
- SPDesktop * desktop = INKSCAPE.active_desktop();
+ SPDesktop * desktop = SP_ACTIVE_DESKTOP;
tools_switch(desktop, TOOLS_SELECT);
tools_switch(desktop, TOOLS_NODES);
}
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 03a10807a..f7fe9592d 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -277,7 +277,7 @@ LPEPowerStroke::doOnApply(SPLPEItem const* lpeitem)
double width = (lpeitem && lpeitem->style) ? lpeitem->style->stroke_width.computed / 2 : 1.;
SPCSSAttr *css = sp_repr_css_attr_new ();
- if (true) {
+ if (lpeitem->style) {
if (lpeitem->style->stroke.isPaintserver()) {
SPPaintServer * server = lpeitem->style->getStrokePaintServer();
if (server) {
diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp
index ffd5433bf..07d9e63e8 100644
--- a/src/live_effects/lpe-roughen.cpp
+++ b/src/live_effects/lpe-roughen.cpp
@@ -14,12 +14,13 @@
*/
#include <gtkmm.h>
-
+#include "desktop.h"
#include "live_effects/lpe-roughen.h"
#include "display/curve.h"
#include "live_effects/parameter/parameter.h"
#include "helper/geom.h"
#include <glibmm/i18n.h>
+#include <util/units.h>
#include <cmath>
namespace Inkscape {
@@ -46,6 +47,8 @@ LPERoughen::LPERoughen(LivePathEffectObject *lpeobject)
"displaceX", &wr, this, 10.),
displaceY(_("Max. displacement in Y"), _("Max. displacement in Y"),
"displaceY", &wr, this, 10.),
+ globalRandomize(_("Global randomize"), _("Global randomize"),
+ "globalRandomize", &wr, this, 1.),
shiftNodes(_("Shift nodes"), _("Shift nodes"), "shiftNodes", &wr, this,
true),
shiftNodeHandles(_("Shift node handles"), _("Shift node handles"),
@@ -57,10 +60,12 @@ LPERoughen::LPERoughen(LivePathEffectObject *lpeobject)
registerParameter(&segments);
registerParameter(&displaceX);
registerParameter(&displaceY);
+ registerParameter(&globalRandomize);
registerParameter(&shiftNodes);
registerParameter(&shiftNodeHandles);
displaceX.param_set_range(0., Geom::infinity());
displaceY.param_set_range(0., Geom::infinity());
+ globalRandomize.param_set_range(0., Geom::infinity());
maxSegmentSize.param_set_range(0., Geom::infinity());
maxSegmentSize.param_set_increments(1, 1);
maxSegmentSize.param_set_digits(1);
@@ -75,6 +80,7 @@ void LPERoughen::doBeforeEffect(SPLPEItem const *lpeitem)
{
displaceX.resetRandomizer();
displaceY.resetRandomizer();
+ globalRandomize.resetRandomizer();
srand(1);
SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
item->apply_to_clippath(item);
@@ -118,6 +124,15 @@ Gtk::Widget *LPERoughen::newWidget()
vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()),
Gtk::PACK_EXPAND_WIDGET);
}
+ if (param->param_key == "globalRandomize") {
+ Gtk::Label *displaceXLabel = Gtk::manage(new Gtk::Label(
+ Glib::ustring(_("<b>Extra roughen</b> Add a extra layer of rough")),
+ Gtk::ALIGN_START));
+ displaceXLabel->set_use_markup(true);
+ vbox->pack_start(*displaceXLabel, false, false, 2);
+ vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()),
+ Gtk::PACK_EXPAND_WIDGET);
+ }
Glib::ustring *tip = param->param_getTooltip();
if (widg) {
vbox->pack_start(*widg, true, true, 2);
@@ -145,10 +160,11 @@ double LPERoughen::sign(double randNumber)
Geom::Point LPERoughen::randomize()
{
+ Inkscape::Util::Unit const *doc_units = SP_ACTIVE_DESKTOP->namedview->doc_units;
double displaceXParsed = Inkscape::Util::Quantity::convert(
- displaceX, unit.get_abbreviation(), "px");
+ displaceX * globalRandomize, unit.get_abbreviation(), doc_units->abbr);
double displaceYParsed = Inkscape::Util::Quantity::convert(
- displaceY, unit.get_abbreviation(), "px");
+ displaceY * globalRandomize, unit.get_abbreviation(), doc_units->abbr);
Geom::Point output = Geom::Point(sign(displaceXParsed), sign(displaceYParsed));
return output;
@@ -159,6 +175,7 @@ void LPERoughen::doEffect(SPCurve *curve)
Geom::PathVector const original_pathv =
pathv_to_linear_and_cubic_beziers(curve->get_pathvector());
curve->reset();
+ Inkscape::Util::Unit const *doc_units = SP_ACTIVE_DESKTOP->namedview->doc_units;
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
path_it != original_pathv.end(); ++path_it) {
if (path_it->empty())
@@ -185,6 +202,7 @@ void LPERoughen::doEffect(SPCurve *curve)
Geom::Point A1(0, 0);
Geom::Point A2(0, 0);
Geom::Point A3(0, 0);
+ bool first = true;
while (curve_it1 != curve_endit) {
Geom::CubicBezier const *cubic = NULL;
A0 = curve_it1->initialPoint();
@@ -194,7 +212,7 @@ void LPERoughen::doEffect(SPCurve *curve)
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if (cubic) {
A1 = (*cubic)[1];
- if (shiftNodes) {
+ if (shiftNodes && first) {
A1 = (*cubic)[1] + initialMove;
}
A2 = (*cubic)[2];
@@ -203,7 +221,7 @@ void LPERoughen::doEffect(SPCurve *curve)
nCurve->lineto(A3);
}
double length = Inkscape::Util::Quantity::convert(
- curve_it1->length(0.001), "px", unit.get_abbreviation());
+ curve_it1->length(0.001), doc_units->abbr, unit.get_abbreviation());
std::size_t splits = 0;
if (method == DM_SEGMENTS) {
splits = segments;
@@ -232,6 +250,7 @@ void LPERoughen::doEffect(SPCurve *curve)
if(curve_it2 != curve_endit) {
++curve_it2;
}
+ first = false;
}
if (path_it->closed()) {
nCurve->closepath_current();
diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h
index d5ec726bd..74331f1ef 100644
--- a/src/live_effects/lpe-roughen.h
+++ b/src/live_effects/lpe-roughen.h
@@ -51,8 +51,10 @@ private:
ScalarParam segments;
RandomParam displaceX;
RandomParam displaceY;
+ RandomParam globalRandomize;
BoolParam shiftNodes;
BoolParam shiftNodeHandles;
+
LPERoughen(const LPERoughen &);
LPERoughen &operator=(const LPERoughen &);
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp
index c191fbbe6..2b2efb1a9 100644
--- a/src/live_effects/lpe-simplify.cpp
+++ b/src/live_effects/lpe-simplify.cpp
@@ -157,8 +157,8 @@ LPESimplify::doEffect(SPCurve *curve) {
Geom::PathVector outres = Geom::parse_svg_path(pathliv->svg_dump_path());
generateHelperPath(outres);
curve->set_pathvector(outres);
- if(SP_ACTIVE_DESKTOP && INK_IS_NODE_TOOL(SP_ACTIVE_DESKTOP->event_context)){
- SPDesktop* desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop* desktop = SP_ACTIVE_DESKTOP;
+ if(desktop && INK_IS_NODE_TOOL(desktop->event_context)){
Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(desktop->event_context);
nt->update_helperpath();
}
diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp
index db24a9735..31d996ad0 100644
--- a/src/live_effects/parameter/filletchamferpointarray.cpp
+++ b/src/live_effects/parameter/filletchamferpointarray.cpp
@@ -359,6 +359,11 @@ void FilletChamferPointArrayParam::set_helper_size(int hs)
helper_size = hs;
}
+void FilletChamferPointArrayParam::set_chamfer_steps(int value_chamfer_steps)
+{
+ chamfer_steps = value_chamfer_steps;
+}
+
void FilletChamferPointArrayParam::set_use_distance(bool use_knot_distance )
{
use_distance = use_knot_distance;
@@ -712,8 +717,8 @@ FilletChamferPointArrayParamKnotHolderEntity(
: _pparam(p), _index(index) {}
void FilletChamferPointArrayParamKnotHolderEntity::knot_set(Point const &p,
- Point const &origin,
- guint state)
+ Point const &/*origin*/,
+ guint /*state*/)
{
using namespace Geom;
@@ -766,15 +771,24 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state)
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
}else{
using namespace Geom;
- double type = _pparam->_vector.at(_index)[Y] + 1;
- if (type > 4) {
- type = 1;
+ int type = (int)_pparam->_vector.at(_index)[Y];
+
+ switch(type){
+ case 1:
+ type = 2;
+ break;
+ case 2:
+ type = _pparam->chamfer_steps;
+ break;
+ default:
+ type = 1;
+ break;
}
- _pparam->_vector.at(_index) = Point(_pparam->_vector.at(_index)[X], type);
+ _pparam->_vector.at(_index) = Point(_pparam->_vector.at(_index)[X], (double)type);
_pparam->param_set_and_write_new_value(_pparam->_vector);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
const gchar *tip;
- if (type == 3) {
+ if (type >= 3) {
tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
@@ -782,12 +796,8 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state)
tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
- } else if (type == 1) {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
} else {
- tip = _("<b>Double Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
}
@@ -835,7 +845,7 @@ void FilletChamferPointArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
continue;
}
const gchar *tip;
- if (_vector[i][Y] == 3) {
+ if (_vector[i][Y] >= 3) {
tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
@@ -843,12 +853,8 @@ void FilletChamferPointArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
- } else if (_vector[i][Y] == 1) {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
} else {
- tip = _("<b>Double Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
}
diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h
index a1fa698ae..1dd31d6d4 100644
--- a/src/live_effects/parameter/filletchamferpointarray.h
+++ b/src/live_effects/parameter/filletchamferpointarray.h
@@ -52,6 +52,7 @@ public:
std::vector<double> get_times(int index, std::vector<Geom::Path> subpaths, bool last);
virtual void set_helper_size(int hs);
virtual void set_use_distance(bool use_knot_distance);
+ virtual void set_chamfer_steps(int value_chamfer_steps);
virtual void set_unit(const gchar *abbr);
virtual void addCanvasIndicators(SPLPEItem const *lpeitem,
std::vector<Geom::PathVector> &hp_vec);
@@ -85,6 +86,7 @@ private:
SPKnotModeType knot_mode;
guint32 knot_color;
int helper_size;
+ int chamfer_steps;
bool use_distance;
const gchar *unit;
Geom::PathVector hp;
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index 7a2fd9769..beb750404 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -47,7 +47,7 @@ Parameter::param_write_to_repr(const char * svgd)
// in gtk3, it is an issue: it allocates widget size for the maxmium
// value you pass to it, leading to some insane lengths.
// If you need this to be more, please be conservative about it.
-const double SCALARPARAM_G_MAXDOUBLE = 10000000000;
+const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile.
void Parameter::write_to_SVG(void)
{