diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 70dc611b2d..ddd998d720 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1265,11 +1265,28 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer ) text = wxT( "File: " ) + aSheet->GetFileName(); m_gal->StrokeText( text, pos_filename, nameAngle ); - + } + else if( aLayer == LAYER_HIERLABEL ) + { for( auto& sheetPin : aSheet->GetPins() ) { if( !sheetPin.IsMoving() ) + { + int width = aSheet->GetPenSize(); + wxPoint pt = sheetPin.GetTextPos(); + + switch( sheetPin.GetEdge() ) + { + case SCH_SHEET_PIN::SHEET_TOP_SIDE: pt.y -= width / 2; break; + case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: pt.y += width / 2; break; + case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: pt.x -= width / 2; break; + case SCH_SHEET_PIN::SHEET_LEFT_SIDE: pt.x += width / 2; break; + default: break; + } + + sheetPin.SetTextPos(pt); draw( static_cast( &sheetPin ), aLayer ); + } } } } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index a608670ee1..21e58e2afc 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -426,9 +426,10 @@ wxPoint SCH_SHEET::GetFileNamePosition() void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const { - aCount = 2; - aLayers[0] = LAYER_SHEET; - aLayers[1] = LAYER_SHEET_BACKGROUND; + aCount = 3; + aLayers[0] = LAYER_HIERLABEL; + aLayers[1] = LAYER_SHEET; + aLayers[2] = LAYER_SHEET_BACKGROUND; } diff --git a/eeschema/sch_view.h b/eeschema/sch_view.h index bdabb2455e..f65b85e349 100644 --- a/eeschema/sch_view.h +++ b/eeschema/sch_view.h @@ -46,6 +46,7 @@ static const LAYER_NUM SCH_LAYER_ORDER[] = LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS, LAYER_JUNCTION, LAYER_NOCONNECT, + LAYER_HIERLABEL, LAYER_WIRE, LAYER_BUS, LAYER_DEVICE, LAYER_DEVICE_BACKGROUND,