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