Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Organizing the Tool option bar layout (#443)

shun-iwasawac86c5d6189af
diff --git a/stuff/config/qss/gray_048/gray_048.less b/stuff/config/qss/gray_048/gray_048.less
index b38958310..3a48d8c9f 100644
--- a/stuff/config/qss/gray_048/gray_048.less
+++ b/stuff/config/qss/gray_048/gray_048.less
@@ -1173,6 +1173,39 @@ SpreadsheetViewer {
}
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("@{image_url}/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("@{image_url}/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("@{image_url}/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("@{image_url}/selectiontool_thickness.png");
+}
+
+PopupButton {
+ &::menu-indicator {
+ image: url("@{image_url}/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid grey;
+ }
+ &::menu-indicator:disabled {
+ image: url("@{image_url}/down_arrow_disabled.png");
+ }
+}
+
+#Cap,#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ border-radius: 2px;
+ min-width: 32px; max-width: 32px;
+ & QMenu {
+ min-width: 18px; max-width: 18px;
+ &::item {
+ min-width: 16px; max-width: 16px;
+ padding: 0px;
+ }
+ }
+}
+
/*------ Script Console ------*/
#ScriptConsole {
diff --git a/stuff/config/qss/gray_048/gray_048.qss b/stuff/config/qss/gray_048/gray_048.qss
index 107de891e..d21b41a66 100644
--- a/stuff/config/qss/gray_048/gray_048.qss
+++ b/stuff/config/qss/gray_048/gray_048.qss
@@ -1175,6 +1175,40 @@ SpreadsheetViewer {
#EditToolLockButton::indicator:checked:hover {
image: url("../gray_072/imgs/cam_lock_hover.png");
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("../gray_072/imgs/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("../gray_072/imgs/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("../gray_072/imgs/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("../gray_072/imgs/selectiontool_thickness.png");
+}
+PopupButton::menu-indicator {
+ image: url("../gray_072/imgs/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid grey;
+}
+PopupButton::menu-indicator:disabled {
+ image: url("../gray_072/imgs/down_arrow_disabled.png");
+}
+#Cap,
+#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ border-radius: 2px;
+ min-width: 32px;
+ max-width: 32px;
+}
+#Cap QMenu,
+#Join QMenu {
+ min-width: 18px;
+ max-width: 18px;
+}
+#Cap QMenu::item,
+#Join QMenu::item {
+ min-width: 16px;
+ max-width: 16px;
+ padding: 0px;
+}
/*------ Script Console ------*/
#ScriptConsole {
border: 1px inset;
diff --git a/stuff/config/qss/gray_048/gray_048_mac.qss b/stuff/config/qss/gray_048/gray_048_mac.qss
index 107de891e..d21b41a66 100644
--- a/stuff/config/qss/gray_048/gray_048_mac.qss
+++ b/stuff/config/qss/gray_048/gray_048_mac.qss
@@ -1175,6 +1175,40 @@ SpreadsheetViewer {
#EditToolLockButton::indicator:checked:hover {
image: url("../gray_072/imgs/cam_lock_hover.png");
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("../gray_072/imgs/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("../gray_072/imgs/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("../gray_072/imgs/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("../gray_072/imgs/selectiontool_thickness.png");
+}
+PopupButton::menu-indicator {
+ image: url("../gray_072/imgs/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid grey;
+}
+PopupButton::menu-indicator:disabled {
+ image: url("../gray_072/imgs/down_arrow_disabled.png");
+}
+#Cap,
+#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ border-radius: 2px;
+ min-width: 32px;
+ max-width: 32px;
+}
+#Cap QMenu,
+#Join QMenu {
+ min-width: 18px;
+ max-width: 18px;
+}
+#Cap QMenu::item,
+#Join QMenu::item {
+ min-width: 16px;
+ max-width: 16px;
+ padding: 0px;
+}
/*------ Script Console ------*/
#ScriptConsole {
border: 1px inset;
diff --git a/stuff/config/qss/gray_072/gray_072.less b/stuff/config/qss/gray_072/gray_072.less
index 35c93af6e..e182fb13f 100644
--- a/stuff/config/qss/gray_072/gray_072.less
+++ b/stuff/config/qss/gray_072/gray_072.less
@@ -1172,6 +1172,39 @@ SpreadsheetViewer {
}
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("@{image_url}/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("@{image_url}/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("@{image_url}/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("@{image_url}/selectiontool_thickness.png");
+}
+
+PopupButton {
+ &::menu-indicator {
+ image: url("@{image_url}/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid grey;
+ }
+ &::menu-indicator:disabled {
+ image: url("@{image_url}/down_arrow_disabled.png");
+ }
+}
+
+#Cap,#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ border-radius: 2px;
+ min-width: 32px; max-width: 32px;
+ & QMenu {
+ min-width: 18px; max-width: 18px;
+ &::item {
+ min-width: 16px; max-width: 16px;
+ padding: 0px;
+ }
+ }
+}
+
/*------ Script Console ------*/
#ScriptConsole {
diff --git a/stuff/config/qss/gray_072/gray_072.qss b/stuff/config/qss/gray_072/gray_072.qss
index 857908c96..5a6801555 100644
--- a/stuff/config/qss/gray_072/gray_072.qss
+++ b/stuff/config/qss/gray_072/gray_072.qss
@@ -1175,6 +1175,40 @@ SpreadsheetViewer {
#EditToolLockButton::indicator:checked:hover {
image: url("imgs/cam_lock_hover.png");
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("imgs/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("imgs/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("imgs/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("imgs/selectiontool_thickness.png");
+}
+PopupButton::menu-indicator {
+ image: url("imgs/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid grey;
+}
+PopupButton::menu-indicator:disabled {
+ image: url("imgs/down_arrow_disabled.png");
+}
+#Cap,
+#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ border-radius: 2px;
+ min-width: 32px;
+ max-width: 32px;
+}
+#Cap QMenu,
+#Join QMenu {
+ min-width: 18px;
+ max-width: 18px;
+}
+#Cap QMenu::item,
+#Join QMenu::item {
+ min-width: 16px;
+ max-width: 16px;
+ padding: 0px;
+}
/*------ Script Console ------*/
#ScriptConsole {
border: 1px inset;
diff --git a/stuff/config/qss/gray_072/gray_072_mac.qss b/stuff/config/qss/gray_072/gray_072_mac.qss
index 857908c96..5a6801555 100644
--- a/stuff/config/qss/gray_072/gray_072_mac.qss
+++ b/stuff/config/qss/gray_072/gray_072_mac.qss
@@ -1175,6 +1175,40 @@ SpreadsheetViewer {
#EditToolLockButton::indicator:checked:hover {
image: url("imgs/cam_lock_hover.png");
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("imgs/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("imgs/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("imgs/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("imgs/selectiontool_thickness.png");
+}
+PopupButton::menu-indicator {
+ image: url("imgs/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid grey;
+}
+PopupButton::menu-indicator:disabled {
+ image: url("imgs/down_arrow_disabled.png");
+}
+#Cap,
+#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ border-radius: 2px;
+ min-width: 32px;
+ max-width: 32px;
+}
+#Cap QMenu,
+#Join QMenu {
+ min-width: 18px;
+ max-width: 18px;
+}
+#Cap QMenu::item,
+#Join QMenu::item {
+ min-width: 16px;
+ max-width: 16px;
+ padding: 0px;
+}
/*------ Script Console ------*/
#ScriptConsole {
border: 1px inset;
diff --git a/stuff/config/qss/gray_072/imgs/selectiontool_position.png b/stuff/config/qss/gray_072/imgs/selectiontool_position.png
new file mode 100644
index 000000000..9b5b591ef
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/selectiontool_position.png differ
diff --git a/stuff/config/qss/gray_072/imgs/selectiontool_rotation.png b/stuff/config/qss/gray_072/imgs/selectiontool_rotation.png
new file mode 100644
index 000000000..fb8b3a6cc
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/selectiontool_rotation.png differ
diff --git a/stuff/config/qss/gray_072/imgs/selectiontool_scalepeg.png b/stuff/config/qss/gray_072/imgs/selectiontool_scalepeg.png
new file mode 100644
index 000000000..1880b02e5
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/selectiontool_scalepeg.png differ
diff --git a/stuff/config/qss/gray_072/imgs/selectiontool_thickness.png b/stuff/config/qss/gray_072/imgs/selectiontool_thickness.png
new file mode 100644
index 000000000..2f906ccfe
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/selectiontool_thickness.png differ
diff --git a/stuff/config/qss/gray_128/gray_128.less b/stuff/config/qss/gray_128/gray_128.less
index 518c277bb..489cd19a5 100644
--- a/stuff/config/qss/gray_128/gray_128.less
+++ b/stuff/config/qss/gray_128/gray_128.less
@@ -996,6 +996,37 @@ SpreadsheetViewer {
}
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("@{image_url}/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("@{image_url}/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("@{image_url}/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("@{image_url}/selectiontool_thickness.png");
+}
+
+PopupButton {
+ &::menu-indicator {
+ image: url("@{image_url}/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid gray;
+ }
+ &::menu-indicator:disabled {
+ image: url("@{image_url}/down_arrow_disabled.png");
+ }
+}
+
+#Cap,#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ min-width: 32px; max-width: 32px;
+ & QMenu {
+ min-width: 18px; max-width: 18px;
+ &::item {
+ min-width: 16px; max-width: 16px;
+ padding: 0px;
+ }
+ }
+}
/*------ Script Console ------*/
diff --git a/stuff/config/qss/gray_128/gray_128.qss b/stuff/config/qss/gray_128/gray_128.qss
index 0ea7d8e97..d6955c799 100644
--- a/stuff/config/qss/gray_128/gray_128.qss
+++ b/stuff/config/qss/gray_128/gray_128.qss
@@ -909,6 +909,39 @@ SpreadsheetViewer {
#EditToolLockButton::indicator:checked:hover {
image: url("imgs/cam_lock_hover.png");
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("imgs/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("imgs/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("imgs/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("imgs/selectiontool_thickness.png");
+}
+PopupButton::menu-indicator {
+ image: url("imgs/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid gray;
+}
+PopupButton::menu-indicator:disabled {
+ image: url("imgs/down_arrow_disabled.png");
+}
+#Cap,
+#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ min-width: 32px;
+ max-width: 32px;
+}
+#Cap QMenu,
+#Join QMenu {
+ min-width: 18px;
+ max-width: 18px;
+}
+#Cap QMenu::item,
+#Join QMenu::item {
+ min-width: 16px;
+ max-width: 16px;
+ padding: 0px;
+}
/*------ Script Console ------*/
#ScriptConsole {
border: 1px inset;
diff --git a/stuff/config/qss/gray_128/gray_128_mac.qss b/stuff/config/qss/gray_128/gray_128_mac.qss
index 0ea7d8e97..d6955c799 100644
--- a/stuff/config/qss/gray_128/gray_128_mac.qss
+++ b/stuff/config/qss/gray_128/gray_128_mac.qss
@@ -909,6 +909,39 @@ SpreadsheetViewer {
#EditToolLockButton::indicator:checked:hover {
image: url("imgs/cam_lock_hover.png");
}
+IconViewField {
+ qproperty-ScalePegPixmap: url("imgs/selectiontool_scalepeg.png");
+ qproperty-RotationPixmap: url("imgs/selectiontool_rotation.png");
+ qproperty-PositionPixmap: url("imgs/selectiontool_position.png");
+ qproperty-ThicknessPixmap: url("imgs/selectiontool_thickness.png");
+}
+PopupButton::menu-indicator {
+ image: url("imgs/down_arrow.png");
+ width: 10px;
+ height: 17px;
+ border-left: 1px solid gray;
+}
+PopupButton::menu-indicator:disabled {
+ image: url("imgs/down_arrow_disabled.png");
+}
+#Cap,
+#Join {
+ padding-left: -8px;
+ padding-right: 4px;
+ min-width: 32px;
+ max-width: 32px;
+}
+#Cap QMenu,
+#Join QMenu {
+ min-width: 18px;
+ max-width: 18px;
+}
+#Cap QMenu::item,
+#Join QMenu::item {
+ min-width: 16px;
+ max-width: 16px;
+ padding: 0px;
+}
/*------ Script Console ------*/
#ScriptConsole {
border: 1px inset;
diff --git a/toonz/sources/toonz/Resources/position.png b/stuff/config/qss/gray_128/imgs/selectiontool_position.png
similarity index 100%
rename from toonz/sources/toonz/Resources/position.png
rename to stuff/config/qss/gray_128/imgs/selectiontool_position.png
diff --git a/toonz/sources/toonz/Resources/rotation.png b/stuff/config/qss/gray_128/imgs/selectiontool_rotation.png
similarity index 100%
rename from toonz/sources/toonz/Resources/rotation.png
rename to stuff/config/qss/gray_128/imgs/selectiontool_rotation.png
diff --git a/toonz/sources/toonz/Resources/scalepeg.png b/stuff/config/qss/gray_128/imgs/selectiontool_scalepeg.png
similarity index 100%
rename from toonz/sources/toonz/Resources/scalepeg.png
rename to stuff/config/qss/gray_128/imgs/selectiontool_scalepeg.png
diff --git a/toonz/sources/toonz/Resources/thickness.png b/stuff/config/qss/gray_128/imgs/selectiontool_thickness.png
similarity index 100%
rename from toonz/sources/toonz/Resources/thickness.png
rename to stuff/config/qss/gray_128/imgs/selectiontool_thickness.png
diff --git a/toonz/sources/include/tools/tooloptions.h b/toonz/sources/include/tools/tooloptions.h
index fd4b3a117..7aa6e507d 100644
--- a/toonz/sources/include/tools/tooloptions.h
+++ b/toonz/sources/include/tools/tooloptions.h
@@ -267,6 +267,45 @@ protected slots:
//
//=============================================================================
+class IconViewField : public QWidget {
+ Q_OBJECT
+
+public:
+ enum IconType{
+ Icon_ScalePeg = 0,
+ Icon_Rotation,
+ Icon_Position,
+ Icon_Thickness,
+ Icon_Amount
+ };
+private:
+ IconType m_iconType;
+
+protected:
+ QPixmap m_pm[Icon_Amount];
+ Q_PROPERTY(QPixmap ScalePegPixmap READ getScalePegPixmap WRITE setScalePegPixmap);
+ Q_PROPERTY(QPixmap RotationPixmap READ getRotationPixmap WRITE setRotationPixmap);
+ Q_PROPERTY(QPixmap PositionPixmap READ getPositionPixmap WRITE setPositionPixmap);
+ Q_PROPERTY(QPixmap ThicknessPixmap READ getThicknessPixmap WRITE setThicknessPixmap);
+
+public:
+ IconViewField(QWidget *parent = 0, IconType iconType = Icon_ScalePeg);
+
+ QPixmap getScalePegPixmap() const { return m_pm[Icon_ScalePeg]; }
+ void setScalePegPixmap(const QPixmap &pixmap) { m_pm[Icon_ScalePeg] = pixmap; }
+ QPixmap getRotationPixmap() const { return m_pm[Icon_Rotation]; }
+ void setRotationPixmap(const QPixmap &pixmap) { m_pm[Icon_Rotation] = pixmap; }
+ QPixmap getPositionPixmap() const { return m_pm[Icon_Position]; }
+ void setPositionPixmap(const QPixmap &pixmap) { m_pm[Icon_Position] = pixmap; }
+ QPixmap getThicknessPixmap() const { return m_pm[Icon_Thickness]; }
+ void setThicknessPixmap(const QPixmap &pixmap) { m_pm[Icon_Thickness] = pixmap; }
+
+protected:
+ void paintEvent(QPaintEvent *e);
+};
+
+//-----------------------------------------------------------------------------
+
class SelectionToolOptionsBox : public ToolOptionsBox,
public TProperty::Listener {
Q_OBJECT
@@ -298,7 +337,7 @@ public:
void updateStatus();
void onPropertyChanged();
-protected slots:
+ protected slots:
void onScaleXValueChanged();
void onScaleYValueChanged();
void onSetSaveboxCheckboxChanged(bool);
diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cpp
index 7309dfe8d..1a19bbe77 100644
--- a/toonz/sources/tnztools/tooloptions.cpp
+++ b/toonz/sources/tnztools/tooloptions.cpp
@@ -90,7 +90,7 @@ ToolOptionsBox::ToolOptionsBox(QWidget *parent) : QFrame(parent) {
m_layout = new QHBoxLayout;
m_layout->setMargin(0);
- m_layout->setSpacing(2);
+ m_layout->setSpacing(5);
m_layout->addSpacing(5);
setLayout(m_layout);
}
@@ -212,7 +212,7 @@ void ToolOptionControlBuilder::visit(TDoublePairProperty *p) {
m_panel->addLabel(p->getName(), label);
ToolOptionPairSlider *control = new ToolOptionPairSlider(
m_tool, p, QObject::tr("Min:"), QObject::tr("Max:"), m_toolHandle);
- hLayout()->addWidget(control, 200);
+ hLayout()->addWidget(control, 150);
m_panel->addControl(control);
if (p->getName() == "Size:" || p->getName() == "Size") {
@@ -352,14 +352,13 @@ void ToolOptionControlBuilder::visit(TEnumProperty *p) {
}
}
- hLayout()->addWidget(widget, 0);
+ hLayout()->addWidget(widget, 100);
m_panel->addControl(control);
hLayout()->addSpacing(5);
if (p->getId() != "") {
std::string actionName = "A_ToolOption_" + p->getId();
QAction *a = CommandManager::instance()->getAction(actionName.c_str());
-
if (a) {
widget->addAction(a);
QObject::connect(a, SIGNAL(triggered()), widget, SLOT(doShowPopup()));
@@ -423,26 +422,6 @@ GenericToolOptionsBox::GenericToolOptionsBox(QWidget *parent, TTool *tool,
//-----------------------------------------------------------------------------
-class IconViewField : public QWidget {
- QPixmap m_pixmap;
-
-public:
- IconViewField(QWidget *parent = 0, QPixmap pixmap = QPixmap())
- : QWidget(parent), m_pixmap(pixmap) {
- setMinimumSize(21, 25);
- }
-
-protected:
- void paintEvent(QPaintEvent *e) {
- QPainter p(this);
- // La pixmap e' alta 17 px, il widget 23. Per centrarla faccio il draw a 3
- // px.
- p.drawPixmap(QRect(0, 3, 21, 17), m_pixmap);
- }
-};
-
-//-----------------------------------------------------------------------------
-
ArrowToolOptionsBox::ArrowToolOptionsBox(
QWidget *parent, TTool *tool, TPropertyGroup *pg, TFrameHandle *frameHandle,
TObjectHandle *objHandle, TXsheetHandle *xshHandle, ToolHandle *toolHandle)
@@ -601,204 +580,176 @@ ArrowToolOptionsBox::ArrowToolOptionsBox(
if (splined != m_splined) m_splined = splined;
setSplined(m_splined);
+ const int ITEM_SPACING = 10;
+ const int LABEL_SPACING = 3;
+
/* --- Layout --- */
QHBoxLayout *mainLay = m_layout;
{
mainLay->addWidget(m_currentStageObjectCombo, 0);
mainLay->addWidget(m_chooseActiveAxisCombo, 0);
- mainLay->addWidget(m_mainStackedWidget, 0);
+ addSeparator();
+
+ mainLay->addWidget(m_mainStackedWidget, 1);
{
- // Position
- QFrame *posFrame = new QFrame(this);
+ //Position
+ QFrame *posFrame = new QFrame(this);
QHBoxLayout *posLay = new QHBoxLayout();
posLay->setMargin(0);
- posLay->setSpacing(3);
+ posLay->setSpacing(0);
posFrame->setLayout(posLay);
m_mainStackedWidget->addWidget(posFrame);
{
posLay->addWidget(new QLabel(tr("Position"), this), 0);
-
- posLay->addSpacing(3);
+ posLay->addSpacing(ITEM_SPACING);
posLay->addWidget(m_motionPathPosField, 0);
- QHBoxLayout *ewLay = new QHBoxLayout();
- ewLay->setMargin(0);
- ewLay->setSpacing(0);
- {
- ewLay->addWidget(m_ewPosLabel, 0);
- ewLay->addWidget(m_ewPosField, 0);
- ewLay->addWidget(m_lockEWPosCheckbox, 0);
- }
- posLay->addLayout(ewLay, 0);
+ posLay->addWidget(m_ewPosLabel, 0);
+ posLay->addSpacing(LABEL_SPACING);
+ posLay->addWidget(m_ewPosField, 10);
+ posLay->addWidget(m_lockEWPosCheckbox, 0);
- posLay->addSpacing(3);
+ posLay->addSpacing(ITEM_SPACING);
- QHBoxLayout *nsLay = new QHBoxLayout();
- nsLay->setMargin(0);
- nsLay->setSpacing(0);
- {
- nsLay->addWidget(m_nsPosLabel, 0);
- nsLay->addWidget(m_nsPosField, 0);
- nsLay->addWidget(m_lockNSPosCheckbox, 0);
- }
- posLay->addLayout(nsLay, 0);
+ posLay->addWidget(m_nsPosLabel, 0);
+ posLay->addSpacing(LABEL_SPACING);
+ posLay->addWidget(m_nsPosField, 10);
+ posLay->addWidget(m_lockNSPosCheckbox, 0);
- posLay->addSpacing(3);
+ posLay->addSpacing(ITEM_SPACING);
posLay->addWidget(new QLabel(tr("Z:"), this), 0);
- posLay->addWidget(m_zField, 0);
+ posLay->addSpacing(LABEL_SPACING);
+ posLay->addWidget(m_zField, 10);
+ posLay->addSpacing(LABEL_SPACING);
posLay->addWidget(new QLabel(tr("("), this), 0);
- posLay->addWidget(m_noScaleZField, 0);
+ posLay->addWidget(m_noScaleZField, 10);
posLay->addWidget(new QLabel(tr(")"), this), 0);
- QHBoxLayout *soLay = new QHBoxLayout();
- soLay->setMargin(0);
- soLay->setSpacing(0);
- {
- soLay->addWidget(m_soLabel, 0);
- soLay->addWidget(m_soField, 0);
- }
- posLay->addLayout(soLay, 0);
+ posLay->addSpacing(ITEM_SPACING);
+
+ posLay->addWidget(m_soLabel, 0);
+ posLay->addWidget(m_soField, 10);
- posLay->addSpacing(3);
+ posLay->addStretch(1);
}
- // Rotation
- QFrame *rotFrame = new QFrame(this);
+ //Rotation
+ QFrame *rotFrame = new QFrame(this);
QHBoxLayout *rotLay = new QHBoxLayout();
rotLay->setMargin(0);
- rotLay->setSpacing(3);
+ rotLay->setSpacing(0);
rotFrame->setLayout(rotLay);
m_mainStackedWidget->addWidget(rotFrame);
{
rotLay->addWidget(new QLabel(tr("Rotation"), this), 0);
- rotLay->addWidget(m_rotationField, 0);
+ rotLay->addSpacing(ITEM_SPACING);
+
+ rotLay->addWidget(m_rotationField, 10);
+
rotLay->addStretch(1);
}
- // Scale
- QFrame *scaleFrame = new QFrame(this);
+ //Scale
+ QFrame *scaleFrame = new QFrame(this);
QHBoxLayout *scaleLay = new QHBoxLayout();
scaleLay->setMargin(0);
- scaleLay->setSpacing(3);
+ scaleLay->setSpacing(0);
scaleFrame->setLayout(scaleLay);
m_mainStackedWidget->addWidget(scaleFrame);
{
scaleLay->addWidget(new QLabel(tr("Scale"), this), 0);
- scaleLay->addSpacing(3);
+ scaleLay->addSpacing(ITEM_SPACING);
+
scaleLay->addWidget(new QLabel(tr("Global:"), this), 0);
- scaleLay->addWidget(m_globalScaleField, 0);
+ scaleLay->addSpacing(LABEL_SPACING);
+ scaleLay->addWidget(m_globalScaleField, 10);
- scaleLay->addSpacing(3);
+ scaleLay->addSpacing(ITEM_SPACING);
- QHBoxLayout *hLay = new QHBoxLayout();
- hLay->setMargin(0);
- hLay->setSpacing(0);
- {
- hLay->addWidget(new QLabel(tr("H:"), this), 0);
- hLay->addWidget(m_scaleHField, 0);
- hLay->addWidget(m_lockScaleHCheckbox, 0);
- }
- scaleLay->addLayout(hLay, 0);
-
- QHBoxLayout *vLay = new QHBoxLayout();
- vLay->setMargin(0);
- vLay->setSpacing(0);
- {
- vLay->addWidget(new QLabel(tr("V:"), this), 0);
- vLay->addWidget(m_scaleVField, 0);
- vLay->addWidget(m_lockScaleVCheckbox, 0);
- }
- scaleLay->addLayout(vLay, 0);
+ scaleLay->addWidget(new QLabel(tr("H:"), this), 0);
+ scaleLay->addSpacing(LABEL_SPACING);
+ scaleLay->addWidget(m_scaleHField, 10);
+ scaleLay->addWidget(m_lockScaleHCheckbox, 0);
+
+ scaleLay->addSpacing(ITEM_SPACING);
- scaleLay->addSpacing(3);
+ scaleLay->addWidget(new QLabel(tr("V:"), this), 0);
+ scaleLay->addSpacing(LABEL_SPACING);
+ scaleLay->addWidget(m_scaleVField, 10);
+ scaleLay->addWidget(m_lockScaleVCheckbox, 0);
+
+ scaleLay->addSpacing(ITEM_SPACING);
scaleLay->addWidget(new QLabel(tr("Maintain:"), this), 0);
+ scaleLay->addSpacing(LABEL_SPACING);
scaleLay->addWidget(m_maintainCombo, 0);
+
scaleLay->addStretch(1);
}
- // Shear
- QFrame *shearFrame = new QFrame(this);
+ //Shear
+ QFrame *shearFrame = new QFrame(this);
QHBoxLayout *shearLay = new QHBoxLayout();
shearLay->setMargin(0);
- shearLay->setSpacing(3);
+ shearLay->setSpacing(0);
shearFrame->setLayout(shearLay);
m_mainStackedWidget->addWidget(shearFrame);
{
shearLay->addWidget(new QLabel(tr("Shear"), this), 0);
- shearLay->addSpacing(3);
-
- QHBoxLayout *hLay = new QHBoxLayout();
- hLay->setMargin(0);
- hLay->setSpacing(0);
- {
- hLay->addWidget(new QLabel(tr("H:"), this), 0);
- hLay->addWidget(m_shearHField, 0);
- hLay->addWidget(m_lockShearHCheckbox, 0);
- }
- shearLay->addLayout(hLay, 0);
-
- QHBoxLayout *vLay = new QHBoxLayout();
- vLay->setMargin(0);
- vLay->setSpacing(0);
- {
- vLay->addWidget(new QLabel(tr("V:"), this), 0);
- vLay->addWidget(m_shearVField, 0);
- vLay->addWidget(m_lockShearVCheckbox, 0);
- }
- shearLay->addLayout(vLay, 0);
+ shearLay->addSpacing(ITEM_SPACING);
+
+ shearLay->addWidget(new QLabel(tr("H:"), this), 0);
+ shearLay->addSpacing(LABEL_SPACING);
+ shearLay->addWidget(m_shearHField, 10);
+ shearLay->addWidget(m_lockShearHCheckbox, 0);
+
+ shearLay->addSpacing(ITEM_SPACING);
+
+ shearLay->addWidget(new QLabel(tr("V:"), this), 0);
+ shearLay->addSpacing(LABEL_SPACING);
+ shearLay->addWidget(m_shearVField, 10);
+ shearLay->addWidget(m_lockShearVCheckbox, 0);
+
+ shearLay->addSpacing(ITEM_SPACING);
shearLay->addStretch(1);
}
- // Center Position
- QFrame *centerPosFrame = new QFrame(this);
+ //Center Position
+ QFrame *centerPosFrame = new QFrame(this);
QHBoxLayout *centerPosLay = new QHBoxLayout();
centerPosLay->setMargin(0);
- centerPosLay->setSpacing(3);
+ centerPosLay->setSpacing(0);
centerPosFrame->setLayout(centerPosLay);
m_mainStackedWidget->addWidget(centerPosFrame);
{
centerPosLay->addWidget(new QLabel(tr("Center Position"), this), 0);
+ centerPosLay->addSpacing(ITEM_SPACING);
- centerPosLay->addSpacing(3);
+ centerPosLay->addWidget(new QLabel(tr("E/W:"), this), 0);
+ centerPosLay->addSpacing(LABEL_SPACING);
+ centerPosLay->addWidget(m_ewCenterField, 10);
+ centerPosLay->addWidget(m_lockEWCenterCheckbox, 0);
- QHBoxLayout *ewLay = new QHBoxLayout();
- ewLay->setMargin(0);
- ewLay->setSpacing(0);
- {
- ewLay->addWidget(new QLabel(tr("E/W:"), this), 0);
- ewLay->addWidget(m_ewCenterField, 0);
- ewLay->addWidget(m_lockEWCenterCheckbox, 0);
- }
- centerPosLay->addLayout(ewLay, 0);
-
- QHBoxLayout *nsLay = new QHBoxLayout();
- nsLay->setMargin(0);
- nsLay->setSpacing(0);
- {
- nsLay->addWidget(new QLabel(tr("N/S:"), this), 0);
- nsLay->addWidget(m_nsCenterField, 0);
- nsLay->addWidget(m_lockNSCenterCheckbox, 0);
- }
- centerPosLay->addLayout(nsLay, 0);
+ centerPosLay->addSpacing(ITEM_SPACING);
+
+ centerPosLay->addWidget(new QLabel(tr("N/S:"), this), 0);
+ centerPosLay->addSpacing(LABEL_SPACING);
+ centerPosLay->addWidget(m_nsCenterField, 10);
+ centerPosLay->addWidget(m_lockNSCenterCheckbox, 0);
centerPosLay->addStretch(1);
}
}
- QHBoxLayout *globalKeyLay = new QHBoxLayout();
- globalKeyLay->setMargin(0);
- globalKeyLay->setSpacing(0);
- mainLay->addLayout(globalKeyLay, 0);
- { globalKeyLay->addWidget(m_globalKey, 0); }
+ addSeparator();
- mainLay->addSpacing(3);
+ mainLay->addWidget(m_globalKey, 0);
- mainLay->addStretch(1);
+ mainLay->addSpacing(5);
QHBoxLayout *pickLay = new QHBoxLayout();
pickLay->setMargin(0);
@@ -1029,6 +980,20 @@ void ArrowToolOptionsBox::onCurrentStageObjectComboActivated(int index) {
//
//=============================================================================
+IconViewField::IconViewField(QWidget *parent, IconType iconType)
+ : QWidget(parent)
+ , m_iconType(iconType){
+ setMinimumSize(21, 25);
+}
+
+void IconViewField::paintEvent(QPaintEvent *e){
+ QPainter p(this);
+ // La pixmap e' alta 17 px, il widget 23. Per centrarla faccio il draw a 3 px.
+ p.drawPixmap(QRect(0, 3, 21, 17), m_pm[m_iconType]);
+}
+
+//-----------------------------------------------------------------------------
+
SelectionToolOptionsBox::SelectionToolOptionsBox(QWidget *parent, TTool *tool,
TPaletteHandle *pltHandle,
ToolHandle *toolHandle)
@@ -1039,87 +1004,87 @@ SelectionToolOptionsBox::SelectionToolOptionsBox(QWidget *parent, TTool *tool,
TPropertyGroup *props = tool->getProperties(0);
assert(props->getPropertyCount() > 0);
- RasterSelectionTool *rasterSelectionTool =
- dynamic_cast<RasterSelectionTool *>(tool);
+ RasterSelectionTool *rasterSelectionTool = dynamic_cast<RasterSelectionTool *>(tool);
SelectionTool *selectionTool = dynamic_cast<SelectionTool *>(tool);
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
- if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
+ if (tool && tool->getProperties(0))
+ tool->getProperties(0)->accept(builder);
- addSeparator();
+ //Scale
+ IconViewField *iconView = new IconViewField(this, IconViewField::Icon_ScalePeg);
+ m_scaleXLabel = new QLabel(tr("H:"), this);
+ m_scaleXField = new SelectionScaleField(selectionTool, 0, "Scale X");
+ m_scaleYLabel = new QLabel(tr("V:"), this);
+ m_scaleYField = new SelectionScaleField(selectionTool, 1, "Scale Y");
+ m_scaleLink = new DVGui::CheckBox(tr("Link"), this);
+
+ //Rotation
+ IconViewField *rotIconView = new IconViewField(this, IconViewField::Icon_Rotation);
+ m_rotationField = new SelectionRotationField(selectionTool, tr("Rotation"));
+
+ //Move
+ IconViewField *moveIconView = new IconViewField(this, IconViewField::Icon_Position);
+ m_moveXLabel = new QLabel(tr("E/W:"), this);
+ m_moveXField = new SelectionMoveField(selectionTool, 0, "Move X");
+ m_moveYLabel = addLabel(tr("N/S:"));
+ m_moveYField = new SelectionMoveField(selectionTool, 1, "Move Y");
+
+ if (rasterSelectionTool) {
+ TBoolProperty *modifySetSaveboxProp = rasterSelectionTool->getModifySaveboxProperty();
+ if (modifySetSaveboxProp)
+ m_setSaveboxCheckbox = new ToolOptionCheckbox(rasterSelectionTool, modifySetSaveboxProp);
+ }
- // Scale
- static QPixmap editScale(":Resources/scalepeg.png");
- IconViewField *iconView = new IconViewField(this, editScale);
- hLayout()->addWidget(iconView, 0);
- m_scaleXLabel = addLabel(tr("H:"));
m_scaleXLabel->setEnabled(false);
- m_scaleXField = new SelectionScaleField(selectionTool, 0, "Scale X");
- hLayout()->addWidget(m_scaleXField);
- bool ret = connect(m_scaleXField, SIGNAL(valueChange()),
- SLOT(onScaleXValueChanged()));
- m_scaleYLabel = addLabel(tr("V:"));
m_scaleYLabel->setEnabled(false);
- m_scaleYField = new SelectionScaleField(selectionTool, 1, "Scale Y");
- hLayout()->addWidget(m_scaleYField);
- ret = ret && connect(m_scaleYField, SIGNAL(valueChange()),
- SLOT(onScaleYValueChanged()));
+ m_moveXLabel->setEnabled(false);
+ m_moveYLabel->setEnabled(false);
+
+ //--- layout ----
+
+ addSeparator();
+
+ hLayout()->addWidget(iconView, 0);
+ hLayout()->addWidget(m_scaleXLabel, 0);
+ hLayout()->addWidget(m_scaleXField, 10);
+ hLayout()->addWidget(m_scaleYLabel, 0);
+ hLayout()->addWidget(m_scaleYField, 10);
hLayout()->addSpacing(4);
- m_scaleLink = new DVGui::CheckBox(tr("Link"), this);
- hLayout()->addWidget(m_scaleLink);
+ hLayout()->addWidget(m_scaleLink, 0);
addSeparator();
- // Rotation
- static QPixmap editRotation(":Resources/rotation.png");
- IconViewField *rotIconView = new IconViewField(this, editRotation);
hLayout()->addWidget(rotIconView, 0);
- m_rotationField = new SelectionRotationField(selectionTool, tr("Rotation"));
- hLayout()->addWidget(m_rotationField);
+ hLayout()->addWidget(m_rotationField, 10);
addSeparator();
- // Move
- static QPixmap editPosition(":Resources/position.png");
- IconViewField *moveIconView = new IconViewField(this, editPosition);
hLayout()->addWidget(moveIconView, 0);
- m_moveXLabel = addLabel(tr("E/W:"));
- m_moveXLabel->setEnabled(false);
- m_moveXField = new SelectionMoveField(selectionTool, 0, "Move X");
- hLayout()->addWidget(m_moveXField);
- m_moveYLabel = addLabel(tr("N/S:"));
- m_moveYLabel->setEnabled(false);
- m_moveYField = new SelectionMoveField(selectionTool, 1, "Move Y");
- hLayout()->addWidget(m_moveYField);
-
- if (rasterSelectionTool) {
- TBoolProperty *modifySetSaveboxProp =
- rasterSelectionTool->getModifySaveboxProperty();
- if (modifySetSaveboxProp) {
- addSeparator();
- m_setSaveboxCheckbox =
- new ToolOptionCheckbox(rasterSelectionTool, modifySetSaveboxProp);
- connect(m_setSaveboxCheckbox, SIGNAL(toggled(bool)),
- SLOT(onSetSaveboxCheckboxChanged(bool)));
- hLayout()->addWidget(m_setSaveboxCheckbox);
- }
+ hLayout()->addWidget(m_moveXLabel, 0);
+ hLayout()->addWidget(m_moveXField, 10);
+ hLayout()->addWidget(m_moveYLabel, 0);
+ hLayout()->addWidget(m_moveYField, 10);
+ if (m_setSaveboxCheckbox)
+ {
+ addSeparator();
+ hLayout()->addWidget(m_setSaveboxCheckbox, 0);
}
- VectorSelectionTool *vectorSelectionTool =
- dynamic_cast<VectorSelectionTool *>(tool);
+ VectorSelectionTool *vectorSelectionTool = dynamic_cast<VectorSelectionTool *>(tool);
if (vectorSelectionTool) {
m_isVectorSelction = true;
- addSeparator();
- // change Thick
- static QPixmap thickness(":Resources/thickness.png");
- IconViewField *thicknessIconView = new IconViewField(this, thickness);
- hLayout()->addWidget(thicknessIconView);
+ //change Thick
+ IconViewField *thicknessIconView = new IconViewField(this, IconViewField::Icon_Thickness);
m_thickChangeField = new ThickChangeField(selectionTool, tr("Thickness"));
- hLayout()->addWidget(m_thickChangeField);
+ addSeparator();
+ hLayout()->addWidget(thicknessIconView, 0);
+ hLayout()->addWidget(m_thickChangeField, 10);
+
// Outline options
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
builder.setEnumWidgetType(ToolOptionControlBuilder::POPUPBUTTON);
@@ -1140,9 +1105,16 @@ SelectionToolOptionsBox::SelectionToolOptionsBox(QWidget *parent, TTool *tool,
onPropertyChanged();
}
- // assert(ret);
+ hLayout()->addStretch(1);
- updateStatus();
+ bool ret = connect(m_scaleXField, SIGNAL(valueChange()), SLOT(onScaleXValueChanged()));
+ ret = ret && connect(m_scaleYField, SIGNAL(valueChange()), SLOT(onScaleYValueChanged()));
+ if (m_setSaveboxCheckbox)
+ ret = ret && connect(m_setSaveboxCheckbox, SIGNAL(toggled(bool)), SLOT(onSetSaveboxCheckboxChanged(bool)));
+
+ //assert(ret);
+
+ updateStatus();
}
//-----------------------------------------------------------------------------
@@ -1258,6 +1230,7 @@ GeometricToolOptionsBox::GeometricToolOptionsBox(QWidget *parent, TTool *tool,
addSeparator();
if (tool && tool->getProperties(1)) tool->getProperties(1)->accept(builder);
+ hLayout()->addStretch(1);
m_hardnessField =
dynamic_cast<ToolOptionSlider *>(m_controls.value("Hardness:"));
if (m_hardnessField)
@@ -1404,6 +1377,7 @@ PaintbrushToolOptionsBox::PaintbrushToolOptionsBox(QWidget *parent, TTool *tool,
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
+ hLayout()->addStretch(1);
m_colorMode = dynamic_cast<ToolOptionCombo *>(m_controls.value("Mode:"));
m_selectiveMode =
@@ -1644,6 +1618,7 @@ BrushToolOptionsBox::BrushToolOptionsBox(QWidget *parent, TTool *tool,
m_miterField->setEnabled(m_joinStyleCombo->currentIndex() ==
TStroke::OutlineOptions::MITER_JOIN);
}
+ hLayout()->addStretch(1);
}
//-----------------------------------------------------------------------------
@@ -1731,6 +1706,8 @@ EraserToolOptionsBox::EraserToolOptionsBox(QWidget *parent, TTool *tool,
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
+ hLayout()->addStretch(1);
+
m_toolType = dynamic_cast<ToolOptionCombo *>(m_controls.value("Type:"));
m_hardnessField =
dynamic_cast<ToolOptionSlider *>(m_controls.value("Hardness:"));
@@ -1977,7 +1954,8 @@ TapeToolOptionsBox::TapeToolOptionsBox(QWidget *parent, TTool *tool,
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
-
+
+ hLayout()->addStretch(1);
if (!(tool->getTargetType() & TTool::Vectors)) return;
m_smoothMode = dynamic_cast<ToolOptionCheckbox *>(m_controls.value("Smooth"));
diff --git a/toonz/sources/tnztools/tooloptionscontrols.cpp b/toonz/sources/tnztools/tooloptionscontrols.cpp
index 5591048fc..6857601e9 100644
--- a/toonz/sources/tnztools/tooloptionscontrols.cpp
+++ b/toonz/sources/tnztools/tooloptionscontrols.cpp
@@ -134,6 +134,17 @@ ToolOptionSlider::ToolOptionSlider(TTool *tool, TDoubleProperty *property,
m_property->addListener(this);
TDoubleProperty::Range range = property->getRange();
setRange(range.first, range.second);
+
+ //calculate maximum text length which includes length for decimals (for now it's fixed to 2) and period
+ int textMaxLength = std::max(QString::number((int)range.first).length(), QString::number((int)range.second).length()) + m_lineEdit->getDecimals() + 1;
+ QString txt;
+ //set the maximum width of the widget according to the text length (with 5 pixels margin)
+ txt.fill('0', textMaxLength);
+ int widgetWidth = fontMetrics().width(txt) + 5;
+ m_lineEdit->parentWidget()->setMaximumWidth(widgetWidth);
+ //set the maximum width of the slider to 250 pixels
+ setMaximumWidth(250 + widgetWidth);
+
updateStatus();
connect(this, SIGNAL(valueChanged(bool)), SLOT(onValueChanged(bool)));
// synchronize the state with the same widgets in other tool option bars
@@ -210,12 +221,27 @@ ToolOptionPairSlider::ToolOptionPairSlider(TTool *tool,
: DoublePairField(0, property->isMaxRangeLimited())
, ToolOptionControl(tool, property->getName(), toolHandle)
, m_property(property) {
- setLeftText(leftName);
- setRightText(rightName);
m_property->addListener(this);
TDoublePairProperty::Value value = property->getValue();
TDoublePairProperty::Range range = property->getRange();
setRange(range.first, range.second);
+
+ //calculate maximum text length which includes length for decimals (for now it's fixed to 2) and period
+ int textMaxLength = std::max(QString::number((int)range.first).length(), QString::number((int)range.second).length()) + m_leftLineEdit->getDecimals() + 1;
+ QString txt;
+ //set the maximum width of the widget according to the text length (with 5 pixels margin)
+ txt.fill('0', textMaxLength);
+ int widgetWidth = fontMetrics().width(txt) + 5;
+ m_leftLineEdit->setFixedWidth(widgetWidth);
+ m_rightLineEdit->setFixedWidth(widgetWidth);
+ m_leftMargin = widgetWidth + 12;
+ m_rightMargin = widgetWidth + 12;
+ //set the maximum width of the slider to 300 pixels
+ setMaximumWidth(300 + m_leftMargin + m_rightMargin);
+
+ setLeftText(leftName);
+ setRightText(rightName);
+
updateStatus();
connect(this, SIGNAL(valuesChanged(bool)), SLOT(onValuesChanged(bool)));
}
@@ -324,6 +350,7 @@ ToolOptionIntPairSlider::ToolOptionIntPairSlider(TTool *tool,
TIntPairProperty::Value value = property->getValue();
TIntPairProperty::Range range = property->getRange();
setRange(range.first, range.second);
+ setMaximumWidth(300);
updateStatus();
connect(this, SIGNAL(valuesChanged(bool)), SLOT(onValuesChanged(bool)));
}
@@ -434,6 +461,7 @@ ToolOptionIntSlider::ToolOptionIntSlider(TTool *tool, TIntProperty *property,
m_property->addListener(this);
TIntProperty::Range range = property->getRange();
setRange(range.first, range.second);
+ setMaximumWidth(300);
updateStatus();
connect(this, SIGNAL(valueChanged(bool)), SLOT(onValueChanged(bool)));
// synchronize the state with the same widgets in other tool option bars
@@ -528,9 +556,20 @@ void ToolOptionCombo::loadEntries() {
TEnumProperty::Range range = m_property->getRange();
TEnumProperty::Range::iterator it;
+ int maxWidth = 0;
+
clear();
for (it = range.begin(); it != range.end(); ++it)
- addItem(QString::fromStdWString(*it));
+ {
+ QString itemStr = QString::fromStdWString(*it);
+ addItem(itemStr);
+ int tmpWidth = fontMetrics().width(itemStr);
+ if (tmpWidth > maxWidth)
+ maxWidth = tmpWidth;
+ }
+
+ //set the maximum width according to the longest item with 25 pixels for arrow button and margin
+ setMaximumWidth(maxWidth + 25);
updateStatus();
}
@@ -986,6 +1025,14 @@ void MeasuredValueField::setPrecision(int precision) {
//=============================================================================
+namespace {
+ //calculate maximum field size (once) with 10 pixels margin
+ int getMaximumWidthForEditToolField(QWidget* widget) {
+ static int fieldMaxWidth = widget->fontMetrics().width("-0000.00 field") + 10;
+ return fieldMaxWidth;
+ }
+}//namespace
+
PegbarChannelField::PegbarChannelField(TTool *tool,
enum TStageObject::Channel actionId,
QString name, TFrameHandle *frameHandle,
@@ -1032,6 +1079,9 @@ PegbarChannelField::PegbarChannelField(TTool *tool,
setMeasure("dummy");
break;
}
+
+ setMaximumWidth(getMaximumWidthForEditToolField(this));
+
updateStatus();
}
@@ -1133,6 +1183,7 @@ PegbarCenterField::PegbarCenterField(TTool *tool, int index, QString name,
connect(this, SIGNAL(measuredValueChanged(TMeasuredValue *)),
SLOT(onChange(TMeasuredValue *)));
updateStatus();
+ setMaximumWidth(getMaximumWidthForEditToolField(this));
}
//-----------------------------------------------------------------------------
@@ -1187,6 +1238,7 @@ NoScaleField::NoScaleField(TTool *tool, QString name)
connect(this, SIGNAL(measuredValueChanged(TMeasuredValue *)),
SLOT(onChange(TMeasuredValue *)));
updateStatus();
+ setMaximumWidth(getMaximumWidthForEditToolField(this));
}
//-----------------------------------------------------------------------------
@@ -1288,6 +1340,16 @@ void PropertyMenuButton::onActionTriggered(QAction *action) {
}
//=============================================================================
+namespace
+{
+ //calculate maximum field size (once) with 10 pixels margin
+ int getMaximumWidthForSelectionToolField(QWidget* widget)
+ {
+ static int fieldMaxWidth = widget->fontMetrics().width("-000.00 %") + 10;
+ return fieldMaxWidth;
+ }
+}//namespace
+
// id == 0 Scale X
// id == 0 Scale Y
SelectionScaleField::SelectionScaleField(SelectionTool *tool, int id,
@@ -1298,6 +1360,8 @@ SelectionScaleField::SelectionScaleField(SelectionTool *tool, int id,
assert(ret);
setMeasure("scale");
updateStatus();
+
+ setMaximumWidth(getMaximumWidthForSelectionToolField(this));
}
//-----------------------------------------------------------------------------
@@ -1382,6 +1446,8 @@ SelectionRotationField::SelectionRotationField(SelectionTool *tool,
assert(ret);
setMeasure("angle");
updateStatus();
+
+ setMaximumWidth(getMaximumWidthForSelectionToolField(this));
}
//-----------------------------------------------------------------------------
@@ -1434,6 +1500,9 @@ SelectionMoveField::SelectionMoveField(SelectionTool *tool, int id,
else
setMeasure("length.y");
updateStatus();
+
+ // for translation value field, use size for the Edit Tool as it needs more estate
+ setMaximumWidth(getMaximumWidthForEditToolField(this));
}
//-----------------------------------------------------------------------------
@@ -1491,6 +1560,8 @@ ThickChangeField::ThickChangeField(SelectionTool *tool, QString name)
assert(ret);
setMeasure("");
updateStatus();
+
+ setMaximumWidth(getMaximumWidthForSelectionToolField(this));
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/matchline.cpp b/toonz/sources/toonz/matchline.cpp
index 5fd4a1b8b..16dd7065f 100644
--- a/toonz/sources/toonz/matchline.cpp
+++ b/toonz/sources/toonz/matchline.cpp
@@ -372,7 +372,7 @@ MatchlinesDialog::MatchlinesDialog()
{
inkUsageLay->addWidget(m_button1, 0, 0, 1, 2);
inkUsageLay->addWidget(m_button2, 1, 0);
- inkUsageLay->addWidget(m_inkIndex, 1, 1);
+ inkUsageLay->addWidget(m_inkIndex, 1, 1, Qt::AlignLeft);
}
inkUsageLay->setColumnStretch(0, 0);
inkUsageLay->setColumnStretch(1, 1);
diff --git a/toonz/sources/toonz/toonz.qrc b/toonz/sources/toonz/toonz.qrc
index ad154ce2d..75aa7a16e 100644
--- a/toonz/sources/toonz/toonz.qrc
+++ b/toonz/sources/toonz/toonz.qrc
@@ -206,7 +206,6 @@
<file>Resources/play.png</file>
<file>Resources/play_click.png</file>
<file>Resources/play_over.png</file>
- <file>Resources/position.png</file>
<file>Resources/preview_toggle.png</file>
<file>Resources/previuos_folder.png</file>
<file>Resources/prevkey.png</file>
@@ -232,13 +231,11 @@
<file>Resources/rotate.png</file>
<file>Resources/rotate.svg</file>
<file>Resources/rotate_rollover.svg</file>
- <file>Resources/rotation.png</file>
<file>Resources/savescreen.png</file>
<file>Resources/scale.png</file>
<file>Resources/scale_h.png</file>
<file>Resources/scale_inv.png</file>
<file>Resources/scale_v.png</file>
- <file>Resources/scalepeg.png</file>
<file>Resources/schematic_spin_arrows.svg</file>
<file>Resources/schematic_spline_aim_rhomb.svg</file>
<file>Resources/schematic_spline_aim_square.svg</file>
@@ -394,7 +391,6 @@
<file>Resources/round_join.png</file>
<file>Resources/bevel_join.png</file>
<file>Resources/miter_join.png</file>
- <file>Resources/thickness.png</file>
<file>Resources/init.js</file>
<file>Resources/scripticon.png</file>
<file>Resources/safearea.png</file>
diff --git a/toonz/sources/toonzqt/doublepairfield.cpp b/toonz/sources/toonzqt/doublepairfield.cpp
index f51e7bbcc..7a7839aaa 100644
--- a/toonz/sources/toonzqt/doublepairfield.cpp
+++ b/toonz/sources/toonzqt/doublepairfield.cpp
@@ -5,6 +5,8 @@
#include "tcommon.h"
+#include <cmath>
+
#include <QLabel>
#include <QPainter>
#include <QMouseEvent>
@@ -171,8 +173,9 @@ void DoubleValuePairField::setLabelsEnabled(bool enable) {
//-----------------------------------------------------------------------------
void DoubleValuePairField::setValue(double value) {
+ int decimals = std::min(m_leftLineEdit->getDecimals(), 4);
+ value = tround(value * std::pow(10, decimals)) * std::pow(0.1, decimals);
value = tcrop(value, m_minValue, m_maxValue);
- value = tround(value * 10000) * 0.0001;
if (m_grabIndex == 0) // Left grab
{
m_values.first = value;
diff --git a/toonz/sources/toonzqt/dvdialog.cpp b/toonz/sources/toonzqt/dvdialog.cpp
index c4a18b7a8..6d9508f5f 100644
--- a/toonz/sources/toonzqt/dvdialog.cpp
+++ b/toonz/sources/toonzqt/dvdialog.cpp
@@ -124,7 +124,12 @@ void Separator::paintEvent(QPaintEvent *) {
int textWidth = p.fontMetrics().width(m_name);
p.drawText(contents.left(), 10, m_name);
- p.setPen(palette().alternateBase().color());
+
+ //make the line semi-transparent
+ QColor lineColor = palette().alternateBase().color();
+ lineColor.setAlpha(128);
+
+ p.setPen(lineColor);
int h = contents.height();
if (m_isHorizontal) {
int y = contents.center().y();
diff --git a/toonz/sources/toonzqt/styleindexlineedit.cpp b/toonz/sources/toonzqt/styleindexlineedit.cpp
index 112a19fcb..2d5ec12b1 100644
--- a/toonz/sources/toonzqt/styleindexlineedit.cpp
+++ b/toonz/sources/toonzqt/styleindexlineedit.cpp
@@ -12,7 +12,12 @@ using namespace DVGui;
//--------------------------------------------------------------------
-StyleIndexLineEdit::StyleIndexLineEdit() : m_pltHandle(0) {}
+StyleIndexLineEdit::StyleIndexLineEdit() : m_pltHandle(0) {
+ // style index will not be more than 4096, but a longer text
+ // "current" may be input instead of style id + chip width + margin
+ setMaximumWidth(fontMetrics().width("current") + 30);
+ setFixedHeight(20);
+}
//--------------------------------------------------------------------
@@ -34,7 +39,7 @@ void StyleIndexLineEdit::paintEvent(QPaintEvent *pe) {
if (style) {
QPainter p(this);
int w = width();
- QRect chipRect(w - 18, 4, 14, 14);
+ QRect chipRect(w - 18, 3, 14, 14);
TRaster32P icon = style->getIcon(qsize2Dimension(chipRect.size()));
p.drawPixmap(chipRect.left(), chipRect.top(), rasterToQPixmap(icon));
p.setPen(Qt::black);