#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

@@ -18,8 +18,6 @@
#include "RimAnnotationInViewCollection.h"
#include "RiaApplication.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationGroupCollection.h"
#include "RimAnnotationTextAppearance.h"
@@ -262,17 +260,31 @@ bool RimAnnotationInViewCollection::hasTextAnnotationsWithCustomFontSize(RiaFont
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize fontSize)
bool RimAnnotationInViewCollection::applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize oldFontSize,
RiaFontCache::FontSize fontSize,
bool forceChange)
{
bool anyChange = false;
for (auto annotation : textAnnotations())
{
annotation->appearance()->setFontSize(fontSize);
if (forceChange || annotation->appearance()->fontSize() == oldFontSize)
{
annotation->appearance()->setFontSize(fontSize);
annotation->updateConnectedEditors();
anyChange = true;
}
}
for (auto annotationInView : globalTextAnnotations())
{
annotationInView->sourceAnnotation()->appearance()->setFontSize(fontSize);
if (forceChange || annotationInView->sourceAnnotation()->appearance()->fontSize() == oldFontSize)
{
annotationInView->sourceAnnotation()->appearance()->setFontSize(fontSize);
annotationInView->updateConnectedEditors();
anyChange = true;
}
}
return anyChange;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -61,7 +61,7 @@ public:
size_t annotationsCount() const;
bool hasTextAnnotationsWithCustomFontSize(RiaFontCache::FontSize defaultFontSize) const;
void applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize fontSize);
bool applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize oldFontSize, RiaFontCache::FontSize fontSize, bool forceSizeChange = false);
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;