From 909ddbfcd54a5102cd09247913540c58baefdfac Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Wed, 8 Jan 2020 13:32:50 +0100 Subject: [PATCH] Create new registry variables for the font sizes to reflect they are now point sizes and not just enum values --- ApplicationCode/Application/RiaFontCache.h | 1 + .../Application/RiaPreferences.cpp | 48 ++++++++++++++----- ApplicationCode/Application/RiaPreferences.h | 5 ++ 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/Application/RiaFontCache.h b/ApplicationCode/Application/RiaFontCache.h index 43f08cfd19..93536adc38 100644 --- a/ApplicationCode/Application/RiaFontCache.h +++ b/ApplicationCode/Application/RiaFontCache.h @@ -40,6 +40,7 @@ class RiaFontCache public: enum FontSize { + INVALID = -1, MIN_FONT_SIZE = 8, FONT_SIZE_8 = 8, FONT_SIZE_10 = 10, diff --git a/ApplicationCode/Application/RiaPreferences.cpp b/ApplicationCode/Application/RiaPreferences.cpp index 803a5058bc..332bd754d2 100644 --- a/ApplicationCode/Application/RiaPreferences.cpp +++ b/ApplicationCode/Application/RiaPreferences.cpp @@ -186,10 +186,16 @@ RiaPreferences::RiaPreferences( void ) caf::AppEnum fontSize = RiaFontCache::FONT_SIZE_8; caf::AppEnum plotFontSize = RiaFontCache::FONT_SIZE_10; - CAF_PDM_InitField( &defaultSceneFontSize, "fontSizeInScene", fontSize, "Viewer Font Size", "", "", "" ); - CAF_PDM_InitField( &defaultAnnotationFontSize, "defaultAnnotationFontSize", fontSize, "Annotation Font Size", "", "", "" ); - CAF_PDM_InitField( &defaultWellLabelFontSize, "wellLabelFontSize", fontSize, "Well Label Font Size", "", "", "" ); - CAF_PDM_InitField( &defaultPlotFontSize, "defaultPlotFontSize", plotFontSize, "Plot Font Size", "", "", "" ); + CAF_PDM_InitField( &defaultSceneFontSize, "defaultSceneFontSizePt", fontSize, "Viewer Font Size", "", "", "" ); + CAF_PDM_InitField( &defaultAnnotationFontSize, + "defaultAnnotationFontSizePt", + fontSize, + "Annotation Font Size", + "", + "", + "" ); + CAF_PDM_InitField( &defaultWellLabelFontSize, "defaultWellLabelFontSizePt", fontSize, "Well Label Font Size", "", "", "" ); + CAF_PDM_InitField( &defaultPlotFontSize, "defaultPlotFontSizePt", plotFontSize, "Plot Font Size", "", "", "" ); CAF_PDM_InitField( &showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", @@ -373,6 +379,24 @@ RiaPreferences::RiaPreferences( void ) "", "", "" ); + + caf::AppEnum invalidFontSize = RiaFontCache::INVALID; + CAF_PDM_InitField( &m_defaultSceneFontSize_OBSOLETE, "fontSizeInScene", invalidFontSize, "Viewer Font Size", "", "", "" ); + CAF_PDM_InitField( &m_defaultAnnotationFontSize_OBSOLETE, + "defaultAnnotationFontSize", + invalidFontSize, + "Annotation Font Size", + "", + "", + "" ); + CAF_PDM_InitField( &m_defaultWellLabelFontSize_OBSOLETE, + "wellLabelFontSize", + invalidFontSize, + "Well Label Font Size", + "", + "", + "" ); + CAF_PDM_InitField( &m_defaultPlotFontSize_OBSOLETE, "defaultPlotFontSize", invalidFontSize, "Plot Font Size", "", "", "" ); } //-------------------------------------------------------------------------------------------------- @@ -629,23 +653,23 @@ QList RiaPreferences::calculateValueOptions( const caf:: void RiaPreferences::initAfterRead() { // If the stored font size is smaller than the minimum enum value, the stored font size is actually just an enum value - int defaultSceneFontEnumValue = static_cast( defaultSceneFontSize.v() ); - if ( defaultSceneFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) + int defaultSceneFontEnumValue = static_cast( m_defaultSceneFontSize_OBSOLETE.v() ); + if ( defaultSceneFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE ) { defaultSceneFontSize = RiaFontCache::legacyEnumToPointSize( defaultSceneFontEnumValue ); } - int defaultWellLabelFontEnumValue = static_cast( defaultWellLabelFontSize.v() ); - if ( defaultWellLabelFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) + int defaultWellLabelFontEnumValue = static_cast( m_defaultWellLabelFontSize_OBSOLETE.v() ); + if ( defaultWellLabelFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE ) { defaultWellLabelFontSize = RiaFontCache::legacyEnumToPointSize( defaultWellLabelFontEnumValue ); } - int defaultAnnotationFontEnumValue = static_cast( defaultAnnotationFontSize.v() ); - if ( defaultAnnotationFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) + int defaultAnnotationFontEnumValue = static_cast( m_defaultAnnotationFontSize_OBSOLETE.v() ); + if ( defaultAnnotationFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE ) { defaultAnnotationFontSize = RiaFontCache::legacyEnumToPointSize( defaultAnnotationFontEnumValue ); } - int defaultPlotFontEnumValue = static_cast( defaultPlotFontSize.v() ); - if ( defaultPlotFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) + int defaultPlotFontEnumValue = static_cast( m_defaultPlotFontSize_OBSOLETE.v() ); + if ( defaultPlotFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE ) { defaultPlotFontSize = RiaFontCache::legacyEnumToPointSize( defaultPlotFontEnumValue ); } diff --git a/ApplicationCode/Application/RiaPreferences.h b/ApplicationCode/Application/RiaPreferences.h index 655c19e007..d93e97dc4b 100644 --- a/ApplicationCode/Application/RiaPreferences.h +++ b/ApplicationCode/Application/RiaPreferences.h @@ -209,4 +209,9 @@ private: caf::PdmField m_defaultPlotTemplate; QStringList m_tabNames; + + caf::PdmField m_defaultSceneFontSize_OBSOLETE; + caf::PdmField m_defaultWellLabelFontSize_OBSOLETE; + caf::PdmField m_defaultAnnotationFontSize_OBSOLETE; + caf::PdmField m_defaultPlotFontSize_OBSOLETE; };