summaryrefslogtreecommitdiffstats
path: root/src/ui/tools
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-07-27 01:17:50 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-07-27 01:17:50 +0000
commit0ac6f5cccf5aaa8bb8d97fdf96d040646b7056c1 (patch)
treef3f00d4c95db349232b1e201fd2e45118d511f6e /src/ui/tools
parentFix for 1309050 (diff)
parentProperly fix 1309050, revert incorrect fix for 601336 (diff)
downloadinkscape-0ac6f5cccf5aaa8bb8d97fdf96d040646b7056c1.tar.gz
inkscape-0ac6f5cccf5aaa8bb8d97fdf96d040646b7056c1.zip
Merge from trunk 13472
(bzr r13341.1.102)
Diffstat (limited to 'src/ui/tools')
-rw-r--r--src/ui/tools/pen-tool.cpp28
-rw-r--r--src/ui/tools/spray-tool.cpp2
-rw-r--r--src/ui/tools/tool-base.cpp9
3 files changed, 19 insertions, 20 deletions
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 56bcbef0d..d826eaf48 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -86,15 +86,15 @@ static bool pen_within_tolerance = false;
static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical
namespace {
- ToolBase* createPenContext() {
- return new PenTool();
- }
+ ToolBase* createPenContext() {
+ return new PenTool();
+ }
- bool penContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pen", createPenContext);
+ bool penContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pen", createPenContext);
}
const std::string& PenTool::getPrefsPath() {
- return PenTool::prefsPath;
+ return PenTool::prefsPath;
}
const std::string PenTool::prefsPath = "/tools/freehand/pen";
@@ -321,7 +321,7 @@ bool PenTool::item_handler(SPItem* item, GdkEvent* event) {
}
if (!ret) {
- ret = FreehandBase::item_handler(item, event);
+ ret = FreehandBase::item_handler(item, event);
}
return ret;
@@ -359,7 +359,7 @@ bool PenTool::root_handler(GdkEvent* event) {
}
if (!ret) {
- ret = FreehandBase::root_handler(event);
+ ret = FreehandBase::root_handler(event);
}
return ret;
@@ -1268,15 +1268,15 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
}
// asign the value in a third of the distance of the last segment.
- if(this->bspline){
+ if (this->bspline){
this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]);
}
Geom::Point const pt( (this->npoints < 4) ? crv->finalPoint() : this->p[3] );
-
+
this->npoints = 2;
// delete the last segment of the green curve
- if( this->green_curve->get_segment_count() == 1){
+ if (this->green_curve->get_segment_count() == 1) {
this->npoints = 5;
if (this->green_bpaths) {
if (this->green_bpaths->data) {
@@ -1285,11 +1285,12 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
}
this->green_curve->reset();
- }else{
+ } else {
this->green_curve->backspace();
}
+
// assign the value of this->p[1] to the oposite of the green line last segment
- if(this->spiro){
+ if (this->spiro){
Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(this->green_curve->last_segment());
if ( cubic ) {
this->p[1] = (*cubic)[3] + (*cubic)[3] - (*cubic)[2];
@@ -1298,6 +1299,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
this->p[1] = this->p[0];
}
}
+
sp_canvas_item_hide(this->c0);
sp_canvas_item_hide(this->c1);
sp_canvas_item_hide(this->cl0);
@@ -2084,7 +2086,7 @@ void PenTool::_setSubsequentPoint(Geom::Point const p, bool statusbar, guint sta
// we are drawing horizontal/vertical lines and hit an anchor;
Geom::Point const origin = this->p[0];
// if the previous point and the anchor are not aligned either horizontally or vertically...
- if ((abs(p[Geom::X] - origin[Geom::X]) > 1e-9) && (abs(p[Geom::Y] - origin[Geom::Y]) > 1e-9)) {
+ if ((std::abs(p[Geom::X] - origin[Geom::X]) > 1e-9) && (std::abs(p[Geom::Y] - origin[Geom::Y]) > 1e-9)) {
// ...then we should draw an L-shaped path, consisting of two paraxial segments
Geom::Point intermed = p;
this->_setToNearestHorizVert(intermed, status, false);
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index 08d3119a1..29f1b9a73 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -677,7 +677,7 @@ bool SprayTool::root_handler(GdkEvent* event) {
desktop->setToolboxAdjustmentValue("population", this->population * 100);
Geom::Point const scroll_w(event->button.x, event->button.y);
Geom::Point const scroll_dt = desktop->point();;
- Geom::Point motion_doc(desktop->dt2doc(scroll_dt));
+
switch (event->scroll.direction) {
case GDK_SCROLL_DOWN:
case GDK_SCROLL_UP: {
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 4195c9eb2..f1d90f6c6 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -1289,8 +1289,7 @@ void sp_event_context_snap_delay_handler(ToolBase *ec,
// now, just in case there's no future motion event that drops under the speed limit (when
// stopping abruptly)
delete ec->_delayed_snap_event;
- ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2,
- event, origin); // watchdog is reset, i.e. pushed forward in time
+ ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); // watchdog is reset, i.e. pushed forward in time
// If the watchdog expires before a new motion event is received, we will snap (as explained
// above). This means however that when the timer is too short, we will always snap and that the
// speed threshold is ineffective. In the extreme case the delay is set to zero, and snapping will
@@ -1301,15 +1300,13 @@ void sp_event_context_snap_delay_handler(ToolBase *ec,
// snap, and set a new watchdog again.
if (ec->_delayed_snap_event == NULL) { // no watchdog has been set
// it might have already expired, so we'll set a new one; the snapping frequency will be limited this way
- ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item,
- dse_item2, event, origin);
+ ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin);
} // else: watchdog has been set before and we'll wait for it to expire
}
} else {
// This is the first GDK_MOTION_NOTIFY event, so postpone snapping and set the watchdog
g_assert(ec->_delayed_snap_event == NULL);
- ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2,
- event, origin);
+ ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin);
}
prev_pos = event_pos;