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