Add LAYER_PRIVATE_NOTES for private text & graphics in symbol editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/11957
This commit is contained in:
Jeff Young 2022-07-06 22:51:23 -06:00
parent f611f9f5d3
commit 62cef3d830
9 changed files with 25 additions and 19 deletions

View File

@ -122,6 +122,7 @@ wxString LayerName( int aLayer )
case LAYER_DEVICE: return _( "Symbol body outlines" ); case LAYER_DEVICE: return _( "Symbol body outlines" );
case LAYER_DEVICE_BACKGROUND: return _( "Symbol body fills" ); case LAYER_DEVICE_BACKGROUND: return _( "Symbol body fills" );
case LAYER_NOTES: return _( "Schematic text && graphics" ); 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_NOTES_BACKGROUND: return _( "Schematic text && graphics backgrounds" );
case LAYER_PIN: return _( "Pins" ); case LAYER_PIN: return _( "Pins" );
case LAYER_SHEET: return _( "Sheet borders" ); case LAYER_SHEET: return _( "Sheet borders" );

View File

@ -50,6 +50,7 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ 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_NOCONNECT, CSS_COLOR( 0, 0, 132, 1 ) },
{ LAYER_NOTES, CSS_COLOR( 0, 0, 194, 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_NOTES_BACKGROUND, CSS_COLOR( 0, 0, 0, 0 ) },
{ LAYER_PIN, CSS_COLOR( 132, 0, 0, 1 ) }, { LAYER_PIN, CSS_COLOR( 132, 0, 0, 1 ) },
{ LAYER_PINNAM, CSS_COLOR( 0, 100, 100, 1 ) }, { LAYER_PINNAM, CSS_COLOR( 0, 100, 100, 1 ) },
@ -203,6 +204,7 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_NETCLASS_REFS, COLOR4D( BLACK ) }, { LAYER_NETCLASS_REFS, COLOR4D( BLACK ) },
{ LAYER_NOCONNECT, COLOR4D( BLUE ) }, { LAYER_NOCONNECT, COLOR4D( BLUE ) },
{ LAYER_NOTES, COLOR4D( LIGHTBLUE ) }, { LAYER_NOTES, COLOR4D( LIGHTBLUE ) },
{ LAYER_PRIVATE_NOTES, COLOR4D( LIGHTBLUE ) },
{ LAYER_NOTES_BACKGROUND, COLOR4D( UNSPECIFIED_COLOR ) }, { LAYER_NOTES_BACKGROUND, COLOR4D( UNSPECIFIED_COLOR ) },
{ LAYER_PIN, COLOR4D( RED ) }, { LAYER_PIN, COLOR4D( RED ) },
{ LAYER_PINNAM, COLOR4D( CYAN ) }, { LAYER_PINNAM, COLOR4D( CYAN ) },

View File

@ -96,6 +96,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "schematic.netclass_flag", LAYER_NETCLASS_REFS ); CLR( "schematic.netclass_flag", LAYER_NETCLASS_REFS );
CLR( "schematic.no_connect", LAYER_NOCONNECT ); CLR( "schematic.no_connect", LAYER_NOCONNECT );
CLR( "schematic.note", LAYER_NOTES ); CLR( "schematic.note", LAYER_NOTES );
CLR( "schematic.private_note", LAYER_PRIVATE_NOTES );
CLR( "schematic.note_background", LAYER_NOTES_BACKGROUND ); CLR( "schematic.note_background", LAYER_NOTES_BACKGROUND );
CLR( "schematic.pin", LAYER_PIN ); CLR( "schematic.pin", LAYER_PIN );
CLR( "schematic.pin_name", LAYER_PINNAM ); CLR( "schematic.pin_name", LAYER_PINNAM );

View File

@ -525,7 +525,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
int pensize = textSize/6; int pensize = textSize/6;
// Get a suitable color // 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; VECTOR2I txtpos = aPosition;
int offset = Millimeter2iu( 0.4 ); int offset = Millimeter2iu( 0.4 );

View File

@ -498,7 +498,7 @@ void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition )
void LIB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const void LIB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 3; 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[1] = IsPrivate() ? LAYER_NOTES_BACKGROUND : LAYER_DEVICE_BACKGROUND;
aLayers[2] = LAYER_SELECTION_SHADOWS; aLayers[2] = LAYER_SELECTION_SHADOWS;
} }

View File

@ -48,8 +48,8 @@ LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 2; aCount = 2;
aLayers[0] = LAYER_DEVICE; aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE;
aLayers[1] = LAYER_SELECTION_SHADOWS; aLayers[2] = LAYER_SELECTION_SHADOWS;
} }

View File

@ -415,7 +415,7 @@ void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
void LIB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const void LIB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 3; 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[1] = IsPrivate() ? LAYER_NOTES_BACKGROUND : LAYER_DEVICE_BACKGROUND;
aLayers[2] = LAYER_SELECTION_SHADOWS; aLayers[2] = LAYER_SELECTION_SHADOWS;
} }

View File

@ -330,19 +330,19 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
{ {
const SCH_SHEET* sheet = static_cast<const SCH_SHEET*>( aItem ); const SCH_SHEET* sheet = static_cast<const SCH_SHEET*>( aItem );
if( aLayer == LAYER_SHEET ) if( aLayer == LAYER_SHEET_BACKGROUND )
color = sheet->GetBorderColor();
else if( aLayer == LAYER_SHEET_BACKGROUND )
color = sheet->GetBackgroundColor(); color = sheet->GetBackgroundColor();
else
color = sheet->GetBorderColor();
} }
else if( aItem->Type() == SCH_SHAPE_T ) else if( aItem->Type() == SCH_SHAPE_T )
{ {
const SCH_SHAPE* shape = static_cast<const SCH_SHAPE*>( aItem ); const SCH_SHAPE* shape = static_cast<const SCH_SHAPE*>( aItem );
if( aLayer == LAYER_NOTES ) if( aLayer == LAYER_NOTES_BACKGROUND )
color = shape->GetStroke().GetColor();
else if( aLayer == LAYER_NOTES_BACKGROUND )
color = shape->GetFillColor(); color = shape->GetFillColor();
else
color = shape->GetStroke().GetColor();
// A filled shape means filled; if they didn't specify a fill colour then use the // A filled shape means filled; if they didn't specify a fill colour then use the
// border colour. // border colour.
@ -353,10 +353,10 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
{ {
const LIB_SHAPE* shape = static_cast<const LIB_SHAPE*>( aItem ); const LIB_SHAPE* shape = static_cast<const LIB_SHAPE*>( aItem );
if( aLayer == LAYER_DEVICE || aLayer == LAYER_NOTES ) if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
color = shape->GetStroke().GetColor();
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
color = shape->GetFillColor(); color = shape->GetFillColor();
else
color = shape->GetStroke().GetColor();
} }
else if( aItem->Type() == SCH_TEXTBOX_T ) else if( aItem->Type() == SCH_TEXTBOX_T )
{ {
@ -666,6 +666,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
return false; return false;
case LAYER_NOTES: case LAYER_NOTES:
case LAYER_PRIVATE_NOTES:
case LAYER_DEVICE: case LAYER_DEVICE:
m_gal->SetIsFill( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE ); m_gal->SetIsFill( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) ); m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
@ -790,7 +791,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
drawShape( aShape ); 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 ) if( aShape->GetFillMode() == FILL_T::FILLED_SHAPE )
{ {
@ -1033,7 +1034,7 @@ void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer )
mapCoords( aTextBox->GetEnd() ) ); mapCoords( aTextBox->GetEnd() ) );
} }
} }
else if( aLayer == LAYER_DEVICE || aLayer == LAYER_NOTES ) else if( aLayer == LAYER_DEVICE || aLayer == LAYER_PRIVATE_NOTES )
{ {
drawText(); 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 ) ); size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) );
thickness[OUTSIDE] = float( size[OUTSIDE] ) / 8.0F; 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(); text [OUTSIDE] = aPin->GetElectricalTypeName();
} }

View File

@ -351,6 +351,7 @@ enum SCH_LAYER_ID: int
LAYER_NETCLASS_REFS, LAYER_NETCLASS_REFS,
LAYER_DEVICE, LAYER_DEVICE,
LAYER_NOTES, LAYER_NOTES,
LAYER_PRIVATE_NOTES,
LAYER_NOTES_BACKGROUND, LAYER_NOTES_BACKGROUND,
LAYER_PIN, LAYER_PIN,
LAYER_SHEET, LAYER_SHEET,