|
Krita Source Code Documentation
|
#include <KoCanvasBase.h>
Inheritance diagram for KoCanvasBase:Public Member Functions | |
| virtual void | addCommand (KUndo2Command *command)=0 |
| KoCanvasController * | canvasController () const |
| virtual bool | canvasIsOpenGL () const |
| virtual const QWidget * | canvasWidget () const =0 |
| virtual QWidget * | canvasWidget ()=0 |
| virtual void | clipToDocument (const KoShape *shape, QPointF &move) const |
| virtual void | disconnectCanvasObserver (QObject *object) |
| virtual QPoint | documentOrigin () const |
| virtual void | gridSize (QPointF *offset, QSizeF *spacing) const =0 |
| KoCanvasBase (KoShapeControllerBase *shapeController, KoCanvasResourceProvider *sharedResourceManager=0) | |
| Private () | |
| KoCanvasResourceProvider * | resourceManager () const |
| virtual KoSelectedShapesProxy * | selectedShapesProxy () const =0 |
| selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged() and selectionContentChanged() signals. While shapeManager() can change throughout the life time of the canvas, selectedShapesProxy() is guaranteed to stay the same. | |
| void | setCanvasController (KoCanvasController *controller) |
| called by KoCanvasController to set the controller that handles this canvas. | |
| virtual void | setCursor (const QCursor &cursor)=0 |
| KoShapeController * | shapeController () const |
| virtual KoShapeManager * | shapeManager () const =0 |
| KoSnapGuide * | snapGuide () const |
| virtual bool | snapToGrid () const =0 |
| virtual KoToolProxy * | toolProxy () const =0 |
| virtual KoUnit | unit () const =0 |
| virtual void | updateCanvas (const QRectF &rc)=0 |
| virtual const KoViewConverter * | viewConverter () const =0 |
| virtual KoViewConverter * | viewConverter ()=0 |
| virtual QPointF | viewToDocument (const QPointF &viewPoint) const |
| ~KoCanvasBase () override | |
| ~Private () | |
Public Attributes | |
| KoCanvasController * | controller |
| bool | isResourceManagerShared |
| QPointer< KoCanvasResourceProvider > | resourceManager |
| QPointer< KoShapeController > | shapeController |
| KoSnapGuide * | snapGuide |
Private Member Functions | |
| KoCanvasBase () | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
KoCanvasBase is the interface actual application canvas classes should implement. Flake tools know about the canvas, so they can do things like scroll, redraw, set a cursor etc.
Definition at line 23 of file KoCanvasBase.cpp.
|
inline |
Definition at line 35 of file KoCanvasBase.cpp.
|
explicit |
The constructor.
| shapeController | the implementation of the shapeController that the application provides to allow shapes to be added in multiple views. |
Definition at line 49 of file KoCanvasBase.cpp.
References d, and shapeController.
|
override |
Definition at line 60 of file KoCanvasBase.cpp.
References d.
|
private |
|
pure virtual |
Adds a command to the history. Call this for each command you create. This will also execute the command. This means, most of the application's code will look like MyCommand * cmd = new MyCommand( parameters ); canvas.addCommand( cmd );
Note that the command history takes ownership of the command, it will delete it when the undo limit is reached, or when deleting the command history itself.
| command | the command to add |
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
| KoCanvasController * KoCanvasBase::canvasController | ( | ) | const |
Return the canvas controller for this canvas.
Definition at line 99 of file KoCanvasBase.cpp.
References d.
|
inlinevirtual |
Reimplemented in KisCanvas2.
Definition at line 62 of file KoCanvasBase.h.
|
pure virtual |
Return the widget that will be added to the scrollArea.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
pure virtual |
Return the widget that will be added to the scrollArea.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
Called when the user tries to move the argument shape to allow the application to limit the users movement to stay within the document bounds. An implementation can alter the parameter move to make sure that if the distance moved is applied to the shape it will not become unreachable for the user. The default implementation does not restrict movement.
| shape | the shape that will be moved soon. |
| move | the distance the caller intends to move the shape. |
Definition at line 104 of file KoCanvasBase.cpp.
|
virtual |
disconnect the given QObject completely and utterly from any and all connections it has to any QObject owned by the canvas. Do this in the setCanvas of every KoCanvasObserver.
Reimplemented in KisCanvas2.
Definition at line 79 of file KoCanvasBase.cpp.
References resourceManager, selectedShapesProxy(), KoShapeManager::selection, shapeManager(), and toolProxy().
|
inlinevirtual |
Return the position of the document origin inside the canvas widget, in pixels. By default the origin of the canvas widget and the position of the document origin are coincident, thus an empty point is returned.
Reimplemented in KisCanvas2.
Definition at line 177 of file KoCanvasBase.h.
|
pure virtual |
retrieve the grid size setting. The grid spacing will be provided in pt.
| horizontal | a pointer to a qreal that will be filled with the horizontal grid-spacing |
| vertical | a pointer to a qreal that will be filled with the vertical grid-spacing |
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
inline |
Definition at line 26 of file KoCanvasBase.cpp.
| KoCanvasResourceProvider * KoCanvasBase::resourceManager | ( | ) | const |
Return a pointer to the resource manager associated with this canvas. The resource manager contains per-canvas settings such as current foreground and background color. If instead of per-canvas resources you need per-document resources you can by going via the shapeController instead;
|
pure virtual |
selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged() and selectionContentChanged() signals. While shapeManager() can change throughout the life time of the canvas, selectedShapesProxy() is guaranteed to stay the same.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
| void KoCanvasBase::setCanvasController | ( | KoCanvasController * | controller | ) |
called by KoCanvasController to set the controller that handles this canvas.
Definition at line 94 of file KoCanvasBase.cpp.
References controller, and d.
|
pure virtual |
set the specified cursor on this canvas
| cursor | the new cursor |
Implemented in SimpleCanvas, KisShapeLayerCanvasBase, KisShapeSelectionCanvas, and KisCanvas2.
| KoShapeController * KoCanvasBase::shapeController | ( | ) | const |
Return the shape controller for this canvas. A shape controller is used to create or delete shapes and show the relevant dialogs to the user.
|
pure virtual |
Return the current shapeManager. WARNING: the shape manager can switch in time, e.g. when a layer is changed. Please don't keep any persistent connections to it. Instead please use selectedShapesProxy(), which is guaranteed to be the same throughout the life of the canvas.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
| KoSnapGuide * KoCanvasBase::snapGuide | ( | ) | const |
Returns the snap guide of the canvas
|
pure virtual |
return if snap to grid is enabled.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
pure virtual |
Return the proxy to the active tool (determining which tool is really, really active is hard when tablets are involved, so leave that to others.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
pure virtual |
Return the unit of the current document for initialization of the widgets created by the flake framework.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
pure virtual |
Tell the canvas to repaint the specified rectangle. The coordinates are document coordinates, not view coordinates.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvas, KisShapeSelectionCanvas, and ReferenceImagesCanvas.
|
pure virtual |
Return the viewConverter for this view.
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
pure virtual |
Implemented in SimpleCanvas, KisCanvas2, KisShapeLayerCanvasBase, and KisShapeSelectionCanvas.
|
virtual |
Convert a coordinate in pixels to pt.
| viewPoint | the point in the coordinate system of the widget, or window. |
Definition at line 66 of file KoCanvasBase.cpp.
References documentOrigin(), viewConverter(), and KoViewConverter::viewToDocument().
| KoCanvasController* KoCanvasBase::controller |
Definition at line 45 of file KoCanvasBase.cpp.
|
private |
Definition at line 225 of file KoCanvasBase.h.
| bool KoCanvasBase::isResourceManagerShared |
Definition at line 44 of file KoCanvasBase.cpp.
| KoCanvasResourceProvider * KoCanvasBase::resourceManager |
Definition at line 43 of file KoCanvasBase.cpp.
| KoShapeController * KoCanvasBase::shapeController |
Definition at line 42 of file KoCanvasBase.cpp.
| KoSnapGuide * KoCanvasBase::snapGuide |
Definition at line 46 of file KoCanvasBase.cpp.