|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/fxsettings.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/keyframenavigator.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvdialog.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/fxhistogramrender.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/histogram.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tmacrofx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tparamcontainer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tspectrumparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxattributes.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toutputproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "pluginhost.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tenv.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcamera.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/toonzfolders.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcolumnfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tscenehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevelhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tobjecthandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/scenefx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/toonzscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/sceneproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/preferences.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/stringtable.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qvboxlayout></qvboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbar></qtoolbar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qicon></qicon>
|
|
Toshihiro Shimizu |
890ddd |
#include <qaction></qaction>
|
|
Toshihiro Shimizu |
890ddd |
#include <qstackedwidget></qstackedwidget>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlabel></qlabel>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmap></qmap>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpainter></qpainter>
|
|
Toshihiro Shimizu |
890ddd |
#include <qcheckbox></qcheckbox>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdialog></qdialog>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpushbutton></qpushbutton>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qdesktopservices></qdesktopservices>
|
|
Toshihiro Shimizu |
890ddd |
#include <qurl></qurl>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace DVGui;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TFxP getCurrentFx(const TFxP ¤tFx, std::wstring actualId) {
|
|
Shinya Kitaoka |
120a6e |
if (currentFx->getFxId() == actualId) return currentFx;
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < currentFx->getInputPortCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
TFxP fx = getCurrentFx(currentFx->getInputPort(i)->getFx(), actualId);
|
|
Shinya Kitaoka |
120a6e |
if (fx.getPointer()) return fx;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool hasEmptyInputPort(const TFxP ¤tFx) {
|
|
Shinya Kitaoka |
120a6e |
if (!currentFx.getPointer()) return true;
|
|
Shinya Kitaoka |
120a6e |
if (currentFx->getInputPortCount() == 0) return false;
|
|
Shinya Kitaoka |
120a6e |
return hasEmptyInputPort(currentFx->getInputPort(0)->getFx());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
TFxP cloneInputPort(const TFxP ¤tFx)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i=0; i
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
120a6e |
TFx *inputFx = sceneFx->getInputPort(i)->getFx();
|
|
Shinya Kitaoka |
120a6e |
if(inputFx)
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
if(TLevelColumnFx* affFx = dynamic_cast
|
|
Shinya Kitaoka |
120a6e |
>(inputFx))
|
|
Shinya Kitaoka |
120a6e |
currentFx->getInputPort(i)->setFx(inputFx);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
currentFx->getInputPort(i)->setFx(cloneInputPort());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
TFxPort *port = getInputPort(i);
|
|
Shinya Kitaoka |
120a6e |
if (port->getFx())
|
|
Shinya Kitaoka |
120a6e |
fx->connect(getInputPortName(i),
|
|
Shinya Kitaoka |
120a6e |
cloneInputPort(port->getFx()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
void setLevelFxInputPort(const TFxP ¤tFx, const TFxP &sceneFx)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
120a6e |
for (int i=0; i<scenefx->getInputPortCount(); ++i)</scenefx->
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
TFx *inputFx = sceneFx->getInputPort(i)->getFx();
|
|
Shinya Kitaoka |
120a6e |
if(inputFx)
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
if(TLevelColumnFx* affFx = dynamic_cast
|
|
Shinya Kitaoka |
120a6e |
>(inputFx))
|
|
Shinya Kitaoka |
120a6e |
currentFx->getInputPort(i)->setFx(inputFx);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
setLevelFxInputPort(currentFx->getInputPort(i)->getFx(),
|
|
Shinya Kitaoka |
120a6e |
inputFx);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ParamViewer
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ParamsPage::ParamsPage(QWidget *parent, ParamViewer *paramViewer)
|
|
Shinya Kitaoka |
120a6e |
: QFrame(parent)
|
|
Shinya Kitaoka |
120a6e |
, m_paramViewer(paramViewer)
|
|
Shinya Kitaoka |
120a6e |
, m_horizontalLayout(NULL)
|
|
Shinya Kitaoka |
120a6e |
, m_groupLayout(NULL) {
|
|
Shinya Kitaoka |
120a6e |
m_fxHistogramRender = new FxHistogramRender();
|
|
Shinya Kitaoka |
120a6e |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout = new QGridLayout(this);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setMargin(12);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setVerticalSpacing(10);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setHorizontalSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setColumnStretch(0, 0);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setColumnStretch(1, 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setLayout(m_mainLayout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPage::~ParamsPage() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::setPageField(TIStream &is, const TFxP &fx, bool isVertical) {
|
|
Shinya Kitaoka |
120a6e |
// m_horizontalLayout dovrebbe essere stato inizializzato prima di entrare nel
|
|
Shinya Kitaoka |
120a6e |
// metodo, per sicurezza verifico.
|
|
Shinya Kitaoka |
120a6e |
if (isVertical == false && !m_horizontalLayout) {
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout = new QHBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->setSpacing(5);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*--
|
|
Shinya Kitaoka |
120a6e |
* HBoxLayoutを挿入するとき、最初のパラメータ名はGridlayoutのColumn0に入れるため
|
|
Shinya Kitaoka |
120a6e |
* --*/
|
|
Shinya Kitaoka |
120a6e |
bool isFirstParamInRow = true;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
while (!is.matchEndTag()) {
|
|
Shinya Kitaoka |
120a6e |
std::string tagName;
|
|
Shinya Kitaoka |
120a6e |
if (!is.matchTag(tagName)) throw TException("expected tag");
|
|
Shinya Kitaoka |
120a6e |
if (tagName == "control") {
|
|
Shinya Kitaoka |
120a6e |
/*--- 設定ファイルからインタフェースの桁数を決める (PairSliderのみ実装。)
|
|
Shinya Kitaoka |
120a6e |
* ---*/
|
|
Shinya Kitaoka |
120a6e |
int decimals = 0;
|
|
Shinya Kitaoka |
120a6e |
std::string decimalsStr = is.getTagAttribute("decimals");
|
|
Shinya Kitaoka |
120a6e |
if (decimalsStr != "") {
|
|
Shinya Kitaoka |
120a6e |
decimals = QString::fromStdString(decimalsStr).toInt();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
std::string name;
|
|
Shinya Kitaoka |
120a6e |
is >> name;
|
|
Shinya Kitaoka |
120a6e |
is.matchEndTag();
|
|
Shinya Kitaoka |
120a6e |
/*-- Layout設定名とFxParameterの名前が一致するものを取得 --*/
|
|
Shinya Kitaoka |
120a6e |
TParamP param = fx->getParams()->getParam(name);
|
|
Shinya Kitaoka |
120a6e |
if (param) {
|
|
Shinya Kitaoka |
120a6e |
std::string paramName = fx->getFxType() + "." + name;
|
|
Shinya Kitaoka |
120a6e |
QString str =
|
|
Shinya Kitaoka |
120a6e |
QString::fromStdWString(TStringTable::translate(paramName));
|
|
Shinya Kitaoka |
120a6e |
ParamField *field = ParamField::create(this, str, param);
|
|
Shinya Kitaoka |
120a6e |
if (field) {
|
|
Shinya Kitaoka |
120a6e |
if (decimals) field->setPrecision(decimals);
|
|
Shinya Kitaoka |
120a6e |
m_fields.push_back(field);
|
|
Shinya Kitaoka |
120a6e |
/*-- hboxタグに挟まれているとき --*/
|
|
Shinya Kitaoka |
120a6e |
if (isVertical == false) {
|
|
Shinya Kitaoka |
120a6e |
assert(m_horizontalLayout);
|
|
Shinya Kitaoka |
120a6e |
QLabel *label = new QLabel(str, this);
|
|
Shinya Kitaoka |
120a6e |
label->setObjectName("FxSettingsLabel");
|
|
Shinya Kitaoka |
120a6e |
if (isFirstParamInRow) {
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(label, currentRow, 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignRight | Qt::AlignVCenter);
|
|
Shinya Kitaoka |
120a6e |
isFirstParamInRow = false;
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addWidget(label, 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignRight | Qt::AlignVCenter);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addWidget(field);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addSpacing(10);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
QLabel *label = new QLabel(str, this);
|
|
Shinya Kitaoka |
120a6e |
label->setObjectName("FxSettingsLabel");
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(label, currentRow, 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignRight | Qt::AlignVCenter);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(field, currentRow, 1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
connect(field, SIGNAL(currentParamChanged()), m_paramViewer,
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(currentFxParamChanged()));
|
|
Shinya Kitaoka |
120a6e |
connect(field, SIGNAL(actualParamChanged()), m_paramViewer,
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(actualFxParamChanged()));
|
|
Shinya Kitaoka |
120a6e |
connect(field, SIGNAL(paramKeyToggle()), m_paramViewer,
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(paramKeyChanged()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "label") {
|
|
Shinya Kitaoka |
120a6e |
std::string name;
|
|
Shinya Kitaoka |
120a6e |
is >> name;
|
|
Shinya Kitaoka |
120a6e |
is.matchEndTag();
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
if (isVertical == false) {
|
|
Shinya Kitaoka |
120a6e |
assert(m_horizontalLayout);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addWidget(new QLabel(str.fromStdString(name)));
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(new QLabel(str.fromStdString(name)), currentRow,
|
|
Shinya Kitaoka |
120a6e |
0, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "separator") {
|
|
Shinya Kitaoka |
120a6e |
// <separator> o <separator label="xxx"></separator></separator>
|
|
Shinya Kitaoka |
120a6e |
std::string label = is.getTagAttribute("label");
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
Separator *sep = new Separator(str.fromStdString(label), this);
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(sep, currentRow, 0, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setRowStretch(currentRow, 0);
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "histogram") {
|
|
Shinya Kitaoka |
120a6e |
Histogram *histogram = new Histogram();
|
|
Shinya Kitaoka |
120a6e |
m_fxHistogramRender->setHistograms(histogram->getHistograms());
|
|
Shinya Kitaoka |
120a6e |
if (isVertical == false) {
|
|
Shinya Kitaoka |
120a6e |
assert(m_horizontalLayout);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addWidget(histogram);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(histogram, currentRow, 0, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "test") {
|
|
Shinya Kitaoka |
120a6e |
// <test></test>
|
|
Shinya Kitaoka |
120a6e |
// box->add(new WidgetBox(new TestSeparator(page)));
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "hbox") {
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout = new QHBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->setSpacing(5);
|
|
Shinya Kitaoka |
120a6e |
setPageField(is, fx, false);
|
|
Shinya Kitaoka |
120a6e |
QWidget *tmpWidget = new QWidget(this);
|
|
Shinya Kitaoka |
120a6e |
tmpWidget->setLayout(m_horizontalLayout);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(tmpWidget, currentRow, 1, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "vbox") {
|
|
Shinya Kitaoka |
120a6e |
int shrink = 0;
|
|
Shinya Kitaoka |
120a6e |
std::string shrinkStr = is.getTagAttribute("shrink");
|
|
Shinya Kitaoka |
120a6e |
if (shrinkStr != "") {
|
|
Shinya Kitaoka |
120a6e |
shrink = QString::fromStdString(shrinkStr).toInt();
|
|
Shinya Kitaoka |
120a6e |
std::string label = is.getTagAttribute("label");
|
|
Shinya Kitaoka |
120a6e |
QCheckBox *checkBox = new QCheckBox(this);
|
|
Shinya Kitaoka |
120a6e |
QHBoxLayout *sepLay = new QHBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
sepLay->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
sepLay->setSpacing(5);
|
|
Shinya Kitaoka |
120a6e |
sepLay->addWidget(checkBox, 0);
|
|
Shinya Kitaoka |
120a6e |
sepLay->addWidget(new Separator(QString::fromStdString(label), this),
|
|
Shinya Kitaoka |
120a6e |
1);
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addLayout(sepLay, currentRow, 0, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setRowStretch(currentRow, 0);
|
|
Shinya Kitaoka |
120a6e |
QGridLayout *keepMainLay = m_mainLayout;
|
|
Shinya Kitaoka |
120a6e |
/*-- レイアウトを一時的に差し替え --*/
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout = new QGridLayout(this);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setMargin(12);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setVerticalSpacing(10);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setHorizontalSpacing(5);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setColumnStretch(0, 0);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setColumnStretch(1, 1);
|
|
Shinya Kitaoka |
120a6e |
setPageField(is, fx, true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QWidget *tmpWidget = new QWidget(this);
|
|
Shinya Kitaoka |
120a6e |
tmpWidget->setLayout(m_mainLayout);
|
|
Shinya Kitaoka |
120a6e |
/*-- レイアウト戻し --*/
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout = keepMainLay;
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(tmpWidget, currentRow + 1, 0, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
//--- signal-slot connection
|
|
Shinya Kitaoka |
120a6e |
connect(checkBox, SIGNAL(toggled(bool)), tmpWidget,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setVisible(bool)));
|
|
Shinya Kitaoka |
120a6e |
checkBox->setChecked(shrink == 1);
|
|
Shinya Kitaoka |
120a6e |
tmpWidget->setVisible(shrink == 1);
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
setPageField(is, fx, true);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- PixelParamFieldが2つあるとき、一方のRGB値を他方にコピーするボタン --*/
|
|
Shinya Kitaoka |
120a6e |
else if (tagName == "rgb_link_button") {
|
|
Shinya Kitaoka |
120a6e |
/*-- リンクさせたいパラメータを2つ得る --*/
|
|
Shinya Kitaoka |
120a6e |
std::string name1, name2;
|
|
Shinya Kitaoka |
120a6e |
is >> name1;
|
|
Shinya Kitaoka |
120a6e |
is >> name2;
|
|
Shinya Kitaoka |
120a6e |
is.matchEndTag();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- 既に作ってあるGUIを探索し、対応する2つを得て格納 --*/
|
|
Shinya Kitaoka |
120a6e |
PixelParamField *ppf1 = 0;
|
|
Shinya Kitaoka |
120a6e |
PixelParamField *ppf2 = 0;
|
|
Shinya Kitaoka |
120a6e |
for (int r = 0; r < m_mainLayout->rowCount(); r++) {
|
|
Shinya Kitaoka |
120a6e |
QLayoutItem *li = m_mainLayout->itemAtPosition(r, 1);
|
|
Shinya Kitaoka |
120a6e |
if (!li) continue;
|
|
Shinya Kitaoka |
120a6e |
QWidget *w = li->widget();
|
|
Shinya Kitaoka |
120a6e |
if (!w) continue;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ParamField *pf = dynamic_cast<paramfield *="">(w);</paramfield>
|
|
Shinya Kitaoka |
120a6e |
if (pf) {
|
|
Shinya Kitaoka |
120a6e |
PixelParamField *ppf = dynamic_cast<pixelparamfield *="">(pf);</pixelparamfield>
|
|
Shinya Kitaoka |
120a6e |
if (ppf) {
|
|
Shinya Kitaoka |
120a6e |
if (ppf1 == 0 && ppf->getParamName().toStdString() == name1)
|
|
Shinya Kitaoka |
120a6e |
ppf1 = ppf;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (ppf2 == 0 && ppf->getParamName().toStdString() == name2)
|
|
Shinya Kitaoka |
120a6e |
ppf2 = ppf;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (ppf1 == 0 || ppf2 == 0) continue;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- ボタンのラベルのため 翻訳する --*/
|
|
Shinya Kitaoka |
120a6e |
std::string paramName1 = fx->getFxType() + "." + name1;
|
|
Shinya Kitaoka |
120a6e |
std::string paramName2 = fx->getFxType() + "." + name2;
|
|
Shinya Kitaoka |
120a6e |
QString str1 =
|
|
Shinya Kitaoka |
120a6e |
QString::fromStdWString(TStringTable::translate(paramName1));
|
|
Shinya Kitaoka |
120a6e |
QString str2 =
|
|
Shinya Kitaoka |
120a6e |
QString::fromStdWString(TStringTable::translate(paramName2));
|
|
Shinya Kitaoka |
120a6e |
QString buttonStr = QString("Copy RGB : %1 > %2").arg(str1).arg(str2);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
RgbLinkButton *linkBut = new RgbLinkButton(buttonStr, this, ppf1, ppf2);
|
|
Shinya Kitaoka |
120a6e |
linkBut->setFixedHeight(21);
|
|
Shinya Kitaoka |
120a6e |
connect(linkBut, SIGNAL(clicked()), linkBut, SLOT(onButtonClicked()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(linkBut, currentRow, 1,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignLeft | Qt::AlignVCenter);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- チェックボックスによって他のインタフェースを表示/非表示させる ---*/
|
|
Shinya Kitaoka |
120a6e |
else if (tagName == "visibleToggle") {
|
|
Shinya Kitaoka |
120a6e |
BoolParamField *controller_bpf = 0;
|
|
Shinya Kitaoka |
120a6e |
QList<qwidget *=""> on_items;</qwidget>
|
|
Shinya Kitaoka |
120a6e |
QList<qwidget *=""> off_items;</qwidget>
|
|
Shinya Kitaoka |
120a6e |
while (!is.matchEndTag()) {
|
|
Shinya Kitaoka |
120a6e |
std::string tagName;
|
|
Shinya Kitaoka |
120a6e |
if (!is.matchTag(tagName)) throw TException("expected tag");
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (tagName ==
|
|
Shinya Kitaoka |
120a6e |
"controller" || /*-- 表示をコントロールするチェックボックス --*/
|
|
Shinya Kitaoka |
120a6e |
tagName == "on" || /*-- ONのとき表示されるインタフェース --*/
|
|
Shinya Kitaoka |
120a6e |
tagName == "off") /*-- OFFのとき表示されるインタフェース --*/
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
std::string name;
|
|
Shinya Kitaoka |
120a6e |
is >> name;
|
|
Shinya Kitaoka |
120a6e |
is.matchEndTag();
|
|
Shinya Kitaoka |
120a6e |
for (int r = 0; r < m_mainLayout->rowCount(); r++) {
|
|
Shinya Kitaoka |
120a6e |
QLayoutItem *li = m_mainLayout->itemAtPosition(r, 1);
|
|
Shinya Kitaoka |
120a6e |
if (!li) continue;
|
|
Shinya Kitaoka |
120a6e |
QWidget *w = li->widget();
|
|
Shinya Kitaoka |
120a6e |
if (!w) continue;
|
|
Shinya Kitaoka |
120a6e |
ParamField *pf = dynamic_cast<paramfield *="">(w);</paramfield>
|
|
Shinya Kitaoka |
120a6e |
if (pf) {
|
|
Shinya Kitaoka |
120a6e |
if (pf->getParamName().toStdString() == name) {
|
|
Shinya Kitaoka |
120a6e |
if (tagName == "controller")
|
|
Shinya Kitaoka |
120a6e |
controller_bpf = dynamic_cast<boolparamfield *="">(pf);</boolparamfield>
|
|
Shinya Kitaoka |
120a6e |
else if (tagName == "on") {
|
|
Shinya Kitaoka |
120a6e |
on_items.push_back(w);
|
|
Shinya Kitaoka |
120a6e |
on_items.push_back(
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->itemAtPosition(r, 0)->widget());
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "off") {
|
|
Shinya Kitaoka |
120a6e |
off_items.push_back(w);
|
|
Shinya Kitaoka |
120a6e |
off_items.push_back(
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->itemAtPosition(r, 0)->widget());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- 入れ子のLayoutも1段階探す --*/
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
QGridLayout *gridLay = dynamic_cast<qgridlayout *="">(w->layout());</qgridlayout>
|
|
Shinya Kitaoka |
120a6e |
if (!gridLay) continue;
|
|
Shinya Kitaoka |
120a6e |
for (int r_s = 0; r_s < gridLay->rowCount(); r_s++) {
|
|
Shinya Kitaoka |
120a6e |
QLayoutItem *li_s = gridLay->itemAtPosition(r_s, 1);
|
|
Shinya Kitaoka |
120a6e |
if (!li_s) continue;
|
|
Shinya Kitaoka |
120a6e |
ParamField *pf_s = dynamic_cast<paramfield *="">(li_s->widget());</paramfield>
|
|
Shinya Kitaoka |
120a6e |
if (pf_s) {
|
|
Shinya Kitaoka |
120a6e |
if (pf_s->getParamName().toStdString() == name) {
|
|
Shinya Kitaoka |
120a6e |
if (tagName == "controller")
|
|
Shinya Kitaoka |
120a6e |
controller_bpf = dynamic_cast<boolparamfield *="">(pf_s);</boolparamfield>
|
|
Shinya Kitaoka |
120a6e |
else if (tagName == "on") {
|
|
Shinya Kitaoka |
120a6e |
on_items.push_back(pf_s);
|
|
Shinya Kitaoka |
120a6e |
on_items.push_back(
|
|
Shinya Kitaoka |
120a6e |
gridLay->itemAtPosition(r_s, 0)->widget());
|
|
Shinya Kitaoka |
120a6e |
} else if (tagName == "off") {
|
|
Shinya Kitaoka |
120a6e |
off_items.push_back(pf_s);
|
|
Shinya Kitaoka |
120a6e |
off_items.push_back(
|
|
Shinya Kitaoka |
120a6e |
gridLay->itemAtPosition(r_s, 0)->widget());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
throw TException("unexpected tag " + tagName);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- 表示コントロールをconnect --*/
|
|
Shinya Kitaoka |
120a6e |
if (controller_bpf) {
|
|
Shinya Kitaoka |
120a6e |
/*-- ラベルとWidgetを両方表示/非表示 --*/
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < on_items.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
connect(controller_bpf, SIGNAL(toggled(bool)), on_items[i],
|
|
Shinya Kitaoka |
120a6e |
SLOT(setVisible(bool)));
|
|
Shinya Kitaoka |
120a6e |
on_items[i]->hide();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < off_items.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
connect(controller_bpf, SIGNAL(toggled(bool)), off_items[i],
|
|
Shinya Kitaoka |
120a6e |
SLOT(setHidden(bool)));
|
|
Shinya Kitaoka |
120a6e |
off_items[i]->show();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
std::cout << "controller_bpf NOT found!" << std::endl;
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
throw TException("unexpected tag " + tagName);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (isVertical == false && m_horizontalLayout) {
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addStretch(1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::setPageSpace() {
|
|
Shinya Kitaoka |
120a6e |
if (m_fields.count() != 0) {
|
|
Shinya Kitaoka |
120a6e |
QWidget *spaceWidget = new QWidget();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int currentRow = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(spaceWidget, currentRow, 0, 1, 2);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < currentRow; i++) m_mainLayout->setRowStretch(i, 0);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->setRowStretch(currentRow, 1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::beginGroup(const char *name) {
|
|
Shinya Kitaoka |
120a6e |
m_groupLayout = new QGridLayout();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QGroupBox *group = new QGroupBox(QString::fromUtf8(name), this);
|
|
Shinya Kitaoka |
120a6e |
group->setLayout(m_groupLayout);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(group, m_mainLayout->rowCount(), 0, 1, 2);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::endGroup() { m_groupLayout = NULL; }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::addWidget(QWidget *field, bool isVertical) {
|
|
Shinya Kitaoka |
120a6e |
QLabel *label = NULL;
|
|
Shinya Kitaoka |
120a6e |
ParamField *pf = qobject_cast<paramfield *="">(field);</paramfield>
|
|
Shinya Kitaoka |
120a6e |
if (pf) {
|
|
Shinya Kitaoka |
120a6e |
label = new QLabel(pf->getUIName(), this);
|
|
Shinya Kitaoka |
120a6e |
label->setObjectName("FxSettingsLabel");
|
|
Shinya Kitaoka |
120a6e |
if (!pf->getDescription().isEmpty())
|
|
Shinya Kitaoka |
120a6e |
label->setToolTip(pf->getDescription());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (isVertical) {
|
|
Shinya Kitaoka |
120a6e |
if (m_groupLayout) {
|
|
Shinya Kitaoka |
120a6e |
int row = m_groupLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
if (label)
|
|
Shinya Kitaoka |
120a6e |
m_groupLayout->addWidget(label, row, 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignRight | Qt::AlignVCenter);
|
|
Shinya Kitaoka |
120a6e |
m_groupLayout->addWidget(field, row, 1);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
int row = m_mainLayout->rowCount();
|
|
Shinya Kitaoka |
120a6e |
if (label)
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(label, row, 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignRight | Qt::AlignVCenter);
|
|
Shinya Kitaoka |
120a6e |
m_mainLayout->addWidget(field, row, 1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
if (!m_horizontalLayout) {
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout = new QHBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->setSpacing(5);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_horizontalLayout->addWidget(field);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
#define TOONZ_DEFINE_NEW_COMPONENT(NAME, MAKE) \
|
|
Shinya Kitaoka |
120a6e |
QWidget *ParamsPage::NAME(TFx *fx, const char *name) { \
|
|
Shinya Kitaoka |
120a6e |
TParamP param = fx->getParams()->getParam(name); \
|
|
Shinya Kitaoka |
120a6e |
if (!param) return NULL; \
|
|
Shinya Kitaoka |
120a6e |
QString const paramName = \
|
|
Shinya Kitaoka |
120a6e |
QString::fromStdString(fx->getFxType() + "." + name); \
|
|
Shinya Kitaoka |
120a6e |
ParamField *field = MAKE(this, paramName, param); \
|
|
Shinya Kitaoka |
120a6e |
if (!field) return NULL; \
|
|
Shinya Kitaoka |
120a6e |
m_fields.push_back(field); \
|
|
Shinya Kitaoka |
120a6e |
connect(field, SIGNAL(currentParamChanged()), m_paramViewer, \
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(currentFxParamChanged())); \
|
|
Shinya Kitaoka |
120a6e |
connect(field, SIGNAL(actualParamChanged()), m_paramViewer, \
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(actualFxParamChanged())); \
|
|
Shinya Kitaoka |
120a6e |
connect(field, SIGNAL(paramKeyToggle()), m_paramViewer, \
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(paramKeyChanged())); \
|
|
Shinya Kitaoka |
120a6e |
return field; \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newParamField, ParamField::create);
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newLineEdit, make_lineedit);
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newSlider, make_slider);
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newSpinBox, make_spinbox);
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newCheckBox, make_checkbox);
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newRadioButton, make_radiobutton);
|
|
Toshihiro Shimizu |
890ddd |
TOONZ_DEFINE_NEW_COMPONENT(newComboBox, make_combobox);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
810553 |
#undef TOONZ_DEFINE_NEW_COMPONENT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::setFx(const TFxP ¤tFx, const TFxP &actualFx, int frame) {
|
|
Shinya Kitaoka |
120a6e |
assert(currentFx);
|
|
Shinya Kitaoka |
120a6e |
assert(actualFx);
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < (int)m_fields.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamField *field = m_fields[i];
|
|
Shinya Kitaoka |
120a6e |
QString fieldName = field->getParamName();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TFxP fx = getCurrentFx(currentFx, actualFx->getFxId());
|
|
Shinya Kitaoka |
120a6e |
assert(fx.getPointer());
|
|
Shinya Kitaoka |
120a6e |
TParamP currentParam =
|
|
Shinya Kitaoka |
120a6e |
currentFx->getParams()->getParam(fieldName.toStdString());
|
|
Shinya Kitaoka |
120a6e |
TParamP actualParam =
|
|
Shinya Kitaoka |
120a6e |
actualFx->getParams()->getParam(fieldName.toStdString());
|
|
Shinya Kitaoka |
120a6e |
assert(currentParam);
|
|
Shinya Kitaoka |
120a6e |
assert(actualParam);
|
|
Shinya Kitaoka |
120a6e |
field->setParam(currentParam, actualParam, frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (actualFx->getInputPortCount() > 0)
|
|
Shinya Kitaoka |
120a6e |
m_fxHistogramRender->computeHistogram(actualFx->getInputPort(0)->getFx(),
|
|
Shinya Kitaoka |
120a6e |
frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::setPointValue(int index, const TPointD &p) {
|
|
Shinya Kitaoka |
120a6e |
if (0 <= index && index < (int)m_fields.size())
|
|
Shinya Kitaoka |
120a6e |
m_fields[index]->setPointValue(p);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPage::update(int frame) {
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < (int)m_fields.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamField *field = m_fields[i];
|
|
Shinya Kitaoka |
120a6e |
field->update(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void updateMaximumPageSize(QGridLayout *layout, int &maxLabelWidth,
|
|
Shinya Kitaoka |
120a6e |
int &maxWidgetWidth, int &fieldsHeight) {
|
|
Shinya Kitaoka |
120a6e |
/*-- Label側の横幅の最大値を得る --*/
|
|
Shinya Kitaoka |
120a6e |
for (int r = 0; r < layout->rowCount(); r++) {
|
|
Shinya Kitaoka |
120a6e |
/*-- アイテムが無ければ次の行へ --*/
|
|
Shinya Kitaoka |
120a6e |
if (!layout->itemAtPosition(r, 0)) continue;
|
|
Shinya Kitaoka |
120a6e |
/*-- ラベルの横幅を得て、最大値を更新していく --*/
|
|
Shinya Kitaoka |
120a6e |
QLabel *label =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<qlabel *="">(layout->itemAtPosition(r, 0)->widget());</qlabel>
|
|
Shinya Kitaoka |
120a6e |
QGroupBox *gBox =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<qgroupbox *="">(layout->itemAtPosition(r, 0)->widget());</qgroupbox>
|
|
Shinya Kitaoka |
120a6e |
if (label) {
|
|
Shinya Kitaoka |
120a6e |
int tmpWidth = label->fontMetrics().width(label->text());
|
|
Shinya Kitaoka |
120a6e |
if (maxLabelWidth < tmpWidth) maxLabelWidth = tmpWidth;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- PlugInFxのGroupパラメータのサイズ --*/
|
|
Shinya Kitaoka |
120a6e |
else if (gBox) {
|
|
Shinya Kitaoka |
120a6e |
QGridLayout *gridLay = dynamic_cast<qgridlayout *="">(gBox->layout());</qgridlayout>
|
|
Shinya Kitaoka |
120a6e |
if (gridLay) {
|
|
Shinya Kitaoka |
120a6e |
updateMaximumPageSize(gridLay, maxLabelWidth, maxWidgetWidth,
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight);
|
|
Shinya Kitaoka |
120a6e |
/*-- GroupBoxのマージン --*/
|
|
Shinya Kitaoka |
120a6e |
maxLabelWidth += 10;
|
|
Shinya Kitaoka |
120a6e |
maxWidgetWidth += 10;
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight += 20;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- Widget側の最適な縦サイズおよび横幅の最大値を得る --*/
|
|
Shinya Kitaoka |
120a6e |
for (int r = 0; r < layout->rowCount(); r++) {
|
|
Shinya Kitaoka |
120a6e |
/*-- Column1にある可能性のあるもの:ParamField, Histogram, Layout,
|
|
Shinya Kitaoka |
120a6e |
* RgbLinkButton --*/
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QLayoutItem *item = layout->itemAtPosition(r, 1);
|
|
Shinya Kitaoka |
120a6e |
if (!item) continue;
|
|
Shinya Kitaoka |
120a6e |
/*-- ParamFieldの場合 --*/
|
|
Shinya Kitaoka |
120a6e |
ParamField *pF = dynamic_cast<paramfield *="">(item->widget());</paramfield>
|
|
Shinya Kitaoka |
120a6e |
if (pF) {
|
|
Shinya Kitaoka |
120a6e |
QSize fieldBestSize = pF->getPreferedSize();
|
|
Shinya Kitaoka |
120a6e |
/*-- 横幅の更新 --*/
|
|
Shinya Kitaoka |
120a6e |
if (maxWidgetWidth < fieldBestSize.width())
|
|
Shinya Kitaoka |
120a6e |
maxWidgetWidth = fieldBestSize.width();
|
|
Shinya Kitaoka |
120a6e |
/*-- 縦サイズの更新 --*/
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight += fieldBestSize.height();
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
QHBoxLayout *hLay = dynamic_cast<qhboxlayout *="">(item->layout());</qhboxlayout>
|
|
Shinya Kitaoka |
120a6e |
Histogram *histo = dynamic_cast<histogram *="">(item->widget());</histogram>
|
|
Shinya Kitaoka |
120a6e |
Separator *sep = dynamic_cast<separator *="">(item->widget());</separator>
|
|
Shinya Kitaoka |
120a6e |
RgbLinkButton *linkBut = dynamic_cast<rgblinkbutton *="">(item->widget());</rgblinkbutton>
|
|
Shinya Kitaoka |
120a6e |
/*-- HLayoutの場合 --*/
|
|
Shinya Kitaoka |
120a6e |
if (hLay) {
|
|
Shinya Kitaoka |
120a6e |
int tmpSumWidth = 0;
|
|
Shinya Kitaoka |
120a6e |
int tmpMaxHeight = 0;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < hLay->count(); i++) {
|
|
Shinya Kitaoka |
120a6e |
QLabel *hLabel = dynamic_cast<qlabel *="">(hLay->itemAt(i)->widget());</qlabel>
|
|
Shinya Kitaoka |
120a6e |
ParamField *hPF =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<paramfield *="">(hLay->itemAt(i)->widget());</paramfield>
|
|
Shinya Kitaoka |
120a6e |
if (hLabel) {
|
|
Shinya Kitaoka |
120a6e |
int tmpWidth = hLabel->fontMetrics().width(hLabel->text());
|
|
Shinya Kitaoka |
120a6e |
/*-- 横幅を足していく --*/
|
|
Shinya Kitaoka |
120a6e |
tmpSumWidth += tmpWidth;
|
|
Shinya Kitaoka |
120a6e |
} else if (hPF) {
|
|
Shinya Kitaoka |
120a6e |
tmpSumWidth += hPF->getPreferedSize().width();
|
|
Shinya Kitaoka |
120a6e |
if (tmpMaxHeight < hPF->getPreferedSize().height())
|
|
Shinya Kitaoka |
120a6e |
tmpMaxHeight = hPF->getPreferedSize().height();
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
continue;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- 横幅にSpacing値(=5)の分を足す --*/
|
|
Shinya Kitaoka |
120a6e |
if (hLay->count() > 1) tmpSumWidth += (hLay->count() - 1) * 5;
|
|
Shinya Kitaoka |
120a6e |
/*-- 横幅の更新 --*/
|
|
Shinya Kitaoka |
120a6e |
if (maxWidgetWidth < tmpSumWidth) maxWidgetWidth = tmpSumWidth;
|
|
Shinya Kitaoka |
120a6e |
/*-- 縦サイズの更新 --*/
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight += tmpMaxHeight;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*--- ヒストグラムの場合 : 最小サイズは 横278 × 縦162 ---*/
|
|
Shinya Kitaoka |
120a6e |
else if (histo) {
|
|
Shinya Kitaoka |
120a6e |
/*-- 横幅の更新 --*/
|
|
Shinya Kitaoka |
120a6e |
if (maxWidgetWidth < 278) maxWidgetWidth = 278;
|
|
Shinya Kitaoka |
120a6e |
/*-- 縦サイズの更新 --*/
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight += 162;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- セパレータの場合 : 高さ10 --*/
|
|
Shinya Kitaoka |
120a6e |
else if (sep) {
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight += 10;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*-- RgbLinkButtonの場合 : 高さ21 --*/
|
|
Shinya Kitaoka |
120a6e |
else if (linkBut) {
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight += 21;
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
continue;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (layout->rowCount() > 1) fieldsHeight += (layout->rowCount() - 1) * 10;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QSize ParamsPage::getPreferedSize() {
|
|
Shinya Kitaoka |
120a6e |
int maxLabelWidth = 0;
|
|
Shinya Kitaoka |
120a6e |
int maxWidgetWidth = 0;
|
|
Shinya Kitaoka |
120a6e |
int fieldsHeight = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
updateMaximumPageSize(m_mainLayout, maxLabelWidth, maxWidgetWidth,
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return QSize(
|
|
Shinya Kitaoka |
120a6e |
maxLabelWidth + maxWidgetWidth + 5 /* Spacing */ + 24 /* Margin2つ分 */,
|
|
Shinya Kitaoka |
120a6e |
fieldsHeight + 24 /* Margin2つ分 */ + 20 /* 余白 */);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ParamsPageSet
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050500
|
|
Toshihiro Shimizu |
890ddd |
ParamsPageSet::ParamsPageSet(QWidget *parent, Qt::WindowFlags flags)
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
ParamsPageSet::ParamsPageSet(QWidget *parent, Qt::WFlags flags)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Shinya Kitaoka |
120a6e |
: QWidget(parent, flags)
|
|
Shinya Kitaoka |
120a6e |
, m_preferedSize(0, 0)
|
|
Shinya Kitaoka |
120a6e |
, m_helpFilePath("")
|
|
Shinya Kitaoka |
120a6e |
, m_helpCommand("") {
|
|
Shinya Kitaoka |
120a6e |
// TabBar
|
|
Shinya Kitaoka |
120a6e |
m_tabBar = new TabBar(this);
|
|
Shinya Kitaoka |
120a6e |
// This widget is used to set the background color of the tabBar
|
|
Shinya Kitaoka |
120a6e |
// using the styleSheet.
|
|
Shinya Kitaoka |
120a6e |
// It is also used to take 6px on the left before the tabBar
|
|
Shinya Kitaoka |
120a6e |
// and to draw the two lines on the bottom size
|
|
Shinya Kitaoka |
120a6e |
m_tabBarContainer = new TabBarContainter(this);
|
|
Shinya Kitaoka |
120a6e |
m_pagesList = new QStackedWidget(this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_helpButton = new QPushButton(tr("Fx Help"), this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_parent = dynamic_cast<paramviewer *="">(parent);</paramviewer>
|
|
Shinya Kitaoka |
120a6e |
m_pageFxIndexTable.clear();
|
|
Shinya Kitaoka |
120a6e |
m_tabBar->setDrawBase(false);
|
|
Shinya Kitaoka |
120a6e |
m_tabBar->setObjectName("FxSettingsTabBar");
|
|
Shinya Kitaoka |
120a6e |
m_helpButton->setFixedHeight(20);
|
|
Shinya Kitaoka |
120a6e |
m_helpButton->setObjectName("FxSettingsHelpButton");
|
|
Shinya Kitaoka |
120a6e |
m_helpButton->setFocusPolicy(Qt::NoFocus);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//----layout
|
|
Shinya Kitaoka |
120a6e |
QVBoxLayout *mainLayout = new QVBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
mainLayout->setMargin(1);
|
|
Shinya Kitaoka |
120a6e |
mainLayout->setSpacing(0);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
QHBoxLayout *hLayout = new QHBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
hLayout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
hLayout->addSpacing(6);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
hLayout->addWidget(m_tabBar);
|
|
Shinya Kitaoka |
120a6e |
hLayout->addStretch(1);
|
|
Shinya Kitaoka |
120a6e |
hLayout->addWidget(m_helpButton);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_tabBarContainer->setLayout(hLayout);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(m_tabBarContainer);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(m_pagesList);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(new Separator("", this), 0);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
setLayout(mainLayout);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(setPage(int)));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_helpButton->hide();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet::~ParamsPageSet() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::setPage(int index) {
|
|
Shinya Kitaoka |
120a6e |
if (m_tabBar->count() == 0 || m_pagesList->count() == 0) return;
|
|
Shinya Kitaoka |
120a6e |
assert(index >= 0 && index < m_pagesList->count());
|
|
Shinya Kitaoka |
120a6e |
m_pagesList->setCurrentIndex(index);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::setFx(const TFxP ¤tFx, const TFxP &actualFx,
|
|
Shinya Kitaoka |
120a6e |
int frame) {
|
|
Shinya Kitaoka |
120a6e |
TMacroFx *currentFxMacro = dynamic_cast<tmacrofx *="">(currentFx.getPointer());</tmacrofx>
|
|
Shinya Kitaoka |
120a6e |
if (currentFxMacro) {
|
|
Shinya Kitaoka |
120a6e |
TMacroFx *actualFxMacro = dynamic_cast<tmacrofx *="">(actualFx.getPointer());</tmacrofx>
|
|
Shinya Kitaoka |
120a6e |
assert(actualFxMacro);
|
|
Shinya Kitaoka |
120a6e |
const std::vector<tfxp> ¤tFxMacroFxs = currentFxMacro->getFxs();</tfxp>
|
|
Shinya Kitaoka |
120a6e |
const std::vector<tfxp> &actualFxMacroFxs = actualFxMacro->getFxs();</tfxp>
|
|
Shinya Kitaoka |
120a6e |
assert(currentFxMacroFxs.size() == actualFxMacroFxs.size());
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < m_pagesList->count(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *page = getParamsPage(i);
|
|
Shinya Kitaoka |
120a6e |
if (!page || !m_pageFxIndexTable.contains(page)) continue;
|
|
Shinya Kitaoka |
120a6e |
int index = m_pageFxIndexTable[page];
|
|
Shinya Kitaoka |
120a6e |
page->setFx(currentFxMacroFxs[index], actualFxMacroFxs[index], frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < m_pagesList->count(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *page = getParamsPage(i);
|
|
Shinya Kitaoka |
120a6e |
if (!page) continue;
|
|
Shinya Kitaoka |
120a6e |
page->setFx(currentFx, actualFx, frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::updatePage(int frame, bool onlyParam) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_pagesList) return;
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < m_pagesList->count(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *page = getParamsPage(i);
|
|
Shinya Kitaoka |
120a6e |
if (!page) continue;
|
|
Shinya Kitaoka |
120a6e |
page->update(frame);
|
|
Shinya Kitaoka |
120a6e |
if (!onlyParam) page->getFxHistogramRender()->invalidateFrame(frame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::setScene(ToonzScene *scene) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_pagesList) return;
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < m_pagesList->count(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *page = getParamsPage(i);
|
|
Shinya Kitaoka |
120a6e |
if (!page) continue;
|
|
Shinya Kitaoka |
120a6e |
page->getFxHistogramRender()->setScene(scene);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::setIsCameraViewMode(bool isCameraViewMode) {
|
|
Shinya Kitaoka |
120a6e |
if (!m_pagesList) return;
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < m_pagesList->count(); i++) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *page = getParamsPage(i);
|
|
Shinya Kitaoka |
120a6e |
if (!page) continue;
|
|
Shinya Kitaoka |
120a6e |
page->getFxHistogramRender()->setIsCameraViewMode(isCameraViewMode);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *ParamsPageSet::createParamsPage() {
|
|
Shinya Kitaoka |
120a6e |
return new ParamsPage(this, m_parent);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::addParamsPage(ParamsPage *page, const char *name) {
|
|
Shinya Kitaoka |
120a6e |
/*-- このFxで最大サイズのページに合わせてダイアログをリサイズ --*/
|
|
Shinya Kitaoka |
120a6e |
QSize pagePreferedSize = page->getPreferedSize();
|
|
Shinya Kitaoka |
120a6e |
m_preferedSize = m_preferedSize.expandedTo(
|
|
Shinya Kitaoka |
120a6e |
pagePreferedSize + QSize(m_tabBarContainer->height() + 2,
|
|
Shinya Kitaoka |
120a6e |
2)); /*-- 2は上下左右のマージン --*/
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QScrollArea *pane = new QScrollArea(this);
|
|
Shinya Kitaoka |
120a6e |
pane->setWidgetResizable(true);
|
|
Shinya Kitaoka |
120a6e |
pane->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
Shinya Kitaoka |
120a6e |
pane->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
Shinya Kitaoka |
120a6e |
pane->setWidget(page);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_tabBar->addSimpleTab(QString::fromUtf8(name));
|
|
Shinya Kitaoka |
120a6e |
m_pagesList->addWidget(pane);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::createControls(const TFxP &fx, int index) {
|
|
Shinya Kitaoka |
120a6e |
if (TMacroFx *macroFx = dynamic_cast<tmacrofx *="">(fx.getPointer())) {</tmacrofx>
|
|
Shinya Kitaoka |
120a6e |
const std::vector<tfxp> &fxs = macroFx->getFxs();</tfxp>
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < (int)fxs.size(); i++) createControls(fxs[i], i);
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (RasterFxPluginHost *plugin =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<rasterfxpluginhost *="">(fx.getPointer())) {</rasterfxpluginhost>
|
|
Shinya Kitaoka |
120a6e |
plugin->build(this);
|
|
Shinya Kitaoka |
120a6e |
std::string url = plugin->getUrl();
|
|
Shinya Kitaoka |
120a6e |
if (!url.empty()) {
|
|
Shinya Kitaoka |
120a6e |
connect(m_helpButton, SIGNAL(pressed()), this, SLOT(openHelpUrl()));
|
|
Shinya Kitaoka |
120a6e |
m_helpButton->show();
|
|
Shinya Kitaoka |
120a6e |
m_helpUrl = url;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TFilePath fp = ToonzFolder::getProfileFolder() + "layouts" + "fxs" +
|
|
Shinya Kitaoka |
120a6e |
(fx->getFxType() + ".xml");
|
|
Shinya Kitaoka |
120a6e |
TIStream is(fp);
|
|
Shinya Kitaoka |
120a6e |
if (!is) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (fx->getParams()->getParamCount()) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
std::string tagName;
|
|
Shinya Kitaoka |
120a6e |
if (!is.matchTag(tagName) || tagName != "fxlayout")
|
|
Shinya Kitaoka |
120a6e |
throw TException("expected <fxlayout>");</fxlayout>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_helpFilePath = is.getTagAttribute("help_file");
|
|
Shinya Kitaoka |
120a6e |
if (m_helpFilePath != "") {
|
|
Shinya Kitaoka |
120a6e |
connect(m_helpButton, SIGNAL(pressed()), this, SLOT(openHelpFile()));
|
|
Shinya Kitaoka |
120a6e |
m_helpButton->show();
|
|
Shinya Kitaoka |
120a6e |
/*-- pdfファイルのページ指定など、引数が必要な場合の追加fragmentを取得
|
|
Shinya Kitaoka |
120a6e |
* --*/
|
|
Shinya Kitaoka |
120a6e |
m_helpCommand = is.getTagAttribute("help_command");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
while (!is.matchEndTag()) createPage(is, fx, index);
|
|
Shinya Kitaoka |
120a6e |
} catch (TException const &) {
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
// else createEmptyPage();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *ParamsPageSet::getCurrentParamsPage() const {
|
|
Shinya Kitaoka |
120a6e |
QScrollArea *scrollAreaPage =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<qscrollarea *="">(m_pagesList->currentWidget());</qscrollarea>
|
|
Shinya Kitaoka |
120a6e |
assert(scrollAreaPage);
|
|
Shinya Kitaoka |
120a6e |
return dynamic_cast<paramspage *="">(scrollAreaPage->widget());</paramspage>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *ParamsPageSet::getParamsPage(int index) const {
|
|
Shinya Kitaoka |
120a6e |
QScrollArea *scrollAreaPage =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<qscrollarea *="">(m_pagesList->widget(index));</qscrollarea>
|
|
Shinya Kitaoka |
120a6e |
assert(scrollAreaPage);
|
|
Shinya Kitaoka |
120a6e |
return dynamic_cast<paramspage *="">(scrollAreaPage->widget());</paramspage>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::createPage(TIStream &is, const TFxP &fx, int index) {
|
|
Shinya Kitaoka |
120a6e |
std::string tagName;
|
|
Shinya Kitaoka |
120a6e |
if (!is.matchTag(tagName) || tagName != "page")
|
|
Shinya Kitaoka |
120a6e |
throw TException("expected <page>");</page>
|
|
Shinya Kitaoka |
120a6e |
std::string pageName = is.getTagAttribute("name");
|
|
Shinya Kitaoka |
120a6e |
if (pageName == "") pageName = "page";
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *paramsPage = new ParamsPage(this, m_parent);
|
|
Shinya Kitaoka |
120a6e |
paramsPage->setPage(is, fx);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- このFxで最大サイズのページに合わせてダイアログをリサイズ --*/
|
|
Shinya Kitaoka |
120a6e |
QSize pagePreferedSize = paramsPage->getPreferedSize();
|
|
Shinya Kitaoka |
120a6e |
m_preferedSize = m_preferedSize.expandedTo(
|
|
Shinya Kitaoka |
120a6e |
pagePreferedSize + QSize(m_tabBarContainer->height() + 2,
|
|
Shinya Kitaoka |
120a6e |
2)); /*-- 2は上下左右のマージン --*/
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QScrollArea *scrollAreaPage = new QScrollArea(this);
|
|
Shinya Kitaoka |
120a6e |
scrollAreaPage->setWidgetResizable(true);
|
|
Shinya Kitaoka |
120a6e |
scrollAreaPage->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
Shinya Kitaoka |
120a6e |
scrollAreaPage->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
Shinya Kitaoka |
120a6e |
scrollAreaPage->setWidget(paramsPage);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
m_tabBar->addSimpleTab(str.fromStdString(pageName));
|
|
Shinya Kitaoka |
120a6e |
m_pagesList->addWidget(scrollAreaPage);
|
|
Shinya Kitaoka |
120a6e |
if (index >= 0) m_pageFxIndexTable[paramsPage] = index;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* TODO: Webサイト内のヘルプに対応すべきか検討 2016.02.01 shun_iwasawa */
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::openHelpFile() {
|
|
Shinya Kitaoka |
120a6e |
if (m_helpFilePath == "") return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// if (m_helpCommand != "")
|
|
Shinya Kitaoka |
120a6e |
// commandString += m_helpCommand + " ";
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TFilePath helpFp =
|
|
Shinya Kitaoka |
120a6e |
TEnv::getStuffDir() + TFilePath("doc") + TFilePath(m_helpFilePath);
|
|
Shinya Kitaoka |
120a6e |
// commandString +=
|
|
Shinya Kitaoka |
120a6e |
// QString::fromStdWString(helpFp.getWideString()).toStdString();
|
|
Shinya Kitaoka |
120a6e |
// QString command = QString::fromStdString(m_helpFilePath);
|
|
Shinya Kitaoka |
120a6e |
// system(commandString.c_str());
|
|
Shinya Kitaoka |
120a6e |
// QProcess process;
|
|
Shinya Kitaoka |
120a6e |
// process.start(command);
|
|
Shinya Kitaoka |
120a6e |
QDesktopServices::openUrl(
|
|
Shinya Kitaoka |
120a6e |
QUrl::fromLocalFile(QString::fromStdWString(helpFp.getWideString())));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamsPageSet::openHelpUrl() {
|
|
Shinya Kitaoka |
120a6e |
QDesktopServices::openUrl(QUrl(QString(m_helpUrl.c_str())));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ParamViewer
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050500
|
|
Toshihiro Shimizu |
890ddd |
ParamViewer::ParamViewer(QWidget *parent, Qt::WindowFlags flags)
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
ParamViewer::ParamViewer(QWidget *parent, Qt::WFlags flags)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Shinya Kitaoka |
120a6e |
: QFrame(parent, flags), m_fx(0) {
|
|
Shinya Kitaoka |
120a6e |
m_tablePageSet = new QStackedWidget(this);
|
|
Shinya Kitaoka |
120a6e |
m_tablePageSet->addWidget(new QWidget());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- SwatchViewerを表示/非表示するボタン --*/
|
|
Shinya Kitaoka |
120a6e |
QPushButton *showSwatchButton = new QPushButton("", this);
|
|
Shinya Kitaoka |
120a6e |
QLabel *swatchLabel = new QLabel(tr("Swatch Viewer"), this);
|
|
Shinya Kitaoka |
120a6e |
|
|
shun_iwasawa |
b102ca |
swatchLabel->setObjectName("TitleTxtLabel");
|
|
Shinya Kitaoka |
120a6e |
showSwatchButton->setObjectName("FxSettingsPreviewShowButton");
|
|
Shinya Kitaoka |
120a6e |
showSwatchButton->setFixedSize(15, 15);
|
|
Shinya Kitaoka |
120a6e |
showSwatchButton->setCheckable(true);
|
|
Shinya Kitaoka |
120a6e |
showSwatchButton->setChecked(false);
|
|
Shinya Kitaoka |
120a6e |
showSwatchButton->setFocusPolicy(Qt::NoFocus);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
|
Shinya Kitaoka |
120a6e |
mainLayout->setMargin(1);
|
|
Shinya Kitaoka |
120a6e |
mainLayout->setSpacing(0);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(m_tablePageSet, 1);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QHBoxLayout *showPreviewButtonLayout = new QHBoxLayout(this);
|
|
Shinya Kitaoka |
120a6e |
showPreviewButtonLayout->setMargin(3);
|
|
Shinya Kitaoka |
120a6e |
showPreviewButtonLayout->setSpacing(3);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
showPreviewButtonLayout->addWidget(showSwatchButton, 0);
|
|
Shinya Kitaoka |
120a6e |
showPreviewButtonLayout->addWidget(swatchLabel, 0);
|
|
Shinya Kitaoka |
120a6e |
showPreviewButtonLayout->addStretch(1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addLayout(showPreviewButtonLayout, 0);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
setLayout(mainLayout);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
connect(showSwatchButton, SIGNAL(toggled(bool)), this,
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(showSwatchButtonToggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamViewer::~ParamViewer() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamViewer::setFx(const TFxP ¤tFx, const TFxP &actualFx, int frame,
|
|
Shinya Kitaoka |
120a6e |
ToonzScene *scene) {
|
|
Shinya Kitaoka |
120a6e |
if (!actualFx) {
|
|
Shinya Kitaoka |
120a6e |
m_tablePageSet->setCurrentIndex(0);
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
std::string name = actualFx->getFxType();
|
|
Shinya Kitaoka |
120a6e |
if (name == "macroFx") {
|
|
Shinya Kitaoka |
120a6e |
TMacroFx *macroFx = dynamic_cast<tmacrofx *="">(currentFx.getPointer());</tmacrofx>
|
|
Shinya Kitaoka |
120a6e |
if (macroFx) name = macroFx->getMacroFxType();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int currentIndex = -1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QMap<std::string, int="">::iterator it;</std::string,>
|
|
Shinya Kitaoka |
120a6e |
it = m_tableFxIndex.find(name);
|
|
Shinya Kitaoka |
120a6e |
if (it == m_tableFxIndex.end()) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet *pageSet = new ParamsPageSet(this);
|
|
Shinya Kitaoka |
120a6e |
currentIndex = m_tablePageSet->addWidget(pageSet);
|
|
Shinya Kitaoka |
120a6e |
m_tableFxIndex[name] = currentIndex;
|
|
Shinya Kitaoka |
120a6e |
pageSet->createControls(actualFx);
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
currentIndex = it.value();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
assert(currentIndex >= 0);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_tablePageSet->setCurrentIndex(currentIndex);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
getCurrentPageSet()->setScene(scene);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_fx != currentFx) {
|
|
Shinya Kitaoka |
120a6e |
getCurrentPageSet()->setFx(currentFx, actualFx, frame);
|
|
Shinya Kitaoka |
120a6e |
QSize pageViewerPreferedSize =
|
|
Shinya Kitaoka |
120a6e |
getCurrentPageSet()->getPreferedSize() + QSize(2, 20);
|
|
Shinya Kitaoka |
120a6e |
emit preferedSizeChanged(pageViewerPreferedSize);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamViewer::setScene(ToonzScene *scene) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet *paramsPageSet = getCurrentPageSet();
|
|
Shinya Kitaoka |
120a6e |
if (!paramsPageSet) return;
|
|
Shinya Kitaoka |
120a6e |
paramsPageSet->setScene(scene);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamViewer::setIsCameraViewMode(bool isCameraViewMode) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet *paramsPageSet = getCurrentPageSet();
|
|
Shinya Kitaoka |
120a6e |
if (!paramsPageSet) return;
|
|
Shinya Kitaoka |
120a6e |
paramsPageSet->setIsCameraViewMode(isCameraViewMode);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamViewer::update(int frame, bool onlyParam) {
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet *paramsPageSet = getCurrentPageSet();
|
|
Shinya Kitaoka |
120a6e |
if (!paramsPageSet) return;
|
|
Shinya Kitaoka |
120a6e |
paramsPageSet->updatePage(frame, onlyParam);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ParamViewer::setPointValue(int index, const TPointD &p) {
|
|
Shinya Kitaoka |
120a6e |
// Search the index-th param among all pages
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet *pageSet = getCurrentPageSet();
|
|
Shinya Kitaoka |
120a6e |
ParamsPage *page = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < pageSet->getParamsPageCount(); ++i) {
|
|
Shinya Kitaoka |
120a6e |
page = pageSet->getParamsPage(i);
|
|
Shinya Kitaoka |
120a6e |
int paramsCount = page->m_fields.count();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (index <= paramsCount) break;
|
|
Shinya Kitaoka |
120a6e |
index -= paramsCount;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (page) page->setPointValue(index, p);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamsPageSet *ParamViewer::getCurrentPageSet() const {
|
|
Shinya Kitaoka |
120a6e |
return dynamic_cast<paramspageset *="">(m_tablePageSet->currentWidget());</paramspageset>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// FxSettings
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FxSettings::FxSettings(QWidget *parent, const TPixel32 &checkCol1,
|
|
Shinya Kitaoka |
120a6e |
const TPixel32 &checkCol2)
|
|
Shinya Kitaoka |
120a6e |
: QSplitter(Qt::Vertical, parent)
|
|
Shinya Kitaoka |
120a6e |
, m_frameHandle(0)
|
|
Shinya Kitaoka |
120a6e |
, m_fxHandle(0)
|
|
Shinya Kitaoka |
120a6e |
, m_xsheetHandle(0)
|
|
Shinya Kitaoka |
120a6e |
, m_sceneHandle(0)
|
|
Shinya Kitaoka |
120a6e |
, m_levelHandle(0)
|
|
Shinya Kitaoka |
120a6e |
, m_objectHandle(0)
|
|
Shinya Kitaoka |
120a6e |
, m_checkCol1(checkCol1)
|
|
Shinya Kitaoka |
120a6e |
, m_checkCol2(checkCol2)
|
|
Shinya Kitaoka |
120a6e |
, m_isCameraModeView(false)
|
|
Shinya Kitaoka |
120a6e |
, m_container_height(177) {
|
|
Shinya Kitaoka |
120a6e |
// param viewer
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer = new ParamViewer(this);
|
|
Shinya Kitaoka |
120a6e |
// swatch
|
|
Shinya Kitaoka |
120a6e |
QWidget *swatchContainer = new QWidget(this);
|
|
Shinya Kitaoka |
120a6e |
m_viewer = new SwatchViewer(swatchContainer);
|
|
Shinya Kitaoka |
120a6e |
setWhiteBg();
|
|
Shinya Kitaoka |
120a6e |
createToolBar();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setMinimumHeight(50);
|
|
Shinya Kitaoka |
120a6e |
swatchContainer->setSizePolicy(QSizePolicy::MinimumExpanding,
|
|
Shinya Kitaoka |
120a6e |
QSizePolicy::MinimumExpanding);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//---layout
|
|
Shinya Kitaoka |
120a6e |
addWidget(m_paramViewer);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QVBoxLayout *swatchLayout = new QVBoxLayout(swatchContainer);
|
|
Shinya Kitaoka |
120a6e |
swatchLayout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
swatchLayout->setSpacing(0);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
swatchLayout->addWidget(m_viewer, 0, Qt::AlignHCenter);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QHBoxLayout *toolBarLayout = new QHBoxLayout(swatchContainer);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
toolBarLayout->addWidget(m_toolBar, 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::AlignHCenter | Qt::AlignBottom);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
swatchLayout->addLayout(toolBarLayout);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
swatchContainer->setLayout(swatchLayout);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
addWidget(swatchContainer);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//---signal-slot connections
|
|
Shinya Kitaoka |
120a6e |
bool ret = true;
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_paramViewer, SIGNAL(currentFxParamChanged()),
|
|
Shinya Kitaoka |
120a6e |
SLOT(updateViewer()));
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
connect(m_viewer, SIGNAL(pointPositionChanged(int, const TPointD &)),
|
|
Shinya Kitaoka |
120a6e |
SLOT(onPointChanged(int, const TPointD &)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_paramViewer, SIGNAL(preferedSizeChanged(QSize)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onPreferedSizeChanged(QSize)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_paramViewer, SIGNAL(showSwatchButtonToggled(bool)),
|
|
Shinya Kitaoka |
120a6e |
this, SLOT(onShowSwatchButtonToggled(bool)));
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
swatchContainer->hide();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Swatch updates should happen only at the end of a separator resize op.
|
|
Shinya Kitaoka |
120a6e |
setStretchFactor(0, 1);
|
|
Shinya Kitaoka |
120a6e |
setStretchFactor(1, 0);
|
|
Shinya Kitaoka |
120a6e |
setOpaqueResize(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FxSettings::~FxSettings() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setFxHandle(TFxHandle *fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_fxHandle = fxHandle;
|
|
Shinya Kitaoka |
120a6e |
m_keyframeNavigator->setFxHandle(m_fxHandle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ParamField::setFxHandle(m_fxHandle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setFrameHandle(TFrameHandle *frameHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_frameHandle = frameHandle;
|
|
Shinya Kitaoka |
120a6e |
m_keyframeNavigator->setFrameHandle(m_frameHandle);
|
|
Shinya Kitaoka |
120a6e |
m_frameNavigator->setFrameHandle(m_frameHandle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setXsheetHandle(TXsheetHandle *xsheetHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_xsheetHandle = xsheetHandle;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setSceneHandle(TSceneHandle *sceneHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_sceneHandle = sceneHandle;
|
|
Shinya Kitaoka |
120a6e |
setCurrentScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setLevelHandle(TXshLevelHandle *levelHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_levelHandle = levelHandle;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setObjectHandle(TObjectHandle *objectHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_objectHandle = objectHandle;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::createToolBar() {
|
|
Shinya Kitaoka |
120a6e |
m_toolBar = new QToolBar(this);
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->setMovable(false);
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->setFixedHeight(23);
|
|
shun_iwasawa |
4a5f42 |
m_toolBar->setIconSize(QSize(17, 17));
|
|
shun_iwasawa |
4a5f42 |
m_toolBar->setObjectName("MediumPaddingToolBar");
|
|
shun_iwasawa |
4a5f42 |
// m_toolBar->setIconSize(QSize(23, 21));
|
|
Shinya Kitaoka |
120a6e |
// m_toolBar->setSizePolicy(QSizePolicy::MinimumExpanding,
|
|
Shinya Kitaoka |
120a6e |
// QSizePolicy::MinimumExpanding);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// View mode
|
|
Shinya Kitaoka |
120a6e |
QActionGroup *viewModeActGroup = new QActionGroup(m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
viewModeActGroup->setExclusive(false);
|
|
Shinya Kitaoka |
120a6e |
// camera
|
|
shun_iwasawa |
4a5f42 |
QIcon camera = createQIconOnOff("viewcamera");
|
|
Shinya Kitaoka |
120a6e |
QAction *cameraAct = new QAction(camera, tr("&Camera Preview"), m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
cameraAct->setCheckable(true);
|
|
Shinya Kitaoka |
120a6e |
viewModeActGroup->addAction(cameraAct);
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addAction(cameraAct);
|
|
Shinya Kitaoka |
120a6e |
// preview
|
|
shun_iwasawa |
4a5f42 |
QIcon preview = createQIconOnOff("preview");
|
|
Shinya Kitaoka |
120a6e |
QAction *previewAct = new QAction(preview, tr("&Preview"), m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
previewAct->setCheckable(true);
|
|
Shinya Kitaoka |
120a6e |
viewModeActGroup->addAction(previewAct);
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addAction(previewAct);
|
|
Shinya Kitaoka |
120a6e |
connect(viewModeActGroup, SIGNAL(triggered(QAction *)),
|
|
Shinya Kitaoka |
120a6e |
SLOT(onViewModeChanged(QAction *)));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addSeparator();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QActionGroup *viewModeGroup = new QActionGroup(m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
viewModeGroup->setExclusive(true);
|
|
Shinya Kitaoka |
120a6e |
|
|
shun_iwasawa |
4a5f42 |
QAction *whiteBg = new QAction(createQIconOnOff("preview_white"),
|
|
Shinya Kitaoka |
120a6e |
tr("&White Background"), m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
whiteBg->setCheckable(true);
|
|
Shinya Kitaoka |
120a6e |
whiteBg->setChecked(true);
|
|
Shinya Kitaoka |
120a6e |
viewModeGroup->addAction(whiteBg);
|
|
Shinya Kitaoka |
120a6e |
connect(whiteBg, SIGNAL(triggered()), this, SLOT(setWhiteBg()));
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addAction(whiteBg);
|
|
Shinya Kitaoka |
120a6e |
|
|
shun_iwasawa |
4a5f42 |
QAction *blackBg = new QAction(createQIconOnOff("preview_black"),
|
|
Shinya Kitaoka |
120a6e |
tr("&Black Background"), m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
blackBg->setCheckable(true);
|
|
Shinya Kitaoka |
120a6e |
viewModeGroup->addAction(blackBg);
|
|
Shinya Kitaoka |
120a6e |
connect(blackBg, SIGNAL(triggered()), this, SLOT(setBlackBg()));
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addAction(blackBg);
|
|
Shinya Kitaoka |
120a6e |
|
|
shun_iwasawa |
4a5f42 |
m_checkboardBg = new QAction(createQIconOnOff("preview_checkboard"),
|
|
Shinya Kitaoka |
120a6e |
tr("&Checkered Background"), m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
m_checkboardBg->setCheckable(true);
|
|
Shinya Kitaoka |
120a6e |
viewModeGroup->addAction(m_checkboardBg);
|
|
Shinya Kitaoka |
120a6e |
connect(m_checkboardBg, SIGNAL(triggered()), this, SLOT(setCheckboardBg()));
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addAction(m_checkboardBg);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addSeparator();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_keyframeNavigator = new FxKeyframeNavigator(m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addWidget(m_keyframeNavigator);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addSeparator();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_frameNavigator = new FrameNavigator(m_toolBar);
|
|
Shinya Kitaoka |
120a6e |
m_frameNavigator->setFrameHandle(m_frameHandle);
|
|
Shinya Kitaoka |
120a6e |
m_toolBar->addWidget(m_frameNavigator);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setFx(const TFxP ¤tFx, const TFxP &actualFx) {
|
|
Shinya Kitaoka |
120a6e |
// disconnecting from the fxChanged() signals avoid useless and dangerous
|
|
Shinya Kitaoka |
120a6e |
// updates!!!
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle)
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_fxHandle, SIGNAL(fxChanged()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(updateParamViewer()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TFxP currentFxWithoutCamera = 0;
|
|
Shinya Kitaoka |
120a6e |
if (currentFx && actualFx)
|
|
Shinya Kitaoka |
120a6e |
currentFxWithoutCamera = getCurrentFx(currentFx, actualFx->getFxId());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (currentFxWithoutCamera)
|
|
Shinya Kitaoka |
120a6e |
TFxUtil::setKeyframe(currentFxWithoutCamera, m_frameHandle->getFrameIndex(),
|
|
Shinya Kitaoka |
120a6e |
actualFx, m_frameHandle->getFrameIndex());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ToonzScene *scene = 0;
|
|
Shinya Kitaoka |
120a6e |
if (m_sceneHandle) scene = m_sceneHandle->getScene();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int frameIndex = 0;
|
|
Shinya Kitaoka |
120a6e |
if (m_frameHandle) frameIndex = m_frameHandle->getFrameIndex();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setFx(currentFxWithoutCamera, actualFx, frameIndex, scene);
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setIsCameraViewMode(m_isCameraModeView);
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setCameraMode(m_isCameraModeView);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDimension cameraSize = TDimension(-1, -1);
|
|
Shinya Kitaoka |
120a6e |
if (scene) cameraSize = scene->getCurrentCamera()->getRes();
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setCameraSize(cameraSize);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setFx(currentFx, actualFx, frameIndex);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle)
|
|
Shinya Kitaoka |
120a6e |
connect(m_fxHandle, SIGNAL(fxChanged()), this, SLOT(updateParamViewer()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setCurrentFrame() {
|
|
Shinya Kitaoka |
120a6e |
int frame = m_frameHandle->getFrameIndex();
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->update(frame, false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// if(m_isCameraModeView)
|
|
Shinya Kitaoka |
120a6e |
setCurrentFx();
|
|
Shinya Kitaoka |
120a6e |
m_viewer->updateFrame(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::changeTitleBar(TFx *fx) {
|
|
Shinya Kitaoka |
120a6e |
QDialog *popup = dynamic_cast<qdialog *="">(parentWidget());</qdialog>
|
|
Shinya Kitaoka |
120a6e |
if (!popup) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QString titleText("Fx Settings");
|
|
Shinya Kitaoka |
120a6e |
if (fx) {
|
|
Shinya Kitaoka |
120a6e |
titleText += tr(" : ");
|
|
Shinya Kitaoka |
120a6e |
titleText += QString::fromStdWString(fx->getName());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
popup->setWindowTitle(titleText);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setCurrentFx() {
|
|
Shinya Kitaoka |
120a6e |
TFx *currFx = m_fxHandle->getFx();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TFxP actualFx, currentFx;
|
|
Shinya Kitaoka |
120a6e |
if (!currFx || 0 != dynamic_cast<txsheetfx *="">(currFx)) {</txsheetfx>
|
|
Shinya Kitaoka |
120a6e |
actualFx = currentFx = TFxP();
|
|
Shinya Kitaoka |
120a6e |
setFx(actualFx, currentFx);
|
|
Shinya Kitaoka |
120a6e |
changeTitleBar(currentFx.getPointer());
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
TFxP fx(currFx);
|
|
Shinya Kitaoka |
120a6e |
bool hasEmptyInput = false;
|
|
Shinya Kitaoka |
120a6e |
if (TZeraryColumnFx *zfx = dynamic_cast<tzerarycolumnfx *="">(fx.getPointer()))</tzerarycolumnfx>
|
|
Shinya Kitaoka |
120a6e |
fx = zfx->getZeraryFx();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
hasEmptyInput = hasEmptyInputPort(fx);
|
|
Shinya Kitaoka |
120a6e |
int frame = m_frameHandle->getFrame();
|
|
Shinya Kitaoka |
120a6e |
ToonzScene *scene = m_sceneHandle->getScene();
|
|
Shinya Kitaoka |
120a6e |
actualFx = fx;
|
|
Shinya Kitaoka |
120a6e |
bool isEnabled = actualFx->getAttributes()->isEnabled();
|
|
Shinya Kitaoka |
120a6e |
actualFx->getAttributes()->enable(true);
|
|
Shinya Kitaoka |
120a6e |
if (hasEmptyInput)
|
|
Shinya Kitaoka |
120a6e |
currentFx = actualFx;
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
if (!m_isCameraModeView)
|
|
Shinya Kitaoka |
120a6e |
currentFx = buildSceneFx(scene, frame, actualFx, false);
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings rs =
|
|
Shinya Kitaoka |
120a6e |
scene->getProperties()->getPreviewProperties()->getRenderSettings();
|
|
Shinya Kitaoka |
120a6e |
currentFx = buildPartialSceneFx(scene, (double)frame, actualFx, 1, false);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (currentFx) currentFx = currentFx->clone(true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// se al frame corrente non c'e' il livello a cui e' applicato l'effetto:
|
|
Shinya Kitaoka |
120a6e |
// current=0, actual!=0
|
|
Shinya Kitaoka |
120a6e |
if (!currentFx) currentFx = actualFx->clone(false);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
actualFx->getAttributes()->enable(isEnabled);
|
|
Shinya Kitaoka |
120a6e |
setFx(currentFx, actualFx);
|
|
Shinya Kitaoka |
120a6e |
changeTitleBar(currentFx.getPointer());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setCurrentScene() {
|
|
Shinya Kitaoka |
120a6e |
ToonzScene *scene = m_sceneHandle->getScene();
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setScene(scene);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::notifySceneChanged() {
|
|
Shinya Kitaoka |
120a6e |
TPixel32 col1, col2;
|
|
Shinya Kitaoka |
120a6e |
Preferences::instance()->getChessboardColors(col1, col2);
|
|
Shinya Kitaoka |
120a6e |
setCheckboardColors(col1, col2);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::showEvent(QShowEvent *event) {
|
|
Shinya Kitaoka |
120a6e |
setCurrentFx();
|
|
Shinya Kitaoka |
120a6e |
setCurrentFrame();
|
|
Shinya Kitaoka |
120a6e |
connect(m_frameHandle, SIGNAL(frameSwitched()), SLOT(setCurrentFrame()));
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
connect(m_paramViewer, SIGNAL(actualFxParamChanged()), m_fxHandle,
|
|
Shinya Kitaoka |
120a6e |
SIGNAL(fxChanged()));
|
|
Shinya Kitaoka |
120a6e |
connect(m_fxHandle, SIGNAL(fxChanged()), SLOT(updateParamViewer()));
|
|
Shinya Kitaoka |
120a6e |
connect(m_fxHandle, SIGNAL(fxSettingsShouldBeSwitched()),
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (m_sceneHandle) {
|
|
Shinya Kitaoka |
120a6e |
connect(m_sceneHandle, SIGNAL(sceneChanged()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(notifySceneChanged()));
|
|
Shinya Kitaoka |
120a6e |
connect(m_sceneHandle, SIGNAL(sceneSwitched()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentScene()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (m_xsheetHandle)
|
|
Shinya Kitaoka |
120a6e |
connect(m_xsheetHandle, SIGNAL(xsheetChanged()), SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
if (m_levelHandle)
|
|
Shinya Kitaoka |
120a6e |
connect(m_levelHandle, SIGNAL(xshLevelChanged()), SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
if (m_objectHandle)
|
|
Shinya Kitaoka |
120a6e |
connect(m_objectHandle, SIGNAL(objectChanged(bool)), SLOT(setCurrentFx()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::hideEvent(QHideEvent *) {
|
|
Shinya Kitaoka |
120a6e |
setFx(0, 0);
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_frameHandle, SIGNAL(frameSwitched()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentFrame()));
|
|
Shinya Kitaoka |
120a6e |
if (m_fxHandle) {
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_fxHandle, SIGNAL(fxChanged()), this, SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_fxHandle, SIGNAL(fxChanged()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(updateParamViewer()));
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_fxHandle, SIGNAL(fxSettingsShouldBeSwitched()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (m_sceneHandle) {
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_sceneHandle, SIGNAL(sceneChanged()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(notifySceneChanged()));
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_sceneHandle, SIGNAL(sceneSwitched()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentScene()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (m_xsheetHandle)
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_xsheetHandle, SIGNAL(xsheetChanged()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
if (m_levelHandle)
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_levelHandle, SIGNAL(xshLevelChanged()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentFx()));
|
|
Shinya Kitaoka |
120a6e |
if (m_objectHandle)
|
|
Shinya Kitaoka |
120a6e |
disconnect(m_objectHandle, SIGNAL(objectChanged(bool)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(setCurrentFx()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setCheckboardColors(const TPixel32 &col1,
|
|
Shinya Kitaoka |
120a6e |
const TPixel32 &col2) {
|
|
Shinya Kitaoka |
120a6e |
m_checkCol1 = col1;
|
|
Shinya Kitaoka |
120a6e |
m_checkCol2 = col2;
|
|
Shinya Kitaoka |
120a6e |
if (m_checkboardBg->isChecked())
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setBgPainter(m_checkCol1, m_checkCol2);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setWhiteBg() { m_viewer->setBgPainter(TPixel32::White); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setBlackBg() { m_viewer->setBgPainter(TPixel32::Black); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::setCheckboardBg() {
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setBgPainter(m_checkCol1, m_checkCol2);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::updateViewer() {
|
|
Shinya Kitaoka |
120a6e |
if (m_viewer->isEnabled())
|
|
Shinya Kitaoka |
120a6e |
m_viewer->updateFrame(m_frameHandle->getFrameIndex());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::updateParamViewer() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_paramViewer || !m_frameHandle) return;
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->update(m_frameHandle->getFrameIndex(), true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::onPointChanged(int index, const TPointD &p) {
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setPointValue(index, p);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::onViewModeChanged(QAction *triggeredAct) {
|
|
Shinya Kitaoka |
120a6e |
setFocus();
|
|
Shinya Kitaoka |
120a6e |
QString name = triggeredAct->text();
|
|
Shinya Kitaoka |
120a6e |
bool actIsChecked = triggeredAct->isChecked();
|
|
Shinya Kitaoka |
120a6e |
QList<qaction *=""> actions = m_toolBar->actions();</qaction>
|
|
Shinya Kitaoka |
120a6e |
QAction *cameraAct = actions[0];
|
|
Shinya Kitaoka |
120a6e |
QAction *previewAct = actions[1];
|
|
Shinya Kitaoka |
120a6e |
if (name == previewAct->text()) {
|
|
Shinya Kitaoka |
120a6e |
if (cameraAct->isChecked()) cameraAct->setChecked(false);
|
|
Shinya Kitaoka |
120a6e |
if (actIsChecked) {
|
|
Shinya Kitaoka |
120a6e |
m_isCameraModeView = false;
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setIsCameraViewMode(false);
|
|
Shinya Kitaoka |
120a6e |
setCurrentFx();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setEnable(actIsChecked);
|
|
Shinya Kitaoka |
120a6e |
} else if (name == cameraAct->text()) {
|
|
Shinya Kitaoka |
120a6e |
if (previewAct->isChecked()) previewAct->setChecked(false);
|
|
Shinya Kitaoka |
120a6e |
if (actIsChecked) {
|
|
Shinya Kitaoka |
120a6e |
m_isCameraModeView = true;
|
|
Shinya Kitaoka |
120a6e |
m_paramViewer->setIsCameraViewMode(true);
|
|
Shinya Kitaoka |
120a6e |
setCurrentFx();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_viewer->setEnable(actIsChecked);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::onPreferedSizeChanged(QSize pvBestSize) {
|
|
Shinya Kitaoka |
120a6e |
QSize popupBestSize = pvBestSize;
|
|
Shinya Kitaoka |
120a6e |
if (m_toolBar->isVisible()) {
|
|
Shinya Kitaoka |
120a6e |
popupBestSize += QSize(0, m_viewer->height() + m_toolBar->height());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QDialog *popup = dynamic_cast<qdialog *="">(parentWidget());</qdialog>
|
|
Shinya Kitaoka |
120a6e |
if (popup) {
|
|
Shinya Kitaoka |
120a6e |
QRect geom = popup->geometry();
|
|
Shinya Kitaoka |
120a6e |
geom.setSize(popupBestSize);
|
|
Shinya Kitaoka |
120a6e |
popup->setGeometry(geom);
|
|
Shinya Kitaoka |
120a6e |
popup->update();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FxSettings::onShowSwatchButtonToggled(bool on) {
|
|
Shinya Kitaoka |
120a6e |
QWidget *bottomContainer = widget(1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!on)
|
|
Shinya Kitaoka |
120a6e |
m_container_height =
|
|
Shinya Kitaoka |
120a6e |
bottomContainer->height() + handleWidth() /* ハンドル幅 */;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bottomContainer->setVisible(on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QDialog *popup = dynamic_cast<qdialog *="">(parentWidget());</qdialog>
|
|
Shinya Kitaoka |
120a6e |
if (popup) {
|
|
Shinya Kitaoka |
120a6e |
QRect geom = popup->geometry();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int height_change = (on) ? m_container_height : -m_container_height;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
geom.setSize(geom.size() + QSize(0, height_change));
|
|
Shinya Kitaoka |
120a6e |
popup->setGeometry(geom);
|
|
Shinya Kitaoka |
120a6e |
popup->update();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|