|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef VECTORSELECTIONTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
#define VECTORSELECTIONTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "selectiontool.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzTools includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/strokeselection.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/levelselection.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tstroke.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tregion.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qset></qset>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class VectorSelectionTool;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// Constants / Defines
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
enum SelectionTarget //! Possible selection targets in a SelectionTool.
|
|
Shinya Kitaoka |
120a6e |
{ NORMAL_TYPE_IDX, //!< Normal selection (strokes at current frame).
|
|
Shinya Kitaoka |
120a6e |
SELECTED_FRAMES_TYPE_IDX, //!< Selection of whole frames.
|
|
Shinya Kitaoka |
120a6e |
ALL_LEVEL_TYPE_IDX, //!< Selection of an entire level.
|
|
Shinya Kitaoka |
120a6e |
SAME_STYLE_TYPE_IDX, //!< Selected styles at current frame.
|
|
Shinya Kitaoka |
120a6e |
STYLE_SELECTED_FRAMES_TYPE_IDX, //!< Selected styles at selected frames.
|
|
Shinya Kitaoka |
120a6e |
STYLE_LEVEL_TYPE_IDX, //!< Selected styles at current frame on the whole
|
|
Shinya Kitaoka |
38fd86 |
//! level.
|
|
Shinya Kitaoka |
120a6e |
BOUNDARY_TYPE_IDX, //!< Boundary strokes on current frame.
|
|
Shinya Kitaoka |
120a6e |
BOUNDARY_SELECTED_FRAMES_TYPE_IDX, //!< Boundary strokes on selected frames.
|
|
Shinya Kitaoka |
120a6e |
BOUNDARY_LEVEL_TYPE_IDX, //!< Boundary strokes on the whole level.
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define NORMAL_TYPE L"Standard"
|
|
Toshihiro Shimizu |
890ddd |
#define SELECTED_FRAMES_TYPE L"Selected Frames"
|
|
Toshihiro Shimizu |
890ddd |
#define ALL_LEVEL_TYPE L"Whole Level"
|
|
Toshihiro Shimizu |
890ddd |
#define SAME_STYLE_TYPE L"Same Style"
|
|
Toshihiro Shimizu |
890ddd |
#define STYLE_SELECTED_FRAMES_TYPE L"Same Style on Selected Frames"
|
|
Toshihiro Shimizu |
890ddd |
#define STYLE_LEVEL_TYPE L"Same Style on Whole Level"
|
|
Toshihiro Shimizu |
890ddd |
#define BOUNDARY_TYPE L"Boundary Strokes"
|
|
Toshihiro Shimizu |
890ddd |
#define BOUNDARY_SELECTED_FRAMES_TYPE L"Boundaries on Selected Frames"
|
|
Toshihiro Shimizu |
890ddd |
#define BOUNDARY_LEVEL_TYPE L"Boundaries on Whole Level"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define ROUNDC_WSTR L"round_cap"
|
|
Toshihiro Shimizu |
890ddd |
#define BUTT_WSTR L"butt_cap"
|
|
Toshihiro Shimizu |
890ddd |
#define PROJECTING_WSTR L"projecting_cap"
|
|
Toshihiro Shimizu |
890ddd |
#define ROUNDJ_WSTR L"round_join"
|
|
Toshihiro Shimizu |
890ddd |
#define BEVEL_WSTR L"bevel_join"
|
|
Toshihiro Shimizu |
890ddd |
#define MITER_WSTR L"miter_join"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorFreeDeformer
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorFreeDeformer final : public FreeDeformer {
|
|
Shinya Kitaoka |
120a6e |
TVectorImageP m_vi;
|
|
Shinya Kitaoka |
120a6e |
std::set<int> m_strokeIndexes;</int>
|
|
Shinya Kitaoka |
120a6e |
std::vector<tstroke *=""> m_originalStrokes;</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_preserveThickness, m_computeRegion, m_flip;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TThickPoint deform(TThickPoint point);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorFreeDeformer(TVectorImageP vi, std::set<int> strokeIndexes);</int>
|
|
Shinya Kitaoka |
120a6e |
~VectorFreeDeformer();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setPreserveThickness(bool preserveThickness);
|
|
Shinya Kitaoka |
120a6e |
void setComputeRegion(bool computeRegion);
|
|
Shinya Kitaoka |
120a6e |
void setFlip(bool flip);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! Return \b index point, with index from 0 to 3. */
|
|
Shinya Kitaoka |
120a6e |
TPointD getPoint(int index) const { return m_newPoints[index]; }
|
|
Shinya Kitaoka |
120a6e |
/*! Set \b index point to \b p, with index from 0 to 3. */
|
|
Shinya Kitaoka |
473e70 |
void setPoint(int index, const TPointD &p) override;
|
|
Shinya Kitaoka |
120a6e |
/*! Helper function. */
|
|
Shinya Kitaoka |
120a6e |
void setPoints(const TPointD &p0, const TPointD &p1, const TPointD &p2,
|
|
Shinya Kitaoka |
473e70 |
const TPointD &p3) override;
|
|
Shinya Kitaoka |
120a6e |
/*! Helper function. */
|
|
Shinya Kitaoka |
120a6e |
TVectorImage *getDeformedImage() const { return m_vi.getPointer(); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void deformRegions();
|
|
Shinya Kitaoka |
473e70 |
void deformImage() override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// DragSelectionTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace DragSelectionTool {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// UndoChangeStrokes
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class UndoChangeStrokes final : public ToolUtils::TToolUndo {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
UndoChangeStrokes(TXshSimpleLevel *level, const TFrameId &frameId,
|
|
Shinya Kitaoka |
120a6e |
VectorSelectionTool *tool,
|
|
Shinya Kitaoka |
120a6e |
const StrokeSelection &selection);
|
|
Shinya Kitaoka |
120a6e |
UndoChangeStrokes(TXshSimpleLevel *level, const TFrameId &frameId,
|
|
Shinya Kitaoka |
120a6e |
VectorSelectionTool *tool, const LevelSelection &selection);
|
|
Shinya Kitaoka |
120a6e |
~UndoChangeStrokes();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void registerStrokes(bool beforeModify = false);
|
|
Shinya Kitaoka |
120a6e |
void setFlip(bool value) { m_flip = value; }
|
|
Shinya Kitaoka |
120a6e |
void transform(const std::vector<tstroke *=""> &strokes, FourPoints bbox,</tstroke>
|
|
Shinya Kitaoka |
120a6e |
TPointD center, DeformValues deformValue) const;
|
|
Shinya Kitaoka |
120a6e |
void restoreRegions() const;
|
|
Shinya Kitaoka |
473e70 |
void undo() const override;
|
|
Shinya Kitaoka |
473e70 |
void redo() const override;
|
|
Shinya Kitaoka |
473e70 |
int getSize() const override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
VectorSelectionTool *m_tool;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::vector<tstroke *=""> m_oldStrokes, m_newStrokes;</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::vector<int> m_indexes; //!< Selected indexes at current frame.</int>
|
|
Shinya Kitaoka |
120a6e |
std::vector<tfilledregioninf> m_regionsData;</tfilledregioninf>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_selectionCount;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FourPoints m_oldBBox, m_newBBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD m_oldCenter, m_newCenter;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DeformValues m_oldDeformValues, m_newDeformValues;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_flip;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorDeformTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class VectorDeformTool : public DeformTool {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorDeformTool(VectorSelectionTool *tool);
|
|
Shinya Kitaoka |
120a6e |
~VectorDeformTool();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void applyTransform(FourPoints bbox) override;
|
|
Shinya Kitaoka |
473e70 |
void addTransformUndo() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*! Trasform whole level and add undo. */
|
|
Shinya Kitaoka |
120a6e |
void transformWholeLevel();
|
|
Shinya Kitaoka |
120a6e |
bool isFlip();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
otakuto |
e28b5e |
std::unique_ptr<undochangestrokes> m_undo;</undochangestrokes>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override {}
|
|
Shinya Kitaoka |
473e70 |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonUp(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
|
|
Shinya Kitaoka |
473e70 |
void draw() override {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
struct VFDScopedBlock;
|
|
otakuto |
e28b5e |
std::unique_ptr<vfdscopedblock> m_vfdScopedBlock;</vfdscopedblock>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorRotationTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorRotationTool final : public VectorDeformTool {
|
|
otakuto |
e28b5e |
std::unique_ptr<rotation> m_rotation;</rotation>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorRotationTool(VectorSelectionTool *tool);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void transform(TAffine aff, double angle) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void draw() override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorFreeDeformTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorFreeDeformTool final : public VectorDeformTool {
|
|
otakuto |
e28b5e |
std::unique_ptr<freedeform> m_freeDeform;</freedeform>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorFreeDeformTool(VectorSelectionTool *tool);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorMoveSelectionTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorMoveSelectionTool final : public VectorDeformTool {
|
|
otakuto |
e28b5e |
std::unique_ptr<moveselection> m_moveSelection;</moveselection>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorMoveSelectionTool(VectorSelectionTool *tool);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void transform(TAffine aff) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorScaleTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorScaleTool final : public VectorDeformTool {
|
|
otakuto |
e28b5e |
std::unique_ptr<scale> m_scale;</scale>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorScaleTool(VectorSelectionTool *tool, int type);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
38fd86 |
TPointD transform(int index,
|
|
Shinya Kitaoka |
38fd86 |
TPointD newPos) override; //!< Returns scale value.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorChangeThicknessTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorChangeThicknessTool final : public DragTool {
|
|
Shinya Kitaoka |
120a6e |
TPointD m_curPos, m_firstPos;
|
|
Shinya Kitaoka |
120a6e |
std::map<int, std::vector<double="">> m_strokesThickness;</int,>
|
|
Shinya Kitaoka |
120a6e |
double m_thicknessChange;
|
|
Toshihiro Shimizu |
890ddd |
|
|
otakuto |
e28b5e |
std::unique_ptr<undochangestrokes> m_undo;</undochangestrokes>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorChangeThicknessTool(VectorSelectionTool *tool);
|
|
Shinya Kitaoka |
120a6e |
~VectorChangeThicknessTool();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setStrokesThickness(TVectorImage &vi);
|
|
Shinya Kitaoka |
120a6e |
void setThicknessChange(double value) { m_thicknessChange = value; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void changeImageThickness(TVectorImage &vi, double newThickness);
|
|
Shinya Kitaoka |
120a6e |
void addUndo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonUp(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void draw() override {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
} // namespace DragSelectionTool
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// VectorSelectionTool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Selection tool for Toonz's vector images.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class VectorSelectionTool final : public SelectionTool {
|
|
Shinya Kitaoka |
120a6e |
Q_DECLARE_TR_FUNCTIONS(VectorSelectionTool)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
VectorSelectionTool(int targetType);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void setNewFreeDeformer() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setCanEnterGroup(bool value) { m_canEnterGroup = value; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
38fd86 |
bool isConstantThickness() const override {
|
|
Shinya Kitaoka |
38fd86 |
return m_constantThickness.getValue();
|
|
Shinya Kitaoka |
38fd86 |
}
|
|
Shinya Kitaoka |
473e70 |
bool isLevelType() const override;
|
|
Shinya Kitaoka |
473e70 |
bool isSelectedFramesType() const override;
|
|
Shinya Kitaoka |
473e70 |
bool isSameStyleType() const override;
|
|
Shinya Kitaoka |
473e70 |
bool isModifiableSelectionType() const override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const std::set<int> &selectedStyles() const {</int>
|
|
Shinya Kitaoka |
120a6e |
return m_levelSelection.styles();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
std::set<int> &selectedStyles() { return m_levelSelection.styles(); }</int>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int getSelectionCount() const { return m_selectionCount; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void selectionOutlineStyle(int &capStyle, int &joinStyle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const StrokeSelection &strokeSelection() const { return m_strokeSelection; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const LevelSelection &levelSelection() const { return m_levelSelection; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
TSelection *getSelection() override;
|
|
Shinya Kitaoka |
473e70 |
bool isSelectionEmpty() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void computeBBox() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
TPropertyGroup *getProperties(int targetType) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void onActivate() override;
|
|
Shinya Kitaoka |
473e70 |
void onDeactivate() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonUp(const TPointD &pos, const TMouseEvent &) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDoubleClick(const TPointD &, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void addContextMenuItems(QMenu *menu) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void draw() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void updateAction(TPointD pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void onSelectedFramesChanged() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
bool onPropertyChanged(std::string propertyName) override;
|
|
Shinya Kitaoka |
473e70 |
void onImageChanged() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
d1f6c4 |
class AttachedLevelSelection final : public LevelSelection {
|
|
Shinya Kitaoka |
120a6e |
StrokeSelection &m_strokeSelection; //!< Selection of strokes to be seen at
|
|
Shinya Kitaoka |
38fd86 |
//! current frame.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
public:
|
|
Shinya Kitaoka |
120a6e |
AttachedLevelSelection(StrokeSelection &strokeSelection)
|
|
Shinya Kitaoka |
120a6e |
: m_strokeSelection(strokeSelection) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void selectNone() override {
|
|
Shinya Kitaoka |
120a6e |
LevelSelection::selectNone(), m_strokeSelection.selectNone();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
shun-iwasawa |
6e8ca5 |
void enableCommands() override { m_strokeSelection.enableCommands(); }
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_selectionTarget; //!< Selected target content (strokes, whole
|
|
Shinya Kitaoka |
38fd86 |
//! image, styles...).
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty m_constantThickness;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
StrokeSelection m_strokeSelection; //!< Standard selection of a set of
|
|
Shinya Kitaoka |
38fd86 |
//! strokes in current image.
|
|
Shinya Kitaoka |
120a6e |
AttachedLevelSelection m_levelSelection; //!< Selection across multiple
|
|
Shinya Kitaoka |
38fd86 |
//! frames and specific styles.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_capStyle; //!< Style of stroke caps.
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_joinStyle; //!< Style of stroke joins.
|
|
Shinya Kitaoka |
120a6e |
TIntProperty m_miterJoinLimit; //!< Stroke joins threshold value.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup m_outlineProps;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_selectionCount; //!< \deprecated This is \a not related to stroke
|
|
Shinya Kitaoka |
38fd86 |
//! selections;
|
|
Shinya Kitaoka |
120a6e |
//! but rather to bboxes count - and even that is deprecated.
|
|
Shinya Kitaoka |
120a6e |
bool m_canEnterGroup; //!< \deprecated Used in Manga and Kids
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void modifySelectionOnClick(TImageP image, const TPointD &pos,
|
|
Shinya Kitaoka |
473e70 |
const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
120a6e |
bool selectStroke(int index, bool toggle);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void doOnActivate() override;
|
|
Shinya Kitaoka |
473e70 |
void doOnDeactivate() override;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void selectRegionVectorImage();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void updateTranslation() override;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \details The updateSelectionTarget() function reads the selection
|
|
Shinya Kitaoka |
120a6e |
target (styles, frames, etc) selected by the user, and ensures
|
|
Shinya Kitaoka |
120a6e |
that the associated internal selection is configured and
|
|
Shinya Kitaoka |
120a6e |
\a current.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
The selected strokes set is \a may be cleared appropriately
|
|
Shinya Kitaoka |
120a6e |
as a result of a change in target. */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void updateSelectionTarget(); //!< Reads widget fields and updates the
|
|
Shinya Kitaoka |
38fd86 |
//! selection target accordingly.
|
|
Shinya Kitaoka |
120a6e |
void
|
|
Shinya Kitaoka |
120a6e |
clearSelectedStrokes(); //!< Clears strokes visible in current selection.
|
|
Shinya Kitaoka |
120a6e |
void finalizeSelection(); //!< Makes selection consistent, and invokes all
|
|
Shinya Kitaoka |
38fd86 |
//! related cached data
|
|
Shinya Kitaoka |
38fd86 |
//! updates needed for visualization.
|
|
Shinya Kitaoka |
120a6e |
void drawInLevelType(const TVectorImage &vi);
|
|
Shinya Kitaoka |
120a6e |
void drawSelectedStrokes(const TVectorImage &vi);
|
|
Shinya Kitaoka |
120a6e |
void drawGroup(const TVectorImage &vi);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // VECTORSELECTIONTOOL_H
|