Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef KEYFRAMENAVIGATOR_INCLUDED
Toshihiro Shimizu 890ddd
#define KEYFRAMENAVIGATOR_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include "tfxutil.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/tstageobject.h"
Toshihiro Shimizu 890ddd
#include "toonz/tframehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tobjecthandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/txsheethandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tpalettehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tfxhandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tcolumnfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qtoolbar></qtoolbar>
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 TStyleSelection;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// KeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI KeyframeNavigator : public QToolBar {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QAction *m_actPreviewKey;
Shinya Kitaoka 120a6e
  QAction *m_actKeyNo;
Shinya Kitaoka 120a6e
  QAction *m_actKeyPartial;
Shinya Kitaoka 120a6e
  QAction *m_actKeyTotal;
Shinya Kitaoka 120a6e
  QAction *m_actNextKey;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Toshihiro Shimizu 890ddd
manongjohn 4be4bb
  QWidget *m_panel;
manongjohn 4be4bb
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  KeyframeNavigator(QWidget *parent = 0, TFrameHandle *frameHandle = 0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getCurrentFrame() const {
Shinya Kitaoka 120a6e
    if (!m_frameHandle) return -1;
Shinya Kitaoka 120a6e
    return m_frameHandle->getFrameIndex();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setCurrentFrame(int frame) {
Shinya Kitaoka 120a6e
    m_frameHandle->setFrameIndex(frame);
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setFrameHandle(TFrameHandle *frameHandle) {
Shinya Kitaoka 120a6e
    m_frameHandle = frameHandle;
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void update();
Toshihiro Shimizu 890ddd
manongjohn 4be4bb
  void onNextKeyframe(QWidget *panel);
manongjohn 4be4bb
  void onPrevKeyframe(QWidget *panel);
manongjohn 4be4bb
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  void toggleKeyAct() {
Shinya Kitaoka 120a6e
    toggle();
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void toggleNextKeyAct() {
Shinya Kitaoka 120a6e
    goNext();
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void togglePrevKeyAct() {
Shinya Kitaoka 120a6e
    goPrev();
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  virtual bool hasNext() const        = 0;
Shinya Kitaoka 120a6e
  virtual bool hasPrev() const        = 0;
Shinya Kitaoka 120a6e
  virtual bool hasKeyframes() const   = 0;
Shinya Kitaoka 120a6e
  virtual bool isKeyframe() const     = 0;
Shinya Kitaoka 120a6e
  virtual bool isFullKeyframe() const = 0;
Shinya Kitaoka 120a6e
  virtual void toggle()               = 0;
Shinya Kitaoka 120a6e
  virtual void goNext()               = 0;
Shinya Kitaoka 120a6e
  virtual void goPrev()               = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// ViewerKeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI ViewerKeyframeNavigator final : public KeyframeNavigator {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TObjectHandle *m_objectHandle;
Shinya Kitaoka 120a6e
  TXsheetHandle *m_xsheetHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ViewerKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
Shinya Kitaoka 120a6e
      : KeyframeNavigator(parent, frameHandle)
Shinya Kitaoka 120a6e
      , m_objectHandle(0)
Shinya Kitaoka 120a6e
      , m_xsheetHandle(0) {
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TObjectHandle *getObjectHandle() const { return m_objectHandle; }
Shinya Kitaoka 120a6e
  TXsheetHandle *getXsheetHandle() const { return m_xsheetHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setObjectHandle(TObjectHandle *objectHandle) {
Shinya Kitaoka 120a6e
    m_objectHandle = objectHandle;
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void setXsheetHandle(TXsheetHandle *xsheetHandle) {
Shinya Kitaoka 120a6e
    m_xsheetHandle = xsheetHandle;
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TStageObject *getStageObject() const;
Shinya Kitaoka 473e70
  bool hasNext() const override;
Shinya Kitaoka 473e70
  bool hasPrev() const override;
Shinya Kitaoka 473e70
  bool hasKeyframes() const override;
Shinya Kitaoka 473e70
  bool isKeyframe() const override;
Shinya Kitaoka 473e70
  bool isFullKeyframe() const override;
Shinya Kitaoka 473e70
  void toggle() override;
Shinya Kitaoka 473e70
  void goNext() override;
Shinya Kitaoka 473e70
  void goPrev() override;
Shinya Kitaoka 473e70
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// PaletteKeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI PaletteKeyframeNavigator final : public KeyframeNavigator {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPaletteHandle *m_paletteHandle;
Shinya Kitaoka 120a6e
  TStyleSelection *m_selection;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PaletteKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
Shinya Kitaoka 120a6e
      : KeyframeNavigator(parent, frameHandle)
Shinya Kitaoka 120a6e
      , m_paletteHandle(0)
Shinya Kitaoka 120a6e
      , m_selection(0) {
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setSelection(TStyleSelection *selection) { m_selection = selection; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TPalette *getPalette() const {
Shinya Kitaoka 120a6e
    if (!m_paletteHandle) return 0;
Shinya Kitaoka 120a6e
    return m_paletteHandle->getPalette();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  int getStyleIndex() const {
Shinya Kitaoka 120a6e
    if (!m_paletteHandle) return 0;
Shinya Kitaoka 120a6e
    return m_paletteHandle->getStyleIndex();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setPaletteHandle(TPaletteHandle *paletteHandle) {
Shinya Kitaoka 120a6e
    m_paletteHandle = paletteHandle;
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  bool hasNext() const override;
Shinya Kitaoka 473e70
  bool hasPrev() const override;
Shinya Kitaoka 473e70
  bool hasKeyframes() const override;
Shinya Kitaoka 473e70
  bool isKeyframe() const override;
Shinya Kitaoka 473e70
  bool isFullKeyframe() const override { return isKeyframe(); }
Shinya Kitaoka 473e70
  void toggle() override;
Shinya Kitaoka 473e70
  void goNext() override;
Shinya Kitaoka 473e70
  void goPrev() override;
Shinya Kitaoka 473e70
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// FxKeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI FxKeyframeNavigator final : public KeyframeNavigator {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TFxHandle *m_fxHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FxKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
Shinya Kitaoka 120a6e
      : KeyframeNavigator(parent, frameHandle), m_fxHandle(0) {
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TFx *getFx() const {
Shinya Kitaoka 120a6e
    if (!m_fxHandle) return 0;
Shinya Kitaoka 120a6e
    TFx *fx = m_fxHandle->getFx();
Shinya Kitaoka 120a6e
    if (TZeraryColumnFx *zfx = dynamic_cast<tzerarycolumnfx *="">(fx))</tzerarycolumnfx>
Shinya Kitaoka 120a6e
      fx = zfx->getZeraryFx();
Shinya Kitaoka 120a6e
    return fx;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TFxHandle *getFxHandle() const { return m_fxHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setFxHandle(TFxHandle *fxHandle) {
Shinya Kitaoka 120a6e
    m_fxHandle = fxHandle;
Shinya Kitaoka 120a6e
    update();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  bool hasNext() const override;
Shinya Kitaoka 473e70
  bool hasPrev() const override;
Shinya Kitaoka 473e70
  bool hasKeyframes() const override;
Shinya Kitaoka 473e70
  bool isKeyframe() const override;
Shinya Kitaoka 473e70
  bool isFullKeyframe() const override;
Shinya Kitaoka 473e70
  void toggle() override;
Shinya Kitaoka 473e70
  void goNext() override;
Shinya Kitaoka 473e70
  void goPrev() override;
Shinya Kitaoka 473e70
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif