2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef VECTORSELECTIONTOOL_H
|
|
|
|
#define VECTORSELECTIONTOOL_H
|
|
|
|
|
|
|
|
#include "selectiontool.h"
|
|
|
|
|
|
|
|
// TnzTools includes
|
|
|
|
#include "tools/strokeselection.h"
|
|
|
|
#include "tools/levelselection.h"
|
2019-12-25 17:04:57 +13:00
|
|
|
#include "tools/cursors.h"
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tstroke.h"
|
|
|
|
#include "tregion.h"
|
|
|
|
|
|
|
|
// Qt includes
|
|
|
|
#include <QSet>
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
// Forward declarations
|
|
|
|
|
|
|
|
class VectorSelectionTool;
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// Constants / Defines
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
enum SelectionTarget //! Possible selection targets in a SelectionTool.
|
|
|
|
{ NORMAL_TYPE_IDX, //!< Normal selection (strokes at current frame).
|
|
|
|
SELECTED_FRAMES_TYPE_IDX, //!< Selection of whole frames.
|
|
|
|
ALL_LEVEL_TYPE_IDX, //!< Selection of an entire level.
|
|
|
|
SAME_STYLE_TYPE_IDX, //!< Selected styles at current frame.
|
|
|
|
STYLE_SELECTED_FRAMES_TYPE_IDX, //!< Selected styles at selected frames.
|
|
|
|
STYLE_LEVEL_TYPE_IDX, //!< Selected styles at current frame on the whole
|
2016-06-20 14:23:05 +12:00
|
|
|
//! level.
|
2016-06-15 18:43:10 +12:00
|
|
|
BOUNDARY_TYPE_IDX, //!< Boundary strokes on current frame.
|
|
|
|
BOUNDARY_SELECTED_FRAMES_TYPE_IDX, //!< Boundary strokes on selected frames.
|
|
|
|
BOUNDARY_LEVEL_TYPE_IDX, //!< Boundary strokes on the whole level.
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NORMAL_TYPE L"Standard"
|
|
|
|
#define SELECTED_FRAMES_TYPE L"Selected Frames"
|
|
|
|
#define ALL_LEVEL_TYPE L"Whole Level"
|
|
|
|
#define SAME_STYLE_TYPE L"Same Style"
|
|
|
|
#define STYLE_SELECTED_FRAMES_TYPE L"Same Style on Selected Frames"
|
|
|
|
#define STYLE_LEVEL_TYPE L"Same Style on Whole Level"
|
|
|
|
#define BOUNDARY_TYPE L"Boundary Strokes"
|
|
|
|
#define BOUNDARY_SELECTED_FRAMES_TYPE L"Boundaries on Selected Frames"
|
|
|
|
#define BOUNDARY_LEVEL_TYPE L"Boundaries on Whole Level"
|
|
|
|
|
|
|
|
#define ROUNDC_WSTR L"round_cap"
|
|
|
|
#define BUTT_WSTR L"butt_cap"
|
|
|
|
#define PROJECTING_WSTR L"projecting_cap"
|
|
|
|
#define ROUNDJ_WSTR L"round_join"
|
|
|
|
#define BEVEL_WSTR L"bevel_join"
|
|
|
|
#define MITER_WSTR L"miter_join"
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorFreeDeformer
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorFreeDeformer final : public FreeDeformer {
|
2016-06-15 18:43:10 +12:00
|
|
|
TVectorImageP m_vi;
|
|
|
|
std::set<int> m_strokeIndexes;
|
|
|
|
std::vector<TStroke *> m_originalStrokes;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool m_preserveThickness, m_computeRegion, m_flip;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TThickPoint deform(TThickPoint point);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorFreeDeformer(TVectorImageP vi, std::set<int> strokeIndexes);
|
|
|
|
~VectorFreeDeformer();
|
|
|
|
|
|
|
|
void setPreserveThickness(bool preserveThickness);
|
|
|
|
void setComputeRegion(bool computeRegion);
|
|
|
|
void setFlip(bool flip);
|
|
|
|
|
|
|
|
/*! Return \b index point, with index from 0 to 3. */
|
|
|
|
TPointD getPoint(int index) const { return m_newPoints[index]; }
|
|
|
|
/*! Set \b index point to \b p, with index from 0 to 3. */
|
2016-06-19 20:06:29 +12:00
|
|
|
void setPoint(int index, const TPointD &p) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
/*! Helper function. */
|
|
|
|
void setPoints(const TPointD &p0, const TPointD &p1, const TPointD &p2,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TPointD &p3) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
/*! Helper function. */
|
|
|
|
TVectorImage *getDeformedImage() const { return m_vi.getPointer(); }
|
|
|
|
|
|
|
|
void deformRegions();
|
2016-06-19 20:06:29 +12:00
|
|
|
void deformImage() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// DragSelectionTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace DragSelectionTool {
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// UndoChangeStrokes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class UndoChangeStrokes final : public ToolUtils::TToolUndo {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
UndoChangeStrokes(TXshSimpleLevel *level, const TFrameId &frameId,
|
|
|
|
VectorSelectionTool *tool,
|
|
|
|
const StrokeSelection &selection);
|
|
|
|
UndoChangeStrokes(TXshSimpleLevel *level, const TFrameId &frameId,
|
|
|
|
VectorSelectionTool *tool, const LevelSelection &selection);
|
|
|
|
~UndoChangeStrokes();
|
|
|
|
|
|
|
|
void registerStrokes(bool beforeModify = false);
|
|
|
|
void setFlip(bool value) { m_flip = value; }
|
|
|
|
void transform(const std::vector<TStroke *> &strokes, FourPoints bbox,
|
|
|
|
TPointD center, DeformValues deformValue) const;
|
|
|
|
void restoreRegions() const;
|
2016-06-19 20:06:29 +12:00
|
|
|
void undo() const override;
|
|
|
|
void redo() const override;
|
|
|
|
int getSize() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorSelectionTool *m_tool;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
std::vector<TStroke *> m_oldStrokes, m_newStrokes;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
std::vector<int> m_indexes; //!< Selected indexes at current frame.
|
|
|
|
std::vector<TFilledRegionInf> m_regionsData;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_selectionCount;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
FourPoints m_oldBBox, m_newBBox;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPointD m_oldCenter, m_newCenter;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DeformValues m_oldDeformValues, m_newDeformValues;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool m_flip;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorDeformTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class VectorDeformTool : public DeformTool {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorDeformTool(VectorSelectionTool *tool);
|
|
|
|
~VectorDeformTool();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2021-04-21 20:42:56 +12:00
|
|
|
void applyTransform(FourPoints bbox, bool onFastDragging = false) override;
|
2016-06-19 20:06:29 +12:00
|
|
|
void addTransformUndo() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2021-07-08 13:39:28 +12:00
|
|
|
/*! Transform whole level and add undo. */
|
2016-06-15 18:43:10 +12:00
|
|
|
void transformWholeLevel();
|
|
|
|
bool isFlip();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<UndoChangeStrokes> m_undo;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override {}
|
|
|
|
|
|
|
|
void leftButtonUp(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
|
|
|
|
void draw() override {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
struct VFDScopedBlock;
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<VFDScopedBlock> m_vfdScopedBlock;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorRotationTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorRotationTool final : public VectorDeformTool {
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<Rotation> m_rotation;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorRotationTool(VectorSelectionTool *tool);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void transform(TAffine aff, double angle) override;
|
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
void draw() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorFreeDeformTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorFreeDeformTool final : public VectorDeformTool {
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<FreeDeform> m_freeDeform;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorFreeDeformTool(VectorSelectionTool *tool);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorMoveSelectionTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorMoveSelectionTool final : public VectorDeformTool {
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<MoveSelection> m_moveSelection;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorMoveSelectionTool(VectorSelectionTool *tool);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void transform(TAffine aff) override;
|
|
|
|
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorScaleTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorScaleTool final : public VectorDeformTool {
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<Scale> m_scale;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2019-12-24 00:03:57 +13:00
|
|
|
VectorScaleTool(VectorSelectionTool *tool, ScaleType type);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2021-04-21 20:42:56 +12:00
|
|
|
TPointD transform(int index, TPointD newPos, bool onFastDragging = false)
|
|
|
|
override; //!< Returns scale value.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorChangeThicknessTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorChangeThicknessTool final : public DragTool {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPointD m_curPos, m_firstPos;
|
|
|
|
std::map<int, std::vector<double>> m_strokesThickness;
|
|
|
|
double m_thicknessChange;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2018-12-14 22:15:03 +13:00
|
|
|
std::unique_ptr<UndoChangeStrokes> m_undo;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorChangeThicknessTool(VectorSelectionTool *tool);
|
|
|
|
~VectorChangeThicknessTool();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setStrokesThickness(TVectorImage &vi);
|
|
|
|
void setThicknessChange(double value) { m_thicknessChange = value; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void changeImageThickness(TVectorImage &vi, double newThickness);
|
|
|
|
void addUndo();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
void leftButtonUp(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
void draw() override {}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
} // namespace DragSelectionTool
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VectorSelectionTool
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Selection tool for Toonz's vector images.
|
|
|
|
*/
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class VectorSelectionTool final : public SelectionTool {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(VectorSelectionTool)
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
VectorSelectionTool(int targetType);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void setNewFreeDeformer() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setCanEnterGroup(bool value) { m_canEnterGroup = value; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
bool isConstantThickness() const override {
|
|
|
|
return m_constantThickness.getValue();
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isLevelType() const override;
|
|
|
|
bool isSelectedFramesType() const override;
|
|
|
|
bool isSameStyleType() const override;
|
|
|
|
bool isModifiableSelectionType() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
const std::set<int> &selectedStyles() const {
|
|
|
|
return m_levelSelection.styles();
|
|
|
|
}
|
|
|
|
std::set<int> &selectedStyles() { return m_levelSelection.styles(); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int getSelectionCount() const { return m_selectionCount; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void selectionOutlineStyle(int &capStyle, int &joinStyle);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
const StrokeSelection &strokeSelection() const { return m_strokeSelection; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
const LevelSelection &levelSelection() const { return m_levelSelection; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TSelection *getSelection() override;
|
|
|
|
bool isSelectionEmpty() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void computeBBox() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TPropertyGroup *getProperties(int targetType) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2019-11-01 07:29:23 +13:00
|
|
|
bool m_resetCenter;
|
|
|
|
|
|
|
|
void setResetCenter(bool update) { m_resetCenter = update; }
|
|
|
|
bool canResetCenter() { return m_resetCenter; }
|
|
|
|
|
2020-09-16 09:49:57 +12:00
|
|
|
bool isSelectionEditable() override { return m_strokeSelection.isEditable(); }
|
2019-11-25 13:22:20 +13:00
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void onActivate() override;
|
|
|
|
void onDeactivate() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &) override;
|
2019-12-25 17:04:57 +13:00
|
|
|
void leftButtonDown(const TPointD &pos, const TMouseEvent &) override;
|
2016-06-19 20:06:29 +12:00
|
|
|
void leftButtonUp(const TPointD &pos, const TMouseEvent &) override;
|
|
|
|
void leftButtonDoubleClick(const TPointD &, const TMouseEvent &e) override;
|
|
|
|
void addContextMenuItems(QMenu *menu) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void draw() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void updateAction(TPointD pos, const TMouseEvent &e) override;
|
|
|
|
void onSelectedFramesChanged() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool onPropertyChanged(std::string propertyName) override;
|
|
|
|
void onImageChanged() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2019-12-25 17:04:57 +13:00
|
|
|
int getCursorId() const override {
|
|
|
|
if (m_viewer && m_viewer->getGuidedStrokePickerMode())
|
|
|
|
return m_viewer->getGuidedStrokePickerCursor();
|
|
|
|
return m_cursorId;
|
|
|
|
}
|
|
|
|
|
2020-01-08 15:32:25 +13:00
|
|
|
bool isDragging() const override;
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
private:
|
2016-06-29 18:17:12 +12:00
|
|
|
class AttachedLevelSelection final : public LevelSelection {
|
2016-06-15 18:43:10 +12:00
|
|
|
StrokeSelection &m_strokeSelection; //!< Selection of strokes to be seen at
|
2016-06-20 14:23:05 +12:00
|
|
|
//! current frame.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
public:
|
|
|
|
AttachedLevelSelection(StrokeSelection &strokeSelection)
|
|
|
|
: m_strokeSelection(strokeSelection) {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void selectNone() override {
|
2016-06-15 18:43:10 +12:00
|
|
|
LevelSelection::selectNone(), m_strokeSelection.selectNone();
|
|
|
|
}
|
2018-03-14 18:58:33 +13:00
|
|
|
void enableCommands() override { m_strokeSelection.enableCommands(); }
|
2016-06-15 18:43:10 +12:00
|
|
|
};
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
TEnumProperty m_selectionTarget; //!< Selected target content (strokes, whole
|
2016-06-20 14:23:05 +12:00
|
|
|
//! image, styles...).
|
2020-06-29 15:05:10 +12:00
|
|
|
TBoolProperty m_includeIntersection;
|
2016-06-15 18:43:10 +12:00
|
|
|
TBoolProperty m_constantThickness;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StrokeSelection m_strokeSelection; //!< Standard selection of a set of
|
2016-06-20 14:23:05 +12:00
|
|
|
//! strokes in current image.
|
2016-06-15 18:43:10 +12:00
|
|
|
AttachedLevelSelection m_levelSelection; //!< Selection across multiple
|
2016-06-20 14:23:05 +12:00
|
|
|
//! frames and specific styles.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TEnumProperty m_capStyle; //!< Style of stroke caps.
|
|
|
|
TEnumProperty m_joinStyle; //!< Style of stroke joins.
|
|
|
|
TIntProperty m_miterJoinLimit; //!< Stroke joins threshold value.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPropertyGroup m_outlineProps;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_selectionCount; //!< \deprecated This is \a not related to stroke
|
2016-06-20 14:23:05 +12:00
|
|
|
//! selections;
|
2016-06-15 18:43:10 +12:00
|
|
|
//! but rather to bboxes count - and even that is deprecated.
|
|
|
|
bool m_canEnterGroup; //!< \deprecated Used in Manga and Kids
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
void modifySelectionOnClick(TImageP image, const TPointD &pos,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TMouseEvent &e) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
bool selectStroke(int index, bool toggle);
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void doOnActivate() override;
|
|
|
|
void doOnDeactivate() override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2020-06-29 15:05:10 +12:00
|
|
|
void selectRegionVectorImage(bool includeIntersect);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void updateTranslation() override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
/*! \details The updateSelectionTarget() function reads the selection
|
|
|
|
target (styles, frames, etc) selected by the user, and ensures
|
|
|
|
that the associated internal selection is configured and
|
|
|
|
\a current.
|
|
|
|
|
|
|
|
The selected strokes set is \a may be cleared appropriately
|
|
|
|
as a result of a change in target. */
|
|
|
|
|
|
|
|
void updateSelectionTarget(); //!< Reads widget fields and updates the
|
2016-06-20 14:23:05 +12:00
|
|
|
//! selection target accordingly.
|
2016-06-15 18:43:10 +12:00
|
|
|
void
|
|
|
|
clearSelectedStrokes(); //!< Clears strokes visible in current selection.
|
|
|
|
void finalizeSelection(); //!< Makes selection consistent, and invokes all
|
2016-06-20 14:23:05 +12:00
|
|
|
//! related cached data
|
|
|
|
//! updates needed for visualization.
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawInLevelType(const TVectorImage &vi);
|
|
|
|
void drawSelectedStrokes(const TVectorImage &vi);
|
|
|
|
void drawGroup(const TVectorImage &vi);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // VECTORSELECTIONTOOL_H
|