| #pragma once |
| |
| #ifndef HOOK_SELECTION |
| #define HOOK_SELECTION |
| |
| #include "toonzqt/selection.h" |
| #include "toonzqt/dvmimedata.h" |
| #include "toonz/txshlevel.h" |
| #include "toonz/hook.h" |
| #include "tundo.h" |
| |
| #include <set> |
| |
| |
| |
| |
| |
| class HookUndo : public TUndo { |
| HookSet m_oldHooks, m_newHooks; |
| TXshLevelP m_level; |
| |
| public: |
| HookUndo(const TXshLevelP &level); |
| ~HookUndo(); |
| |
| void onAdd(); |
| void assignHookSet(const HookSet &src) const; |
| |
| void undo() const; |
| void redo() const; |
| |
| int getSize() const; |
| }; |
| |
| |
| |
| |
| |
| class HooksData : public DvMimeData { |
| struct HookPosition { |
| int m_id; |
| TPointD m_aPos, m_bPos; |
| |
| HookPosition(int id, const TPointD &aPos, const TPointD &bPos) |
| : m_id(id), m_aPos(aPos), m_bPos(bPos) {} |
| }; |
| |
| std::vector<HookPosition> m_hookPositions; |
| TXshLevelP m_level; |
| |
| public: |
| HooksData(const TXshLevelP &level); |
| ~HooksData(); |
| |
| HooksData *clone() const; |
| void storeHookPositions(const std::vector<int> &ids); |
| void restoreHookPositions() const; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class HookSelection : public TSelection { |
| TXshLevelP m_level; |
| std::set<std::pair<int, int>> m_hooks; |
| |
| public: |
| HookSelection(); |
| ~HookSelection(); |
| |
| TSelection *clone() const; |
| void setLevel(const TXshLevelP &level) { m_level = level; } |
| void select(int id, int side); |
| void unselect(int id, int side); |
| bool isSelected(int id, int side) const; |
| void invertSelection(int id, int side); |
| bool isEmpty() const; |
| void selectNone() { m_hooks.clear(); } |
| HookSet *getHookSet() const; |
| bool select(const TSelection *s); |
| void enableCommands(); |
| |
| |
| void deleteSelectedHooks(); |
| void copySelectedHooks(); |
| void cutSelectedHooks(); |
| void pasteSelectedHooks(); |
| }; |
| |
| #endif |