|
Krita Source Code Documentation
|
This command allows you to change the zIndex of a number of shapes. More...
#include <KoShapeReorderCommand.h>
Inheritance diagram for KoShapeReorderCommand:Classes | |
| struct | IndexedShape |
Public Types | |
| enum | MoveShapeType { RaiseShape , LowerShape , BringToFront , SendToBack } |
| An enum for defining what kind of reordering to use. More... | |
Public Member Functions | |
| KoShapeReorderCommand (const QList< IndexedShape > &shapes, KUndo2Command *parent=0) | |
| KoShapeReorderCommand (const QList< KoShape * > &shapes, QList< int > &newIndexes, KUndo2Command *parent=0) | |
| void | redo () override |
| redo the command | |
| void | undo () override |
| revert the actions done in redo | |
| ~KoShapeReorderCommand () override | |
Public Member Functions inherited from KUndo2Command | |
| QString | actionText () const |
| virtual bool | canAnnihilateWith (const KUndo2Command *other) const |
| const KUndo2Command * | child (int index) const |
| int | childCount () const |
| virtual QTime | endTime () const |
| KUndo2CommandExtraData * | extraData () const |
| bool | hasParent () const |
| virtual int | id () const |
| virtual bool | isMerged () const |
| KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0) | |
| KUndo2Command (KUndo2Command *parent=0) | |
| virtual QVector< KUndo2Command * > | mergeCommandsVector () const |
| virtual bool | mergeWith (const KUndo2Command *other) |
| virtual void | redoMergedCommands () |
| void | setEndTime () |
| virtual void | setEndTime (const QTime &time) |
| void | setExtraData (KUndo2CommandExtraData *data) |
| void | setText (const KUndo2MagicString &text) |
| void | setTime () |
| virtual void | setTime (const QTime &time) |
| virtual void | setTimedID (int timedID) |
| KUndo2MagicString | text () const |
| virtual QTime | time () const |
| virtual int | timedId () const |
| virtual bool | timedMergeWith (KUndo2Command *other) |
| virtual void | undoMergedCommands () |
| virtual | ~KUndo2Command () |
Static Public Member Functions | |
| static KoShapeReorderCommand * | createCommand (const QList< KoShape * > &shapes, KoShapeManager *manager, MoveShapeType move, KUndo2Command *parent=0) |
| static QList< KoShapeReorderCommand::IndexedShape > | homogenizeZIndexes (QList< IndexedShape > shapes) |
| static QList< KoShapeReorderCommand::IndexedShape > | homogenizeZIndexesLazy (QList< IndexedShape > shapes) |
| static QList< IndexedShape > | mergeDownShapes (QList< KoShape * > shapesBelow, QList< KoShape * > shapesAbove) |
| static KoShapeReorderCommand * | mergeInShape (QList< KoShape * > shapes, KoShape *newShape, KUndo2Command *parent=0) |
mergeInShape adjust zIndex of all the shapes and newShape to avoid collisions between shapes and newShape. | |
Private Attributes | |
| KoShapeReorderCommandPrivate *const | d |
This command allows you to change the zIndex of a number of shapes.
Definition at line 21 of file KoShapeReorderCommand.h.
An enum for defining what kind of reordering to use.
Definition at line 48 of file KoShapeReorderCommand.h.
| KoShapeReorderCommand::KoShapeReorderCommand | ( | const QList< KoShape * > & | shapes, |
| QList< int > & | newIndexes, | ||
| KUndo2Command * | parent = 0 ) |
Constructor.
| shapes | the set of objects that are moved. |
| newIndexes | the new indexes for the shapes. this list naturally must have the same amount of items as the shapes set. |
| parent | the parent command used for macro commands |
Definition at line 45 of file KoShapeReorderCommand.cpp.
References d, kundo2_i18n(), KoShapeReorderCommandPrivate::previousIndexes, KUndo2Command::setText(), and KoShape::zIndex().
| KoShapeReorderCommand::KoShapeReorderCommand | ( | const QList< IndexedShape > & | shapes, |
| KUndo2Command * | parent = 0 ) |
Definition at line 56 of file KoShapeReorderCommand.cpp.
References d, kundo2_i18n(), KoShapeReorderCommandPrivate::newIndexes, KoShapeReorderCommandPrivate::previousIndexes, KUndo2Command::setText(), KoShapeReorderCommand::IndexedShape::shape, KoShapeReorderCommandPrivate::shapes, KoShapeReorderCommand::IndexedShape::zIndex, and KoShape::zIndex().
|
override |
|
static |
Create a new KoShapeReorderCommand by calculating the new indexes required to move the shapes according to the move parameter.
| shapes | all the shapes that should be moved. |
| manager | the shapeManager that contains all the shapes that could have their indexes changed. |
| move | the moving type. |
| parent | the parent command for grouping purposes. |
TODO: this method doesn't handle the case when one of the shapes has maximum or minimum zIndex value (which is 16-bit in our case)!
Definition at line 142 of file KoShapeReorderCommand.cpp.
References BringToFront, KoShape::compareShapeZIndex(), KoShapeReorderCommand(), LowerShape, KoShape::maxZIndex, and prepare().
|
static |
Recalculates the attached z-indexes of 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.
Definition at line 243 of file KoShapeReorderCommand.cpp.
|
static |
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.
Definition at line 283 of file KoShapeReorderCommand.cpp.
References homogenizeZIndexes().
|
static |
Put all the shapes in shapesAbove above the shapes in shapesBelow, adjusting their z-index values.
Definition at line 299 of file KoShapeReorderCommand.cpp.
References KoShape::compareShapeZIndex(), and homogenizeZIndexesLazy().
|
static |
mergeInShape adjust zIndex of all the shapes and newShape to avoid collisions between shapes and newShape.
Note1: newShape may or may not be contained in shapes, there is no difference. Note2: the collisions inside shapes are ignored. They are just adjusted to avoid collisions with newShape only
| shapes | list of shapes |
| newShape | the new shape |
| parent | the parent command for grouping purposes. |
Definition at line 204 of file KoShapeReorderCommand.cpp.
References KoShape::compareShapeZIndex(), KoShapeReorderCommand(), and KoShape::zIndex().
|
overridevirtual |
redo the command
Reimplemented from KUndo2Command.
Definition at line 74 of file KoShapeReorderCommand.cpp.
References d, KoShapeReorderCommandPrivate::newIndexes, KUndo2Command::redo(), and KoShapeReorderCommandPrivate::shapes.
|
overridevirtual |
revert the actions done in redo
Reimplemented from KUndo2Command.
Definition at line 85 of file KoShapeReorderCommand.cpp.
References d, KoShapeReorderCommandPrivate::previousIndexes, KoShapeReorderCommandPrivate::shapes, and KUndo2Command::undo().
|
private |
Definition at line 114 of file KoShapeReorderCommand.h.