Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef STYLESELECTION_INCLUDED
Toshihiro Shimizu 890ddd
#define STYLESELECTION_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonzqt/selection.h"
Toshihiro Shimizu 890ddd
#include "toonz/tpalettehandle.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
#include <qstring></qstring>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class QByteArray;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_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
class TXsheetHandle;
Toshihiro Shimizu 890ddd
class TXshLevelHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// TStyleSelection
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TStyleSelection final : public TSelection {
Shinya Kitaoka 120a6e
  TPaletteHandle *m_paletteHandle;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // Used to change level palette; in other palette (cleanup, ...) xsheetHandle
Shinya Kitaoka 120a6e
  // is not necessary.
Shinya Kitaoka 120a6e
  TXsheetHandle *m_xsheetHandle;
Shinya Kitaoka 120a6e
  // for clearing cache when the pastestyle command is executed
Shinya Kitaoka 120a6e
  TXshLevelHandle *m_levelHandle;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_pageIndex;
Shinya Kitaoka 120a6e
  std::set<int> m_styleIndicesInPage;</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TStyleSelection();
Shinya Kitaoka 120a6e
  TStyleSelection(TStyleSelection *styleSelection)
Shinya Kitaoka 120a6e
      : m_paletteHandle(styleSelection->getPaletteHandle())
Shinya Kitaoka 120a6e
      , m_pageIndex(styleSelection->getPageIndex())
Shinya Kitaoka 120a6e
      , m_styleIndicesInPage(styleSelection->getIndicesInPage()) {}
Shinya Kitaoka 120a6e
  ~TStyleSelection();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void select(int pageIndex);
Shinya Kitaoka 120a6e
  void select(int pageIndex, int styleIndexInPage, bool on);
Shinya Kitaoka 120a6e
  bool isSelected(int pageIndex, int styleIndexInPage) const;
Shinya Kitaoka 120a6e
  bool isPageSelected(int pageIndex) const;
Shinya Kitaoka 120a6e
  bool canHandleStyles();
Shinya Kitaoka 473e70
  void selectNone() override;
Shinya Kitaoka 473e70
  bool isEmpty() const override;
Shinya Kitaoka 120a6e
  int getStyleCount() const;
Shinya Kitaoka 120a6e
  TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
Shinya Kitaoka 120a6e
  void setPaletteHandle(TPaletteHandle *paletteHandle) {
Shinya Kitaoka 120a6e
    m_paletteHandle = paletteHandle;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  TPalette *getPalette() const { return m_paletteHandle->getPalette(); }
Shinya Kitaoka 120a6e
  int getPageIndex() const { return m_pageIndex; }
Shinya Kitaoka 120a6e
  const std::set<int> &getIndicesInPage() const { return m_styleIndicesInPage; }</int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void getIndices(std::set<int> &indices) const;</int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Used to change level palette; in other palette (cleanup, ...) xsheetHandle
Shinya Kitaoka 120a6e
  // is not necessary.
Shinya Kitaoka 120a6e
  void setXsheetHandle(TXsheetHandle *xsheetHandle) {
Shinya Kitaoka 120a6e
    m_xsheetHandle = xsheetHandle;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  TXsheetHandle *getXsheetHandle() const { return m_xsheetHandle; }
Shinya Kitaoka 120a6e
  void setLevelHandle(TXshLevelHandle *levelHandle) {
Shinya Kitaoka 120a6e
    m_levelHandle = levelHandle;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // commands
Shinya Kitaoka 120a6e
  void cutStyles();
Shinya Kitaoka 120a6e
  void copyStyles();
Shinya Kitaoka 120a6e
  void pasteStyles();
Shinya Kitaoka 120a6e
  void pasteStylesValues(bool pasteName, bool pasteColor = true);
Shinya Kitaoka 120a6e
  void pasteStylesValue();
Shinya Kitaoka 120a6e
  void pasteStylesColor();
Shinya Kitaoka 120a6e
  void pasteStylesName();
Shinya Kitaoka 120a6e
  void deleteStyles();
Shinya Kitaoka 120a6e
  void eraseUnsedStyle();
Shinya Kitaoka 120a6e
  void blendStyles();
Shinya Kitaoka 120a6e
  void toggleLink();
Shinya Kitaoka 120a6e
  void eraseToggleLink();
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void enableCommands() override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void toggleKeyframe(int frame);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // remove link from the studio palette (if linked)
shun_iwasawa 640862
  void removeLink();
Shinya Kitaoka 120a6e
  // get back the style from the studio palette (if linked)
Shinya Kitaoka 120a6e
  void getBackOriginalStyle();
shun_iwasawa 9f19cf
  // return true if there is at least one linked style in the selection
shun_iwasawa 9f19cf
  bool hasLinkedStyle();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // STYLESELECTION_INCLUDED