diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 736a19f..eac1ace 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -193,8 +193,8 @@ public: // Interface tab QStringList getStyleSheetList() const { return m_styleSheetList; } bool getIconTheme() const { return getBoolValue(iconTheme); } - void storeOldUnits(); // OK - void resetOldUnits(); // OK + void storeOldUnits(); + void resetOldUnits(); QStringList getLanguageList() const { return m_languageList; } QMap getRoomMap() const { return m_roomMaps; } diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 78feef6..e0199df 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -579,6 +579,10 @@ void PreferencesPopup::onPixelsOnlyChanged() { //----------------------------------------------------------------------------- +void PreferencesPopup::beforeUnitChanged() { m_pref->storeOldUnits(); } + +//----------------------------------------------------------------------------- + void PreferencesPopup::onUnitChanged() { CheckBox* pixelsOnlyCB = getUI(pixelsOnly); if (!pixelsOnlyCB->isChecked() && @@ -1705,7 +1709,9 @@ QWidget* PreferencesPopup::createInterfacePage() { &PreferencesPopup::onStyleSheetTypeChanged); m_onEditedFuncMap.insert(iconTheme, &PreferencesPopup::onIconThemeChanged); m_onEditedFuncMap.insert(pixelsOnly, &PreferencesPopup::onPixelsOnlyChanged); + m_preEditedFuncMap.insert(linearUnits, &PreferencesPopup::beforeUnitChanged); m_onEditedFuncMap.insert(linearUnits, &PreferencesPopup::onUnitChanged); + m_preEditedFuncMap.insert(cameraUnits, &PreferencesPopup::beforeUnitChanged); m_onEditedFuncMap.insert(cameraUnits, &PreferencesPopup::onUnitChanged); m_preEditedFuncMap.insert(CurrentRoomChoice, &PreferencesPopup::beforeRoomChoiceChanged); diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index 25c2628..c1e1e1e 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -127,6 +127,7 @@ private: void onStyleSheetTypeChanged(); void onIconThemeChanged(); void onPixelsOnlyChanged(); + void beforeUnitChanged(); void onUnitChanged(); void beforeRoomChoiceChanged(); void onColorCalibrationChanged(); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 1f9aeaf..288a26c 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -983,8 +983,10 @@ void Preferences::setRasterBackgroundColor() { //----------------------------------------------------------------- void Preferences::storeOldUnits() { - setValue(oldUnits, getStringValue(linearUnits)); - setValue(oldCameraUnits, getStringValue(cameraUnits)); + QString linearU = getStringValue(linearUnits); + if (linearU != "pixel") setValue(oldUnits, linearU); + QString cameraU = getStringValue(cameraUnits); + if (cameraU != "pixel") setValue(oldCameraUnits, cameraU); } //-----------------------------------------------------------------