Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef STROKE_SELECTION_H
Toshihiro Shimizu 890ddd
#define STROKE_SELECTION_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzQt includes
Toshihiro Shimizu 890ddd
#include "toonzqt/selection.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "tvectorimage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// boost includes
Toshihiro Shimizu 890ddd
#include <boost scoped_ptr.hpp=""></boost>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// STD includes
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZTOOLS_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//    Forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TGroupCommand;
Toshihiro Shimizu 890ddd
class TSceneHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//****************************************************************************
Toshihiro Shimizu 890ddd
//    StrokeSelection  declaration
Toshihiro Shimizu 890ddd
//****************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI StrokeSelection : public TSelection
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	typedef std::set<int> IndexesContainer;</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	StrokeSelection();
Toshihiro Shimizu 890ddd
	~StrokeSelection();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	StrokeSelection(const StrokeSelection &other);
Toshihiro Shimizu 890ddd
	StrokeSelection &operator=(const StrokeSelection &other);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TGroupCommand *getGroupCommand() { return m_groupCommand.get(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setImage(const TVectorImageP &image) { m_vi = image; }
Toshihiro Shimizu 890ddd
	const TVectorImageP &getImage() const { return m_vi; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const IndexesContainer &getSelection() const { return m_indexes; }
Toshihiro Shimizu 890ddd
	IndexesContainer &getSelection() { return m_indexes; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isEmpty() const { return m_indexes.empty(); }
Toshihiro Shimizu 890ddd
	bool updateSelectionBBox() const { return m_updateSelectionBBox; }
Toshihiro Shimizu 890ddd
	bool isSelected(int index) const { return (m_indexes.count(index) > 0); }
Toshihiro Shimizu 890ddd
	void select(int index, bool on);
Toshihiro Shimizu 890ddd
	void toggle(int index);
Toshihiro Shimizu 890ddd
	void selectNone() { m_indexes.clear(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setSceneHandle(TSceneHandle *tsh)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_sceneHandle = tsh;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	// Commands
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void changeColorStyle(int styleIndex);
Toshihiro Shimizu 890ddd
	void deleteStrokes();
Toshihiro Shimizu 890ddd
	void copy();
Toshihiro Shimizu 890ddd
	void cut();
Toshihiro Shimizu 890ddd
	void paste();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void removeEndpoints();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void enableCommands();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	TVectorImageP m_vi;			//!< Selected vector image.
Toshihiro Shimizu 890ddd
	IndexesContainer m_indexes; //!< Selected stroke indexes in m_vi.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	boost::scoped_ptr<tgroupcommand> m_groupCommand; //!< Groups commands wrapper.</tgroupcommand>
Toshihiro Shimizu 890ddd
	TSceneHandle *m_sceneHandle;					 //!< Global scene handle. \deprecated  Use TApplication instead.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*!Set this boolean to true before call tool->notifyImageChanged() when you want to reset strokes bbox.
Toshihiro Shimizu 890ddd
     N.B. after call tool->notifyImageChanged() set m_updateSelectionBBox to false.*/
Toshihiro Shimizu 890ddd
	bool m_updateSelectionBBox;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // STROKE_SELECTION_H