diff --git a/krita/pics/tools/SVG/16/dark_tool_magnetic_selection.svg b/krita/pics/tools/SVG/16/dark_tool_magnetic_selection.svg new file mode 100644 index 0000000000..cb6ebd8897 --- /dev/null +++ b/krita/pics/tools/SVG/16/dark_tool_magnetic_selection.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Andrei Rudenko + + + + + + + + + + + + + + + + + + + diff --git a/krita/pics/tools/SVG/16/light_tool_magnetic_selection.svg b/krita/pics/tools/SVG/16/light_tool_magnetic_selection.svg new file mode 100644 index 0000000000..426c2647d5 --- /dev/null +++ b/krita/pics/tools/SVG/16/light_tool_magnetic_selection.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Andrei Rudenko + + + + + + + + + + + + + diff --git a/krita/pics/tools/SVG/16/tools-svg-16-icons.qrc b/krita/pics/tools/SVG/16/tools-svg-16-icons.qrc index d760fb0128..eafca030a8 100644 --- a/krita/pics/tools/SVG/16/tools-svg-16-icons.qrc +++ b/krita/pics/tools/SVG/16/tools-svg-16-icons.qrc @@ -1,82 +1,84 @@ dark_calligraphy.svg dark_draw-text.svg dark_format-fill-color.svg dark_krita_draw_path.svg dark_krita_tool_color_fill.svg dark_krita_tool_color_picker.svg dark_krita_tool_dyna.svg dark_krita_tool_ellipse.svg dark_krita_tool_freehand.svg dark_krita_tool_freehandvector.svg dark_krita_tool_gradient.svg dark_krita_tool_grid.svg dark_krita_tool_line.svg dark_krita_tool_measure.svg dark_krita_tool_move.svg dark_krita_tool_multihand.svg dark_krita_tool_polygon.svg dark_krita_tool_rectangle.svg dark_krita_tool_transform.svg dark_pattern.svg dark_polyline.svg dark_select.svg dark_tool_contiguous_selection.svg dark_tool_crop.svg dark_tool_elliptical_selection.svg dark_tool_outline_selection.svg dark_tool_pan.svg dark_tool_path_selection.svg + dark_tool_magnetic_selection.svg dark_tool_perspectivegrid.svg dark_tool_polygonal_selection.svg dark_tool_rect_selection.svg dark_tool_similar_selection.svg dark_tool_zoom.svg light_calligraphy.svg light_draw-text.svg light_format-fill-color.svg light_krita_draw_path.svg light_krita_tool_color_fill.svg light_krita_tool_color_picker.svg light_krita_tool_dyna.svg light_krita_tool_ellipse.svg light_krita_tool_freehand.svg light_krita_tool_freehandvector.svg light_krita_tool_gradient.svg light_krita_tool_grid.svg light_krita_tool_line.svg light_krita_tool_measure.svg light_krita_tool_move.svg light_krita_tool_multihand.svg light_krita_tool_polygon.svg light_krita_tool_rectangle.svg light_krita_tool_transform.svg light_pattern.svg light_polyline.svg light_select.svg light_tool_contiguous_selection.svg light_tool_crop.svg light_tool_elliptical_selection.svg light_tool_outline_selection.svg light_tool_pan.svg light_tool_path_selection.svg + light_tool_magnetic_selection.svg light_tool_perspectivegrid.svg light_tool_polygonal_selection.svg light_tool_rect_selection.svg light_tool_similar_selection.svg light_tool_zoom.svg dark_shape_handling.svg dark_artistic_text.svg light_artistic_text.svg light_shape_handling.svg dark_krita_tool_lazybrush.svg light_krita_tool_lazybrush.svg dark_krita_tool_smart_patch.svg light_krita_tool_smart_patch.svg light_krita_tool_assistant.svg dark_krita_tool_assistant.svg dark_krita_tool_reference_images.svg light_krita_tool_reference_images.svg diff --git a/plugins/tools/selectiontools/kis_tool_select_magnetic.h b/plugins/tools/selectiontools/kis_tool_select_magnetic.h index 78ecc603c1..54075634d3 100644 --- a/plugins/tools/selectiontools/kis_tool_select_magnetic.h +++ b/plugins/tools/selectiontools/kis_tool_select_magnetic.h @@ -1,113 +1,115 @@ /* * Copyright (c) 2007 Sven Langkamp * Copyright (c) 2015 Michael Abrahams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIS_TOOL_SELECT_MAGNETIC_H_ #define KIS_TOOL_SELECT_MAGNETIC_H_ #include #include #include "kis_tool_select_base.h" #include "kis_delegated_tool.h" #include class KoCanvasBase; class KisToolSelectMagnetic; class __KisToolSelectMagneticLocalTool : public KoCreatePathTool { public: __KisToolSelectMagneticLocalTool(KoCanvasBase * canvas, KisToolSelectMagnetic* parentTool); void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter) override; void addPathShape(KoPathShape* pathShape) override; + friend class KisToolSelectMagnetic; + using KoCreatePathTool::createOptionWidgets; using KoCreatePathTool::endPathWithoutLastPoint; using KoCreatePathTool::endPath; using KoCreatePathTool::cancelPath; using KoCreatePathTool::removeLastPoint; protected: void paintOutline(QPainter *painter, const QPainterPath &path, qreal width); private: KisToolSelectMagnetic* const m_selectionTool; }; typedef KisDelegatedTool DelegatedSelectMagneticTool; struct KisDelegatedSelectMagneticWrapper : public DelegatedSelectMagneticTool { KisDelegatedSelectMagneticWrapper(KoCanvasBase *canvas, const QCursor &cursor, KisTool* delegateTool) : DelegatedSelectMagneticTool(canvas, cursor, dynamic_cast<__KisToolSelectMagneticLocalTool*>(delegateTool)) { } // If an event is explicitly forwarded only as an action (e.g. shift-click is captured by "change size") // we will receive a primary action but no mousePressEvent. Thus these events must be explicitly forwarded. void beginPrimaryAction(KoPointerEvent *event) override; void continuePrimaryAction(KoPointerEvent *event) override; void endPrimaryAction(KoPointerEvent *event) override; bool hasUserInteractionRunning() const; }; class KisToolSelectMagnetic : public KisToolSelectBase { Q_OBJECT public: KisToolSelectMagnetic(KoCanvasBase * canvas); void mousePressEvent(KoPointerEvent* event) override; bool eventFilter(QObject *obj, QEvent *event) override; void resetCursorStyle() override; protected: void requestStrokeCancellation() override; void requestStrokeEnd() override; friend class __KisToolSelectMagneticLocalTool; QList > createOptionWidgets() override; }; class KisToolSelectMagneticFactory : public KisSelectionToolFactoryBase { public: KisToolSelectMagneticFactory() : KisSelectionToolFactoryBase("KisToolSelectMagnetic") { setToolTip(i18n("Magnetic Selection Tool")); setSection(TOOL_TYPE_SELECTION); setActivationShapeId(KRITA_TOOL_ACTIVATION_ID); - setIconName(koIconNameCStr("tool_path_selection")); + setIconName(koIconNameCStr("tool_magnetic_selection")); setPriority(6); } ~KisToolSelectMagneticFactory() override {} KoToolBase * createTool(KoCanvasBase *canvas) override { return new KisToolSelectMagnetic(canvas); } }; #endif // KIS_TOOL_SELECT_MAGNETIC_H_