From 42e3c13820c0f50f5af4c3dfb5a306b2a430afeb Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 16 Jun 2019 13:27:11 -0700 Subject: [PATCH] Eeschema: Plot in same order as drawing This ensures the junctions are on top and the bitmaps are on bottom (cherry picked from commit ddbc25077ccdde7d3abe7bd25b72514750a5f9a5) --- eeschema/sch_screen.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 442af17cfd..756e54b82e 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -549,10 +549,45 @@ void SCH_SCREEN::Print( wxDC* aDC ) void SCH_SCREEN::Plot( PLOTTER* aPlotter ) { + // Ensure links are up to date, even if a library was reloaded for some reason: + std::vector< SCH_ITEM* > junctions; + std::vector< SCH_ITEM* > bitmaps; + std::vector< SCH_ITEM* > other; + // Ensure links are up to date, even if a library was reloaded for some reason: UpdateSymbolLinks(); - for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) + for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) + { + if( item->IsMoving() || item->IsResized() ) + continue; + + if( item->Type() == SCH_JUNCTION_T ) + junctions.push_back( item ); + else if( item->Type() == SCH_BITMAP_T ) + bitmaps.push_back( item ); + else + // uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox() + // if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) ) + other.push_back( item ); + } + + // Bitmaps are drawn first to ensure they are in the background + // This is particularly important for the wxPostscriptDC (used in *nix printers) as + // the bitmap PS command clears the screen + for( auto item : bitmaps ) + { + aPlotter->SetCurrentLineWidth( item->GetPenSize() ); + item->Plot( aPlotter ); + } + + for( auto item : other ) + { + aPlotter->SetCurrentLineWidth( item->GetPenSize() ); + item->Plot( aPlotter ); + } + + for( auto item : junctions ) { aPlotter->SetCurrentLineWidth( item->GetPenSize() ); item->Plot( aPlotter );