CADSTAR Schematic: Load text sizes for pin names/numbers and net labels
This commit is contained in:
parent
0aa37d1173
commit
be9ff7a7d5
|
@ -611,8 +611,18 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
|||
|
||||
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
|
||||
netLabel->SetPosition( getKiCadPoint( sym.Origin + terminalPosOffset ) );
|
||||
netLabel->SetText( "YOU SHOULDN'T SEE THIS TEXT - PLEASE REPORT THIS BUG" );
|
||||
netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist
|
||||
netLabel->SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) );
|
||||
|
||||
SYMDEF_SCM symbolDef = Library.SymbolDefinitions.at( sym.SymdefID );
|
||||
|
||||
if( symbolDef.TextLocations.count( LINK_ORIGIN_ATTRID ) )
|
||||
{
|
||||
TEXT_LOCATION linkOrigin = symbolDef.TextLocations.at( LINK_ORIGIN_ATTRID );
|
||||
applyTextSettings( netLabel, linkOrigin.TextCodeID, linkOrigin.Alignment,
|
||||
linkOrigin.Justification );
|
||||
}
|
||||
|
||||
netLabel->SetLabelSpinStyle( getSpinStyle( sym.OrientAngle, sym.Mirror ) );
|
||||
|
||||
if( libSymDef.Alternate.Lower().Contains( "in" ) )
|
||||
|
@ -852,8 +862,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
|||
}
|
||||
else
|
||||
{
|
||||
const int smallText = KiROUND( (double) SCH_IU_PER_MM * 0.4 );
|
||||
label->SetTextSize( wxSize( smallText, smallText ) );
|
||||
label->SetTextSize( wxSize( SMALL_LABEL_SIZE, SMALL_LABEL_SIZE ) );
|
||||
}
|
||||
|
||||
netlabels.insert( { busTerm.ID, label } );
|
||||
|
@ -865,9 +874,18 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
|||
NET_SCH::DANGLER dangler = danglerPair.second;
|
||||
|
||||
SCH_LABEL* label = new SCH_LABEL();
|
||||
label->SetText( netName );
|
||||
label->SetPosition( getKiCadPoint( dangler.Position ) );
|
||||
label->SetVisible( true );
|
||||
|
||||
if( dangler.HasNetLabel )
|
||||
{
|
||||
applyTextSettings( label,
|
||||
dangler.NetLabel.TextCodeID,
|
||||
dangler.NetLabel.Alignment,
|
||||
dangler.NetLabel.Justification );
|
||||
}
|
||||
|
||||
label->SetText( netName ); // set text after applying settings to avoid double-escaping
|
||||
netlabels.insert( { dangler.ID, label } );
|
||||
|
||||
m_sheetMap.at( dangler.LayerID )->GetScreen()->Append( label );
|
||||
|
@ -1273,6 +1291,24 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
|||
pin->SetNumber( pinNum );
|
||||
pin->SetName( pinName );
|
||||
|
||||
int pinNumberHeight = getTextHeightFromTextCode( wxT( "TC0" ) ); // TC0 is the default CADSTAR text size for name/number
|
||||
int pinNameHeight = getTextHeightFromTextCode( wxT( "TC0" ) );
|
||||
|
||||
if( symbol.PinNumberLocations.count( term.ID ) )
|
||||
{
|
||||
PIN_NUM_LABEL_LOC pinNumLocation = symbol.PinNumberLocations.at( term.ID );
|
||||
pinNumberHeight = getTextHeightFromTextCode( pinNumLocation.TextCodeID );
|
||||
}
|
||||
|
||||
if( symbol.PinLabelLocations.count( term.ID ) )
|
||||
{
|
||||
PIN_NUM_LABEL_LOC pinNameLocation = symbol.PinLabelLocations.at( term.ID );
|
||||
pinNameHeight = getTextHeightFromTextCode( pinNameLocation.TextCodeID );
|
||||
}
|
||||
|
||||
pin->SetNumberTextSize( pinNumberHeight );
|
||||
pin->SetNameTextSize( pinNameHeight );
|
||||
|
||||
if( aSymbol->IsPower() )
|
||||
{
|
||||
pin->SetVisible( false );
|
||||
|
@ -2293,6 +2329,14 @@ CADSTAR_SCH_ARCHIVE_LOADER::TEXTCODE CADSTAR_SCH_ARCHIVE_LOADER::getTextCode(
|
|||
}
|
||||
|
||||
|
||||
int CADSTAR_SCH_ARCHIVE_LOADER::getTextHeightFromTextCode( const TEXTCODE_ID& aCadstarTextCodeID )
|
||||
{
|
||||
TEXTCODE txtCode = getTextCode( aCadstarTextCodeID );
|
||||
|
||||
return KiROUND( (double) getKiCadLength( txtCode.Height ) * TXT_HEIGHT_RATIO );
|
||||
}
|
||||
|
||||
|
||||
wxString CADSTAR_SCH_ARCHIVE_LOADER::getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID )
|
||||
{
|
||||
wxCHECK( Assignments.Codedefs.AttributeNames.find( aCadstarAttributeID )
|
||||
|
|
|
@ -52,6 +52,9 @@ class SCHEMATIC;
|
|||
class CADSTAR_SCH_ARCHIVE_LOADER : public CADSTAR_SCH_ARCHIVE_PARSER
|
||||
{
|
||||
public:
|
||||
// Size of tiny net labels when none present in original design
|
||||
const int SMALL_LABEL_SIZE = KiROUND( (double) SCH_IU_PER_MM * 0.4 );
|
||||
|
||||
explicit CADSTAR_SCH_ARCHIVE_LOADER( wxString aFilename, REPORTER* aReporter )
|
||||
: CADSTAR_SCH_ARCHIVE_PARSER( aFilename )
|
||||
{
|
||||
|
@ -196,6 +199,7 @@ private:
|
|||
PART getPart( const PART_ID& aCadstarPartID );
|
||||
ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
|
||||
TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
|
||||
int getTextHeightFromTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
|
||||
wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
|
||||
|
||||
PART::DEFINITION::PIN getPartDefinitionPin(
|
||||
|
|
Loading…
Reference in New Issue