OpenToonz - An open-source full-featured 2D animation creation software
C
project settings-aware frame number field size
shun-iwasawa7bfeb36ae8fd
diff --git a/toonz/sources/toonz/penciltestpopup.cpp b/toonz/sources/toonz/penciltestpopup.cppindex 426646840..0688e3eb2 100644--- a/toonz/sources/toonz/penciltestpopup.cpp+++ b/toonz/sources/toonz/penciltestpopup.cpp@@ -44,6 +44,7 @@#include "toonz/levelproperties.h"#include "toonz/tcamera.h"#include "toonz/preferences.h"+#include "toonz/filepathproperties.h"// TnzCore includes#include "tsystem.h"@@ -688,7 +689,6 @@ void MyVideoWidget::mouseReleaseEvent(QMouseEvent* event) {FrameNumberLineEdit::FrameNumberLineEdit(QWidget* parent, TFrameId fId,bool acceptLetter): LineEdit(parent) {- setFixedWidth(60);if (acceptLetter) {QString regExpStr = QString("^%1$").arg(TFilePath::fidRegExpStr());m_regexpValidator = new QRegExpValidator(QRegExp(regExpStr), this);@@ -701,6 +701,7 @@ FrameNumberLineEdit::FrameNumberLineEdit(QWidget* parent, TFrameId fId,new QRegExpValidator(QRegExp("^\\d{1,3}[A-Ia-i]?$"), this);updateValidator();+ updateSize();setValue(fId);}@@ -716,6 +717,22 @@ void FrameNumberLineEdit::updateValidator() {//-----------------------------------------------------------------------------+void FrameNumberLineEdit::updateSize() {+ FilePathProperties* fpProp =+ TProjectManager::instance()->getCurrentProject()->getFilePathProperties();+ bool useStandard = fpProp->useStandard();+ int letterCount = fpProp->letterCountForSuffix();+ if (useStandard)+ setFixedWidth(60);+ else {+ // 4 digits + letters reserve 12 px each+ int lc = (letterCount == 0) ? 9 : letterCount + 4;+ setFixedWidth(12 * lc);+ }+ updateGeometry();+}+//-----------------------------------------------------------------------------+void FrameNumberLineEdit::setValue(TFrameId fId) {QString str;if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) {@@ -764,6 +781,7 @@ void FrameNumberLineEdit::onProjectSwitched() {m_regexpValidator = new QRegExpValidator(QRegExp(regExpStr), this);updateValidator();if (oldValidator) delete oldValidator;+ updateSize();}void FrameNumberLineEdit::onProjectChanged() { onProjectSwitched(); }diff --git a/toonz/sources/toonz/penciltestpopup.h b/toonz/sources/toonz/penciltestpopup.hindex b6569fe66..feb81ee41 100644--- a/toonz/sources/toonz/penciltestpopup.h+++ b/toonz/sources/toonz/penciltestpopup.h@@ -126,6 +126,7 @@ class FrameNumberLineEdit : public DVGui::LineEdit,QRegExpValidator *m_regexpValidator, *m_regexpValidator_alt;void updateValidator();+ void updateSize();QString m_textOnFocusIn;public:diff --git a/toonz/sources/toonz/penciltestpopup_qt.cpp b/toonz/sources/toonz/penciltestpopup_qt.cppindex a0333c3ab..58aa19bd8 100644--- a/toonz/sources/toonz/penciltestpopup_qt.cpp+++ b/toonz/sources/toonz/penciltestpopup_qt.cpp@@ -32,6 +32,7 @@#include "toonz/levelproperties.h"#include "toonz/tcamera.h"#include "toonz/preferences.h"+#include "toonz/filepathproperties.h"// TnzCore includes#include "tsystem.h"@@ -886,7 +887,6 @@ void MyVideoWidget::mouseReleaseEvent(QMouseEvent* event) {FrameNumberLineEdit::FrameNumberLineEdit(QWidget* parent, TFrameId fId,bool acceptLetter): LineEdit(parent) {- setFixedWidth(60);if (acceptLetter) {QString regExpStr = QString("^%1$").arg(TFilePath::fidRegExpStr());m_regexpValidator = new QRegExpValidator(QRegExp(regExpStr), this);@@ -899,6 +899,7 @@ FrameNumberLineEdit::FrameNumberLineEdit(QWidget* parent, TFrameId fId,new QRegExpValidator(QRegExp("^\\d{1,3}[A-Ia-i]?$"), this);updateValidator();+ updateSize();setValue(fId);}@@ -914,6 +915,23 @@ void FrameNumberLineEdit::updateValidator() {//-----------------------------------------------------------------------------+void FrameNumberLineEdit::updateSize() {+ FilePathProperties* fpProp =+ TProjectManager::instance()->getCurrentProject()->getFilePathProperties();+ bool useStandard = fpProp->useStandard();+ int letterCount = fpProp->letterCountForSuffix();+ if (useStandard)+ setFixedWidth(60);+ else {+ // 4 digits + letters reserve 12 px each+ int lc = (letterCount == 0) ? 9 : letterCount + 4;+ setFixedWidth(12 * lc);+ }+ updateGeometry();+}++//-----------------------------------------------------------------------------+void FrameNumberLineEdit::setValue(TFrameId fId) {QString str;if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) {diff --git a/toonz/sources/toonz/penciltestpopup_qt.h b/toonz/sources/toonz/penciltestpopup_qt.hindex a0a4bdd3a..30d03008c 100644--- a/toonz/sources/toonz/penciltestpopup_qt.h+++ b/toonz/sources/toonz/penciltestpopup_qt.h@@ -192,6 +192,7 @@ class FrameNumberLineEdit : public DVGui::LineEdit,QRegExpValidator *m_regexpValidator, *m_regexpValidator_alt;void updateValidator();+ void updateSize();QString m_textOnFocusIn;public: