mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
First round of caf::FontTools
This commit is contained in:
@@ -150,6 +150,8 @@ Rim3dView::Rim3dView( void )
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size", "", "", "" );
|
||||
|
||||
m_intersectionVizModel = new cvf::ModelBasicList;
|
||||
m_intersectionVizModel->setName( "CrossSectionModel" );
|
||||
|
||||
@@ -385,6 +387,7 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
{
|
||||
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroupWithKeyword( "Viewer", "ViewGroup" );
|
||||
|
||||
viewGroup->add( &m_fontSize );
|
||||
viewGroup->add( &m_backgroundColor );
|
||||
viewGroup->add( &m_showZScaleLabel );
|
||||
viewGroup->add( &m_showGridBox );
|
||||
@@ -876,8 +879,17 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const
|
||||
m_viewer->update();
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_backgroundColor )
|
||||
else if ( changedField == &m_backgroundColor || changedField == &m_fontSize )
|
||||
{
|
||||
if ( changedField == &m_fontSize )
|
||||
{
|
||||
std::vector<caf::FontHolderInterface*> fontHolderChildren;
|
||||
descendantsOfType( fontHolderChildren );
|
||||
for ( auto fontHolder : fontHolderChildren )
|
||||
{
|
||||
fontHolder->updateFonts();
|
||||
}
|
||||
}
|
||||
this->applyBackgroundColorAndFontChanges();
|
||||
}
|
||||
else if ( changedField == &maximumFrameRate )
|
||||
@@ -996,7 +1008,7 @@ void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* measureModel )
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//---------------------------------------------------- ----------------------------------------------
|
||||
bool Rim3dView::isMasterView() const
|
||||
{
|
||||
RimViewLinker* viewLinker = this->assosiatedViewLinker();
|
||||
@@ -1040,7 +1052,11 @@ void Rim3dView::updateGridBoxData()
|
||||
}
|
||||
}
|
||||
|
||||
viewer()->updateGridBoxData( scaleZ(), ownerCase()->displayModelOffset(), backgroundColor(), combinedDomainBBox );
|
||||
viewer()->updateGridBoxData( scaleZ(),
|
||||
ownerCase()->displayModelOffset(),
|
||||
backgroundColor(),
|
||||
combinedDomainBBox,
|
||||
fontSize() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1204,11 +1220,28 @@ void Rim3dView::applyBackgroundColorAndFontChanges()
|
||||
if ( viewer() != nullptr )
|
||||
{
|
||||
viewer()->mainCamera()->viewport()->setClearColor( cvf::Color4f( backgroundColor() ) );
|
||||
viewer()->updateFonts();
|
||||
viewer()->updateFonts( fontSize() );
|
||||
}
|
||||
updateGridBoxData();
|
||||
updateAnnotationItems();
|
||||
onUpdateLegends();
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int Rim3dView::fontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultSceneFontSize(), m_fontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::updateFonts()
|
||||
{
|
||||
applyBackgroundColorAndFontChanges();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1311,30 +1344,6 @@ cvf::ref<caf::DisplayCoordTransform> Rim3dView::displayCoordTransform() const
|
||||
return coordTrans;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dView::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dView::applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false*/ )
|
||||
{
|
||||
if ( fontSettingType == RiaDefines::FontSettingType::SCENE_FONT )
|
||||
{
|
||||
applyBackgroundColorAndFontChanges();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1365,6 +1374,10 @@ QList<caf::PdmOptionItemInfo> Rim3dView::calculateValueOptions( const caf::PdmFi
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_fontSize )
|
||||
{
|
||||
options = caf::FontTools::relativeSizeValueOptions( RiaPreferences::current()->defaultSceneFontSize() );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user