2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef PARAMFIELD_H
|
|
|
|
#define PARAMFIELD_H
|
|
|
|
|
2016-04-15 17:11:23 +12:00
|
|
|
#ifdef _WIN32
|
2016-03-19 06:57:51 +13:00
|
|
|
#pragma warning(disable : 4251)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "tcommon.h"
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QSlider>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
|
|
#include "tgeometry.h"
|
|
|
|
#include "tparam.h"
|
|
|
|
#include "tnotanimatableparam.h"
|
|
|
|
#include "tspectrumparam.h"
|
|
|
|
#include "ttonecurveparam.h"
|
|
|
|
#include "tdoubleparam.h"
|
|
|
|
#include "toonz/tfxhandle.h"
|
|
|
|
#include "historytypes.h"
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
// forward declaration
|
|
|
|
class QString;
|
|
|
|
class QComboBox;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class TFxHandle;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace DVGui {
|
2016-03-19 06:57:51 +13:00
|
|
|
class LineEdit;
|
|
|
|
class IntField;
|
|
|
|
class DoubleField;
|
|
|
|
class MeasuredDoubleField;
|
|
|
|
class MeasuredDoublePairField;
|
|
|
|
class ColorField;
|
|
|
|
class SpectrumField;
|
|
|
|
class ToneCurveField;
|
|
|
|
class CheckBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*! \brief ParamField.
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
Inherits \b QWidget.
|
2016-03-19 06:57:51 +13:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI ParamField : public QWidget {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
QHBoxLayout *m_layout;
|
|
|
|
QString m_paramName;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
static TFxHandle *m_fxHandleStat;
|
|
|
|
QString m_interfaceName;
|
|
|
|
QString m_description;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ParamField(QWidget *parent, QString paramName, const TParamP ¶m,
|
|
|
|
bool addEmptyLabel = true);
|
|
|
|
~ParamField();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QString getParamName() const { return m_paramName; }
|
|
|
|
QString getUIName() const { return m_interfaceName; }
|
|
|
|
QString getDescription() const { return m_description; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual void setParam(const TParamP ¤t, const TParamP &actual,
|
|
|
|
int frame) = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual void update(int frame) = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
static ParamField *create(QWidget *parent, QString name,
|
|
|
|
const TParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual void setPointValue(const TPointD &p){};
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual QSize getPreferedSize() { return QSize(200, 28); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
static void setFxHandle(TFxHandle *fxHandle);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual void setPrecision(int precision) {}
|
2016-03-19 06:57:51 +13:00
|
|
|
signals:
|
2016-06-15 18:43:10 +12:00
|
|
|
void currentParamChanged();
|
|
|
|
void actualParamChanged();
|
|
|
|
void paramKeyToggle();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ParamFieldKeyToggle
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI ParamFieldKeyToggle : public QWidget {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
enum Status { NOT_ANIMATED, NOT_KEYFRAME, MODIFIED, KEYFRAME };
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
Status m_status;
|
|
|
|
bool m_highlighted;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ParamFieldKeyToggle(QWidget *parent,
|
|
|
|
std::string name = "ParamFieldKeyToggle");
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setStatus(Status status);
|
|
|
|
Status getStatus() const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setStatus(bool hasKeyframe, bool isKeyframe, bool hasBeenChanged);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
void mousePressEvent(QMouseEvent *);
|
|
|
|
void enterEvent(QEvent *);
|
|
|
|
void leaveEvent(QEvent *);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
signals:
|
2016-06-15 18:43:10 +12:00
|
|
|
void keyToggled();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// FxSettingsKeyToggleUndo
|
|
|
|
//=============================================================================
|
|
|
|
template <class T, class ParamP>
|
2016-06-15 18:43:10 +12:00
|
|
|
class FxSettingsKeyToggleUndo : public TUndo {
|
|
|
|
TFxHandle *m_fxHandle;
|
|
|
|
QString m_name;
|
|
|
|
bool m_wasKeyframe;
|
|
|
|
int m_frame;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
ParamP m_param;
|
|
|
|
T m_currentValue;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
FxSettingsKeyToggleUndo(ParamP param, T currentValue, bool wasKeyFrame,
|
|
|
|
QString name, int frame, TFxHandle *fxHandle)
|
|
|
|
: m_param(param)
|
|
|
|
, m_currentValue(currentValue)
|
|
|
|
, m_wasKeyframe(wasKeyFrame)
|
|
|
|
, m_name(name)
|
|
|
|
, m_frame(frame)
|
|
|
|
, m_fxHandle(fxHandle) {}
|
|
|
|
|
|
|
|
// void notify();
|
|
|
|
|
|
|
|
void undo() const {
|
|
|
|
if (m_wasKeyframe)
|
|
|
|
m_param->setValue(m_frame, m_currentValue);
|
|
|
|
else
|
|
|
|
m_param->deleteKeyframe(m_frame);
|
|
|
|
|
|
|
|
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void redo() const {
|
|
|
|
if (m_wasKeyframe)
|
|
|
|
m_param->deleteKeyframe(m_frame);
|
|
|
|
else
|
|
|
|
m_param->setValue(m_frame, m_currentValue);
|
|
|
|
|
|
|
|
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
int getSize() const { return sizeof(*this); }
|
|
|
|
int getHistoryType() { return HistoryType::Fx; }
|
|
|
|
QString getHistoryString() {
|
|
|
|
QString str =
|
|
|
|
QObject::tr("Modify Fx Param : %1 Key : %2 Frame %3")
|
|
|
|
.arg((m_wasKeyframe) ? QObject::tr("Delete") : QObject::tr("Set"))
|
|
|
|
.arg(m_name)
|
|
|
|
.arg(QString::number(m_frame + 1));
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// AnimatedParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
template <class T, class ParamP>
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI AnimatedParamField : public ParamField {
|
2016-03-19 06:57:51 +13:00
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
ParamP m_currentParam, m_actualParam;
|
|
|
|
int m_frame;
|
|
|
|
ParamFieldKeyToggle *m_keyToggle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
AnimatedParamField(QWidget *parent, QString name, const ParamP ¶m,
|
|
|
|
bool addEmptyLabel = true)
|
|
|
|
: ParamField(parent, name, param, addEmptyLabel), m_frame(0) {
|
|
|
|
m_keyToggle = new ParamFieldKeyToggle(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void updateField(T value) = 0;
|
|
|
|
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual, int frame) {
|
|
|
|
m_currentParam = current;
|
|
|
|
m_actualParam = actual;
|
|
|
|
assert(m_currentParam);
|
|
|
|
assert(m_actualParam);
|
|
|
|
update(frame);
|
|
|
|
}
|
|
|
|
void update(int frame) {
|
|
|
|
m_frame = frame;
|
|
|
|
if (!m_actualParam || !m_currentParam) return;
|
|
|
|
T value = m_actualParam->getValue(m_frame);
|
|
|
|
if (m_actualParam->isKeyframe(m_frame))
|
|
|
|
m_currentParam->setValue(m_frame, value);
|
|
|
|
else if (!m_actualParam.getPointer()->hasKeyframes())
|
|
|
|
m_currentParam->setDefaultValue(value);
|
|
|
|
updateField(value);
|
|
|
|
updateKeyToggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateKeyToggle() {
|
|
|
|
T stroke = m_actualParam->getValue(m_frame);
|
|
|
|
T stroke2 = m_currentParam->getValue(m_frame);
|
|
|
|
m_keyToggle->setStatus(
|
|
|
|
m_actualParam->hasKeyframes(), m_actualParam->isKeyframe(m_frame),
|
|
|
|
m_actualParam->getValue(m_frame) != m_currentParam->getValue(m_frame));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--
|
|
|
|
* エフェクトの位置パラメータをSwatchViewerでドラッグして編集するときに呼ばれる
|
|
|
|
* ---*/
|
|
|
|
void setValue(T value) {
|
|
|
|
if (m_currentParam->getValue(m_frame) == value) return;
|
|
|
|
m_currentParam->setValue(m_frame, value);
|
|
|
|
/*-- キーフレーム上で操作した場合 --*/
|
|
|
|
if (m_actualParam->isKeyframe(m_frame)) {
|
|
|
|
m_actualParam->setValue(m_frame, value);
|
|
|
|
emit actualParamChanged();
|
|
|
|
}
|
|
|
|
/*-- キーフレーム無い場合 --*/
|
|
|
|
else if (!m_actualParam.getPointer()->hasKeyframes()) {
|
|
|
|
m_actualParam->setDefaultValue(value);
|
|
|
|
emit actualParamChanged();
|
|
|
|
}
|
|
|
|
/*-- 他にキーフレームがあって、キーフレーム以外のフレームで操作した場合 --*/
|
|
|
|
emit currentParamChanged();
|
|
|
|
updateKeyToggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
void onKeyToggle() {
|
|
|
|
T currentVal = m_currentParam->getValue(m_frame);
|
|
|
|
bool wasKeyFrame;
|
|
|
|
|
|
|
|
if (m_keyToggle->getStatus() == ParamFieldKeyToggle::KEYFRAME) {
|
|
|
|
m_actualParam->deleteKeyframe(m_frame);
|
|
|
|
update(m_frame);
|
|
|
|
wasKeyFrame = true;
|
|
|
|
} else {
|
|
|
|
m_actualParam->setValue(m_frame, m_currentParam->getValue(m_frame));
|
|
|
|
updateKeyToggle();
|
|
|
|
wasKeyFrame = false;
|
|
|
|
}
|
|
|
|
emit actualParamChanged();
|
|
|
|
emit paramKeyToggle();
|
|
|
|
|
|
|
|
TUndoManager::manager()->add(new FxSettingsKeyToggleUndo<T, ParamP>(
|
|
|
|
m_actualParam, currentVal, wasKeyFrame, m_interfaceName, m_frame,
|
|
|
|
ParamField::m_fxHandleStat));
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// MeasuredDoubleParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI MeasuredDoubleParamField
|
|
|
|
: public AnimatedParamField<double, TDoubleParamP> {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVGui::MeasuredDoubleField *m_measuredDoubleField;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
MeasuredDoubleParamField(QWidget *parent, QString name,
|
|
|
|
const TDoubleParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateField(double value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(260, 28); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(bool);
|
|
|
|
void onKeyToggled();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// RangeParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI MeasuredRangeParamField
|
|
|
|
: public AnimatedParamField<DoublePair, TRangeParamP> {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVGui::MeasuredDoublePairField *m_valueField;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
MeasuredRangeParamField(QWidget *parent, QString name,
|
|
|
|
const TRangeParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateField(DoublePair value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(300, 20); }
|
|
|
|
void setPrecision(int precision);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(bool);
|
|
|
|
void onKeyToggled();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// PointParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI PointParamField : public AnimatedParamField<TPointD, TPointParamP> {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVGui::MeasuredDoubleField *m_xFld, *m_yFld;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
PointParamField(QWidget *parent, QString name, const TPointParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setPointValue(const TPointD &p);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateField(TPointD value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(270, 28); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(bool);
|
|
|
|
void onKeyToggled();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// PixelParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI PixelParamField
|
|
|
|
: public AnimatedParamField<TPixel32, TPixelParamP> {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVGui::ColorField *m_colorField;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
PixelParamField(QWidget *parent, QString name, const TPixelParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateField(TPixel32 value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(360, 40); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
/*-- RgbLinkButtonの実行のため --*/
|
|
|
|
TPixel32 getColor();
|
|
|
|
void setColor(TPixel32 value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParams();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(const TPixel32 &value, bool isDragging);
|
|
|
|
void onKeyToggled();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// RGB Link Button
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI RgbLinkButton : public QPushButton {
|
|
|
|
Q_OBJECT
|
|
|
|
PixelParamField *m_field1, *m_field2;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
RgbLinkButton(QString str, QWidget *parent, PixelParamField *field1,
|
|
|
|
PixelParamField *field2);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onButtonClicked();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// SpectrumParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI SpectrumParamField
|
|
|
|
: public AnimatedParamField<TSpectrum, TSpectrumParamP> {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVGui::SpectrumField *m_spectrumField;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
SpectrumParamField(QWidget *parent, QString name,
|
|
|
|
const TSpectrumParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateField(TSpectrum value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParams();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(390, 60); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onKeyToggled();
|
|
|
|
void onChange(bool isDragging);
|
|
|
|
void onKeyAdded(int keyIndex);
|
|
|
|
void onKeyRemoved(int keyIndex);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// EnumParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class EnumParamField : public ParamField {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TIntEnumParamP m_currentParam, m_actualParam;
|
|
|
|
QComboBox *m_om;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
EnumParamField(QWidget *parent, QString name, const TIntEnumParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(150, 20); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(const QString &str);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// BoolParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI BoolParamField : public ParamField {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TBoolParamP m_currentParam, m_actualParam;
|
|
|
|
DVGui::CheckBox *m_checkBox;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
BoolParamField(QWidget *parent, QString name, const TBoolParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(20, 10); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onToggled(bool checked);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
/*-- visibleToggle UIで使用する --*/
|
2016-03-19 06:57:51 +13:00
|
|
|
signals:
|
2016-06-15 18:43:10 +12:00
|
|
|
void toggled(bool);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// IntParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI IntParamField : public ParamField {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TIntParamP m_currentParam, m_actualParam;
|
|
|
|
DVGui::IntField *m_intField;
|
|
|
|
typedef IntParamField This;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
IntParamField(QWidget *parent = 0, QString name = 0,
|
|
|
|
const TIntParamP ¶m = 0);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(50, 28); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(bool isDragging = false);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// StringParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI StringParamField : public ParamField {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TStringParamP m_currentParam, m_actualParam;
|
|
|
|
DVGui::LineEdit *m_textFld;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
StringParamField(QWidget *parent, QString name, const TStringParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(100, 20); }
|
2016-03-19 06:57:51 +13:00
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ToneCurveParamField
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI ToneCurveParamField
|
|
|
|
: public AnimatedParamField<const QList<TPointD>, TToneCurveParamP> {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
DVGui::ToneCurveField *m_toneCurveField;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ToneCurveParamField(QWidget *parent, QString name,
|
|
|
|
const TToneCurveParamP ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateField(const QList<TPointD> value);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParams();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QSize getPreferedSize() { return QSize(400, 380); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChannelChanged(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void onChange(bool isDragging);
|
|
|
|
void onPointAdded(int index);
|
|
|
|
void onPointRemoved(int index);
|
|
|
|
void onIsLinearChanged(bool);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void onKeyToggled();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace component {
|
|
|
|
class DVAPI LineEdit_double : public ParamField {
|
|
|
|
Q_OBJECT; // could not use templates for Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TDoubleParamP current_;
|
|
|
|
TDoubleParamP actual_;
|
|
|
|
QLineEdit *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
LineEdit_double(QWidget *parent, QString name, TDoubleParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(QString const &text); // could not use MACROs for slots
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI Slider_double : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TDoubleParamP current_;
|
|
|
|
TDoubleParamP actual_;
|
|
|
|
QSlider *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
Slider_double(QWidget *parent, QString name, TDoubleParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI SpinBox_double : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TDoubleParamP current_;
|
|
|
|
TDoubleParamP actual_;
|
|
|
|
QDoubleSpinBox *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
SpinBox_double(QWidget *parent, QString name, TDoubleParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(double);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace component {
|
|
|
|
class DVAPI LineEdit_int : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TIntParamP current_;
|
|
|
|
TIntParamP actual_;
|
|
|
|
QLineEdit *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
LineEdit_int(QWidget *parent, QString name, TIntParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(QString const &text);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI Slider_int : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TIntParamP current_;
|
|
|
|
TIntParamP actual_;
|
|
|
|
QSlider *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
Slider_int(QWidget *parent, QString name, TIntParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI SpinBox_int : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TIntParamP current_;
|
|
|
|
TIntParamP actual_;
|
|
|
|
QSpinBox *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
SpinBox_int(QWidget *parent, QString name, TIntParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
} // end of namespace component
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace component {
|
|
|
|
class DVAPI CheckBox_bool : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TBoolParamP current_;
|
|
|
|
TBoolParamP actual_;
|
|
|
|
QCheckBox *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
CheckBox_bool(QWidget *parent, QString name, TBoolParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
} // end of namespace component
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace component {
|
|
|
|
class DVAPI RadioButton_enum : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TIntEnumParamP current_;
|
|
|
|
TIntEnumParamP actual_;
|
|
|
|
QButtonGroup *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
RadioButton_enum(QWidget *parent, QString name, TIntEnumParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI ComboBox_enum : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TIntEnumParamP current_;
|
|
|
|
TIntEnumParamP actual_;
|
|
|
|
QComboBox *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ComboBox_enum(QWidget *parent, QString name, TIntEnumParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(int);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
2016-06-15 18:43:10 +12:00
|
|
|
} // end of namespace component
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace component {
|
|
|
|
class DVAPI LineEdit_string : public ParamField {
|
|
|
|
Q_OBJECT;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int frame_;
|
|
|
|
TStringParamP current_;
|
|
|
|
TStringParamP actual_;
|
|
|
|
QLineEdit *value_;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
LineEdit_string(QWidget *parent, QString name, TStringParamP const ¶m);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual, int frame);
|
|
|
|
void update(int frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void update_value(QString const &);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
2016-06-15 18:43:10 +12:00
|
|
|
} // end of namespace component
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#define TOONZ_DECLARE_MAKE_WIDGET(NAME) \
|
|
|
|
ParamField *NAME(QWidget *parent, QString name, TParamP const ¶m)
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_lineedit);
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_slider);
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_spinbox);
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_checkbox);
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_radiobutton);
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_combobox);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // PARAMFIELD_H
|