#4255 Read default plot font sizes from preferences and apply

This commit is contained in:
Gaute Lindkvist
2019-04-10 16:13:40 +02:00
parent 798e3ff19e
commit 9d06b59357
35 changed files with 679 additions and 202 deletions

View File

@@ -27,16 +27,19 @@
#include "RimIntersectionCollection.h"
#include "RimProject.h"
#include "RimPropertyFilterCollection.h"
#include "RimTextAnnotation.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimViewNameConfig.h"
#include "Riu3DMainWindowTools.h"
#include "RiuMainWindow.h"
#include "cvfModel.h"
#include "cvfScene.h"
#include "RiuMainWindow.h"
#include <set>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimGridView, "GenericGridView"); // Do not use. Abstract class
@@ -284,6 +287,45 @@ bool RimGridView::isGridVisualizationMode() const
return this->m_gridCollection->isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
{
bool hasCustomFonts = Rim3dView::hasCustomFontSizes(fontSettingType, defaultFontSize);
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
{
auto annotations = annotationCollection();
RiaFontCache::FontSize oldFontSize = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize) || hasCustomFonts;
}
return hasCustomFonts;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridView::applyFontSize(RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false*/)
{
bool anyChange = Rim3dView::applyFontSize(fontSettingType, oldFontSize, fontSize, forceChange);
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
{
auto annotations = annotationCollection();
RiaFontCache::FontSize oldFontSize = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
RiaFontCache::FontSize newFontSize = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize);
if (applyFontSizes)
{
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSize, newFontSize, forceChange) || anyChange;
}
}
return anyChange;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------