Git commit baa9d8fcaba476677d8def3fb5f411f6478cd649 by Dmitry Kazakov. Committed on 17/02/2017 at 14:19. Pushed by dkazakov into branch 'kazakov/svg-loading'. Make the shortcuts in Edit Tool be consistent with Selection Tool Shift + click, Shift + drag --- multiselection Ctrl + Click on point --- changle point type: corner, smooth, symmetric CC:kimageshop@kde.org M +13 -2 libs/flake/tools/KoPathPointRubberSelectStrategy.cpp M +3 -1 libs/flake/tools/KoPathPointRubberSelectStrategy.h M +13 -28 libs/flake/tools/KoPathTool.cpp M +2 -2 libs/flake/tools/KoPathToolHandle.cpp M +1 -1 plugins/flake/textshape/TextToolFactory.cpp https://commits.kde.org/krita/baa9d8fcaba476677d8def3fb5f411f6478cd649 diff --git a/libs/flake/tools/KoPathPointRubberSelectStrategy.cpp b/libs/fl= ake/tools/KoPathPointRubberSelectStrategy.cpp index d58f6b0650e..05d6dff98a2 100644 --- a/libs/flake/tools/KoPathPointRubberSelectStrategy.cpp +++ b/libs/flake/tools/KoPathPointRubberSelectStrategy.cpp @@ -31,14 +31,25 @@ KoPathPointRubberSelectStrategy::KoPathPointRubberSelec= tStrategy(KoPathTool *too { } = +void KoPathPointRubberSelectStrategy::handleMouseMove(const QPointF &p, Qt= ::KeyboardModifiers modifiers) +{ + KoPathToolSelection * selection =3D dynamic_cast= (m_tool->selection()); + if (selection && !(modifiers & Qt::ShiftModifier)) { + selection->clear(); + } + + KoShapeRubberSelectStrategy::handleMouseMove(p, modifiers); +} + void KoPathPointRubberSelectStrategy::finishInteraction(Qt::KeyboardModifi= ers modifiers) { Q_D(KoShapeRubberSelectStrategy); KoPathToolSelection * selection =3D dynamic_cast= (m_tool->selection()); - if (! selection) + if (!selection) { return; + } = - selection->selectPoints(d->selectedRect(), !(modifiers & Qt::ControlMo= difier)); + selection->selectPoints(d->selectedRect(), !(modifiers & Qt::ShiftModi= fier)); m_tool->canvas()->updateCanvas(d->selectedRect().normalized()); selection->repaint(); } diff --git a/libs/flake/tools/KoPathPointRubberSelectStrategy.h b/libs/flak= e/tools/KoPathPointRubberSelectStrategy.h index 87b04f7e2a2..9817c8c4d11 100644 --- a/libs/flake/tools/KoPathPointRubberSelectStrategy.h +++ b/libs/flake/tools/KoPathPointRubberSelectStrategy.h @@ -33,7 +33,9 @@ class KoPathPointRubberSelectStrategy : public KoShapeRub= berSelectStrategy public: KoPathPointRubberSelectStrategy(KoPathTool *tool, const QPointF &click= ed); virtual ~KoPathPointRubberSelectStrategy() {} - virtual void finishInteraction(Qt::KeyboardModifiers modifiers); + + void handleMouseMove(const QPointF &p, Qt::KeyboardModifiers modifiers= ) override; + void finishInteraction(Qt::KeyboardModifiers modifiers) override; = private: /// pointer to the path tool diff --git a/libs/flake/tools/KoPathTool.cpp b/libs/flake/tools/KoPathTool.= cpp index c90fe3c0748..8a7bc209d62 100644 --- a/libs/flake/tools/KoPathTool.cpp +++ b/libs/flake/tools/KoPathTool.cpp @@ -491,10 +491,6 @@ void KoPathTool::mousePressEvent(KoPointerEvent *event) delete m_activeSegment; m_activeSegment =3D 0; } else { - if ((event->modifiers() & Qt::ControlModifier) =3D=3D 0) { - m_pointSelection.clear(); - } - // start rubberband selection Q_ASSERT(m_currentStrategy =3D=3D 0); m_currentStrategy =3D new KoPathPointRubberSelectStrategy(= this, event->point); event->accept(); @@ -514,8 +510,10 @@ void KoPathTool::mouseMoveEvent(KoPointerEvent *event) = // repaint new handle positions m_pointSelection.repaint(); - if (m_activeHandle) + if (m_activeHandle) { m_activeHandle->repaint(); + } + return; } = @@ -612,8 +610,11 @@ void KoPathTool::mouseMoveEvent(KoPointerEvent *event) } = useCursor(m_selectCursor); - if (m_activeHandle) + + if (m_activeHandle) { m_activeHandle->repaint(); + } + delete m_activeHandle; m_activeHandle =3D 0; = @@ -681,17 +682,6 @@ void KoPathTool::keyPressEvent(QKeyEvent *event) } } else { switch (event->key()) { -// TODO move these to the actions in the constructor. - case Qt::Key_I: { - KoDocumentResourceManager *rm =3D d->canvas->shapeController()= ->resourceManager(); - int handleRadius =3D rm->handleRadius(); - if (event->modifiers() & Qt::ControlModifier) - handleRadius--; - else - handleRadius++; - rm->setHandleRadius(handleRadius); - break; - } #ifndef NDEBUG case Qt::Key_D: if (m_pointSelection.objectCount() =3D=3D 1) { @@ -740,14 +730,11 @@ void KoPathTool::mouseDoubleClickEvent(KoPointerEvent= *event) event->ignore(); = // check if we are doing something else at the moment - if (m_currentStrategy) - return; + if (m_currentStrategy) return; = - PathSegment *s =3D segmentAtPoint(event->point); - if (!s) - return; + QScopedPointer s(segmentAtPoint(event->point)); = - if (s->isValid()) { + if (s && s->isValid()) { QList segments; segments.append(KoPathPointData(s->path, s->path->pathPointIndex(s= ->segmentStart))); KoPathPointInsertCommand *cmd =3D new KoPathPointInsertCommand(seg= ments, s->positionOnSegment); @@ -759,7 +746,6 @@ void KoPathTool::mouseDoubleClickEvent(KoPointerEvent *= event) updateActions(); event->accept(); } - delete s; } = KoPathTool::PathSegment* KoPathTool::segmentAtPoint(const QPointF &point) @@ -772,7 +758,7 @@ KoPathTool::PathSegment* KoPathTool::segmentAtPoint(con= st QPointF &point) // the max allowed distance from a segment const qreal maxSquaredDistance =3D clickOffset.x()*clickOffset.x(); = - PathSegment *segment =3D new PathSegment; + QScopedPointer segment(new PathSegment); = Q_FOREACH (KoPathShape *shape, m_pointSelection.selectedShapes()) { KoParameterShape * parameterShape =3D dynamic_cast(shape); @@ -805,11 +791,10 @@ KoPathTool::PathSegment* KoPathTool::segmentAtPoint(c= onst QPointF &point) } = if (!segment->isValid()) { - delete segment; - segment =3D 0; + segment.reset(); } = - return segment; + return segment.take(); } = void KoPathTool::activate(ToolActivation toolActivation, const QSet &shapes) diff --git a/libs/flake/tools/KoPathToolHandle.cpp b/libs/flake/tools/KoPat= hToolHandle.cpp index 3c0fe0fdd77..89e44b70b9c 100644 --- a/libs/flake/tools/KoPathToolHandle.cpp +++ b/libs/flake/tools/KoPathToolHandle.cpp @@ -89,11 +89,11 @@ KoInteractionStrategy * PointHandle::handleMousePress(K= oPointerEvent *event) { if ((event->button() & Qt::LeftButton) =3D=3D 0) return 0; - if ((event->modifiers() & Qt::ShiftModifier) =3D=3D 0) { // no shift p= ressed. + if ((event->modifiers() & Qt::ControlModifier) =3D=3D 0) { // no shift= pressed. KoPathToolSelection * selection =3D dynamic_cast(m_tool->selection()); = // control select adds/removes points to/from the selection - if (event->modifiers() & Qt::ControlModifier) { + if (event->modifiers() & Qt::ShiftModifier) { if (selection->contains(m_activePoint)) { selection->remove(m_activePoint); } else { diff --git a/plugins/flake/textshape/TextToolFactory.cpp b/plugins/flake/te= xtshape/TextToolFactory.cpp index 0be037e0d7a..d032de3f640 100644 --- a/plugins/flake/textshape/TextToolFactory.cpp +++ b/plugins/flake/textshape/TextToolFactory.cpp @@ -31,7 +31,7 @@ TextToolFactory::TextToolFactory() setToolTip(i18n("Text editing")); setSection(dynamicToolType() + ",calligrawords,calligraauthor"); setIconName(koIconNameCStr("tool-text")); - setPriority(0); + setPriority(2); setActivationShapeId(TextShape_SHAPEID "," AnnotationShape_SHAPEID); } =