|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/paramfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/fxsettings.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/intfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/spectrumfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/colorfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/doublepairfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/tonecurvefield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/checkbox.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tdoubleparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tnotanimatableparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tparamset.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/stringtable.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qstring></qstring>
|
|
Toshihiro Shimizu |
890ddd |
#include <qhboxlayout></qhboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlabel></qlabel>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpainter></qpainter>
|
|
Toshihiro Shimizu |
890ddd |
#include <qcombobox></qcombobox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace DVGui;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! FxSettingsに共通のUndo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
class FxSettingsUndo : public TUndo {
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *m_fxHandle;
|
|
Shinya Kitaoka |
120a6e |
QString m_name;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
FxSettingsUndo(QString name, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: m_name(name), m_fxHandle(fxHandle) {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
int getSize() const override { return sizeof(*this); }
|
|
Shinya Kitaoka |
473e70 |
int getHistoryType() override { return HistoryType::Fx; }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class AnimatableFxSettingsUndo : public FxSettingsUndo {
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
bool m_wasKeyframe;
|
|
Shinya Kitaoka |
120a6e |
int m_frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
AnimatableFxSettingsUndo(QString name, int frame, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle), m_frame(frame) {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str = QObject::tr("Modify Fx Param : %1").arg(m_name);
|
|
Shinya Kitaoka |
120a6e |
if (m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
str += QString(" Frame : %1").arg(QString::number(m_frame + 1));
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
str += QString(" (Default Value)");
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! MeasuredDoubleParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class MeasuredDoubleParamFieldUndo final : public AnimatableFxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
double m_oldValue, m_newValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
MeasuredDoubleParamFieldUndo(const TDoubleParamP param, QString name,
|
|
Shinya Kitaoka |
120a6e |
int frame, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: AnimatableFxSettingsUndo(name, frame, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldValue = param->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
m_newValue = m_oldValue;
|
|
Shinya Kitaoka |
120a6e |
m_wasKeyframe = m_param->isKeyframe(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newValue = m_param->getValue(m_frame); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_newValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_newValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! RangeParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class RangeParamFieldUndo final : public AnimatableFxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TRangeParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
DoublePair m_oldValue, m_newValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
RangeParamFieldUndo(const TRangeParamP param, QString name, int frame,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: AnimatableFxSettingsUndo(name, frame, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldValue = param->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
m_newValue = m_oldValue;
|
|
Shinya Kitaoka |
120a6e |
m_wasKeyframe = m_param->isKeyframe(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newValue = m_param->getValue(m_frame); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_newValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_newValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! PixelParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class PixelParamFieldUndo final : public AnimatableFxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TPixelParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
TPixel32 m_oldValue, m_newValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
PixelParamFieldUndo(const TPixelParamP param, QString name, int frame,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: AnimatableFxSettingsUndo(name, frame, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldValue = param->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
m_newValue = m_oldValue;
|
|
Shinya Kitaoka |
120a6e |
m_wasKeyframe = m_param->isKeyframe(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newValue = m_param->getValue(m_frame); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_newValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_newValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! PointParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class PointParamFieldUndo final : public AnimatableFxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TPointParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
TPointD m_oldValue, m_newValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
PointParamFieldUndo(const TPointParamP param, QString name, int frame,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: AnimatableFxSettingsUndo(name, frame, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldValue = param->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
m_newValue = m_oldValue;
|
|
Shinya Kitaoka |
120a6e |
m_wasKeyframe = m_param->isKeyframe(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newValue = m_param->getValue(m_frame); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_newValue);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_newValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! EnumParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class EnumParamFieldUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
std::string m_oldString, m_newString;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
EnumParamFieldUndo(const TIntEnumParamP param, std::string oldString,
|
|
Shinya Kitaoka |
120a6e |
std::string newString, QString name, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle)
|
|
Shinya Kitaoka |
120a6e |
, m_param(param)
|
|
Shinya Kitaoka |
120a6e |
, m_oldString(oldString)
|
|
Shinya Kitaoka |
120a6e |
, m_newString(newString) {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_oldString);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_newString);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str = QObject::tr("Modify Fx Param : %1 : %2 -> %3")
|
|
Shinya Kitaoka |
120a6e |
.arg(m_name)
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::fromStdString(m_oldString))
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::fromStdString(m_newString));
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! IntParamFieldのUndo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class IntParamFieldUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TIntParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
int m_oldValue, m_newValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
IntParamFieldUndo(const TIntParamP param, QString name, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldValue = param->getValue();
|
|
Shinya Kitaoka |
120a6e |
m_newValue = m_oldValue;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newValue = m_param->getValue(); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_newValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str = QObject::tr("Modify Fx Param : %1 : %2 -> %3")
|
|
Shinya Kitaoka |
120a6e |
.arg(m_name)
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::number(m_oldValue))
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::number(m_newValue));
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! BoolParamFieldのUndo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class BoolParamFieldUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
bool m_newState;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
BoolParamFieldUndo(const TBoolParamP param, QString name, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_newState = param->getValue();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(!m_newState);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_newState);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str = QObject::tr("Modify Fx Param : ");
|
|
Shinya Kitaoka |
120a6e |
if (m_newState)
|
|
Shinya Kitaoka |
120a6e |
str += QObject::tr("ON : %1").arg(m_name);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
str += QObject::tr("OFF : %1").arg(m_name);
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! SpectrumParamFieldのUndo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class SpectrumParamFieldUndo final : public AnimatableFxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
TSpectrum m_oldSpectrum, m_newSpectrum;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SpectrumParamFieldUndo(const TSpectrumParamP param, QString name, int frame,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: AnimatableFxSettingsUndo(name, frame, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldSpectrum = param->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
m_newSpectrum = m_oldSpectrum;
|
|
Shinya Kitaoka |
120a6e |
m_wasKeyframe = m_param->isKeyframe(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newSpectrum = m_param->getValue(m_frame); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_oldSpectrum);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_oldSpectrum);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_newSpectrum);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_newSpectrum);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! SpectrumParamField Undo
|
|
Shinya Kitaoka |
120a6e |
※
|
|
Shinya Kitaoka |
120a6e |
SpectrumParamFieldは、表示更新時にactualParamとcurrentParamのKeyの数が
|
|
Shinya Kitaoka |
120a6e |
一致していなくてはならないので、2つ同時に変更する必要が有る。
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class SpectrumParamFieldAddRemoveKeyUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
TSpectrum::ColorKey m_key;
|
|
Shinya Kitaoka |
120a6e |
int m_index;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_isAddUndo;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SpectrumParamFieldAddRemoveKeyUndo(const TSpectrumParamP actualParam,
|
|
Shinya Kitaoka |
120a6e |
const TSpectrumParamP currentParam,
|
|
Shinya Kitaoka |
120a6e |
TSpectrum::ColorKey key, int index,
|
|
Shinya Kitaoka |
120a6e |
bool isAddUndo, QString name,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle)
|
|
Shinya Kitaoka |
120a6e |
, m_actualParam(actualParam)
|
|
Shinya Kitaoka |
120a6e |
, m_currentParam(currentParam)
|
|
Shinya Kitaoka |
120a6e |
, m_key(key)
|
|
Shinya Kitaoka |
120a6e |
, m_index(index)
|
|
Shinya Kitaoka |
120a6e |
, m_isAddUndo(isAddUndo) {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void removeKeys() const {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->removeKey(m_index);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->removeKey(m_index);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void addKeys() const {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->insertKey(m_index, m_key.first, m_key.second);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->insertKey(m_index, m_key.first, m_key.second);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (m_isAddUndo)
|
|
Shinya Kitaoka |
120a6e |
removeKeys();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
addKeys();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (m_isAddUndo)
|
|
Shinya Kitaoka |
120a6e |
addKeys();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
removeKeys();
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str =
|
|
Shinya Kitaoka |
120a6e |
QObject::tr("Modify Fx Param : %1 : %2 Key")
|
|
Shinya Kitaoka |
120a6e |
.arg(m_name)
|
|
Shinya Kitaoka |
120a6e |
.arg((m_isAddUndo) ? QObject::tr("Add") : QObject::tr("Remove"));
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! StringParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class StringParamFieldUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TStringParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
std::wstring m_oldValue, m_newValue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
StringParamFieldUndo(const TStringParamP param, QString name,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldValue = param->getValue();
|
|
Shinya Kitaoka |
120a6e |
m_newValue = m_oldValue;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newValue = m_param->getValue(); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_oldValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_newValue);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str = QObject::tr("Modify Fx Param : %1 : %2 -> %3")
|
|
Shinya Kitaoka |
120a6e |
.arg(m_name)
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::fromStdWString(m_oldValue))
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::fromStdWString(m_newValue));
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! ToneCurveParamField Undo
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class ToneCurveParamFieldUndo final : public AnimatableFxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP m_param;
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> m_oldPoints, m_newPoints;</tpointd>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ToneCurveParamFieldUndo(const TToneCurveParamP param, QString name, int frame,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: AnimatableFxSettingsUndo(name, frame, fxHandle), m_param(param) {
|
|
Shinya Kitaoka |
120a6e |
m_oldPoints = param->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
m_newPoints = m_oldPoints;
|
|
Shinya Kitaoka |
120a6e |
m_wasKeyframe = m_param->isKeyframe(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void onAdd() override { m_newPoints = m_param->getValue(m_frame); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_oldPoints);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_oldPoints);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_wasKeyframe)
|
|
Shinya Kitaoka |
120a6e |
m_param->setDefaultValue(m_newPoints);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_param->setValue(m_frame, m_newPoints);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! ToneCurveParamField Undo
|
|
Shinya Kitaoka |
120a6e |
※
|
|
Shinya Kitaoka |
120a6e |
ToneCurveParamFieldは、表示更新時にactualParamとcurrentParamのPointの数が
|
|
Shinya Kitaoka |
120a6e |
一致していなくてはならないので、2つ同時に変更する必要が有る。
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class ToneCurveParamFieldAddRemovePointUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> m_value;</tpointd>
|
|
Shinya Kitaoka |
120a6e |
int m_index;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_isAddUndo;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ToneCurveParamFieldAddRemovePointUndo(const TToneCurveParamP actualParam,
|
|
Shinya Kitaoka |
120a6e |
const TToneCurveParamP currentParam,
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> value, int index,</tpointd>
|
|
Shinya Kitaoka |
120a6e |
bool isAddUndo, QString name,
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle)
|
|
Shinya Kitaoka |
120a6e |
, m_actualParam(actualParam)
|
|
Shinya Kitaoka |
120a6e |
, m_currentParam(currentParam)
|
|
Shinya Kitaoka |
120a6e |
, m_value(value)
|
|
Shinya Kitaoka |
120a6e |
, m_index(index)
|
|
Shinya Kitaoka |
120a6e |
, m_isAddUndo(isAddUndo) {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void removePoints() const {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->removeValue(0, m_index);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->removeValue(0, m_index);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void addPoints() const {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->addValue(0, m_value, m_index);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->addValue(0, m_value, m_index);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (m_isAddUndo)
|
|
Shinya Kitaoka |
120a6e |
removePoints();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
addPoints();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
if (m_isAddUndo)
|
|
Shinya Kitaoka |
120a6e |
addPoints();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
removePoints();
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str =
|
|
Shinya Kitaoka |
120a6e |
QObject::tr("Modify Fx Param : %1 : %2 Point")
|
|
Shinya Kitaoka |
120a6e |
.arg(m_name)
|
|
Shinya Kitaoka |
120a6e |
.arg((m_isAddUndo) ? QObject::tr("Add") : QObject::tr("Remove"));
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! ToneCurveParamField Undo (Linearのトグル)
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class ToneCurveParamFieldToggleLinearUndo final : public FxSettingsUndo {
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
bool m_newState;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ToneCurveParamFieldToggleLinearUndo(const TToneCurveParamP actualParam,
|
|
Shinya Kitaoka |
120a6e |
const TToneCurveParamP currentParam,
|
|
Shinya Kitaoka |
120a6e |
QString name, TFxHandle *fxHandle)
|
|
Shinya Kitaoka |
120a6e |
: FxSettingsUndo(name, fxHandle)
|
|
Shinya Kitaoka |
120a6e |
, m_actualParam(actualParam)
|
|
Shinya Kitaoka |
120a6e |
, m_currentParam(currentParam) {
|
|
Shinya Kitaoka |
120a6e |
m_newState = actualParam->isLinear();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void undo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setIsLinear(!m_newState);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setIsLinear(!m_newState);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void redo() const override {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setIsLinear(m_newState);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setIsLinear(m_newState);
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
QString getHistoryString() override {
|
|
Shinya Kitaoka |
120a6e |
QString str = QObject::tr("Modify Fx Param : ");
|
|
Shinya Kitaoka |
120a6e |
if (m_newState)
|
|
Shinya Kitaoka |
120a6e |
str += QObject::tr("%1 : Linear ON").arg(m_name);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
str += QObject::tr("%1 : Linear OFF").arg(m_name);
|
|
Shinya Kitaoka |
120a6e |
return str;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ParamField::ParamField(QWidget *parent, QString paramName, const TParamP ¶m,
|
|
Shinya Kitaoka |
120a6e |
bool addEmptyLabel)
|
|
Shinya Kitaoka |
120a6e |
: QWidget(parent)
|
|
Shinya Kitaoka |
120a6e |
, m_paramName(paramName)
|
|
Shinya Kitaoka |
120a6e |
, m_interfaceName(param->hasUILabel()
|
|
Shinya Kitaoka |
120a6e |
? QString::fromStdString(param->getUILabel())
|
|
Shinya Kitaoka |
120a6e |
: paramName)
|
|
Shinya Kitaoka |
120a6e |
, m_description(QString::fromStdString(param->getDescription())) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_layout = new QHBoxLayout(this);
|
|
Shinya Kitaoka |
120a6e |
m_layout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
m_layout->setSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField::~ParamField() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxHandle *ParamField::m_fxHandleStat = 0;
|
|
Shinya Kitaoka |
120a6e |
void ParamField::setFxHandle(TFxHandle *fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat = fxHandle;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ParamFieldKeyToggle
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
ParamFieldKeyToggle::ParamFieldKeyToggle(QWidget *parent, std::string name)
|
|
Shinya Kitaoka |
120a6e |
: QWidget(parent), m_status(NOT_ANIMATED), m_highlighted(false) {
|
|
Shinya Kitaoka |
120a6e |
setFixedSize(15, 15);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamFieldKeyToggle::setStatus(Status status) {
|
|
Shinya Kitaoka |
120a6e |
m_status = status;
|
|
Shinya Kitaoka |
120a6e |
update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamFieldKeyToggle::setStatus(bool hasKeyframes, bool isKeyframe,
|
|
Shinya Kitaoka |
120a6e |
bool hasBeenChanged) {
|
|
Shinya Kitaoka |
120a6e |
if (!hasKeyframes)
|
|
Shinya Kitaoka |
120a6e |
setStatus(NOT_ANIMATED);
|
|
Shinya Kitaoka |
120a6e |
else if (hasBeenChanged)
|
|
Shinya Kitaoka |
120a6e |
setStatus(MODIFIED);
|
|
Shinya Kitaoka |
120a6e |
else if (isKeyframe)
|
|
Shinya Kitaoka |
120a6e |
setStatus(KEYFRAME);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
setStatus(NOT_KEYFRAME);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamFieldKeyToggle::Status ParamFieldKeyToggle::getStatus() const {
|
|
Shinya Kitaoka |
120a6e |
return m_status;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamFieldKeyToggle::paintEvent(QPaintEvent *e) {
|
|
Shinya Kitaoka |
120a6e |
QPainter p(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
switch (m_status) {
|
|
Shinya Kitaoka |
120a6e |
case NOT_ANIMATED:
|
|
Shinya Kitaoka |
120a6e |
p.drawPixmap(rect(), QPixmap(":Resources/keyframe_noanim.png"));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case KEYFRAME:
|
|
Shinya Kitaoka |
120a6e |
p.drawPixmap(rect(), QPixmap(":Resources/keyframe_key.png"));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case MODIFIED:
|
|
Shinya Kitaoka |
120a6e |
p.drawPixmap(rect(), QPixmap(":Resources/keyframe_modified.png"));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
p.drawPixmap(rect(), QPixmap(":Resources/keyframe_inbetween.png"));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (m_highlighted) {
|
|
Shinya Kitaoka |
120a6e |
p.fillRect(rect(), QBrush(QColor(50, 100, 255, 100)));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamFieldKeyToggle::mousePressEvent(QMouseEvent *e) { emit keyToggled(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamFieldKeyToggle::enterEvent(QEvent *) {
|
|
Shinya Kitaoka |
120a6e |
m_highlighted = true;
|
|
Shinya Kitaoka |
120a6e |
update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamFieldKeyToggle::leaveEvent(QEvent *) {
|
|
Shinya Kitaoka |
120a6e |
m_highlighted = false;
|
|
Shinya Kitaoka |
120a6e |
update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// MeasuredDoubleParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
MeasuredDoubleParamField::MeasuredDoubleParamField(QWidget *parent,
|
|
Shinya Kitaoka |
120a6e |
QString name,
|
|
Shinya Kitaoka |
120a6e |
const TDoubleParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: AnimatedParamField<double, tdoubleparamp="">(parent, name, param) {</double,>
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField = new MeasuredDoubleField(this, false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField->setSizePolicy(QSizePolicy::Expanding,
|
|
Shinya Kitaoka |
120a6e |
QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField->setMeasure(param->getMeasureName());
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField->setValue(param->getValue(m_frame));
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField->setDecimals(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double min = 0, max = 100, step = 1;
|
|
Shinya Kitaoka |
120a6e |
param->getValueRange(min, max, step);
|
|
Shinya Kitaoka |
120a6e |
assert(min < max);
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField->setRange(min, max);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//----layout
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_keyToggle);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_measuredDoubleField);
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//----signal-slot connection
|
|
Shinya Kitaoka |
120a6e |
bool ret = connect(m_measuredDoubleField, SIGNAL(valueChanged(bool)),
|
|
Shinya Kitaoka |
120a6e |
SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_keyToggle, SIGNAL(keyToggled()), SLOT(onKeyToggled()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredDoubleParamField::updateField(double value) {
|
|
Shinya Kitaoka |
120a6e |
m_measuredDoubleField->setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredDoubleParamField::onChange(bool dragging) {
|
|
Shinya Kitaoka |
120a6e |
if (dragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP doubleParam = m_actualParam;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
/*-- Undoを登録する条件:
|
|
Shinya Kitaoka |
120a6e |
値が変更されていて、かつ
|
|
Shinya Kitaoka |
120a6e |
キーフレーム上か、または、まだキーフレームが無い
|
|
Shinya Kitaoka |
120a6e |
(すなわち、実際にシーンの情報を変えることになる)場合
|
|
Shinya Kitaoka |
120a6e |
--*/
|
|
Shinya Kitaoka |
120a6e |
if (doubleParam &&
|
|
Shinya Kitaoka |
120a6e |
doubleParam->getValue(m_frame) != m_measuredDoubleField->getValue() &&
|
|
Shinya Kitaoka |
120a6e |
(m_actualParam->isKeyframe(m_frame) ||
|
|
Shinya Kitaoka |
120a6e |
!m_actualParam.getPointer()->hasKeyframes()))
|
|
Shinya Kitaoka |
120a6e |
undo = new MeasuredDoubleParamFieldUndo(
|
|
Shinya Kitaoka |
120a6e |
doubleParam, m_interfaceName, m_frame, ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setValue(m_measuredDoubleField->getValue());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredDoubleParamField::onKeyToggled() { onKeyToggle(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// MeasuredRangeParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
MeasuredRangeParamField::MeasuredRangeParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TRangeParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: AnimatedParamField<doublepair, trangeparamp="">(parent, name, param) {</doublepair,>
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_valueField = new MeasuredDoublePairField(this);
|
|
Shinya Kitaoka |
120a6e |
m_valueField->setLabelsEnabled(false);
|
|
Shinya Kitaoka |
120a6e |
m_valueField->setMeasure(param->getMin()->getMeasureName());
|
|
Shinya Kitaoka |
120a6e |
m_valueField->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
double a, b, c, min, max;
|
|
Shinya Kitaoka |
120a6e |
param->getMin()->getValueRange(a, b, c);
|
|
Shinya Kitaoka |
120a6e |
min = a;
|
|
Shinya Kitaoka |
120a6e |
param->getMax()->getValueRange(a, b, c);
|
|
Shinya Kitaoka |
120a6e |
max = b;
|
|
Shinya Kitaoka |
120a6e |
if (min < max && max - min < 1e10) // se min=-inf e max=inf
|
|
Shinya Kitaoka |
120a6e |
m_valueField->setRange(min, max);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_keyToggle);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_valueField);
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool ret =
|
|
Shinya Kitaoka |
120a6e |
connect(m_valueField, SIGNAL(valuesChanged(bool)), SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_keyToggle, SIGNAL(keyToggled()), SLOT(onKeyToggled()));
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredRangeParamField::updateField(DoublePair value) {
|
|
Shinya Kitaoka |
120a6e |
m_valueField->setValues(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredRangeParamField::onChange(bool dragging) {
|
|
Shinya Kitaoka |
120a6e |
if (dragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TRangeParamP rangeParam = m_actualParam;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DoublePair value = m_valueField->getValues();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*-- Undoを登録する条件:
|
|
Shinya Kitaoka |
120a6e |
値が変更されていて
|
|
Shinya Kitaoka |
120a6e |
キーフレーム上か、または、まだキーフレームが無い
|
|
Shinya Kitaoka |
120a6e |
(すなわち、実際にシーンの情報を変えることになる)場合
|
|
Shinya Kitaoka |
120a6e |
--*/
|
|
Shinya Kitaoka |
120a6e |
if (rangeParam && rangeParam->getValue(m_frame) != value &&
|
|
Shinya Kitaoka |
120a6e |
(m_actualParam->isKeyframe(m_frame) ||
|
|
Shinya Kitaoka |
120a6e |
!m_actualParam.getPointer()->hasKeyframes()))
|
|
Shinya Kitaoka |
120a6e |
undo = new RangeParamFieldUndo(rangeParam, m_interfaceName, m_frame,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredRangeParamField::onKeyToggled() { onKeyToggle(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void MeasuredRangeParamField::setPrecision(int precision) {
|
|
Shinya Kitaoka |
120a6e |
m_valueField->setPrecision(precision);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// PointParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PointParamField::PointParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TPointParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: AnimatedParamField<tpointd, tpointparamp="">(parent, name, param) {</tpointd,>
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QLabel *xLabel = new QLabel(tr("X:"), this);
|
|
Shinya Kitaoka |
120a6e |
m_xFld = new MeasuredDoubleField(this, false);
|
|
Shinya Kitaoka |
120a6e |
QLabel *yLabel = new QLabel(tr("Y:"), this);
|
|
Shinya Kitaoka |
120a6e |
m_yFld = new MeasuredDoubleField(this, false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double xmin = -(std::numeric_limits<double>::max)(),</double>
|
|
Shinya Kitaoka |
120a6e |
xmax = (std::numeric_limits<double>::max)();</double>
|
|
Shinya Kitaoka |
120a6e |
double ymin = -(std::numeric_limits<double>::max)(),</double>
|
|
Shinya Kitaoka |
120a6e |
ymax = (std::numeric_limits<double>::max)();</double>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if 1
|
|
Shinya Kitaoka |
120a6e |
/* これを有効にすれば PointParamField に範囲が設定できることが UI
|
|
Shinya Kitaoka |
120a6e |
の見た目が変わってしまう.
|
|
Shinya Kitaoka |
120a6e |
これまで誰も TPointParam に対して range
|
|
Shinya Kitaoka |
120a6e |
を設定していないなら(どうせ効いてなかったのだから)無条件に設定してもよさそうだが
|
|
Shinya Kitaoka |
120a6e |
実際は Pinned Texture などの FX
|
|
Shinya Kitaoka |
120a6e |
が設定しており(効いてないなかったが、この修正により)動作が変わってしまうので
|
|
Shinya Kitaoka |
120a6e |
plugin から要求された場合でのみ range を有効にする. */
|
|
Shinya Kitaoka |
120a6e |
if (param->isFromPlugin()) {
|
|
Shinya Kitaoka |
120a6e |
double xstep, ystep;
|
|
Shinya Kitaoka |
120a6e |
param->getX()->getValueRange(xmin, xmax, xstep);
|
|
Shinya Kitaoka |
120a6e |
param->getY()->getValueRange(ymin, ymax, ystep);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_xFld->setMaximumWidth(100);
|
|
Shinya Kitaoka |
120a6e |
m_xFld->setRange(xmin, xmax);
|
|
Shinya Kitaoka |
120a6e |
m_xFld->setMeasure(param->getX()->getMeasureName());
|
|
Shinya Kitaoka |
120a6e |
m_xFld->setValue(param->getX()->getValue(m_frame));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_yFld->setMaximumWidth(100);
|
|
Shinya Kitaoka |
120a6e |
m_yFld->setRange(ymin, ymax);
|
|
Shinya Kitaoka |
120a6e |
m_yFld->setMeasure(param->getY()->getMeasureName());
|
|
Shinya Kitaoka |
120a6e |
m_yFld->setValue(param->getY()->getValue(m_frame));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//----layout
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_keyToggle);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(xLabel);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_xFld);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(yLabel);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_yFld);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//----signal-slot connections
|
|
Shinya Kitaoka |
120a6e |
bool ret =
|
|
Shinya Kitaoka |
120a6e |
connect(m_xFld, SIGNAL(valueChanged(bool)), this, SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
connect(m_yFld, SIGNAL(valueChanged(bool)), this, SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_keyToggle, SIGNAL(keyToggled()), SLOT(onKeyToggled()));
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PointParamField::setPointValue(const TPointD &p) {
|
|
Shinya Kitaoka |
120a6e |
m_xFld->setValue(p.x);
|
|
Shinya Kitaoka |
120a6e |
m_yFld->setValue(p.y);
|
|
Shinya Kitaoka |
120a6e |
setValue(p);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PointParamField::updateField(TPointD value) {
|
|
Shinya Kitaoka |
120a6e |
m_xFld->setValue(value.x);
|
|
Shinya Kitaoka |
120a6e |
m_yFld->setValue(value.y);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PointParamField::onChange(bool dragging) {
|
|
Shinya Kitaoka |
120a6e |
if (dragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointParamP pointParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TPointD pos(m_xFld->getValue(), m_yFld->getValue());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
/*-- Undoを登録する条件:
|
|
Shinya Kitaoka |
120a6e |
値が変更されていて
|
|
Shinya Kitaoka |
120a6e |
キーフレーム上か、または、まだキーフレームが無い
|
|
Shinya Kitaoka |
120a6e |
(すなわち、実際にシーンの情報を変えることになる)場合
|
|
Shinya Kitaoka |
120a6e |
--*/
|
|
Shinya Kitaoka |
120a6e |
if (pointParam && pointParam->getValue(m_frame) != pos &&
|
|
Shinya Kitaoka |
120a6e |
(m_actualParam->isKeyframe(m_frame) ||
|
|
Shinya Kitaoka |
120a6e |
!m_actualParam.getPointer()->hasKeyframes()))
|
|
Shinya Kitaoka |
120a6e |
undo = new PointParamFieldUndo(pointParam, m_interfaceName, m_frame,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setValue(pos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PointParamField::onKeyToggled() { onKeyToggle(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// PixelParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PixelParamField::PixelParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TPixelParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: AnimatedParamField<tpixel32, tpixelparamp="">(parent, name, param) {</tpixel32,>
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_colorField = new ColorField(this, param->isMatteEnabled());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//----layout
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_keyToggle);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_colorField);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addStretch();
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//----signal-slot connections
|
|
Shinya Kitaoka |
120a6e |
bool ret = connect(m_colorField, SIGNAL(colorChanged(const TPixel32 &, bool)),
|
|
Shinya Kitaoka |
120a6e |
this, SLOT(onChange(const TPixel32 &, bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_keyToggle, SIGNAL(keyToggled()), SLOT(onKeyToggled()));
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PixelParamField::updateField(TPixel32 value) {
|
|
Shinya Kitaoka |
120a6e |
m_colorField->setColor(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PixelParamField::onChange(const TPixel32 &value, bool isDragging) {
|
|
Shinya Kitaoka |
120a6e |
if (isDragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPixelParamP pixelParam = m_actualParam;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
/*-- Undoを登録する条件:
|
|
Shinya Kitaoka |
120a6e |
値が変更されていて
|
|
Shinya Kitaoka |
120a6e |
キーフレーム上か、または、まだキーフレームが無い
|
|
Shinya Kitaoka |
120a6e |
(すなわち、実際にシーンの情報を変えることになる)場合
|
|
Shinya Kitaoka |
120a6e |
--*/
|
|
Shinya Kitaoka |
120a6e |
if (pixelParam && pixelParam->getValue(m_frame) != value &&
|
|
Shinya Kitaoka |
120a6e |
(m_actualParam->isKeyframe(m_frame) ||
|
|
Shinya Kitaoka |
120a6e |
!m_actualParam.getPointer()->hasKeyframes()))
|
|
Shinya Kitaoka |
120a6e |
undo = new PixelParamFieldUndo(pixelParam, m_interfaceName, m_frame,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PixelParamField::onKeyToggled() { onKeyToggle(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPixel32 PixelParamField::getColor() { return m_colorField->getColor(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void PixelParamField::setColor(TPixel32 value) {
|
|
Shinya Kitaoka |
120a6e |
m_colorField->setColor(value);
|
|
Shinya Kitaoka |
120a6e |
setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// RGB Link Button
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
RgbLinkButton::RgbLinkButton(QString str, QWidget *parent,
|
|
Shinya Kitaoka |
120a6e |
PixelParamField *field1, PixelParamField *field2)
|
|
Shinya Kitaoka |
120a6e |
: QPushButton(str, parent), m_field1(field1), m_field2(field2) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void RgbLinkButton::onButtonClicked() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_field1 || !m_field2) return;
|
|
Shinya Kitaoka |
120a6e |
TPixel32 val1 = m_field1->getColor();
|
|
Shinya Kitaoka |
120a6e |
TPixel32 val2 = m_field2->getColor();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*-- Alphaは変えない --*/
|
|
Shinya Kitaoka |
120a6e |
val1.m = val2.m;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (val1 == val2) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_field2->setColor(val1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// SpectrumParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SpectrumParamField::SpectrumParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TSpectrumParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: AnimatedParamField<tspectrum, tspectrumparamp="">(parent, name, param) {</tspectrum,>
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_spectrumField = new SpectrumField(this);
|
|
Shinya Kitaoka |
120a6e |
m_spectrumField->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
m_spectrumField->setCurrentKeyIndex(0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//--- layout
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_keyToggle);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_spectrumField);
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//--- signal-slot connections
|
|
Shinya Kitaoka |
120a6e |
bool ret = true;
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_spectrumField, SIGNAL(keyColorChanged(bool)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_spectrumField, SIGNAL(keyPositionChanged(bool)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_spectrumField, SIGNAL(keyAdded(int)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onKeyAdded(int)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_spectrumField, SIGNAL(keyRemoved(int)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onKeyRemoved(int)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_keyToggle, SIGNAL(keyToggled()), SLOT(onKeyToggled()));
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpectrumParamField::updateField(TSpectrum value) {
|
|
Shinya Kitaoka |
120a6e |
if (m_spectrumField->getSpectrum() == value) return;
|
|
Shinya Kitaoka |
120a6e |
m_spectrumField->setSpectrum(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpectrumParamField::setParams() {
|
|
Shinya Kitaoka |
120a6e |
TSpectrum spectrum = m_spectrumField->getSpectrum();
|
|
Shinya Kitaoka |
120a6e |
// if(m_currentParam->getValue(0) == spectrum) return; //Rivedi quando sistemi
|
|
Shinya Kitaoka |
120a6e |
// lo SwatchViewer
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setValue(m_frame, spectrum);
|
|
Shinya Kitaoka |
120a6e |
if (m_actualParam->isKeyframe(m_frame)) {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setValue(m_frame, spectrum);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Shinya Kitaoka |
120a6e |
} else if (!m_actualParam->hasKeyframes()) {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setDefaultValue(spectrum);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
updateKeyToggle();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpectrumParamField::onKeyToggled() { onKeyToggle(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpectrumParamField::onChange(bool isDragging) {
|
|
Shinya Kitaoka |
120a6e |
if (isDragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP spectrumParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
if (spectrumParam &&
|
|
Shinya Kitaoka |
120a6e |
spectrumParam->getValue(m_frame) != m_spectrumField->getSpectrum() &&
|
|
Shinya Kitaoka |
120a6e |
(m_actualParam->isKeyframe(m_frame) ||
|
|
Shinya Kitaoka |
120a6e |
!m_actualParam.getPointer()->hasKeyframes()))
|
|
Shinya Kitaoka |
120a6e |
undo = new SpectrumParamFieldUndo(spectrumParam, m_interfaceName, m_frame,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setParams();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpectrumParamField::onKeyAdded(int keyIndex) {
|
|
Shinya Kitaoka |
120a6e |
TSpectrum::ColorKey key = m_spectrumField->getSpectrum().getKey(keyIndex);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP actualSpectrumParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
assert(actualSpectrumParam);
|
|
Shinya Kitaoka |
120a6e |
actualSpectrumParam->addKey(key.first, key.second);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP currentSpectrumParam = m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
assert(currentSpectrumParam);
|
|
Shinya Kitaoka |
120a6e |
currentSpectrumParam->addKey(key.first, key.second);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndoManager::manager()->add(new SpectrumParamFieldAddRemoveKeyUndo(
|
|
Shinya Kitaoka |
120a6e |
actualSpectrumParam, currentSpectrumParam, key, keyIndex, true,
|
|
Shinya Kitaoka |
120a6e |
m_interfaceName, ParamField::m_fxHandleStat));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpectrumParamField::onKeyRemoved(int keyIndex) {
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP actualSpectrumParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TSpectrumParamP currentSpectrumParam = m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
if (currentSpectrumParam && actualSpectrumParam) {
|
|
Shinya Kitaoka |
120a6e |
TSpectrum::ColorKey key =
|
|
Shinya Kitaoka |
120a6e |
actualSpectrumParam->getValue(m_frame).getKey(keyIndex);
|
|
Shinya Kitaoka |
120a6e |
undo = new SpectrumParamFieldAddRemoveKeyUndo(
|
|
Shinya Kitaoka |
120a6e |
actualSpectrumParam, currentSpectrumParam, key, keyIndex, false,
|
|
Shinya Kitaoka |
120a6e |
m_interfaceName, ParamField::m_fxHandleStat);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->removeKey(keyIndex);
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->removeKey(keyIndex);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setParams();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// EnumParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
EnumParamField::EnumParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TIntEnumParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Shinya Kitaoka |
120a6e |
m_om = new QComboBox(this);
|
|
Shinya Kitaoka |
120a6e |
m_om->setFixedHeight(20);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < param->getItemCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
int value = 0;
|
|
Shinya Kitaoka |
120a6e |
std::string caption;
|
|
Shinya Kitaoka |
120a6e |
param->getItem(i, value, caption);
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_om->addItem(str.fromStdString(caption));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
connect(m_om, SIGNAL(activated(const QString &)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onChange(const QString &)));
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_om);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addStretch();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void EnumParamField::onChange(const QString &str) {
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP intEnumParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
std::string newStdStr = str.toStdString();
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
if (intEnumParam) {
|
|
Shinya Kitaoka |
120a6e |
/*--クリックしただけで実際のカレントアイテムが変わっていない場合はreturn--*/
|
|
Shinya Kitaoka |
120a6e |
std::string oldStr;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < intEnumParam->getItemCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
int oldVal;
|
|
Shinya Kitaoka |
120a6e |
intEnumParam->getItem(i, oldVal, oldStr);
|
|
Shinya Kitaoka |
120a6e |
if (oldVal == intEnumParam->getValue()) {
|
|
Shinya Kitaoka |
120a6e |
if (oldStr == newStdStr)
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
undo = new EnumParamFieldUndo(intEnumParam, oldStr, newStdStr,
|
|
Shinya Kitaoka |
120a6e |
m_interfaceName, ParamField::m_fxHandleStat);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setValue(newStdStr);
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setValue(newStdStr);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void EnumParamField::setParam(const TParamP ¤t, const TParamP &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
m_currentParam = current;
|
|
Shinya Kitaoka |
120a6e |
m_actualParam = actual;
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam);
|
|
Shinya Kitaoka |
120a6e |
assert(m_actualParam);
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void EnumParamField::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_actualParam || !m_currentParam) return;
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP param = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < param->getItemCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
int value = 0;
|
|
Shinya Kitaoka |
120a6e |
std::string caption;
|
|
Shinya Kitaoka |
120a6e |
param->getItem(i, value, caption);
|
|
Shinya Kitaoka |
120a6e |
if (value != param->getValue()) continue;
|
|
Shinya Kitaoka |
120a6e |
if (m_om->currentIndex() == i) return;
|
|
Shinya Kitaoka |
120a6e |
m_om->setCurrentIndex(i);
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// BoolParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
BoolParamField::BoolParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TBoolParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Shinya Kitaoka |
120a6e |
if (!param->hasUILabel()) m_interfaceName = name;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_checkBox = new CheckBox("", this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*-- Undo時には反応しないように、toggledでなくclickedにする --*/
|
|
Shinya Kitaoka |
120a6e |
connect(m_checkBox, SIGNAL(clicked(bool)), this, SLOT(onToggled(bool)));
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_checkBox);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addStretch();
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*-- visibleToggleインタフェースのため --*/
|
|
Shinya Kitaoka |
120a6e |
connect(m_checkBox, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void BoolParamField::onToggled(bool checked) {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setValue(checked);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setValue(checked);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP boolParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
if (boolParam)
|
|
Shinya Kitaoka |
120a6e |
TUndoManager::manager()->add(new BoolParamFieldUndo(
|
|
Shinya Kitaoka |
120a6e |
boolParam, m_interfaceName, ParamField::m_fxHandleStat));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void BoolParamField::setParam(const TParamP ¤t, const TParamP &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
m_currentParam = current;
|
|
Shinya Kitaoka |
120a6e |
m_actualParam = actual;
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam);
|
|
Shinya Kitaoka |
120a6e |
assert(m_actualParam);
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void BoolParamField::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_actualParam || !m_currentParam) return;
|
|
Shinya Kitaoka |
120a6e |
bool value = m_actualParam->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (m_checkBox->isChecked() == value) return;
|
|
Shinya Kitaoka |
120a6e |
m_checkBox->setChecked(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// IntParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
IntParamField::IntParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TIntParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Shinya Kitaoka |
120a6e |
m_intField = new IntField(this, false);
|
|
Shinya Kitaoka |
120a6e |
m_intField->setMaximumWidth(43);
|
|
Shinya Kitaoka |
120a6e |
m_intField->enableSlider(false);
|
|
Shinya Kitaoka |
120a6e |
m_intField->enableRoller(param->isWheelEnabled());
|
|
Shinya Kitaoka |
120a6e |
int min, max;
|
|
Shinya Kitaoka |
120a6e |
param->getValueRange(min, max);
|
|
Shinya Kitaoka |
120a6e |
assert(min < max);
|
|
Shinya Kitaoka |
120a6e |
m_intField->setRange(min, max);
|
|
Shinya Kitaoka |
120a6e |
connect(m_intField, SIGNAL(valueChanged(bool)), SLOT(onChange(bool)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_intField);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addStretch();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void IntParamField::onChange(bool isDragging) {
|
|
Shinya Kitaoka |
120a6e |
if (isDragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int value = m_intField->getValue();
|
|
Shinya Kitaoka |
120a6e |
int min, max;
|
|
Shinya Kitaoka |
120a6e |
m_intField->getRange(min, max);
|
|
Shinya Kitaoka |
120a6e |
if (value > max)
|
|
Shinya Kitaoka |
120a6e |
value = max;
|
|
Shinya Kitaoka |
120a6e |
else if (value < min)
|
|
Shinya Kitaoka |
120a6e |
value = min;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TIntParamP intParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
if (intParam && intParam->getValue() != value)
|
|
Shinya Kitaoka |
120a6e |
undo = new IntParamFieldUndo(intParam, m_interfaceName,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void IntParamField::setParam(const TParamP ¤t, const TParamP &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
m_currentParam = current;
|
|
Shinya Kitaoka |
120a6e |
m_actualParam = actual;
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam);
|
|
Shinya Kitaoka |
120a6e |
assert(m_actualParam);
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void IntParamField::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_actualParam || !m_currentParam) return;
|
|
Shinya Kitaoka |
120a6e |
int value = m_actualParam->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (m_intField->getValue() == value) return;
|
|
Shinya Kitaoka |
120a6e |
m_intField->setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// StringParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
StringParamField::StringParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TStringParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Shinya Kitaoka |
120a6e |
m_textFld = new LineEdit(name, this);
|
|
Shinya Kitaoka |
120a6e |
m_textFld->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
bool ret =
|
|
Shinya Kitaoka |
120a6e |
connect(m_textFld, SIGNAL(editingFinished()), this, SLOT(onChange()));
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_textFld);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void StringParamField::onChange() {
|
|
Shinya Kitaoka |
120a6e |
std::wstring value = m_textFld->text().toStdWString();
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TStringParamP stringParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
if (stringParam && stringParam->getValue() != value)
|
|
Shinya Kitaoka |
120a6e |
undo = new StringParamFieldUndo(stringParam, m_interfaceName,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void StringParamField::setParam(const TParamP ¤t, const TParamP &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
m_currentParam = current;
|
|
Shinya Kitaoka |
120a6e |
m_actualParam = actual;
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam);
|
|
Shinya Kitaoka |
120a6e |
assert(m_actualParam);
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void StringParamField::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_actualParam || !m_currentParam) return;
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
QString strValue = str.fromStdWString(m_actualParam->getValue());
|
|
Shinya Kitaoka |
120a6e |
if (m_textFld->text() == strValue) return;
|
|
Shinya Kitaoka |
120a6e |
m_textFld->setText(strValue);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Faccio in modo che il cursore sia sulla prima cifra, cosi' se la stringa
|
|
Shinya Kitaoka |
120a6e |
// da visualizzare e' piu' lunga del campo le cifre che vengono troncate sono
|
|
Shinya Kitaoka |
120a6e |
// le ultime e non le prime (dovrebbero essere quelle dopo la virgola).
|
|
Shinya Kitaoka |
120a6e |
m_textFld->setCursorPosition(0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ToneCurveParamField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ToneCurveParamField::ToneCurveParamField(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TToneCurveParamP ¶m)
|
|
Shinya Kitaoka |
120a6e |
: AnimatedParamField<const qlist<tpointd="">, TToneCurveParamP>(parent, name,</const>
|
|
Shinya Kitaoka |
120a6e |
param, false) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_paramName = str.fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *paramsPage = dynamic_cast<paramspage *="">(parent);</paramspage>
|
|
Shinya Kitaoka |
120a6e |
FxHistogramRender *fxHistogramRender =
|
|
Shinya Kitaoka |
120a6e |
(paramsPage) ? paramsPage->getFxHistogramRender() : 0;
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField = new ToneCurveField(this, fxHistogramRender);
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//--- layout
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_keyToggle);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(m_toneCurveField);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addStretch();
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(m_keyToggle, SIGNAL(keyToggled()), SLOT(onKeyToggled()));
|
|
Shinya Kitaoka |
120a6e |
connect(m_toneCurveField, SIGNAL(currentChannelIndexChanged(int)),
|
|
Shinya Kitaoka |
120a6e |
SLOT(onChannelChanged(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < m_toneCurveField->getChannelCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ChennelCurveEditor *c = m_toneCurveField->getChannelEditor(i);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(c, SIGNAL(controlPointChanged(bool)), this, SLOT(onChange(bool)));
|
|
Shinya Kitaoka |
120a6e |
connect(c, SIGNAL(controlPointAdded(int)), this, SLOT(onPointAdded(int)));
|
|
Shinya Kitaoka |
120a6e |
connect(c, SIGNAL(controlPointRemoved(int)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onPointRemoved(int)));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
connect(m_toneCurveField, SIGNAL(isLinearChanged(bool)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onIsLinearChanged(bool)));
|
|
Shinya Kitaoka |
120a6e |
updateField(param->getValue(0));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::updateField(const QList<tpointd> value) {</tpointd>
|
|
Shinya Kitaoka |
120a6e |
if (m_actualParam) {
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam &&
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->getCurrentChannel() ==
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->getCurrentChannel());
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->setCurrentChannel(m_actualParam->getCurrentChannel());
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam &&
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->isLinear() == m_actualParam->isLinear());
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->setIsLinearCheckBox(m_actualParam->isLinear());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->getCurrentChannelEditor()->setPoints(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::setParams() {
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> value =</tpointd>
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->getCurrentChannelEditor()->getPoints();
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setValue(m_frame, value);
|
|
Shinya Kitaoka |
120a6e |
if (m_actualParam->isKeyframe(m_frame)) {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setValue(m_frame, value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Shinya Kitaoka |
120a6e |
} else if (!m_actualParam->hasKeyframes()) {
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setDefaultValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
updateKeyToggle();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::onChannelChanged(int channel) {
|
|
Shinya Kitaoka |
120a6e |
if (m_actualParam->getCurrentChannel() ==
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParam::ToneChannel(channel)) {
|
|
Shinya Kitaoka |
120a6e |
assert(m_currentParam->getCurrentChannel() ==
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParam::ToneChannel(channel));
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setCurrentChannel(TToneCurveParam::ToneChannel(channel));
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setCurrentChannel(TToneCurveParam::ToneChannel(channel));
|
|
Shinya Kitaoka |
120a6e |
updateField(m_currentParam->getValue(m_frame));
|
|
Shinya Kitaoka |
120a6e |
updateKeyToggle();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::onChange(bool isDragging) {
|
|
Shinya Kitaoka |
120a6e |
if (isDragging) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveParam = m_actualParam;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndo *undo = 0;
|
|
Shinya Kitaoka |
120a6e |
/*--- Undoを登録する条件:
|
|
Shinya Kitaoka |
120a6e |
値が変更されていて
|
|
Shinya Kitaoka |
120a6e |
キーフレーム上か、または、まだキーフレームが無い
|
|
Shinya Kitaoka |
120a6e |
(すなわち、実際にシーンの情報を変えることになる)場合
|
|
Shinya Kitaoka |
120a6e |
---*/
|
|
Shinya Kitaoka |
120a6e |
if (toneCurveParam &&
|
|
Shinya Kitaoka |
120a6e |
toneCurveParam->getValue(m_frame) !=
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->getCurrentChannelEditor()->getPoints() &&
|
|
Shinya Kitaoka |
120a6e |
(m_actualParam->isKeyframe(m_frame) ||
|
|
Shinya Kitaoka |
120a6e |
!m_actualParam.getPointer()->hasKeyframes()))
|
|
Shinya Kitaoka |
120a6e |
undo = new ToneCurveParamFieldUndo(toneCurveParam, m_interfaceName, m_frame,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setParams();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (undo) TUndoManager::manager()->add(undo);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::onPointAdded(int index) {
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> value =</tpointd>
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->getCurrentChannelEditor()->getPoints();
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->addValue(0, value, index);
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->addValue(0, value, index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveActualParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveCurrentParam = m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
if (toneCurveActualParam && toneCurveCurrentParam)
|
|
Shinya Kitaoka |
120a6e |
TUndoManager::manager()->add(new ToneCurveParamFieldAddRemovePointUndo(
|
|
Shinya Kitaoka |
120a6e |
toneCurveActualParam, toneCurveCurrentParam, value, index, true,
|
|
Shinya Kitaoka |
120a6e |
m_interfaceName, ParamField::m_fxHandleStat));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::onPointRemoved(int index) {
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveActualParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveCurrentParam = m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
if (toneCurveActualParam && toneCurveCurrentParam) {
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> value =</tpointd>
|
|
Shinya Kitaoka |
120a6e |
m_toneCurveField->getCurrentChannelEditor()->getPoints();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TUndoManager::manager()->add(new ToneCurveParamFieldAddRemovePointUndo(
|
|
Shinya Kitaoka |
120a6e |
toneCurveActualParam, toneCurveCurrentParam, value, index, false,
|
|
Shinya Kitaoka |
120a6e |
m_interfaceName, ParamField::m_fxHandleStat));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->removeValue(0, index);
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->removeValue(0, index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::onIsLinearChanged(bool isLinear) {
|
|
Shinya Kitaoka |
120a6e |
m_currentParam->setIsLinear(isLinear);
|
|
Shinya Kitaoka |
120a6e |
m_actualParam->setIsLinear(isLinear);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveActualParam = m_actualParam;
|
|
Shinya Kitaoka |
120a6e |
TToneCurveParamP toneCurveCurrentParam = m_currentParam;
|
|
Shinya Kitaoka |
120a6e |
if (toneCurveActualParam && toneCurveCurrentParam)
|
|
Shinya Kitaoka |
120a6e |
TUndoManager::manager()->add(new ToneCurveParamFieldToggleLinearUndo(
|
|
Shinya Kitaoka |
120a6e |
toneCurveActualParam, toneCurveCurrentParam, m_interfaceName,
|
|
Shinya Kitaoka |
120a6e |
ParamField::m_fxHandleStat));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ToneCurveParamField::onKeyToggled() { onKeyToggle(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ParamField::create()
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *ParamField::create(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
const TParamP ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (TDoubleParamP doubleParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new MeasuredDoubleParamField(parent, name, doubleParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TRangeParamP rangeParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new MeasuredRangeParamField(parent, name, rangeParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TPixelParamP pixelParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new PixelParamField(parent, name, pixelParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TPointParamP pointParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new PointParamField(parent, name, pointParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TIntEnumParamP enumParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new EnumParamField(parent, name, enumParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TIntParamP intParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new IntParamField(parent, name, intParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TBoolParamP boolParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new BoolParamField(parent, name, boolParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TSpectrumParamP spectrumParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new SpectrumParamField(parent, name, spectrumParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TStringParamP stringParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new StringParamField(parent, name, stringParam);
|
|
Shinya Kitaoka |
120a6e |
else if (TToneCurveParamP toneCurveParam = param)
|
|
Shinya Kitaoka |
120a6e |
return new ToneCurveParamField(parent, name, toneCurveParam);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// Custom Components
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
#include <sstream></sstream>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace component {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// LineEdit_double
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
LineEdit_double::LineEdit_double(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param), frame_(0) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QLineEdit(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
value_->setText(QString::number(param->getValue(0)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(textChanged(QString const &)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(update_value(QString const &)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_double::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_double::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const double value = actual_->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->text().toDouble()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setText(QString::number(value));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_double::update_value(QString const &text) {
|
|
Shinya Kitaoka |
120a6e |
const double value = text.toDouble();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(frame_, value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(frame_, value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Slider_double
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
Slider_double::Slider_double(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QSlider(Qt::Horizontal, this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
value_->setValue(param->getValue(0));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double minvalue;
|
|
Shinya Kitaoka |
120a6e |
double maxvalue;
|
|
Shinya Kitaoka |
120a6e |
double valuestep;
|
|
Shinya Kitaoka |
120a6e |
if (param->getValueRange(minvalue, maxvalue, valuestep)) {
|
|
Shinya Kitaoka |
120a6e |
value_->setRange(minvalue * 100, maxvalue * 100);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(valueChanged(int)), this, SLOT(update_value(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void Slider_double::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void Slider_double::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const double value = actual_->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->value() / 100.0) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setValue(value * 100);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void Slider_double::update_value(int slider_value) {
|
|
Shinya Kitaoka |
120a6e |
const double value = slider_value / 100.0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(frame_, value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(frame_, value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SpinBox_double
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
SpinBox_double::SpinBox_double(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QDoubleSpinBox(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double minvalue;
|
|
Shinya Kitaoka |
120a6e |
double maxvalue;
|
|
Shinya Kitaoka |
120a6e |
double valuestep;
|
|
Shinya Kitaoka |
120a6e |
if (param->getValueRange(minvalue, maxvalue, valuestep)) {
|
|
Shinya Kitaoka |
120a6e |
value_->setRange(minvalue, maxvalue);
|
|
Shinya Kitaoka |
120a6e |
value_->setSingleStep(valuestep / 100.0);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(valueChanged(double)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(update_value(double)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpinBox_double::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpinBox_double::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const double value = actual_->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->value()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpinBox_double::update_value(double value) {
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(frame_, value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(frame_, value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // end of namespace component
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace component {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// LineEdit_int
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
LineEdit_int::LineEdit_int(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TIntParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QLineEdit(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
value_->setText(QString::number(param->getValue()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(textChanged(QString const &)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(update_value(QString const &)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_int::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_int::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const int value = actual_->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->text().toInt()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setText(QString::number(value));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_int::update_value(QString const &text) {
|
|
Shinya Kitaoka |
120a6e |
const int value = text.toInt();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Slider_int
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
Slider_int::Slider_int(QWidget *parent, QString name, TIntParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QSlider(Qt::Horizontal, this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
value_->setValue(param->getValue());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int minvalue;
|
|
Shinya Kitaoka |
120a6e |
int maxvalue;
|
|
Shinya Kitaoka |
120a6e |
if (param->getValueRange(minvalue, maxvalue)) {
|
|
Shinya Kitaoka |
120a6e |
value_->setRange(minvalue, maxvalue);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
value_->setRange(0, 100);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(valueChanged(int)), this, SLOT(update_value(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void Slider_int::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void Slider_int::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const int value = actual_->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->value()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void Slider_int::update_value(int value) {
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SpinBox_int
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
SpinBox_int::SpinBox_int(QWidget *parent, QString name, TIntParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QSpinBox(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int minvalue;
|
|
Shinya Kitaoka |
120a6e |
int maxvalue;
|
|
Shinya Kitaoka |
120a6e |
if (param->getValueRange(minvalue, maxvalue)) {
|
|
Shinya Kitaoka |
120a6e |
value_->setRange(minvalue, maxvalue);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
value_->setRange(0, 100);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(valueChanged(int)), this, SLOT(update_value(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpinBox_int::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpinBox_int::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const int value = actual_->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->value()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setValue(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SpinBox_int::update_value(int value) {
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // end of namespace component
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace component {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// CheckBox_bool
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
CheckBox_bool::CheckBox_bool(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QCheckBox(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(stateChanged(int)), this, SLOT(update_value(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void CheckBox_bool::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void CheckBox_bool::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool const value = actual_->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (value == (value_->checkState() != Qt::Unchecked)) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setCheckState(value ? Qt::Checked : Qt::Unchecked);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void CheckBox_bool::update_value(int checkbox_value) {
|
|
Shinya Kitaoka |
120a6e |
bool const value = checkbox_value != Qt::Unchecked;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // end of namespace component
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace component {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// RadioButton_enum
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
RadioButton_enum::RadioButton_enum(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QButtonGroup(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0, count = param->getItemCount(); i < count; i++) {
|
|
Shinya Kitaoka |
120a6e |
int item;
|
|
Shinya Kitaoka |
120a6e |
std::string caption;
|
|
Shinya Kitaoka |
120a6e |
param->getItem(i, item, caption);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QRadioButton *button = new QRadioButton(caption.c_str(), this);
|
|
Shinya Kitaoka |
120a6e |
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
value_->addButton(button, item);
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(button);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(buttonClicked(int)), this, SLOT(update_value(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void RadioButton_enum::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void RadioButton_enum::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const int value = actual_->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->checkedId()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->button(value)->setChecked(true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void RadioButton_enum::update_value(int value) {
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// ComboBox_enum
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
ComboBox_enum::ComboBox_enum(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QComboBox(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setFixedHeight(20);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0, count = param->getItemCount(); i < count; i++) {
|
|
Shinya Kitaoka |
120a6e |
int item;
|
|
Shinya Kitaoka |
120a6e |
std::string caption;
|
|
Shinya Kitaoka |
120a6e |
param->getItem(i, item, caption);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->addItem(QString::fromStdString(caption));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(currentIndexChanged(int)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(update_value(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ComboBox_enum::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ComboBox_enum::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const int value = actual_->getValue();
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->currentIndex()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setCurrentIndex(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ComboBox_enum::update_value(int value) {
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // end of namespace component
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace component {
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// LineEdit_string
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Shinya Kitaoka |
120a6e |
LineEdit_string::LineEdit_string(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TStringParamP const ¶m)
|
|
Shinya Kitaoka |
120a6e |
: ParamField(parent, name, param), frame_(0) {
|
|
Shinya Kitaoka |
120a6e |
m_paramName = QString::fromStdString(param->getName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_ = new QLineEdit(this);
|
|
Shinya Kitaoka |
120a6e |
value_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
Shinya Kitaoka |
120a6e |
value_->setText(QString::fromStdWString(param->getValue()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
connect(value_, SIGNAL(textChanged(QString const &)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(update_value(QString const &)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_layout->addWidget(value_);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_string::setParam(TParamP const ¤t, TParamP const &actual,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
current_ = current;
|
|
Shinya Kitaoka |
120a6e |
actual_ = actual;
|
|
Shinya Kitaoka |
120a6e |
update(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_string::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
frame_ = frame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!actual_ || !current_) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString const value = QString::fromStdWString(actual_->getValue());
|
|
Shinya Kitaoka |
120a6e |
if (value == value_->text()) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
value_->setText(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LineEdit_string::update_value(QString const &text) {
|
|
Shinya Kitaoka |
120a6e |
std::wstring const value = text.toStdWString();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
current_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit currentParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
actual_->setValue(value);
|
|
Shinya Kitaoka |
120a6e |
emit actualParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // end of namespace component
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *make_lineedit(QWidget *parent, QString name, TParamP const ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (0)
|
|
Shinya Kitaoka |
120a6e |
;
|
|
Shinya Kitaoka |
120a6e |
else if (TDoubleParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::LineEdit_double(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
} else if (TIntParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::LineEdit_int(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
} else if (TStringParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::LineEdit_string(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return NULL;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *make_slider(QWidget *parent, QString name, TParamP const ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (0)
|
|
Shinya Kitaoka |
120a6e |
;
|
|
Shinya Kitaoka |
120a6e |
else if (TDoubleParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::Slider_double(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
} else if (TIntParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::Slider_int(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return NULL;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *make_spinbox(QWidget *parent, QString name, TParamP const ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (0)
|
|
Shinya Kitaoka |
120a6e |
;
|
|
Shinya Kitaoka |
120a6e |
else if (TDoubleParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::SpinBox_double(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
} else if (TIntParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::SpinBox_int(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return NULL;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *make_checkbox(QWidget *parent, QString name, TParamP const ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (0)
|
|
Shinya Kitaoka |
120a6e |
;
|
|
Shinya Kitaoka |
120a6e |
else if (TBoolParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::CheckBox_bool(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return NULL;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *make_radiobutton(QWidget *parent, QString name,
|
|
Shinya Kitaoka |
120a6e |
TParamP const ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (0)
|
|
Shinya Kitaoka |
120a6e |
;
|
|
Shinya Kitaoka |
120a6e |
else if (TIntEnumParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::RadioButton_enum(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return NULL;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField *make_combobox(QWidget *parent, QString name, TParamP const ¶m) {
|
|
Shinya Kitaoka |
120a6e |
if (0)
|
|
Shinya Kitaoka |
120a6e |
;
|
|
Shinya Kitaoka |
120a6e |
else if (TIntEnumParamP _ = param) {
|
|
Shinya Kitaoka |
120a6e |
return new component::ComboBox_enum(parent, name, _);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return NULL;
|
|
Toshihiro Shimizu |
890ddd |
}
|