Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
#ifndef TNOTANIMATABLEPARAM_H
Toshihiro Shimizu 890ddd
#define TNOTANIMATABLEPARAM_H
Toshihiro Shimizu 890ddd
Shinya Kitaoka 262a92
#include <memory></memory>
Shinya Kitaoka 262a92
Toshihiro Shimizu 890ddd
#include "tparam.h"
Toshihiro Shimizu 890ddd
#include "tparamchange.h"
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
#include "texception.h"
Toshihiro Shimizu 890ddd
#include "tundo.h"
Toshihiro Shimizu 890ddd
#include "tconvert.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TPARAM_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
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  TNotAnimatableParamChange
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
e280ae
#ifdef _MSC_VER
Toshihiro Shimizu 890ddd
#pragma warning(push)
Toshihiro Shimizu 890ddd
#pragma warning(disable : 4251)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka d1f6c4
class TNotAnimatableParamChange final : public TParamChange {
Shinya Kitaoka 120a6e
  T m_oldValue;
Shinya Kitaoka 120a6e
  T m_newValue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TNotAnimatableParamChange(TParam *param, const T &oldValue, const T &newValue,
Shinya Kitaoka 120a6e
                            bool undoing)
Shinya Kitaoka 120a6e
      : TParamChange(param, TParamChange::m_minFrame, TParamChange::m_maxFrame,
Shinya Kitaoka 120a6e
                     false, false, undoing)
Shinya Kitaoka 120a6e
      , m_oldValue(oldValue)
Shinya Kitaoka 120a6e
      , m_newValue(newValue) {}
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TParamChange *clone() const {
Shinya Kitaoka 120a6e
    return new TNotAnimatableParamChange<t>(*this);</t>
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  TUndo *createUndo() const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  TNotAnimatableParamChangeUndo
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka d1f6c4
class TNotAnimatableParamChangeUndo final : public TUndo {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TNotAnimatableParamChangeUndo(TParam *param, const T &oldValue,
Shinya Kitaoka 120a6e
                                const T &newValue);
Shinya Kitaoka 120a6e
  ~TNotAnimatableParamChangeUndo();
Shinya Kitaoka 473e70
  void undo() const override;
Shinya Kitaoka 473e70
  void redo() const override;
Shinya Kitaoka 473e70
  int getSize() const override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TParam *m_param;
Shinya Kitaoka 120a6e
  T m_oldValue;
Shinya Kitaoka 120a6e
  T m_newValue;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  TNotAnimatableParamObserver
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
class TNotAnimatableParamObserver : public TParamObserver {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TNotAnimatableParamObserver() {}
Shinya Kitaoka 473e70
Shinya Kitaoka 473e70
  void onChange(const TParamChange &) override = 0;
Shinya Kitaoka 120a6e
  void onChange(const TNotAnimatableParamChange<t> &change) {</t>
Shinya Kitaoka 120a6e
    onChange(static_cast<const &="" tparamchange="">(change));</const>
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef TNotAnimatableParamObserver<int> TIntParamObserver;</int>
Toshihiro Shimizu 890ddd
typedef TNotAnimatableParamObserver<bool> TBoolParamObserver;</bool>
Toshihiro Shimizu 890ddd
typedef TNotAnimatableParamObserver<tfilepath> TFilePathParamObserver;</tfilepath>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//    TNotAnimatableParam base class
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
using std::set;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
class DVAPI TNotAnimatableParam : public TParam {
Shinya Kitaoka 120a6e
  T m_defaultValue, m_value;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  set<tnotanimatableparamobserver<t> *> m_observers;</tnotanimatableparamobserver<t>
Shinya Kitaoka 120a6e
  set<tparamobserver *=""> m_paramObservers;</tparamobserver>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TNotAnimatableParam(T def = T())
Shinya Kitaoka 120a6e
      : TParam(), m_defaultValue(def), m_value(def){};
Shinya Kitaoka 120a6e
  TNotAnimatableParam(const TNotAnimatableParam &src)
Shinya Kitaoka 120a6e
      : TParam(src.getName())
Shinya Kitaoka 120a6e
      , m_defaultValue(src.getDefaultValue())
Shinya Kitaoka 120a6e
      , m_value(src.getValue()){};
Shinya Kitaoka 120a6e
  ~TNotAnimatableParam(){};
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  T getValue() const { return m_value; }
Shinya Kitaoka 120a6e
  T getDefaultValue() const { return m_defaultValue; }
Shinya Kitaoka 120a6e
  void setValue(T v, bool undoing = false) {
Shinya Kitaoka 120a6e
    if (m_value == v) return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TNotAnimatableParamChange<t> change(this, m_value, v, undoing);</t>
Shinya Kitaoka 120a6e
    m_value = v;
Shinya Kitaoka 120a6e
    for (typename std::set<tnotanimatableparamobserver<t> *>::iterator obsIt =</tnotanimatableparamobserver<t>
Shinya Kitaoka 120a6e
             m_observers.begin();
Shinya Kitaoka 120a6e
         obsIt != m_observers.end(); ++obsIt)
Shinya Kitaoka 120a6e
      (*obsIt)->onChange(change);
Shinya Kitaoka 120a6e
    for (std::set<tparamobserver *="">::iterator parObsIt =</tparamobserver>
Shinya Kitaoka 120a6e
             m_paramObservers.begin();
Shinya Kitaoka 120a6e
         parObsIt != m_paramObservers.end(); ++parObsIt)
Shinya Kitaoka 120a6e
      (*parObsIt)->onChange(change);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setDefaultValue(T value) { m_defaultValue = value; }
Shinya Kitaoka 473e70
  void copy(TParam *src) override {
Shinya Kitaoka 120a6e
    TNotAnimatableParam<t> *p = dynamic_cast<tnotanimatableparam<t> *>(src);</tnotanimatableparam<t></t>
Shinya Kitaoka 120a6e
    if (!p) throw TException("invalid source for copy");
Shinya Kitaoka 120a6e
    setName(src->getName());
Shinya Kitaoka 120a6e
    m_defaultValue = p->m_defaultValue;
Shinya Kitaoka 120a6e
    m_value        = p->m_value;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void reset(bool undoing = false) { setValue(m_defaultValue, undoing); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void addObserver(TParamObserver *observer) override {
Shinya Kitaoka 120a6e
    TNotAnimatableParamObserver<t> *obs =</t>
Shinya Kitaoka 120a6e
        dynamic_cast<tnotanimatableparamobserver<t> *>(observer);</tnotanimatableparamobserver<t>
Shinya Kitaoka 120a6e
    if (obs)
Shinya Kitaoka 120a6e
      m_observers.insert(obs);
Shinya Kitaoka 120a6e
    else
Shinya Kitaoka 120a6e
      m_paramObservers.insert(observer);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 473e70
  void removeObserver(TParamObserver *observer) override {
Shinya Kitaoka 120a6e
    TNotAnimatableParamObserver<t> *obs =</t>
Shinya Kitaoka 120a6e
        dynamic_cast<tnotanimatableparamobserver<t> *>(observer);</tnotanimatableparamobserver<t>
Shinya Kitaoka 120a6e
    if (obs)
Shinya Kitaoka 120a6e
      m_observers.erase(obs);
Shinya Kitaoka 120a6e
    else
Shinya Kitaoka 120a6e
      m_paramObservers.erase(observer);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  bool isAnimatable() const override { return false; }
Shinya Kitaoka 473e70
  bool isKeyframe(double) const override { return false; }
Shinya Kitaoka 473e70
  void deleteKeyframe(double) override {}
Shinya Kitaoka 473e70
  void clearKeyframes() override {}
Shinya Kitaoka 38fd86
  void assignKeyframe(double, const TSmartPointerT<tparam> &, double,</tparam>
Shinya Kitaoka 38fd86
                      bool) override {}
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  std::string getValueAlias(double, int) override {
Shinya Kitaoka 120a6e
    using namespace std;
Shinya Kitaoka 120a6e
    return to_string(getValue());
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 473e70
  bool hasKeyframes() const override { return 0; };
Shinya Kitaoka 38fd86
  void getKeyframes(std::set<double> &) const override{};</double>
Shinya Kitaoka 473e70
  int getNextKeyframe(double) const override { return -1; };
Shinya Kitaoka 473e70
  int getPrevKeyframe(double) const override { return -1; };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//  class TIntParam
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TNotAnimatableParam<int>;</int>
Toshihiro Shimizu 890ddd
class TIntParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tintparam>;</tintparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TIntParam final : public TNotAnimatableParam<int> {</int>
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TIntParam);
Shinya Kitaoka 120a6e
  int minValue, maxValue;
Shinya Kitaoka 120a6e
  bool m_isWheelEnabled;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TIntParam(int v = int())
Shinya Kitaoka 120a6e
      : TNotAnimatableParam<int>(v)</int>
Shinya Kitaoka 120a6e
      , minValue(-(std::numeric_limits<int>::max)())</int>
Shinya Kitaoka 120a6e
      , maxValue((std::numeric_limits<int>::max)())</int>
Shinya Kitaoka 120a6e
      , m_isWheelEnabled(false) {}
Shinya Kitaoka 120a6e
  TIntParam(const TIntParam &src) : TNotAnimatableParam<int>(src) {}</int>
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TIntParam(*this); }
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Shinya Kitaoka 120a6e
  void enableWheel(bool on);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool isWheelEnabled() const;
Shinya Kitaoka 120a6e
  void setValueRange(int min, int max);
Shinya Kitaoka 120a6e
  bool getValueRange(int &min, int &max) const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TIntParam, int)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//  class TBoolParam
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TNotAnimatableParam<bool>;</bool>
Toshihiro Shimizu 890ddd
class TBoolParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tboolparam>;</tboolparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TBoolParam final : public TNotAnimatableParam<bool> {</bool>
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TBoolParam);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TBoolParam(bool v = bool()) : TNotAnimatableParam<bool>(v) {}</bool>
Shinya Kitaoka 120a6e
  TBoolParam(const TBoolParam &src) : TNotAnimatableParam<bool>(src) {}</bool>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TBoolParam(*this); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TBoolParam, bool)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//  class TFilePathParam
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TNotAnimatableParam<tfilepath>;</tfilepath>
Toshihiro Shimizu 890ddd
class TFilePathParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tfilepathparam>;</tfilepathparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TFilePathParam final : public TNotAnimatableParam<tfilepath> {</tfilepath>
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TFilePathParam);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TFilePathParam(const TFilePath &v = TFilePath())
Shinya Kitaoka 120a6e
      : TNotAnimatableParam<tfilepath>(v) {}</tfilepath>
Shinya Kitaoka 120a6e
  TFilePathParam(const TFilePathParam &src)
Shinya Kitaoka 120a6e
      : TNotAnimatableParam<tfilepath>(src) {}</tfilepath>
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TFilePathParam(*this); }
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TFilePathParam, TFilePath)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//  class TStringParam
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TNotAnimatableParam<std::wstring>;</std::wstring>
Toshihiro Shimizu 890ddd
class TStringParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tstringparam>;</tstringparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TStringParam final : public TNotAnimatableParam<std::wstring> {</std::wstring>
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TStringParam);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TStringParam(std::wstring v = L"") : TNotAnimatableParam<std::wstring>(v) {}</std::wstring>
Shinya Kitaoka 120a6e
  TStringParam(const TStringParam &src)
Shinya Kitaoka 120a6e
      : TNotAnimatableParam<std::wstring>(src) {}</std::wstring>
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TStringParam(*this); }
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
DEFINE_PARAM_SMARTPOINTER(TStringParam, std::wstring)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//  class TEnumParam
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TEnumParamImp;
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TEnumParam final : public TNotAnimatableParam<int> {</int>
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TEnumParam)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TEnumParam(const int &v, const std::string &caption);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TEnumParam();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TEnumParam(const TEnumParam &src);
Shinya Kitaoka 120a6e
  ~TEnumParam();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TEnumParam(*this); }
Shinya Kitaoka 473e70
  void copy(TParam *src) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setValue(int v, bool undoing = false);
Shinya Kitaoka 120a6e
  void setValue(const std::string &caption, bool undoing = false);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void addItem(const int &item, const std::string &caption);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getItemCount() const;
Shinya Kitaoka 120a6e
  void getItem(int i, int &item, std::string &caption) const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // TPersist methods
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  std::unique_ptr<tenumparamimp> m_imp;</tenumparamimp>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef TEnumParam TIntEnumParam;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef TNotAnimatableParamObserver<tintenumparam> TIntEnumParamObserver;</tintenumparam>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI_PARAM_SMARTPOINTER(TIntEnumParam)
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TIntEnumParamP final
Shinya Kitaoka 120a6e
    : public TDerivedSmartPointerT<tintenumparam, tparam=""> {</tintenumparam,>
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TIntEnumParamP(TIntEnumParam *p = 0) : DerivedSmartPointer(p) {}
Shinya Kitaoka 120a6e
  TIntEnumParamP(int v, const std::string &caption)
Shinya Kitaoka 120a6e
      : DerivedSmartPointer(new TEnumParam(v, caption)) {}
Shinya Kitaoka 120a6e
  TIntEnumParamP(TParamP &p) : DerivedSmartPointer(p) {}
Shinya Kitaoka 120a6e
  TIntEnumParamP(const TParamP &p) : DerivedSmartPointer(p) {}
Shinya Kitaoka 120a6e
  operator TParamP() const { return TParamP(m_pointer); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//  class TNADoubleParam   //is a not animatable double param
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TNotAnimatableParam<double>;</double>
Toshihiro Shimizu 890ddd
class TNADoubleParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tnadoubleparam>;</tnadoubleparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TNADoubleParam final : public TNotAnimatableParam<double> {</double>
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TNADoubleParam);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TNADoubleParam(double v = double())
Shinya Kitaoka 120a6e
      : TNotAnimatableParam<double>(v), m_min(0.), m_max(100.) {}</double>
Shinya Kitaoka 120a6e
  TNADoubleParam(const TNADoubleParam &src)
Shinya Kitaoka 120a6e
      : TNotAnimatableParam<double>(src) {}</double>
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TNADoubleParam(*this); }
Shinya Kitaoka 120a6e
  void setValueRange(double min, double max) {
Shinya Kitaoka 120a6e
    m_min = min;
Shinya Kitaoka 120a6e
    m_max = max;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void setValue(double v, bool undoing = false) {
Shinya Kitaoka 120a6e
    notMoreThan(m_max, v);
Shinya Kitaoka 120a6e
    notLessThan(m_min, v);
Shinya Kitaoka 120a6e
    TNotAnimatableParam<double>::setValue(v, undoing);</double>
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  bool getValueRange(double &min, double &max) const {
Shinya Kitaoka 120a6e
    min = m_min;
Shinya Kitaoka 120a6e
    max = m_max;
Shinya Kitaoka 120a6e
    return min < max;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  double m_min, m_max;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TNADoubleParam, double)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  TNotAnimatableParamChangeUndo
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
TNotAnimatableParamChangeUndo<t>::TNotAnimatableParamChangeUndo(</t>
Shinya Kitaoka 120a6e
    TParam *param, const T &oldValue, const T &newValue)
Shinya Kitaoka 120a6e
    : m_param(param), m_oldValue(oldValue), m_newValue(newValue) {
Shinya Kitaoka 120a6e
  m_param->addRef();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
TNotAnimatableParamChangeUndo<t>::~TNotAnimatableParamChangeUndo() {</t>
Shinya Kitaoka 120a6e
  m_param->release();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
void TNotAnimatableParamChangeUndo<t>::undo() const {</t>
Shinya Kitaoka 120a6e
  TNotAnimatableParam<t> *p = dynamic_cast<tnotanimatableparam<t> *>(m_param);</tnotanimatableparam<t></t>
Shinya Kitaoka 120a6e
  p->setValue(m_oldValue, true);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
void TNotAnimatableParamChangeUndo<t>::redo() const {</t>
Shinya Kitaoka 120a6e
  TNotAnimatableParam<t> *p = dynamic_cast<tnotanimatableparam<t> *>(m_param);</tnotanimatableparam<t></t>
Shinya Kitaoka 120a6e
  p->setValue(m_newValue, true);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
int TNotAnimatableParamChangeUndo<t>::getSize() const {</t>
Shinya Kitaoka 120a6e
  return sizeof(*this);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  TNotAnimatableParamChange
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
TUndo *TNotAnimatableParamChange<t>::createUndo() const {</t>
Shinya Kitaoka 120a6e
  return new TNotAnimatableParamChangeUndo<t>(m_param, m_oldValue, m_newValue);</t>
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
e280ae
#ifdef _MSC_VER
Toshihiro Shimizu 890ddd
#pragma warning(pop)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif