af90cdedbe
* add multi arc mockup * implement mutli arc * add join and smooth option * reset multiarc and arc when deactivated * create self loop if the last point is the same as the first * make join option in multiarc consistent with tape tool * fix a bug where thickness don't affect mutliarc in vector level * remove join option in geometric tool * stop mutliarc after closing shape * double click can also end multi arc * fix a bug where multiArc will produce buggy stroke * fix a bug where geometric tools is not deactivated * add multiArc shortcut * rewrite multiArc * revert changes to tvectorimage * add undo data for multiArc * Paste as Copy Command for XSheet * Remove unneeded code * Bug fix * prevent guide lines from jumping around in MultiArc * make stroke color consistent in MultiArc * remove color in MultiArc's undo data * make color consistent in MultiArc with previous version * Fix single image raster levels * fix compilation error * fix a bug where multiArc might generate bugged stroke * Remove ICONV dep (#3304) * fix crash on saving studio palette * Move to Paste Special Menu * Don't Set Fixed Width if Docking a Floating Panel * Update how_to_build_win.md New draft of pr for requested changes to windows build instructions. * fix geometric tool multiarc smooth option * fix level saving failure * fix wrong warning after saving palette * fix a bug where moving a control point while holding alt has unintended result * fix travis-install (#3389) * Fix assert debug crash in flipconsole.cpp Fix crash when using the viewer controls in the console (debug) * Redraw Audio Waveform Fills the waveform rather than outlines it. * Update .gitignore * fix undo data when drawing arc and mutliarc * fix overwriting raster drawing palette (#3387) * mode sensitive fx settings * Create New Style Command Button (#3394) * Create New Style Command Button This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz. Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com> * Update paletteviewergui.cpp Made changes to the PR per request by Shun. * Fixed a space within the code that wasn't suppose to be there. Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> * tahoma license (#3396) * new style button optional * fix loading pegbars (removing updateKeyframes) * periodic random expression * add fx in linear color space this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd. in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories. * fractal noise iwa fx * skip unnecessary icon invalidation * fix frame range fill with tablet * stop function editor to open by dbl clicking key * Expanding the radius of the rotation handle. This just changes when the cursor transforms into the rotation tool. (cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39) * fix vector img patern stroke style * Update Stylesheets - Support the new icon sizes - XSheet and Timeline significantly redesigned - Lots of margin fixes and refactoring - Remove deprecated icons, as some icons are moved into binary - New Light theme * New Icons - Redesigns almost every icon as symbolic - Adds icons for most commands * Add Option for Icon Themes - Adds option for icon themes - Removes useless label from Preferences category list * Update Icon Functions - Adds themePath() boolean - Adds function for recoloring black pixels in pixmaps to any color - Rebuilds createQIcon to use fromTheme() and recolorPixmap() - Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon - Removes a grey horizontal line drawn above the console play bar in the viewer * Set Default Icon Theme and Paths - Sets search paths for icons for use with QIcon::fromTheme() - Sets default start icon theme on first install - Sets flag for displaying icons in menus, so we can selectively hide them * Set Icons for Commands - Sets icons for the commands - Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16 - Selectively allows icons to display for Tools in menus * Change Icon Sizes, General Fixes and Stylesheet Additions - Change icon sizes to new size - Remove margin around FX Editor window - Remove white line under color sliders in Style Editor - Make keyframe icons uniform and color stylable in the stylesheets - Removes deprecated stylesheet strings - Redesign GUI for palette list view - Make tree list header sort row stylable - Remove black lines from scrollbars in New Project window - Remove margin around combobox in Level Strip - Alter how some lines are drawn in the Timeline to fix some alpha issues - Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility - Make text always viewable in the FPS field in console bar - Increase size of radio buttons in Cleanup Settings - Increase size of switches in motion path nodes - Remove unessesary "Layer" label in Timeline and other rects - Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more - Moves some external stylesheet icons into binary * Make TPanelTitleBar Icon States Stylable - Makes icon states for TPanelTitleBar buttons stylable in stylesheets * Travis Fixes * Swap Startup Popup Logos They were in the wrong folders * Revert "Swap Startup Popup Logos" This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d. * Fix Startup Popup Logo It wasn't switching * Feedback Changes - Change render visualization to clapboard - Fix text contrast on levels in XSheet * Make Cell Selection More Clear * Darken Light Theme and Tint Empty Cell Selection * Fix missing icons * Fix memo button * Bring back colors * Hide Motion Tab * Fix Play Range Area (Light) Make play range area more visible * Vector Column Color Co-authored-by: pojienie <pojienie@gmail.com> Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp> Co-authored-by: Rodney <rodney.baker@gmail.com> Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com> Co-authored-by: Kite <konero@users.noreply.github.com> Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
943 lines
26 KiB
C++
943 lines
26 KiB
C++
#pragma once
|
|
|
|
#ifndef PARAMFIELD_H
|
|
#define PARAMFIELD_H
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma warning(disable : 4251)
|
|
#endif
|
|
|
|
#include "tcommon.h"
|
|
#include <QWidget>
|
|
#include <QSpinBox>
|
|
#include <QSlider>
|
|
#include <QCheckBox>
|
|
#include <QButtonGroup>
|
|
#include <QRadioButton>
|
|
#include <QPushButton>
|
|
#include <QTextEdit>
|
|
#include <QPainterPath>
|
|
|
|
#include "tgeometry.h"
|
|
#include "tparam.h"
|
|
#include "tnotanimatableparam.h"
|
|
#include "tspectrumparam.h"
|
|
#include "ttonecurveparam.h"
|
|
#include "tdoubleparam.h"
|
|
#include "toonz/tfxhandle.h"
|
|
#include "historytypes.h"
|
|
|
|
#undef DVAPI
|
|
#undef DVVAR
|
|
#ifdef TOONZQT_EXPORTS
|
|
#define DVAPI DV_EXPORT_API
|
|
#define DVVAR DV_EXPORT_VAR
|
|
#else
|
|
#define DVAPI DV_IMPORT_API
|
|
#define DVVAR DV_IMPORT_VAR
|
|
#endif
|
|
|
|
// forward declaration
|
|
class QString;
|
|
class QComboBox;
|
|
class QHBoxLayout;
|
|
class TFxHandle;
|
|
class QFontComboBox;
|
|
|
|
namespace DVGui {
|
|
class LineEdit;
|
|
class IntField;
|
|
class DoubleField;
|
|
class MeasuredDoubleField;
|
|
class MeasuredDoublePairField;
|
|
class ColorField;
|
|
class SpectrumField;
|
|
class ToneCurveField;
|
|
class CheckBox;
|
|
} // namespace DVGui
|
|
|
|
//=============================================================================
|
|
/*! \brief ParamField.
|
|
|
|
Inherits \b QWidget.
|
|
*/
|
|
class DVAPI ParamField : public QWidget {
|
|
Q_OBJECT
|
|
|
|
protected:
|
|
QHBoxLayout *m_layout;
|
|
QString m_paramName;
|
|
|
|
static TFxHandle *m_fxHandleStat;
|
|
QString m_interfaceName;
|
|
QString m_description;
|
|
|
|
public:
|
|
ParamField(QWidget *parent, QString paramName, const TParamP ¶m,
|
|
bool addEmptyLabel = true);
|
|
~ParamField();
|
|
|
|
QString getParamName() const { return m_paramName; }
|
|
QString getUIName() const { return m_interfaceName; }
|
|
QString getDescription() const { return m_description; }
|
|
|
|
virtual void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) = 0;
|
|
|
|
virtual void update(int frame) = 0;
|
|
|
|
static ParamField *create(QWidget *parent, QString name,
|
|
const TParamP ¶m);
|
|
|
|
virtual void setPointValue(const TPointD &p){};
|
|
|
|
virtual QSize getPreferedSize() { return QSize(200, 28); }
|
|
|
|
static void setFxHandle(TFxHandle *fxHandle);
|
|
|
|
virtual void setPrecision(int precision) {}
|
|
signals:
|
|
void currentParamChanged();
|
|
void actualParamChanged();
|
|
void paramKeyToggle();
|
|
};
|
|
|
|
//=============================================================================
|
|
// ParamFieldKeyToggle
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI ParamFieldKeyToggle final : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
QPixmap m_pixmap;
|
|
|
|
// keyframe colors
|
|
QColor m_keyBorderOffColor;
|
|
QColor m_keyBorderOnColor;
|
|
QColor m_keyBorderModifiedColor;
|
|
QColor m_keyBorderInbetweenColor;
|
|
QColor m_keyBorderHighlightColor;
|
|
QColor m_keyOffColor;
|
|
QColor m_keyOnColor;
|
|
QColor m_keyModifiedColor;
|
|
QColor m_keyHighlightColor;
|
|
QColor m_keyInbetweenColor;
|
|
|
|
// keyframe colors
|
|
Q_PROPERTY(QColor KeyBorderOffColor READ getKeyBorderOffColor WRITE
|
|
setKeyBorderOffColor)
|
|
Q_PROPERTY(QColor KeyBorderOnColor READ getKeyBorderOnColor WRITE
|
|
setKeyBorderOnColor)
|
|
Q_PROPERTY(QColor KeyBorderModifiedColor READ getKeyBorderModifiedColor WRITE
|
|
setKeyBorderModifiedColor)
|
|
Q_PROPERTY(QColor KeyBorderInbetweenColor READ getKeyBorderInbetweenColor
|
|
WRITE setKeyBorderInbetweenColor)
|
|
Q_PROPERTY(QColor KeyBorderHighlightColor READ getKeyBorderHighlightColor
|
|
WRITE setKeyBorderHighlightColor)
|
|
Q_PROPERTY(QColor KeyOffColor READ getKeyOffColor WRITE setKeyOffColor)
|
|
Q_PROPERTY(QColor KeyOnColor READ getKeyOnColor WRITE setKeyOnColor)
|
|
Q_PROPERTY(QColor KeyModifiedColor READ getKeyModifiedColor WRITE
|
|
setKeyModifiedColor)
|
|
Q_PROPERTY(QColor KeyInbetweenColor READ getKeyInbetweenColor WRITE
|
|
setKeyInbetweenColor)
|
|
Q_PROPERTY(QColor KeyHighlightColor READ getKeyHighlightColor WRITE
|
|
setKeyHighlightColor)
|
|
|
|
enum Status { NOT_ANIMATED, NOT_KEYFRAME, MODIFIED, KEYFRAME };
|
|
//QPixmap m_pixmap;
|
|
QIcon m_icon;
|
|
//// keyframe colors
|
|
//QColor m_keyOffColor;
|
|
//QColor m_keyOnColor;
|
|
//QColor m_keyModifiedColor;
|
|
//QColor m_keyHighlightColor;
|
|
//QColor m_keyInbetweenColor;
|
|
|
|
//// keyframe colors
|
|
//Q_PROPERTY(QColor KeyOffColor READ getKeyOffColor WRITE setKeyOffColor)
|
|
//Q_PROPERTY(QColor KeyOnColor READ getKeyOnColor WRITE setKeyOnColor)
|
|
//Q_PROPERTY(QColor KeyModifiedColor READ getKeyModifiedColor WRITE
|
|
// setKeyModifiedColor)
|
|
//Q_PROPERTY(QColor KeyInbetweenColor READ getKeyInbetweenColor WRITE
|
|
// setKeyInbetweenColor)
|
|
//Q_PROPERTY(QColor KeyHighlightColor READ getKeyHighlightColor WRITE
|
|
// setKeyHighlightColor)
|
|
|
|
|
|
private:
|
|
Status m_status;
|
|
bool m_highlighted;
|
|
|
|
public:
|
|
ParamFieldKeyToggle(QWidget *parent,
|
|
std::string name = "ParamFieldKeyToggle");
|
|
|
|
void setStatus(Status status);
|
|
Status getStatus() const;
|
|
|
|
void setStatus(bool hasKeyframe, bool isKeyframe, bool hasBeenChanged);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *) override;
|
|
void mousePressEvent(QMouseEvent *) override;
|
|
void enterEvent(QEvent *) override;
|
|
void leaveEvent(QEvent *) override;
|
|
|
|
// keyframe colors
|
|
void setKeyBorderOffColor(const QColor &color) {
|
|
m_keyBorderOffColor = color;
|
|
}
|
|
QColor getKeyBorderOffColor() const { return m_keyBorderOffColor; }
|
|
void setKeyBorderOnColor(const QColor &color) { m_keyBorderOnColor = color; }
|
|
QColor getKeyBorderOnColor() const { return m_keyBorderOnColor; }
|
|
void setKeyBorderModifiedColor(const QColor &color) {
|
|
m_keyBorderModifiedColor = color;
|
|
}
|
|
QColor getKeyBorderModifiedColor() const { return m_keyBorderModifiedColor; }
|
|
void setKeyBorderInbetweenColor(const QColor &color) {
|
|
m_keyBorderInbetweenColor = color;
|
|
}
|
|
QColor getKeyBorderInbetweenColor() const {
|
|
return m_keyBorderInbetweenColor;
|
|
}
|
|
void setKeyBorderHighlightColor(const QColor &color) {
|
|
m_keyBorderHighlightColor = color;
|
|
}
|
|
QColor getKeyBorderHighlightColor() const {
|
|
return m_keyBorderHighlightColor;
|
|
}
|
|
void setKeyOffColor(const QColor &color) { m_keyOffColor = color; }
|
|
QColor getKeyOffColor() const { return m_keyOffColor; }
|
|
void setKeyOnColor(const QColor &color) { m_keyOnColor = color; }
|
|
QColor getKeyOnColor() const { return m_keyOnColor; }
|
|
void setKeyModifiedColor(const QColor &color) { m_keyModifiedColor = color; }
|
|
QColor getKeyModifiedColor() const { return m_keyModifiedColor; }
|
|
void setKeyHighlightColor(const QColor &color) {
|
|
m_keyHighlightColor = color;
|
|
}
|
|
QColor getKeyHighlightColor() const { return m_keyHighlightColor; }
|
|
void setKeyInbetweenColor(const QColor &color) {
|
|
m_keyInbetweenColor = color;
|
|
}
|
|
QColor getKeyInbetweenColor() const { return m_keyInbetweenColor; }
|
|
|
|
signals:
|
|
void keyToggled();
|
|
};
|
|
|
|
//=============================================================================
|
|
// FxSettingsKeyToggleUndo
|
|
//=============================================================================
|
|
template <class T, class ParamP>
|
|
class FxSettingsKeyToggleUndo final : public TUndo {
|
|
TFxHandle *m_fxHandle;
|
|
QString m_name;
|
|
bool m_wasKeyframe;
|
|
int m_frame;
|
|
|
|
ParamP m_param;
|
|
T m_currentValue;
|
|
|
|
public:
|
|
FxSettingsKeyToggleUndo(ParamP param, T currentValue, bool wasKeyFrame,
|
|
QString name, int frame, TFxHandle *fxHandle)
|
|
: m_param(param)
|
|
, m_currentValue(currentValue)
|
|
, m_wasKeyframe(wasKeyFrame)
|
|
, m_name(name)
|
|
, m_frame(frame)
|
|
, m_fxHandle(fxHandle) {}
|
|
|
|
// void notify();
|
|
|
|
void undo() const override {
|
|
if (m_wasKeyframe)
|
|
m_param->setValue(m_frame, m_currentValue);
|
|
else
|
|
m_param->deleteKeyframe(m_frame);
|
|
|
|
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
}
|
|
|
|
void redo() const override {
|
|
if (m_wasKeyframe)
|
|
m_param->deleteKeyframe(m_frame);
|
|
else
|
|
m_param->setValue(m_frame, m_currentValue);
|
|
|
|
if (m_fxHandle) m_fxHandle->notifyFxChanged();
|
|
}
|
|
|
|
int getSize() const override { return sizeof(*this); }
|
|
int getHistoryType() override { return HistoryType::Fx; }
|
|
QString getHistoryString() override {
|
|
QString str =
|
|
QObject::tr("Modify Fx Param : %1 Key : %2 Frame %3")
|
|
.arg((m_wasKeyframe) ? QObject::tr("Delete") : QObject::tr("Set"))
|
|
.arg(m_name)
|
|
.arg(QString::number(m_frame + 1));
|
|
|
|
return str;
|
|
}
|
|
};
|
|
|
|
//=============================================================================
|
|
// AnimatedParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
template <class T, class ParamP>
|
|
class DVAPI AnimatedParamField : public ParamField {
|
|
protected:
|
|
ParamP m_currentParam, m_actualParam;
|
|
int m_frame;
|
|
ParamFieldKeyToggle *m_keyToggle;
|
|
|
|
public:
|
|
AnimatedParamField(QWidget *parent, QString name, const ParamP ¶m,
|
|
bool addEmptyLabel = true)
|
|
: ParamField(parent, name, param, addEmptyLabel), m_frame(0) {
|
|
m_keyToggle = new ParamFieldKeyToggle(this);
|
|
}
|
|
|
|
virtual void updateField(T value) = 0;
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) override {
|
|
m_currentParam = current;
|
|
m_actualParam = actual;
|
|
assert(m_currentParam);
|
|
assert(m_actualParam);
|
|
update(frame);
|
|
}
|
|
void update(int frame) override {
|
|
m_frame = frame;
|
|
if (!m_actualParam || !m_currentParam) return;
|
|
T value = m_actualParam->getValue(m_frame);
|
|
if (m_actualParam->isKeyframe(m_frame))
|
|
m_currentParam->setValue(m_frame, value);
|
|
else if (!m_actualParam.getPointer()->hasKeyframes())
|
|
m_currentParam->setDefaultValue(value);
|
|
updateField(value);
|
|
updateKeyToggle();
|
|
}
|
|
|
|
void updateKeyToggle() {
|
|
T stroke = m_actualParam->getValue(m_frame);
|
|
T stroke2 = m_currentParam->getValue(m_frame);
|
|
m_keyToggle->setStatus(
|
|
m_actualParam->hasKeyframes(), m_actualParam->isKeyframe(m_frame),
|
|
m_actualParam->getValue(m_frame) != m_currentParam->getValue(m_frame));
|
|
}
|
|
|
|
/*--
|
|
* エフェクトの位置パラメータをSwatchViewerでドラッグして編集するときに呼ばれる
|
|
* ---*/
|
|
void setValue(T value) {
|
|
if (m_currentParam->getValue(m_frame) == value) return;
|
|
m_currentParam->setValue(m_frame, value);
|
|
/*-- キーフレーム上で操作した場合 --*/
|
|
if (m_actualParam->isKeyframe(m_frame)) {
|
|
m_actualParam->setValue(m_frame, value);
|
|
emit actualParamChanged();
|
|
}
|
|
/*-- キーフレーム無い場合 --*/
|
|
else if (!m_actualParam.getPointer()->hasKeyframes()) {
|
|
m_actualParam->setDefaultValue(value);
|
|
emit actualParamChanged();
|
|
}
|
|
/*-- 他にキーフレームがあって、キーフレーム以外のフレームで操作した場合 --*/
|
|
emit currentParamChanged();
|
|
updateKeyToggle();
|
|
}
|
|
|
|
void onKeyToggle() {
|
|
T currentVal = m_currentParam->getValue(m_frame);
|
|
bool wasKeyFrame;
|
|
|
|
if (m_keyToggle->getStatus() == ParamFieldKeyToggle::KEYFRAME) {
|
|
m_actualParam->deleteKeyframe(m_frame);
|
|
update(m_frame);
|
|
wasKeyFrame = true;
|
|
} else {
|
|
m_actualParam->setValue(m_frame, m_currentParam->getValue(m_frame));
|
|
updateKeyToggle();
|
|
wasKeyFrame = false;
|
|
}
|
|
emit actualParamChanged();
|
|
emit paramKeyToggle();
|
|
|
|
TUndoManager::manager()->add(new FxSettingsKeyToggleUndo<T, ParamP>(
|
|
m_actualParam, currentVal, wasKeyFrame, m_interfaceName, m_frame,
|
|
ParamField::m_fxHandleStat));
|
|
}
|
|
};
|
|
|
|
//=============================================================================
|
|
// MeasuredDoubleParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI MeasuredDoubleParamField final
|
|
: public AnimatedParamField<double, TDoubleParamP> {
|
|
Q_OBJECT
|
|
|
|
DVGui::MeasuredDoubleField *m_measuredDoubleField;
|
|
|
|
public:
|
|
MeasuredDoubleParamField(QWidget *parent, QString name,
|
|
const TDoubleParamP ¶m);
|
|
|
|
void updateField(double value) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(260, 28); }
|
|
|
|
protected slots:
|
|
void onChange(bool);
|
|
void onKeyToggled();
|
|
};
|
|
|
|
//=============================================================================
|
|
// RangeParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI MeasuredRangeParamField final
|
|
: public AnimatedParamField<DoublePair, TRangeParamP> {
|
|
Q_OBJECT
|
|
|
|
DVGui::MeasuredDoublePairField *m_valueField;
|
|
|
|
public:
|
|
MeasuredRangeParamField(QWidget *parent, QString name,
|
|
const TRangeParamP ¶m);
|
|
|
|
void updateField(DoublePair value) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(300, 20); }
|
|
void setPrecision(int precision) override;
|
|
|
|
protected slots:
|
|
void onChange(bool);
|
|
void onKeyToggled();
|
|
};
|
|
|
|
//=============================================================================
|
|
// PointParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI PointParamField final
|
|
: public AnimatedParamField<TPointD, TPointParamP> {
|
|
Q_OBJECT
|
|
|
|
DVGui::MeasuredDoubleField *m_xFld, *m_yFld;
|
|
|
|
public:
|
|
PointParamField(QWidget *parent, QString name, const TPointParamP ¶m);
|
|
|
|
void setPointValue(const TPointD &p) override;
|
|
|
|
void updateField(TPointD value) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(270, 28); }
|
|
|
|
protected slots:
|
|
void onChange(bool);
|
|
void onKeyToggled();
|
|
};
|
|
|
|
//=============================================================================
|
|
// PixelParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI PixelParamField final
|
|
: public AnimatedParamField<TPixel32, TPixelParamP> {
|
|
Q_OBJECT
|
|
|
|
DVGui::ColorField *m_colorField;
|
|
|
|
public:
|
|
PixelParamField(QWidget *parent, QString name, const TPixelParamP ¶m);
|
|
|
|
void updateField(TPixel32 value) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(480, 40); }
|
|
|
|
/*-- RgbLinkButtonの実行のため --*/
|
|
TPixel32 getColor();
|
|
void setColor(TPixel32 value);
|
|
|
|
protected:
|
|
void setParams();
|
|
|
|
protected slots:
|
|
void onChange(const TPixel32 &value, bool isDragging);
|
|
void onKeyToggled();
|
|
};
|
|
|
|
//=============================================================================
|
|
// RGB Link Button
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI RgbLinkButtons final : public QWidget {
|
|
Q_OBJECT
|
|
PixelParamField *m_field1, *m_field2;
|
|
|
|
public:
|
|
RgbLinkButtons(QString str1, QString str2, QWidget *parent,
|
|
PixelParamField *field1, PixelParamField *field2);
|
|
|
|
protected slots:
|
|
void onCopyButtonClicked();
|
|
void onSwapButtonClicked();
|
|
};
|
|
|
|
//=============================================================================
|
|
// SpectrumParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI SpectrumParamField final
|
|
: public AnimatedParamField<TSpectrum, TSpectrumParamP> {
|
|
Q_OBJECT
|
|
|
|
DVGui::SpectrumField *m_spectrumField;
|
|
|
|
public:
|
|
SpectrumParamField(QWidget *parent, QString name,
|
|
const TSpectrumParamP ¶m);
|
|
|
|
void updateField(TSpectrum value) override;
|
|
|
|
void setParams();
|
|
|
|
QSize getPreferedSize() override { return QSize(477, 60); }
|
|
|
|
protected slots:
|
|
void onKeyToggled();
|
|
void onChange(bool isDragging);
|
|
void onKeyAdded(int keyIndex);
|
|
void onKeyRemoved(int keyIndex);
|
|
};
|
|
|
|
//=============================================================================
|
|
// Mode Sensitive Box
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class ModeChangerParamField : public ParamField {
|
|
Q_OBJECT
|
|
public:
|
|
ModeChangerParamField(QWidget *parent, QString paramName,
|
|
const TParamP ¶m, bool addEmptyLabel = true)
|
|
: ParamField(parent, paramName, param, addEmptyLabel) {}
|
|
signals:
|
|
void modeChanged(int);
|
|
};
|
|
|
|
class DVAPI ModeSensitiveBox final : public QWidget {
|
|
Q_OBJECT
|
|
QList<int> m_modes;
|
|
|
|
public:
|
|
ModeSensitiveBox(QWidget *parent, ModeChangerParamField *modeChanger,
|
|
QList<int> modes);
|
|
QList<int> modes() { return m_modes; }
|
|
protected slots:
|
|
void onModeChanged(int mode);
|
|
};
|
|
|
|
//=============================================================================
|
|
// EnumParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class EnumParamField final : public ModeChangerParamField {
|
|
Q_OBJECT
|
|
|
|
TIntEnumParamP m_currentParam, m_actualParam;
|
|
QComboBox *m_om;
|
|
|
|
public:
|
|
EnumParamField(QWidget *parent, QString name, const TIntEnumParamP ¶m);
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(150, 20); }
|
|
|
|
protected slots:
|
|
void onChange(const QString &str);
|
|
};
|
|
|
|
//=============================================================================
|
|
// BoolParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI BoolParamField final : public ModeChangerParamField {
|
|
Q_OBJECT
|
|
|
|
TBoolParamP m_currentParam, m_actualParam;
|
|
DVGui::CheckBox *m_checkBox;
|
|
|
|
public:
|
|
BoolParamField(QWidget *parent, QString name, const TBoolParamP ¶m);
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(20, 15); }
|
|
|
|
protected slots:
|
|
void onToggled(bool checked);
|
|
|
|
/*-- visibleToggle UIで使用する --*/
|
|
signals:
|
|
void toggled(bool);
|
|
};
|
|
|
|
//=============================================================================
|
|
// IntParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI IntParamField final : public ParamField {
|
|
Q_OBJECT
|
|
|
|
TIntParamP m_currentParam, m_actualParam;
|
|
DVGui::IntField *m_intField;
|
|
typedef IntParamField This;
|
|
|
|
public:
|
|
IntParamField(QWidget *parent = 0, QString name = 0,
|
|
const TIntParamP ¶m = 0);
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(50, 20); }
|
|
|
|
protected slots:
|
|
void onChange(bool isDragging = false);
|
|
};
|
|
|
|
//=============================================================================
|
|
// StringParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace component {
|
|
class MyTextEdit : public QTextEdit {
|
|
Q_OBJECT
|
|
public:
|
|
MyTextEdit(const QString &text, QWidget *parent = Q_NULLPTR)
|
|
: QTextEdit(text, parent) {}
|
|
|
|
protected:
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
void focusOutEvent(QFocusEvent *e) override;
|
|
|
|
signals:
|
|
void edited();
|
|
};
|
|
}; // namespace component
|
|
|
|
class DVAPI StringParamField final : public ParamField {
|
|
Q_OBJECT
|
|
|
|
TStringParamP m_currentParam, m_actualParam;
|
|
DVGui::LineEdit *m_textFld = nullptr;
|
|
component::MyTextEdit *m_multiTextFld = nullptr;
|
|
|
|
public:
|
|
StringParamField(QWidget *parent, QString name, const TStringParamP ¶m);
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
QSize getPreferedSize() override {
|
|
if (m_textFld)
|
|
return QSize(100, 20);
|
|
else
|
|
return QSize(100, 80);
|
|
}
|
|
protected slots:
|
|
void onChange();
|
|
};
|
|
|
|
//=============================================================================
|
|
// FontParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class FontParamField final : public ParamField {
|
|
Q_OBJECT
|
|
|
|
TFontParamP m_currentParam, m_actualParam;
|
|
|
|
QFontComboBox *m_fontCombo;
|
|
QComboBox *m_styleCombo;
|
|
DVGui::IntField *m_sizeField;
|
|
|
|
public:
|
|
FontParamField(QWidget *parent, QString name, const TFontParamP ¶m);
|
|
|
|
void setParam(const TParamP ¤t, const TParamP &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
QSize getPreferedSize() override { return QSize(150, 20); }
|
|
|
|
protected slots:
|
|
void findStyles(const QFont &font);
|
|
void onSizeChange(bool);
|
|
void onChange();
|
|
};
|
|
|
|
//=============================================================================
|
|
// ToneCurveParamField
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class DVAPI ToneCurveParamField final
|
|
: public AnimatedParamField<const QList<TPointD>, TToneCurveParamP> {
|
|
Q_OBJECT
|
|
|
|
DVGui::ToneCurveField *m_toneCurveField;
|
|
|
|
public:
|
|
ToneCurveParamField(QWidget *parent, QString name,
|
|
const TToneCurveParamP ¶m);
|
|
|
|
void updateField(const QList<TPointD> value) override;
|
|
|
|
void setParams();
|
|
|
|
QSize getPreferedSize() override;
|
|
|
|
protected slots:
|
|
void onChannelChanged(int);
|
|
|
|
void onChange(bool isDragging);
|
|
void onPointAdded(int index);
|
|
void onPointRemoved(int index);
|
|
void onIsLinearChanged(bool);
|
|
|
|
void onKeyToggled();
|
|
};
|
|
|
|
namespace component {
|
|
class DVAPI LineEdit_double final : public ParamField {
|
|
Q_OBJECT; // could not use templates for Q_OBJECT
|
|
|
|
int frame_;
|
|
TDoubleParamP current_;
|
|
TDoubleParamP actual_;
|
|
QLineEdit *value_;
|
|
|
|
public:
|
|
LineEdit_double(QWidget *parent, QString name, TDoubleParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(QString const &text); // could not use MACROs for slots
|
|
};
|
|
|
|
class DVAPI Slider_double final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TDoubleParamP current_;
|
|
TDoubleParamP actual_;
|
|
QSlider *value_;
|
|
|
|
public:
|
|
Slider_double(QWidget *parent, QString name, TDoubleParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(int);
|
|
};
|
|
|
|
class DVAPI SpinBox_double final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TDoubleParamP current_;
|
|
TDoubleParamP actual_;
|
|
QDoubleSpinBox *value_;
|
|
|
|
public:
|
|
SpinBox_double(QWidget *parent, QString name, TDoubleParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(double);
|
|
};
|
|
} // namespace component
|
|
|
|
namespace component {
|
|
class DVAPI LineEdit_int final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TIntParamP current_;
|
|
TIntParamP actual_;
|
|
QLineEdit *value_;
|
|
|
|
public:
|
|
LineEdit_int(QWidget *parent, QString name, TIntParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(QString const &text);
|
|
};
|
|
|
|
class DVAPI Slider_int final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TIntParamP current_;
|
|
TIntParamP actual_;
|
|
QSlider *value_;
|
|
|
|
public:
|
|
Slider_int(QWidget *parent, QString name, TIntParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(int);
|
|
};
|
|
|
|
class DVAPI SpinBox_int final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TIntParamP current_;
|
|
TIntParamP actual_;
|
|
QSpinBox *value_;
|
|
|
|
public:
|
|
SpinBox_int(QWidget *parent, QString name, TIntParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(int);
|
|
};
|
|
|
|
} // end of namespace component
|
|
|
|
namespace component {
|
|
class DVAPI CheckBox_bool final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TBoolParamP current_;
|
|
TBoolParamP actual_;
|
|
QCheckBox *value_;
|
|
|
|
public:
|
|
CheckBox_bool(QWidget *parent, QString name, TBoolParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(int);
|
|
};
|
|
|
|
} // end of namespace component
|
|
|
|
namespace component {
|
|
class DVAPI RadioButton_enum final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TIntEnumParamP current_;
|
|
TIntEnumParamP actual_;
|
|
QButtonGroup *value_;
|
|
|
|
public:
|
|
RadioButton_enum(QWidget *parent, QString name, TIntEnumParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(int);
|
|
};
|
|
|
|
class DVAPI ComboBox_enum final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TIntEnumParamP current_;
|
|
TIntEnumParamP actual_;
|
|
QComboBox *value_;
|
|
|
|
public:
|
|
ComboBox_enum(QWidget *parent, QString name, TIntEnumParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(int);
|
|
};
|
|
} // end of namespace component
|
|
|
|
namespace component {
|
|
class DVAPI LineEdit_string final : public ParamField {
|
|
Q_OBJECT;
|
|
|
|
int frame_;
|
|
TStringParamP current_;
|
|
TStringParamP actual_;
|
|
QLineEdit *value_;
|
|
|
|
public:
|
|
LineEdit_string(QWidget *parent, QString name, TStringParamP const ¶m);
|
|
|
|
void setParam(TParamP const ¤t, TParamP const &actual,
|
|
int frame) override;
|
|
void update(int frame) override;
|
|
|
|
protected slots:
|
|
void update_value(QString const &);
|
|
};
|
|
} // end of namespace component
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define TOONZ_DECLARE_MAKE_WIDGET(NAME) \
|
|
ParamField *NAME(QWidget *parent, QString name, TParamP const ¶m)
|
|
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_lineedit);
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_slider);
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_spinbox);
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_checkbox);
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_radiobutton);
|
|
TOONZ_DECLARE_MAKE_WIDGET(make_combobox);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // PARAMFIELD_H
|