EDA_TEXT Get/SetTextSize should use VECTOR2I

This commit is contained in:
Marek Roszko 2022-05-14 08:12:03 -04:00
parent 5c7a79e287
commit 88c7322a0d
7 changed files with 12 additions and 13 deletions

View File

@ -344,7 +344,7 @@ void EDA_TEXT::SetLineSpacing( double aLineSpacing )
}
void EDA_TEXT::SetTextSize( const wxSize& aNewSize )
void EDA_TEXT::SetTextSize( const VECTOR2I& aNewSize )
{
m_attributes.m_Size = aNewSize;
ClearRenderCache();

View File

@ -530,7 +530,7 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
return StringFromBool( field.IsBold() );
case FDC_TEXT_SIZE:
return StringFromValue( m_frame->GetUserUnits(), field.GetTextSize().GetHeight(), true );
return StringFromValue( m_frame->GetUserUnits(), field.GetTextHeight(), true );
case FDC_ORIENTATION:
if( field.GetTextAngle().IsHorizontal() )

View File

@ -2827,9 +2827,9 @@ LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_SYMBOL* aSym
};
auto scaleSize =
[&]( wxSize aSize ) -> wxSize
[&]( VECTOR2I aSize ) -> VECTOR2I
{
return wxSize( scaleLen( aSize.x ), scaleLen( aSize.y ) );
return VECTOR2I( scaleLen( aSize.x ), scaleLen( aSize.y ) );
};
LIB_ITEMS_CONTAINER& items = retval->GetDrawItems();

View File

@ -569,9 +569,9 @@ int SCH_SHEET::GetPenWidth() const
void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
{
wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
VECTOR2I textSize = m_fields[SHEETNAME].GetTextSize();
int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
if( IsVerticalOrientation() )
{

View File

@ -192,9 +192,8 @@ public:
void SetLineSpacing( double aLineSpacing );
double GetLineSpacing() const { return m_attributes.m_LineSpacing; }
void SetTextSize( const wxSize& aNewSize );
wxSize GetTextSize() const { return wxSize( m_attributes.m_Size.x,
m_attributes.m_Size.y ); }
void SetTextSize( const VECTOR2I& aNewSize );
VECTOR2I GetTextSize() const { return m_attributes.m_Size; }
void SetTextWidth( int aWidth );
int GetTextWidth() const { return m_attributes.m_Size.x; }

View File

@ -76,7 +76,7 @@ public:
bool m_Visible = true;
bool m_Mirrored = false;
bool m_Multiline = true;
VECTOR2D m_Size;
VECTOR2I m_Size;
/**
* If true, keep rotation angle between -90...90 degrees for readability

View File

@ -1678,8 +1678,8 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
if( a.ratio )
ratio = *a.ratio;
wxSize fontz = aFPText->GetTextSize();
int textThickness = KiROUND( fontz.y * ratio / 100 );
VECTOR2I fontz = aFPText->GetTextSize();
int textThickness = KiROUND( fontz.y * ratio / 100 );
aFPText->SetTextThickness( textThickness );
if( a.size )