background() const;
/**
* @brief setInheritBackground marks a shape as inhiriting the background
* from the parent shape. NOTE: The currently selected background is destroyed.
* @param value true if the shape should inherit the filling background
*/
void setInheritBackground(bool value);
/**
* @brief inheritBackground shows if the shape inherits background from its parent
* @return true if the shape inherits the fill
*/
bool inheritBackground() const;
/**
* Returns true if there is some transparency, false if the shape is fully opaque.
* The default implementation will just return if the background has some transparency,
* you should override it and always return true if your shape is not square.
* @return if the shape is (partly) transparent.
*/
virtual bool hasTransparency() const;
/**
* Sets shape level transparency.
* @param transparency the new shape level transparency
*/
void setTransparency(qreal transparency);
/**
* Returns the shape level transparency.
* @param recursive when true takes the parents transparency into account
*/
qreal transparency(bool recursive=false) const;
/**
* Retrieve the z-coordinate of this shape.
* The zIndex property is used to determine which shape lies on top of other objects.
* An shape with a higher z-order is on top, and can obscure another shape.
* @return the z-index of this shape.
* @see setZIndex()
*/
qint16 zIndex() const;
/**
* Set the z-coordinate of this shape.
* The zIndex property is used to determine which shape lies on top of other objects.
* An shape with a higher z-order is on top, and can obscure, another shape.
* Just like two objects having the same x or y coordinate will make them 'touch',
* so will two objects with the same z-index touch on the z plane. In layering the
* shape this, however, can cause a little confusion as one always has to be on top.
* The layering if two overlapping objects have the same index is implementation dependent
* and probably depends on the order in which they are added to the shape manager.
* @param zIndex the new z-index;
*/
void setZIndex(qint16 zIndex);
/**
* Maximum value of z-index
*/
static const qint16 maxZIndex;
/**
* Minimum value of z-index
*/
static const qint16 minZIndex;
/**
* Retrieve the run through property of this shape.
* The run through property is used to determine if the shape is behind, inside or before text.
* @return the run through of this shape.
*/
int runThrough();
/**
* Set the run through property of this shape.
* The run through property is used to determine if the shape is behind, inside or before text.
* @param runThrough the new run through;
*/
virtual void setRunThrough(short int runThrough);
/**
* Changes the Shape to be visible or invisible.
* Being visible means being painted, as well as being used for
* things like guidelines or searches.
* @param on when true; set the shape to be visible.
* @see setGeometryProtected(), setContentProtected(), setSelectable()
*/
void setVisible(bool on);
/**
* Returns current visibility state of this shape.
* Being visible means being painted, as well as being used for
* things like guidelines or searches.
* @param recursive when true, checks visibility recursively
* @return current visibility state of this shape.
* @see isGeometryProtected(), isContentProtected(), isSelectable()
*/
bool isVisible(bool recursive = true) const;
/**
* Changes the shape to be printable or not. The default is true.
*
* If a Shape's print flag is true, the shape will be printed. If
* false, the shape will not be printed. If a shape is not visible (@see isVisible),
* it isPrinted will return false, too.
*/
void setPrintable(bool on);
/**
* Returns the current printable state of this shape.
*
* A shape can be visible but not printable, not printable and not visible
* or visible and printable, but not invisible and still printable.
*
* @return current printable state of this shape.
*/
bool isPrintable() const;
/**
* Makes it possible for the user to select this shape.
* This parameter defaults to true.
* @param selectable when true; set the shape to be selectable by the user.
* @see setGeometryProtected(), setContentProtected(), setVisible()
*/
void setSelectable(bool selectable);
/**
* Returns if this shape can be selected by the user.
* @return true only when the object is selectable.
* @see isGeometryProtected(), isContentProtected(), isVisible()
*/
bool isSelectable() const;
/**
* Tells the shape to have its position/rotation and size protected from user-changes.
* The geometry being protected means the user can not change shape or position of the
* shape. This includes any matrix operation such as rotation.
* @param on when true; set the shape to have its geometry protected.
* @see setContentProtected(), setSelectable(), setVisible()
*/
void setGeometryProtected(bool on);
/**
* Returns current geometry protection state of this shape.
* The geometry being protected means the user can not change shape or position of the
* shape. This includes any matrix operation such as rotation.
* @return current geometry protection state of this shape.
* @see isContentProtected(), isSelectable(), isVisible()
*/
bool isGeometryProtected() const;
/**
* Marks the shape to have its content protected against editing.
* Content protection is a hint for tools to disallow the user editing the content.
* @param protect when true set the shapes content to be protected from user modification.
* @see setGeometryProtected(), setSelectable(), setVisible()
*/
void setContentProtected(bool protect);
/**
* Returns current content protection state of this shape.
* Content protection is a hint for tools to disallow the user editing the content.
* @return current content protection state of this shape.
* @see isGeometryProtected(), isSelectable(), isVisible()
*/
bool isContentProtected() const;
/**
* Returns the parent, or 0 if there is no parent.
* @return the parent, or 0 if there is no parent.
*/
KoShapeContainer *parent() const;
/**
* Set the parent of this shape.
* @param parent the new parent of this shape. Can be 0 if the shape has no parent anymore.
*/
void setParent(KoShapeContainer *parent);
/**
* @brief inheritsTransformFromAny checks if the shape inherits transformation from
* any of the shapes listed in \p ancestorsInQuestion. The inheritance is checked
* in recursive way.
* @return true if there is a (transitive) transformation-wise parent found in \p ancestorsInQuestion
*/
bool inheritsTransformFromAny(const QList ancestorsInQuestion) const;
/**
* @return true if this shape has a common parent with \p shape
*/
bool hasCommonParent(const KoShape *shape) const;
/**
* Request a repaint to be queued.
* The repaint will be of the entire Shape, including its selection handles should this
* shape be selected.
* This method will return immediately and only request a repaint. Successive calls
* will be merged into an appropriate repaint action.
*/
virtual void update() const;
/**
* Request a repaint to be queued.
* The repaint will be restricted to the parameters rectangle, which is expected to be
* in absolute coordinates of the canvas and it is expected to be
* normalized.
*
This method will return immediately and only request a repaint. Successive calls
* will be merged into an appropriate repaint action.
* @param rect the rectangle (in pt) to queue for repaint.
*/
virtual void updateAbsolute(const QRectF &rect) const;
/// Used by compareShapeZIndex() to order shapes
enum ChildZOrderPolicy {
ChildZDefault,
ChildZParentChild = ChildZDefault, ///< normal parent/child ordering
ChildZPassThrough ///< children are considered equal to this shape
};
/**
* Returns if during compareShapeZIndex() how this shape portrays the values
* of its children. The default behaviour is to let this shape's z values take
* the place of its childrens values, so you get a parent/child relationship.
* The children are naturally still ordered relatively to their z values
*
* But for special cases (like Calligra's TextShape) it can be overloaded to return
* ChildZPassThrough which means the children keep their own z values
* @returns the z order policy of this shape
*/
virtual ChildZOrderPolicy childZOrderPolicy();
/**
* This is a method used to sort a list using the STL sorting methods.
* @param s1 the first shape
* @param s2 the second shape
*/
static bool compareShapeZIndex(KoShape *s1, KoShape *s2);
/**
* returns the outline of the shape in the form of a path.
* The outline returned will always be relative to the position() of the shape, so
* moving the shape will not alter the result. The outline is used to draw the stroke
* on, for example.
* @returns the outline of the shape in the form of a path.
*/
virtual QPainterPath outline() const;
/**
* returns the outline of the shape in the form of a rect.
* The outlineRect returned will always be relative to the position() of the shape, so
* moving the shape will not alter the result. The outline is used to calculate
* the boundingRect.
* @returns the outline of the shape in the form of a rect.
*/
virtual QRectF outlineRect() const;
/**
* returns the outline of the shape in the form of a path for the use of painting a shadow.
*
* Normally this would be the same as outline() if there is a fill (background) set on the
* shape and empty if not. However, a shape could reimplement this to return an outline
* even if no fill is defined. A typical example of this would be the picture shape
* which has a picture but almost never a background.
*
* @returns the outline of the shape in the form of a path.
*/
virtual QPainterPath shadowOutline() const;
/**
* Returns the currently set stroke, or 0 if there is no stroke.
* @return the currently set stroke, or 0 if there is no stroke.
*/
KoShapeStrokeModelSP stroke() const;
/**
* Set a new stroke, removing the old one. The stroke inheritance becomes disabled.
* @param stroke the new stroke, or 0 if there should be no stroke.
*/
void setStroke(KoShapeStrokeModelSP stroke);
/**
* @brief setInheritStroke marks a shape as inhiriting the stroke
* from the parent shape. NOTE: The currently selected stroke is destroyed.
* @param value true if the shape should inherit the stroke style
*/
void setInheritStroke(bool value);
/**
* @brief inheritStroke shows if the shape inherits the stroke from its parent
* @return true if the shape inherits the stroke style
*/
bool inheritStroke() const;
/**
* Return the insets of the stroke.
* Convenience method for KoShapeStrokeModel::strokeInsets()
*/
KoInsets strokeInsets() const;
/// Sets the new shadow, removing the old one
void setShadow(KoShapeShadow *shadow);
/// Returns the currently set shadow or 0 if there is no shadow set
KoShapeShadow *shadow() const;
/// Sets the new border, removing the old one.
void setBorder(KoBorder *border);
/// Returns the currently set border or 0 if there is no border set
KoBorder *border() const;
/// Sets a new clip path, removing the old one
void setClipPath(KoClipPath *clipPath);
/// Returns the currently set clip path or 0 if there is no clip path set
KoClipPath * clipPath() const;
/// Sets a new clip mask, removing the old one. The mask is owned by the shape.
void setClipMask(KoClipMask *clipMask);
/// Returns the currently set clip mask or 0 if there is no clip mask set
KoClipMask* clipMask() const;
/**
* Setting the shape to keep its aspect-ratio has the effect that user-scaling will
* keep the width/height ratio intact so as not to distort shapes that rely on that
* ratio.
* @param keepAspect the new value
*/
void setKeepAspectRatio(bool keepAspect);
/**
* Setting the shape to keep its aspect-ratio has the effect that user-scaling will
* keep the width/height ratio intact so as not to distort shapes that rely on that
* ratio.
* @return whether to keep aspect ratio of this shape
*/
bool keepAspectRatio() const;
/**
* Return the position of this shape regardless of rotation/skew/scaling and regardless of
* this shape having a parent (being in a group) or not.
* @param anchor The place on the (unaltered) shape that you want the position of.
* @return the point that is the absolute, centered position of this shape.
*/
QPointF absolutePosition(KoFlake::AnchorPosition anchor = KoFlake::Center) const;
/**
* Move this shape to an absolute position where the end location will be the same
* regardless of the shape's rotation/skew/scaling and regardless of this shape having
* a parent (being in a group) or not.
* The newPosition is going to be the center of the shape.
* This has the convenient effect that:
shape->setAbsolutePosition(QPointF(0,0));
shape->rotate(45);
Will result in the same visual position of the shape as the opposite:
shape->rotate(45);
shape->setAbsolutePosition(QPointF(0,0));
* @param newPosition the new absolute center of the shape.
* @param anchor The place on the (unaltered) shape that you set the position of.
*/
void setAbsolutePosition(const QPointF &newPosition, KoFlake::AnchorPosition anchor = KoFlake::Center);
/**
* Set a data object on the shape to be used by an application.
* This is specifically useful when a shape is created in a plugin and that data from that
* shape should be accessible outside the plugin.
* @param userData the new user data, or 0 to delete the current one.
*/
void setUserData(KoShapeUserData *userData);
/**
* Return the current userData.
*/
KoShapeUserData *userData() const;
/**
* Return the Id of this shape, identifying the type of shape by the id of the factory.
* @see KoShapeFactoryBase::shapeId()
* @return the id of the shape-type
*/
QString shapeId() const;
/**
* Set the Id of this shape. A shapeFactory is expected to set the Id at creation
* so applications can find out what kind of shape this is.
* @see KoShapeFactoryBase::shapeId()
* @param id the ID from the factory that created this shape
*/
void setShapeId(const QString &id);
/**
* Create a matrix that describes all the transformations done on this shape.
*
* The absolute transformation is the combined transformation of this shape
* and all its parents and grandparents.
*
* @param converter if not null, this method uses the converter to mark the right
* offsets in the current view.
*/
QTransform absoluteTransformation(const KoViewConverter *converter) const;
/**
* Applies a transformation to this shape.
*
* The transformation given is relative to the global coordinate system, i.e. the document.
* This is a convenience function to apply a global transformation to this shape.
* @see applyTransformation
*
* @param matrix the transformation matrix to apply
*/
void applyAbsoluteTransformation(const QTransform &matrix);
/**
* Sets a new transformation matrix describing the local transformations on this shape.
* @param matrix the new transformation matrix
*/
void setTransformation(const QTransform &matrix);
/// Returns the shapes local transformation matrix
QTransform transformation() const;
/**
* Applies a transformation to this shape.
*
* The transformation given is relative to the shape coordinate system.
*
* @param matrix the transformation matrix to apply
*/
void applyTransformation(const QTransform &matrix);
/**
* Copy all the settings from the parameter shape and apply them to this shape.
* Settings like the position and rotation to visible and locked. The parent
* is a notable exclusion.
* @param shape the shape to use as original
*/
void copySettings(const KoShape *shape);
/**
* Convenience method that allows people implementing paint() to use the shape
* internal coordinate system directly to paint itself instead of considering the
* views zoom.
* @param painter the painter to alter the zoom level of.
* @param converter the converter for the current views zoom.
*/
static void applyConversion(QPainter &painter, const KoViewConverter &converter);
/**
* A convenience method that creates a handles helper with applying transformations at
* the same time. Please note that you shouldn't save/restore additionally. All the work
* on restoring original painter's transformations is done by the helper.
*/
static KisHandlePainterHelper createHandlePainterHelper(QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius = 0.0);
/**
* @brief Transforms point from shape coordinates to document coordinates
* @param point in shape coordinates
* @return point in document coordinates
*/
QPointF shapeToDocument(const QPointF &point) const;
/**
* @brief Transforms rect from shape coordinates to document coordinates
* @param rect in shape coordinates
* @return rect in document coordinates
*/
QRectF shapeToDocument(const QRectF &rect) const;
/**
* @brief Transforms point from document coordinates to shape coordinates
* @param point in document coordinates
* @return point in shape coordinates
*/
QPointF documentToShape(const QPointF &point) const;
/**
* @brief Transform rect from document coordinates to shape coordinates
* @param rect in document coordinates
* @return rect in shape coordinates
*/
QRectF documentToShape(const QRectF &rect) const;
/**
* Returns the name of the shape.
* @return the shapes name
*/
QString name() const;
/**
* Sets the name of the shape.
* @param name the new shape name
*/
void setName(const QString &name);
/**
* Update the position of the shape in the tree of the KoShapeManager.
*/
void notifyChanged();
/**
* A shape can be in a state that it is doing processing data like loading or text layout.
* In this case it can be shown on screen probably partially but it should really not be printed
* until it is fully done processing.
* Warning! This method can be blocking for a long time
+ * @param converter The converter
* @param asynchronous If set to true the processing will can take place in a different thread and the
* function will not block until the shape is finished.
* In case of printing Flake will call this method from a non-main thread and only
* start printing it when the in case of printing method returned.
* If set to false the processing needs to be done synchronously and will
* block until the result is finished.
*/
virtual void waitUntilReady(const KoViewConverter &converter, bool asynchronous = true) const;
/// checks recursively if the shape or one of its parents is not visible or locked
virtual bool isShapeEditable(bool recursive = true) const;
/**
* Adds a shape which depends on this shape.
* Making a shape dependent on this one means it will get shapeChanged() called
* on each update of this shape.
*
* If this shape already depends on the given shape, establishing the
* dependency is refused to prevent circular dependencies.
*
* @param shape the shape which depends on this shape
* @return true if dependency could be established, otherwise false
* @see removeDependee(), hasDependee()
*/
bool addDependee(KoShape *shape);
/**
* Removes as shape depending on this shape.
* @see addDependee(), hasDependee()
*/
void removeDependee(KoShape *shape);
/// Returns if the given shape is dependent on this shape
bool hasDependee(KoShape *shape) const;
/// Returns list of shapes depending on this shape
QList dependees() const;
/// Returns additional snap data the shape wants to have snapping to
virtual KoSnapData snapData() const;
/**
* Set additional attribute
*
* This can be used to attach additional attributes to a shape for attributes
* that are application specific like presentation:placeholder
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
* @param value The value of the attribute
*/
void setAdditionalAttribute(const QString &name, const QString &value);
/**
* Remove additional attribute
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
*/
void removeAdditionalAttribute(const QString &name);
/**
* Check if additional attribute is set
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
*
* @return true if there is a attribute with prefix:tag set, false otherwise
*/
bool hasAdditionalAttribute(const QString &name) const;
/**
* Get additional attribute
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
*
* @return The value of the attribute if it exists or a null string if not found.
*/
QString additionalAttribute(const QString &name) const;
void setAdditionalStyleAttribute(const char *name, const QString &value);
void removeAdditionalStyleAttribute(const char *name);
/**
* Returns the filter effect stack of the shape
*
* @return the list of filter effects applied on the shape when rendering.
*/
KoFilterEffectStack *filterEffectStack() const;
/// Sets the new filter effect stack, removing the old one
void setFilterEffectStack(KoFilterEffectStack *filterEffectStack);
/**
* Set the property collision detection.
* Setting this to true will result in calls to shapeChanged() with the CollisionDetected
* parameter whenever either this or another shape is moved/rotated etc and intersects this shape.
* @param detect if true detect collisions.
*/
void setCollisionDetection(bool detect);
/**
* get the property collision detection.
* @returns true if collision detection is on.
*/
bool collisionDetection();
/**
* Return the tool delegates for this shape.
* In Flake a shape being selected will cause the tool manager to make available all tools that
* can edit the selected shapes. In some cases selecting one shape should allow the tool to
* edit a related shape be available too. The tool delegates allows this to happen by taking
* all the shapes in the set into account on tool selection.
* Notice that if the set is non-empty 'this' shape is no longer looked at. You can choose
* to add itself to the set too.
*/
QSet toolDelegates() const;
/**
* Set the tool delegates.
* @param delegates the new delegates.
* @see toolDelegates()
*/
void setToolDelegates(const QSet &delegates);
/**
* Return the hyperlink for this shape.
*/
QString hyperLink () const;
/**
* Set hyperlink for this shape.
* @param hyperLink name.
*/
void setHyperLink(const QString &hyperLink);
/**
* \internal
* Returns the private object for use within the flake lib
*/
KoShapePrivate *priv();
public:
struct KRITAFLAKE_EXPORT ShapeChangeListener {
virtual ~ShapeChangeListener();
virtual void notifyShapeChanged(ChangeType type, KoShape *shape) = 0;
private:
friend class KoShape;
friend class KoShapePrivate;
void registerShape(KoShape *shape);
void unregisterShape(KoShape *shape);
void notifyShapeChangedImpl(ChangeType type, KoShape *shape);
QList m_registeredShapes;
};
void addShapeChangeListener(ShapeChangeListener *listener);
void removeShapeChangeListener(ShapeChangeListener *listener);
public:
static QList linearizeSubtree(const QList &shapes);
protected:
/// constructor
KoShape(KoShapePrivate *);
/* ** loading saving helper methods */
/// attributes from ODF 1.1 chapter 9.2.15 Common Drawing Shape Attributes
enum OdfAttribute {
OdfTransformation = 1, ///< Store transformation information
OdfSize = 2, ///< Store size information
OdfPosition = 8, ///< Store position
OdfAdditionalAttributes = 4, ///< Store additional attributes of the shape
OdfCommonChildElements = 16, ///< Event actions and connection points
OdfLayer = 64, ///< Store layer name
OdfStyle = 128, ///< Store the style
OdfId = 256, ///< Store the unique ID
OdfName = 512, ///< Store the name of the shape
OdfZIndex = 1024, ///< Store the z-index
OdfViewbox = 2048, ///< Store the viewbox
/// A mask for all mandatory attributes
OdfMandatories = OdfLayer | OdfStyle | OdfId | OdfName | OdfZIndex,
/// A mask for geometry attributes
OdfGeometry = OdfPosition | OdfSize,
/// A mask for all the attributes
OdfAllAttributes = OdfTransformation | OdfGeometry | OdfAdditionalAttributes | OdfMandatories | OdfCommonChildElements
};
/**
* This method is used during loading of the shape to load common attributes
*
* @param context the KoShapeLoadingContext used for loading
* @param element element which represents the shape in odf
* @param attributes a number of OdfAttribute items to state which attributes to load.
*/
bool loadOdfAttributes(const KoXmlElement &element, KoShapeLoadingContext &context, int attributes);
/**
* Parses the transformation attribute from the given string
* @param transform the transform attribute string
* @return the resulting transformation matrix
*/
QTransform parseOdfTransform(const QString &transform);
/**
* @brief Saves the style used for the shape
*
* This method fills the given style object with the stroke and
* background properties and then adds the style to the context.
*
* @param style the style object to fill
* @param context used for saving
* @return the name of the style
* @see saveOdf
*/
virtual QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
/**
* Loads the stroke and fill style from the given element.
*
* @param element the xml element to load the style from
* @param context the loading context used for loading
*/
virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context);
/// Loads the stroke style
KoShapeStrokeModelSP loadOdfStroke(const KoXmlElement &element, KoShapeLoadingContext &context) const;
/// Loads the fill style
QSharedPointer loadOdfFill(KoShapeLoadingContext &context) const;
/// Loads the connection points
void loadOdfGluePoints(const KoXmlElement &element, KoShapeLoadingContext &context);
/// Loads the clip contour
void loadOdfClipContour(const KoXmlElement &element, KoShapeLoadingContext &context, const QSizeF &scaleFactor);
/* ** end loading saving */
/**
* A hook that allows inheriting classes to do something after a KoShape property changed
* This is called whenever the shape, position rotation or scale properties were altered.
* @param type an indicator which type was changed.
+ * @param shape the shape.
*/
virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
/// return the current matrix that contains the rotation/scale/position of this shape
QTransform transform() const;
KoShapePrivate *d_ptr;
private:
Q_DECLARE_PRIVATE(KoShape)
};
Q_DECLARE_METATYPE(KoShape*)
#endif
diff --git a/libs/flake/KoShapeContainer.h b/libs/flake/KoShapeContainer.h
index c1b934dd07..3f31b9d8fc 100644
--- a/libs/flake/KoShapeContainer.h
+++ b/libs/flake/KoShapeContainer.h
@@ -1,251 +1,252 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2010 Thomas Zander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONTAINER_H
#define KOSHAPECONTAINER_H
#include "KoShape.h"
#include
#include "kritaflake_export.h"
class QPainter;
class KoShapeContainerModel;
class KoShapeContainerPrivate;
class KoViewConverter;
/**
* This is the base class that all Flake group-shapes are based on.
* Extending from this class allows you to have child-shapes.
* Like the KoShape class, this shape is a visible class with
* a position and a size. It can paint itself as well if you implement
* the paintComponent() method.
*
* The most important feature of this class is that you can make
* other KoShape classes to be children of this container.
*
*
The effect of grouping those shapes is that their position
* is relative to the position of the container. Move the container and
* all children move with it.
*
*
Each child can optionally be said to be 'clipped' by the container.
* This feature will give the effect that if the child has a size and
* position outside the container, parts outside the container will not be shown.
* This is especially useful
* for showing cutouts of content, like images, without changing the actual content.
*
*
For so called clipped children any modification made to the container is
* propagated to the child. This includes rotation as well as scaling
* and shearing.
*
*
Maintaining the list of children can be done using the supplied methods
* addChild() and removeChild(). However, they only forward their requests to the
* data model KoShapeContainerModel and if you provide a custom implementation
* of that model any means can be used to maintain a list of children, as long as
* you will take care to register them with the appropriate shape manager.
*
*
An example usage where a custom model might be useful is when you have a
* container for text areas which are split into columns. If you resize the container
* and the width of the individual columns gets too small, the model can choose to
* remove a child or add one when the width allows another column.
*/
class KRITAFLAKE_EXPORT KoShapeContainer : public KoShape
{
public:
/**
* Constructor with custom model to be used for maintaining the list of children.
* For all the normal cases you don't need a custom model. Only when you want to respond
* to moves of the container to do something special, or disable one of the features the
* container normally has (like clipping). Use the default constructor in those cases.
* @param model the custom model to be used for maintaining the list of children.
*/
explicit KoShapeContainer(KoShapeContainerModel *model = 0);
/**
* Destructor for the shape container.
* All children will be orphaned by calling a KoShape::setParent(0)
*/
~KoShapeContainer() override;
/**
* Add a child to this container.
*
* This container will NOT take over ownership of the shape. The caller or those creating
* the shape is responsible to delete it if not needed any longer.
*
* @param shape the child to be managed in the container.
*/
void addShape(KoShape *shape);
/**
* Remove a child to be completely separated from the container.
*
* The shape will only be removed from this container but not be deleted.
*
* @param shape the child to be removed.
*/
void removeShape(KoShape *shape);
/**
* Return the current number of children registered.
* @return the current number of children registered.
*/
int shapeCount() const;
/**
* Set the argument child to have its 'clipping' property set.
*
* A shape that is clipped by the container will have its visible portion
* limited to the area where it intersects with the container.
* If a shape is positioned or sized such that it would be painted outside
* of the KoShape::outline() of its parent container, setting this property
* to true will clip the shape painting to the container outline.
*
* @param child the child for which the property will be changed.
* @param clipping the property
*/
void setClipped(const KoShape *child, bool clipping);
/**
* Returns if the argument child has its 'clipping' property set.
*
* A shape that is clipped by the container will have its visible portion
* limited to the area where it intersects with the container.
* If a shape is positioned or sized such that it would be painted outside
* of the KoShape::outline() of its parent container, setting this property
* to true will clip the shape painting to the container outline.
*
* @return if the argument child has its 'clipping' property set.
* @param child the child for which the property will be returned.
*/
bool isClipped(const KoShape *child) const;
/**
* Set the shape to inherit the container transform.
*
* A shape that inherits the transform of the parent container will have its
* share / rotation / skew etc be calculated as being the product of both its
* own local transformation and also that of its parent container.
* If you set this to true and rotate the container, the shape will get that
* rotation as well automatically.
*
* @param shape the shape for which the property will be changed.
* @param inherit the new value
*/
void setInheritsTransform(const KoShape *shape, bool inherit);
/**
* Returns if the shape inherits the container transform.
*
* A shape that inherits the transform of the parent container will have its
* share / rotation / skew etc be calculated as being the product of both its
* own local transformation and also that of its parent container.
* If you set this to true and rotate the container, the shape will get that
* rotation as well automatically.
*
* @return if the argument shape has its 'inherits transform' property set.
* @param shape the shape for which the property will be returned.
*/
bool inheritsTransform(const KoShape *shape) const;
/// reimplemented
void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
/**
* @brief Paint the component
* Implement this method to allow the shape to paint itself, just like the KoShape::paint()
* method does.
*
* @param painter used for painting the shape
* @param converter to convert between internal and view coordinates.
+ * @param paintcontext the painting context
* @see applyConversion()
*/
virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) = 0;
using KoShape::update;
/// reimplemented
void update() const override;
/**
* Return the list of all child shapes.
* @return the list of all child shapes
*/
QList shapes() const;
/**
* return the model for this container
*/
KoShapeContainerModel *model() const;
/**
* A special interface for KoShape to use during setParent call. Don't use
* these method directly for managing shapes hierarchy! Use shape->setParent()
* instead.
*/
struct ShapeInterface {
ShapeInterface(KoShapeContainer *_q);
/**
* Add a child to this container.
*
* This container will NOT take over ownership of the shape. The caller or those creating
* the shape is responsible to delete it if not needed any longer.
*
* @param shape the child to be managed in the container.
*/
void addShape(KoShape *shape);
/**
* Remove a child to be completely separated from the container.
*
* The shape will only be removed from this container but not be deleted.
*
* @param shape the child to be removed.
*/
void removeShape(KoShape *shape);
protected:
KoShapeContainer *q;
};
ShapeInterface* shapeInterface();
protected:
/**
* This hook is for inheriting classes that need to do something on adding/removing
* of children.
* This method will be called just after the child has been added/removed.
* The default implementation is empty.
*/
virtual void shapeCountChanged() { }
void shapeChanged(ChangeType type, KoShape *shape = 0) override;
/// constructor
KoShapeContainer(KoShapeContainerPrivate *);
private:
Q_DECLARE_PRIVATE(KoShapeContainer)
};
#endif
diff --git a/libs/flake/KoShapeController.h b/libs/flake/KoShapeController.h
index cde79865e5..9e60ff550a 100644
--- a/libs/flake/KoShapeController.h
+++ b/libs/flake/KoShapeController.h
@@ -1,170 +1,173 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007, 2010 Thomas Zander
* Copyright (C) 2006-2008 Thorsten Zachmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONTROLLER_H
#define KOSHAPECONTROLLER_H
#include "kritaflake_export.h"
#include
#include
#include
class KoCanvasBase;
class KoShape;
class KoShapeContainer;
class KoShapeControllerBase;
class KUndo2Command;
class KoDocumentResourceManager;
/**
* Class used by tools to maintain the list of shapes.
* All applications have some sort of list of all shapes that belong to the document.
* The applications implement the KoShapeControllerBase interface (all pure virtuals)
* to add and remove shapes from the document. To ensure that an application can expect
* a certain protocol to be adhered to when adding/removing shapes, all tools use the API
* from this class for maintaining the list of shapes in the document. So no tool gets
* to access the application directly.
*/
class KRITAFLAKE_EXPORT KoShapeController : public QObject
{
Q_OBJECT
public:
/**
* Create a new Controller; typically not called by applications, only
* by the KonCanvasBase constructor.
* @param canvas the canvas this controller works for. The canvas can be 0
* @param shapeController the application provided shapeController that we can call.
*/
KoShapeController(KoCanvasBase *canvas, KoShapeControllerBase *shapeController);
/// destructor
~KoShapeController() override;
/**
* @brief reset sets the canvas and shapebased document to 0.
*/
void reset();
/**
* @brief Add a shape to the document.
* If the shape has no parent, the active layer will become its parent.
*
* @param shape to add to the document
+ * @param parentShape the parent shape
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shape into the document or 0 if the
* insertion was cancelled. The command is not yet executed.
*/
KUndo2Command* addShape(KoShape *shape, KoShapeContainer *parentShape, KUndo2Command *parent = 0);
/**
* @brief Add a shape to the document, skipping any dialogs or other user interaction.
*
* @param shape to add to the document
+ * @param parentShape the parent shape
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shape into the document. The command is not yet executed.
*/
KUndo2Command* addShapeDirect(KoShape *shape, KoShapeContainer *parentShape, KUndo2Command *parent = 0);
/**
* @brief Add shapes to the document, skipping any dialogs or other user interaction.
*
- * @param shapes to add to the document
+ * @param shape the shape to add to the document
+ * @param parentShape the parent shape
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shapes into the document. The command is not yet executed.
*/
KUndo2Command* addShapesDirect(const QList shape, KoShapeContainer *parentShape, KUndo2Command *parent = 0);
/**
* @brief Remove a shape from the document.
*
* @param shape to remove from the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will remove the shape from the document.
* The command is not yet executed.
*/
KUndo2Command* removeShape(KoShape *shape, KUndo2Command *parent = 0);
/**
* Remove a shape from the document.
*
* @param shapes the set of shapes to remove from the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will remove the shape from the document.
* The command is not yet executed.
*/
KUndo2Command* removeShapes(const QList &shapes, KUndo2Command *parent = 0);
/**
* @brief Set the KoShapeControllerBase used to add/remove shapes.
*
* NOTE: only Sheets uses this method. Do not use it in your application. Sheets
* has to also call:
* KoToolManager::instance()->updateShapeControllerBase(shapeController, canvas->canvasController());
*
* @param shapeController the new shapeController.
*/
void setShapeControllerBase(KoShapeControllerBase *shapeController);
/**
* The size of the document measured in rasterized pixels. This information is needed for loading
* SVG documents that use 'px' as the default unit.
*/
QRectF documentRectInPixels() const;
/**
* Resolution of the rasterized representation of the document. Used to load SVG documents correctly.
*/
qreal pixelsPerInch() const;
/**
* Document rect measured in 'pt'
*/
QRectF documentRect() const;
/**
* Return a pointer to the resource manager associated with the
* shape-set (typically a document). The resource manager contains
* document wide resources * such as variable managers, the image
* collection and others.
*/
KoDocumentResourceManager *resourceManager() const;
/**
* @brief Returns the KoShapeControllerBase used to add/remove shapes.
*
* @return the KoShapeControllerBase
*/
KoShapeControllerBase *documentBase() const;
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoShapeController *)
#endif
diff --git a/libs/flake/KoShapeControllerBase.h b/libs/flake/KoShapeControllerBase.h
index c11dc0b4be..f14eee34a5 100644
--- a/libs/flake/KoShapeControllerBase.h
+++ b/libs/flake/KoShapeControllerBase.h
@@ -1,110 +1,110 @@
/* This file is part of the KDE project
Copyright (C) 2006 Jan Hambrecht
Copyright (C) 2006, 2010 Thomas Zander
Copyright (C) 2008 C. Boemann
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOshapeControllerBASE_H
#define KOshapeControllerBASE_H
#include "kritaflake_export.h"
#include
class QRectF;
class KoShape;
class KoshapeControllerBasePrivate;
class KoDocumentResourceManager;
class KUndo2Command;
/**
* The KoshapeControllerBase is an abstract interface that the application's class
* that owns the shapes should implement. This tends to be the document.
* @see KoShapeDeleteCommand, KoShapeCreateCommand
*/
class KRITAFLAKE_EXPORT KoShapeControllerBase
{
public:
KoShapeControllerBase();
virtual ~KoShapeControllerBase();
/**
* Add a shape to the shape controller, allowing it to be seen and saved.
* The controller should add the shape to the ShapeManager instance(s) manually
* if the shape is one that should be currently shown on screen.
* @param shape the new shape
*/
void addShape(KoShape *shape);
/**
* Add shapes to the shape controller, allowing it to be seen and saved.
* The controller should add the shape to the ShapeManager instance(s) manually
* if the shape is one that should be currently shown on screen.
- * @param shape the new shape
+ * @param shapes the shapes to add
*/
virtual void addShapes(const QList shapes) = 0;
/**
* Remove a shape from the shape controllers control, allowing it to be deleted shortly after
* The controller should remove the shape from all the ShapeManager instance(s) manually
* @param shape the shape to remove
*/
virtual void removeShape(KoShape *shape) = 0;
/**
* This method gets called after the KoShapeDeleteCommand is executed
*
* This passes the KoShapeDeleteCommand as the command parameter. This makes it possible
* for applications that need to do something after the KoShapeDeleteCommand is done, e.g.
* adding one commands that need to be executed when a shape was deleted.
* The default implementation is empty.
* @param shapes The list of shapes that got removed.
* @param command The command that was used to remove the shapes from the document.
*/
virtual void shapesRemoved(const QList &shapes, KUndo2Command *command);
/**
* Return a pointer to the resource manager associated with the
* shape-set (typically a document). The resource manager contains
* document wide resources * such as variable managers, the image
* collection and others.
*/
virtual KoDocumentResourceManager *resourceManager() const;
/**
* The size of the document measured in rasterized pixels. This information is needed for loading
* SVG documents that use 'px' as the default unit.
*/
virtual QRectF documentRectInPixels() const = 0;
/**
* The size of the document measured in 'pt'
*/
QRectF documentRect() const;
/**
* Resolution of the rasterized representation of the document. Used to load SVG documents correctly.
*/
virtual qreal pixelsPerInch() const = 0;
private:
KoshapeControllerBasePrivate * const d;
};
#endif
diff --git a/libs/flake/KoShapeManager.h b/libs/flake/KoShapeManager.h
index 8b9600658d..9b21d5af37 100644
--- a/libs/flake/KoShapeManager.h
+++ b/libs/flake/KoShapeManager.h
@@ -1,212 +1,214 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Thorsten Zachmann
Copyright (C) 2007, 2009 Thomas Zander
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEMANAGER_H
#define KOSHAPEMANAGER_H
#include
#include
#include
#include "KoFlake.h"
#include "kritaflake_export.h"
class KoShape;
class KoSelection;
class KoViewConverter;
class KoCanvasBase;
class KoPointerEvent;
class KoShapePaintingContext;
class QPainter;
class QPointF;
class QRectF;
/**
* The shape manager hold a list of all shape which are in scope.
* There is one shape manager per canvas. This makes the shape manager
* different from QGraphicsScene, which contains the datamodel for all
* graphics items: KoShapeManager only contains the subset of shapes
* that are shown in its canvas.
*
* The selection in the different views can be different.
*/
class KRITAFLAKE_EXPORT KoShapeManager : public QObject
{
Q_OBJECT
public:
/// enum for add()
enum Repaint {
PaintShapeOnAdd, ///< Causes each shapes 'update()' to be called after being added to the shapeManager
AddWithoutRepaint ///< Avoids each shapes 'update()' to be called for faster addition when its possible.
};
/**
* Constructor.
*/
explicit KoShapeManager(KoCanvasBase *canvas);
/**
* Constructor that takes a list of shapes, convenience version.
* @param shapes the shapes to start out with, see also setShapes()
* @param canvas the canvas this shape manager is working on.
*/
KoShapeManager(KoCanvasBase *canvas, const QList &shapes);
~KoShapeManager() override;
/**
* Remove all previously owned shapes and make the argument list the new shapes
* to be managed by this manager.
* @param shapes the new shapes to manage.
* @param repaint if true it will trigger a repaint of the shapes
*/
void setShapes(const QList &shapes, Repaint repaint = PaintShapeOnAdd);
/// returns the list of maintained shapes
QList shapes() const;
/**
* Get a list of all shapes that don't have a parent.
*/
QList topLevelShapes() const;
public Q_SLOTS:
/**
* Add a KoShape to be displayed and managed by this manager.
* This will trigger a repaint of the shape.
* @param shape the shape to add
* @param repaint if true it will trigger a repaint of the shape
*/
void addShape(KoShape *shape, KoShapeManager::Repaint repaint = PaintShapeOnAdd);
/**
* Remove a KoShape from this manager
* @param shape the shape to remove
*/
void remove(KoShape *shape);
public:
/// return the selection shapes for this shapeManager
KoSelection *selection() const;
/**
* Paint all shapes and their selection handles etc.
* @param painter the painter to paint to.
* @param forPrint if true, make sure only actual content is drawn and no decorations.
* @param converter to convert between document and view coordinates.
*/
void paint(QPainter &painter, const KoViewConverter &converter, bool forPrint);
/**
* Returns the shape located at a specific point in the document.
* If more than one shape is located at the specific point, the given selection type
* controls which of them is returned.
* @param position the position in the document coordinate system.
* @param selection controls which shape is returned when more than one shape is at the specific point
* @param omitHiddenShapes if true, only visible shapes are considered
*/
KoShape *shapeAt(const QPointF &position, KoFlake::ShapeSelection selection = KoFlake::ShapeOnTop, bool omitHiddenShapes = true);
/**
* Returns the shapes which intersects the specific rect in the document.
* @param rect the rectangle in the document coordinate system.
- * @param omitHiddenShapes if true, only visible shapes are considered
+ * @param omitHiddenShapes if @c true, only visible shapes are considered
+ * @param containedMode if @c true use contained mode
*/
QList shapesAt(const QRectF &rect, bool omitHiddenShapes = true, bool containedMode = false);
/**
* Request a repaint to be queued.
* The repaint will be restricted to the parameters rectangle, which is expected to be
* in points (the document coordinates system of KoShape) and it is expected to be
* normalized and based in the global coordinates, not any local coordinates.
* This method will return immediately and only request a repaint. Successive calls
* will be merged into an appropriate repaint action.
* @param rect the rectangle (in pt) to queue for repaint.
* @param shape the shape that is going to be redrawn; only needed when selectionHandles=true
* @param selectionHandles if true; find out if the shape is selected and repaint its
* selection handles at the same time.
*/
void update(const QRectF &rect, const KoShape *shape = 0, bool selectionHandles = false);
/**
* Update the tree for finding the shapes.
* This will remove the shape from the tree and will reinsert it again.
* The update to the tree will be posponed until it is needed so that successive calls
* will be merged into one.
* @param shape the shape to updated its position in the tree.
*/
void notifyShapeChanged(KoShape *shape);
/**
* Paint a shape
*
* @param shape the shape to paint
* @param painter the painter to paint to.
* @param converter to convert between document and view coordinates.
+ * @param paintContext the painting context
*/
static void paintShape(KoShape *shape, QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
/**
* @brief renderSingleShape renders a shape on \p painter. This method includes all the
* needed steps for painting a single shape: setting transformations, clipping and masking.
*/
static void renderSingleShape(KoShape *shape, QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
/**
* A special interface for KoShape to use during shape destruction. Don't use this
* interface directly unless you are KoShape.
*/
struct ShapeInterface {
ShapeInterface(KoShapeManager *_q);
/**
* Called by a shape when it is destructed. Please note that you cannot access
* any shape's method type or information during this call because the shape might be
* semi-destroyed.
*/
void notifyShapeDestructed(KoShape *shape);
protected:
KoShapeManager *q;
};
ShapeInterface* shapeInterface();
Q_SIGNALS:
/// emitted when the selection is changed
void selectionChanged();
/// emitted when an object in the selection is changed (moved/rotated etc)
void selectionContentChanged();
/// emitted when any object changed (moved/rotated etc)
void contentChanged();
private:
KoCanvasBase *canvas();
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void updateTree())
};
#endif
diff --git a/libs/flake/KoToolManager.h b/libs/flake/KoToolManager.h
index f99dc52d34..77dbe4edd1 100644
--- a/libs/flake/KoToolManager.h
+++ b/libs/flake/KoToolManager.h
@@ -1,335 +1,335 @@
/* This file is part of the KDE project
* Copyright (c) 2005-2006 Boudewijn Rempt
* Copyright (C) 2006, 2008 Thomas Zander
* Copyright (C) 2006 Thorsten Zachmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_TOOL_MANAGER
#define KO_TOOL_MANAGER
#include "KoInputDevice.h"
#include "kritaflake_export.h"
#include
#include
class KoCanvasController;
class KoShapeControllerBase;
class KoToolFactoryBase;
class KoCanvasBase;
class KoToolBase;
class KoCreateShapesTool;
class KActionCollection;
class KoShape;
class KoInputDeviceHandlerEvent;
class KoShapeLayer;
class ToolHelper;
class QKeySequence;
class QCursor;
/**
* This class serves as a QAction-like control object for activation of a tool.
*
* It allows to implement a custom UI to control the activation of tools.
* See KoToolBox & KoModeBox in the kowidgets library.
*
* KoToolAction objects are indirectly owned by the KoToolManager singleton
* and live until the end of its lifetime.
*/
class KRITAFLAKE_EXPORT KoToolAction : public QObject
{
Q_OBJECT
public:
// toolHelper takes over ownership, and those live till the end of KoToolManager.
explicit KoToolAction(ToolHelper *toolHelper);
~KoToolAction() override;
public:
QString id() const; ///< The id of the tool
QString iconText() const; ///< The icontext of the tool
QString toolTip() const; ///< The tooltip of the tool
QString iconName() const; ///< The icon name of the tool
QKeySequence shortcut() const; ///< The shortcut to activate the tool
QString section() const; ///< The section the tool wants to be in.
int priority() const; ///< Lower number (higher priority) means coming first in the section.
int buttonGroupId() const; ///< A unique ID for this tool as passed by changedTool(), >= 0
QString visibilityCode() const; ///< This tool should become visible when we emit this string in toolCodesSelected()
public Q_SLOTS:
void trigger(); ///< Request the activation of the tool
Q_SIGNALS:
void changed(); ///< Emitted when a property changes (shortcut ATM)
private:
friend class ToolHelper;
class Private;
Private *const d;
};
/**
* This class manages the activation and deactivation of tools for
* each input device.
*
* Managing the active tool and switching tool based on various variables.
*
* The state of the toolbox will be the same for all views in the process so practically
* you can say we have one toolbox per application instance (process). Implementation
* does not allow one widget to be in more then one view, so we just make sure the toolbox
* is hidden in not-in-focus views.
*
* The ToolManager is a singleton and will manage all views in all applications that
* are loaded in this process. This means you will have to register and unregister your view.
* When creating your new view you should use a KoCanvasController() and register that
* with the ToolManager like this:
@code
MyGuiWidget::MyGuiWidget() {
m_canvasController = new KoCanvasController(this);
m_canvasController->setCanvas(m_canvas);
KoToolManager::instance()->addControllers(m_canvasController));
}
MyGuiWidget::~MyGuiWidget() {
KoToolManager::instance()->removeCanvasController(m_canvasController);
}
@endcode
*
* For a new view that extends KoView all you need to do is implement KoView::createToolBox()
*
* KoToolManager also keeps track of the current tool based on a
complex set of conditions and heuristics:
- there is one active tool per KoCanvasController (and there is one KoCanvasController
per view, because this is a class with scrollbars and a zoomlevel and so on)
- for every pointing device (determined by the unique id of tablet,
or 0 for mice -- you may have more than one mouse attached, but
Qt cannot distinguish between them, there is an associated tool.
- depending on things like tablet leave/enter proximity, incoming
mouse or tablet events and a little timer (that gets stopped when
we know what is what), the active pointing device is determined,
and the active tool is set accordingly.
Nota bene: if you use KoToolManager and register your canvases with
it you no longer have to manually implement methods to route mouse,
tablet, key or wheel events to the active tool. In fact, it's no
longer interesting to you which tool is active; you can safely
route the paint event through KoToolProxy::paint().
(The reason the input events are handled completely by the
toolmanager and the paint events not is that, generally speaking,
it's okay if the tools get the input events first, but you want to
paint your shapes or other canvas stuff first and only then paint
the tool stuff.)
*/
class KRITAFLAKE_EXPORT KoToolManager : public QObject
{
Q_OBJECT
public:
KoToolManager();
/// Return the toolmanager singleton
static KoToolManager* instance();
~KoToolManager() override;
/**
* Register actions for switching to tools at the actionCollection parameter.
* The actions will have the text / shortcut as stated by the toolFactory.
* If the application calls this in their KoView extending class they will have all the benefits
* from allowing this in the menus and to allow the use to configure the shortcuts used.
* @param ac the actionCollection that will be the parent of the actions.
* @param controller tools registered with this controller will have all their actions added as well.
*/
void registerToolActions(KActionCollection *ac, KoCanvasController *controller);
/**
* Register a new canvas controller
* @param controller the view controller that this toolmanager will manage the tools for
*/
void addController(KoCanvasController *controller);
/**
* Remove a set of controllers
* When the controller is no longer used it should be removed so all tools can be
* deleted and stop eating memory.
* @param controller the controller that is removed
*/
void removeCanvasController(KoCanvasController *controller);
/**
* Attempt to remove a controller.
* This is automatically called when a controller's proxy object is deleted, and
* it ensures that the controller is, in fact, removed, even if the creator forgot
* to do so.
* @param controller the proxy object of the controller to be removed
*/
Q_SLOT void attemptCanvasControllerRemoval(QObject *controller);
/// @return the active canvas controller
KoCanvasController *activeCanvasController() const;
/**
* Return the tool that is able to create shapes for this param canvas.
* This is typically used by the KoShapeSelector to set which shape to create next.
* @param canvas the canvas that is a child of a previously registered controller
* who's tool you want.
* @see addController()
*/
KoCreateShapesTool *shapeCreatorTool(KoCanvasBase *canvas) const;
/**
* Returns the tool for the given tool id. The tool may be 0
* @param canvas the canvas that is a child of a previously registered controller
* who's tool you want.
+ * @param id the tool identifier
* @see addController()
*/
KoToolBase *toolById(KoCanvasBase *canvas, const QString &id) const;
/// @return the currently active pointing device
KoInputDevice currentInputDevice() const;
/**
* For the list of shapes find out which tool is the highest priority tool that can handle it.
* @returns the toolId for the shapes.
* @param shapes a list of shapes, a selection for example, that is used to look for the tool.
*/
QString preferredToolForSelection(const QList &shapes);
/**
* Returns the list of toolActions for the current tools.
* @returns lists of toolActions for the current tools.
*/
QList toolActionList() const;
/// Request tool activation for the given canvas controller
void requestToolActivation(KoCanvasController *controller);
/// Returns the toolId of the currently active tool
QString activeToolId() const;
void initializeCurrentToolForCanvas();
class Private;
/**
* \internal return the private object for the toolmanager.
*/
KoToolManager::Private *priv();
public Q_SLOTS:
/**
* Request switching tool
* @param id the id of the tool
*/
void switchToolRequested(const QString &id);
/**
* Request change input device
* @param id the id of the input device
*/
void switchInputDeviceRequested(const KoInputDevice &id);
/**
* Request for temporary switching the tools.
* This switch can be later reverted with switchBackRequested().
* @param id the id of the tool
*
* @see switchBackRequested()
*/
void switchToolTemporaryRequested(const QString &id);
/**
* Switches back to the original tool after the temporary switch
* has been done. It the user changed the tool manually on the way,
* then it switches to the interaction tool
*/
void switchBackRequested();
Q_SIGNALS:
/**
* Emitted when a new tool is going to override the current tool
* @param canvas the currently active canvas.
*/
void aboutToChangeTool(KoCanvasController *canvas);
/**
* Emitted when a new tool was selected or became active.
* @param canvas the currently active canvas.
* @param uniqueToolId a random but unique code for the new tool.
*/
void changedTool(KoCanvasController *canvas, int uniqueToolId);
/**
* Emitted after the selection changed to state which unique shape-types are now
* in the selection.
- * @param canvas the currently active canvas.
* @param types a list of string that are the shape types of the selected objects.
*/
void toolCodesSelected(const QList &types);
/**
* Emitted after the current layer changed either its properties or to a new layer.
* @param canvas the currently active canvas.
* @param layer the layer that is selected.
*/
void currentLayerChanged(const KoCanvasController *canvas, const KoShapeLayer *layer);
/**
* Every time a new input device gets used by a tool, this event is emitted.
* @param device the new input device that the user picked up.
*/
void inputDeviceChanged(const KoInputDevice &device);
/**
* Emitted whenever the active canvas changed.
* @param canvas the new activated canvas (might be 0)
*/
void changedCanvas(const KoCanvasBase *canvas);
/**
* Emitted whenever the active tool changes the status text.
* @param statusText the new status text
*/
void changedStatusText(const QString &statusText);
/**
* emitted whenever a new tool is dynamically added for the given canvas
*/
void addedTool(KoToolAction *toolAction, KoCanvasController *canvas);
/**
* Emit the new tool option widgets to be used with this canvas.
*/
void toolOptionWidgetsChanged(KoCanvasController *controller, const QList > &widgets);
private:
KoToolManager(const KoToolManager&);
KoToolManager operator=(const KoToolManager&);
Q_PRIVATE_SLOT(d, void toolActivated(ToolHelper *tool))
Q_PRIVATE_SLOT(d, void detachCanvas(KoCanvasController *controller))
Q_PRIVATE_SLOT(d, void attachCanvas(KoCanvasController *controller))
Q_PRIVATE_SLOT(d, void movedFocus(QWidget *from, QWidget *to))
Q_PRIVATE_SLOT(d, void updateCursor(const QCursor &cursor))
Q_PRIVATE_SLOT(d, void selectionChanged(const QList &shapes))
Q_PRIVATE_SLOT(d, void currentLayerChanged(const KoShapeLayer *layer))
QPair createTools(KoCanvasController *controller, ToolHelper *tool);
Private *const d;
};
#endif
diff --git a/libs/flake/commands/KoPathBaseCommand.h b/libs/flake/commands/KoPathBaseCommand.h
index 25b23acc8d..ee40b5110d 100644
--- a/libs/flake/commands/KoPathBaseCommand.h
+++ b/libs/flake/commands/KoPathBaseCommand.h
@@ -1,53 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht
* Copyright (C) 2006,2007 Thorsten Zachmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHBASECOMMAND_H
#define KOPATHBASECOMMAND_H
#include
#include
class KoPathShape;
/// the base command for commands altering a path shape
class KoPathBaseCommand : public KUndo2Command
{
public:
/**
* @param parent the parent command used for macro commands
*/
explicit KoPathBaseCommand(KUndo2Command *parent = 0);
/** initialize the base command with a single shape
+ * @param shape the shape
* @param parent the parent command used for macro commands
*/
explicit KoPathBaseCommand(KoPathShape *shape, KUndo2Command *parent = 0);
protected:
/**
* Schedules repainting of all shapes control point rects.
* @param normalizeShapes controls if paths are normalized before painting
*/
void repaint(bool normalizeShapes);
QSet m_shapes; ///< the shapes the command operates on
};
#endif // KOPATHBASECOMMAND_H
diff --git a/libs/flake/commands/KoPathControlPointMoveCommand.h b/libs/flake/commands/KoPathControlPointMoveCommand.h
index e1d14381ba..12e8848e90 100644
--- a/libs/flake/commands/KoPathControlPointMoveCommand.h
+++ b/libs/flake/commands/KoPathControlPointMoveCommand.h
@@ -1,58 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht
* Copyright (C) 2006,2007 Thorsten Zachmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHCONTROLPOINTMOVECOMMAND_H
#define KOPATHCONTROLPOINTMOVECOMMAND_H
#include
#include
#include "KoPathPointData.h"
#include "KoPathPoint.h"
#include "kritaflake_export.h"
/// The undo / redo command for path point moving.
class KRITAFLAKE_EXPORT KoPathControlPointMoveCommand : public KUndo2Command
{
public:
/**
* Command to move one control path point.
+ * @param pointData the data of the point to move
* @param offset the offset by which the point is moved in document coordinates
* @param pointType the type of the point to move
* @param parent the parent command used for macro commands
*/
KoPathControlPointMoveCommand(const KoPathPointData &pointData, const QPointF &offset,
KoPathPoint::PointType pointType, KUndo2Command *parent = 0);
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
KoPathPointData m_pointData;
// the offset in shape coordinates
QPointF m_offset;
KoPathPoint::PointType m_pointType;
};
#endif // KOPATHCONTROLPOINTMOVECOMMAND_H
diff --git a/libs/flake/commands/KoShapeGroupCommand.h b/libs/flake/commands/KoShapeGroupCommand.h
index 8d70cbc4e6..a18f8886a5 100644
--- a/libs/flake/commands/KoShapeGroupCommand.h
+++ b/libs/flake/commands/KoShapeGroupCommand.h
@@ -1,83 +1,80 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2010 Thomas Zander
* Copyright (C) 2007 Jan Hambrecht
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEGROUPCOMMAND_H
#define KOSHAPEGROUPCOMMAND_H
#include "kritaflake_export.h"
#include
#include
#include
class KoShape;
class KoShapeGroup;
class KoShapeContainer;
class KoShapeGroupCommandPrivate;
/// The undo / redo command for grouping shapes
class KRITAFLAKE_EXPORT KoShapeGroupCommand : public KUndo2Command
{
public:
/**
* Create command to group a set of shapes into a predefined container.
* This uses the KoShapeGroupCommand(KoShapeGroup *container, const QList &shapes, KUndo2Command *parent = 0);
* constructor.
* The createCommand will make sure that the group will have the z-index and the parent of the top most shape in the group.
*
* @param container the group to group the shapes under.
- * @param parent the parent command if the resulting command is a compound undo command.
* @param shapes a list of all the shapes that should be grouped.
+ * @param shouldNormalize whether the shapes should be normalized
*/
static KoShapeGroupCommand *createCommand(KoShapeContainer *container, const QList &shapes, bool shouldNormalize = false);
/**
* Command to group a set of shapes into a predefined container.
* @param container the container to group the shapes under.
* @param shapes a list of all the shapes that should be grouped.
- * @param clipped shows whether the shapes should be clipped by the container
- * See KoShapeContainer::isClipped()
- * @param inheritTransform shows whether the shapes should inherit the parent transformation
- * See KoShapeContainer::inheritsTransform()
+ * @param shouldNormalize shows whether the shapes should be normalized by the container
* @param parent the parent command used for macro commands
*/
KoShapeGroupCommand(KoShapeContainer *container, const QList &shapes, bool shouldNormalize, KUndo2Command *parent = 0);
/**
* Command to group a set of shapes into a predefined container.
* Convenience constructor since KoShapeGroup does not allow clipping.
* @param container the group to group the shapes under.
* @param parent the parent command if the resulting command is a compound undo command.
* @param shapes a list of all the shapes that should be grouped.
*/
KoShapeGroupCommand(KoShapeContainer *container, const QList &shapes, KUndo2Command *parent = 0);
~KoShapeGroupCommand() override;
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
protected:
const QScopedPointer d;
};
#endif
diff --git a/libs/flake/commands/KoShapeReorderCommand.h b/libs/flake/commands/KoShapeReorderCommand.h
index ac640a31f2..1643052096 100644
--- a/libs/flake/commands/KoShapeReorderCommand.h
+++ b/libs/flake/commands/KoShapeReorderCommand.h
@@ -1,130 +1,132 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEREORDERCOMMAND_H
#define KOSHAPEREORDERCOMMAND_H
#include "kritaflake_export.h"
#include
#include
#include
class KoShape;
class KoShapeManager;
class KoShapeReorderCommandPrivate;
/// This command allows you to change the zIndex of a number of shapes.
class KRITAFLAKE_EXPORT KoShapeReorderCommand : public KUndo2Command
{
public:
struct KRITAFLAKE_EXPORT IndexedShape : boost::less_than_comparable {
IndexedShape();
IndexedShape(KoShape *_shape);
bool operator<(const IndexedShape &rhs) const;
int zIndex = 0;
KoShape *shape = 0;
};
public:
/**
* Constructor.
* @param shapes the set of objects that are moved.
* @param newIndexes the new indexes for the shapes.
* this list naturally must have the same amount of items as the shapes set.
* @param parent the parent command used for macro commands
*/
KoShapeReorderCommand(const QList &shapes, QList &newIndexes, KUndo2Command *parent = 0);
KoShapeReorderCommand(const QList &shapes, KUndo2Command *parent = 0);
~KoShapeReorderCommand() override;
/// An enum for defining what kind of reordering to use.
enum MoveShapeType {
RaiseShape, ///< raise the selected shape to the level that it is above the shape that is on top of it.
LowerShape, ///< Lower the selected shape to the level that it is below the shape that is below it.
BringToFront, ///< Raise the selected shape to be on top of all shapes.
SendToBack ///< Lower the selected shape to be below all other shapes.
};
/**
* Create a new KoShapeReorderCommand by calculating the new indexes required to move the shapes
* according to the move parameter.
* @param shapes all the shapes that should be moved.
* @param manager the shapeManager that contains all the shapes that could have their indexes changed.
* @param move the moving type.
* @param parent the parent command for grouping purposes.
* @return command for reordering the shapes or 0 if no reordering happened
*/
static KoShapeReorderCommand *createCommand(const QList &shapes, KoShapeManager *manager,
MoveShapeType move, KUndo2Command *parent = 0);
/**
* @brief mergeInShape adjust zIndex of all the \p shapes and \p newShape to
* avoid collisions between \p shapes and \p newShape.
*
* Note1: \p newShape may or may not be contained in \p shapes, there
* is no difference.
* Note2: the collisions inside \p shapes are ignored. They are just
* adjusted to avoid collisions with \p newShape only
+ * @param shapes list of shapes
+ * @param newShape the new shape
* @param parent the parent command for grouping purposes.
* @return command for reordering the shapes or 0 if no reordering happened
*/
static KoShapeReorderCommand *mergeInShape(QList shapes, KoShape *newShape,
KUndo2Command *parent = 0);
/**
* Recalculates the attached z-indexes of \p shapes so that all indexes go
* strictly in ascending order and no shapes have repetitive indexes. The
* physical order of the shapes in the array is not changed, on the indexes
* in IndexedShape are corrected.
*/
static
QList
homogenizeZIndexes(QList shapes);
/**
* Convenience version of homogenizeZIndexes() that removes all the IndexedShape
* objects, which z-index didn't change during homogenization. In a result
* you get a list that can be passed to KoShapeReorderCommand directly.
*/
static
QList
homogenizeZIndexesLazy(QList shapes);
/**
* Put all the shapes in \p shapesAbove above the shapes in \p shapesBelow, adjusting their
* z-index values.
*/
static QList mergeDownShapes(QList shapesBelow, QList shapesAbove);
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
private:
KoShapeReorderCommandPrivate * const d;
};
KRITAFLAKE_EXPORT QDebug operator<<(QDebug dbg, const KoShapeReorderCommand::IndexedShape &indexedShape);
#endif
diff --git a/libs/flake/commands/KoShapeUngroupCommand.h b/libs/flake/commands/KoShapeUngroupCommand.h
index 098cbcd6b1..2dca24cf05 100644
--- a/libs/flake/commands/KoShapeUngroupCommand.h
+++ b/libs/flake/commands/KoShapeUngroupCommand.h
@@ -1,57 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander
* Copyright (C) 2006 Jan Hambrecht
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEUNGROUPCOMMAND_H
#define KOSHAPEUNGROUPCOMMAND_H
#include "kritaflake_export.h"
#include
#include
class KoShape;
class KoShapeGroup;
class KoShapeContainer;
/// The undo / redo command for ungrouping shapes
class KRITAFLAKE_EXPORT KoShapeUngroupCommand : public KUndo2Command
{
public:
/**
* Command to ungroup a set of shapes from one parent container.
* @param container the group to ungroup the shapes from.
* @param shapes a list of all the shapes that should be ungrouped.
+ * @param topLevelShapes a list of top level shapes.
* @param parent the parent command used for macro commands
*/
KoShapeUngroupCommand(KoShapeContainer *container, const QList &shapes,
const QList &topLevelShapes = QList(), KUndo2Command *parent = 0);
~KoShapeUngroupCommand();
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
private:
struct Private;
const QScopedPointer m_d;
};
#endif
diff --git a/libs/flake/svg/SvgUtil.h b/libs/flake/svg/SvgUtil.h
index 22493ca9c2..b72018261e 100644
--- a/libs/flake/svg/SvgUtil.h
+++ b/libs/flake/svg/SvgUtil.h
@@ -1,150 +1,150 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Jan Hambrecht
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGUTIL_H
#define SVGUTIL_H
#include "kritaflake_export.h"
#include
class QString;
class QTransform;
class QStringList;
class KoXmlWriter;
#include
class SvgGraphicsContext;
class KRITAFLAKE_EXPORT SvgUtil
{
public:
// remove later! pixels *are* user coordinates
static double fromUserSpace(double value);
static double toUserSpace(double value);
static double ptToPx(SvgGraphicsContext *gc, double value);
/// Converts given point from points to userspace units.
static QPointF toUserSpace(const QPointF &point);
/// Converts given rectangle from points to userspace units.
static QRectF toUserSpace(const QRectF &rect);
/// Converts given rectangle from points to userspace units.
static QSizeF toUserSpace(const QSizeF &size);
/**
* Parses the given string containing a percentage number.
- * @param s the input string containing the percentage
+ * @param value the input number containing the percentage
* @return the percentage number normalized to 0..100
*/
static QString toPercentage(qreal value);
/**
* Parses the given string containing a percentage number.
* @param s the input string containing the percentage
* @return the percentage number normalized to 0..1
*/
static double fromPercentage(QString s);
/**
* Converts position from objectBoundingBox units to userSpace units.
*/
static QPointF objectToUserSpace(const QPointF &position, const QRectF &objectBound);
/**
* Converts size from objectBoundingBox units to userSpace units.
*/
static QSizeF objectToUserSpace(const QSizeF &size, const QRectF &objectBound);
/**
* Converts position from userSpace units to objectBoundingBox units.
*/
static QPointF userSpaceToObject(const QPointF &position, const QRectF &objectBound);
/**
* Converts size from userSpace units to objectBoundingBox units.
*/
static QSizeF userSpaceToObject(const QSizeF &size, const QRectF &objectBound);
/// Converts specified transformation to a string
static QString transformToString(const QTransform &transform);
/// Writes a \p transform as an attribute \p name iff the transform is not empty
static void writeTransformAttributeLazy(const QString &name, const QTransform &transform, KoXmlWriter &shapeWriter);
/// Parses a viewbox attribute into an rectangle
static bool parseViewBox(SvgGraphicsContext *gc, const KoXmlElement &e, const QRectF &elementBounds, QRectF *_viewRect, QTransform *_viewTransform);
struct PreserveAspectRatioParser;
static void parseAspectRatio(const PreserveAspectRatioParser &p, const QRectF &elementBounds, const QRectF &viewRect, QTransform *_viewTransform);
/// Parses a length attribute
static qreal parseUnit(SvgGraphicsContext *gc, const QString &, bool horiz = false, bool vert = false, const QRectF &bbox = QRectF());
/// parses a length attribute in x-direction
static qreal parseUnitX(SvgGraphicsContext *gc, const QString &unit);
/// parses a length attribute in y-direction
static qreal parseUnitY(SvgGraphicsContext *gc, const QString &unit);
/// parses a length attribute in xy-direction
static qreal parseUnitXY(SvgGraphicsContext *gc, const QString &unit);
/// parses angle, result in *radians*!
static qreal parseUnitAngular(SvgGraphicsContext *gc, const QString &unit);
/// parses the number into parameter number
static const char * parseNumber(const char *ptr, qreal &number);
static qreal parseNumber(const QString &string);
static QString mapExtendedShapeTag(const QString &tagName, const KoXmlElement &element);
static QStringList simplifyList(const QString &str);
struct KRITAFLAKE_EXPORT PreserveAspectRatioParser
{
PreserveAspectRatioParser(const QString &str);
enum Alignment {
Min,
Middle,
Max
};
bool defer = false;
Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio;
Alignment xAlignment = Min;
Alignment yAlignment = Min;
QPointF rectAnchorPoint(const QRectF &rc) const;
QString toString() const;
private:
Alignment alignmentFromString(const QString &str) const;
QString alignmentToString(Alignment alignment) const;
static qreal alignedValue(qreal min, qreal max, Alignment alignment);
};
};
#endif // SVGUTIL_H
diff --git a/libs/flake/text/KoSvgTextChunkShape.h b/libs/flake/text/KoSvgTextChunkShape.h
index fd790df9a6..df6c966f72 100644
--- a/libs/flake/text/KoSvgTextChunkShape.h
+++ b/libs/flake/text/KoSvgTextChunkShape.h
@@ -1,174 +1,174 @@
/*
* Copyright (c) 2017 Dmitry Kazakov
*
* 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 KOSVGTEXTCHUNKSHAPE_H
#define KOSVGTEXTCHUNKSHAPE_H
#include "kritaflake_export.h"
#include
#include
class HtmlSavingContext;
class KoSvgTextProperties;
class KoSvgTextChunkShapePrivate;
class KoSvgTextChunkShapeLayoutInterface;
/**
* KoSvgTextChunkShape is an elementary block of SVG text object.
*
- * KoSvgTextChunkShape represents either a or element of SVG.
+ * KoSvgTextChunkShape represents either a \ or \ element of SVG.
* The chunk shape uses flake hierarchy to represent the DOM hierarchy of the
* supplied text. All the attributes of text blocks can be fetched using
* textProperties() method.
*
* KoSvgTextChunkShape uses special text properties object to overcome the
* flake's "property inheritance" limitation. Basically, flake doesn't support
* the inheritance of shape properties: every shape stores all the properties
* that were defined at the stage of loading/creation. KoSvgTextProperties is a
* wrapper that allows the user to compare the properties of the two shapes and
* return only the ones that are unique for a child shape. That allows us to
* generate a correct SVG/markup code that can be edited by the user easily.
*
* WARNING: beware the difference between "svg-text-chunk" and
* KoSvgTextChunkShape! The chunk shape is **not** a "text chunk" in SVG's
* definition. According to SVG, "text chunk" is a set of characters anchored to
* a specific absolute position on canvas. And KoSvgTextChunkShape is just one
- * or element. Obviously, one can contain multiple "text
- * chunks" and, vice versa, a "text chunk" can spread onto multiple 's.
+ * \ or \ element. Obviously, one \ can contain multiple "text
+ * chunks" and, vice versa, a "text chunk" can spread onto multiple \'s.
*/
class KRITAFLAKE_EXPORT KoSvgTextChunkShape : public KoShapeContainer, public SvgShape
{
public:
KoSvgTextChunkShape();
KoSvgTextChunkShape(const KoSvgTextChunkShape &rhs);
~KoSvgTextChunkShape() override;
KoShape* cloneShape() const override;
QSizeF size() const override;
void setSize(const QSizeF &size) override;
QRectF outlineRect() const override;
QPainterPath outline() const override;
void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
void saveOdf(KoShapeSavingContext &Context) const override;
bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &Context) override;
bool saveHtml(HtmlSavingContext &context);
/**
* Reset the text shape into initial state, removing all the child shapes.
* This method is used by text-updating code to upload the updated text
* into shape. The uploading code first calls resetTextShape() and then adds
* new children.
*/
virtual void resetTextShape();
bool saveSvg(SvgSavingContext &context) override;
bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context) override;
bool loadSvgTextNode(const KoXmlText &text, SvgLoadingContext &context);
/**
* Normalize the SVG character transformations
*
* In SVG x,y,dx,dy,rotate attributes are inherited from the parent shapes
* in a curious ways. We do not want to unwind the links on the fly, so we
* just parse and adjust them right when the loading completed. After
* normalizeCharTransformations() is finished, all the child shapes will
* have local transformations set according to the parent's lists.
*/
void normalizeCharTransformations();
/**
* Compress the inheritance of 'fill' and 'stroke'.
*
* The loading code makes no difference if the fill or stroke was inherited
* or not. That is not a problem for normal shapes, but it cannot work for
* text shapes. The text has different inheritance rules: if the parent
* text chunk has a gradient fill, its inheriting descendants will
* **smoothly continue** this gradient. They will not start a new gradient
* in their local coordinate system.
*
* Therefore, after loading, the loading code calls
* simplifyFillStrokeInheritance() which marks the coinciding strokes and
* fills so that the rendering code will be able to distinguish them in the
* future.
*
* Proper fill inheritance is also needed for the GUI. When the user
* changes the color of the parent text chunk, all the inheriting children
* should update its color automatically, without GUI recursively
* traversing the shapes.
*
*/
void simplifyFillStrokeInheritance();
/**
* SVG properties of the text chunk
* @return the properties object with fill and stroke included as a property
*/
KoSvgTextProperties textProperties() const;
/**
* Return the type of the chunk.
*
* The chunk can be either a "text chunk", that contains a text string
* itself, of an "intermediate chunk" that doesn't contain any text itself,
* but works as a group for a set of child chunks, which might be either
* text (leaf) or intermediate chunks. Such groups are needed to define a
- * common text style for a group of '' objects.
+ * common text style for a group of '\' objects.
*
* @return true if the chunk is a "text chunk" false if it is "intermediate chunk"
*/
bool isTextNode() const;
/**
* A special interface for KoSvgTextShape's layout code. Don't use it
* unless you are KoSvgTextShape.
*/
KoSvgTextChunkShapeLayoutInterface* layoutInterface();
/**
* WARNING: this propperty is available only if isRootTextNode() is true
*
* @return true if the shape should be edited in a rich-text editor
*/
bool isRichTextPreferred() const;
/**
* WARNING: this propperty is available only if isRootTextNode() is true
*
* Sets whether the shape should be edited in rich-text editor
*/
void setRichTextPreferred(bool value);
protected:
/**
* Show if the shape is a root of the text hierarchy. Always true for
* KoSvgTextShape and always false for KoSvgTextChunkShape
*/
virtual bool isRootTextNode() const;
protected:
KoSvgTextChunkShape(KoSvgTextChunkShapePrivate *dd);
private:
Q_DECLARE_PRIVATE(KoSvgTextChunkShape)
};
#endif // KOSVGTEXTCHUNKSHAPE_H
diff --git a/libs/flake/text/KoSvgTextProperties.h b/libs/flake/text/KoSvgTextProperties.h
index 071cef7668..b0c51f5870 100644
--- a/libs/flake/text/KoSvgTextProperties.h
+++ b/libs/flake/text/KoSvgTextProperties.h
@@ -1,192 +1,192 @@
/*
* Copyright (c) 2017 Dmitry Kazakov
*
* 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 KOSVGTEXTPROPERTIES_H
#define KOSVGTEXTPROPERTIES_H
#include "kritaflake_export.h"
#include
#include
#include
class SvgLoadingContext;
/**
* KoSvgTextProperties represents the text attributes defined in SVG DOM tree
*
* There is a limitation in flake: it doesn't support the inheritance of shape
* properties: every shape stores all the properties that were defined at the
* loading/creation stage. KoSvgTextProperties allows the user to compare
* the properties of the two shapes and distinguish, which properties were
* inherited by text shape, and which are its own. It is needed to generate a
* correct and clean SVG/markup code that can be edited by the user easily.
- * Otherwise, every block will contain the full list of 20+ attributes,
+ * Otherwise, every \ block will contain the full list of 20+ attributes,
* which are not interesting for the user, since they are inherited or default.
*
* To achieve the goal, KoSvgTextProperties wraps all the SVG attributes into a
* map of QVariants. When the user need to find a set of unique properties
* of the shape, it iterates through the map and compares values with standard
* QVariant-based comparison operator. If the property value in a child and a
* parent is not the same, then it is not inherited.
*/
class KRITAFLAKE_EXPORT KoSvgTextProperties
{
public:
/**
* Defines a set of supported properties. See SVG 1.1 for details.
*/
enum PropertyId {
WritingModeId,
DirectionId,
UnicodeBidiId,
TextAnchorId,
DominantBaselineId,
AlignmentBaselineId,
BaselineShiftModeId,
BaselineShiftValueId,
KerningId,
GlyphOrientationVerticalId,
GlyphOrientationHorizontalId,
LetterSpacingId,
WordSpacingId,
FontFamiliesId,
FontStyleId,
FontIsSmallCapsId,
FontStretchId,
FontWeightId,
FontSizeId,
FontSizeAdjustId,
TextDecorationId,
FillId,
StrokeId
};
public:
KoSvgTextProperties();
~KoSvgTextProperties();
KoSvgTextProperties(const KoSvgTextProperties &rhs);
KoSvgTextProperties& operator=(const KoSvgTextProperties &rhs);
/**
* Set the property \p id to \p value
*/
void setProperty(PropertyId id, const QVariant &value);
/**
* Check if property \p id is present in this properties set
*/
bool hasProperty(PropertyId id) const;
/**
* Return the value of property \p id. If the property doesn't exist in
* the shape, return \p defaultValue instead.
*/
QVariant property(PropertyId id, const QVariant &defaultValue = QVariant()) const;
/**
* Remove property \p id from the set
*/
void removeProperty(PropertyId id);
/**
* Return the value of property \p id. If the property doesn't exist in the
* shape, return the default value define in SVG 1.1.
*/
QVariant propertyOrDefault(PropertyId id) const;
/**
* Return a list of properties contained in this set
*/
QList properties() const;
/**
* Return true if the set contains no properties
*/
bool isEmpty() const;
/**
* Reset all non-inheritable properties to default values. The set of
* non-inheritable properties is define by SVG 1.1. Used by the loading
- * code for resetting state automata's properties on entering a .
+ * code for resetting state automata's properties on entering a \.
*/
void resetNonInheritableToDefault();
/**
* Apply properties from the parent shape. The property is set **iff** the
* property is inheritable according to SVG and this set does not define
* it.
*/
void inheritFrom(const KoSvgTextProperties &parentProperties);
/**
* Return true if the property \p id is inherited from \p parentProperties.
* The property is considered "inherited" **iff* it is inheritable
* according to SVG and the parent defined the same property with the same
* value.
*/
bool inheritsProperty(PropertyId id, const KoSvgTextProperties &parentProperties) const;
/**
* Return a set of properties that ar **not** inherited from \p
* parentProperties. The property is considered "inherited" **iff* it is
* inheritable according to SVG and the parent defined the same property
* with the same value.
*/
KoSvgTextProperties ownProperties(const KoSvgTextProperties &parentProperties) const;
/**
* @brief parseSvgTextAttribute add a property according to an XML attribute value.
* @param context shared loading context
* @param command XML attribute name
* @param value attribute value
*
* @see supportedXmlAttributes for a list of supported attributes
*/
void parseSvgTextAttribute(const SvgLoadingContext &context, const QString &command, const QString &value);
/**
* Convert all the properties of the set into a map of XML attribute/value
* pairs.
*/
QMap convertToSvgTextAttributes() const;
/**
* Return a list of supported XML attribute names (defined in SVG)
*/
static QStringList supportedXmlAttributes();
/**
* Return a static object that defines default values for all the supported
* properties according to SVG
*/
static const KoSvgTextProperties& defaultProperties();
private:
struct Private;
const QScopedPointer m_d;
};
#endif // KOSVGTEXTPROPERTIES_H
diff --git a/libs/flake/text/KoSvgTextShape.h b/libs/flake/text/KoSvgTextShape.h
index 6e63952012..8a24d8596a 100644
--- a/libs/flake/text/KoSvgTextShape.h
+++ b/libs/flake/text/KoSvgTextShape.h
@@ -1,94 +1,94 @@
/*
* Copyright (c) 2017 Dmitry Kazakov
*
* 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 KOSVGTEXTSHAPE_H
#define KOSVGTEXTSHAPE_H
#include "kritaflake_export.h"
#include
#include
#include
class KoSvgTextProperties;
class KoSvgTextShapePrivate;
#define KoSvgTextShape_SHAPEID "KoSvgTextShapeID"
/**
- * KoSvgTextShape is a root chunk of the element subtree.
+ * KoSvgTextShape is a root chunk of the \ element subtree.
*/
class KRITAFLAKE_EXPORT KoSvgTextShape : public KoSvgTextChunkShape
{
public:
KoSvgTextShape();
KoSvgTextShape(const KoSvgTextShape &rhs);
~KoSvgTextShape() override;
KoShape* cloneShape() const override;
void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
void paintStroke(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
/**
* Reset the text shape into initial shape, removing all the child shapes
* and precalculated layouts. This method is used by text-updating code to
* upload the updated text into shape. The upload code first calls
* resetTextShape() and then adds new children.
*/
void resetTextShape() override;
/**
* Create a new text layout for the current content of the text shape
* chunks tree. The user should always call relayout() after every change
* in the text shapes hierarchy.
*/
void relayout();
QPainterPath textOutline();
protected:
/**
* Show if the shape is a root of the text hierarchy. Always true for
* KoSvgTextShape and always false for KoSvgTextChunkShape
*/
bool isRootTextNode() const override;
void shapeChanged(ChangeType type, KoShape *shape) override;
private:
Q_DECLARE_PRIVATE(KoSvgTextShape)
};
class KoSvgTextShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
KoSvgTextShapeFactory();
~KoSvgTextShapeFactory() {}
KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const override;
/// Reimplemented
bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
};
#endif // KOSVGTEXTSHAPE_H
diff --git a/libs/flake/text/KoSvgTextShapeMarkupConverter.h b/libs/flake/text/KoSvgTextShapeMarkupConverter.h
index e7f455c22a..9b58ce2468 100644
--- a/libs/flake/text/KoSvgTextShapeMarkupConverter.h
+++ b/libs/flake/text/KoSvgTextShapeMarkupConverter.h
@@ -1,144 +1,144 @@
/*
* Copyright (c) 2017 Dmitry Kazakov
*
* 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 KOSVGTEXTSHAPEMARKUPCONVERTER_H
#define KOSVGTEXTSHAPEMARKUPCONVERTER_H
#include "kritaflake_export.h"
#include
#include
#include
#include
class QRectF;
class KoSvgTextShape;
/**
* KoSvgTextShapeMarkupConverter is a utility class for converting a
* KoSvgTextShape to/from user-editable markup/svg representation.
*
* Please note that the converted SVG is **not** the same as when saved into
* .kra! Some attributes are dropped to make the editing is easier for the
* user.
*/
class KRITAFLAKE_EXPORT KoSvgTextShapeMarkupConverter
{
public:
KoSvgTextShapeMarkupConverter(KoSvgTextShape *shape);
~KoSvgTextShapeMarkupConverter();
/**
* Convert the text shape into two strings: text and styles. Styles string
* is non-empty only when the text has some gradient/pattern attached. It is
* intended to be places into a separate tab in the GUI.
*
* @return true on success
*/
bool convertToSvg(QString *svgText, QString *stylesText);
/**
* @brief upload the svg representation of text into the shape
- * @param svgText part of SVG
- * @param stylesText part of SVG (used only for gradients and patterns)
+ * @param svgText \ part of SVG
+ * @param stylesText \ part of SVG (used only for gradients and patterns)
* @param boundsInPixels bounds of the entire image in pixel. Used for parsing percentage units.
* @param pixelsPerInch resolution of the image where we load the shape to
*
* @return true if the text was parsed successfully. Check `errors()` and `warnings()` for details.
*/
bool convertFromSvg(const QString &svgText, const QString &stylesText, const QRectF &boundsInPixels, qreal pixelsPerInch);
/**
* @brief convertToHtml convert the text in the text shape to html
* @param htmlText will be filled with correct html representing the text in the shape
- * @return true om success
+ * @return @c true on success
*/
bool convertToHtml(QString *htmlText);
/**
* @brief convertFromHtml converted Qt rich text html (and no other: http://doc.qt.io/qt-5/richtext-html-subset.html) to SVG
* @param htmlText the input html
* @param svgText the converted svg text element
* @param styles
- * @return true if the conversion was successful
+ * @return @c true if the conversion was successful
*/
bool convertFromHtml(const QString &htmlText, QString *svgText, QString *styles);
/**
* @brief convertDocumentToSvg
* @param doc the QTextDocument to convert.
* @param svgText the converted svg text element
- * @return true if the conversion was successful
+ * @return @c true if the conversion was successful
*/
bool convertDocumentToSvg(const QTextDocument *doc, QString *svgText);
/**
* @brief convertSvgToDocument
- * @param svgText the element and it's children as a string.
+ * @param svgText the \ element and it's children as a string.
* @param doc the QTextDocument that the conversion is written to.
- * @return true if the conversion was successful
+ * @return @c true if the conversion was successful
*/
bool convertSvgToDocument(const QString &svgText, QTextDocument *doc);
/**
* A list of errors happened during loading the user's text
*/
QStringList errors() const;
/**
* A list of warnings produced during loading the user's text
*/
QStringList warnings() const;
/**
* @brief style
* creates a style string based on the blockformat and the format.
* @param format the textCharFormat of the current text.
* @param blockFormat the block format of the current text.
* @param mostCommon the most common format to compare the format to.
* @return a string that can be written into a style element.
*/
QString style(QTextCharFormat format, QTextBlockFormat blockFormat, QTextCharFormat mostCommon = QTextCharFormat());
/**
* @brief stylesFromString
* returns a qvector with two textformats:
* at 0 is the QTextCharFormat
* at 1 is the QTextBlockFormat
* @param styles a style string split at ";"
* @param currentCharFormat the current charformat to compare against.
* @param currentBlockFormat the current blockformat to compare against.
* @return A QVector with at 0 a QTextCharFormat and at 1 a QBlockCharFormat.
*/
static QVector stylesFromString(QStringList styles, QTextCharFormat currentCharFormat, QTextBlockFormat currentBlockFormat);
/**
* @brief formatDifference
* A class to get the difference between two text-char formats.
* @param test the format to test
* @param reference the format to test against.
* @return the difference between the two.
*/
QTextFormat formatDifference(QTextFormat test, QTextFormat reference);
private:
struct Private;
const QScopedPointer d;
};
#endif // KOSVGTEXTSHAPEMARKUPCONVERTER_H
diff --git a/libs/image/brushengine/kis_paintop_factory.h b/libs/image/brushengine/kis_paintop_factory.h
index 27a9c91628..c6129638a8 100644
--- a/libs/image/brushengine/kis_paintop_factory.h
+++ b/libs/image/brushengine/kis_paintop_factory.h
@@ -1,116 +1,118 @@
/*
* Copyright (c) 2008 Boudewijn Rempt
* Copyright (c) 2010 Lukáš Tvrdý
* 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_PAINTOP_FACTORY_H_
#define KIS_PAINTOP_FACTORY_H_
#include "kis_types.h"
#include "kritaimage_export.h"
#include
#include
#include
#include
#include
class KisPainter;
class KisPaintOp;
class QWidget;
class KisPaintOpConfigWidget;
/**
* The paintop factory is responsible for creating paintops of the specified class.
* If there is an optionWidget, the derived paintop itself must support settings,
* and it's up to the factory to do that.
*/
class KRITAIMAGE_EXPORT KisPaintOpFactory : public QObject
{
Q_OBJECT
public:
enum PaintopVisibility {
AUTO,
ALWAYS,
NEVER
};
/**
* @param whiteListedCompositeOps list of compositeops that don't work with this paintop
*/
KisPaintOpFactory(const QStringList & whiteListedCompositeOps = QStringList());
~KisPaintOpFactory() override {}
static QString categoryStable();
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
virtual void preinitializePaintOpIfNeeded(const KisPaintOpSettingsSP settings);
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
/**
* Create a KisPaintOp with the given settings and painter.
* @param settings the settings associated with the input device
* @param painter the painter used to draw
+ * @param node the node used to draw
+ * @param image the image used to draw
*/
virtual KisPaintOp * createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) = 0;
virtual QString id() const = 0;
virtual QString name() const = 0;
virtual QString category() const = 0;
/**
* List of usually hidden compositeops that are useful for this paintop.
*/
QStringList whiteListedCompositeOps() const;
/**
* @brief icon
* @return the icon to represent this paintop.
*/
virtual QIcon icon();
/**
* Create and return an settings object for this paintop.
*/
virtual KisPaintOpSettingsSP createSettings() = 0;
/**
* create a widget that can display paintop settings
*/
virtual KisPaintOpConfigWidget* createConfigWidget(QWidget* parent) = 0;
/**
* Set the priority of this paintop, as it is shown in the UI; lower number means
* it will be show more to the front of the list.
* @param newPriority the priority
*/
void setPriority(int newPriority);
int priority() const;
/**
* This method will be called by the registry after all paintops are loaded
* Overwrite to let the factory do something.
*/
virtual void processAfterLoading() {}
private:
QStringList m_whiteListedCompositeOps;
int m_priority;
PaintopVisibility m_visibility;
};
#endif
diff --git a/libs/image/commands/kis_image_command.h b/libs/image/commands/kis_image_command.h
index 0c8b0c04f1..e5f3779449 100644
--- a/libs/image/commands/kis_image_command.h
+++ b/libs/image/commands/kis_image_command.h
@@ -1,71 +1,72 @@
/*
* Copyright (c) 2002 Patrick Julien
* Copyright (c) 2007 Sven Langkamp
*
* 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_IMAGE_COMMAND_H_
#define KIS_IMAGE_COMMAND_H_
#include
#include
#include
#include
#include "kis_types.h"
#include "kis_paint_device.h"
/// the base command for commands altering a KisImage
class KRITAIMAGE_EXPORT KisImageCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param name The name that will be shown in the ui
* @param image The image the command will be working on.
+ * @param parent The parent command.
*/
KisImageCommand(const KUndo2MagicString& name, KisImageWSP image, KUndo2Command *parent = 0);
~KisImageCommand() override;
protected:
/**
* Used for performing the smallest update
* after a node has been removed from stack.
* First tries to setDirty() node's siblings.
* If it doesn't help, performs full refresh.
*/
class UpdateTarget
{
public:
UpdateTarget(KisImageWSP image, KisNodeSP removedNode, const QRect &updateRect);
void update();
private:
KisImageWSP m_image;
QRect m_updateRect;
int m_removedNodeIndex;
KisNodeSP m_removedNodeParent;
};
protected:
KisImageWSP m_image;
};
#endif // KIS_IMAGE_COMMAND_H_
diff --git a/libs/image/commands/kis_image_layer_add_command.h b/libs/image/commands/kis_image_layer_add_command.h
index aff0848dac..6444c33e8c 100644
--- a/libs/image/commands/kis_image_layer_add_command.h
+++ b/libs/image/commands/kis_image_layer_add_command.h
@@ -1,53 +1,57 @@
/*
* Copyright (c) 2002 Patrick Julien
* Copyright (c) 2007 Sven Langkamp
*
* 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_IMAGE_LAYER_ADD_COMMAND_H_
#define KIS_IMAGE_LAYER_ADD_COMMAND_H_
#include
#include "kis_types.h"
#include "kis_image_command.h"
/// The command for adding a layer
class KRITAIMAGE_EXPORT KisImageLayerAddCommand : public KisImageCommand
{
public:
/**
* Constructor
* @param image The image the command will be working on.
- * @param layer the layer to add
+ * @param layer The layer to add
+ * @param parent The parent node
+ * @param aboveThis The node above this
+ * @param doRedoUpdates Whether to make the redo updates
+ * @param doUndoUpdates Whether to make the undo updates
*/
KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis, bool doRedoUpdates = true, bool doUndoUpdates = true);
KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index, bool doRedoUpdates = true, bool doUndoUpdates = true);
void redo() override;
void undo() override;
private:
KisNodeSP m_layer;
KisNodeSP m_parent;
KisNodeSP m_aboveThis;
quint32 m_index;
bool m_doRedoUpdates;
bool m_doUndoUpdates;
};
#endif
diff --git a/libs/image/commands/kis_image_layer_move_command.h b/libs/image/commands/kis_image_layer_move_command.h
index 4b98dd98e7..d89e572bd3 100644
--- a/libs/image/commands/kis_image_layer_move_command.h
+++ b/libs/image/commands/kis_image_layer_move_command.h
@@ -1,62 +1,63 @@
/*
* Copyright (c) 2002 Patrick Julien
* Copyright (c) 2007 Sven Langkamp
*
* 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_IMAGE_LAYER_MOVE_COMMAND_H_
#define KIS_IMAGE_LAYER_MOVE_COMMAND_H_
#include
#include
#include
#include "kis_types.h"
#include "kis_image_command.h"
/// The command for layer moves inside the layer stack
class KRITAIMAGE_EXPORT KisImageLayerMoveCommand : public KisImageCommand
{
public:
/**
* Command for layer moves inside the layer stack
*
* @param image the image
- * @param layer the moved layer
+ * @param node the moved node
* @param newParent the next parent of the layer
* @param newAbove the layer that will be below the layer after the move
+ * @param doUpdates whether to do updates
*/
KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, KisNodeSP newAbove, bool doUpdates = true);
KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, quint32 index);
void redo() override;
void undo() override;
private:
KisNodeSP m_layer;
KisNodeSP m_prevParent;
KisNodeSP m_prevAbove;
KisNodeSP m_newParent;
KisNodeSP m_newAbove;
quint32 m_index;
bool m_useIndex;
bool m_doUpdates;
};
#endif
diff --git a/libs/image/filter/kis_color_transformation_filter.h b/libs/image/filter/kis_color_transformation_filter.h
index 52b8eacbbb..d495c004cd 100644
--- a/libs/image/filter/kis_color_transformation_filter.h
+++ b/libs/image/filter/kis_color_transformation_filter.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2009 Cyrille Berger
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_TRANSFORMATION_FILTER_H_
#define _KIS_COLOR_TRANSFORMATION_FILTER_H_
#include "kis_filter.h"
#include "kritaimage_export.h"
/**
* This is a base class for filters that implement a filter for
- * \ref KoColorTransformation based filters.
+ * KoColorTransformationFactory based filters.
*/
class KRITAIMAGE_EXPORT KisColorTransformationFilter : public KisFilter
{
public:
KisColorTransformationFilter(const KoID& id, const KoID & category, const QString & entry);
~KisColorTransformationFilter() override;
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
) const override;
/**
* Create the color transformation that will be applied on the device.
*/
virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const = 0;
KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/libs/image/filter/kis_filter.h b/libs/image/filter/kis_filter.h
index 10a6964064..3e8ed01dd6 100644
--- a/libs/image/filter/kis_filter.h
+++ b/libs/image/filter/kis_filter.h
@@ -1,126 +1,126 @@
/*
* Copyright (c) 2004,2006-2007 Cyrille Berger
*
* 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_FILTER_H_
#define _KIS_FILTER_H_
#include
#include
#include
#include "KoID.h"
#include "KoColorSpace.h"
#include "kis_types.h"
#include "kis_base_processor.h"
#include "kritaimage_export.h"
/**
* Basic interface of a Krita filter.
*/
class KRITAIMAGE_EXPORT KisFilter : public KisBaseProcessor
{
public:
/**
* Construct a Krita filter
*/
KisFilter(const KoID& id, const KoID & category, const QString & entry);
~KisFilter() override;
/**
* Override this function with the implementation of your filter.
*
* This is a low level function that expects all the conditions
* for the @param device be met. Use usual process() methods
* instead.
*
* @param device the paint device to filter
* @param applyRect the rectangle where the filter is applied
* @param config the parameters of the filter
* @param progressUpdater to pass on the progress the filter is making
*/
virtual void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater = 0 ) const = 0;
/**
* Filter \p src device and write the result into \p dst device.
* If \p dst is an alpha color space device, it will get special
* treatment.
*
* @param src the source paint device
* @param dst the destination paint device
* @param selection the selection
* @param applyRect the rectangle where the filter is applied
* @param config the parameters of the filter
* @param progressUpdater to pass on the progress the filter is making
*/
void process(const KisPaintDeviceSP src,
KisPaintDeviceSP dst,
KisSelectionSP selection,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater = 0 ) const;
/**
* A convenience method for a two-device process() function
*/
void process(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater = 0 ) const;
/**
* Some filters need pixels outside the current processing rect to compute the new
* value (for instance, convolution filters)
*/
virtual QRect neededRect(const QRect & rect, const KisFilterConfigurationSP config, int lod) const;
/**
- * Similar to \ref neededRect: some filters will alter a lot of pixels that are
+ * Similar to @ref neededRect : some filters will alter a lot of pixels that are
* near to each other at the same time. So when you changed a single rectangle
* in a device, the actual rectangle that will feel the influence of this change
* might be bigger. Use this function to determine that rect.
*/
virtual QRect changedRect(const QRect & rect, const KisFilterConfigurationSP config, int lod) const;
/**
* Returns true if the filter is capable of handling LoD scaled planes
* when generating preview.
*/
virtual bool supportsLevelOfDetail(const KisFilterConfigurationSP config, int lod) const;
virtual bool needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const;
protected:
QString configEntryGroup() const;
void setSupportsLevelOfDetail(bool value);
private:
bool m_supportsLevelOfDetail;
};
#endif
diff --git a/libs/image/generator/kis_generator.h b/libs/image/generator/kis_generator.h
index 55c393abf5..7beda85a76 100644
--- a/libs/image/generator/kis_generator.h
+++ b/libs/image/generator/kis_generator.h
@@ -1,91 +1,92 @@
/*
* Copyright (c) 2008 Boudewijn Rempt
*
* 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_GENERATOR_H_
#define _KIS_GENERATOR_H_
#include
#include
#include "KoID.h"
#include "KoColorSpace.h"
#include "kis_types.h"
#include "kis_base_processor.h"
#include "kritaimage_export.h"
class KisProcessingInformation;
/**
* Basic interface of a Krita generator: a generator is a program
* that can fill a paint device with a color. A generator can have a
* preferred colorspace.
*
* Generators can have initial parameter settings that determine the
* way a particular generator works, but also state that allows the generator
* to continue from one invocation of generate to another (handy for, e.g.,
* painting)
*/
class KRITAIMAGE_EXPORT KisGenerator : public KisBaseProcessor
{
friend class KisGeneratorConfigurationFactory;
public:
KisGenerator(const KoID& id, const KoID & category, const QString & entry);
~KisGenerator() override;
public:
/**
* Override this function with the implementation of your generator.
*
* @param dst the destination paint device
* @param size the size of the area that is to be filled
* @param config the parameters of the filter
+ * @param progressUpdater the progress updater
*/
virtual void generate(KisProcessingInformation dst,
const QSize& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
) const = 0;
/**
* Provided for convenience when no progress reporting is needed.
*/
virtual void generate(KisProcessingInformation dst,
const QSize& size,
const KisFilterConfigurationSP config
) const;
/**
* @param _imageArea the rectangle of the image
* @return the rectangle that is affected by this generator, if the generator
* is supposed to affect all pixels, then the function should return
* @p _imageArea
*/
virtual QRect generatedRect(QRect _imageArea, const KisFilterConfigurationSP = 0) const;
protected:
/// @return the name of config group in KConfig
QString configEntryGroup() const;
};
#endif
diff --git a/libs/image/kis_adjustment_layer.h b/libs/image/kis_adjustment_layer.h
index 10c2dd64ab..447f0cf422 100644
--- a/libs/image/kis_adjustment_layer.h
+++ b/libs/image/kis_adjustment_layer.h
@@ -1,123 +1,125 @@
/*
* Copyright (c) 2006 Boudewijn Rempt
*
* 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.
*/
/**
- * @file
+ * @file kis_adjustment_layer.h
* This file is part of the Krita calligra application. It handles
* a contains a KisFilter OR a KisLayer, and this class is created
* to influence the rendering of layers below this one. Can also
* function as a fixating layer.
*
* @author Boudewijn Rempt
* @author comments by hscott
* @since 1.5
*/
#ifndef KIS_ADJUSTMENT_LAYER_H_
#define KIS_ADJUSTMENT_LAYER_H_
#include
#include
#include "kis_selection_based_layer.h"
class KisFilterConfiguration;
/**
- * @class KisAdjustmentLayer Contains a KisFilter and a KisSelection.
+ * @class KisAdjustmentLayer
+ * @brief Contains a KisFilter and a KisSelection.
+ *
* If the selection is present, it is a mask used by the adjustment layer
* to know where to apply the filter, thus the combination is used
* to influence the rendering of the layers under this layer
* in the layerstack. AdjustmentLayers also function as a kind
* of "fixating layers".
*/
class KRITAIMAGE_EXPORT KisAdjustmentLayer : public KisSelectionBasedLayer
{
Q_OBJECT
public:
/**
* creates a new adjustment layer with the given
* configuration and selection. Note that the selection
* will be _copied_ (with COW, though).
* @param image the image to set this AdjustmentLayer to
* @param name name of the adjustment layer
* @param kfc the configuration for the adjustment layer filter
* @param selection is a mask used by the adjustment layer to
* know where to apply the filter.
*/
KisAdjustmentLayer(KisImageWSP image, const QString &name, KisFilterConfigurationSP kfc, KisSelectionSP selection);
KisAdjustmentLayer(const KisAdjustmentLayer& rhs);
~KisAdjustmentLayer() override;
bool accept(KisNodeVisitor &) override;
void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
/**
* clones this AdjustmentLayer into a KisNodeSP type.
* @return the KisNodeSP returned
*/
KisNodeSP clone() const override {
return KisNodeSP(new KisAdjustmentLayer(*this));
}
/**
* gets the adjustmentLayer's tool filter
* @return QIcon returns the QIcon tool filter
*/
QIcon icon() const override;
/**
* gets the AdjustmentLayer properties describing whether
* or not the node is locked, visible, and the filter
* name is it is a filter. Overrides sectionModelProperties
* in KisLayer, and KisLayer overrides
* sectionModelProperties in KisBaseNode.
* @return KisBaseNode::PropertyList returns a list
* of the properties
*/
KisBaseNode::PropertyList sectionModelProperties() const override;
public:
/**
* \see KisNodeFilterInterface::setFilter()
*/
void setFilter(KisFilterConfigurationSP filterConfig) override;
void setChannelFlags(const QBitArray & channelFlags) override;
protected:
// override from KisLayer
QRect incomingChangeRect(const QRect &rect) const override;
// override from KisNode
QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
public Q_SLOTS:
/**
* gets this AdjustmentLayer. Overrides function in
* KisIndirectPaintingSupport
* @return this AdjustmentLayer
*/
KisLayer* layer() {
return this;
}
};
#endif // KIS_ADJUSTMENT_LAYER_H_
diff --git a/libs/image/kis_annotation.h b/libs/image/kis_annotation.h
index e106124211..b091236190 100644
--- a/libs/image/kis_annotation.h
+++ b/libs/image/kis_annotation.h
@@ -1,126 +1,128 @@
/*
* This file is part of the KDE project
*
* Copyright (c) 2005 Boudewijn Rempt
*
* 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.
*/
/**
- * @file this file is part of the Krita application in calligra
+ * @file kis_annotation.h
+ * @brief This file is part of the Krita application in calligra
* @author Boudewijn Rempt
* @author comments by hscott
* @since 1.4 or 2005
*/
#ifndef _KIS_ANNOTATION_H_
#define _KIS_ANNOTATION_H_
#include
#include
#include
/**
- * @class KisAnnotation A data extension mechanism for Krita.
+ * @class KisAnnotation
+ * @brief A data extension mechanism for Krita.
*
* An annotation can be of something like a QByteArray or a QString or
* a more specific datatype that can be attached to an image (or maybe
* later, if needed, to a layer) and contains data that must be
* associated with an image for purposes of import/export.
*
* Annotations will be saved to krita images and may be exported in
* filetypes that support them.
*
* Examples of annotations are EXIF data and ICC profiles.
*/
class KisAnnotation : public KisShared
{
public:
/**
* creates a new annotation object. The annotation object cannot
* be changed later.
*
* @param type a non-localized string identifying the type of the
* annotation
* @param description a localized string describing the annotation
* @param data a binary blob containing the annotation data
*/
KisAnnotation(const QString & type, const QString & description, const QByteArray & data)
: m_type(type),
m_description(description),
m_annotation(data) {}
virtual ~KisAnnotation() {}
virtual KisAnnotation* clone() const {
return new KisAnnotation(*this);
}
/**
* gets a non-localized string identifying the type of the
* annotation.
* @return a non-localized string identifiying the type of the
* annotation
*/
const QString & type() const {
return m_type;
}
/**
* gets a localized string describing the type of annotations for
* used interface purposes.
* @return a localized string describing the type of the
* annotations for user interface purposes.
*/
const QString & description() const {
return m_description;
}
/**
* gets a binary blob representation of this annotation
* @return a binary blob representation of this annotation
*/
const QByteArray & annotation() const {
return m_annotation;
}
/**
* @brief displayText: override this to return an interpreted version of the annotation
*/
virtual QString displayText() const {
return QString::fromUtf8(m_annotation);
}
protected:
KisAnnotation(const KisAnnotation &rhs)
: KisShared(),
m_type(rhs.m_type),
m_description(rhs.m_description),
m_annotation(rhs.m_annotation)
{
}
protected:
QString m_type;
QString m_description;
QByteArray m_annotation;
};
#endif // _KIS_ANNOTATION_H_
diff --git a/libs/image/kis_base_mask_generator.h b/libs/image/kis_base_mask_generator.h
index 8df0dfe275..c79aca2d42 100644
--- a/libs/image/kis_base_mask_generator.h
+++ b/libs/image/kis_base_mask_generator.h
@@ -1,130 +1,134 @@
/*
* Copyright (c) 2008-2009 Cyrille Berger
* Copyright (c) 2010 Lukáš Tvrdý
*
* 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_MASK_GENERATOR_H_
#define _KIS_MASK_GENERATOR_H_
#include