|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef HOOK_SELECTION
|
|
Toshihiro Shimizu |
890ddd |
#define HOOK_SELECTION
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/selection.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvmimedata.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/hook.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tundo.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <set></set>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// HookUndo
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class HookUndo : public TUndo
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
HookSet m_oldHooks, m_newHooks;
|
|
Toshihiro Shimizu |
890ddd |
TXshLevelP m_level;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
HookUndo(const TXshLevelP &level);
|
|
Toshihiro Shimizu |
890ddd |
~HookUndo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onAdd();
|
|
Toshihiro Shimizu |
890ddd |
void assignHookSet(const HookSet &src) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void undo() const;
|
|
Toshihiro Shimizu |
890ddd |
void redo() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getSize() const;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// HooksData
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class HooksData : public DvMimeData
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
struct HookPosition {
|
|
Toshihiro Shimizu |
890ddd |
int m_id;
|
|
Toshihiro Shimizu |
890ddd |
TPointD m_aPos, m_bPos;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
HookPosition(int id, const TPointD &aPos, const TPointD &bPos)
|
|
Toshihiro Shimizu |
890ddd |
: m_id(id), m_aPos(aPos), m_bPos(bPos) {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
std::vector<hookposition> m_hookPositions;</hookposition>
|
|
Toshihiro Shimizu |
890ddd |
TXshLevelP m_level;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
HooksData(const TXshLevelP &level);
|
|
Toshihiro Shimizu |
890ddd |
~HooksData();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
HooksData *clone() const;
|
|
Shinya Kitaoka |
3bfa54 |
void storeHookPositions(const std::vector<int> &ids);</int>
|
|
Toshihiro Shimizu |
890ddd |
void restoreHookPositions() const;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// HookSelection
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Derived from TSelection. Control which hooks are currently selected
|
|
Toshihiro Shimizu |
890ddd |
// Note that a hook is made of two different parts (used e.g. to "pass the hook"
|
|
Toshihiro Shimizu |
890ddd |
// between the feet in a walking cycle) that can be independently selected (1=A,2=B)
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class HookSelection : public TSelection
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TXshLevelP m_level;
|
|
Toshihiro Shimizu |
890ddd |
std::set<std::pair<int, int="">> m_hooks; // hookId, side : 1=A 2=B</std::pair<int,>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
HookSelection();
|
|
Toshihiro Shimizu |
890ddd |
~HookSelection();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TSelection *clone() const;
|
|
Toshihiro Shimizu |
890ddd |
void setLevel(const TXshLevelP &level) { m_level = level; }
|
|
Toshihiro Shimizu |
890ddd |
void select(int id, int side);
|
|
Toshihiro Shimizu |
890ddd |
void unselect(int id, int side);
|
|
Toshihiro Shimizu |
890ddd |
bool isSelected(int id, int side) const;
|
|
Toshihiro Shimizu |
890ddd |
void invertSelection(int id, int side);
|
|
Toshihiro Shimizu |
890ddd |
bool isEmpty() const;
|
|
Toshihiro Shimizu |
890ddd |
void selectNone() { m_hooks.clear(); }
|
|
Toshihiro Shimizu |
890ddd |
HookSet *getHookSet() const;
|
|
Toshihiro Shimizu |
890ddd |
bool select(const TSelection *s);
|
|
Toshihiro Shimizu |
890ddd |
void enableCommands();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//commands
|
|
Toshihiro Shimizu |
890ddd |
void deleteSelectedHooks();
|
|
Toshihiro Shimizu |
890ddd |
void copySelectedHooks();
|
|
Toshihiro Shimizu |
890ddd |
void cutSelectedHooks();
|
|
Toshihiro Shimizu |
890ddd |
void pasteSelectedHooks();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //HOOK_SELECTION
|