diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-12-03 20:00:48 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2016-12-03 20:00:48 +0000 |
| commit | 1b0115caee90d4da4281a76c359a920087ec58bf (patch) | |
| tree | 842cbd0e67a45a586bd191076e4c9c556125f063 /src/gradient-drag.cpp | |
| parent | Fix a typo (diff) | |
| download | inkscape-1b0115caee90d4da4281a76c359a920087ec58bf.tar.gz inkscape-1b0115caee90d4da4281a76c359a920087ec58bf.zip | |
Enable node resizing in mesh tool.
(bzr r15296)
Diffstat (limited to 'src/gradient-drag.cpp')
| -rw-r--r-- | src/gradient-drag.cpp | 27 |
1 files changed, 27 insertions, 0 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(); |
