summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2016-12-03 22:49:54 +0000
committerJabiertxof <jtx@jtx>2016-12-03 22:49:54 +0000
commitc0c68e209a2836551355aad581ef3f001ab2ee8f (patch)
tree8879fce4bc2484af69e87e2e707dfdaf7c677cf8
parentStart coding (diff)
parentFix names in measure line LPE (diff)
downloadinkscape-c0c68e209a2836551355aad581ef3f001ab2ee8f.tar.gz
inkscape-c0c68e209a2836551355aad581ef3f001ab2ee8f.zip
Update to trunk
(bzr r15295.1.2)
-rw-r--r--src/gradient-drag.cpp27
-rw-r--r--src/gradient-drag.h5
-rw-r--r--src/live_effects/lpe-measure-line.cpp18
-rw-r--r--src/live_effects/lpe-measure-line.h10
4 files changed, 46 insertions, 14 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 752e408f8..8bdc4134a 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -1209,6 +1209,30 @@ void GrDragger::fireDraggables(bool write_repr, bool scale_radial, bool merging_
}
}
+void GrDragger::updateControlSizesOverload(SPKnot * knot)
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ int sizes[] = {4, 6, 8, 10, 12, 14, 16};
+ std::vector<int> sizeTable = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0])));
+ int size = prefs->getIntLimited("/options/grabsize/value", 3, 1, 7);
+ int knot_size = sizeTable[size - 1];
+ if(knot->shape == SP_KNOT_SHAPE_TRIANGLE){
+ knot_size *= 2.2;
+ knot_size = floor(knot_size);
+ if ( knot_size % 2 == 0 ){
+ knot_size += 1;
+ }
+ }
+ knot->setSize(knot_size);
+}
+
+void GrDragger::updateControlSizes()
+{
+ updateControlSizesOverload(this->knot);
+ this->knot->updateCtrl();
+ this->updateKnotShape();
+}
+
/**
* Checks if the dragger has a draggable with this point_type.
*/
@@ -1608,6 +1632,7 @@ GrDragger::GrDragger(GrDrag *parent, Geom::Point p, GrDraggable *draggable)
}
this->knot->setFill(fill_color, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
this->knot->setStroke(0x0000007f, 0x0000007f, 0x0000007f);
+ this->updateControlSizesOverload(this->knot);
this->knot->updateCtrl();
// move knot to the given point
@@ -1626,6 +1651,7 @@ GrDragger::GrDragger(GrDrag *parent, Geom::Point p, GrDraggable *draggable)
this->_moved_connection = this->knot->moved_signal.connect(sigc::bind(sigc::ptr_fun(gr_knot_moved_handler), this));
}
+ this->sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged(sigc::mem_fun(*this, &GrDragger::updateControlSizes));
this->_clicked_connection = this->knot->click_signal.connect(sigc::bind(sigc::ptr_fun(gr_knot_clicked_handler), this));
this->_doubleclicked_connection = this->knot->doubleclicked_signal.connect(sigc::bind(sigc::ptr_fun(gr_knot_doubleclicked_handler), this));
this->_grabbed_connection = this->knot->grabbed_signal.connect(sigc::bind(sigc::ptr_fun(gr_knot_grabbed_handler), this));
@@ -1648,6 +1674,7 @@ GrDragger::~GrDragger()
//this->parent->setDeselected(this);
// disconnect signals
+ this->sizeUpdatedConn.disconnect();
this->_moved_connection.disconnect();
this->_clicked_connection.disconnect();
this->_doubleclicked_connection.disconnect();
diff --git a/src/gradient-drag.h b/src/gradient-drag.h
index a18511e69..a57e9b070 100644
--- a/src/gradient-drag.h
+++ b/src/gradient-drag.h
@@ -116,6 +116,11 @@ struct GrDragger {
void fireDraggables(bool write_repr, bool scale_radial = false, bool merging_focus = false);
+protected:
+ void updateControlSizesOverload(SPKnot * knot);
+ void updateControlSizes();
+ sigc::connection sizeUpdatedConn;
+
private:
sigc::connection _moved_connection;
sigc::connection _clicked_connection;
diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp
index 9238f2571..ef270d849 100644
--- a/src/live_effects/lpe-measure-line.cpp
+++ b/src/live_effects/lpe-measure-line.cpp
@@ -677,22 +677,22 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
void
LPEMeasureLine::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
{
- processObjects(MA_VISIBILITY);
+ processObjects(LPE_VISIBILITY);
}
void
LPEMeasureLine::doOnRemove (SPLPEItem const* /*lpeitem*/)
{
if (!erase_extra_objects) {
- processObjects(MA_TO_OBJECTS);
+ processObjects(LPE_TO_OBJECTS);
ml_elements.clear();
return;
}
- processObjects(MA_ERASE);
+ processObjects(LPE_ERASE);
}
void
-LPEMeasureLine::processObjects(MeasureAction measure_action)
+LPEMeasureLine::processObjects(LpeAction lpe_action)
{
if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
@@ -704,14 +704,14 @@ LPEMeasureLine::processObjects(MeasureAction measure_action)
SVGElemRef->attach(SVGElem_uri);
SPObject *elemref = NULL;
if (elemref = SVGElemRef->getObject()) {
- switch (measure_action){
- case MA_TO_OBJECTS:
+ switch (lpe_action){
+ case LPE_TO_OBJECTS:
elemref->getRepr()->setAttribute("sodipodi:insensitive", NULL);
break;
- case MA_ERASE:
+ case LPE_ERASE:
elemref->deleteObject();
break;
- default: //MA_VISIBILITY
+ default: //LPE_VISIBILITY
if (!this->isVisible()) {
elemref->getRepr()->setAttribute("style", "display:none");
} else {
@@ -721,7 +721,7 @@ LPEMeasureLine::processObjects(MeasureAction measure_action)
}
}
}
- if (measure_action == MA_ERASE) {
+ if (lpe_action == LPE_ERASE) {
ml_elements.clear();
}
}
diff --git a/src/live_effects/lpe-measure-line.h b/src/live_effects/lpe-measure-line.h
index ed8224ab6..a05189039 100644
--- a/src/live_effects/lpe-measure-line.h
+++ b/src/live_effects/lpe-measure-line.h
@@ -32,10 +32,10 @@ enum OrientationMethod {
OM_END
};
-enum MeasureAction {
- MA_ERASE = 0,
- MA_TO_OBJECTS,
- MA_VISIBILITY
+enum LpeAction {
+ LPE_ERASE = 0,
+ LPE_TO_OBJECTS,
+ LPE_VISIBILITY
};
class LPEMeasureLine : public Effect {
@@ -47,7 +47,7 @@ public:
virtual void doOnRemove (SPLPEItem const* /*lpeitem*/);
virtual void doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/);
virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in);
- void processObjects(MeasureAction measure_action);
+ void processObjects(LpeAction lpe_action);
void createLine(Geom::Point start,Geom::Point end,Glib::ustring id, bool main, bool overflow, bool remove, bool arrows = false);
void createTextLabel(Geom::Point pos, double length, Geom::Coord angle, bool remove, bool valid);
void onExpanderChanged();