enum class SHEET_SIDE
This commit is contained in:
parent
5c543b62c5
commit
3ac5aa5369
|
@ -1691,10 +1691,10 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
|
|||
// For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
|
||||
switch( sheetPin->GetEdge() )
|
||||
{
|
||||
case SHEET_TOP_SIDE: offset_pos.y += KiROUND( width / 2.0 ); break;
|
||||
case SHEET_BOTTOM_SIDE: offset_pos.y -= KiROUND( width / 2.0 ); break;
|
||||
case SHEET_RIGHT_SIDE: offset_pos.x -= KiROUND( width / 2.0 ); break;
|
||||
case SHEET_LEFT_SIDE: offset_pos.x += KiROUND( width / 2.0 ); break;
|
||||
case SHEET_SIDE::TOP: offset_pos.y += KiROUND( width / 2.0 ); break;
|
||||
case SHEET_SIDE::BOTTOM: offset_pos.y -= KiROUND( width / 2.0 ); break;
|
||||
case SHEET_SIDE::RIGHT: offset_pos.x -= KiROUND( width / 2.0 ); break;
|
||||
case SHEET_SIDE::LEFT: offset_pos.x += KiROUND( width / 2.0 ); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1387,22 +1387,22 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
|
|||
case ASCH_SHEET_ENTRY_SIDE::LEFT:
|
||||
sheetPin->SetPosition( { pos.x, pos.y + elem.distanceFromTop } );
|
||||
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT );
|
||||
sheetPin->SetEdge( SHEET_SIDE::SHEET_LEFT_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::LEFT );
|
||||
break;
|
||||
case ASCH_SHEET_ENTRY_SIDE::RIGHT:
|
||||
sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.distanceFromTop } );
|
||||
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
|
||||
sheetPin->SetEdge( SHEET_SIDE::SHEET_RIGHT_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::RIGHT );
|
||||
break;
|
||||
case ASCH_SHEET_ENTRY_SIDE::TOP:
|
||||
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y } );
|
||||
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP );
|
||||
sheetPin->SetEdge( SHEET_SIDE::SHEET_TOP_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::TOP );
|
||||
break;
|
||||
case ASCH_SHEET_ENTRY_SIDE::BOTTOM:
|
||||
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y + size.y } );
|
||||
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM );
|
||||
sheetPin->SetEdge( SHEET_SIDE::SHEET_BOTTOM_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::BOTTOM );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1820,13 +1820,13 @@ SCH_SHEET_PIN* SCH_SEXPR_PARSER::parseSchSheetPin( SCH_SHEET* aSheet )
|
|||
double angle = parseDouble( "sheet pin angle (side)" );
|
||||
|
||||
if( angle == 0.0 )
|
||||
sheetPin->SetEdge( SHEET_RIGHT_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::RIGHT );
|
||||
else if( angle == 90.0 )
|
||||
sheetPin->SetEdge( SHEET_TOP_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::TOP );
|
||||
else if( angle == 180.0 )
|
||||
sheetPin->SetEdge( SHEET_LEFT_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::LEFT );
|
||||
else if( angle == 270.0 )
|
||||
sheetPin->SetEdge( SHEET_BOTTOM_SIDE );
|
||||
sheetPin->SetEdge( SHEET_SIDE::BOTTOM );
|
||||
else
|
||||
Expecting( "0, 90, 180, or 270" );
|
||||
|
||||
|
|
|
@ -213,11 +213,11 @@ static double getSheetPinAngle( SHEET_SIDE aSide )
|
|||
|
||||
switch( aSide )
|
||||
{
|
||||
case SHEET_UNDEFINED_SIDE:
|
||||
case SHEET_LEFT_SIDE: retv = 180.0; break;
|
||||
case SHEET_RIGHT_SIDE: retv = 0.0; break;
|
||||
case SHEET_TOP_SIDE: retv = 90.0; break;
|
||||
case SHEET_BOTTOM_SIDE: retv = 270.0; break;
|
||||
case SHEET_SIDE::UNDEFINED:
|
||||
case SHEET_SIDE::LEFT: retv = 180.0; break;
|
||||
case SHEET_SIDE::RIGHT: retv = 0.0; break;
|
||||
case SHEET_SIDE::TOP: retv = 90.0; break;
|
||||
case SHEET_SIDE::BOTTOM: retv = 270.0; break;
|
||||
default: wxFAIL; retv = 0.0; break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1054,10 +1054,10 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
|||
|
||||
switch( parseChar( aReader, line, &line ) )
|
||||
{
|
||||
case 'R': sheetPin->SetEdge( SHEET_RIGHT_SIDE ); break;
|
||||
case 'T': sheetPin->SetEdge( SHEET_TOP_SIDE ); break;
|
||||
case 'B': sheetPin->SetEdge( SHEET_BOTTOM_SIDE ); break;
|
||||
case 'L': sheetPin->SetEdge( SHEET_LEFT_SIDE ); break;
|
||||
case 'R': sheetPin->SetEdge( SHEET_SIDE::RIGHT ); break;
|
||||
case 'T': sheetPin->SetEdge( SHEET_SIDE::TOP ); break;
|
||||
case 'B': sheetPin->SetEdge( SHEET_SIDE::BOTTOM ); break;
|
||||
case 'L': sheetPin->SetEdge( SHEET_SIDE::LEFT ); break;
|
||||
default:
|
||||
SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line );
|
||||
}
|
||||
|
@ -2218,10 +2218,10 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
|||
switch( pin->GetEdge() )
|
||||
{
|
||||
default:
|
||||
case SHEET_LEFT_SIDE: side = 'L'; break;
|
||||
case SHEET_RIGHT_SIDE: side = 'R'; break;
|
||||
case SHEET_TOP_SIDE: side = 'T'; break;
|
||||
case SHEET_BOTTOM_SIDE: side = 'B'; break;
|
||||
case SHEET_SIDE::LEFT: side = 'L'; break;
|
||||
case SHEET_SIDE::RIGHT: side = 'R'; break;
|
||||
case SHEET_SIDE::TOP: side = 'T'; break;
|
||||
case SHEET_SIDE::BOTTOM: side = 'B'; break;
|
||||
}
|
||||
|
||||
switch( pin->GetShape() )
|
||||
|
|
|
@ -357,10 +357,10 @@ bool SCH_SHEET::IsVerticalOrientation() const
|
|||
{
|
||||
switch( pin->GetEdge() )
|
||||
{
|
||||
case SHEET_LEFT_SIDE: leftRight++; break;
|
||||
case SHEET_RIGHT_SIDE: leftRight++; break;
|
||||
case SHEET_TOP_SIDE: topBottom++; break;
|
||||
case SHEET_BOTTOM_SIDE: topBottom++; break;
|
||||
case SHEET_SIDE::LEFT: leftRight++; break;
|
||||
case SHEET_SIDE::RIGHT: leftRight++; break;
|
||||
case SHEET_SIDE::TOP: topBottom++; break;
|
||||
case SHEET_SIDE::BOTTOM: topBottom++; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -407,9 +407,9 @@ int SCH_SHEET::GetMinWidth( bool aFromLeft ) const
|
|||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
{
|
||||
int edge = m_pins[i]->GetEdge();
|
||||
SHEET_SIDE edge = m_pins[i]->GetEdge();
|
||||
|
||||
if( edge == SHEET_TOP_SIDE || edge == SHEET_BOTTOM_SIDE )
|
||||
if( edge == SHEET_SIDE::TOP || edge == SHEET_SIDE::BOTTOM )
|
||||
{
|
||||
EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
|
||||
|
||||
|
@ -441,9 +441,9 @@ int SCH_SHEET::GetMinHeight( bool aFromTop ) const
|
|||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
{
|
||||
int edge = m_pins[i]->GetEdge();
|
||||
SHEET_SIDE edge = m_pins[i]->GetEdge();
|
||||
|
||||
if( edge == SHEET_RIGHT_SIDE || edge == SHEET_LEFT_SIDE )
|
||||
if( edge == SHEET_SIDE::RIGHT || edge == SHEET_SIDE::LEFT )
|
||||
{
|
||||
EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) :
|
||||
SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ),
|
||||
m_edge( SHEET_UNDEFINED_SIDE )
|
||||
m_edge( SHEET_SIDE::UNDEFINED )
|
||||
{
|
||||
SetParent( parent );
|
||||
wxASSERT( parent );
|
||||
|
@ -49,9 +49,9 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr
|
|||
SetTextPos( pos );
|
||||
|
||||
if( parent->IsVerticalOrientation() )
|
||||
SetEdge( SHEET_TOP_SIDE );
|
||||
SetEdge( SHEET_SIDE::TOP );
|
||||
else
|
||||
SetEdge( SHEET_LEFT_SIDE );
|
||||
SetEdge( SHEET_SIDE::LEFT );
|
||||
|
||||
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
|
||||
m_isDangling = true;
|
||||
|
@ -117,25 +117,25 @@ void SCH_SHEET_PIN::SetEdge( SHEET_SIDE aEdge )
|
|||
|
||||
switch( aEdge )
|
||||
{
|
||||
case SHEET_LEFT_SIDE:
|
||||
case SHEET_SIDE::LEFT:
|
||||
m_edge = aEdge;
|
||||
SetTextX( Sheet->m_pos.x );
|
||||
SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); // Orientation horiz inverse
|
||||
break;
|
||||
|
||||
case SHEET_RIGHT_SIDE:
|
||||
case SHEET_SIDE::RIGHT:
|
||||
m_edge = aEdge;
|
||||
SetTextX( Sheet->m_pos.x + Sheet->m_size.x );
|
||||
SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); // Orientation horiz normal
|
||||
break;
|
||||
|
||||
case SHEET_TOP_SIDE:
|
||||
case SHEET_SIDE::TOP:
|
||||
m_edge = aEdge;
|
||||
SetTextY( Sheet->m_pos.y );
|
||||
SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); // Orientation vert BOTTOM
|
||||
break;
|
||||
|
||||
case SHEET_BOTTOM_SIDE:
|
||||
case SHEET_SIDE::BOTTOM:
|
||||
m_edge = aEdge;
|
||||
SetTextY( Sheet->m_pos.y + Sheet->m_size.y );
|
||||
SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); // Orientation vert UP
|
||||
|
@ -175,17 +175,17 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
|
|||
|
||||
switch( sheetEdge.NearestSegment( Pos ) )
|
||||
{
|
||||
case 0: SetEdge( SHEET_TOP_SIDE ); break;
|
||||
case 1: SetEdge( SHEET_RIGHT_SIDE ); break;
|
||||
case 2: SetEdge( SHEET_BOTTOM_SIDE ); break;
|
||||
case 3: SetEdge( SHEET_LEFT_SIDE ); break;
|
||||
case 0: SetEdge( SHEET_SIDE::TOP ); break;
|
||||
case 1: SetEdge( SHEET_SIDE::RIGHT ); break;
|
||||
case 2: SetEdge( SHEET_SIDE::BOTTOM ); break;
|
||||
case 3: SetEdge( SHEET_SIDE::LEFT ); break;
|
||||
default: wxASSERT( "Invalid segment number" );
|
||||
}
|
||||
|
||||
switch( GetEdge() )
|
||||
{
|
||||
case SHEET_RIGHT_SIDE:
|
||||
case SHEET_LEFT_SIDE:
|
||||
case SHEET_SIDE::RIGHT:
|
||||
case SHEET_SIDE::LEFT:
|
||||
SetTextY( Pos.y );
|
||||
|
||||
if( GetTextPos().y < topSide )
|
||||
|
@ -196,8 +196,8 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
|
|||
|
||||
break;
|
||||
|
||||
case SHEET_BOTTOM_SIDE:
|
||||
case SHEET_TOP_SIDE:
|
||||
case SHEET_SIDE::BOTTOM:
|
||||
case SHEET_SIDE::TOP:
|
||||
SetTextX( Pos.x );
|
||||
|
||||
if( GetTextPos().x < leftSide )
|
||||
|
@ -208,7 +208,7 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
|
|||
|
||||
break;
|
||||
|
||||
case SHEET_UNDEFINED_SIDE:
|
||||
case SHEET_SIDE::UNDEFINED:
|
||||
wxASSERT( "Undefined sheet side" );
|
||||
}
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ void SCH_SHEET_PIN::MirrorVertically( int aCenter )
|
|||
|
||||
switch( m_edge )
|
||||
{
|
||||
case SHEET_TOP_SIDE: SetEdge( SHEET_BOTTOM_SIDE ); break;
|
||||
case SHEET_BOTTOM_SIDE: SetEdge( SHEET_TOP_SIDE ); break;
|
||||
case SHEET_SIDE::TOP: SetEdge( SHEET_SIDE::BOTTOM ); break;
|
||||
case SHEET_SIDE::BOTTOM: SetEdge( SHEET_SIDE::TOP ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -237,8 +237,8 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
|
|||
|
||||
switch( m_edge )
|
||||
{
|
||||
case SHEET_LEFT_SIDE: SetEdge( SHEET_RIGHT_SIDE ); break;
|
||||
case SHEET_RIGHT_SIDE: SetEdge( SHEET_LEFT_SIDE ); break;
|
||||
case SHEET_SIDE::LEFT: SetEdge( SHEET_SIDE::RIGHT ); break;
|
||||
case SHEET_SIDE::RIGHT: SetEdge( SHEET_SIDE::LEFT ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,13 +42,13 @@ class SCH_SHEET;
|
|||
*
|
||||
* For compatibility reasons, this does not follow same values as text orientation.
|
||||
*/
|
||||
enum SHEET_SIDE
|
||||
enum class SHEET_SIDE
|
||||
{
|
||||
SHEET_LEFT_SIDE = 0,
|
||||
SHEET_RIGHT_SIDE,
|
||||
SHEET_TOP_SIDE,
|
||||
SHEET_BOTTOM_SIDE,
|
||||
SHEET_UNDEFINED_SIDE
|
||||
LEFT = 0,
|
||||
RIGHT,
|
||||
TOP,
|
||||
BOTTOM,
|
||||
UNDEFINED
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -591,11 +591,11 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
|
||||
switch( pin->GetEdge() )
|
||||
{
|
||||
case SHEET_LEFT_SIDE: pos.x = topLeft.x; break;
|
||||
case SHEET_RIGHT_SIDE: pos.x = topRight.x; break;
|
||||
case SHEET_TOP_SIDE: pos.y = topLeft.y; break;
|
||||
case SHEET_BOTTOM_SIDE: pos.y = botLeft.y; break;
|
||||
case SHEET_UNDEFINED_SIDE: break;
|
||||
case SHEET_SIDE::LEFT: pos.x = topLeft.x; break;
|
||||
case SHEET_SIDE::RIGHT: pos.x = topRight.x; break;
|
||||
case SHEET_SIDE::TOP: pos.y = topLeft.y; break;
|
||||
case SHEET_SIDE::BOTTOM: pos.y = botLeft.y; break;
|
||||
case SHEET_SIDE::UNDEFINED: break;
|
||||
}
|
||||
|
||||
pin->SetPosition( pos );
|
||||
|
|
|
@ -420,13 +420,13 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair<SCH_LINE*, SCH_L
|
|||
int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y;
|
||||
|
||||
const SCH_SHEET_PIN* connectedPin = getSheetPin( segment->GetStartPoint() );
|
||||
SHEET_SIDE force = connectedPin ? connectedPin->GetEdge() : SHEET_UNDEFINED_SIDE;
|
||||
SHEET_SIDE force = connectedPin ? connectedPin->GetEdge() : SHEET_SIDE::UNDEFINED;
|
||||
|
||||
if( force == SHEET_LEFT_SIDE || force == SHEET_RIGHT_SIDE )
|
||||
if( force == SHEET_SIDE::LEFT || force == SHEET_SIDE::RIGHT )
|
||||
{
|
||||
if( aPosition.x == connectedPin->GetPosition().x ) // push outside sheet boundary
|
||||
{
|
||||
int direction = ( force == SHEET_LEFT_SIDE ) ? -1 : 1;
|
||||
int direction = ( force == SHEET_SIDE::LEFT ) ? -1 : 1;
|
||||
aPosition.x += KiROUND( getView()->GetGAL()->GetGridSize().x * direction );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue