|
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"
|
|
shun-iwasawa |
5e9027 |
#include "toonzqt/menubarcommand.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>
|
|
shun-iwasawa |
5b2332 |
#include <qfontcombobox></qfontcombobox>
|
|
shun-iwasawa |
5b2332 |
#include <qkeyevent></qkeyevent>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace DVGui;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! FxSettingsに共通のUndo
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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
|
|
shun-iwasawa |
cac18a |
*/
|
|
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 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
/*! FontParamFieldUndo
|
|
shun-iwasawa |
cac18a |
*/
|
|
shun-iwasawa |
5b2332 |
class FontParamFieldUndo final : public FxSettingsUndo {
|
|
shun-iwasawa |
5b2332 |
TFontParamP m_param;
|
|
shun-iwasawa |
5b2332 |
std::wstring m_oldValue, m_newValue;
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
public:
|
|
shun-iwasawa |
5b2332 |
FontParamFieldUndo(const TFontParamP param, QString name, TFxHandle *fxHandle)
|
|
shun-iwasawa |
5b2332 |
: FxSettingsUndo(name, fxHandle), m_param(param) {
|
|
shun-iwasawa |
5b2332 |
m_oldValue = param->getValue();
|
|
shun-iwasawa |
5b2332 |
m_newValue = m_oldValue;
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void onAdd() override { m_newValue = m_param->getValue(); }
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void undo() const override {
|
|
shun-iwasawa |
5b2332 |
m_param->setValue(m_oldValue);
|
|
shun-iwasawa |
5b2332 |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void redo() const override {
|
|
shun-iwasawa |
5b2332 |
m_param->setValue(m_newValue);
|
|
shun-iwasawa |
5b2332 |
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
QString getHistoryString() override {
|
|
shun-iwasawa |
5b2332 |
QString str = QObject::tr("Modify Fx Param : %1").arg(m_name);
|
|
shun-iwasawa |
5b2332 |
return str;
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
};
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! ToneCurveParamField Undo
|
|
shun-iwasawa |
cac18a |
*/
|
|
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のトグル)
|
|
shun-iwasawa |
cac18a |
*/
|
|
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) {
|
|
Kite |
521c84 |
setFixedSize(20, 20);
|
|
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) {
|
|
Kite |
521c84 |
QIcon icon;
|
|
Kite |
521c84 |
const int iconSize = 20;
|
|
Kite |
521c84 |
const int radius = 2;
|
|
Kite |
521c84 |
|
|
Kite |
521c84 |
// Create rounded rect for key button states
|
|
Shinya Kitaoka |
120a6e |
QPainter p(this);
|
|
Kite |
521c84 |
p.setRenderHint(p.Antialiasing, true);
|
|
Kite |
521c84 |
QPainterPath path;
|
|
Kite |
521c84 |
path.addRoundedRect(
|
|
Kite |
521c84 |
QRectF(0.5, 0.5, 19, 19), radius,
|
|
Kite |
521c84 |
radius); // Nudge rect by half pixel so QPen looks pixel perfect
|
|
Kite |
521c84 |
QPen pen = QColor(0, 0, 0, 0);
|
|
Kite |
521c84 |
p.setPen(pen);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
switch (m_status) {
|
|
Shinya Kitaoka |
120a6e |
case NOT_ANIMATED:
|
|
Kite |
521c84 |
pen = QColor(getKeyBorderOffColor());
|
|
Kite |
521c84 |
p.setPen(pen);
|
|
Kite |
521c84 |
p.fillPath(path, getKeyOffColor());
|
|
Kite |
521c84 |
m_pixmap = QPixmap(createQIcon("key_off").pixmap(
|
|
Kite |
521c84 |
iconSize, iconSize, QIcon::Normal, QIcon::Off));
|
|
Kite |
521c84 |
icon.addPixmap(m_pixmap);
|
|
Kite |
521c84 |
icon.paint(&p, QRect(0, 0, iconSize, iconSize));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case KEYFRAME:
|
|
Kite |
521c84 |
pen = QColor(getKeyBorderOnColor());
|
|
Kite |
521c84 |
p.setPen(pen);
|
|
Kite |
521c84 |
p.fillPath(path, getKeyOnColor());
|
|
Kite |
521c84 |
m_pixmap =
|
|
Kite |
521c84 |
QPixmap(createQIcon("key_on", true)
|
|
Kite |
521c84 |
.pixmap(iconSize, iconSize, QIcon::Normal, QIcon::Off));
|
|
Kite |
521c84 |
icon.addPixmap(m_pixmap);
|
|
Kite |
521c84 |
icon.paint(&p, QRect(0, 0, iconSize, iconSize));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case MODIFIED:
|
|
Kite |
521c84 |
pen = QColor(getKeyBorderModifiedColor());
|
|
Kite |
521c84 |
p.setPen(pen);
|
|
Kite |
521c84 |
p.fillPath(path, getKeyModifiedColor());
|
|
Kite |
521c84 |
m_pixmap =
|
|
Kite |
521c84 |
QPixmap(createQIcon("key_modified", true)
|
|
Kite |
521c84 |
.pixmap(iconSize, iconSize, QIcon::Normal, QIcon::Off));
|
|
Kite |
521c84 |
icon.addPixmap(m_pixmap);
|
|
Kite |
521c84 |
icon.paint(&p, QRect(0, 0, iconSize, iconSize));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Kite |
521c84 |
pen = QColor(getKeyBorderInbetweenColor());
|
|
Kite |
521c84 |
p.setPen(pen);
|
|
Kite |
521c84 |
p.fillPath(path, getKeyInbetweenColor());
|
|
Kite |
521c84 |
m_pixmap =
|
|
Kite |
521c84 |
QPixmap(createQIcon("key_on", true)
|
|
Kite |
521c84 |
.pixmap(iconSize, iconSize, QIcon::Normal, QIcon::Off));
|
|
Kite |
521c84 |
icon.addPixmap(m_pixmap);
|
|
Kite |
521c84 |
icon.paint(&p, QRect(0, 0, iconSize, iconSize));
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Kite |
521c84 |
p.drawPath(path);
|
|
Kite |
521c84 |
|
|
Shinya Kitaoka |
120a6e |
if (m_highlighted) {
|
|
Kite |
521c84 |
pen = QColor(getKeyBorderHighlightColor());
|
|
Kite |
521c84 |
p.setPen(pen);
|
|
Kite |
521c84 |
p.fillPath(path, getKeyHighlightColor());
|
|
Kite |
521c84 |
p.drawPath(path);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Kite |
521c84 |
|
|
Kite |
521c84 |
p.end();
|
|
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 |
|
|
shun-iwasawa |
d76928 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
d76928 |
|
|
shun-iwasawa |
d76928 |
void MeasuredDoubleParamField::setPrecision(int precision) {
|
|
shun-iwasawa |
d76928 |
double min, max;
|
|
shun-iwasawa |
d76928 |
m_measuredDoubleField->getRange(min, max);
|
|
shun-iwasawa |
d76928 |
m_measuredDoubleField->setDecimals(precision);
|
|
shun-iwasawa |
d76928 |
// update slider
|
|
shun-iwasawa |
d76928 |
m_measuredDoubleField->setRange(min, max);
|
|
shun-iwasawa |
d76928 |
}
|
|
shun-iwasawa |
d76928 |
|
|
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);
|
|
shun-iwasawa |
cac18a |
onChange(value, false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// RGB Link Button
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
cac18a |
RgbLinkButtons::RgbLinkButtons(QString str1, QString str2, QWidget *parent,
|
|
shun-iwasawa |
cac18a |
PixelParamField *field1, PixelParamField *field2)
|
|
shun-iwasawa |
cac18a |
: QWidget(parent), m_field1(field1), m_field2(field2) {
|
|
shun-iwasawa |
cac18a |
QString copyButtonStr = tr("Copy RGB : %1 > %2").arg(str1).arg(str2);
|
|
shun-iwasawa |
cac18a |
QString swapButtonStr = tr("Swap %1 and %2").arg(str1).arg(str2);
|
|
shun-iwasawa |
cac18a |
QPushButton *copyButton = new QPushButton(copyButtonStr, this);
|
|
shun-iwasawa |
cac18a |
QPushButton *swapButton = new QPushButton(swapButtonStr, this);
|
|
shun-iwasawa |
cac18a |
|
|
shun-iwasawa |
cac18a |
copyButton->setFixedHeight(21);
|
|
shun-iwasawa |
cac18a |
swapButton->setFixedHeight(21);
|
|
shun-iwasawa |
cac18a |
|
|
shun-iwasawa |
cac18a |
QHBoxLayout *lay = new QHBoxLayout();
|
|
shun-iwasawa |
cac18a |
lay->setMargin(0);
|
|
shun-iwasawa |
cac18a |
lay->setSpacing(5);
|
|
shun-iwasawa |
cac18a |
{
|
|
shun-iwasawa |
cac18a |
lay->addWidget(copyButton, 0);
|
|
shun-iwasawa |
cac18a |
lay->addWidget(swapButton, 0);
|
|
shun-iwasawa |
cac18a |
lay->addStretch(1);
|
|
shun-iwasawa |
cac18a |
}
|
|
shun-iwasawa |
cac18a |
setLayout(lay);
|
|
shun-iwasawa |
cac18a |
|
|
shun-iwasawa |
cac18a |
connect(copyButton, SIGNAL(clicked()), this, SLOT(onCopyButtonClicked()));
|
|
shun-iwasawa |
cac18a |
connect(swapButton, SIGNAL(clicked()), this, SLOT(onSwapButtonClicked()));
|
|
shun-iwasawa |
cac18a |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
cac18a |
void RgbLinkButtons::onCopyButtonClicked() {
|
|
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 |
|
|
shun-iwasawa |
cac18a |
// keep alpha channel unchanged
|
|
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 |
|
|
shun-iwasawa |
cac18a |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
cac18a |
|
|
shun-iwasawa |
cac18a |
void RgbLinkButtons::onSwapButtonClicked() {
|
|
shun-iwasawa |
cac18a |
if (!m_field1 || !m_field2) return;
|
|
shun-iwasawa |
cac18a |
TPixel32 val1 = m_field1->getColor();
|
|
shun-iwasawa |
cac18a |
TPixel32 val2 = m_field2->getColor();
|
|
shun-iwasawa |
cac18a |
|
|
shun-iwasawa |
cac18a |
if (val1 == val2) return;
|
|
shun-iwasawa |
cac18a |
|
|
shun-iwasawa |
cac18a |
TUndoManager::manager()->beginBlock();
|
|
shun-iwasawa |
cac18a |
m_field2->setColor(val1);
|
|
shun-iwasawa |
cac18a |
m_field1->setColor(val2);
|
|
shun-iwasawa |
cac18a |
TUndoManager::manager()->endBlock();
|
|
shun-iwasawa |
cac18a |
}
|
|
shun-iwasawa |
cac18a |
|
|
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 |
//=============================================================================
|
|
shun-iwasawa |
6e910b |
// Mode Sensitive Box
|
|
shun-iwasawa |
6e910b |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
6e910b |
|
|
shun-iwasawa |
6e910b |
ModeSensitiveBox::ModeSensitiveBox(QWidget *parent,
|
|
shun-iwasawa |
6e910b |
ModeChangerParamField *modeChanger,
|
|
shun-iwasawa |
6e910b |
QList<int> modes)</int>
|
|
shun-iwasawa |
6e910b |
: QWidget(parent), m_modes(modes) {
|
|
shun-iwasawa |
1b1839 |
m_currentMode = m_modes.first();
|
|
shun-iwasawa |
6e910b |
connect(modeChanger, SIGNAL(modeChanged(int)), this,
|
|
shun-iwasawa |
6e910b |
SLOT(onModeChanged(int)));
|
|
shun-iwasawa |
6e910b |
}
|
|
shun-iwasawa |
6e910b |
|
|
shun-iwasawa |
1b1839 |
ModeSensitiveBox::ModeSensitiveBox(QWidget *parent, QCheckBox *checkBox)
|
|
shun-iwasawa |
1b1839 |
: QWidget(parent) {
|
|
shun-iwasawa |
1b1839 |
m_modes << 1;
|
|
shun-iwasawa |
1b1839 |
connect(
|
|
shun-iwasawa |
1b1839 |
checkBox, &QCheckBox::stateChanged, this,
|
|
shun-iwasawa |
1b1839 |
[=]() { onModeChanged(checkBox->isChecked() ? 1 : 0); },
|
|
shun-iwasawa |
1b1839 |
Qt::AutoConnection);
|
|
shun-iwasawa |
1b1839 |
}
|
|
shun-iwasawa |
1b1839 |
|
|
shun-iwasawa |
6e910b |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
6e910b |
|
|
shun-iwasawa |
6e910b |
void ModeSensitiveBox::onModeChanged(int modeValue) {
|
|
shun-iwasawa |
6d5bbe |
bool wasVisible = isVisibleTo(parentWidget());
|
|
shun-iwasawa |
1b1839 |
m_currentMode = modeValue;
|
|
shun-iwasawa |
1b1839 |
if (wasVisible == m_modes.contains(modeValue)) return;
|
|
shun-iwasawa |
1b1839 |
setVisible(!wasVisible);
|
|
shun-iwasawa |
1b1839 |
|
|
shun-iwasawa |
1b1839 |
ParamsPage *paramsPage = dynamic_cast<paramspage *="">(parentWidget());</paramspage>
|
|
shun-iwasawa |
1b1839 |
if (paramsPage) emit paramsPage->preferredPageSizeChanged();
|
|
shun-iwasawa |
6e910b |
}
|
|
shun-iwasawa |
6e910b |
|
|
shun-iwasawa |
6e910b |
//=============================================================================
|
|
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)
|
|
shun-iwasawa |
6e910b |
: ModeChangerParamField(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();
|
|
shun-iwasawa |
6e910b |
emit modeChanged(m_actualParam->getValue());
|
|
shun-iwasawa |
6e910b |
|
|
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);
|
|
shun-iwasawa |
6e910b |
emit modeChanged(m_actualParam->getValue());
|
|
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 |
|
|
shun-iwasawa |
832993 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
832993 |
|
|
shun-iwasawa |
832993 |
int EnumParamField::getValue() const { return m_actualParam->getValue(); }
|
|
shun-iwasawa |
832993 |
|
|
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)
|
|
shun-iwasawa |
6e910b |
: ModeChangerParamField(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 |
|
|
shun-iwasawa |
6e910b |
emit modeChanged((checked) ? 1 : 0);
|
|
shun-iwasawa |
6e910b |
|
|
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);
|
|
shun-iwasawa |
6e910b |
emit modeChanged((m_actualParam->getValue()) ? 1 : 0);
|
|
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 |
|
|
shun-iwasawa |
5b2332 |
namespace component {
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5e9027 |
MyTextEdit::MyTextEdit(const QString &text, QWidget *parent)
|
|
shun-iwasawa |
dfd2f7 |
: QTextEdit(text, parent) {}
|
|
shun-iwasawa |
5e9027 |
|
|
shun-iwasawa |
5b2332 |
void MyTextEdit::keyPressEvent(QKeyEvent *event) {
|
|
shun-iwasawa |
5b2332 |
QTextEdit::keyPressEvent(event);
|
|
shun-iwasawa |
5b2332 |
if (event->key() == Qt::Key_Return) emit edited();
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void MyTextEdit::focusOutEvent(QFocusEvent *event) {
|
|
shun-iwasawa |
5b2332 |
QTextEdit::focusOutEvent(event);
|
|
shun-iwasawa |
5b2332 |
emit edited();
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5e9027 |
|
|
shun-iwasawa |
cac18a |
}; // namespace component
|
|
shun-iwasawa |
5b2332 |
|
|
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());
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
5b2332 |
bool ret = true;
|
|
shun-iwasawa |
5b2332 |
if (param->isMultiLineEnabled()) {
|
|
shun-iwasawa |
5b2332 |
m_multiTextFld = new component::MyTextEdit(name, this);
|
|
shun-iwasawa |
5b2332 |
m_multiTextFld->setFixedHeight(80);
|
|
shun-iwasawa |
5b2332 |
m_multiTextFld->setAcceptRichText(false);
|
|
shun-iwasawa |
5b2332 |
m_multiTextFld->setStyleSheet(
|
|
shun-iwasawa |
5b2332 |
"background:white;\ncolor:black;\nborder:1 solid black;");
|
|
shun-iwasawa |
5b2332 |
ret = ret &&
|
|
shun-iwasawa |
5b2332 |
connect(m_multiTextFld, SIGNAL(edited()), this, SLOT(onChange()));
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(m_multiTextFld);
|
|
shun-iwasawa |
5b2332 |
} else {
|
|
shun-iwasawa |
5b2332 |
m_textFld = new LineEdit(name, this);
|
|
shun-iwasawa |
5b2332 |
m_textFld->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
shun-iwasawa |
5b2332 |
ret = ret &&
|
|
shun-iwasawa |
5b2332 |
connect(m_textFld, SIGNAL(editingFinished()), this, SLOT(onChange()));
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(m_textFld);
|
|
shun-iwasawa |
5b2332 |
}
|
|
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() {
|
|
shun-iwasawa |
5b2332 |
std::wstring value;
|
|
shun-iwasawa |
5b2332 |
if (m_multiTextFld)
|
|
shun-iwasawa |
5b2332 |
value = m_multiTextFld->toPlainText().toStdWString();
|
|
shun-iwasawa |
5b2332 |
else
|
|
shun-iwasawa |
2d3c43 |
value = m_textFld->text().toStdWString();
|
|
shun-iwasawa |
5b2332 |
TUndo *undo = 0;
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
if (!m_actualParam || m_actualParam->getValue() == value) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
5b2332 |
if (m_actualParam->getValue() != value)
|
|
shun-iwasawa |
5b2332 |
undo = new StringParamFieldUndo(m_actualParam, 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());
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
5b2332 |
if (m_textFld) {
|
|
shun-iwasawa |
5b2332 |
if (m_textFld->text() == strValue) return;
|
|
shun-iwasawa |
5b2332 |
m_textFld->setText(strValue);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
// Faccio in modo che il cursore sia sulla prima cifra, cosi' se la stringa
|
|
shun-iwasawa |
5b2332 |
// da visualizzare e' piu' lunga del campo le cifre che vengono troncate
|
|
shun-iwasawa |
5b2332 |
// sono
|
|
shun-iwasawa |
5b2332 |
// le ultime e non le prime (dovrebbero essere quelle dopo la virgola).
|
|
shun-iwasawa |
5b2332 |
m_textFld->setCursorPosition(0);
|
|
shun-iwasawa |
5b2332 |
} else {
|
|
shun-iwasawa |
5b2332 |
if (m_multiTextFld->toPlainText() == strValue) return;
|
|
shun-iwasawa |
5b2332 |
m_multiTextFld->setPlainText(strValue);
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//=============================================================================
|
|
shun-iwasawa |
5b2332 |
// FontParamField
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
FontParamField::FontParamField(QWidget *parent, QString name,
|
|
shun-iwasawa |
5b2332 |
const TFontParamP ¶m)
|
|
shun-iwasawa |
5b2332 |
: ParamField(parent, name, param) {
|
|
shun-iwasawa |
5b2332 |
m_paramName = QString::fromStdString(param->getName());
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
m_fontCombo = new QFontComboBox(this);
|
|
shun-iwasawa |
5b2332 |
m_styleCombo = new QComboBox(this);
|
|
shun-iwasawa |
5b2332 |
m_sizeField = new IntField(this, false);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
m_sizeField->setRange(1, 500);
|
|
shun-iwasawa |
5b2332 |
m_sizeField->enableSlider(false);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(m_fontCombo);
|
|
shun-iwasawa |
5b2332 |
m_layout->addSpacing(5);
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(new QLabel(tr("Style:"), this), 0,
|
|
shun-iwasawa |
5b2332 |
Qt::AlignRight | Qt::AlignVCenter);
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(m_styleCombo);
|
|
shun-iwasawa |
5b2332 |
m_layout->addSpacing(5);
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(new QLabel(tr("Size:"), this), 0,
|
|
shun-iwasawa |
5b2332 |
Qt::AlignRight | Qt::AlignVCenter);
|
|
shun-iwasawa |
5b2332 |
m_layout->addWidget(m_sizeField);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
m_layout->addStretch();
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
setLayout(m_layout);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
bool ret = true;
|
|
shun-iwasawa |
2d3c43 |
ret = ret && connect(m_fontCombo, SIGNAL(activated(const QString &)), this,
|
|
shun-iwasawa |
2d3c43 |
SLOT(onChange()));
|
|
shun-iwasawa |
5b2332 |
ret = ret && connect(m_styleCombo, SIGNAL(activated(const QString &)), this,
|
|
shun-iwasawa |
5b2332 |
SLOT(onChange()));
|
|
shun-iwasawa |
5b2332 |
ret = ret && connect(m_sizeField, SIGNAL(valueChanged(bool)), this,
|
|
shun-iwasawa |
5b2332 |
SLOT(onSizeChange(bool)));
|
|
shun-iwasawa |
5b2332 |
assert(ret);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
findStyles(m_fontCombo->currentFont());
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void FontParamField::findStyles(const QFont &font) {
|
|
shun-iwasawa |
5b2332 |
QFontDatabase fontDatabase;
|
|
shun-iwasawa |
5b2332 |
QString currentItem = m_styleCombo->currentText();
|
|
shun-iwasawa |
5b2332 |
m_styleCombo->clear();
|
|
shun-iwasawa |
5b2332 |
|
|
otakuto |
dfe1cf |
for (const QString &style : fontDatabase.styles(font.family()))
|
|
shun-iwasawa |
5b2332 |
m_styleCombo->addItem(style);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
int styleIndex = m_styleCombo->findText(currentItem);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
if (styleIndex == -1)
|
|
shun-iwasawa |
5b2332 |
m_styleCombo->setCurrentIndex(0);
|
|
shun-iwasawa |
5b2332 |
else
|
|
shun-iwasawa |
5b2332 |
m_styleCombo->setCurrentIndex(styleIndex);
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void FontParamField::onSizeChange(bool isDragging) {
|
|
shun-iwasawa |
5b2332 |
if (isDragging) return;
|
|
shun-iwasawa |
5b2332 |
onChange();
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void FontParamField::onChange() {
|
|
shun-iwasawa |
5b2332 |
QString family = m_fontCombo->currentFont().family();
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
2d3c43 |
TFontParamP fontParam = m_actualParam;
|
|
shun-iwasawa |
2d3c43 |
QFont currentFont;
|
|
shun-iwasawa |
2d3c43 |
currentFont.fromString(QString::fromStdWString(fontParam->getValue()));
|
|
shun-iwasawa |
2d3c43 |
if (family != currentFont.family()) {
|
|
shun-iwasawa |
2d3c43 |
findStyles(QFont(family));
|
|
shun-iwasawa |
2d3c43 |
}
|
|
shun-iwasawa |
2d3c43 |
QString style = m_styleCombo->currentText();
|
|
shun-iwasawa |
2d3c43 |
int size = m_sizeField->getValue();
|
|
shun-iwasawa |
5b2332 |
int min, max;
|
|
shun-iwasawa |
5b2332 |
m_sizeField->getRange(min, max);
|
|
shun-iwasawa |
5b2332 |
if (size < min) size = min;
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
QFontDatabase fontDatabase;
|
|
shun-iwasawa |
5b2332 |
QFont font = fontDatabase.font(family, style, 10);
|
|
shun-iwasawa |
5b2332 |
font.setPixelSize(size);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
TUndo *undo = 0;
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
if (fontParam && currentFont != font)
|
|
shun-iwasawa |
5b2332 |
undo = new FontParamFieldUndo(fontParam, m_interfaceName,
|
|
shun-iwasawa |
5b2332 |
ParamField::m_fxHandleStat);
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
m_actualParam->setValue(font.toString().toStdWString());
|
|
shun-iwasawa |
5b2332 |
emit currentParamChanged();
|
|
shun-iwasawa |
5b2332 |
m_currentParam->setValue(font.toString().toStdWString());
|
|
shun-iwasawa |
5b2332 |
emit actualParamChanged();
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
if (undo) TUndoManager::manager()->add(undo);
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void FontParamField::setParam(const TParamP ¤t, const TParamP &actual,
|
|
shun-iwasawa |
5b2332 |
int frame) {
|
|
shun-iwasawa |
5b2332 |
m_currentParam = current;
|
|
shun-iwasawa |
5b2332 |
m_actualParam = actual;
|
|
shun-iwasawa |
5b2332 |
assert(m_currentParam);
|
|
shun-iwasawa |
5b2332 |
assert(m_actualParam);
|
|
shun-iwasawa |
5b2332 |
update(frame);
|
|
shun-iwasawa |
5b2332 |
}
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
5b2332 |
|
|
shun-iwasawa |
5b2332 |
void FontParamField::update(int frame) {
|
|
shun-iwasawa |
5b2332 |
if (!m_actualParam || !m_currentParam) return;
|
|
shun-iwasawa |
5b2332 |
QFont font;
|
|
shun-iwasawa |
5b2332 |
font.fromString(QString::fromStdWString(m_actualParam->getValue()));
|
|
shun-iwasawa |
2d3c43 |
if (m_fontCombo->currentText() != font.family()) {
|
|
shun-iwasawa |
5b2332 |
m_fontCombo->setCurrentFont(font);
|
|
shun-iwasawa |
2d3c43 |
findStyles(font);
|
|
shun-iwasawa |
2d3c43 |
}
|
|
shun-iwasawa |
5b2332 |
m_styleCombo->setCurrentText(font.styleName());
|
|
shun-iwasawa |
5b2332 |
m_sizeField->setValue(font.pixelSize());
|
|
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)));
|
|
shun-iwasawa |
0ed559 |
// on enlarged, make the ParamPageSet to recompute the preferred size
|
|
shun-iwasawa |
0ed559 |
if (paramsPage)
|
|
shun-iwasawa |
0ed559 |
connect(m_toneCurveField, SIGNAL(sizeChanged()), paramsPage,
|
|
shun-iwasawa |
0ed559 |
SIGNAL(preferredPageSizeChanged()));
|
|
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) {
|
|
shun-iwasawa |
2d3c43 |
assert(m_currentParam && m_currentParam->getCurrentChannel() ==
|
|
shun-iwasawa |
2d3c43 |
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 |
|
|
luz paz |
f71e6c |
QSize ToneCurveParamField::getPreferredSize() {
|
|
shun-iwasawa |
0ed559 |
if (m_toneCurveField->isEnlarged())
|
|
shun-iwasawa |
0ed559 |
return QSize(676, 640);
|
|
shun-iwasawa |
0ed559 |
else
|
|
shun-iwasawa |
0ed559 |
return QSize(420, 384);
|
|
shun-iwasawa |
0ed559 |
}
|
|
shun-iwasawa |
0ed559 |
|
|
shun-iwasawa |
0ed559 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
0ed559 |
|
|
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);
|
|
shun-iwasawa |
5b2332 |
else if (TFontParamP fontParam = param)
|
|
shun-iwasawa |
5b2332 |
return new FontParamField(parent, name, fontParam);
|
|
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 |
}
|