Changeset View
Changeset View
Standalone View
Standalone View
plugins/flake/artistictextshape/MoveStartOffsetStrategy.h
Show All 28 Lines | |||||
29 | 29 | | |||
30 | /// A strategy to change the offset of a text when put on a path | 30 | /// A strategy to change the offset of a text when put on a path | ||
31 | class MoveStartOffsetStrategy : public KoInteractionStrategy | 31 | class MoveStartOffsetStrategy : public KoInteractionStrategy | ||
32 | { | 32 | { | ||
33 | public: | 33 | public: | ||
34 | MoveStartOffsetStrategy(KoToolBase *tool, ArtisticTextShape *text); | 34 | MoveStartOffsetStrategy(KoToolBase *tool, ArtisticTextShape *text); | ||
35 | ~MoveStartOffsetStrategy() override; | 35 | ~MoveStartOffsetStrategy() override; | ||
36 | 36 | | |||
37 | // reimplemnted from KoInteractionStrategy | 37 | // reimplemented from KoInteractionStrategy | ||
38 | void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override; | 38 | void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override; | ||
39 | // reimplemnted from KoInteractionStrategy | 39 | // reimplemented from KoInteractionStrategy | ||
40 | KUndo2Command *createCommand() override; | 40 | KUndo2Command *createCommand() override; | ||
41 | // reimplemnted from KoInteractionStrategy | 41 | // reimplemented from KoInteractionStrategy | ||
42 | void finishInteraction(Qt::KeyboardModifiers modifiers) override; | 42 | void finishInteraction(Qt::KeyboardModifiers modifiers) override; | ||
43 | private: | 43 | private: | ||
44 | ArtisticTextShape *m_text; ///< the text shape we are working on | 44 | ArtisticTextShape *m_text; ///< the text shape we are working on | ||
45 | KoPathShape *m_baselineShape; ///< path shape the text is put on | 45 | KoPathShape *m_baselineShape; ///< path shape the text is put on | ||
46 | qreal m_oldStartOffset; ///< the initial start offset | 46 | qreal m_oldStartOffset; ///< the initial start offset | ||
47 | QList<qreal> m_segmentLengths; ///< cached lengths of baseline path segments | 47 | QList<qreal> m_segmentLengths; ///< cached lengths of baseline path segments | ||
48 | qreal m_totalLength; ///< total length of baseline path | 48 | qreal m_totalLength; ///< total length of baseline path | ||
49 | }; | 49 | }; | ||
50 | 50 | | |||
51 | #endif // MOVESTARTOFFSETSTRATEGY_H | 51 | #endif // MOVESTARTOFFSETSTRATEGY_H |