|
Krita Source Code Documentation
|
#include <kis_tool_polyline_base.h>
Inheritance diagram for KisToolPolylineBase:Public Types | |
| enum | ToolType { PAINT , SELECT } |
Public Types inherited from KisTool | |
| enum | { FLAG_USES_CUSTOM_PRESET =0x01 , FLAG_USES_CUSTOM_COMPOSITEOP =0x02 , FLAG_USES_CUSTOM_SIZE =0x04 } |
| enum | AlternateAction { ChangeSize = AlternateChangeSize , ChangeSizeSnap = AlternateChangeSizeSnap , SampleFgNode = AlternateSampleFgNode , SampleBgNode = AlternateSampleBgNode , SampleFgImage = AlternateSampleFgImage , SampleBgImage = AlternateSampleBgImage , Secondary = AlternateSecondary , Third = AlternateThird , Fourth = AlternateFourth , Fifth = AlternateFifth , NONE = 10000 } |
| enum | NodePaintAbility { VECTOR , CLONE , PAINT , UNPAINTABLE , MYPAINTBRUSH_UNPAINTABLE } |
| enum | ToolAction { Primary , AlternateChangeSize , AlternateChangeSizeSnap , AlternateSampleFgNode , AlternateSampleBgNode , AlternateSampleFgImage , AlternateSampleBgImage , AlternateSecondary , AlternateThird , AlternateFourth , AlternateFifth , Alternate_NONE = 10000 } |
Public Member Functions | |
| void | activate (const QSet< KoShape * > &shapes) override |
| void | beginAlternateAction (KoPointerEvent *event, AlternateAction action) override |
| void | beginPrimaryAction (KoPointerEvent *event) override |
| void | beginPrimaryDoubleClickAction (KoPointerEvent *event) override |
| void | deactivate () override |
| void | endPrimaryAction (KoPointerEvent *event) override |
| bool | eventFilter (QObject *obj, QEvent *event) override |
| KisToolPolylineBase (KoCanvasBase *canvas, KisToolPolylineBase::ToolType type, const QCursor &cursor=KisCursor::load("tool_polygon_cursor.png", 6, 6)) | |
| void | mouseMoveEvent (KoPointerEvent *event) override |
| void | paint (QPainter &gc, const KoViewConverter &converter) override |
| KisPopupWidgetInterface * | popupWidget () override |
| void | requestStrokeCancellation () override |
| void | requestStrokeEnd () override |
Public Member Functions inherited from KisToolShape | |
| int | flags () const override |
| KisToolShape (KoCanvasBase *canvas, const QCursor &cursor) | |
| ~KisToolShape () override | |
Public Member Functions inherited from KisToolPaint | |
| KisToolPaint (KoCanvasBase *canvas, const QCursor &cursor) | |
| void | mousePressEvent (KoPointerEvent *event) override |
| void | mouseReleaseEvent (KoPointerEvent *event) override |
| ~KisToolPaint () override | |
Public Member Functions inherited from KisTool | |
| virtual bool | alternateActionSupportsHiResEvents (AlternateAction action) const |
| virtual void | beginAlternateDoubleClickAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | continuePrimaryAction (KoPointerEvent *event) |
| void | deleteSelection () override |
| bool | isActive () const |
| KisTool (KoCanvasBase *canvas, const QCursor &cursor) | |
| void | mouseDoubleClickEvent (KoPointerEvent *event) override |
| void | mouseTripleClickEvent (KoPointerEvent *event) override |
| virtual void | newActivationWithExternalSource (KisPaintDeviceSP externalSource) |
| newActivationWithExternalSource Makes sure that the tool is active and starts a new stroke, which will be able to access the pixels from the specified external source. | |
| KisTool::NodePaintAbility | nodePaintAbility () |
| virtual bool | primaryActionSupportsHiResEvents () const |
| virtual bool | supportsPaintingAssistants () const |
| ~KisTool () override | |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Member Functions inherited from KoToolBase | |
| QAction * | action (const QString &name) const |
| KoCanvasBase * | canvas () const |
| Returns the canvas the tool is working on. | |
| virtual void | copy () const |
| QCursor | cursor () const |
| return the last emitted cursor | |
| virtual void | customMoveEvent (KoPointerEvent *event) |
| virtual void | customPressEvent (KoPointerEvent *event) |
| virtual void | customReleaseEvent (KoPointerEvent *event) |
| virtual void | cut () |
| virtual QRectF | decorationsRect () const |
| int | decorationThickness () const |
| decorationThickness The minimum thickness for tool decoration lines, this is derived from the screen magnification, thus the HiDPI settings. Note: to use this effectively, also set the pen to isCosmetic(true); | |
| virtual void | deselect () |
| deselect the tool should clear the selection if it has one. | |
| virtual void | dragLeaveEvent (QDragLeaveEvent *event) |
| virtual void | dragMoveEvent (QDragMoveEvent *event, const QPointF &point) |
| virtual void | dropEvent (QDropEvent *event, const QPointF &point) |
| virtual void | explicitUserStrokeEndRequest () |
| explicitUserStrokeEndRequest is called by the input manager when the user presses Enter key or any equivalent. This callback comes before requestStrokeEnd(), which comes from a different source. | |
| KoToolFactoryBase * | factory () const |
| virtual void | focusInEvent (QFocusEvent *event) |
| virtual void | focusOutEvent (QFocusEvent *event) |
| virtual bool | hasSelection () |
| virtual void | inputMethodEvent (QInputMethodEvent *event) |
| virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
| bool | isInTextMode () const |
| bool | isOpacityPresetMode () const |
| virtual void | keyPressEvent (QKeyEvent *event) |
| virtual void | keyReleaseEvent (QKeyEvent *event) |
| KoToolBase (KoCanvasBase *canvas) | |
| bool | maskSyntheticEvents () const |
| QList< QPointer< QWidget > > | optionWidgets () |
| virtual bool | paste () |
| virtual QMenu * | popupActionsMenu () |
| virtual bool | selectAll () |
| selectAll select all data the tool can select. | |
| virtual KoToolSelection * | selection () |
| Q_INVOKABLE QString | toolId () const |
| virtual bool | wantsAutoScroll () const |
| ~KoToolBase () override | |
Protected Member Functions | |
| virtual void | finishPolyline (const QVector< QPointF > &points)=0 |
Protected Member Functions inherited from KisToolShape | |
| void | addPathShape (KoPathShape *pathShape, const KUndo2MagicString &name) |
| void | addShape (KoShape *shape) |
| virtual void | beginShape () |
| QWidget * | createOptionWidget () override |
| qreal | currentStrokeWidth () const |
| virtual void | endShape () |
| KisToolShapeUtils::FillStyle | fillStyle () |
| QTransform | fillTransform () |
| ShapeAddInfo | shouldAddShape (KisNodeSP currentNode) const |
| KisToolShapeUtils::StrokeStyle | strokeStyle () |
Protected Member Functions inherited from KisToolPaint | |
| void | activateAlternateAction (AlternateAction action) override |
| void | activatePrimaryAction () override |
| void | addOptionWidgetLayout (QLayout *layout) |
| Add the tool-specific layout to the default option widget layout. | |
| virtual void | addOptionWidgetOption (QWidget *control, QWidget *label=nullptr) |
| Add a widget and a label to the current option widget layout. | |
| void | canvasResourceChanged (int key, const QVariant &v) override |
| void | continueAlternateAction (KoPointerEvent *event, AlternateAction action) override |
| void | deactivateAlternateAction (AlternateAction action) override |
| void | deactivatePrimaryAction () override |
| void | enableControl (QWidget *control, bool value) |
| void | endAlternateAction (KoPointerEvent *event, AlternateAction action) override |
| virtual KisOptimizedBrushOutline | getOutlinePath (const QPointF &documentPos, const KoPointerEvent *event, KisPaintOpSettings::OutlineMode outlineMode) |
| bool | isEraser () const |
| bool | isOutlineEnabled () const |
| bool | isOutlineVisible () const |
| virtual QString | quickHelp () const |
| virtual void | requestUpdateOutline (const QPointF &outlineDocPoint, const KoPointerEvent *event) |
| void | setMode (ToolMode mode) override |
| void | setOutlineEnabled (bool enabled) |
| void | setOutlineVisible (bool visible) |
| void | setSupportOutline (bool supportOutline) |
| void | showControl (QWidget *control, bool value) |
Protected Member Functions inherited from KisTool | |
| bool | blockUntilOperationsFinished () |
| void | blockUntilOperationsFinishedForced () |
| QPointF | convertDocumentToWidget (const QPointF &pt) |
| QPoint | convertToImagePixelCoordFloored (KoPointerEvent *e) |
| QPointF | convertToPixelCoord (const QPointF &pt) |
| QPointF | convertToPixelCoord (KoPointerEvent *e) |
| QPointF | convertToPixelCoordAndAlignOnWidget (const QPointF &pt) |
| QPointF | convertToPixelCoordAndSnap (const QPointF &pt, const QPointF &offset=QPointF()) |
| QPointF | convertToPixelCoordAndSnap (KoPointerEvent *e, const QPointF &offset=QPointF(), bool useModifiers=true) |
| QRectF | convertToPt (const QRectF &rect) |
| qreal | convertToPt (qreal value) |
| KoColor | currentBgColor () |
| KoColor | currentFgColor () |
| KisFilterConfigurationSP | currentGenerator () |
| KoAbstractGradientSP | currentGradient () |
| KisImageWSP | currentImage () |
| KisNodeSP | currentNode () const |
| KisPaintOpPresetSP | currentPaintOpPreset () |
| KoPatternSP | currentPattern () |
| QCursor | cursor () const |
| KisImageWSP | image () const |
| virtual bool | listeningToModifiers () |
| virtual void | listenToModifiers (bool listen) |
| virtual ToolMode | mode () const |
| bool | nodeEditable () |
| Checks checks if the current node is editable. | |
| bool | overrideCursorIfNotEditable () |
| Override the cursor appropriately if current node is not editable. | |
| void | paintToolOutline (QPainter *painter, const KisOptimizedBrushOutline &path) |
| KisOptimizedBrushOutline | pixelToView (const KisOptimizedBrushOutline &path) const |
| QPainterPath | pixelToView (const QPainterPath &pixelPath) const |
| Convert a pixel path into a view path. | |
| QPointF | pixelToView (const QPoint &pixelCoord) const |
| QPointF | pixelToView (const QPointF &pixelCoord) const |
| Convert a floating point pixel coordinate into a view coordinate. | |
| QPolygonF | pixelToView (const QPolygonF &pixelPolygon) const |
| Convert a pixel polygon into a view path. | |
| QRectF | pixelToView (const QRectF &pixelRect) const |
| Convert a pixel rectangle into a view rectangle. | |
| KisNodeList | selectedNodes () const |
| bool | selectionEditable () |
| Checks checks if the selection is editable, only applies to local selection as global selection is always editable. | |
| void | setCursor (const QCursor &cursor) |
| void | updateCanvasPixelRect (const QRectF &pixelRect) |
| Update the canvas for the given rectangle in image pixel coordinates. | |
| void | updateCanvasViewRect (const QRectF &viewRect) |
| Update the canvas for the given rectangle in view coordinates. | |
| QPointF | viewToPixel (const QPointF &viewCoord) const |
| QPointF | widgetCenterInWidgetPixels () |
Protected Member Functions inherited from KoToolBase | |
| virtual QList< QPointer< QWidget > > | createOptionWidgets () |
| int | grabSensitivity () const |
| Convenience function to get the current grab sensitivity. | |
| qreal | handleDocRadius () const |
| QRectF | handleGrabRect (const QPointF &position) const |
| QRectF | handlePaintRect (const QPointF &position) const |
| int | handleRadius () const |
| Convenience function to get the current handle radius. | |
| bool | isActivated () const |
| KoToolBase (KoToolBasePrivate &dd) | |
| KoPointerEvent * | lastDeliveredPointerEvent () const |
| void | setAbstractResource (KoAbstractCanvasResourceInterfaceSP abstractResource) |
| void | setConverter (KoDerivedResourceConverterSP converter) |
| void | setIsOpacityPresetMode (bool value) |
| void | setMaskSyntheticEvents (bool value) |
| void | setTextMode (bool value) |
| QHash< int, KoAbstractCanvasResourceInterfaceSP > | toolAbstractResources () |
| QHash< int, KoDerivedResourceConverterSP > | toolConverters () |
| void | useCursor (const QCursor &cursor) |
Private Slots | |
| void | undoSelection () |
| void | undoSelectionOrCancel () |
Private Member Functions | |
| void | cancelStroke () |
| QRectF | dragBoundingRect () |
| void | endStroke () |
| void | updateArea () |
Private Attributes | |
| bool | m_closeSnappingActivated |
| QPointF | m_dragEnd |
| bool | m_dragging |
| QPointF | m_dragStart |
| vQPointF | m_points |
| ToolType | m_type |
Definition at line 13 of file kis_tool_polyline_base.h.
| Enumerator | |
|---|---|
| PAINT | |
| SELECT | |
Definition at line 17 of file kis_tool_polyline_base.h.
| KisToolPolylineBase::KisToolPolylineBase | ( | KoCanvasBase * | canvas, |
| KisToolPolylineBase::ToolType | type, | ||
| const QCursor & | cursor = KisCursor::load("tool_polygon_cursor.png", 6, 6) ) |
Definition at line 30 of file kis_tool_polyline_base.cpp.
References Private::canvas, KisViewManager::canvasResourceProvider(), connect(), KisTool::resetCursorStyle(), and KisCanvas2::viewManager().
This method is called when this tool instance is activated. For any main window there is only one tool active at a time, which then gets all user input. Switching between tools will call deactivate on one and activate on the new tool allowing the tool to flush items (like a selection) when it is not in use.
| shapes | the set of shapes that are selected or suggested for editing by a selected shape for the tool to work on. Not all shapes will be meant for this tool. |
Reimplemented from KoToolBase.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 42 of file kis_tool_polyline_base.cpp.
References KoToolBase::action(), KisToolShape::activate(), KisInputManager::attachPriorityEventFilter(), Private::canvas, connect(), and undoSelectionOrCancel().
|
overridevirtual |
Reimplemented from KisToolPaint.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 161 of file kis_tool_polyline_base.cpp.
References KoToolBase::action(), KisToolPaint::beginAlternateAction(), KisTool::ChangeSize, KisTool::ChangeSizeSnap, endStroke(), m_closeSnappingActivated, m_dragging, and m_points.
|
overridevirtual |
Called by KisToolProxy when a primary action for the tool is started. The event stores the original event that started the stroke. The event is accepted by default. If the tool decides to ignore this particular action (e.g. when the node is not editable), it should call event->ignore(). Then no further continuePrimaryAction() or endPrimaryAction() will be called until the next user action.
Reimplemented from KisTool.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 107 of file kis_tool_polyline_base.cpp.
References KisToolShape::beginShape(), Private::canvas, KisTool::CLONE, endStroke(), koIcon, m_closeSnappingActivated, m_dragging, m_points, m_type, KisTool::MYPAINTBRUSH_UNPAINTABLE, KisTool::nodeEditable(), KisTool::nodePaintAbility(), PAINT, KisTool::PAINT_MODE, SELECT, KisTool::selectionEditable(), KisToolPaint::setMode(), KisViewManager::showFloatingMessage(), KisTool::UNPAINTABLE, and KisCanvas2::viewManager().
|
overridevirtual |
The same as beginPrimaryAction(), but called when the stroke is started by a double-click
Reimplemented from KisTool.
Definition at line 153 of file kis_tool_polyline_base.cpp.
References endStroke().
|
private |
Definition at line 291 of file kis_tool_polyline_base.cpp.
References KisToolShape::endShape(), m_closeSnappingActivated, m_dragging, m_points, and updateArea().
|
overridevirtual |
This method is called whenever this tool is no longer the active tool
Reimplemented from KoToolBase.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 53 of file kis_tool_polyline_base.cpp.
References KoToolBase::action(), cancelStroke(), Private::canvas, KoToolBase::deactivate(), and KisInputManager::detachPriorityEventFilter().
|
private |
Definition at line 302 of file kis_tool_polyline_base.cpp.
References m_dragEnd, m_dragStart, KisTool::pixelToView(), and PREVIEW_LINE_WIDTH.
|
overridevirtual |
Called by KisToolProxy when the primary action is being finished, that is while mouseRelease or tabletRelease event. If the tool has ignored the event in beginPrimaryAction(), this method will not be called.
Reimplemented from KisTool.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 141 of file kis_tool_polyline_base.cpp.
References CHECK_MODE_SANITY_OR_RETURN, KisTool::convertToPixelCoordAndSnap(), KisTool::HOVER_MODE, m_dragEnd, m_dragging, m_dragStart, m_points, KisTool::PAINT_MODE, and KisToolPaint::setMode().
|
private |
Definition at line 277 of file kis_tool_polyline_base.cpp.
References KisToolShape::endShape(), finishPolyline(), m_closeSnappingActivated, m_dragging, m_points, and updateArea().
|
override |
Definition at line 83 of file kis_tool_polyline_base.cpp.
References m_dragging, and undoSelectionOrCancel().
|
protectedpure virtual |
Implemented in KisToolSelectPolygonal, KisToolPolygon, and KisToolPolyline.
|
overridevirtual |
Called when the mouse or stylus moved over the canvas. Implementors should call event->ignore() if they do not actually use the event.
| event | state and reason of this mouse or stylus move |
Reimplemented from KisToolPaint.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 173 of file kis_tool_polyline_base.cpp.
References KisTool::convertToPixelCoordAndSnap(), dragBoundingRect(), m_closeSnappingActivated, m_dragEnd, m_dragging, m_points, KisToolPaint::mouseMoveEvent(), KisTool::pixelToView(), KoPointerEvent::point, PREVIEW_LINE_WIDTH, KisToolPaint::requestUpdateOutline(), SNAPPING_HANDLE_RADIUS, SNAPPING_THRESHOLD, and KisTool::updateCanvasViewRect().
|
overridevirtual |
Called by the canvas to paint any decorations that the tool deems needed. The painter has the top left of the canvas as its origin.
| painter | used for painting the shape |
| converter | to convert between internal and view coordinates. |
Reimplemented from KisToolPaint.
Definition at line 229 of file kis_tool_polyline_base.cpp.
References Private::canvas, KisTool::currentImage(), m_closeSnappingActivated, m_dragEnd, m_dragging, m_dragStart, m_points, KisToolPaint::paint(), KisTool::paintToolOutline(), KisTool::pixelToView(), and SNAPPING_HANDLE_RADIUS.
|
overridevirtual |
popupActionsMenu() does not return null. Reimplemented from KisToolPaint.
Reimplemented in KisToolSelectBase< __KisToolSelectPolygonalLocal >.
Definition at line 76 of file kis_tool_polyline_base.cpp.
References m_dragging, m_type, KoToolBase::popupWidget(), and SELECT.
|
overridevirtual |
Called when the user requested the cancellation of the current stroke. If you tool supports cancelling, override this method and do the needed work there
Reimplemented from KoToolBase.
Definition at line 71 of file kis_tool_polyline_base.cpp.
References cancelStroke().
|
overridevirtual |
Called when the image decided that the stroke should better be ended. If you tool supports long strokes, override this method and do the needed work there
Reimplemented from KoToolBase.
Definition at line 66 of file kis_tool_polyline_base.cpp.
References endStroke().
|
privateslot |
Definition at line 197 of file kis_tool_polyline_base.cpp.
References dragBoundingRect(), m_dragging, m_dragStart, m_points, KisTool::pixelToView(), PREVIEW_LINE_WIDTH, and KisTool::updateCanvasViewRect().
|
privateslot |
Definition at line 220 of file kis_tool_polyline_base.cpp.
References cancelStroke(), m_points, and undoSelection().
|
private |
Definition at line 272 of file kis_tool_polyline_base.cpp.
References bounds, KisTool::image(), and KisTool::updateCanvasPixelRect().
|
private |
Definition at line 60 of file kis_tool_polyline_base.h.
|
private |
Definition at line 56 of file kis_tool_polyline_base.h.
|
private |
Definition at line 57 of file kis_tool_polyline_base.h.
|
private |
Definition at line 55 of file kis_tool_polyline_base.h.
|
private |
Definition at line 58 of file kis_tool_polyline_base.h.
|
private |
Definition at line 59 of file kis_tool_polyline_base.h.