Commit 9dce6fba authored by Wayne Stambaugh's avatar Wayne Stambaugh

Encapsulate SCH_JUNCTION, SCH_LINE, and SCH_NO_CONNECT classes.

parent 16131a50
......@@ -88,7 +88,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint( CurrentLine, endpos );
else
CurrentLine->m_End = endpos;
CurrentLine->SetEndPoint( endpos );
segment = CurrentLine;
......@@ -201,7 +201,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if( nextsegment )
{
newsegment = new SCH_LINE( *nextsegment );
nextsegment->m_Start = newsegment->m_End;
nextsegment->SetStartPoint( newsegment->GetEndPoint() );
nextsegment->SetNext( NULL );
nextsegment->SetBack( newsegment );
newsegment->SetNext( nextsegment );
......@@ -210,10 +210,10 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
else
{
newsegment = new SCH_LINE( *oldsegment );
newsegment->m_Start = oldsegment->m_End;
newsegment->SetStartPoint( oldsegment->GetEndPoint() );
}
newsegment->m_End = cursorpos;
newsegment->SetEndPoint( cursorpos );
oldsegment->ClearFlags( IS_NEW );
oldsegment->SetFlags( SELECTED );
newsegment->SetFlags( IS_NEW );
......@@ -224,7 +224,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
* Create a junction if needed. Note: a junction can be needed later,
* if the new segment is merged (after a cleanup) with an older one
* (tested when the connection will be finished)*/
if( oldsegment->m_Start == s_ConnexionStartPoint )
if( oldsegment->GetStartPoint() == s_ConnexionStartPoint )
{
if( GetScreen()->IsJunctionNeeded( s_ConnexionStartPoint ) )
AddJunction( DC, s_ConnexionStartPoint );
......@@ -288,14 +288,14 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
wxPoint end_point, alt_end_point;
/* A junction can be needed to connect the last segment
* usually to m_End coordinate.
* usually to m_end coordinate.
* But if the last segment is removed by a cleanup, because of redundancy,
* a junction can be needed to connect the previous segment m_End
* coordinate with is also the lastsegment->m_Start coordinate */
* a junction can be needed to connect the previous segment m_end
* coordinate with is also the lastsegment->m_start coordinate */
if( lastsegment )
{
end_point = lastsegment->m_End;
alt_end_point = lastsegment->m_Start;
end_point = lastsegment->GetEndPoint();
alt_end_point = lastsegment->GetStartPoint();
}
GetScreen()->SchematicCleanUp( DrawPanel );
......@@ -373,37 +373,36 @@ static void ComputeBreakPoint( SCH_LINE* aSegment, const wxPoint& aPosition )
if( nextsegment == NULL )
return;
#if 0
if( ABS( middle_position.x - aSegment->m_Start.x ) <
ABS( middle_position.y - aSegment->m_Start.y ) )
middle_position.x = aSegment->m_Start.x;
if( ABS( middle_position.x - aSegment->GetStartPoint().x ) <
ABS( middle_position.y - aSegment->GetStartPoint().y ) )
middle_position.x = aSegment->GetStartPoint().x;
else
middle_position.y = aSegment->m_Start.y;
middle_position.y = aSegment->GetStartPoint().y;
#else
int iDx = aSegment->m_End.x - aSegment->m_Start.x;
int iDy = aSegment->m_End.y - aSegment->m_Start.y;
int iDx = aSegment->GetEndPoint().x - aSegment->GetStartPoint().x;
int iDy = aSegment->GetEndPoint().y - aSegment->GetStartPoint().y;
if( iDy != 0 ) // keep the first segment orientation (currently horizontal)
{
middle_position.x = aSegment->m_Start.x;
middle_position.x = aSegment->GetStartPoint().x;
}
else if( iDx != 0 ) // keep the first segment orientation (currently vertical)
{
middle_position.y = aSegment->m_Start.y;
middle_position.y = aSegment->GetStartPoint().y;
}
else
{
if( ABS( middle_position.x - aSegment->m_Start.x ) <
ABS( middle_position.y - aSegment->m_Start.y ) )
middle_position.x = aSegment->m_Start.x;
if( ABS( middle_position.x - aSegment->GetStartPoint().x ) <
ABS( middle_position.y - aSegment->GetStartPoint().y ) )
middle_position.x = aSegment->GetStartPoint().x;
else
middle_position.y = aSegment->m_Start.y;
middle_position.y = aSegment->GetStartPoint().y;
}
#endif
aSegment->m_End = middle_position;
nextsegment->m_Start = middle_position;
nextsegment->m_End = aPosition;
aSegment->SetEndPoint( middle_position );
nextsegment->SetStartPoint( middle_position );
nextsegment->SetEndPoint( aPosition );
}
......
......@@ -578,7 +578,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
// Add global label command only if the cursor is over one end of the wire.
if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) )
if( Wire->IsEndPoint( pos ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
KiBitmap( add_glabel_xpm ) );
}
......@@ -608,7 +608,7 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
// Add global label command only if the cursor is over one end of the bus.
if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) )
if( Bus->IsEndPoint( pos ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
KiBitmap( add_glabel_xpm ) );
}
......
......@@ -46,9 +46,9 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_JUNCTION_T )
{
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */
m_Pos = pos;
m_pos = pos;
m_Layer = LAYER_JUNCTION;
m_Size.x = m_Size.y = DRAWJUNCTION_DIAMETER;
m_size.x = m_size.y = DRAWJUNCTION_DIAMETER;
#undef DRAWJUNCTION_DIAMETER
}
......@@ -56,8 +56,8 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_JUNCTION::SCH_JUNCTION( const SCH_JUNCTION& aJunction ) :
SCH_ITEM( aJunction )
{
m_Pos = aJunction.m_Pos;
m_Size = aJunction.m_Size;
m_pos = aJunction.m_pos;
m_size = aJunction.m_size;
}
......@@ -65,7 +65,7 @@ bool SCH_JUNCTION::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "Connection ~ %-4d %-4d\n", m_Pos.x, m_Pos.y ) == EOF )
if( fprintf( aFile, "Connection ~ %-4d %-4d\n", m_pos.x, m_pos.y ) == EOF )
{
success = false;
}
......@@ -86,8 +86,8 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
wxT( "Cannot swap junction data with invalid item." ) );
SCH_JUNCTION* item = (SCH_JUNCTION*) aItem;
EXCHG( m_Pos, item->m_Pos );
EXCHG( m_Size, item->m_Size );
EXCHG( m_pos, item->m_pos );
EXCHG( m_size, item->m_size );
}
......@@ -99,7 +99,7 @@ bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %d %d", name, &m_Pos.x, &m_Pos.y ) != 3 )
if( sscanf( line, "%s %d %d", name, &m_pos.x, &m_pos.y ) != 3 )
{
aErrorMsg.Printf( wxT( "Eeschema file connection load error at line %d, aborted" ),
aLine.LineNumber() );
......@@ -115,8 +115,8 @@ EDA_RECT SCH_JUNCTION::GetBoundingBox() const
{
EDA_RECT rect;
rect.SetOrigin( m_Pos );
rect.Inflate( ( GetPenSize() + m_Size.x ) / 2 );
rect.SetOrigin( m_pos );
rect.Inflate( ( GetPenSize() + m_size.x ) / 2 );
return rect;
}
......@@ -134,36 +134,36 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
GRSetDrawMode( aDC, aDrawMode );
GRFilledCircle( &aPanel->m_ClipBox, aDC, m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
( m_Size.x / 2 ), 0, color, color );
GRFilledCircle( &aPanel->m_ClipBox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
( m_size.x / 2 ), 0, color, color );
}
void SCH_JUNCTION::Mirror_X( int aXaxis_position )
{
m_Pos.y -= aXaxis_position;
NEGATE( m_Pos.y );
m_Pos.y += aXaxis_position;
m_pos.y -= aXaxis_position;
NEGATE( m_pos.y );
m_pos.y += aXaxis_position;
}
void SCH_JUNCTION::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position;
m_pos.x -= aYaxis_position;
NEGATE( m_pos.x );
m_pos.x += aYaxis_position;
}
void SCH_JUNCTION::Rotate( wxPoint rotationPoint )
{
RotatePoint( &m_Pos, rotationPoint, 900 );
RotatePoint( &m_pos, rotationPoint, 900 );
}
void SCH_JUNCTION::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{
DANGLING_END_ITEM item( JUNCTION_END, this, m_Pos );
DANGLING_END_ITEM item( JUNCTION_END, this, m_pos );
aItemList.push_back( item );
}
......@@ -172,7 +172,7 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
if( aRect.Contains( m_pos ) )
m_Flags |= SELECTED;
else
m_Flags &= ~SELECTED;
......@@ -183,7 +183,7 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect )
void SCH_JUNCTION::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{
aPoints.push_back( m_Pos );
aPoints.push_back( m_pos );
}
......@@ -196,7 +196,7 @@ void SCH_JUNCTION::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_JUNCTION;
item->m_Start = item->m_End = m_Pos;
item->m_Start = item->m_End = m_pos;
aNetListItems.push_back( item );
}
......@@ -208,7 +208,7 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
// XML output:
wxString s = GetClass();
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_Pos << "/>\n";
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_pos << "/>\n";
}
#endif
......@@ -238,12 +238,12 @@ bool SCH_JUNCTION::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur
bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
{
return m_Pos == aPosition;
return m_pos == aPosition;
}
void SCH_JUNCTION::doPlot( PLOTTER* aPlotter )
{
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->circle( m_Pos, m_Size.x, FILLED_SHAPE );
aPlotter->circle( m_pos, m_size.x, FILLED_SHAPE );
}
......@@ -36,10 +36,8 @@
class SCH_JUNCTION : public SCH_ITEM
{
wxPoint m_Pos; /* XY coordinates of connection. */
public:
wxSize m_Size;
wxPoint m_pos; /* XY coordinates of connection. */
wxSize m_size;
public:
SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
......@@ -94,7 +92,7 @@ public:
*/
virtual void Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
m_pos += aMoveVector;
}
/**
......@@ -133,8 +131,8 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
virtual wxPoint doGetPosition() const { return m_pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
};
......
This diff is collapsed.
......@@ -41,13 +41,11 @@
*/
class SCH_LINE : public SCH_ITEM
{
bool m_StartIsDangling;
bool m_EndIsDangling; // true if not connected (wires, tracks...)
public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
bool m_startIsDangling; ///< True if start point is not connected.
bool m_endIsDangling; ///< True if end point is not connected.
int m_width; ///< Set to 0 for wires and greater than 0 for busses.
wxPoint m_start; ///< Line start point
wxPoint m_end; ///< Line end point
public:
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
......@@ -64,10 +62,18 @@ public:
bool IsEndPoint( const wxPoint& aPoint ) const
{
return aPoint == m_Start || aPoint == m_End;
return aPoint == m_start || aPoint == m_end;
}
bool IsNull() const { return m_Start == m_End; }
bool IsNull() const { return m_start == m_end; }
wxPoint GetStartPoint() const { return m_start; }
void SetStartPoint( const wxPoint& aPosition ) { m_start = aPosition; }
wxPoint GetEndPoint() const { return m_end; }
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
/**
* Function GetBoundingBox
......@@ -145,7 +151,7 @@ public:
virtual bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDangling() const { return m_StartIsDangling || m_EndIsDangling; }
virtual bool IsDangling() const { return m_startIsDangling || m_endIsDangling; }
virtual bool IsSelectStateChanged( const wxRect& aRect );
......@@ -176,7 +182,7 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Start; }
virtual wxPoint doGetPosition() const { return m_start; }
virtual void doSetPosition( const wxPoint& aPosition );
};
......
......@@ -47,8 +47,8 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_NO_CONNECT_T )
{
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
m_Pos = pos;
m_Size.x = m_Size.y = DRAWNOCONNECT_SIZE;
m_pos = pos;
m_size.x = m_size.y = DRAWNOCONNECT_SIZE;
#undef DRAWNOCONNECT_SIZE
SetLayer( LAYER_NOCONNECT );
......@@ -58,8 +58,8 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_NO_CONNECT::SCH_NO_CONNECT( const SCH_NO_CONNECT& aNoConnect ) :
SCH_ITEM( aNoConnect )
{
m_Pos = aNoConnect.m_Pos;
m_Size = aNoConnect.m_Size;
m_pos = aNoConnect.m_pos;
m_size = aNoConnect.m_size;
}
......@@ -75,17 +75,17 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
wxT( "Cannot swap no connect data with invalid item." ) );
SCH_NO_CONNECT* item = (SCH_NO_CONNECT*)aItem;
EXCHG( m_Pos, item->m_Pos );
EXCHG( m_Size, item->m_Size );
EXCHG( m_pos, item->m_pos );
EXCHG( m_size, item->m_size );
}
EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
{
int delta = ( GetPenSize() + m_Size.x ) / 2;
int delta = ( GetPenSize() + m_size.x ) / 2;
EDA_RECT box;
box.SetOrigin( m_Pos );
box.SetOrigin( m_pos );
box.Inflate( delta );
return box;
......@@ -96,7 +96,7 @@ bool SCH_NO_CONNECT::Save( FILE* aFile ) const
{
bool success = true;
if( fprintf( aFile, "NoConn ~ %-4d %-4d\n", m_Pos.x, m_Pos.y ) == EOF )
if( fprintf( aFile, "NoConn ~ %-4d %-4d\n", m_pos.x, m_pos.y ) == EOF )
{
success = false;
}
......@@ -113,7 +113,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %d %d", name, &m_Pos.x, &m_Pos.y ) != 3 )
if( sscanf( line, "%s %d %d", name, &m_pos.x, &m_pos.y ) != 3 )
{
aErrorMsg.Printf( wxT( "Eeschema file No Connect load error at line %d" ),
aLine.LineNumber() );
......@@ -135,11 +135,11 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
int aDrawMode, int aColor )
{
int pX, pY, color;
int delta = m_Size.x / 2;
int delta = m_size.x / 2;
int width = g_DrawDefaultLineThickness;
pX = m_Pos.x + aOffset.x;
pY = m_Pos.y + aOffset.y;
pX = m_pos.x + aOffset.x;
pY = m_pos.y + aOffset.y;
if( aColor >= 0 )
color = aColor;
......@@ -155,23 +155,23 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
void SCH_NO_CONNECT::Mirror_X( int aXaxis_position )
{
m_Pos.y -= aXaxis_position;
NEGATE( m_Pos.y );
m_Pos.y += aXaxis_position;
m_pos.y -= aXaxis_position;
NEGATE( m_pos.y );
m_pos.y += aXaxis_position;
}
void SCH_NO_CONNECT::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position;
m_pos.x -= aYaxis_position;
NEGATE( m_pos.x );
m_pos.x += aYaxis_position;
}
void SCH_NO_CONNECT::Rotate( wxPoint rotationPoint )
{
RotatePoint( &m_Pos, rotationPoint, 900 );
RotatePoint( &m_pos, rotationPoint, 900 );
}
......@@ -179,7 +179,7 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
if( aRect.Contains( m_pos ) )
m_Flags |= SELECTED;
else
m_Flags &= ~SELECTED;
......@@ -190,7 +190,7 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{
aPoints.push_back( m_Pos );
aPoints.push_back( m_pos );
}
......@@ -203,7 +203,7 @@ void SCH_NO_CONNECT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = this;
item->m_Type = NET_NOCONNECT;
item->m_Start = item->m_End = m_Pos;
item->m_Start = item->m_End = m_pos;
aNetListItems.push_back( item );
}
......@@ -211,14 +211,14 @@ void SCH_NO_CONNECT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
{
return m_Pos == aPosition;
return m_pos == aPosition;
}
bool SCH_NO_CONNECT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
int delta = ( ( m_Size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy;
int delta = ( ( m_size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy;
wxPoint dist = aPoint - m_Pos;
wxPoint dist = aPoint - m_pos;
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
return true;
......@@ -242,11 +242,11 @@ bool SCH_NO_CONNECT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAcc
void SCH_NO_CONNECT::doPlot( PLOTTER* aPlotter )
{
int delta = m_Size.x / 2;
int delta = m_size.x / 2;
int pX, pY;
pX = m_Pos.x;
pY = m_Pos.y;
pX = m_pos.x;
pY = m_pos.y;
aPlotter->set_current_line_width( GetPenSize() );
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
......
......@@ -36,10 +36,8 @@
class SCH_NO_CONNECT : public SCH_ITEM
{
wxPoint m_Pos; /* XY coordinates of NoConnect. */
public:
wxSize m_Size; // size of this symbol
wxPoint m_pos; ///< Position of the no connect object.
wxSize m_size; ///< Size of the no connect object.
public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
......@@ -101,7 +99,7 @@ public:
*/
virtual void Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
m_pos += aMoveVector;
}
/**
......@@ -134,8 +132,8 @@ private:
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
virtual wxPoint doGetPosition() const { return m_pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
};
......
......@@ -259,6 +259,7 @@ void SCH_SCREEN::AddToDrawList( SCH_ITEM* aItem )
{
if( aItem == NULL )
return;
aItem->SetNext( GetDrawItems() );
SetDrawItems( aItem );
}
......@@ -393,13 +394,15 @@ void SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
SCH_LINE* segment = (SCH_LINE*) item;
if( aSegment->IsEndPoint( segment->m_Start ) && !GetPin( segment->m_Start, NULL, true ) )
if( aSegment->IsEndPoint( segment->GetStartPoint() )
&& !GetPin( segment->GetStartPoint(), NULL, true ) )
{
item->SetFlags( CANDIDATE );
MarkConnections( segment );
}
if( aSegment->IsEndPoint( segment->m_End ) && !GetPin( segment->m_End, NULL, true ) )
if( aSegment->IsEndPoint( segment->GetEndPoint() )
&& !GetPin( segment->GetEndPoint(), NULL, true ) )
{
item->SetFlags( CANDIDATE );
MarkConnections( segment );
......@@ -671,17 +674,21 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
{
pin = NULL;
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() );
if( entry == NULL )
continue;
for( pin = entry->GetNextPin(); pin != NULL; pin = entry->GetNextPin( pin ) )
{
// Skip items not used for this part.
if( component->GetUnit() && pin->GetUnit() &&
( pin->GetUnit() != component->GetUnit() ) )
continue;
if( component->GetConvert() && pin->GetConvert() &&
( pin->GetConvert() != component->GetConvert() ) )
continue;
if(component->GetPinPhysicalPosition( pin ) == aPosition )
break;
}
......@@ -691,6 +698,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
else
{
pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T );
if( pin )
break;
}
......@@ -879,9 +887,9 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
SCH_LINE* line = (SCH_LINE*) item;
if( line->m_Start == position )
if( line->GetStartPoint() == position )
item->ClearFlags( STARTPOINT );
else if( line->m_End == position )
else if( line->GetEndPoint() == position )
item->ClearFlags( ENDPOINT );
}
else
......@@ -962,8 +970,8 @@ bool SCH_SCREEN::BreakSegment( const wxPoint& aPoint )
// Break the segment at aPoint and create a new segment.
newSegment = new SCH_LINE( *segment );
newSegment->m_Start = aPoint;
segment->m_End = newSegment->m_Start;
newSegment->GetStartPoint() = aPoint;
segment->GetEndPoint() = newSegment->GetStartPoint();
newSegment->SetNext( segment->Next() );
segment->SetNext( newSegment );
item = newSegment;
......@@ -991,7 +999,8 @@ bool SCH_SCREEN::BreakSegmentsOnJunctions()
{
SCH_BUS_ENTRY* busEntry = ( SCH_BUS_ENTRY* ) item;
if( BreakSegment( busEntry->GetPosition() ) || BreakSegment( busEntry->m_End() ) )
if( BreakSegment( busEntry->GetPosition() )
|| BreakSegment( busEntry->m_End() ) )
brokenSegments = true;
}
}
......@@ -1117,6 +1126,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
fpfield->m_Pos = component->GetField( VALUE )->m_Pos;
fpfield->m_Size = component->GetField( VALUE )->m_Size;
if( fpfield->m_Orient == 0 )
fpfield->m_Pos.y += 100;
else
......@@ -1210,14 +1220,14 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
SCH_LINE* testSegment = (SCH_LINE*) tmp;
// Test for segment connected to the previously deleted segment:
if( testSegment->IsEndPoint( segment->m_Start ) )
if( testSegment->IsEndPoint( segment->GetStartPoint() ) )
break;
}
// when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the start point is not connected to an other item (like pin)
if( tmp && !CountConnectedItems( segment->m_Start, true ) )
if( tmp && !CountConnectedItems( segment->GetStartPoint(), true ) )
noconnect = true;
/* If the wire end point is connected to a wire that has already been found
......@@ -1234,14 +1244,14 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
SCH_LINE* testSegment = (SCH_LINE*) tmp;
// Test for segment connected to the previously deleted segment:
if( testSegment->IsEndPoint( segment->m_End ) )
if( testSegment->IsEndPoint( segment->GetEndPoint() ) )
break;
}
// when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the end point is not connected to an other item (like pin)
if( tmp && !CountConnectedItems( segment->m_End, true ) )
if( tmp && !CountConnectedItems( segment->GetEndPoint(), true ) )
noconnect = true;
item->ClearFlags( SKIP_STRUCT );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment