From 62cef3d83058a680511cebd27e9736857d550872 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 6 Jul 2022 22:51:23 -0600 Subject: [PATCH] Add LAYER_PRIVATE_NOTES for private text & graphics in symbol editor. Fixes https://gitlab.com/kicad/code/kicad/issues/11957 --- common/layer_id.cpp | 1 + common/settings/builtin_color_themes.h | 4 +++- common/settings/color_settings.cpp | 1 + eeschema/lib_pin.cpp | 2 +- eeschema/lib_shape.cpp | 2 +- eeschema/lib_text.cpp | 6 +++--- eeschema/lib_textbox.cpp | 2 +- eeschema/sch_painter.cpp | 25 +++++++++++++------------ include/layer_ids.h | 1 + 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/common/layer_id.cpp b/common/layer_id.cpp index 721fbfb2a1..3cf92abb9e 100644 --- a/common/layer_id.cpp +++ b/common/layer_id.cpp @@ -122,6 +122,7 @@ wxString LayerName( int aLayer ) case LAYER_DEVICE: return _( "Symbol body outlines" ); case LAYER_DEVICE_BACKGROUND: return _( "Symbol body fills" ); case LAYER_NOTES: return _( "Schematic text && graphics" ); + case LAYER_PRIVATE_NOTES: return _( "Symbol private text && graphics" ); case LAYER_NOTES_BACKGROUND: return _( "Schematic text && graphics backgrounds" ); case LAYER_PIN: return _( "Pins" ); case LAYER_SHEET: return _( "Sheet borders" ); diff --git a/common/settings/builtin_color_themes.h b/common/settings/builtin_color_themes.h index 9bd014ed6e..f6ca9f9767 100644 --- a/common/settings/builtin_color_themes.h +++ b/common/settings/builtin_color_themes.h @@ -47,9 +47,10 @@ static const std::map s_defaultTheme = { LAYER_GLOBLABEL, CSS_COLOR( 132, 0, 0, 1 ) }, { LAYER_HIERLABEL, CSS_COLOR( 114, 86, 0, 1 ) }, { LAYER_LOCLABEL, CSS_COLOR( 15, 15, 15, 1 ) }, - { LAYER_NETCLASS_REFS, CSS_COLOR( 72, 72, 72, 1 ) }, + { LAYER_NETCLASS_REFS, CSS_COLOR( 72, 72, 72, 1 ) }, { LAYER_NOCONNECT, CSS_COLOR( 0, 0, 132, 1 ) }, { LAYER_NOTES, CSS_COLOR( 0, 0, 194, 1 ) }, + { LAYER_PRIVATE_NOTES, CSS_COLOR( 72, 72, 255, 1 ) }, { LAYER_NOTES_BACKGROUND, CSS_COLOR( 0, 0, 0, 0 ) }, { LAYER_PIN, CSS_COLOR( 132, 0, 0, 1 ) }, { LAYER_PINNAM, CSS_COLOR( 0, 100, 100, 1 ) }, @@ -203,6 +204,7 @@ static const std::map s_classicTheme = { LAYER_NETCLASS_REFS, COLOR4D( BLACK ) }, { LAYER_NOCONNECT, COLOR4D( BLUE ) }, { LAYER_NOTES, COLOR4D( LIGHTBLUE ) }, + { LAYER_PRIVATE_NOTES, COLOR4D( LIGHTBLUE ) }, { LAYER_NOTES_BACKGROUND, COLOR4D( UNSPECIFIED_COLOR ) }, { LAYER_PIN, COLOR4D( RED ) }, { LAYER_PINNAM, COLOR4D( CYAN ) }, diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index 9f212c5c35..64618f3d38 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -96,6 +96,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath ) CLR( "schematic.netclass_flag", LAYER_NETCLASS_REFS ); CLR( "schematic.no_connect", LAYER_NOCONNECT ); CLR( "schematic.note", LAYER_NOTES ); + CLR( "schematic.private_note", LAYER_PRIVATE_NOTES ); CLR( "schematic.note_background", LAYER_NOTES_BACKGROUND ); CLR( "schematic.pin", LAYER_PIN ); CLR( "schematic.pin_name", LAYER_PINNAM ); diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 8778469a32..436fb440b8 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -525,7 +525,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT int pensize = textSize/6; // Get a suitable color - COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_NOTES : LAYER_HIDDEN ); + COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PRIVATE_NOTES : LAYER_HIDDEN ); VECTOR2I txtpos = aPosition; int offset = Millimeter2iu( 0.4 ); diff --git a/eeschema/lib_shape.cpp b/eeschema/lib_shape.cpp index d21053f1cb..f0a25d931a 100644 --- a/eeschema/lib_shape.cpp +++ b/eeschema/lib_shape.cpp @@ -498,7 +498,7 @@ void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition ) void LIB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const { aCount = 3; - aLayers[0] = IsPrivate() ? LAYER_NOTES : LAYER_DEVICE; + aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE; aLayers[1] = IsPrivate() ? LAYER_NOTES_BACKGROUND : LAYER_DEVICE_BACKGROUND; aLayers[2] = LAYER_SELECTION_SHADOWS; } diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 2a3a53a1ff..afa0d29ee8 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -47,9 +47,9 @@ LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) : void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const { - aCount = 2; - aLayers[0] = LAYER_DEVICE; - aLayers[1] = LAYER_SELECTION_SHADOWS; + aCount = 2; + aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE; + aLayers[2] = LAYER_SELECTION_SHADOWS; } diff --git a/eeschema/lib_textbox.cpp b/eeschema/lib_textbox.cpp index 9a98f1c394..895393ab4a 100644 --- a/eeschema/lib_textbox.cpp +++ b/eeschema/lib_textbox.cpp @@ -415,7 +415,7 @@ void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector( aItem ); - if( aLayer == LAYER_SHEET ) - color = sheet->GetBorderColor(); - else if( aLayer == LAYER_SHEET_BACKGROUND ) + if( aLayer == LAYER_SHEET_BACKGROUND ) color = sheet->GetBackgroundColor(); + else + color = sheet->GetBorderColor(); } else if( aItem->Type() == SCH_SHAPE_T ) { const SCH_SHAPE* shape = static_cast( aItem ); - if( aLayer == LAYER_NOTES ) - color = shape->GetStroke().GetColor(); - else if( aLayer == LAYER_NOTES_BACKGROUND ) + if( aLayer == LAYER_NOTES_BACKGROUND ) color = shape->GetFillColor(); + else + color = shape->GetStroke().GetColor(); // A filled shape means filled; if they didn't specify a fill colour then use the // border colour. @@ -353,10 +353,10 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr { const LIB_SHAPE* shape = static_cast( aItem ); - if( aLayer == LAYER_DEVICE || aLayer == LAYER_NOTES ) - color = shape->GetStroke().GetColor(); - else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND ) + if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND ) color = shape->GetFillColor(); + else + color = shape->GetStroke().GetColor(); } else if( aItem->Type() == SCH_TEXTBOX_T ) { @@ -666,6 +666,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer ) return false; case LAYER_NOTES: + case LAYER_PRIVATE_NOTES: case LAYER_DEVICE: m_gal->SetIsFill( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE ); m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) ); @@ -790,7 +791,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer ) drawShape( aShape ); } } - else if( aLayer == LAYER_DEVICE || ( m_schSettings.m_IsSymbolEditor && aLayer == LAYER_NOTES ) ) + else if( aLayer == LAYER_DEVICE || aLayer == LAYER_PRIVATE_NOTES ) { if( aShape->GetFillMode() == FILL_T::FILLED_SHAPE ) { @@ -1033,7 +1034,7 @@ void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer ) mapCoords( aTextBox->GetEnd() ) ); } } - else if( aLayer == LAYER_DEVICE || aLayer == LAYER_NOTES ) + else if( aLayer == LAYER_DEVICE || aLayer == LAYER_PRIVATE_NOTES ) { drawText(); @@ -1370,7 +1371,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) { size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) ); thickness[OUTSIDE] = float( size[OUTSIDE] ) / 8.0F; - colour [OUTSIDE] = getRenderColor( aPin, LAYER_NOTES, drawingShadows ); + colour [OUTSIDE] = getRenderColor( aPin, LAYER_PRIVATE_NOTES, drawingShadows ); text [OUTSIDE] = aPin->GetElectricalTypeName(); } diff --git a/include/layer_ids.h b/include/layer_ids.h index 155c74dfaa..ae11dc64db 100644 --- a/include/layer_ids.h +++ b/include/layer_ids.h @@ -351,6 +351,7 @@ enum SCH_LAYER_ID: int LAYER_NETCLASS_REFS, LAYER_DEVICE, LAYER_NOTES, + LAYER_PRIVATE_NOTES, LAYER_NOTES_BACKGROUND, LAYER_PIN, LAYER_SHEET,