← Back to team overview

kicad-developers team mailing list archive

[PATCH] Draw junctions last

 

​Kevin made a ​request to have junctions draw last on schematics to avoid a
visual negative.

This patch provides that functionality.  Since it was independent of the
other junction work, I'm formatting it as a separate patch to master.

-S
From e48ea3aed5f6d3d371b34320c1cb188a3b6b6b90 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Fri, 3 Nov 2017 10:56:59 -0700
Subject: [PATCH] Eeschema: Draw junctions last

Places junctions on the schematic after all other items
to avoid visual clutter when a pin overlaps a junction.
---
 eeschema/sch_screen.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 02f2030d1..00f525440 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -561,6 +561,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
      * library editor and library viewer do not use m_drawList, and therefore
      * their SCH_SCREEN::Draw() draws nothing
      */
+    std::vector< SCH_ITEM* > junctions;
 
     // Ensure links are up to date, even if a library was reloaded for some reason:
     CheckComponentsToPartsLinks();
@@ -570,10 +571,16 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
         if( item->IsMoving() || item->IsResized() )
             continue;
 
-        // uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
-        // if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
-        item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
+        if( item->Type() == SCH_JUNCTION_T )
+            junctions.push_back( item );
+        else
+            // uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
+            // if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
+            item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
     }
+
+    for( auto item : junctions )
+        item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
 }
 
 
-- 
2.11.0


Follow ups