First round of caf::FontTools

This commit is contained in:
Gaute Lindkvist
2020-05-09 11:23:58 +02:00
parent 0e70cf809c
commit 2fe4372dc2
86 changed files with 1021 additions and 966 deletions

View File

@@ -1393,7 +1393,8 @@ void RiaGuiApplication::onProgramExit()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreferences )
void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreferences,
const std::vector<caf::FontHolderInterface*>& defaultFontObjects )
{
if ( m_activeReservoirView && m_activeReservoirView->viewer() )
{
@@ -1418,7 +1419,10 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
m_preferences->appendClassNameToUiText() );
}
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes = m_preferences->defaultFontSizes();
for ( auto fontObject : defaultFontObjects )
{
fontObject->updateFonts();
}
if ( this->project() )
{
@@ -1457,13 +1461,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
existingViewsWithCustomZScale = true;
}
RimGridView* gridView = dynamic_cast<RimGridView*>( rim3dView );
if ( gridView && gridView->annotationCollection() )
{
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
existingObjectsWithCustomFonts =
gridView->annotationCollection()->hasTextAnnotationsWithCustomFontSize( oldFontSize );
}
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( rim3dView );
if ( eclipseView )
{
@@ -1475,18 +1472,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
}
}
}
for ( auto fontTypeSizePair : fontSizes )
{
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultFontSizes()[fontTypeSizePair.first];
if ( oldFontSize != fontTypeSizePair.second )
{
if ( viewWindow->hasCustomFontSizes( fontTypeSizePair.first, oldFontSize ) )
{
existingObjectsWithCustomFonts = true;
}
}
}
}
if ( oldPreferences->defaultWellLabelColor() != wellPathCollection->wellPathLabelColor() )
@@ -1525,16 +1510,6 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* oldPreference
for ( auto viewWindow : allViewWindows )
{
for ( auto fontTypeSizePair : fontSizes )
{
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultFontSizes()[fontTypeSizePair.first];
int newFontSize = fontTypeSizePair.second;
if ( oldFontSize != newFontSize )
{
viewWindow->applyFontSize( fontTypeSizePair.first, oldFontSize, newFontSize, applySettingsToAllViews );
}
}
auto rim3dView = dynamic_cast<Rim3dView*>( viewWindow );
if ( rim3dView )
{