#4256 Update fonts in Project and views when changing preferences

This commit is contained in:
Gaute Lindkvist
2019-04-10 12:49:20 +02:00
parent 0e0d78104b
commit 798e3ff19e
32 changed files with 411 additions and 129 deletions

View File

@@ -22,6 +22,7 @@
#include "RimAnnotationCollection.h"
#include "RimAnnotationGroupCollection.h"
#include "RimAnnotationTextAppearance.h"
#include "RimCase.h"
#include "RimProject.h"
#include "RimGridView.h"
@@ -234,6 +235,46 @@ size_t RimAnnotationInViewCollection::annotationsCount() const
return m_textAnnotations->m_annotations.size() + allGlobalPdmAnnotations().size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimAnnotationInViewCollection::hasTextAnnotationsWithCustomFontSize(RiaFontCache::FontSize defaultFontSize) const
{
for (auto annotation : textAnnotations())
{
if (annotation->appearance()->fontSize() != defaultFontSize)
{
return true;
}
}
for (auto annotationInView : globalTextAnnotations())
{
if (annotationInView->sourceAnnotation()->appearance()->fontSize() != defaultFontSize)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize fontSize)
{
for (auto annotation : textAnnotations())
{
annotation->appearance()->setFontSize(fontSize);
}
for (auto annotationInView : globalTextAnnotations())
{
annotationInView->sourceAnnotation()->appearance()->setFontSize(fontSize);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------