Eeschema Eagle Import: Changed convertTextSize() to ETEXT::ConvertSize()

This commit is contained in:
Maciej Suminski 2017-09-12 16:06:54 +02:00
parent 2a0a999350
commit ce11e9a264
3 changed files with 36 additions and 30 deletions

View File

@ -220,31 +220,6 @@ static int parseAlignment( const wxString& aAlignment )
}
// convert textsize method.
wxSize convertTextSize(ETEXT& etext ) {
wxSize textsize;
if(etext.font){
wxString font = etext.font.Get();
if(font == "vector")
{
textsize = wxSize( etext.size * EUNIT_TO_MIL, etext.size * EUNIT_TO_MIL );
}
else if ( font == "fixed")
{
textsize = wxSize( etext.size * EUNIT_TO_MIL, etext.size * EUNIT_TO_MIL*0.80 );
}
}
else
{
textsize = wxSize( etext.size * EUNIT_TO_MIL*0.85, etext.size * EUNIT_TO_MIL );
}
return textsize;
}
EWIRE::EWIRE( wxXmlNode* aWire )
{
/*
@ -519,6 +494,37 @@ ETEXT::ETEXT( wxXmlNode* aText )
}
wxSize ETEXT::ConvertSize() const
{
wxSize textsize;
if( font )
{
const wxString& fontName = font.CGet();
if( fontName == "vector" )
{
textsize = wxSize( size * EUNIT_TO_MIL, size * EUNIT_TO_MIL );
}
else if( fontName == "fixed" )
{
textsize = wxSize( size * EUNIT_TO_MIL, size * EUNIT_TO_MIL * 0.80 );
}
else
{
wxASSERT( false );
textsize = wxSize( size * EUNIT_TO_MIL, size * EUNIT_TO_MIL );
}
}
else
{
textsize = wxSize( size * EUNIT_TO_MIL * 0.85, size * EUNIT_TO_MIL );
}
return textsize;
}
EPAD::EPAD( wxXmlNode* aPad )
{
/*

View File

@ -1729,7 +1729,7 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText( std::unique_ptr<LIB_PART>& aPart,
libtext->SetUnit( aGateNumber );
libtext->SetPosition( wxPoint( etext.x * EUNIT_TO_MIL, etext.y * EUNIT_TO_MIL ) );
libtext->SetText( aLibText->GetNodeContent() );
libtext->SetTextSize( convertTextSize( etext ) );
libtext->SetTextSize( etext.ConvertSize() );
if( etext.ratio )
{
@ -1773,8 +1773,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadPlainText( wxXmlNode* aSchText )
}
}
schtext->SetTextSize( convertTextSize( etext ) );
schtext->SetTextSize( etext.ConvertSize() );
int align = etext.align ? *etext.align : ETEXT::BOTTOM_LEFT;
int degrees = etext.rot ? etext.rot->degrees : 0;

View File

@ -600,10 +600,11 @@ struct ETEXT
opt_int align;
ETEXT( wxXmlNode* aText );
/// Calculate text size based on font type and size
wxSize ConvertSize() const;
};
/// Calculate text size based on font type and size;
wxSize convertTextSize(ETEXT& etext );
/// Eagle thru hol pad
struct EPAD