|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/tooloptions.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzTools includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/tool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/toolhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/toolcommandids.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "selectiontool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "vectorselectiontool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "rasterselectiontool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "brushtool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "fullcolorbrushtool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tooloptionscontrols.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//#include "rgbpickertool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "rulertool.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvdialog.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/menubarcommand.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvscrollwidget.h"
|
|
Toshihiro Shimizu |
890ddd |
//iwsw commented out temporarily
|
|
Toshihiro Shimizu |
890ddd |
//#include "toonzqt/ghibli_3dlut_converter.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tobjecthandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobject.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txsheethandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobjectspline.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tframehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/palettecontroller.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevelhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/preferences.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobjecttree.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tenv.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qpainter></qpainter>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbar></qtoolbar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdockwidget></qdockwidget>
|
|
Toshihiro Shimizu |
890ddd |
#include <qhboxlayout></qhboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
#include <qcombobox></qcombobox>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlabel></qlabel>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpushbutton></qpushbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbutton></qtoolbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qresizeevent></qresizeevent>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlist></qlist>
|
|
Toshihiro Shimizu |
890ddd |
#include <qsignalmapper></qsignalmapper>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpushbutton></qpushbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpropertyanimation></qpropertyanimation>
|
|
Toshihiro Shimizu |
890ddd |
#include <qeasingcurve></qeasingcurve>
|
|
Toshihiro Shimizu |
890ddd |
#include <qstackedwidget></qstackedwidget>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// tcg includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_deleter_types.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TEnv::IntVar ArrowGlobalKeyFrame("EditToolGlobalKeyFrame", 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ToolOptionToolBar
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionToolBar::ToolOptionToolBar(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QToolBar(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setObjectName("toolOptionsPanel");
|
|
Toshihiro Shimizu |
890ddd |
setMaximumHeight(25);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionToolBar::addSpacing(int width)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QWidget *spaceW = new QWidget(this);
|
|
Toshihiro Shimizu |
890ddd |
spaceW->setFixedWidth(width);
|
|
Toshihiro Shimizu |
890ddd |
addWidget(spaceW);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionsBox::ToolOptionsBox(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QFrame(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setObjectName("toolOptionsPanel");
|
|
Toshihiro Shimizu |
890ddd |
setStyleSheet("#toolOptionsPanel {border: 0px; margin: 1px;}");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
setFixedHeight(26);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_layout = new QHBoxLayout;
|
|
Toshihiro Shimizu |
890ddd |
m_layout->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->setSpacing(2);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
setLayout(m_layout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionsBox::~ToolOptionsBox()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
std::for_each(m_controls.begin(), m_controls.end(), tcg::deleter<tooloptioncontrol>());</tooloptioncontrol>
|
|
Toshihiro Shimizu |
890ddd |
std::for_each(m_labels.begin(), m_labels.end(), tcg::deleter<qlabel>());</qlabel>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QLabel *ToolOptionsBox::addLabel(QString name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = new QLabel(name);
|
|
Toshihiro Shimizu |
890ddd |
label->setFixedHeight(20);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addWidget(label);
|
|
Toshihiro Shimizu |
890ddd |
m_labels[name.toStdString()] = label;
|
|
Toshihiro Shimizu |
890ddd |
return label;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionsBox::addLabel(string propName, QLabel *label)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_labels[propName] = label;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionsBox::addSeparator()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
DVGui::Separator *separator = new DVGui::Separator();
|
|
Toshihiro Shimizu |
890ddd |
separator->setOrientation(false);
|
|
Toshihiro Shimizu |
890ddd |
separator->setFixedWidth(17);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addWidget(separator, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionsBox::addControl(ToolOptionControl *control)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_controls[control->propertyName()] = control;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControl *ToolOptionsBox::control(const std::string &controlName) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<std::string, *="" tooloptioncontrol="">::const_iterator</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
ct = m_controls.find(controlName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return (ct == m_controls.end()) ? 0 : ct.value();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ToolOptionControlBuilder
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder::ToolOptionControlBuilder(ToolOptionsBox *panel, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: m_panel(panel), m_tool(tool), m_pltHandle(pltHandle), m_toolHandle(toolHandle), m_singleValueWidgetType(SLIDER), m_enumWidgetType(COMBOBOX)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QLabel *ToolOptionControlBuilder::addLabel(TProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = new QLabel(p->getQStringName());
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(label, 0);
|
|
Toshihiro Shimizu |
890ddd |
return label;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TDoubleProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionSlider *control = new ToolOptionSlider(m_tool, p, m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(control, 100);
|
|
Toshihiro Shimizu |
890ddd |
// storing the control in the map for updating values later
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
CommandManager *cm = CommandManager::instance();
|
|
Toshihiro Shimizu |
890ddd |
if (p->getName() == "Size:") {
|
|
Toshihiro Shimizu |
890ddd |
QAction *a;
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increase()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decrease()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (p->getName() == "Hardness:") {
|
|
Toshihiro Shimizu |
890ddd |
QAction *a;
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseBrushHardness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increase()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseBrushHardness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decrease()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TDoublePairProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionPairSlider *control = new ToolOptionPairSlider(m_tool, p, QObject::tr("Min:"), QObject::tr("Max:"), m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(control, 200);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (p->getName() == "Size:") {
|
|
Toshihiro Shimizu |
890ddd |
CommandManager *cm = CommandManager::instance();
|
|
Toshihiro Shimizu |
890ddd |
QAction *a;
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increaseMaxValue()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decreaseMaxValue()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseMinBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increaseMinValue()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseMinBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decreaseMinValue()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TIntPairProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionIntPairSlider *control = new ToolOptionIntPairSlider(m_tool, p, QObject::tr("Min:"), QObject::tr("Max:"), m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(control, 100);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (p->getName() == "Size:") {
|
|
Toshihiro Shimizu |
890ddd |
CommandManager *cm = CommandManager::instance();
|
|
Toshihiro Shimizu |
890ddd |
QAction *a;
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increaseMaxValue()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decreaseMaxValue()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseMinBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increaseMinValue()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseMinBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decreaseMinValue()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TIntProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionIntSlider *control = new ToolOptionIntSlider(m_tool, p, m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_singleValueWidgetType == FIELD) {
|
|
Toshihiro Shimizu |
890ddd |
control->enableSlider(false);
|
|
Toshihiro Shimizu |
890ddd |
control->setFixedWidth(45);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(control, 100);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
if (p->getName() == "Size:") {
|
|
Toshihiro Shimizu |
890ddd |
CommandManager *cm = CommandManager::instance();
|
|
Toshihiro Shimizu |
890ddd |
QAction *a;
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_IncreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(increase()));
|
|
Toshihiro Shimizu |
890ddd |
a = cm->getAction("A_DecreaseMaxBrushThickness");
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decrease()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TBoolProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionCheckbox *control = new ToolOptionCheckbox(m_tool, p, m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(control, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (p->getId() != "") {
|
|
Toshihiro Shimizu |
890ddd |
string actionName = "A_ToolOption_" + p->getId();
|
|
Toshihiro Shimizu |
890ddd |
QAction *a = CommandManager::instance()->getAction(actionName.c_str());
|
|
Toshihiro Shimizu |
890ddd |
if (a) {
|
|
Toshihiro Shimizu |
890ddd |
control->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), control, SLOT(doClick()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TStringProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionTextField *control = new ToolOptionTextField(m_tool, p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(control);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TEnumProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QWidget *widget;
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControl *control;
|
|
Toshihiro Shimizu |
890ddd |
switch (m_enumWidgetType) {
|
|
Toshihiro Shimizu |
890ddd |
case POPUPBUTTON: {
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionPopupButton *obj = new ToolOptionPopupButton(m_tool, p);
|
|
Toshihiro Shimizu |
890ddd |
obj->setToolTip(p->getQStringName());
|
|
Toshihiro Shimizu |
890ddd |
control = obj;
|
|
Toshihiro Shimizu |
890ddd |
widget = obj;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
case COMBOBOX:
|
|
Toshihiro Shimizu |
890ddd |
default: {
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionCombo *obj = new ToolOptionCombo(m_tool, p, m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
control = obj;
|
|
Toshihiro Shimizu |
890ddd |
widget = obj;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(widget, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(control);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (p->getId() != "") {
|
|
Toshihiro Shimizu |
890ddd |
string actionName = "A_ToolOption_" + p->getId();
|
|
Toshihiro Shimizu |
890ddd |
QAction *a = CommandManager::instance()->getAction(actionName.c_str());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (a) {
|
|
Toshihiro Shimizu |
890ddd |
widget->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), widget, SLOT(doShowPopup()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty::Range range = p->getRange();
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty::Range::iterator it;
|
|
Toshihiro Shimizu |
890ddd |
QSignalMapper *signalMapper = 0;
|
|
Toshihiro Shimizu |
890ddd |
int index = 0;
|
|
Toshihiro Shimizu |
890ddd |
for (it = range.begin(); it != range.end(); ++it, ++index) {
|
|
Toshihiro Shimizu |
890ddd |
string item = toString(*it);
|
|
Toshihiro Shimizu |
890ddd |
string itemActionName = actionName + ":" + item;
|
|
Toshihiro Shimizu |
890ddd |
a = CommandManager::instance()->getAction(itemActionName.c_str());
|
|
Toshihiro Shimizu |
890ddd |
if (a) {
|
|
Toshihiro Shimizu |
890ddd |
widget->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
if (signalMapper == 0) {
|
|
Toshihiro Shimizu |
890ddd |
signalMapper = new QSignalMapper(widget);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(signalMapper, SIGNAL(mapped(int)), widget, SLOT(doOnActivated(int)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
|
Toshihiro Shimizu |
890ddd |
signalMapper->setMapping(a, index);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TStyleIndexProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLabel *label = addLabel(p);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addLabel(p->getName(), label);
|
|
Toshihiro Shimizu |
890ddd |
StyleIndexFieldAndChip *chip = new StyleIndexFieldAndChip(m_tool, p, m_pltHandle, m_toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(chip, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_panel->addControl(chip);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptionControlBuilder::visit(TPointerProperty *p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(!"not implemented");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// GenericToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
GenericToolOptionsBox::GenericToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
int propertyGroupIdx,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setObjectName("toolOptionsPanel");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(propertyGroupIdx))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(propertyGroupIdx)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class IconViewField : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QPixmap m_pixmap;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
IconViewField(QWidget *parent = 0, QPixmap pixmap = QPixmap())
|
|
Toshihiro Shimizu |
890ddd |
: QWidget(parent), m_pixmap(pixmap)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setMinimumSize(21, 25);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *e)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QPainter p(this);
|
|
Toshihiro Shimizu |
890ddd |
// La pixmap e' alta 17 px, il widget 23. Per centrarla faccio il draw a 3 px.
|
|
Toshihiro Shimizu |
890ddd |
p.drawPixmap(QRect(0, 3, 21, 17), m_pixmap);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ArrowToolOptionsBox::ArrowToolOptionsBox(QWidget *parent, TTool *tool, TPropertyGroup *pg,
|
|
Toshihiro Shimizu |
890ddd |
TFrameHandle *frameHandle, TObjectHandle *objHandle, TXsheetHandle *xshHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_pg(pg), m_tool(tool), m_frameHandle(frameHandle), m_objHandle(objHandle), m_xshHandle(xshHandle)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
setObjectName("toolOptionsPanel");
|
|
Toshihiro Shimizu |
890ddd |
setFixedHeight(26);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_mainStackedWidget = new QStackedWidget(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- General Parts --- */
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//enable to choose target pegbar with combobox
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObjectCombo = new QComboBox(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty *activeAxisProp = dynamic_cast<tenumproperty *="">(m_pg->getProperty("Active Axis"));</tenumproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (activeAxisProp)
|
|
Toshihiro Shimizu |
890ddd |
m_chooseActiveAxisCombo = new ToolOptionCombo(m_tool, activeAxisProp, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty *autoSelectProp = dynamic_cast<tenumproperty *="">(m_pg->getProperty("Auto Select Column"));</tenumproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (autoSelectProp)
|
|
Toshihiro Shimizu |
890ddd |
m_pickCombo = new ToolOptionCombo(m_tool, autoSelectProp, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Position --- */
|
|
Toshihiro Shimizu |
890ddd |
m_motionPathPosField = new PegbarChannelField(m_tool, TStageObject::T_Path, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_ewPosField = new PegbarChannelField(m_tool, TStageObject::T_X, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_nsPosField = new PegbarChannelField(m_tool, TStageObject::T_Y, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_zField = new PegbarChannelField(m_tool, TStageObject::T_Z, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_noScaleZField = new NoScaleField(m_tool, "field");
|
|
Toshihiro Shimizu |
890ddd |
m_ewPosLabel = new QLabel(tr("E/W:"), this);
|
|
Toshihiro Shimizu |
890ddd |
m_nsPosLabel = new QLabel(tr("N/S:"), this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock E/W
|
|
Toshihiro Shimizu |
890ddd |
TBoolProperty *lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Position E/W"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWPosCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock N/S
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Position N/S"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSPosCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
//stacking order
|
|
Toshihiro Shimizu |
890ddd |
m_soLabel = new QLabel(tr("SO:"), this);
|
|
Toshihiro Shimizu |
890ddd |
m_soField = new PegbarChannelField(m_tool, TStageObject::T_SO, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Rotation --- */
|
|
Toshihiro Shimizu |
890ddd |
m_rotationField = new PegbarChannelField(m_tool, TStageObject::T_Angle, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Scale --- */
|
|
Toshihiro Shimizu |
890ddd |
m_globalScaleField = new PegbarChannelField(m_tool, TStageObject::T_Scale, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_scaleHField = new PegbarChannelField(m_tool, TStageObject::T_ScaleX, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_scaleVField = new PegbarChannelField(m_tool, TStageObject::T_ScaleY, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty *scaleConstraintProp = dynamic_cast<tenumproperty *="">(m_pg->getProperty("Scale Constraint:"));</tenumproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (scaleConstraintProp)
|
|
Toshihiro Shimizu |
890ddd |
m_maintainCombo = new ToolOptionCombo(m_tool, scaleConstraintProp, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
// Lock Scale H
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Scale H"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockScaleHCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock Scale V
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Scale V"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockScaleVCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Shear --- */
|
|
Toshihiro Shimizu |
890ddd |
m_shearHField = new PegbarChannelField(m_tool, TStageObject::T_ShearX, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_shearVField = new PegbarChannelField(m_tool, TStageObject::T_ShearY, "field", frameHandle, objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock Shear H
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Shear H"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockShearHCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock Scale V
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Shear V"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockShearVCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Center Position --- */
|
|
Toshihiro Shimizu |
890ddd |
m_ewCenterField = new PegbarCenterField(m_tool, 0, "field", objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
m_nsCenterField = new PegbarCenterField(m_tool, 1, "field", objHandle, xshHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock E/W Center
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Center E/W"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWCenterCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
// Lock N/S Center
|
|
Toshihiro Shimizu |
890ddd |
lockProp = dynamic_cast<tboolproperty *="">(m_pg->getProperty("Lock Center N/S"));</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
if (lockProp)
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSCenterCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWPosCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSPosCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWCenterCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSCenterCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockScaleHCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockScaleVCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockShearHCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockShearVCheckbox->setObjectName("EditToolLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWPosCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSPosCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWCenterCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSCenterCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockScaleHCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockScaleVCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockShearHCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_lockShearVCheckbox->setText("");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_zField->setPrecision(4);
|
|
Toshihiro Shimizu |
890ddd |
m_noScaleZField->setPrecision(4);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool splined = isCurrentObjectSplined();
|
|
Toshihiro Shimizu |
890ddd |
if (splined != m_splined)
|
|
Toshihiro Shimizu |
890ddd |
m_splined = splined;
|
|
Toshihiro Shimizu |
890ddd |
setSplined(m_splined);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Layout --- */
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *mainLay = m_layout;
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
mainLay->addWidget(m_currentStageObjectCombo, 0);
|
|
Toshihiro Shimizu |
890ddd |
mainLay->addWidget(m_chooseActiveAxisCombo, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
mainLay->addWidget(m_mainStackedWidget, 0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Position
|
|
Toshihiro Shimizu |
890ddd |
QFrame *posFrame = new QFrame(this);
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *posLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
posLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
posLay->setSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
posFrame->setLayout(posLay);
|
|
Toshihiro Shimizu |
890ddd |
m_mainStackedWidget->addWidget(posFrame);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(new QLabel(tr("Position"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
posLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(m_motionPathPosField, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *ewLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
ewLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
ewLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
ewLay->addWidget(m_ewPosLabel, 0);
|
|
Toshihiro Shimizu |
890ddd |
ewLay->addWidget(m_ewPosField, 0);
|
|
Toshihiro Shimizu |
890ddd |
ewLay->addWidget(m_lockEWPosCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
posLay->addLayout(ewLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
posLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *nsLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
nsLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
nsLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
nsLay->addWidget(m_nsPosLabel, 0);
|
|
Toshihiro Shimizu |
890ddd |
nsLay->addWidget(m_nsPosField, 0);
|
|
Toshihiro Shimizu |
890ddd |
nsLay->addWidget(m_lockNSPosCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
posLay->addLayout(nsLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
posLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(new QLabel(tr("Z:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(m_zField, 0);
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(new QLabel(tr("("), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(m_noScaleZField, 0);
|
|
Toshihiro Shimizu |
890ddd |
posLay->addWidget(new QLabel(tr(")"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *soLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
soLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
soLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
soLay->addWidget(m_soLabel, 0);
|
|
Toshihiro Shimizu |
890ddd |
soLay->addWidget(m_soField, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
posLay->addLayout(soLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
posLay->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Rotation
|
|
Toshihiro Shimizu |
890ddd |
QFrame *rotFrame = new QFrame(this);
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *rotLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
rotLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
rotLay->setSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
rotFrame->setLayout(rotLay);
|
|
Toshihiro Shimizu |
890ddd |
m_mainStackedWidget->addWidget(rotFrame);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
rotLay->addWidget(new QLabel(tr("Rotation"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
rotLay->addWidget(m_rotationField, 0);
|
|
Toshihiro Shimizu |
890ddd |
rotLay->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Scale
|
|
Toshihiro Shimizu |
890ddd |
QFrame *scaleFrame = new QFrame(this);
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *scaleLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->setSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
scaleFrame->setLayout(scaleLay);
|
|
Toshihiro Shimizu |
890ddd |
m_mainStackedWidget->addWidget(scaleFrame);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addWidget(new QLabel(tr("Scale"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addWidget(new QLabel(tr("Global:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addWidget(m_globalScaleField, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *hLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
hLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
hLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
hLay->addWidget(new QLabel(tr("H:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
hLay->addWidget(m_scaleHField, 0);
|
|
Toshihiro Shimizu |
890ddd |
hLay->addWidget(m_lockScaleHCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addLayout(hLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *vLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
vLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
vLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
vLay->addWidget(new QLabel(tr("V:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
vLay->addWidget(m_scaleVField, 0);
|
|
Toshihiro Shimizu |
890ddd |
vLay->addWidget(m_lockScaleVCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addLayout(vLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addWidget(new QLabel(tr("Maintain:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addWidget(m_maintainCombo, 0);
|
|
Toshihiro Shimizu |
890ddd |
scaleLay->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Shear
|
|
Toshihiro Shimizu |
890ddd |
QFrame *shearFrame = new QFrame(this);
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *shearLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
shearLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
shearLay->setSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
shearFrame->setLayout(shearLay);
|
|
Toshihiro Shimizu |
890ddd |
m_mainStackedWidget->addWidget(shearFrame);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
shearLay->addWidget(new QLabel(tr("Shear"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
shearLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *hLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
hLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
hLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
hLay->addWidget(new QLabel(tr("H:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
hLay->addWidget(m_shearHField, 0);
|
|
Toshihiro Shimizu |
890ddd |
hLay->addWidget(m_lockShearHCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
shearLay->addLayout(hLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *vLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
vLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
vLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
vLay->addWidget(new QLabel(tr("V:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
vLay->addWidget(m_shearVField, 0);
|
|
Toshihiro Shimizu |
890ddd |
vLay->addWidget(m_lockShearVCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
shearLay->addLayout(vLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
shearLay->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Center Position
|
|
Toshihiro Shimizu |
890ddd |
QFrame *centerPosFrame = new QFrame(this);
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *centerPosLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->setSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
centerPosFrame->setLayout(centerPosLay);
|
|
Toshihiro Shimizu |
890ddd |
m_mainStackedWidget->addWidget(centerPosFrame);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->addWidget(new QLabel(tr("Center Position"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *ewLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
ewLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
ewLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
ewLay->addWidget(new QLabel(tr("E/W:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
ewLay->addWidget(m_ewCenterField, 0);
|
|
Toshihiro Shimizu |
890ddd |
ewLay->addWidget(m_lockEWCenterCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->addLayout(ewLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *nsLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
nsLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
nsLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
nsLay->addWidget(new QLabel(tr("N/S:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
nsLay->addWidget(m_nsCenterField, 0);
|
|
Toshihiro Shimizu |
890ddd |
nsLay->addWidget(m_lockNSCenterCheckbox, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->addLayout(nsLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
centerPosLay->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
mainLay->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *pickLay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
pickLay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
pickLay->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
mainLay->addLayout(pickLay, 0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
pickLay->addWidget(new QLabel(tr("Pick:"), this), 0);
|
|
Toshihiro Shimizu |
890ddd |
pickLay->addWidget(m_pickCombo, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- signal-slot connections --- */
|
|
Toshihiro Shimizu |
890ddd |
//swap page when the active axis is changed
|
|
Toshihiro Shimizu |
890ddd |
connect(m_chooseActiveAxisCombo, SIGNAL(currentIndexChanged(int)), m_mainStackedWidget, SLOT(setCurrentIndex(int)));
|
|
Toshihiro Shimizu |
890ddd |
// when the current stage object is changed via combo box, then switch the current stage object in the scene
|
|
Toshihiro Shimizu |
890ddd |
connect(m_currentStageObjectCombo, SIGNAL(activated(int)), this, SLOT(onCurrentStageObjectComboActivated(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* --- Assigning shortcut keys --- */
|
|
Toshihiro Shimizu |
890ddd |
if (activeAxisProp->getId() != "") {
|
|
Toshihiro Shimizu |
890ddd |
string actionName = "A_ToolOption_" + activeAxisProp->getId();
|
|
Toshihiro Shimizu |
890ddd |
QAction *a = CommandManager::instance()->getAction(actionName.c_str());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (a) {
|
|
Toshihiro Shimizu |
890ddd |
m_chooseActiveAxisCombo->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), m_chooseActiveAxisCombo, SLOT(doShowPopup()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty::Range range = activeAxisProp->getRange();
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty::Range::iterator it;
|
|
Toshihiro Shimizu |
890ddd |
QSignalMapper *signalMapper = 0;
|
|
Toshihiro Shimizu |
890ddd |
int index = 0;
|
|
Toshihiro Shimizu |
890ddd |
for (it = range.begin(); it != range.end(); ++it, ++index) {
|
|
Toshihiro Shimizu |
890ddd |
string item = toString(*it);
|
|
Toshihiro Shimizu |
890ddd |
string itemActionName = actionName + ":" + item;
|
|
Toshihiro Shimizu |
890ddd |
a = CommandManager::instance()->getAction(itemActionName.c_str());
|
|
Toshihiro Shimizu |
890ddd |
if (a) {
|
|
Toshihiro Shimizu |
890ddd |
m_chooseActiveAxisCombo->addAction(a);
|
|
Toshihiro Shimizu |
890ddd |
if (signalMapper == 0) {
|
|
Toshihiro Shimizu |
890ddd |
signalMapper = new QSignalMapper(m_chooseActiveAxisCombo);
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(signalMapper, SIGNAL(mapped(int)), m_chooseActiveAxisCombo, SLOT(doOnActivated(int)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
QObject::connect(a, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
|
Toshihiro Shimizu |
890ddd |
signalMapper->setMapping(a, index);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (scaleConstraintProp) {
|
|
Toshihiro Shimizu |
890ddd |
m_scaleHField->onScaleTypeChanged(m_maintainCombo->currentIndex());
|
|
Toshihiro Shimizu |
890ddd |
m_scaleVField->onScaleTypeChanged(m_maintainCombo->currentIndex());
|
|
Toshihiro Shimizu |
890ddd |
connect(m_maintainCombo, SIGNAL(currentIndexChanged(int)), m_scaleHField, SLOT(onScaleTypeChanged(int)));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_maintainCombo, SIGNAL(currentIndexChanged(int)), m_scaleVField, SLOT(onScaleTypeChanged(int)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::showEvent(QShowEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
connect(m_frameHandle, SIGNAL(frameSwitched()), SLOT(onFrameSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
// if some stage object is added/removed, then reflect it to the combobox
|
|
Toshihiro Shimizu |
890ddd |
connect(m_xshHandle, SIGNAL(xsheetSwitched()), this, SLOT(updateStageObjectComboItems()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_xshHandle, SIGNAL(xsheetChanged()), this, SLOT(updateStageObjectComboItems()));
|
|
Toshihiro Shimizu |
890ddd |
// If the current stage object is switched, then synchronize it to the combobox
|
|
Toshihiro Shimizu |
890ddd |
connect(m_objHandle, SIGNAL(objectSwitched()), this, SLOT(syncCurrentStageObjectComboItem()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//update the item list in m_currentStageObjectCombo
|
|
Toshihiro Shimizu |
890ddd |
updateStageObjectComboItems();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::hideEvent(QShowEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_frameHandle, SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_xshHandle, SIGNAL(xsheetSwitched()), this, SLOT(updateStageObjectComboItems()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_xshHandle, SIGNAL(xsheetChanged()), this, SLOT(updateStageObjectComboItems()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_objHandle, SIGNAL(objectSwitched()), this, SLOT(syncCurrentStageObjectComboItem()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::setSplined(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_splined = on;
|
|
Toshihiro Shimizu |
890ddd |
//Activate on selecting spline
|
|
Toshihiro Shimizu |
890ddd |
m_motionPathPosField->setVisible(on);
|
|
Toshihiro Shimizu |
890ddd |
//DEactivate on selecting spline
|
|
Toshihiro Shimizu |
890ddd |
m_ewPosField->setVisible(!on);
|
|
Toshihiro Shimizu |
890ddd |
m_nsPosField->setVisible(!on);
|
|
Toshihiro Shimizu |
890ddd |
m_ewPosLabel->setVisible(!on);
|
|
Toshihiro Shimizu |
890ddd |
m_nsPosLabel->setVisible(!on);
|
|
Toshihiro Shimizu |
890ddd |
m_lockEWPosCheckbox->setVisible(!on);
|
|
Toshihiro Shimizu |
890ddd |
m_lockNSPosCheckbox->setVisible(!on);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ArrowToolOptionsBox::isCurrentObjectSplined() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TStageObjectId objId = m_objHandle->getObjectId();
|
|
Toshihiro Shimizu |
890ddd |
return m_xshHandle->getXsheet()->getStageObject(objId)->getSpline() != 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//General
|
|
Toshihiro Shimizu |
890ddd |
m_chooseActiveAxisCombo->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_pickCombo->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Position
|
|
Toshihiro Shimizu |
890ddd |
m_motionPathPosField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_ewPosField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_nsPosField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_zField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_noScaleZField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_soField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Rotation
|
|
Toshihiro Shimizu |
890ddd |
m_rotationField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Scale
|
|
Toshihiro Shimizu |
890ddd |
m_globalScaleField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_scaleHField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_scaleVField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_maintainCombo->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Shear
|
|
Toshihiro Shimizu |
890ddd |
m_shearHField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_shearVField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Center Position
|
|
Toshihiro Shimizu |
890ddd |
m_ewCenterField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_nsCenterField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool splined = isCurrentObjectSplined();
|
|
Toshihiro Shimizu |
890ddd |
if (splined != m_splined)
|
|
Toshihiro Shimizu |
890ddd |
setSplined(splined);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::onStageObjectChange()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! update the object list in combobox
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::updateStageObjectComboItems()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//clear items
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObjectCombo->clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXsheet *xsh = m_xshHandle->getXsheet();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TStageObjectId id;
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < xsh->getStageObjectTree()->getStageObjectCount(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
id = xsh->getStageObjectTree()->getStageObject(i)->getId();
|
|
Toshihiro Shimizu |
890ddd |
if (id.isColumn()) {
|
|
Toshihiro Shimizu |
890ddd |
int columnIndex = id.getIndex();
|
|
Toshihiro Shimizu |
890ddd |
if (xsh->isColumnEmpty(columnIndex))
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TStageObject *pegbar = xsh->getStageObject(id);
|
|
Toshihiro Shimizu |
890ddd |
QString itemName = QString::fromStdString(pegbar->getName());
|
|
Toshihiro Shimizu |
890ddd |
// store the item with ObjectId data
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObjectCombo->addItem(itemName, (int)id.getCode());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//synchronize
|
|
Toshihiro Shimizu |
890ddd |
syncCurrentStageObjectComboItem();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! syncronize the current item in the combobox to the selected stage object
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::syncCurrentStageObjectComboItem()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TStageObjectId curObjId = m_objHandle->getObjectId();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int index = m_currentStageObjectCombo->findData((int)curObjId.getCode());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// if the item is found
|
|
Toshihiro Shimizu |
890ddd |
if (index >= 0)
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObjectCombo->setCurrentIndex(index);
|
|
Toshihiro Shimizu |
890ddd |
// if not found, add a new item. (This may happens when selecting the empty column.)
|
|
Toshihiro Shimizu |
890ddd |
else {
|
|
Toshihiro Shimizu |
890ddd |
TStageObject *pegbar = m_xshHandle
|
|
Toshihiro Shimizu |
890ddd |
->getXsheet()
|
|
Toshihiro Shimizu |
890ddd |
->getStageObject(curObjId);
|
|
Toshihiro Shimizu |
890ddd |
QString itemName = QString::fromStdString(pegbar->getName());
|
|
Toshihiro Shimizu |
890ddd |
// store the item with ObjectId data
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObjectCombo->addItem(itemName, (int)curObjId.getCode());
|
|
Toshihiro Shimizu |
890ddd |
// move the current index to it
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObjectCombo->setCurrentIndex(m_currentStageObjectCombo->findText(itemName));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*!change the current stage object when user changes it via combobox by hand
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void ArrowToolOptionsBox::onCurrentStageObjectComboActivated(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int code = m_currentStageObjectCombo->itemData(index).toInt();
|
|
Toshihiro Shimizu |
890ddd |
TStageObjectId id;
|
|
Toshihiro Shimizu |
890ddd |
id.setCode(code);
|
|
Toshihiro Shimizu |
890ddd |
if (id == TStageObjectId::NoneId) {
|
|
Toshihiro Shimizu |
890ddd |
std::cout << "Warning: ArrowToolOptionsBox::onCurrentStageObjectComboActivated \nNo stage object linked to the selected item found in the scene." << std::endl;
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
// switch the current object
|
|
Toshihiro Shimizu |
890ddd |
m_objHandle->setObjectId(id);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SelectionToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SelectionToolOptionsBox::SelectionToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_tool(tool), m_isVectorSelction(false), m_setSaveboxCheckbox(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
RasterSelectionTool *rasterSelectionTool = dynamic_cast<rasterselectiontool *="">(tool);</rasterselectiontool>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SelectionTool *selectionTool = dynamic_cast<selectiontool *="">(tool);</selectiontool>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Scale
|
|
Toshihiro Shimizu |
890ddd |
static QPixmap editScale(":Resources/scalepeg.png");
|
|
Toshihiro Shimizu |
890ddd |
IconViewField *iconView = new IconViewField(this, editScale);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(iconView, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXLabel = addLabel(tr("H:"));
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXField = new SelectionScaleField(selectionTool, 0, "Scale X");
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_scaleXField);
|
|
Toshihiro Shimizu |
890ddd |
bool ret = connect(m_scaleXField, SIGNAL(valueChange()), SLOT(onScaleXValueChanged()));
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYLabel = addLabel(tr("V:"));
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYField = new SelectionScaleField(selectionTool, 1, "Scale Y");
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_scaleYField);
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_scaleYField, SIGNAL(valueChange()), SLOT(onScaleYValueChanged()));
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addSpacing(4);
|
|
Toshihiro Shimizu |
890ddd |
m_scaleLink = new CheckBox(tr("Link"), this);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_scaleLink);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Rotation
|
|
Toshihiro Shimizu |
890ddd |
static QPixmap editRotation(":Resources/rotation.png");
|
|
Toshihiro Shimizu |
890ddd |
IconViewField *rotIconView = new IconViewField(this, editRotation);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(rotIconView, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_rotationField = new SelectionRotationField(selectionTool, tr("Rotation"));
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_rotationField);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Move
|
|
Toshihiro Shimizu |
890ddd |
static QPixmap editPosition(":Resources/position.png");
|
|
Toshihiro Shimizu |
890ddd |
IconViewField *moveIconView = new IconViewField(this, editPosition);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(moveIconView, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_moveXLabel = addLabel(tr("E/W:"));
|
|
Toshihiro Shimizu |
890ddd |
m_moveXLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_moveXField = new SelectionMoveField(selectionTool, 0, "Move X");
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_moveXField);
|
|
Toshihiro Shimizu |
890ddd |
m_moveYLabel = addLabel(tr("N/S:"));
|
|
Toshihiro Shimizu |
890ddd |
m_moveYLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_moveYField = new SelectionMoveField(selectionTool, 1, "Move Y");
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_moveYField);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (rasterSelectionTool) {
|
|
Toshihiro Shimizu |
890ddd |
TBoolProperty *modifySetSaveboxProp = rasterSelectionTool->getModifySaveboxProperty();
|
|
Toshihiro Shimizu |
890ddd |
if (modifySetSaveboxProp) {
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
m_setSaveboxCheckbox = new ToolOptionCheckbox(rasterSelectionTool, modifySetSaveboxProp);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_setSaveboxCheckbox, SIGNAL(toggled(bool)), SLOT(onSetSaveboxCheckboxChanged(bool)));
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_setSaveboxCheckbox);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
VectorSelectionTool *vectorSelectionTool = dynamic_cast<vectorselectiontool *="">(tool);</vectorselectiontool>
|
|
Toshihiro Shimizu |
890ddd |
if (vectorSelectionTool) {
|
|
Toshihiro Shimizu |
890ddd |
m_isVectorSelction = true;
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//change Thick
|
|
Toshihiro Shimizu |
890ddd |
static QPixmap thickness(":Resources/thickness.png");
|
|
Toshihiro Shimizu |
890ddd |
IconViewField *thicknessIconView = new IconViewField(this, thickness);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(thicknessIconView);
|
|
Toshihiro Shimizu |
890ddd |
m_thickChangeField = new ThickChangeField(selectionTool, tr("Thickness"));
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_thickChangeField);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Outline options
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
builder.setEnumWidgetType(ToolOptionControlBuilder::POPUPBUTTON);
|
|
Toshihiro Shimizu |
890ddd |
builder.setSingleValueWidgetType(ToolOptionControlBuilder::FIELD);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(1))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(1)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_capStyle =
|
|
Toshihiro Shimizu |
890ddd |
dynamic_cast<tooloptionpopupbutton *="">(m_controls.value("Cap"));</tooloptionpopupbutton>
|
|
Toshihiro Shimizu |
890ddd |
m_joinStyle =
|
|
Toshihiro Shimizu |
890ddd |
dynamic_cast<tooloptionpopupbutton *="">(m_controls.value("Join"));</tooloptionpopupbutton>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_miterField = dynamic_cast<tooloptionintslider *="">(m_controls.value("Miter:"));</tooloptionintslider>
|
|
Toshihiro Shimizu |
890ddd |
m_miterField->setEnabled(m_joinStyle->currentIndex() == TStroke::OutlineOptions::MITER_JOIN);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
onPropertyChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SelectionToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_setSaveboxCheckbox) {
|
|
Toshihiro Shimizu |
890ddd |
bool disable = m_setSaveboxCheckbox->checkState() == Qt::Checked;
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < hLayout()->count(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
QWidget *w = hLayout()->itemAt(i)->widget();
|
|
Toshihiro Shimizu |
890ddd |
if (w && w != m_setSaveboxCheckbox)
|
|
Toshihiro Shimizu |
890ddd |
w->setEnabled(!disable);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (disable)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXLabel->setEnabled(m_scaleXField->isEnabled());
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYLabel->setEnabled(m_scaleXField->isEnabled());
|
|
Toshihiro Shimizu |
890ddd |
m_rotationField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_moveXField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_moveXLabel->setEnabled(m_moveXField->isEnabled());
|
|
Toshihiro Shimizu |
890ddd |
m_moveYField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
m_moveYLabel->setEnabled(m_moveYField->isEnabled());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_isVectorSelction) {
|
|
Toshihiro Shimizu |
890ddd |
m_thickChangeField->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
onPropertyChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SelectionToolOptionsBox::onScaleXValueChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_scaleLink->isChecked() || m_scaleXField->getValue() == m_scaleYField->getValue())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYField->setValue(m_scaleXField->getValue());
|
|
Toshihiro Shimizu |
890ddd |
m_scaleYField->applyChange();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SelectionToolOptionsBox::onScaleYValueChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_scaleLink->isChecked() || m_scaleXField->getValue() == m_scaleYField->getValue())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXField->setValue(m_scaleYField->getValue());
|
|
Toshihiro Shimizu |
890ddd |
m_scaleXField->applyChange();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SelectionToolOptionsBox::onSetSaveboxCheckboxChanged(bool)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SelectionToolOptionsBox::onPropertyChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Check the selection's outline styles group.
|
|
Toshihiro Shimizu |
890ddd |
VectorSelectionTool *tool = (VectorSelectionTool *)m_tool;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int capStyle, joinStyle;
|
|
Toshihiro Shimizu |
890ddd |
tool->selectionOutlineStyle(capStyle, joinStyle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Show a void icon when no homogeneous style is found
|
|
Toshihiro Shimizu |
890ddd |
if (capStyle < 0)
|
|
Toshihiro Shimizu |
890ddd |
m_capStyle->setIcon(QPixmap());
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
//m_capStyle->setIcon(m_capStyle->currentItem()->icon());
|
|
Toshihiro Shimizu |
890ddd |
m_capStyle->setCurrentIndex(capStyle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (joinStyle < 0)
|
|
Toshihiro Shimizu |
890ddd |
m_joinStyle->setIcon(QPixmap());
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
m_joinStyle->setCurrentIndex(joinStyle);
|
|
Toshihiro Shimizu |
890ddd |
//m_joinStyle->setIcon(m_joinStyle->currentItem()->icon());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Enable the miter field only in case the join is of type miter
|
|
Toshihiro Shimizu |
890ddd |
m_miterField->setEnabled(joinStyle == TStroke::OutlineOptions::MITER_JOIN);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// GeometricToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
GeometricToolOptionsBox::GeometricToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_targetType(tool->getTargetType()), m_poligonSideLabel(0), m_hardnessLabel(0), m_hardnessField(0), m_poligonSideField(0), m_shapeField(0), m_pencilMode(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
setFixedHeight(26);
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
builder.setEnumWidgetType(ToolOptionControlBuilder::POPUPBUTTON);
|
|
Toshihiro Shimizu |
890ddd |
builder.setSingleValueWidgetType(ToolOptionControlBuilder::FIELD);
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(1))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(1)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField = dynamic_cast<tooloptionslider *="">(m_controls.value("Hardness:"));</tooloptionslider>
|
|
Toshihiro Shimizu |
890ddd |
if (m_hardnessField)
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel = m_labels.value(m_hardnessField->propertyName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_shapeField = dynamic_cast<tooloptioncombo *="">(m_controls.value("Shape:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_poligonSideField = dynamic_cast<tooloptionintslider *="">(m_controls.value("Polygon Sides:"));</tooloptionintslider>
|
|
Toshihiro Shimizu |
890ddd |
if (m_poligonSideField)
|
|
Toshihiro Shimizu |
890ddd |
m_poligonSideLabel = m_labels.value(m_poligonSideField->propertyName());
|
|
Toshihiro Shimizu |
890ddd |
m_pencilMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Pencil Mode"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_shapeField->currentText().toStdWString() != L"Polygon") {
|
|
Toshihiro Shimizu |
890ddd |
m_poligonSideLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_poligonSideField->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
bool ret = connect(m_shapeField, SIGNAL(currentIndexChanged(int)), this, SLOT(onShapeValueChanged()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_pencilMode) {
|
|
Toshihiro Shimizu |
890ddd |
if (m_pencilMode->isChecked()) {
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_pencilMode, SIGNAL(toggled(bool)), this, SLOT(onPencilModeToggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionPopupButton *m_joinStyle =
|
|
Toshihiro Shimizu |
890ddd |
dynamic_cast<tooloptionpopupbutton *="">(m_controls.value("Join"));</tooloptionpopupbutton>
|
|
Toshihiro Shimizu |
890ddd |
m_miterField = dynamic_cast<tooloptionintslider *="">(m_controls.value("Miter:"));</tooloptionintslider>
|
|
Toshihiro Shimizu |
890ddd |
m_miterField->setEnabled(m_joinStyle->currentIndex() == TStroke::OutlineOptions::MITER_JOIN);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(m_joinStyle && m_miterField);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_joinStyle, SIGNAL(activated(int)), this, SLOT(onJoinStyleChanged(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void GeometricToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void GeometricToolOptionsBox::onShapeValueChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool enabled = m_shapeField->currentText() == QString("Polygon");
|
|
Toshihiro Shimizu |
890ddd |
m_poligonSideLabel->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
m_poligonSideField->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void GeometricToolOptionsBox::onPencilModeToggled(bool value)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void GeometricToolOptionsBox::onJoinStyleChanged(int joinStyle)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_miterField->setEnabled(joinStyle == TStroke::OutlineOptions::MITER_JOIN);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// TypeToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TypeToolOptionsBox::TypeToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_tool(tool)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addStretch(0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ret = true;
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionCombo *fontField = dynamic_cast<tooloptioncombo *="">(m_controls.value("Font:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
ret &&connect(fontField, SIGNAL(currentIndexChanged(int)), this, SLOT(onFieldChanged()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionCombo *styleField = dynamic_cast<tooloptioncombo *="">(m_controls.value("Style:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
ret &&connect(styleField, SIGNAL(currentIndexChanged(int)), this, SLOT(onFieldChanged()));
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionCombo *sizeField = dynamic_cast<tooloptioncombo *="">(m_controls.value("Size:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
ret &&connect(sizeField, SIGNAL(currentIndexChanged(int)), this, SLOT(onFieldChanged()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionCheckbox *orientationField = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Vertical Orientation"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(orientationField, SIGNAL(stateChanged(int)), this, SLOT(onFieldChanged()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TypeToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TypeToolOptionsBox::onFieldChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(m_tool);
|
|
Toshihiro Shimizu |
890ddd |
m_tool->getViewer()->setFocus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// PaintbrushToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PaintbrushToolOptionsBox::PaintbrushToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_colorMode = dynamic_cast<tooloptioncombo *="">(m_controls.value("Mode:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_selectiveMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Selective"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_colorMode->currentText().toStdWString() == L"Lines")
|
|
Toshihiro Shimizu |
890ddd |
m_selectiveMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ret = connect(m_colorMode, SIGNAL(currentIndexChanged(int)), this, SLOT(onColorModeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaintbrushToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaintbrushToolOptionsBox::onColorModeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool enabled = m_colorMode->currentText() != QString("Lines");
|
|
Toshihiro Shimizu |
890ddd |
m_selectiveMode->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// FillToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FillToolOptionsBox::FillToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_targetType(tool->getTargetType()), m_fillDepthLabel(0), m_fillDepthField(0), m_segmentMode(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addStretch(0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_toolType = dynamic_cast<tooloptioncombo *="">(m_controls.value("Type:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_colorMode = dynamic_cast<tooloptioncombo *="">(m_controls.value("Mode:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_selectiveMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Selective"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_fillDepthField = dynamic_cast<tooloptionpairslider *="">(m_controls.value("Fill Depth"));</tooloptionpairslider>
|
|
Toshihiro Shimizu |
890ddd |
if (m_fillDepthField)
|
|
Toshihiro Shimizu |
890ddd |
m_fillDepthLabel = m_labels.value(m_fillDepthField->propertyName());
|
|
Toshihiro Shimizu |
890ddd |
m_segmentMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Segment"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_onionMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Onion Skin"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Frame Range"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ret = connect(m_colorMode, SIGNAL(currentIndexChanged(int)), this, SLOT(onColorModeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_toolType, SIGNAL(currentIndexChanged(int)), this, SLOT(onToolTypeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_onionMode, SIGNAL(toggled(bool)), this, SLOT(onOnionModeToggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_multiFrameMode, SIGNAL(toggled(bool)), this, SLOT(onMultiFrameModeToggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
if (m_colorMode->currentText().toStdWString() == L"Lines") {
|
|
Toshihiro Shimizu |
890ddd |
m_selectiveMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
if (m_fillDepthLabel && m_fillDepthField) {
|
|
Toshihiro Shimizu |
890ddd |
m_fillDepthLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_fillDepthField->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (m_toolType->currentText() == QString("Normal") ||
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode->isChecked())
|
|
Toshihiro Shimizu |
890ddd |
m_onionMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (m_toolType->currentText().toStdWString() != L"Normal") {
|
|
Toshihiro Shimizu |
890ddd |
if (m_segmentMode)
|
|
Toshihiro Shimizu |
890ddd |
m_segmentMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
if (m_colorMode->currentText() == QString("Lines") ||
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode->isChecked())
|
|
Toshihiro Shimizu |
890ddd |
m_onionMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (m_onionMode->isChecked())
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void FillToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void FillToolOptionsBox::onColorModeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool enabled = m_colorMode->currentText() != QString("Lines");
|
|
Toshihiro Shimizu |
890ddd |
m_selectiveMode->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
if (m_fillDepthLabel && m_fillDepthField) {
|
|
Toshihiro Shimizu |
890ddd |
m_fillDepthLabel->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
m_fillDepthField->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (m_segmentMode) {
|
|
Toshihiro Shimizu |
890ddd |
enabled = m_colorMode->currentText() != QString("Areas");
|
|
Toshihiro Shimizu |
890ddd |
m_segmentMode->setEnabled(enabled ? m_toolType->currentText() == QString("Normal") : false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
enabled = m_colorMode->currentText() != QString("Lines") &&
|
|
Toshihiro Shimizu |
890ddd |
!m_multiFrameMode->isChecked();
|
|
Toshihiro Shimizu |
890ddd |
m_onionMode->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void FillToolOptionsBox::onToolTypeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool enabled = m_toolType->currentText() == QString("Normal");
|
|
Toshihiro Shimizu |
890ddd |
if (m_segmentMode)
|
|
Toshihiro Shimizu |
890ddd |
m_segmentMode->setEnabled(enabled ? m_colorMode->currentText() != QString("Areas") : false);
|
|
Toshihiro Shimizu |
890ddd |
enabled = enabled ||
|
|
Toshihiro Shimizu |
890ddd |
(m_colorMode->currentText() != QString("Lines") &&
|
|
Toshihiro Shimizu |
890ddd |
!m_multiFrameMode->isChecked());
|
|
Toshihiro Shimizu |
890ddd |
m_onionMode->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void FillToolOptionsBox::onOnionModeToggled(bool value)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void FillToolOptionsBox::onMultiFrameModeToggled(bool value)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_onionMode->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// BrushToolOptionsBox classes
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class BrushToolOptionsBox::PresetNamePopup : public DVGui::Dialog
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
DVGui::LineEdit *m_nameFld;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
PresetNamePopup()
|
|
Toshihiro Shimizu |
890ddd |
: Dialog(0, true)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setWindowTitle(tr("Preset Name"));
|
|
Toshihiro Shimizu |
890ddd |
m_nameFld = new LineEdit();
|
|
Toshihiro Shimizu |
890ddd |
addWidget(m_nameFld);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPushButton *okBtn = new QPushButton(tr("OK"), this);
|
|
Toshihiro Shimizu |
890ddd |
okBtn->setDefault(true);
|
|
Toshihiro Shimizu |
890ddd |
QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
|
|
Toshihiro Shimizu |
890ddd |
connect(okBtn, SIGNAL(clicked()), this, SLOT(accept()));
|
|
Toshihiro Shimizu |
890ddd |
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addButtonBarWidget(okBtn, cancelBtn);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString getName() { return m_nameFld->text(); }
|
|
Toshihiro Shimizu |
890ddd |
void removeName() { m_nameFld->setText(QString("")); }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// BrushToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
BrushToolOptionsBox::BrushToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_tool(tool), m_presetNamePopup(0), m_pencilMode(0), m_hardnessLabel(0), m_joinStyleCombo(0), m_miterField(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField = dynamic_cast<tooloptionslider *="">(m_controls.value("Hardness:"));</tooloptionslider>
|
|
Toshihiro Shimizu |
890ddd |
if (m_hardnessField)
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel = m_labels.value(m_hardnessField->propertyName());
|
|
Toshihiro Shimizu |
890ddd |
m_pencilMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Pencil"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_presetCombo = dynamic_cast<tooloptioncombo *="">(m_controls.value("Preset:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Preset +/- buttons
|
|
Toshihiro Shimizu |
890ddd |
m_addPresetButton = new QPushButton(QString("+"));
|
|
Toshihiro Shimizu |
890ddd |
m_removePresetButton = new QPushButton(QString("-"));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_addPresetButton->setFixedSize(QSize(20, 20));
|
|
Toshihiro Shimizu |
890ddd |
m_removePresetButton->setFixedSize(QSize(20, 20));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_addPresetButton);
|
|
Toshihiro Shimizu |
890ddd |
hLayout()->addWidget(m_removePresetButton);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_addPresetButton, SIGNAL(clicked()), this, SLOT(onAddPreset()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_removePresetButton, SIGNAL(clicked()), this, SLOT(onRemovePreset()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (tool->getTargetType() & TTool::ToonzImage) {
|
|
Toshihiro Shimizu |
890ddd |
assert(m_pencilMode);
|
|
Toshihiro Shimizu |
890ddd |
bool ret = connect(m_pencilMode, SIGNAL(toggled(bool)), this, SLOT(onPencilModeToggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_pencilMode->isChecked()) {
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else if (tool->getTargetType() & TTool::Vectors) {
|
|
Toshihiro Shimizu |
890ddd |
//Further vector options
|
|
Toshihiro Shimizu |
890ddd |
builder.setEnumWidgetType(ToolOptionControlBuilder::POPUPBUTTON);
|
|
Toshihiro Shimizu |
890ddd |
builder.setSingleValueWidgetType(ToolOptionControlBuilder::FIELD);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(1))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(1)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_joinStyleCombo = dynamic_cast<tooloptionpopupbutton *="">(m_controls.value("Join"));</tooloptionpopupbutton>
|
|
Toshihiro Shimizu |
890ddd |
m_miterField = dynamic_cast<tooloptionintslider *="">(m_controls.value("Miter:"));</tooloptionintslider>
|
|
Toshihiro Shimizu |
890ddd |
m_miterField->setEnabled(m_joinStyleCombo->currentIndex() == TStroke::OutlineOptions::MITER_JOIN);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void BrushToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_miterField)
|
|
Toshihiro Shimizu |
890ddd |
m_miterField->setEnabled(m_joinStyleCombo->currentIndex() == TStroke::OutlineOptions::MITER_JOIN);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void BrushToolOptionsBox::onPencilModeToggled(bool value)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void BrushToolOptionsBox::onAddPreset()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Initialize preset name popup
|
|
Toshihiro Shimizu |
890ddd |
if (!m_presetNamePopup)
|
|
Toshihiro Shimizu |
890ddd |
m_presetNamePopup = new PresetNamePopup;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!m_presetNamePopup->getName().isEmpty())
|
|
Toshihiro Shimizu |
890ddd |
m_presetNamePopup->removeName();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Retrieve the preset name
|
|
Toshihiro Shimizu |
890ddd |
bool ret = m_presetNamePopup->exec();
|
|
Toshihiro Shimizu |
890ddd |
if (!ret)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString name(m_presetNamePopup->getName());
|
|
Toshihiro Shimizu |
890ddd |
m_presetNamePopup->removeName();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
switch (m_tool->getTargetType() & TTool::CommonImages) {
|
|
Toshihiro Shimizu |
890ddd |
case TTool::VectorImage:
|
|
Toshihiro Shimizu |
890ddd |
case TTool::ToonzImage: {
|
|
Toshihiro Shimizu |
890ddd |
static_cast<brushtool *="">(m_tool)->addPreset(name);</brushtool>
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
case TTool::RasterImage: {
|
|
Toshihiro Shimizu |
890ddd |
static_cast<fullcolorbrushtool *="">(m_tool)->addPreset(name);</fullcolorbrushtool>
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_presetCombo->loadEntries();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void BrushToolOptionsBox::onRemovePreset()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
switch (m_tool->getTargetType() & TTool::CommonImages) {
|
|
Toshihiro Shimizu |
890ddd |
case TTool::VectorImage:
|
|
Toshihiro Shimizu |
890ddd |
case TTool::ToonzImage: {
|
|
Toshihiro Shimizu |
890ddd |
static_cast<brushtool *="">(m_tool)->removePreset();</brushtool>
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
case TTool::RasterImage: {
|
|
Toshihiro Shimizu |
890ddd |
static_cast<fullcolorbrushtool *="">(m_tool)->removePreset();</fullcolorbrushtool>
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_presetCombo->loadEntries();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// EraserToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
EraserToolOptionsBox::EraserToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_pencilMode(0), m_colorMode(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_toolType = dynamic_cast<tooloptioncombo *="">(m_controls.value("Type:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField = dynamic_cast<tooloptionslider *="">(m_controls.value("Hardness:"));</tooloptionslider>
|
|
Toshihiro Shimizu |
890ddd |
if (m_hardnessField)
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel = m_labels.value(m_hardnessField->propertyName());
|
|
Toshihiro Shimizu |
890ddd |
m_colorMode = dynamic_cast<tooloptioncombo *="">(m_controls.value("Mode:"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_invertMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Invert"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Frame Range"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_pencilMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Pencil Mode"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ret = true;
|
|
Toshihiro Shimizu |
890ddd |
if (m_pencilMode) {
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_pencilMode, SIGNAL(toggled(bool)), this, SLOT(onPencilModeToggled(bool)));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_colorMode, SIGNAL(currentIndexChanged(int)), this, SLOT(onColorModeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_toolType, SIGNAL(currentIndexChanged(int)), this, SLOT(onToolTypeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_pencilMode && m_pencilMode->isChecked()) {
|
|
Toshihiro Shimizu |
890ddd |
assert(m_hardnessField && m_hardnessLabel);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_toolType && m_toolType->currentText() == QString("Normal")) {
|
|
Toshihiro Shimizu |
890ddd |
m_invertMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_colorMode && m_colorMode->currentText() == QString("Areas")) {
|
|
Toshihiro Shimizu |
890ddd |
assert(m_hardnessField && m_hardnessLabel && m_pencilMode);
|
|
Toshihiro Shimizu |
890ddd |
m_pencilMode->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void EraserToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void EraserToolOptionsBox::onPencilModeToggled(bool value)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_hardnessField && m_hardnessLabel) {
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(!value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void EraserToolOptionsBox::onToolTypeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool value = m_toolType && m_toolType->currentText() != QString("Normal");
|
|
Toshihiro Shimizu |
890ddd |
m_invertMode->setEnabled(value);
|
|
Toshihiro Shimizu |
890ddd |
m_multiFrameMode->setEnabled(value);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void EraserToolOptionsBox::onColorModeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool enabled = m_colorMode->currentText() != QString("Areas");
|
|
Toshihiro Shimizu |
890ddd |
if (m_pencilMode && m_hardnessField && m_hardnessLabel) {
|
|
Toshihiro Shimizu |
890ddd |
m_pencilMode->setEnabled(enabled);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessField->setEnabled(enabled ? !m_pencilMode->isChecked() : false);
|
|
Toshihiro Shimizu |
890ddd |
m_hardnessLabel->setEnabled(enabled ? !m_pencilMode->isChecked() : false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// RulerToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
class ToolOptionsBarSeparator : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionsBarSeparator(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QWidget(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setFixedSize(2, 26);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QPainter p(this);
|
|
Toshihiro Shimizu |
890ddd |
p.setPen(QColor(64, 64, 64));
|
|
Toshihiro Shimizu |
890ddd |
p.drawLine(0, 0, 0, 25);
|
|
Toshihiro Shimizu |
890ddd |
p.setPen(Qt::white);
|
|
Toshihiro Shimizu |
890ddd |
p.drawLine(1, 0, 1, 25);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
RulerToolOptionsBox::RulerToolOptionsBox(QWidget *parent,
|
|
Toshihiro Shimizu |
890ddd |
TTool *tool)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_tool(tool)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
setFixedHeight(26);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_Xfld = new MeasuredValueField(this);
|
|
Toshihiro Shimizu |
890ddd |
m_Yfld = new MeasuredValueField(this);
|
|
Toshihiro Shimizu |
890ddd |
m_Wfld = new MeasuredValueField(this);
|
|
Toshihiro Shimizu |
890ddd |
m_Hfld = new MeasuredValueField(this);
|
|
Toshihiro Shimizu |
890ddd |
m_Afld = new MeasuredValueField(this);
|
|
Toshihiro Shimizu |
890ddd |
m_Lfld = new MeasuredValueField(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_XpixelFld = new QLabel(this);
|
|
Toshihiro Shimizu |
890ddd |
m_YpixelFld = new QLabel(this);
|
|
Toshihiro Shimizu |
890ddd |
m_WpixelFld = new QLabel(this);
|
|
Toshihiro Shimizu |
890ddd |
m_HpixelFld = new QLabel(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_Afld->setMeasure("angle");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_Xfld->setObjectName("RulerToolOptionValues");
|
|
Toshihiro Shimizu |
890ddd |
m_Yfld->setObjectName("RulerToolOptionValues");
|
|
Toshihiro Shimizu |
890ddd |
m_Wfld->setObjectName("RulerToolOptionValues");
|
|
Toshihiro Shimizu |
890ddd |
m_Hfld->setObjectName("RulerToolOptionValues");
|
|
Toshihiro Shimizu |
890ddd |
m_Afld->setObjectName("RulerToolOptionValues");
|
|
Toshihiro Shimizu |
890ddd |
m_Lfld->setObjectName("RulerToolOptionValues");
|
|
Toshihiro Shimizu |
890ddd |
setStyleSheet("#RulerToolOptionValues {border:0px; background: rgb(196,196,196);}");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_Xfld->setMaximumWidth(70);
|
|
Toshihiro Shimizu |
890ddd |
m_Yfld->setMaximumWidth(70);
|
|
Toshihiro Shimizu |
890ddd |
m_Wfld->setMaximumWidth(70);
|
|
Toshihiro Shimizu |
890ddd |
m_Hfld->setMaximumWidth(70);
|
|
Toshihiro Shimizu |
890ddd |
m_Afld->setMaximumWidth(70);
|
|
Toshihiro Shimizu |
890ddd |
m_Lfld->setMaximumWidth(70);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_Xfld->setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
m_Yfld->setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
m_Wfld->setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
m_Hfld->setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
m_Afld->setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
m_Lfld->setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// layout
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *lay = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
lay->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
lay->setSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new QLabel("X:", this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_Xfld, 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_XpixelFld, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new QLabel("Y:", this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_Yfld, 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_YpixelFld, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new ToolOptionsBarSeparator(this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new QLabel("W:", this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_Wfld, 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_WpixelFld, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new QLabel("H:", this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_Hfld, 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_HpixelFld, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new ToolOptionsBarSeparator(this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new QLabel("A:", this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_Afld, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addSpacing(3);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(new QLabel("L:", this), 0);
|
|
Toshihiro Shimizu |
890ddd |
lay->addWidget(m_Lfld, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addLayout(lay, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RulerToolOptionsBox::updateValues(bool isRasterLevelEditing,
|
|
Toshihiro Shimizu |
890ddd |
double X,
|
|
Toshihiro Shimizu |
890ddd |
double Y,
|
|
Toshihiro Shimizu |
890ddd |
double W,
|
|
Toshihiro Shimizu |
890ddd |
double H,
|
|
Toshihiro Shimizu |
890ddd |
double A,
|
|
Toshihiro Shimizu |
890ddd |
double L,
|
|
Toshihiro Shimizu |
890ddd |
int Xpix,
|
|
Toshihiro Shimizu |
890ddd |
int Ypix,
|
|
Toshihiro Shimizu |
890ddd |
int Wpix,
|
|
Toshihiro Shimizu |
890ddd |
int Hpix)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_Xfld->setValue(X);
|
|
Toshihiro Shimizu |
890ddd |
m_Yfld->setValue(Y);
|
|
Toshihiro Shimizu |
890ddd |
m_Wfld->setValue(W);
|
|
Toshihiro Shimizu |
890ddd |
m_Hfld->setValue(H);
|
|
Toshihiro Shimizu |
890ddd |
m_Afld->setValue(A);
|
|
Toshihiro Shimizu |
890ddd |
m_Lfld->setValue(L);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_XpixelFld->setVisible(isRasterLevelEditing);
|
|
Toshihiro Shimizu |
890ddd |
m_YpixelFld->setVisible(isRasterLevelEditing);
|
|
Toshihiro Shimizu |
890ddd |
m_WpixelFld->setVisible(isRasterLevelEditing);
|
|
Toshihiro Shimizu |
890ddd |
m_HpixelFld->setVisible(isRasterLevelEditing);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (isRasterLevelEditing) {
|
|
Toshihiro Shimizu |
890ddd |
m_XpixelFld->setText(QString("(%1)").arg(Xpix));
|
|
Toshihiro Shimizu |
890ddd |
m_YpixelFld->setText(QString("(%1)").arg(Ypix));
|
|
Toshihiro Shimizu |
890ddd |
m_WpixelFld->setText(QString("(%1)").arg(Wpix));
|
|
Toshihiro Shimizu |
890ddd |
m_HpixelFld->setText(QString("(%1)").arg(Hpix));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
repaint();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RulerToolOptionsBox::resetValues()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_Xfld->setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
m_Yfld->setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
m_Wfld->setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
m_Hfld->setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
m_Afld->setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
m_Lfld->setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_XpixelFld->setVisible(false);
|
|
Toshihiro Shimizu |
890ddd |
m_YpixelFld->setVisible(false);
|
|
Toshihiro Shimizu |
890ddd |
m_WpixelFld->setVisible(false);
|
|
Toshihiro Shimizu |
890ddd |
m_HpixelFld->setVisible(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// TapeToolOptionsBox
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TapeToolOptionsBox::TapeToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent), m_smoothMode(0), m_joinStrokesMode(0), m_toolMode(0), m_autocloseLabel(0), m_autocloseField(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!(tool->getTargetType() & TTool::Vectors))
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_smoothMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Smooth"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_joinStrokesMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("JoinStrokes"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
m_toolMode = dynamic_cast<tooloptioncombo *="">(m_controls.value("Mode"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_typeMode = dynamic_cast<tooloptioncombo *="">(m_controls.value("Type"));</tooloptioncombo>
|
|
Toshihiro Shimizu |
890ddd |
m_autocloseField = dynamic_cast<tooloptionslider *="">(m_controls.value("Distance"));</tooloptionslider>
|
|
Toshihiro Shimizu |
890ddd |
if (m_autocloseField)
|
|
Toshihiro Shimizu |
890ddd |
m_autocloseLabel = m_labels.value(m_autocloseField->propertyName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isNormalType = m_typeMode->currentText() == "Normal";
|
|
Toshihiro Shimizu |
890ddd |
m_toolMode->setEnabled(isNormalType);
|
|
Toshihiro Shimizu |
890ddd |
m_autocloseField->setEnabled(!isNormalType);
|
|
Toshihiro Shimizu |
890ddd |
m_autocloseLabel->setEnabled(!isNormalType);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isLineToLineMode = m_toolMode->currentText() == "Line to Line";
|
|
Toshihiro Shimizu |
890ddd |
m_joinStrokesMode->setEnabled(!isLineToLineMode);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isJoinStrokes = m_joinStrokesMode->isChecked();
|
|
Toshihiro Shimizu |
890ddd |
m_smoothMode->setEnabled(!isLineToLineMode && isJoinStrokes);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ret = connect(m_typeMode, SIGNAL(currentIndexChanged(int)), this, SLOT(onToolTypeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_toolMode, SIGNAL(currentIndexChanged(int)), this, SLOT(onToolModeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_joinStrokesMode, SIGNAL(toggled(bool)), this, SLOT(onJoinStrokesModeChanged()));
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TapeToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TapeToolOptionsBox::onToolTypeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool isNormalType = m_typeMode->currentText() == "Normal";
|
|
Toshihiro Shimizu |
890ddd |
m_toolMode->setEnabled(isNormalType);
|
|
Toshihiro Shimizu |
890ddd |
m_autocloseField->setEnabled(!isNormalType);
|
|
Toshihiro Shimizu |
890ddd |
m_autocloseLabel->setEnabled(!isNormalType);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TapeToolOptionsBox::onToolModeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool isLineToLineMode = m_toolMode->currentText() == "Line to Line";
|
|
Toshihiro Shimizu |
890ddd |
m_joinStrokesMode->setEnabled(!isLineToLineMode);
|
|
Toshihiro Shimizu |
890ddd |
bool isJoinStrokes = m_joinStrokesMode->isChecked();
|
|
Toshihiro Shimizu |
890ddd |
m_smoothMode->setEnabled(!isLineToLineMode && isJoinStrokes);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TapeToolOptionsBox::onJoinStrokesModeChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool isLineToLineMode = m_toolMode->currentText() == "Line to Line";
|
|
Toshihiro Shimizu |
890ddd |
bool isJoinStrokes = m_joinStrokesMode->isChecked();
|
|
Toshihiro Shimizu |
890ddd |
m_smoothMode->setEnabled(!isLineToLineMode && isJoinStrokes);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// RGBPickerToolOptions
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Label with background color
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class RGBLabel : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QColor m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
RGBLabel(QColor color, QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QWidget(parent), m_color(color)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setFixedSize(120, 20);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~RGBLabel() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setColorAndUpdate(QColor color)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_color == color)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_color = color;
|
|
Toshihiro Shimizu |
890ddd |
update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *pe)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QPainter p(this);
|
|
Toshihiro Shimizu |
890ddd |
p.setPen(Qt::NoPen);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// iwsw commented out temporarily
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QColor convertedColor(m_color);
|
|
Toshihiro Shimizu |
890ddd |
Ghibli3DLutConverter::instance()->convert(convertedColor);
|
|
Toshihiro Shimizu |
890ddd |
p.setBrush(convertedColor);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
p.setBrush(m_color);
|
|
Toshihiro Shimizu |
890ddd |
p.setBrush(m_color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
p.drawRect(rect());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// white text on dark color. black text on light color.
|
|
Toshihiro Shimizu |
890ddd |
int val = m_color.red() * 30 +
|
|
Toshihiro Shimizu |
890ddd |
m_color.green() * 59 +
|
|
Toshihiro Shimizu |
890ddd |
m_color.blue() * 11;
|
|
Toshihiro Shimizu |
890ddd |
if (val < 12800)
|
|
Toshihiro Shimizu |
890ddd |
p.setPen(Qt::white);
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
p.setPen(Qt::black);
|
|
Toshihiro Shimizu |
890ddd |
p.setBrush(Qt::NoBrush);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
p.drawText(rect(), Qt::AlignCenter,
|
|
Toshihiro Shimizu |
890ddd |
QString("R:%1 G:%2 B:%3").arg(m_color.red()).arg(m_color.green()).arg(m_color.blue()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
RGBPickerToolOptionsBox::RGBPickerToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle, PaletteController *paletteController)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
setFixedHeight(26);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_currentRGBLabel = new RGBLabel(QColor(128, 128, 128), this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QAction *pickScreenAction = CommandManager::instance()->getAction("A_ToolOption_PickScreen");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPushButton *button = new QPushButton(tr("Pick Screen"));
|
|
Toshihiro Shimizu |
890ddd |
button->setFixedHeight(20);
|
|
Toshihiro Shimizu |
890ddd |
button->addAction(pickScreenAction);
|
|
Toshihiro Shimizu |
890ddd |
connect(button, SIGNAL(clicked()), pickScreenAction, SLOT(trigger()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_realTimePickMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Passive Pick"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addWidget(m_currentRGBLabel, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addWidget(button, 0); // new in 6.4
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_realTimePickMode) {
|
|
Toshihiro Shimizu |
890ddd |
connect(m_realTimePickMode, SIGNAL(toggled(bool)), m_currentRGBLabel, SLOT(setVisible(bool)));
|
|
Toshihiro Shimizu |
890ddd |
m_currentRGBLabel->setVisible(m_realTimePickMode->isChecked());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//for passive pick
|
|
Toshihiro Shimizu |
890ddd |
connect(paletteController, SIGNAL(colorPassivePicked(const QColor &)), this, SLOT(updateRealTimePickLabel(const QColor &)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RGBPickerToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RGBPickerToolOptionsBox::updateRealTimePickLabel(const QColor &pix)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (isVisible())
|
|
Toshihiro Shimizu |
890ddd |
m_currentRGBLabel->setColorAndUpdate(pix);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// StylePickerToolOptions
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
StylePickerToolOptionsBox::StylePickerToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *toolHandle, PaletteController *paletteController)
|
|
Toshihiro Shimizu |
890ddd |
: ToolOptionsBox(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
setFixedHeight(26);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel = new QLabel(" - - - ", this);
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel->setObjectName("SytlePickerValue");
|
|
Toshihiro Shimizu |
890ddd |
setStyleSheet("#SytlePickerValue {color: black; border:0px; background: rgb(196,196,196);}");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel->setFixedSize(200, 20);
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel->setAlignment(Qt::AlignCenter);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
assert(props->getPropertyCount() > 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (tool && tool->getProperties(0))
|
|
Toshihiro Shimizu |
890ddd |
tool->getProperties(0)->accept(builder);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_realTimePickMode = dynamic_cast<tooloptioncheckbox *="">(m_controls.value("Passive Pick"));</tooloptioncheckbox>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addWidget(m_currentStyleLabel, 0);
|
|
Toshihiro Shimizu |
890ddd |
m_layout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_realTimePickMode) {
|
|
Toshihiro Shimizu |
890ddd |
connect(m_realTimePickMode, SIGNAL(toggled(bool)), m_currentStyleLabel, SLOT(setVisible(bool)));
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel->setVisible(m_realTimePickMode->isChecked());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//for passive pick
|
|
Toshihiro Shimizu |
890ddd |
connect(paletteController, SIGNAL(stylePassivePicked(const int, const int, const int)),
|
|
Toshihiro Shimizu |
890ddd |
this, SLOT(updateRealTimePickLabel(const int, const int, const int)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void StylePickerToolOptionsBox::updateStatus()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QMap<string, *="" tooloptioncontrol="">::iterator it;</string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_controls.begin(); it != m_controls.end(); it++)
|
|
Toshihiro Shimizu |
890ddd |
it.value()->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void StylePickerToolOptionsBox::updateRealTimePickLabel(const int ink, const int paint, const int tone)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (isVisible()) {
|
|
Toshihiro Shimizu |
890ddd |
if (ink < 0)
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel->setText(" - - - ");
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
m_currentStyleLabel->setText(QString("INK: #%1 PAINT: #%2 TONE: %3").arg(ink).arg(paint).arg(tone));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ToolOptions
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptions::ToolOptions()
|
|
Toshihiro Shimizu |
890ddd |
: m_panel(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *mainLayout = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
setLayout(mainLayout);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptions::~ToolOptions()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptions::showEvent(QShowEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TTool::Application *app = TTool::getApplication();
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *currTool = app->getCurrentTool();
|
|
Toshihiro Shimizu |
890ddd |
if (currTool) {
|
|
Toshihiro Shimizu |
890ddd |
onToolSwitched();
|
|
Toshihiro Shimizu |
890ddd |
connect(currTool, SIGNAL(toolSwitched()), SLOT(onToolSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
connect(currTool, SIGNAL(toolChanged()), SLOT(onToolChanged()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TObjectHandle *currObject = app->getCurrentObject();
|
|
Toshihiro Shimizu |
890ddd |
if (currObject) {
|
|
Toshihiro Shimizu |
890ddd |
onStageObjectChange();
|
|
Toshihiro Shimizu |
890ddd |
connect(currObject, SIGNAL(objectSwitched()), SLOT(onStageObjectChange()));
|
|
Toshihiro Shimizu |
890ddd |
connect(currObject, SIGNAL(objectChanged(bool)), SLOT(onStageObjectChange()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshLevelHandle *currLevel = app->getCurrentLevel();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (currLevel)
|
|
Toshihiro Shimizu |
890ddd |
connect(currLevel, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onStageObjectChange()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptions::hideEvent(QShowEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TTool::Application *app = TTool::getApplication();
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *currTool = app->getCurrentTool();
|
|
Toshihiro Shimizu |
890ddd |
if (currTool)
|
|
Toshihiro Shimizu |
890ddd |
currTool->disconnect(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TObjectHandle *currObject = app->getCurrentObject();
|
|
Toshihiro Shimizu |
890ddd |
if (currObject)
|
|
Toshihiro Shimizu |
890ddd |
currObject->disconnect(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshLevelHandle *currLevel = app->getCurrentLevel();
|
|
Toshihiro Shimizu |
890ddd |
if (currLevel)
|
|
Toshihiro Shimizu |
890ddd |
currLevel->disconnect(this);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptions::onToolSwitched()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_panel)
|
|
Toshihiro Shimizu |
890ddd |
m_panel->hide();
|
|
Toshihiro Shimizu |
890ddd |
m_panel = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TTool::Application *app = TTool::getApplication();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Quando i seguenti non serviranno piu', rimuovere gli header corrispondenti in cima, thx
|
|
Toshihiro Shimizu |
890ddd |
TFrameHandle *currFrame = app->getCurrentFrame();
|
|
Toshihiro Shimizu |
890ddd |
TObjectHandle *currObject = app->getCurrentObject();
|
|
Toshihiro Shimizu |
890ddd |
TXsheetHandle *currXsheet = app->getCurrentXsheet();
|
|
Toshihiro Shimizu |
890ddd |
TPaletteHandle *currPalette = app->getPaletteController()->getCurrentLevelPalette();
|
|
Toshihiro Shimizu |
890ddd |
ToolHandle *currTool = app->getCurrentTool();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TTool *tool = app->getCurrentTool()->getTool();
|
|
Toshihiro Shimizu |
890ddd |
if (tool) {
|
|
Toshihiro Shimizu |
890ddd |
// c'e' un tool corrente
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionsBox *panel = 0;
|
|
Toshihiro Shimizu |
890ddd |
std::map<ttool *="" *,="" tooloptionsbox="">::iterator it = m_panels.find(tool);</ttool>
|
|
Toshihiro Shimizu |
890ddd |
if (it == m_panels.end()) {
|
|
Toshihiro Shimizu |
890ddd |
// ... senza panel associato
|
|
Toshihiro Shimizu |
890ddd |
if (tool->getName() == T_Edit) {
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *pg = tool->getProperties(0);
|
|
Toshihiro Shimizu |
890ddd |
panel = new ArrowToolOptionsBox(0, tool, pg, currFrame, currObject, currXsheet, currTool);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tool->getName() == T_Selection)
|
|
Toshihiro Shimizu |
890ddd |
panel = new SelectionToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_Geometric)
|
|
Toshihiro Shimizu |
890ddd |
panel = new GeometricToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_Type)
|
|
Toshihiro Shimizu |
890ddd |
panel = new TypeToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_PaintBrush)
|
|
Toshihiro Shimizu |
890ddd |
panel = new PaintbrushToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_Fill)
|
|
Toshihiro Shimizu |
890ddd |
panel = new FillToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_Eraser)
|
|
Toshihiro Shimizu |
890ddd |
panel = new EraserToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_Tape)
|
|
Toshihiro Shimizu |
890ddd |
panel = new TapeToolOptionsBox(0, tool, currPalette, currTool);
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_RGBPicker)
|
|
Toshihiro Shimizu |
890ddd |
panel = new RGBPickerToolOptionsBox(0, tool, currPalette, currTool, app->getPaletteController());
|
|
Toshihiro Shimizu |
890ddd |
else if (tool->getName() == T_Ruler) {
|
|
Toshihiro Shimizu |
890ddd |
RulerToolOptionsBox *p = new RulerToolOptionsBox(0, tool);
|
|
Toshihiro Shimizu |
890ddd |
panel = p;
|
|
Toshihiro Shimizu |
890ddd |
RulerTool *rt = dynamic_cast<rulertool *="">(tool);</rulertool>
|
|
Toshihiro Shimizu |
890ddd |
if (rt)
|
|
Toshihiro Shimizu |
890ddd |
rt->setToolOptionsBox(p);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tool->getName() == T_StylePicker)
|
|
Toshihiro Shimizu |
890ddd |
panel = new StylePickerToolOptionsBox(0, tool, currPalette, currTool, app->getPaletteController());
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
panel = tool->createOptionsBox(); // Only this line should remain out of that if/else monstrosity
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* DANIELE: Regola per il futuro - NON FARE PIU' COME SOPRA.
|
|
Toshihiro Shimizu |
890ddd |
Bisogna cominciare a collegare il metodo virtuale
|
|
Toshihiro Shimizu |
890ddd |
createOptionsBox() di ogni tool.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Chi ha tempo si adoperi un pochino per normalizzare
|
|
Toshihiro Shimizu |
890ddd |
la situazione anche per i tool sopra, plz - basta spostare
|
|
Toshihiro Shimizu |
890ddd |
un po' di codice... */
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_panels[tool] = panel;
|
|
Toshihiro Shimizu |
890ddd |
layout()->addWidget(panel);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
// il panel c'e' gia'.
|
|
Toshihiro Shimizu |
890ddd |
panel = it->second;
|
|
Toshihiro Shimizu |
890ddd |
panel->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_panel = panel;
|
|
Toshihiro Shimizu |
890ddd |
m_panel->show();
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
// niente tool
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptions::onToolChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(m_panel);
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionsBox *optionBox = dynamic_cast<tooloptionsbox *="">(m_panel);</tooloptionsbox>
|
|
Toshihiro Shimizu |
890ddd |
assert(optionBox);
|
|
Toshihiro Shimizu |
890ddd |
optionBox->updateStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ToolOptions::onStageObjectChange()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TTool *tool = TTool::getApplication()->getCurrentTool()->getTool();
|
|
Toshihiro Shimizu |
890ddd |
if (!tool)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::map<ttool *="" *,="" tooloptionsbox="">::iterator it = m_panels.find(tool);</ttool>
|
|
Toshihiro Shimizu |
890ddd |
if (it == m_panels.end())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ToolOptionsBox *panel = it->second;
|
|
Toshihiro Shimizu |
890ddd |
panel->onStageObjectChange();
|
|
Toshihiro Shimizu |
890ddd |
}
|