From e9a297de5b68d0562b436d1ff4bae0258485aaa9 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 16 Nov 2017 12:39:59 -0800 Subject: [PATCH] Eeschema: Removing DC dependencies --- eeschema/bus-wire-junction.cpp | 16 ++++++---------- eeschema/onleftclick.cpp | 6 +++--- eeschema/schedit.cpp | 4 ++-- eeschema/schframe.h | 7 +++---- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 410f830f6c..ea215c302f 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -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. if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) ) { - EndSegment( DC ); + EndSegment(); 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_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. 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 if( screen->IsJunctionNeeded( startPoint ) ) - screen->Append( AddJunction( DC, startPoint ) ); + screen->Append( AddJunction( startPoint ) ); 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 ) { SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition ); 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 ) { 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 ); diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index ed349001b6..2cfc9e045c 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -120,7 +120,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { 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 ); GetScreen()->SetCurItem( no_connect ); 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 ) { - SCH_JUNCTION* junction = AddJunction( aDC, gridPosition, true ); + SCH_JUNCTION* junction = AddJunction( gridPosition ); SetRepeatItem( junction ); GetScreen()->SetCurItem( junction ); m_canvas->SetAutoPanRequest( true ); @@ -442,7 +442,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) case ID_WIRE_BUTT: case ID_LINE_COMMENT_BUTT: if( item && item->IsNew() ) - EndSegment( aDC ); + EndSegment(); break; } diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 80b17570c4..61d9bf6e8d 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -169,7 +169,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_END_LINE: m_canvas->MoveCursorToCrossHair(); - EndSegment( &dc ); + EndSegment(); break; 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: m_canvas->MoveCursorToCrossHair(); - screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) ); + screen->SetCurItem( AddJunction( GetCrossHairPosition() ) ); if( screen->TestDanglingEnds() ) m_canvas->Refresh(); diff --git a/eeschema/schframe.h b/eeschema/schframe.h index a583ab46f8..76013d54df 100644 --- a/eeschema/schframe.h +++ b/eeschema/schframe.h @@ -897,16 +897,15 @@ private: /** * 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. * @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. */ - SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = false ); + SCH_JUNCTION* AddJunction( const wxPoint& aPosition, bool aPutInUndoList = false ); /** * Function SchematicCleanUp @@ -950,7 +949,7 @@ private: /** * Terminate a bus, wire, or line creation. */ - void EndSegment( wxDC* DC ); + void EndSegment(); /** * Erase the last segment at the current mouse position.