Eeschema: Removing DC dependencies

This commit is contained in:
Seth Hillbrand 2017-11-16 12:39:59 -08:00 committed by Wayne Stambaugh
parent bf32cc2555
commit e9a297de5b
4 changed files with 14 additions and 19 deletions

View File

@ -248,7 +248,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
// Terminate the command if the end point is on a pin, junction, or another wire or bus. // Terminate the command if the end point is on a pin, junction, or another wire or bus.
if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) ) if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) )
{ {
EndSegment( DC ); EndSegment();
return; return;
} }
@ -267,7 +267,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
} }
void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) void SCH_EDIT_FRAME::EndSegment()
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
SCH_LINE* segment = (SCH_LINE*) screen->GetCurItem(); SCH_LINE* segment = (SCH_LINE*) screen->GetCurItem();
@ -334,11 +334,11 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
// A junction could be needed to connect the end point of the last created segment. // A junction could be needed to connect the end point of the last created segment.
if( screen->IsJunctionNeeded( endpoint ) ) if( screen->IsJunctionNeeded( endpoint ) )
screen->Append( AddJunction( DC, endpoint ) ); screen->Append( AddJunction( endpoint ) );
// A junction could be needed to connect the start point of the set of new created wires // A junction could be needed to connect the start point of the set of new created wires
if( screen->IsJunctionNeeded( startPoint ) ) if( screen->IsJunctionNeeded( startPoint ) )
screen->Append( AddJunction( DC, startPoint ) ); screen->Append( AddJunction( startPoint ) );
m_canvas->Refresh(); m_canvas->Refresh();
@ -466,17 +466,13 @@ bool SCH_EDIT_FRAME::SchematicCleanUp()
} }
SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition, SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( const wxPoint& aPosition,
bool aPutInUndoList ) bool aPutInUndoList )
{ {
SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition ); SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition );
SetRepeatItem( junction ); SetRepeatItem( junction );
m_canvas->CrossHairOff( aDC ); // Erase schematic cursor
junction->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
m_canvas->CrossHairOn( aDC ); // Display schematic cursor
if( aPutInUndoList ) if( aPutInUndoList )
{ {
GetScreen()->Append( junction ); GetScreen()->Append( junction );
@ -488,7 +484,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
} }
SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPosition ) SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( const wxPoint& aPosition )
{ {
SCH_NO_CONNECT* no_connect = new SCH_NO_CONNECT( aPosition ); SCH_NO_CONNECT* no_connect = new SCH_NO_CONNECT( aPosition );

View File

@ -120,7 +120,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{ {
if( GetScreen()->GetItem( gridPosition, 0, SCH_NO_CONNECT_T ) == NULL ) if( GetScreen()->GetItem( gridPosition, 0, SCH_NO_CONNECT_T ) == NULL )
{ {
SCH_NO_CONNECT* no_connect = AddNoConnect( aDC, gridPosition ); SCH_NO_CONNECT* no_connect = AddNoConnect( gridPosition );
SetRepeatItem( no_connect ); SetRepeatItem( no_connect );
GetScreen()->SetCurItem( no_connect ); GetScreen()->SetCurItem( no_connect );
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
@ -137,7 +137,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{ {
if( GetScreen()->GetItem( gridPosition, 0, SCH_JUNCTION_T ) == NULL ) if( GetScreen()->GetItem( gridPosition, 0, SCH_JUNCTION_T ) == NULL )
{ {
SCH_JUNCTION* junction = AddJunction( aDC, gridPosition, true ); SCH_JUNCTION* junction = AddJunction( gridPosition );
SetRepeatItem( junction ); SetRepeatItem( junction );
GetScreen()->SetCurItem( junction ); GetScreen()->SetCurItem( junction );
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
@ -442,7 +442,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_WIRE_BUTT: case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
if( item && item->IsNew() ) if( item && item->IsNew() )
EndSegment( aDC ); EndSegment();
break; break;
} }

View File

@ -169,7 +169,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_END_LINE: case ID_POPUP_END_LINE:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
EndSegment( &dc ); EndSegment();
break; break;
case ID_POPUP_SCH_BEGIN_WIRE: case ID_POPUP_SCH_BEGIN_WIRE:
@ -372,7 +372,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) ); screen->SetCurItem( AddJunction( GetCrossHairPosition() ) );
if( screen->TestDanglingEnds() ) if( screen->TestDanglingEnds() )
m_canvas->Refresh(); m_canvas->Refresh();

View File

@ -897,16 +897,15 @@ private:
/** /**
* Add no connect item to the current schematic sheet at \a aPosition. * Add no connect item to the current schematic sheet at \a aPosition.
* *
* @param aDC The device context to draw the no connect to.
* @param aPosition The position in logical (drawing) units to add the no connect. * @param aPosition The position in logical (drawing) units to add the no connect.
* @return The no connect item added. * @return The no connect item added.
*/ */
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition ); SCH_NO_CONNECT* AddNoConnect( const wxPoint& aPosition );
/** /**
* Add a new junction at \a aPosition. * Add a new junction at \a aPosition.
*/ */
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = false ); SCH_JUNCTION* AddJunction( const wxPoint& aPosition, bool aPutInUndoList = false );
/** /**
* Function SchematicCleanUp * Function SchematicCleanUp
@ -950,7 +949,7 @@ private:
/** /**
* Terminate a bus, wire, or line creation. * Terminate a bus, wire, or line creation.
*/ */
void EndSegment( wxDC* DC ); void EndSegment();
/** /**
* Erase the last segment at the current mouse position. * Erase the last segment at the current mouse position.