tahoma2d/toonz/sources/include/toonzqt/styleselection.h

106 lines
3 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef STYLESELECTION_INCLUDED
#define STYLESELECTION_INCLUDED
#include "toonzqt/selection.h"
#include "toonz/tpalettehandle.h"
#include "tpalette.h"
#include <set>
#include <QString>
class QByteArray;
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
class TXsheetHandle;
class TXshLevelHandle;
//=============================================================================
// TStyleSelection
//-----------------------------------------------------------------------------
class DVAPI TStyleSelection final : public TSelection {
2016-06-15 18:43:10 +12:00
TPaletteHandle *m_paletteHandle;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// Used to change level palette; in other palette (cleanup, ...) xsheetHandle
// is not necessary.
TXsheetHandle *m_xsheetHandle;
// for clearing cache when the pastestyle command is executed
TXshLevelHandle *m_levelHandle;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int m_pageIndex;
std::set<int> m_styleIndicesInPage;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TStyleSelection();
TStyleSelection(TStyleSelection *styleSelection)
: m_paletteHandle(styleSelection->getPaletteHandle())
, m_pageIndex(styleSelection->getPageIndex())
, m_styleIndicesInPage(styleSelection->getIndicesInPage()) {}
~TStyleSelection();
void select(int pageIndex);
void select(int pageIndex, int styleIndexInPage, bool on);
bool isSelected(int pageIndex, int styleIndexInPage) const;
bool isPageSelected(int pageIndex) const;
bool canHandleStyles();
2016-06-19 20:06:29 +12:00
void selectNone() override;
bool isEmpty() const override;
2016-06-15 18:43:10 +12:00
int getStyleCount() const;
TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
void setPaletteHandle(TPaletteHandle *paletteHandle) {
m_paletteHandle = paletteHandle;
}
TPalette *getPalette() const { return m_paletteHandle->getPalette(); }
int getPageIndex() const { return m_pageIndex; }
const std::set<int> &getIndicesInPage() const { return m_styleIndicesInPage; }
void getIndices(std::set<int> &indices) const;
// Used to change level palette; in other palette (cleanup, ...) xsheetHandle
// is not necessary.
void setXsheetHandle(TXsheetHandle *xsheetHandle) {
m_xsheetHandle = xsheetHandle;
}
TXsheetHandle *getXsheetHandle() const { return m_xsheetHandle; }
void setLevelHandle(TXshLevelHandle *levelHandle) {
m_levelHandle = levelHandle;
}
// commands
void cutStyles();
void copyStyles();
void pasteStyles();
void pasteStylesValues(bool pasteName, bool pasteColor = true);
void pasteStylesValue();
void pasteStylesColor();
void pasteStylesName();
void deleteStyles();
2020-01-22 16:14:07 +13:00
void eraseUnusedStyle();
2016-06-15 18:43:10 +12:00
void blendStyles();
void toggleLink();
void eraseToggleLink();
2016-06-19 20:06:29 +12:00
void enableCommands() override;
2016-06-15 18:43:10 +12:00
void toggleKeyframe(int frame);
// remove link from the studio palette (if linked)
2016-09-15 23:31:45 +12:00
void removeLink();
2016-06-15 18:43:10 +12:00
// get back the style from the studio palette (if linked)
void getBackOriginalStyle();
2016-09-20 20:32:21 +12:00
// return true if there is at least one linked style in the selection
bool hasLinkedStyle();
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // STYLESELECTION_INCLUDED