mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -23,27 +23,27 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
template <>
|
||||
void RiaFontCache::FontSizeType::setUp()
|
||||
{
|
||||
addItem(RiaFontCache::FONT_SIZE_8, "8", "8");
|
||||
addItem(RiaFontCache::FONT_SIZE_10, "10", "10");
|
||||
addItem(RiaFontCache::FONT_SIZE_12, "12", "12");
|
||||
addItem(RiaFontCache::FONT_SIZE_14, "14", "14");
|
||||
addItem(RiaFontCache::FONT_SIZE_16, "16", "16");
|
||||
addItem(RiaFontCache::FONT_SIZE_24, "24", "24");
|
||||
addItem(RiaFontCache::FONT_SIZE_32, "32", "32");
|
||||
addItem( RiaFontCache::FONT_SIZE_8, "8", "8" );
|
||||
addItem( RiaFontCache::FONT_SIZE_10, "10", "10" );
|
||||
addItem( RiaFontCache::FONT_SIZE_12, "12", "12" );
|
||||
addItem( RiaFontCache::FONT_SIZE_14, "14", "14" );
|
||||
addItem( RiaFontCache::FONT_SIZE_16, "16", "16" );
|
||||
addItem( RiaFontCache::FONT_SIZE_24, "24", "24" );
|
||||
addItem( RiaFontCache::FONT_SIZE_32, "32", "32" );
|
||||
|
||||
setDefault(RiaFontCache::FONT_SIZE_8);
|
||||
}
|
||||
setDefault( RiaFontCache::FONT_SIZE_8 );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::FixedAtlasFont::FontSize mapToAtlasFontSize(RiaFontCache::FontSize fontSize)
|
||||
caf::FixedAtlasFont::FontSize mapToAtlasFontSize( RiaFontCache::FontSize fontSize )
|
||||
{
|
||||
switch (fontSize)
|
||||
switch ( fontSize )
|
||||
{
|
||||
case RiaFontCache::FONT_SIZE_8:
|
||||
return caf::FixedAtlasFont::POINT_SIZE_8;
|
||||
@@ -72,12 +72,12 @@ std::map<RiaFontCache::FontSize, cvf::ref<caf::FixedAtlasFont>> RiaFontCache::ms
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont(FontSize size)
|
||||
cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont( FontSize size )
|
||||
{
|
||||
if (ms_fonts.count(size) == 0)
|
||||
if ( ms_fonts.count( size ) == 0 )
|
||||
{
|
||||
auto newFont = new caf::FixedAtlasFont(mapToAtlasFontSize(size));
|
||||
ms_fonts.insert(std::make_pair(size, newFont));
|
||||
auto newFont = new caf::FixedAtlasFont( mapToAtlasFontSize( size ) );
|
||||
ms_fonts.insert( std::make_pair( size, newFont ) );
|
||||
}
|
||||
return ms_fonts[size];
|
||||
}
|
||||
@@ -85,9 +85,9 @@ cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont(FontSize size)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaFontCache::pointSizeFromFontSizeEnum(FontSize fontSize)
|
||||
int RiaFontCache::pointSizeFromFontSizeEnum( FontSize fontSize )
|
||||
{
|
||||
switch (fontSize)
|
||||
switch ( fontSize )
|
||||
{
|
||||
case RiaFontCache::FONT_SIZE_8:
|
||||
return 8;
|
||||
@@ -111,17 +111,17 @@ int RiaFontCache::pointSizeFromFontSizeEnum(FontSize fontSize)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize(int pointSize)
|
||||
RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize( int pointSize )
|
||||
{
|
||||
std::vector<FontSize> allValues =
|
||||
{ FONT_SIZE_8, FONT_SIZE_10, FONT_SIZE_12, FONT_SIZE_14, FONT_SIZE_16, FONT_SIZE_24, FONT_SIZE_32 };
|
||||
|
||||
{FONT_SIZE_8, FONT_SIZE_10, FONT_SIZE_12, FONT_SIZE_14, FONT_SIZE_16, FONT_SIZE_24, FONT_SIZE_32};
|
||||
|
||||
FontSize closestEnumValue = FONT_SIZE_8;
|
||||
int closestDiff = std::numeric_limits<int>::max();
|
||||
for (FontSize enumValue : allValues)
|
||||
for ( FontSize enumValue : allValues )
|
||||
{
|
||||
int diff = std::abs(pointSizeFromFontSizeEnum(enumValue) - pointSize);
|
||||
if (diff < closestDiff)
|
||||
int diff = std::abs( pointSizeFromFontSizeEnum( enumValue ) - pointSize );
|
||||
if ( diff < closestDiff )
|
||||
{
|
||||
closestEnumValue = enumValue;
|
||||
closestDiff = diff;
|
||||
|
||||
Reference in New Issue
Block a user