From 40fcfe891dbb8c78bd3bdc6d1bd3c85eb417db68 Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Sun, 25 Jun 2023 16:01:06 +0100
Subject: [PATCH] Move pinnumber above pins if pinnames aren't shown.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14998
---
 eeschema/sch_painter.cpp | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp
index e3ce838050..792f61ddcd 100644
--- a/eeschema/sch_painter.cpp
+++ b/eeschema/sch_painter.cpp
@@ -1576,8 +1576,8 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
         colour   [ABOVE] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows, aDimmed );
         text     [ABOVE] = aPin->GetShownNumber();
     }
-    // Otherwise pin NAMES go above and pin NUMBERS go below
-    else
+    // Otherwise if both are shown pin NAMES go above and pin NUMBERS go below
+    else if( showPinNames && showPinNumbers )
     {
         size     [ABOVE] = showPinNames ? aPin->GetNameTextSize() : 0;
         thickness[ABOVE] = nameStrokeWidth;
@@ -1589,6 +1589,20 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
         colour   [BELOW] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows, aDimmed );
         text     [BELOW] = aPin->GetShownNumber();
     }
+    else if( showPinNames )
+    {
+        size     [ABOVE] = aPin->GetNameTextSize();
+        thickness[ABOVE] = nameStrokeWidth;
+        colour   [ABOVE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows, aDimmed );
+        text     [ABOVE] = aPin->GetShownName();
+    }
+    else if( showPinNumbers )
+    {
+        size     [ABOVE] = aPin->GetNumberTextSize();
+        thickness[ABOVE] = numStrokeWidth;
+        colour   [ABOVE] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows, aDimmed );
+        text     [ABOVE] = aPin->GetShownNumber();
+    }
 
     if( m_schSettings.m_ShowPinsElectricalType )
     {