Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef FXSETTINGS_H
Toshihiro Shimizu 890ddd
#define FXSETTINGS_H
Toshihiro Shimizu 890ddd
e280ae
#ifdef _MSC_VER
Toshihiro Shimizu 890ddd
#pragma warning(disable : 4251)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qsplitter></qsplitter>
Toshihiro Shimizu 890ddd
#include <qtoolbar></qtoolbar>
Toshihiro Shimizu 890ddd
#include <qstackedwidget></qstackedwidget>
Toshihiro Shimizu 890ddd
#include <qscrollarea></qscrollarea>
Toshihiro Shimizu 890ddd
#include <qmap></qmap>
Toshihiro Shimizu 890ddd
#include <qgroupbox></qgroupbox>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "tfx.h"
Toshihiro Shimizu 890ddd
#include "tabbar.h"
Toshihiro Shimizu 890ddd
#include "gutil.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonzqt/framenavigator.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/paramfield.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/swatchviewer.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/fxhistogramrender.h"
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
// forward declaration
Toshihiro Shimizu 890ddd
class QToolBar;
Toshihiro Shimizu 890ddd
class QStackedWidget;
Toshihiro Shimizu 890ddd
class QVBoxLayout;
Toshihiro Shimizu 890ddd
class QGridLayout;
shun-iwasawa 481b59
class QLabel;
Toshihiro Shimizu 890ddd
class QPushButton;
Toshihiro Shimizu 890ddd
class FxKeyframeNavigator;
Toshihiro Shimizu 890ddd
class ParamViewer;
Toshihiro Shimizu 890ddd
class TFxHandle;
Toshihiro Shimizu 890ddd
class TFrameHandle;
Toshihiro Shimizu 890ddd
class TXsheetHandle;
Toshihiro Shimizu 890ddd
class TSceneHandle;
Toshihiro Shimizu 890ddd
class TXshLevelHandle;
Toshihiro Shimizu 890ddd
class TObjectHandle;
Toshihiro Shimizu 890ddd
class ToonzScene;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
/*! \brief ParamsPage. View a page with fx params.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
                Inherits \b QWidget.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka d1f6c4
class DVAPI ParamsPage final : public QFrame {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QColor m_textColor; /*-- 文字の色 デフォルト黒 --*/
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor TextColor READ getTextColor WRITE setTextColor)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QGridLayout *m_mainLayout;
Shinya Kitaoka 120a6e
  QHBoxLayout *m_horizontalLayout;
Shinya Kitaoka 120a6e
  QGridLayout *m_groupLayout;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  friend class ParamViewer;
Shinya Kitaoka 120a6e
  QVector<paramfield *=""> m_fields;</paramfield>
Shinya Kitaoka 120a6e
  /*! To menage eventually histogram in page. */
Shinya Kitaoka 120a6e
  FxHistogramRender *m_fxHistogramRender;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ParamViewer *m_paramViewer;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ParamsPage(QWidget *parent = 0, ParamViewer *paramViewer = 0);
Shinya Kitaoka 120a6e
  ~ParamsPage();
Toshihiro Shimizu 890ddd
shun-iwasawa 8cac36
  void setPage(TIStream &is, const TFxP &fx, bool isFirstPage) {
Shinya Kitaoka 120a6e
    setPageField(is, fx);
shun-iwasawa 8cac36
    if (isFirstPage) addGlobalControl(fx);
Shinya Kitaoka 120a6e
    setPageSpace();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setFx(const TFxP ¤tFx, const TFxP &actualFx, int frame);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void update(int frame);
Shinya Kitaoka 120a6e
  void setPointValue(int index, const TPointD &p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  FxHistogramRender *getFxHistogramRender() const {
Shinya Kitaoka 120a6e
    return m_fxHistogramRender;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /*- 現在のページの最適なサイズを返す -*/
shun-iwasawa 0ed559
  QSize getPreferredSize();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setTextColor(const QColor &color) { m_textColor = color; }
Shinya Kitaoka 120a6e
  QColor getTextColor() const { return m_textColor; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  void setPageField(TIStream &is, const TFxP &fx, bool isVertical = true);
shun-iwasawa 8cac36
  void addGlobalControl(const TFxP &fx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  void setPageSpace();
Shinya Kitaoka 120a6e
  void beginGroup(const char *name);
Shinya Kitaoka 120a6e
  void endGroup();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void addWidget(QWidget *, bool isVertical = true);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define TOONZ_DECLARE_NEW_COMPONENT(NAME)                                      \
Shinya Kitaoka 120a6e
  QWidget *NAME(TFx *fx, const char *name)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newParamField);
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newLineEdit);
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newSlider);
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newSpinBox);
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newCheckBox);
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newRadioButton);
Shinya Kitaoka 120a6e
  TOONZ_DECLARE_NEW_COMPONENT(newComboBox);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef TOONZ_DECLARE_NEW_COMPONENT
shun-iwasawa 0ed559
shun-iwasawa 0ed559
  // make ParamsPageSet to re-compute preferred size.
shun-iwasawa 0ed559
  // currently emitted only from ToneCurveParamField
shun-iwasawa 0ed559
signals:
shun-iwasawa 0ed559
  void preferredPageSizeChanged();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Shinya Kitaoka 120a6e
/*! \brief ParamsPageSet. Contains a stack of page \b ParamsPage with relative
Shinya Kitaoka 120a6e
   tab.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
                Inherits \b QWidget.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka d1f6c4
class DVAPI ParamsPageSet final : public QWidget {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TabBarContainter *m_tabBarContainer;
Shinya Kitaoka 120a6e
  DVGui::TabBar *m_tabBar;
Shinya Kitaoka 120a6e
  QStackedWidget *m_pagesList;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ParamViewer *m_parent;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  //! Allows to map page and index, useful to display a macro.
Shinya Kitaoka 120a6e
  QMap<paramspage *,="" int=""> m_pageFxIndexTable;</paramspage>
Toshihiro Shimizu 890ddd
shun-iwasawa 0ed559
  QSize m_preferredSize;
Shinya Kitaoka 120a6e
  /*-- ヘルプのファイルパス(もしあれば)---*/
Shinya Kitaoka 120a6e
  std::string m_helpFilePath;
Shinya Kitaoka 120a6e
  /*-- pdfファイルのページ指定など、引数が必要な場合の追加引数 --*/
Shinya Kitaoka 120a6e
  std::string m_helpCommand;
Shinya Kitaoka 120a6e
  /*-- ヘルプボタンで開くURL --*/
Shinya Kitaoka 120a6e
  std::string m_helpUrl;
Shinya Kitaoka 120a6e
  QPushButton *m_helpButton;
shun-iwasawa 481b59
  // waring mark appears when the current fx does not support
shun-iwasawa 481b59
  // float / linear render settings
shun-iwasawa 481b59
  QLabel *m_warningMark;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
#if QT_VERSION >= 0x050500
Shinya Kitaoka 120a6e
  ParamsPageSet(QWidget *parent = 0, Qt::WindowFlags flags = 0);
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
  ParamsPageSet(QWidget *parent = 0, Qt::WFlags flags = 0);
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
  ~ParamsPageSet();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setFx(const TFxP ¤tFx, const TFxP &actualFx, int frame);
Shinya Kitaoka 120a6e
  void setScene(ToonzScene *scene);
Shinya Kitaoka 120a6e
  void setIsCameraViewMode(bool isCameraViewMode);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updatePage(int frame, bool onlyParam);
Shinya Kitaoka 120a6e
  /*! Create a page reading xml file relating to \b fx. */
Shinya Kitaoka 120a6e
  void createControls(const TFxP &fx, int index = -1);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ParamsPage *getCurrentParamsPage() const;
Shinya Kitaoka 120a6e
  ParamsPage *getParamsPage(int index) const;
Shinya Kitaoka 120a6e
  int getParamsPageCount() const { return (int)m_pagesList->count(); };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ParamsPage *createParamsPage();
Shinya Kitaoka 120a6e
  void addParamsPage(ParamsPage *page, const char *name);
Toshihiro Shimizu 890ddd
shun-iwasawa 0ed559
  QSize getPreferredSize() { return m_preferredSize; }
Toshihiro Shimizu 890ddd
shun-iwasawa 481b59
  void updateWarnings(const TFxP ¤tFx, bool isFloat);
shun-iwasawa 481b59
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  void createPage(TIStream &is, const TFxP &fx, int index);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  void setPage(int);
Shinya Kitaoka 120a6e
  void openHelpFile();
Shinya Kitaoka 120a6e
  void openHelpUrl();
shun-iwasawa 0ed559
  void recomputePreferredSize();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
/*! \brief ParamViewer. Contains a stack of \b ParamsPageSet.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
                Inherits \b QWidget.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka d1f6c4
class DVAPI ParamViewer final : public QFrame {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TFxP m_fx;
manongjohn b13816
  TFxP m_actualFx;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QStackedWidget *m_tablePageSet;
Shinya Kitaoka 120a6e
  QMap<std::string, int=""> m_tableFxIndex;</std::string,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
#if QT_VERSION >= 0x050500
Shinya Kitaoka 120a6e
  ParamViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
  ParamViewer(QWidget *parent = 0, Qt::WFlags flags = 0);
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
  ~ParamViewer();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setFx(const TFxP ¤tFx, const TFxP &actualFx, int frame,
Shinya Kitaoka 120a6e
             ToonzScene *scene);
Shinya Kitaoka 120a6e
  void setScene(ToonzScene *scene);
Shinya Kitaoka 120a6e
  void setIsCameraViewMode(bool isCameraViewMode);
Shinya Kitaoka 120a6e
  /*! If onlyParam is true don't invalidate raster of associated histogram. */
Shinya Kitaoka 120a6e
  void update(int frame, bool onlyParam);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setPointValue(int index, const TPointD &p);
Toshihiro Shimizu 890ddd
shun-iwasawa 0ed559
  void notifyPreferredSizeChanged(QSize size) {
shun-iwasawa 0ed559
    emit preferredSizeChanged(size);
shun-iwasawa 0ed559
  }
shun-iwasawa 0ed559
shun-iwasawa 481b59
  // show warning if the current Fx does not support float rendering
shun-iwasawa 481b59
  void updateWarnings(const TFxP ¤tFx, bool isFloat);
shun-iwasawa 481b59
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  ParamsPageSet *getCurrentPageSet() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
signals:
Shinya Kitaoka 120a6e
  void currentFxParamChanged();
Shinya Kitaoka 120a6e
  void actualFxParamChanged();
Shinya Kitaoka 120a6e
  void paramKeyChanged();
Toshihiro Shimizu 890ddd
shun-iwasawa 0ed559
  void preferredSizeChanged(QSize);
Shinya Kitaoka 120a6e
  void showSwatchButtonToggled(bool);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
/*! \brief FxSettings.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
                Inherits \b QWidget.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class QActionGroup;
Shinya Kitaoka d1f6c4
class DVAPI FxSettings final : public QSplitter {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QToolBar *m_toolBar;
Shinya Kitaoka 120a6e
  QAction *m_checkboardBg;
Shinya Kitaoka 120a6e
  ParamViewer *m_paramViewer;
Shinya Kitaoka 120a6e
  SwatchViewer *m_viewer;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TFxHandle *m_fxHandle;
Shinya Kitaoka 120a6e
  TXsheetHandle *m_xsheetHandle;
Shinya Kitaoka 120a6e
  TSceneHandle *m_sceneHandle;
Shinya Kitaoka 120a6e
  TXshLevelHandle *m_levelHandle;
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Shinya Kitaoka 120a6e
  TObjectHandle *m_objectHandle;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  FxKeyframeNavigator *m_keyframeNavigator;
Shinya Kitaoka 120a6e
  FrameNavigator *m_frameNavigator;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPixel32 m_checkCol1, m_checkCol2;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool m_isCameraModeView;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_container_height;
manongjohn b13816
  int m_container_width;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FxSettings(QWidget *parent, const TPixel32 &checkCol1,
Shinya Kitaoka 120a6e
             const TPixel32 &checkCol2);
Shinya Kitaoka 120a6e
  ~FxSettings();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Devono essere settati!
Shinya Kitaoka 120a6e
  void setFxHandle(TFxHandle *fxHandle);
Shinya Kitaoka 120a6e
  TFxHandle *getFxHandle() const { return m_fxHandle; }
Shinya Kitaoka 120a6e
  void setFrameHandle(TFrameHandle *frameHandle);
Shinya Kitaoka 120a6e
  TFrameHandle *getFrameHandle() const { return m_frameHandle; }
Shinya Kitaoka 120a6e
  void setXsheetHandle(TXsheetHandle *XsheetHandle);
Shinya Kitaoka 120a6e
  TXsheetHandle *getXsheetHandle() const { return m_xsheetHandle; }
Shinya Kitaoka 120a6e
  void setSceneHandle(TSceneHandle *sceneHandle);
Shinya Kitaoka 120a6e
  TSceneHandle *getSceneHandle() const { return m_sceneHandle; }
Shinya Kitaoka 120a6e
  void setLevelHandle(TXshLevelHandle *levelHandle);
Shinya Kitaoka 120a6e
  TXshLevelHandle *getLevelHandle() const { return m_levelHandle; }
Shinya Kitaoka 120a6e
  void setObjectHandle(TObjectHandle *objectHandle);
Shinya Kitaoka 120a6e
  TObjectHandle *getObjectHandle() const { return m_objectHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setCurrentFrame();
Shinya Kitaoka 120a6e
  void setCurrentFx();
Shinya Kitaoka 120a6e
  void setCurrentScene();
Shinya Kitaoka 120a6e
  void notifySceneChanged();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  /*! \b currentFx is fx with parent, \b actualFx is simple fx. */
Shinya Kitaoka 120a6e
  void setFx(const TFxP ¤tFx, const TFxP &actualFx);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void createToolBar();
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Shinya Kitaoka 120a6e
  void setCheckboardColors(const TPixel32 &col1, const TPixel32 &col2);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void changeTitleBar(TFx *fx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  void updateViewer();
Shinya Kitaoka 120a6e
  void updateParamViewer();
Shinya Kitaoka 120a6e
  void onPointChanged(int index, const TPointD &p);
Shinya Kitaoka 120a6e
  void onViewModeChanged(QAction *);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setWhiteBg();
Shinya Kitaoka 120a6e
  void setBlackBg();
Shinya Kitaoka 120a6e
  void setCheckboardBg();
Toshihiro Shimizu 890ddd
shun-iwasawa 0ed559
  void onPreferredSizeChanged(QSize);
Shinya Kitaoka 120a6e
  void onShowSwatchButtonToggled(bool);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // FXSETTINGS_H