diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 6cfc44116a..4518bf347b 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -160,15 +160,13 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, - GR_DRAWMODE aDrawMode, COLOR4D aColor ) + GR_DRAWMODE aDrawMode, COLOR4D aColor ) { COLOR4D color; EDA_RECT* clipbox = aPanel->GetClipBox(); if( aColor != COLOR4D::UNSPECIFIED ) color = aColor; - else if( aPanel->GetScreen() && !aPanel->GetScreen()->m_IsPrinting && GetState( BRIGHTENED ) ) - color = GetLayerColor( LAYER_BRIGHTENED ); else color = GetLayerColor( m_Layer ); @@ -177,20 +175,16 @@ void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& GRLine( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color ); - - // Draw pin targets if part is being dragged - bool dragging = aPanel->GetScreen()->GetCurItem() == this && aPanel->IsMouseCaptured(); - - if( m_isDanglingStart || dragging ) + if( m_isDanglingStart ) { GRCircle( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, - TARGET_BUSENTRY_RADIUS, 0, color ); + TARGET_BUSENTRY_RADIUS, 0, color ); } - if( m_isDanglingEnd || dragging ) + if( m_isDanglingEnd ) { GRCircle( clipbox, aDC, m_End().x + aOffset.x, m_End().y + aOffset.y, - TARGET_BUSENTRY_RADIUS, 0, color ); + TARGET_BUSENTRY_RADIUS, 0, color ); } } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 2dd9a5160f..a8ed6514df 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -368,54 +368,6 @@ static bool sort_by_libid( const SCH_COMPONENT* ref, SCH_COMPONENT* cmp ) } -void SCH_COMPONENT::ResolveAll( const SCH_COLLECTOR& aComponents, PART_LIBS* aLibs ) -{ - // Usually, many components use the same part lib. - // to avoid too long calculation time the list of components is grouped - // and once the lib part is found for one member of a group, it is also - // set for all other members of this group - std::vector cmp_list; - - // build the cmp list. - for( int i = 0; i < aComponents.GetCount(); ++i ) - { - SCH_COMPONENT* cmp = dynamic_cast( aComponents[i] ); - wxASSERT( cmp ); - - if( cmp ) // cmp == NULL should not occur. - cmp_list.push_back( cmp ); - } - - // sort it by lib part. Cmp will be grouped by same lib part. - std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid ); - - LIB_ID curr_libid; - - for( unsigned ii = 0; ii < cmp_list.size (); ++ii ) - { - SCH_COMPONENT* cmp = cmp_list[ii]; - curr_libid = cmp->m_lib_id; - cmp->Resolve( aLibs ); - cmp->UpdatePins(); - - // Propagate the m_part pointer to other members using the same lib_id - for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj ) - { - SCH_COMPONENT* next_cmp = cmp_list[jj]; - - if( curr_libid != next_cmp->m_lib_id ) - break; - - next_cmp->m_part = cmp->m_part; - - next_cmp->UpdatePins(); - - ii = jj; - } - } -} - - void SCH_COMPONENT::ResolveAll( const SCH_COLLECTOR& aComponents, SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib ) { @@ -460,7 +412,7 @@ void SCH_COMPONENT::ResolveAll( const SCH_COLLECTOR& aComponents, SYMBOL_LIB_TAB } -void SCH_COMPONENT::UpdateAllPinCaches( const SCH_COLLECTOR& aComponents ) +void SCH_COMPONENT::UpdatePins( const SCH_COLLECTOR& aComponents ) { for( int i = 0; i < aComponents.GetCount(); ++i ) { @@ -476,8 +428,10 @@ void SCH_COMPONENT::UpdatePins( SCH_SHEET_PATH* aSheet ) { if( PART_SPTR part = m_part.lock() ) { + std::set stalePins; + for( auto& it : m_pins ) - it.second.ClearFlags( BUSY ); + stalePins.insert( it.first ); for( LIB_PIN* libPin = part->GetNextPin(); libPin; libPin = part->GetNextPin( libPin ) ) { @@ -495,14 +449,11 @@ void SCH_COMPONENT::UpdatePins( SCH_SHEET_PATH* aSheet ) if( aSheet ) m_pins.at( libPin ).InitializeConnection( *aSheet ); - m_pins.at( libPin ).SetFlags( BUSY ); + stalePins.erase( libPin ); } - for( auto& it : m_pins ) - { - if( !( it.second.GetFlags() & BUSY ) ) - m_pins.erase( it.first ); - } + for( auto& stalePin : stalePins ) + m_pins.erase( stalePin ); } } @@ -564,8 +515,7 @@ int SCH_COMPONENT::GetUnitCount() const void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, - GR_DRAWMODE aDrawMode, COLOR4D aColor, - bool aDrawPinText ) + GR_DRAWMODE aDrawMode, COLOR4D aColor, bool aDrawPinText ) { auto opts = PART_DRAW_OPTIONS::Default(); opts.draw_mode = aDrawMode; @@ -599,7 +549,7 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff SCH_FIELD* field = GetField( REFERENCE ); - if( field->IsVisible() && !field->IsMoving() ) + if( field->IsVisible() ) { field->Draw( aPanel, aDC, aOffset, aDrawMode ); } @@ -607,33 +557,8 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff for( int ii = VALUE; ii < GetFieldCount(); ii++ ) { field = GetField( ii ); - - if( field->IsMoving() ) - continue; - field->Draw( aPanel, aDC, aOffset, aDrawMode ); } - -#if 0 - // Only for testing purposes, draw the component bounding box - { - EDA_RECT boundingBox = GetBoundingBox(); - GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN ); -#if 1 - if( GetField( REFERENCE )->IsVisible() ) - { - boundingBox = GetField( REFERENCE )->GetBoundingBox(); - GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN ); - } - - if( GetField( VALUE )->IsVisible() ) - { - boundingBox = GetField( VALUE )->GetBoundingBox(); - GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN ); - } -#endif - } -#endif } diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index d530be3416..0ccecfcd3c 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -195,8 +195,6 @@ public: bool Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib = NULL ); - static void ResolveAll( const SCH_COLLECTOR& aComponents, PART_LIBS* aLibs ); - static void ResolveAll( const SCH_COLLECTOR& aComponents, SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib = NULL ); @@ -207,7 +205,7 @@ public: * * @param aComponents collector of components in screen */ - static void UpdateAllPinCaches( const SCH_COLLECTOR& aComponents ); + static void UpdatePins( const SCH_COLLECTOR& aComponents ); /** * Updates the local cache of SCH_PIN_CONNECTION objects for each pin diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index e27666883f..469b46ef5a 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -218,38 +218,6 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, DrawGraphicText( clipbox, aDC, textpos, color, GetFullyQualifiedText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, lineWidth, IsItalic(), IsBold() ); - - // While moving: don't loose visual contact to which component this label belongs. - if ( IsWireImage() ) - { - const wxPoint origin = parentComponent->GetPosition(); - textpos = GetTextPos() - origin; - textpos = parentComponent->GetScreenCoord( textpos ); - textpos += parentComponent->GetPosition(); - GRLine( clipbox, aDC, origin, textpos, 2, DARKGRAY ); - } - - /* Enable this to draw the bounding box around the text field to validate - * the bounding box calculations. - */ -#if 0 - - // Draw boundary box: - GRRect( aPanel->GetClipBox(), aDC, boundaryBox, 0, BROWN ); - - // Draw the text anchor point - - /* Calculate the text position, according to the component - * orientation/mirror */ - textpos = m_Pos - parentComponent->GetPosition(); - textpos = parentComponent->GetScreenCoord( textpos ); - textpos += parentComponent->GetPosition(); - const int len = 10; - GRLine( clipbox, aDC, - textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE ); - GRLine( clipbox, aDC, - textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE ); -#endif } diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 6f29cf2247..f8afc57774 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -100,8 +100,6 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs if( aColor != COLOR4D::UNSPECIFIED ) color = aColor; - else if( aPanel->GetScreen() && !aPanel->GetScreen()->m_IsPrinting && GetState( BRIGHTENED ) ) - color = GetLayerColor( LAYER_BRIGHTENED ); else color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer ); diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 81836c443d..e1f2c24d91 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -315,8 +315,6 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, color = Color; else if( m_color != COLOR4D::UNSPECIFIED ) color = m_color; - else if( panel->GetScreen() && !panel->GetScreen()->m_IsPrinting && GetState( BRIGHTENED ) ) - color = GetLayerColor( LAYER_BRIGHTENED ); else color = GetLayerColor( m_Layer ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index b01b53815f..093ef788a9 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -508,7 +508,7 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce ) // Resolving will update the pin caches but we must ensure that this happens // even if the libraries don't change. else - SCH_COMPONENT::UpdateAllPinCaches( c ); + SCH_COMPONENT::UpdatePins( c ); } } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 61d223da0c..4adcbd1317 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -436,15 +436,15 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor ) { - COLOR4D txtcolor; - wxString Text; - COLOR4D color; - int name_orientation; - wxPoint pos_sheetname,pos_filename; - wxPoint pos = m_pos + aOffset; - int lineWidth = GetPenSize(); - int textWidth; - wxSize textSize; + COLOR4D txtcolor; + wxString Text; + COLOR4D color; + int name_orientation; + wxPoint pos_sheetname,pos_filename; + wxPoint pos = m_pos + aOffset; + int lineWidth = GetPenSize(); + int textWidth; + wxSize textSize; EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL; if( aColor != COLOR4D::UNSPECIFIED ) @@ -497,18 +497,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, /* Draw text : SheetLabel */ for( SCH_SHEET_PIN& sheetPin : m_pins ) - { - if( !sheetPin.IsMoving() ) - sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor ); - } - - -#if 0 - // Only for testing purposes, draw the component bounding box - EDA_RECT boundingBox = GetBoundingBox(); - GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN ); - GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x, m_pos.y, 10, 0, color, color ); -#endif + sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor ); } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 8290e9a444..73b16076e2 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -316,8 +316,6 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, if( Color != COLOR4D::UNSPECIFIED ) color = Color; - else if( panel->GetScreen() && !panel->GetScreen()->m_IsPrinting && GetState( BRIGHTENED ) ) - color = GetLayerColor( LAYER_BRIGHTENED ); else color = GetLayerColor( m_Layer ); @@ -334,14 +332,6 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, if( m_isDangling && panel) DrawDanglingSymbol( panel, DC, GetTextPos() + aOffset, color ); - - // Enable these line to draw the bounding box (debug tests purposes only) -#if DRAW_BBOX - { - EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( clipbox, DC, BoundaryBox, 0, BROWN ); - } -#endif }