Make global labels have the same spin style as net/hierarchical labels

For legacy reasons, it stored left and right "spin" as flipped integers in the file format.
But the code handled the flip in multiple locations rather than just doing it on file io.
This change unifies the internal code and does the mapping in the file I/O.
This commit is contained in:
Mark Roszko
2020-01-08 19:07:55 +00:00
committed by Ian McInerney
parent fd0d5fdb38
commit ca34ade00c
19 changed files with 883 additions and 1017 deletions
-32
View File
@@ -54,38 +54,6 @@
class OUTPUTFORMATTER;
class wxFindReplaceData;
// Sadly we store the orientation of hierarchical and global labels using a different
// int encoding than that for local labels:
// Global Local
// Left justified 0 2
// Up 1 3
// Right justified 2 0
// Down 3 1
int EDA_TEXT::MapOrientation( KICAD_T labelType, int aOrientation )
{
if( labelType == SCH_LABEL_T )
return aOrientation;
switch( aOrientation )
{
case 0: return 2;
case 2: return 0;
default: return aOrientation;
}
}
int EDA_TEXT::MapOrientation( KICAD_T fromLabelType, KICAD_T toLabelType, int aOrientation )
{
bool fromNormal = ( ( fromLabelType == SCH_TEXT_T ) || ( fromLabelType == SCH_LABEL_T ) );
bool toNormal = ( ( toLabelType == SCH_TEXT_T ) || ( toLabelType == SCH_LABEL_T ) );
if( fromNormal != toNormal )
return MapOrientation( SCH_GLOBAL_LABEL_T, aOrientation );
else
return aOrientation;
}
EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify( int aHorizJustify )
{