summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-06-12 22:58:55 +0000
committerjabiertxof <info@marker.es>2016-06-12 22:58:55 +0000
commit73f078b27b669c941651ecf14a3119ae491ccabf (patch)
tree859d650d22f499e1b3af266bcd3e43ff39bdbc6f /src/live_effects/parameter
parentHandle both directions on knot reposition (diff)
downloadinkscape-73f078b27b669c941651ecf14a3119ae491ccabf.tar.gz
inkscape-73f078b27b669c941651ecf14a3119ae491ccabf.zip
Fix 90% of tweenk review
(bzr r13645.1.155)
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/array.cpp15
-rw-r--r--src/live_effects/parameter/array.h2
-rw-r--r--src/live_effects/parameter/satellitesarray.cpp51
-rw-r--r--src/live_effects/parameter/satellitesarray.h5
4 files changed, 47 insertions, 26 deletions
diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp
index 4e3037904..28867def2 100644
--- a/src/live_effects/parameter/array.cpp
+++ b/src/live_effects/parameter/array.cpp
@@ -58,18 +58,19 @@ ArrayParam<std::vector<Satellite > >::readsvg(const gchar * str)
gchar ** strarray = g_strsplit(str, "@", 0);
gchar ** iter = strarray;
while (*iter != NULL) {
- gchar ** strsubarray = g_strsplit(*iter, ",", 7);
- if(*strsubarray[6]){
+ gchar ** strsubarray = g_strsplit(*iter, ",", 8);
+ if(*strsubarray[7]){//steps always > 0
Satellite *satellite = new Satellite();
satellite->setSatelliteType(g_strstrip(strsubarray[0]));
satellite->is_time = strncmp(strsubarray[1],"1",1) == 0;
- satellite->has_mirror = strncmp(strsubarray[2],"1",1) == 0;
- satellite->hidden = strncmp(strsubarray[3],"1",1) == 0;
+ satellite->selected = strncmp(strsubarray[2],"1",1) == 0;
+ satellite->has_mirror = strncmp(strsubarray[3],"1",1) == 0;
+ satellite->hidden = strncmp(strsubarray[4],"1",1) == 0;
double amount,angle;
float stepsTmp;
- sp_svg_number_read_d(strsubarray[4], &amount);
- sp_svg_number_read_d(strsubarray[5], &angle);
- sp_svg_number_read_f(g_strstrip(strsubarray[6]), &stepsTmp);
+ sp_svg_number_read_d(strsubarray[5], &amount);
+ sp_svg_number_read_d(strsubarray[6], &angle);
+ sp_svg_number_read_f(g_strstrip(strsubarray[7]), &stepsTmp);
unsigned int steps = (unsigned int)stepsTmp;
satellite->amount = amount;
satellite->angle = angle;
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index 9802abc2e..9204ede1f 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -120,6 +120,8 @@ protected:
str << ",";
str << vector_data[i].is_time;
str << ",";
+ str << vector_data[i].selected;
+ str << ",";
str << vector_data[i].has_mirror;
str << ",";
str << vector_data[i].hidden;
diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp
index 18e1bd4de..2f5cea7b5 100644
--- a/src/live_effects/parameter/satellitesarray.cpp
+++ b/src/live_effects/parameter/satellitesarray.cpp
@@ -26,7 +26,7 @@ SatellitesArrayParam::SatellitesArrayParam(const Glib::ustring &label,
const Glib::ustring &key,
Inkscape::UI::Widget::Registry *wr,
Effect *effect)
- : ArrayParam<std::vector<Satellite> >(label, tip, key, wr, effect, 0), knoth(NULL)
+ : ArrayParam<std::vector<Satellite> >(label, tip, key, wr, effect, 0), _knoth(NULL)
{
_knot_shape = SP_KNOT_SHAPE_DIAMOND;
_knot_mode = SP_KNOT_MODE_XOR;
@@ -180,6 +180,9 @@ void SatellitesArrayParam::updateCanvasIndicators(bool mirror)
}
}
}
+ if(!_knot_reset_helper.empty()){
+ _hp.insert(_hp.end(), _knot_reset_helper.begin(), _knot_reset_helper.end() );
+ }
if (mirror) {
updateCanvasIndicators(false);
}
@@ -230,24 +233,21 @@ void SatellitesArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
using namespace Geom;
//If is for filletChamfer effect...
if (_effectType == FILLET_CHAMFER) {
-// if(!pathv[i].closed() && (j == 0 || j == _vector[i].size() -1)) {
-// continue;
-// }
const gchar *tip;
if (type == CHAMFER) {
- tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (type == INVERSE_CHAMFER) {
- tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (type == INVERSE_FILLET) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
}
@@ -267,7 +267,7 @@ void SatellitesArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
SPDesktop *desktop,
SPItem *item)
{
- knoth = knotholder;
+ _knoth = knotholder;
addKnotHolderEntities(knotholder, desktop, item, true);
}
@@ -316,6 +316,14 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p,
Geom::Point normal = pathv[path_index][curve_index].pointAt(normal_time);
double distance_mirror = Geom::distance(mirror,s);
double distance_normal = Geom::distance(normal,s);
+ //this avoid toggle when fillet are near node
+// if (is_mirror && Geom::are_near(mirror, pathv[path_index][curve_index].initialPoint())) {
+// distance_mirror = 0.0;
+// distance_normal = 1.0;
+// } else if (!is_mirror && Geom::are_near(normal, pathv[path_index][curve_index].initialPoint())){
+// distance_mirror = 1.0;
+// distance_normal = 0.0;
+// }
if (distance_mirror <= distance_normal) {
double time_start = 0;
Satellites satellites = _pparam->_last_pathvector_satellites->getSatellites();
@@ -332,6 +340,15 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p,
} else {
satellite.setPosition(s, pathv[path_index][curve_index]);
}
+ _pparam->_knot_reset_helper.clear();
+ if (satellite.amount == 0){
+ char const *svgd;
+ svgd = "M -5.39,8.78 -9.13,5.29 -10.38,10.28 Z M -7.22,7.07 -3.43,3.37 m -1.95,-12.16 -3.74,3.5 -1.26,-5 z "
+ "m -1.83,1.71 3.78,3.7 M 5.24,8.78 8.98,5.29 10.24,10.28 Z "
+ "M 7.07,7.07 3.29,3.37 M 5.24,-8.78 l 3.74,3.5 1.26,-5 z M 7.07,-7.07 3.29,-3.37";
+ _pparam->_knot_reset_helper = sp_svg_read_pathv(svgd);
+ _pparam->_knot_reset_helper *= Geom::Affine(_pparam->_helper_size * 0.1,0,0,_pparam->_helper_size * 0.1,0,0) * Geom::Translate(Geom::Point(normal));
+ }
_pparam->_vector[path_index][curve_index] = satellite;
SPLPEItem *splpeitem = dynamic_cast<SPLPEItem *>(item);
if (splpeitem) {
@@ -446,21 +463,21 @@ void FilletChamferKnotHolderEntity::knot_click(guint state)
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
const gchar *tip;
if (type == CHAMFER) {
- tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
} else if (type == INVERSE_CHAMFER) {
- tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
} else if (type == INVERSE_FILLET) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
} else {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
}
this->knot->tip = g_strdup(tip);
this->knot->show();
diff --git a/src/live_effects/parameter/satellitesarray.h b/src/live_effects/parameter/satellitesarray.h
index 30b1db6c1..64bc934c8 100644
--- a/src/live_effects/parameter/satellitesarray.h
+++ b/src/live_effects/parameter/satellitesarray.h
@@ -64,7 +64,7 @@ public:
friend class LPEFilletChamfer;
protected:
- KnotHolder *knoth;
+ KnotHolder *_knoth;
private:
SatellitesArrayParam(const SatellitesArrayParam &);
@@ -74,6 +74,7 @@ private:
SPKnotModeType _knot_mode;
guint32 _knot_color;
Geom::PathVector _hp;
+ Geom::PathVector _knot_reset_helper;
int _helper_size;
bool _use_distance;
bool _global_knot_hide;
@@ -87,7 +88,7 @@ public:
FilletChamferKnotHolderEntity(SatellitesArrayParam *p, size_t index);
virtual ~FilletChamferKnotHolderEntity()
{
- _pparam->knoth = NULL;
+ _pparam->_knoth = NULL;
}
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin,