summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp53
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h2
-rw-r--r--src/live_effects/parameter/array.cpp6
-rw-r--r--src/live_effects/parameter/array.h2
-rw-r--r--src/live_effects/parameter/satellitepairarray.cpp217
-rw-r--r--src/live_effects/parameter/satellitepairarray.h16
6 files changed, 180 insertions, 116 deletions
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index 118a89ead..d979171be 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -79,7 +79,7 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
chamfer_steps.param_set_range(1, 999);
chamfer_steps.param_set_increments(1, 1);
chamfer_steps.param_set_digits(0);
- helper_size.param_set_range(0, infinity());
+ helper_size.param_set_range(0, 999);
helper_size.param_set_increments(5, 5);
helper_size.param_set_digits(0);
}
@@ -175,7 +175,7 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
Gtk::Widget *widg = param->param_newWidget();
if (param->param_key == "radius") {
Inkscape::UI::Widget::Scalar *widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
- widgRegistered->signal_value_changed().connect(sigc::mem_fun(*this, &LPEFilletChamfer::updateAmmount));
+ widgRegistered->signal_value_changed().connect(sigc::mem_fun(*this, &LPEFilletChamfer::updateAmount));
widg = widgRegistered;
if (widg) {
Gtk::HBox *scalarParameter = dynamic_cast<Gtk::HBox *>(widg);
@@ -267,7 +267,7 @@ void LPEFilletChamfer::refreshKnots()
}
}
-void LPEFilletChamfer::updateAmmount()
+void LPEFilletChamfer::updateAmount()
{
double power = 0;
if (!flexible) {
@@ -279,26 +279,26 @@ void LPEFilletChamfer::updateAmmount()
Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2();
for (std::vector<std::pair<unsigned int,Geom::Satellite> >::iterator it = satellites.begin(); it != satellites.end(); ++it) {
if(pointwise->findClosingSatellites(it->first).size() == 0 && it->second.getIsStart()){
- it->second.setAmmount(0);
+ it->second.setAmount(0);
continue;
}
- if(ignore_radius_0 && it->second.getAmmount() == 0){
+ if(ignore_radius_0 && it->second.getAmount() == 0){
continue;
}
if(only_selected){
Geom::Point satPoint = pwd2.valueAt(it->first);
if(isNodePointSelected(satPoint)){
if(!use_knot_distance && !flexible){
- it->second.setAmmount(pointwise->rad_to_len(power,*it));
+ it->second.setAmount(pointwise->rad_to_len(power,*it));
} else {
- it->second.setAmmount(power);
+ it->second.setAmount(power);
}
}
} else {
if(!use_knot_distance && !flexible){
- it->second.setAmmount(pointwise->rad_to_len(power,*it));
+ it->second.setAmount(pointwise->rad_to_len(power,*it));
} else {
- it->second.setAmmount(power);
+ it->second.setAmount(power);
}
}
}
@@ -311,7 +311,7 @@ void LPEFilletChamfer::updateChamferSteps()
std::vector<std::pair<unsigned int,Geom::Satellite> > satellites = pointwise->getSatellites();
Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2();
for (std::vector<std::pair<unsigned int,Geom::Satellite> >::iterator it = satellites.begin(); it != satellites.end(); ++it) {
- if(ignore_radius_0 && it->second.getAmmount() == 0){
+ if(ignore_radius_0 && it->second.getAmount() == 0){
continue;
}
if(only_selected){
@@ -332,7 +332,7 @@ void LPEFilletChamfer::updateSatelliteType(Geom::SatelliteType satellitetype)
std::vector<std::pair<unsigned int,Geom::Satellite> > satellites = pointwise->getSatellites();
Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2();
for (std::vector<std::pair<unsigned int,Geom::Satellite> >::iterator it = satellites.begin(); it != satellites.end(); ++it) {
- if(ignore_radius_0 && it->second.getAmmount() == 0){
+ if(ignore_radius_0 && it->second.getAmount() == 0){
continue;
}
if(only_selected){
@@ -358,33 +358,40 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
if(path){
c = path->get_original_curve();
}
+ //fillet chamfer specific calls
+ satellitepairarrayparam_values.set_document_unit(defaultUnit);
+ satellitepairarrayparam_values.set_use_distance(use_knot_distance);
+ satellitepairarrayparam_values.set_unit(unit.get_abbreviation());
+ //mandatory call
+ satellitepairarrayparam_values.set_effect_type(this->effectType());
+
PathVector const &original_pathv = pathv_to_linear_and_cubic_beziers(c->get_pathvector());
- Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(pathv_to_linear_and_cubic_beziers(original_pathv));
+ Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(original_pathv);
pwd2_in = remove_short_cuts(pwd2_in, 0.01);
std::vector<std::pair<unsigned int,Geom::Satellite> > satellites = satellitepairarrayparam_values.data();
pointwise = new Pointwise(pwd2_in,satellites);
+
+ //mandatory call
satellitepairarrayparam_values.set_pointwise(pointwise);
+ //optional call
if(hide_knots){
satellitepairarrayparam_values.set_helper_size(0);
} else {
satellitepairarrayparam_values.set_helper_size(helper_size);
}
- satellitepairarrayparam_values.set_document_unit(defaultUnit);
- satellitepairarrayparam_values.set_use_distance(use_knot_distance);
- satellitepairarrayparam_values.set_unit(unit.get_abbreviation());
bool changed = false;
bool refresh = false;
for (std::vector<std::pair<unsigned int,Geom::Satellite> >::iterator it = satellites.begin(); it != satellites.end(); ++it) {
if(it->second.getIsTime() != flexible){
it->second.setIsTime(flexible);
- double ammount = it->second.getAmmount();
+ double amount = it->second.getAmount();
D2<SBasis> d2_in = pwd2_in[it->first];
if(it->second.getIsTime()){
- double time = it->second.toTime(ammount,d2_in);
- it->second.setAmmount(time);
+ double time = it->second.toTime(amount,d2_in);
+ it->second.setAmount(time);
} else {
- double size = it->second.toSize(ammount,d2_in);
- it->second.setAmmount(size);
+ double size = it->second.toSize(amount,d2_in);
+ it->second.setAmount(size);
}
changed = true;
}
@@ -483,6 +490,10 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
if(time1 <= time0){
time1 = time0;
}
+ std::cout << counter << ":::::::::::::::::::::::::::::\n";
+ std::cout << time0 << "time0\n";
+ std::cout << time1 << "time1\n";
+ std::cout << time2 << "time2\n";
std::vector<double> times;
times.push_back(time0);
times.push_back(time1);
@@ -549,7 +560,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
Coord rx = radius;
Coord ry = rx;
if (times[1] != 1) {
- if (times[1] != times[0] || times[1] == times[0] == 1) {
+ if (times[1] != times[0] || times[1] == times[0] == 1 ) {
if(!knotCurve1->isDegenerate()){
path_out.append(*knotCurve1);
}
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index 56db6305e..3d22216d4 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -42,7 +42,7 @@ public:
/*double len_to_rad(double A, std::pair<int,Geom::Satellite> sat);*/
void updateSatelliteType(Geom::SatelliteType satellitetype);
void updateChamferSteps();
- void updateAmmount();
+ void updateAmount();
void refreshKnots();
void chamfer();
void inverseChamfer();
diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp
index e4c480d93..e8a1b9532 100644
--- a/src/live_effects/parameter/array.cpp
+++ b/src/live_effects/parameter/array.cpp
@@ -62,13 +62,13 @@ sp_svg_satellite_read_d(gchar const *str, Geom::Satellite *sat){
sat->setActive(strncmp(strarray[4],"1",1) == 0);
sat->setHasMirror(strncmp(strarray[5],"1",1) == 0);
sat->setHidden(strncmp(strarray[6],"1",1) == 0);
- double ammount,angle;
+ double amount,angle;
float stepsTmp;
- sp_svg_number_read_d(strarray[7], &ammount);
+ sp_svg_number_read_d(strarray[7], &amount);
sp_svg_number_read_d(strarray[8], &angle);
sp_svg_number_read_f(strarray[9], &stepsTmp);
unsigned int steps = (unsigned int)stepsTmp;
- sat->setAmmount(ammount);
+ sat->setAmount(amount);
sat->setAngle(angle);
sat->setSteps(steps);
g_strfreev (strarray);
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index d28576fce..a6e797d4e 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -129,7 +129,7 @@ protected:
str << "*";
str << nVector.second.getHidden();
str << "*";
- str << nVector.second.getAmmount();
+ str << nVector.second.getAmount();
str << "*";
str << nVector.second.getAngle();
str << "*";
diff --git a/src/live_effects/parameter/satellitepairarray.cpp b/src/live_effects/parameter/satellitepairarray.cpp
index ffd04e14c..9c2c1f93b 100644
--- a/src/live_effects/parameter/satellitepairarray.cpp
+++ b/src/live_effects/parameter/satellitepairarray.cpp
@@ -34,7 +34,7 @@ SatellitePairArrayParam::SatellitePairArrayParam(
knot_color = 0x00ff0000;
helper_size = 0;
use_distance = false;
-
+ _effectType = FILLET_CHAMFER;
last_pointwise = NULL;
}
@@ -69,37 +69,61 @@ void SatellitePairArrayParam::set_unit(const gchar *abbr)
unit = abbr;
}
+void SatellitePairArrayParam::set_effect_type(EffectType et)
+{
+ _effectType = et;
+}
+
void SatellitePairArrayParam::set_helper_size(int hs)
{
helper_size = hs;
updateCanvasIndicators();
}
-void SatellitePairArrayParam::updateCanvasIndicators()
+void SatellitePairArrayParam::updateCanvasIndicators(bool mirror)
{
+ if( last_pointwise == NULL){
+ return;
+ }
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = last_pointwise->getPwd2();
- hp.clear();
- bool mirrorPass = false;
+ if( mirror == true){
+ hp.clear();
+ }
for (unsigned int i = 0; i < _vector.size(); ++i) {
if(!_vector[i].second.getActive() || !_vector[i].second.getHidden()){
continue;
}
+ if((!_vector[i].second.getHasMirror() && mirror == true) || _vector[i].second.getAmount() == 0){
+ continue;
+ }
double pos = 0;
if(pwd2.size() <= (unsigned)_vector[i].first){
break;
}
Geom::D2<Geom::SBasis> d2 = pwd2[_vector[i].first];
- if(mirrorPass == true){
- double size = _vector[i].second.getSize(pwd2[_vector[i].first]);
- boost::optional<Geom::D2<Geom::SBasis> > curve_in = last_pointwise->getCurveIn(_vector[i]);
+ bool overflow = false;
+ double size_out = _vector[i].second.getSize(pwd2[_vector[i].first]);
+ double lenght_out = Geom::length(pwd2[_vector[i].first], Geom::EPSILON);
+ double lenght_in = 0;
+ boost::optional<Geom::D2<Geom::SBasis> > curve_in = last_pointwise->getCurveIn(_vector[i]);
+ if(curve_in){
+ lenght_in = Geom::length(*curve_in, Geom::EPSILON);
+ }
+ if(mirror == true){
if(curve_in){
d2 = *curve_in;
- pos = _vector[i].second.getOpositeTime(size,*curve_in);
+ pos = _vector[i].second.getOpositeTime(size_out,*curve_in);
+ if(lenght_out < size_out){
+ overflow = true;
+ }
}
} else {
pos = _vector[i].second.getTime(pwd2[_vector[i].first]);
+ if(lenght_in < size_out){
+ overflow = true;
+ }
}
- if (pos == 0) {
+ if (pos <= 0 || pos >= 1) {
continue;
}
Geom::Point ptA = d2.valueAt(pos);
@@ -113,7 +137,7 @@ void SatellitePairArrayParam::updateCanvasIndicators()
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
Geom::Affine aff = Geom::Affine();
aff *= Geom::Scale(helper_size);
- if(mirrorPass == true){
+ if(mirror == true){
aff *= Geom::Rotate(ray1.angle() - deg_to_rad(90));
} else {
aff *= Geom::Rotate(ray1.angle() - deg_to_rad(270));
@@ -122,13 +146,40 @@ void SatellitePairArrayParam::updateCanvasIndicators()
pathv += d2.valueAt(pos);
hp.push_back(pathv[0]);
hp.push_back(pathv[1]);
- if(_vector[i].second.getHasMirror() && mirrorPass == false){
- mirrorPass = true;
- i--;
- } else {
- mirrorPass = false;
+ if(overflow){
+ double diameter = helper_size;
+ if(helper_size == 0){
+ diameter = 15;
+ char const * svgd;
+ svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z";
+ Geom::PathVector pathv = sp_svg_read_pathv(svgd);
+ pathv *= Geom::Scale (diameter);
+ pathv += ptA-Geom::Point(diameter * 0.35,diameter * 0.35);
+ hp.push_back(pathv[0]);
+ } else {
+ char const * svgd;
+ svgd = "M 0 -1.32 A 1.32 1.32 0 0 0 -1.32 0 A 1.32 1.32 0 0 0 0 1.32 A 1.32 1.32 0 0 0 1.18 0.59 L 0 0 L 1.18 -0.59 A 1.32 1.32 0 0 0 0 -1.32 z";
+ Geom::PathVector pathv = sp_svg_read_pathv(svgd);
+ aff = Geom::Affine();
+ aff *= Geom::Scale(helper_size/2.0);
+ if(mirror == true){
+ aff *= Geom::Rotate(ray1.angle() - deg_to_rad(90));
+ } else {
+ aff *= Geom::Rotate(ray1.angle() - deg_to_rad(270));
+ }
+ pathv *= aff;
+ pathv += d2.valueAt(pos);
+ hp.push_back(pathv[0]);
+ }
}
}
+ if( mirror == true){
+ updateCanvasIndicators(false);
+ }
+}
+void SatellitePairArrayParam::updateCanvasIndicators()
+{
+ updateCanvasIndicators(true);
}
void SatellitePairArrayParam::addCanvasIndicators(
@@ -139,76 +190,62 @@ void SatellitePairArrayParam::addCanvasIndicators(
void SatellitePairArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
SPDesktop *desktop,
- SPItem *item)
+ SPItem *item,
+ bool mirror)
{
for (unsigned int i = 0; i < _vector.size(); ++i) {
if(!_vector[i].second.getActive() || !_vector[i].second.getHidden()){
continue;
}
- if(_vector[i].second.getHasMirror()){
- addKnotHolderEntitieMirrored(knotholder, desktop, item, i);
+ if(!_vector[i].second.getHasMirror() && mirror == true){
+ continue;
+ }
+ int iPlus = i;
+ if( mirror == true){
+ iPlus = i + _vector.size();
}
using namespace Geom;
SatelliteType type = _vector[i].second.getSatelliteType();
- const gchar *tip;
- if (type == C){
- tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- } else if (type == IC) {
- tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- } else if (type == IF) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- } else {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ //IF is for filletChamfer effect...
+ if(_effectType == FILLET_CHAMFER){
+ const gchar *tip;
+ if (type == C){
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ } else if (type == IC) {
+ tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ } else if (type == IF) {
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ } else {
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ }
+ FilletChamferKnotHolderEntity *e =
+ new FilletChamferKnotHolderEntity(this, iPlus);
+ e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),
+ knot_shape, knot_mode, knot_color);
+ knotholder->add(e);
}
- SatellitePairArrayParamKnotHolderEntity *e =
- new SatellitePairArrayParamKnotHolderEntity(this, i);
- e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),
- knot_shape, knot_mode, knot_color);
- knotholder->add(e);
+ }
+ if( mirror == true){
+ addKnotHolderEntities(knotholder, desktop, item, false);
}
}
-void SatellitePairArrayParam::addKnotHolderEntitieMirrored(KnotHolder *knotholder,
+void SatellitePairArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
SPDesktop *desktop,
- SPItem *item, int i)
+ SPItem *item)
{
- using namespace Geom;
- SatelliteType type = _vector[i].second.getSatelliteType();
- const gchar *tip;
- if (type == C){
- tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- } else if (type == IC) {
- tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- } else if (type == IF) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- } else {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- }
- SatellitePairArrayParamKnotHolderEntity *e =
- new SatellitePairArrayParamKnotHolderEntity(this, i + _vector.size());
- e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),
- knot_shape, knot_mode, knot_color);
- knotholder->add(e);
+ addKnotHolderEntities(knotholder, desktop, item, true);
}
-
-SatellitePairArrayParamKnotHolderEntity::SatellitePairArrayParamKnotHolderEntity(SatellitePairArrayParam *p, unsigned int index)
+FilletChamferKnotHolderEntity::FilletChamferKnotHolderEntity(SatellitePairArrayParam *p, unsigned int index)
: _pparam(p),
_index(index)
{
@@ -216,7 +253,7 @@ SatellitePairArrayParamKnotHolderEntity::SatellitePairArrayParamKnotHolderEntity
-void SatellitePairArrayParamKnotHolderEntity::knot_set(Point const &p,
+void FilletChamferKnotHolderEntity::knot_set(Point const &p,
Point const &/*origin*/,
guint state)
{
@@ -244,10 +281,11 @@ void SatellitePairArrayParamKnotHolderEntity::knot_set(Point const &p,
mirrorTime = timeStart;
}
double size = satellite.second.toSize(mirrorTime, *d2_in);
- double lenght = Geom::length(*d2_in, Geom::EPSILON) - size;
- double time = satellite.second.toTime(lenght,pwd2[satellite.first]);
- s = pwd2[satellite.first].valueAt(time);
- satellite.second.setPosition(s,pwd2[satellite.first]);
+ double amount = Geom::length(*d2_in, Geom::EPSILON) - size;
+ if(satellite.second.getIsTime()){
+ amount = satellite.second.toTime(amount,pwd2[satellite.first]);
+ }
+ satellite.second.setAmount(amount);
}
} else {
satellite.second.setPosition(s,pwd2[satellite.first]);
@@ -260,7 +298,7 @@ void SatellitePairArrayParamKnotHolderEntity::knot_set(Point const &p,
}
Geom::Point
-SatellitePairArrayParamKnotHolderEntity::knot_get() const
+FilletChamferKnotHolderEntity::knot_get() const
{
Geom::Point tmpPoint;
int index = _index;
@@ -303,15 +341,19 @@ SatellitePairArrayParamKnotHolderEntity::knot_get() const
}
-void SatellitePairArrayParamKnotHolderEntity::knot_click(guint state)
+void FilletChamferKnotHolderEntity::knot_click(guint state)
{
+ if( _pparam->last_pointwise == NULL){
+ return;
+ }
+
int index = _index;
if( _index >= _pparam->_vector.size()){
index = _index-_pparam->_vector.size();
}
if (state & GDK_CONTROL_MASK) {
if (state & GDK_MOD1_MASK) {
- _pparam->_vector.at(index).second.setAmmount(0.0);
+ _pparam->_vector.at(index).second.setAmount(0.0);
_pparam->param_set_and_write_new_value(_pparam->_vector);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
}else{
@@ -356,9 +398,9 @@ void SatellitePairArrayParamKnotHolderEntity::knot_click(guint state)
this->knot->show();
}
} else if (state & GDK_SHIFT_MASK) {
- double ammount = _pparam->_vector.at(index).second.getAmmount();
+ double amount = _pparam->_vector.at(index).second.getAmount();
if(!_pparam->use_distance && !_pparam->_vector.at(index).second.getIsTime()){
- ammount = _pparam->last_pointwise->len_to_rad(ammount, _pparam->_vector.at(index));
+ amount = _pparam->last_pointwise->len_to_rad(amount, _pparam->_vector.at(index));
}
boost::optional<Geom::D2<Geom::SBasis> > d2_in = _pparam->last_pointwise->getCurveIn(_pparam->_vector.at(index));
bool aprox = false;
@@ -367,22 +409,29 @@ void SatellitePairArrayParamKnotHolderEntity::knot_click(guint state)
aprox = ((*d2_in)[0].degreesOfFreedom() != 2 || d2_out[0].degreesOfFreedom() != 2) && !_pparam->use_distance?true:false;
}
Inkscape::UI::Dialogs::FilletChamferPropertiesDialog::showDialog(
- this->desktop, ammount , this, _pparam->unit, _pparam->use_distance, aprox, _pparam->documentUnit,_pparam->_vector.at(index).second);
+ this->desktop, amount , this, _pparam->unit, _pparam->use_distance, aprox, _pparam->documentUnit,_pparam->_vector.at(index).second);
}
}
-void SatellitePairArrayParamKnotHolderEntity::knot_set_offset(Geom::Satellite satellite)
+void FilletChamferKnotHolderEntity::knot_set_offset(Geom::Satellite satellite)
{
+ if( _pparam->last_pointwise == NULL){
+ return;
+ }
int index = _index;
if( _index >= _pparam->_vector.size()){
index = _index-_pparam->_vector.size();
}
- double ammount = satellite.getAmmount();
+ double amount = satellite.getAmount();
+ double maxAmount = amount;
if(!_pparam->use_distance && !satellite.getIsTime()){
- ammount = _pparam->last_pointwise->rad_to_len(ammount, _pparam->_vector.at(index));
+ amount = _pparam->last_pointwise->rad_to_len(amount, _pparam->_vector.at(index));
+ if(maxAmount > 0 && amount == 0){
+ amount = _pparam->_vector.at(index).second.getAmount();
+ }
}
- satellite.setAmmount(ammount);
+ satellite.setAmount(amount);
_pparam->_vector.at(index).second = satellite;
this->parent_holder->knot_ungrabbed_handler(this->knot, 0);
_pparam->param_set_and_write_new_value(_pparam->_vector);
diff --git a/src/live_effects/parameter/satellitepairarray.h b/src/live_effects/parameter/satellitepairarray.h
index 21fb0fbd8..79a015c6d 100644
--- a/src/live_effects/parameter/satellitepairarray.h
+++ b/src/live_effects/parameter/satellitepairarray.h
@@ -20,6 +20,7 @@
#include <glib.h>
#include "live_effects/parameter/array.h"
+#include "live_effects/effect-enum.h"
#include "knot-holder-entity.h"
#include <2geom/pointwise.h>
@@ -27,7 +28,7 @@ namespace Inkscape {
namespace LivePathEffect {
-class SatellitePairArrayParamKnotHolderEntity;
+class FilletChamferKnotHolderEntity;
class SatellitePairArrayParam : public ArrayParam<std::pair<unsigned int, Geom::Satellite> > {
public:
@@ -46,7 +47,7 @@ public:
guint32 color);
virtual void set_helper_size(int hs);
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
- virtual void addKnotHolderEntitieMirrored(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item, int i);
+ virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item, bool mirror);
virtual void addCanvasIndicators(SPLPEItem const *lpeitem,std::vector<Geom::PathVector> &hp_vec);
virtual bool providesKnotHolderEntities() const {
return true;
@@ -54,9 +55,11 @@ public:
void set_document_unit(Glib::ustring const * value_document_unit);
void set_use_distance(bool use_knot_distance );
void set_unit(const gchar *abbr);
+ void set_effect_type(EffectType et);
virtual void updateCanvasIndicators();
+ virtual void updateCanvasIndicators(bool mirror);
void set_pointwise(Geom::Pointwise *pointwise);
- friend class SatellitePairArrayParamKnotHolderEntity;
+ friend class FilletChamferKnotHolderEntity;
private:
SatellitePairArrayParam(const SatellitePairArrayParam &);
@@ -70,14 +73,15 @@ private:
bool use_distance;
const gchar *unit;
Glib::ustring const * documentUnit;
+ EffectType _effectType;
Geom::Pointwise *last_pointwise;
};
-class SatellitePairArrayParamKnotHolderEntity : public KnotHolderEntity {
+class FilletChamferKnotHolderEntity : public KnotHolderEntity {
public:
- SatellitePairArrayParamKnotHolderEntity(SatellitePairArrayParam *p, unsigned int index);
- virtual ~SatellitePairArrayParamKnotHolderEntity() {}
+ FilletChamferKnotHolderEntity(SatellitePairArrayParam *p, unsigned int index);
+ virtual ~FilletChamferKnotHolderEntity() {}
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
virtual Geom::Point knot_get() const;