Create new registry variables for the font sizes to reflect they are now point sizes and not just enum values

This commit is contained in:
Gaute Lindkvist 2020-01-08 13:32:50 +01:00
parent fdb453a813
commit 909ddbfcd5
3 changed files with 42 additions and 12 deletions

View File

@ -40,6 +40,7 @@ class RiaFontCache
public: public:
enum FontSize enum FontSize
{ {
INVALID = -1,
MIN_FONT_SIZE = 8, MIN_FONT_SIZE = 8,
FONT_SIZE_8 = 8, FONT_SIZE_8 = 8,
FONT_SIZE_10 = 10, FONT_SIZE_10 = 10,

View File

@ -186,10 +186,16 @@ RiaPreferences::RiaPreferences( void )
caf::AppEnum<RiaFontCache::FontSize> fontSize = RiaFontCache::FONT_SIZE_8; caf::AppEnum<RiaFontCache::FontSize> fontSize = RiaFontCache::FONT_SIZE_8;
caf::AppEnum<RiaFontCache::FontSize> plotFontSize = RiaFontCache::FONT_SIZE_10; caf::AppEnum<RiaFontCache::FontSize> plotFontSize = RiaFontCache::FONT_SIZE_10;
CAF_PDM_InitField( &defaultSceneFontSize, "fontSizeInScene", fontSize, "Viewer Font Size", "", "", "" ); CAF_PDM_InitField( &defaultSceneFontSize, "defaultSceneFontSizePt", fontSize, "Viewer Font Size", "", "", "" );
CAF_PDM_InitField( &defaultAnnotationFontSize, "defaultAnnotationFontSize", fontSize, "Annotation Font Size", "", "", "" ); CAF_PDM_InitField( &defaultAnnotationFontSize,
CAF_PDM_InitField( &defaultWellLabelFontSize, "wellLabelFontSize", fontSize, "Well Label Font Size", "", "", "" ); "defaultAnnotationFontSizePt",
CAF_PDM_InitField( &defaultPlotFontSize, "defaultPlotFontSize", plotFontSize, "Plot Font Size", "", "", "" ); 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, CAF_PDM_InitField( &showLasCurveWithoutTvdWarning,
"showLasCurveWithoutTvdWarning", "showLasCurveWithoutTvdWarning",
@ -373,6 +379,24 @@ RiaPreferences::RiaPreferences( void )
"", "",
"", "",
"" ); "" );
caf::AppEnum<RiaFontCache::FontSize> 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<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions( const caf::
void RiaPreferences::initAfterRead() 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 // 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<int>( defaultSceneFontSize.v() ); int defaultSceneFontEnumValue = static_cast<int>( m_defaultSceneFontSize_OBSOLETE.v() );
if ( defaultSceneFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) if ( defaultSceneFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{ {
defaultSceneFontSize = RiaFontCache::legacyEnumToPointSize( defaultSceneFontEnumValue ); defaultSceneFontSize = RiaFontCache::legacyEnumToPointSize( defaultSceneFontEnumValue );
} }
int defaultWellLabelFontEnumValue = static_cast<int>( defaultWellLabelFontSize.v() ); int defaultWellLabelFontEnumValue = static_cast<int>( m_defaultWellLabelFontSize_OBSOLETE.v() );
if ( defaultWellLabelFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) if ( defaultWellLabelFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{ {
defaultWellLabelFontSize = RiaFontCache::legacyEnumToPointSize( defaultWellLabelFontEnumValue ); defaultWellLabelFontSize = RiaFontCache::legacyEnumToPointSize( defaultWellLabelFontEnumValue );
} }
int defaultAnnotationFontEnumValue = static_cast<int>( defaultAnnotationFontSize.v() ); int defaultAnnotationFontEnumValue = static_cast<int>( m_defaultAnnotationFontSize_OBSOLETE.v() );
if ( defaultAnnotationFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) if ( defaultAnnotationFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{ {
defaultAnnotationFontSize = RiaFontCache::legacyEnumToPointSize( defaultAnnotationFontEnumValue ); defaultAnnotationFontSize = RiaFontCache::legacyEnumToPointSize( defaultAnnotationFontEnumValue );
} }
int defaultPlotFontEnumValue = static_cast<int>( defaultPlotFontSize.v() ); int defaultPlotFontEnumValue = static_cast<int>( m_defaultPlotFontSize_OBSOLETE.v() );
if ( defaultPlotFontEnumValue < (int)RiaFontCache::MIN_FONT_SIZE ) if ( defaultPlotFontEnumValue >= (int)RiaFontCache::MIN_FONT_SIZE )
{ {
defaultPlotFontSize = RiaFontCache::legacyEnumToPointSize( defaultPlotFontEnumValue ); defaultPlotFontSize = RiaFontCache::legacyEnumToPointSize( defaultPlotFontEnumValue );
} }

View File

@ -209,4 +209,9 @@ private:
caf::PdmField<caf::FilePath> m_defaultPlotTemplate; caf::PdmField<caf::FilePath> m_defaultPlotTemplate;
QStringList m_tabNames; QStringList m_tabNames;
caf::PdmField<FontSizeType> m_defaultSceneFontSize_OBSOLETE;
caf::PdmField<FontSizeType> m_defaultWellLabelFontSize_OBSOLETE;
caf::PdmField<FontSizeType> m_defaultAnnotationFontSize_OBSOLETE;
caf::PdmField<FontSizeType> m_defaultPlotFontSize_OBSOLETE;
}; };