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