ADDED: Support for explicit DNP field

Dims elements shown as DNP.  Adds property `dnp` to explicitly denote
parts that should not be populated. These parts are not included in X/Y
files
This commit is contained in:
Seth Hillbrand 2022-09-16 09:20:36 -07:00
parent 107f409106
commit 524b129c64
39 changed files with 575 additions and 191 deletions

View File

@ -400,7 +400,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
RENDER_SETTINGS* renderSettings = symbolEditor->GetRenderSettings();
renderSettings->SetPrintDC( &dc );
m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform, false );
event.Skip();
}

View File

@ -490,6 +490,8 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( cfg->m_Printing.use_theme && theme )
renderSettings.LoadColors( theme );
renderSettings.SetBackgroundColor( bgColor );
// The drawing-sheet-item print code is shared between PCBNew and Eeschema, so it's easier
// if they just use the PCB layer.
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,

View File

@ -530,6 +530,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
m_cbExcludeFromBom->SetValue( !m_symbol->GetIncludeInBom() );
m_cbExcludeFromBoard->SetValue( !m_symbol->GetIncludeOnBoard() );
m_cbDNP->SetValue( m_symbol->GetDNP() );
if( m_part )
{
@ -709,6 +710,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_symbol->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
m_symbol->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
m_symbol->SetDNP( m_cbDNP->IsChecked() );
// Update any assignments
if( m_dataModel )
@ -777,6 +779,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
otherUnit->SetDNP( m_cbDNP->IsChecked() );
if( m_dataModel )
{

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -210,6 +210,9 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
sbAttributes->Add( m_cbExcludeFromBoard, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_cbDNP = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Do not populate"), wxDefaultPosition, wxDefaultSize, 0 );
sbAttributes->Add( m_cbDNP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 4 );
bMiddleCol->Add( sbAttributes, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );

View File

@ -1478,6 +1478,70 @@
<event name="OnCheckBox">OnCheckBox</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Do not populate</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbDNP</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -65,6 +65,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
wxCheckBox* m_ShowPinNameButt;
wxCheckBox* m_cbExcludeFromBom;
wxCheckBox* m_cbExcludeFromBoard;
wxCheckBox* m_cbDNP;
wxButton* m_updateSymbolBtn;
wxButton* m_changeSymbolBtn;
wxButton* m_editSchematicSymbolBtn;

View File

@ -135,18 +135,25 @@ KIFONT::FONT* LIB_FIELD::GetDrawFont() const
void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
COLOR4D bg = aSettings->GetBackgroundColor();
bool blackAndWhiteMode = GetGRForceBlackPenState();
int penWidth = GetEffectivePenWidth( aSettings );
VECTOR2I text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
if( blackAndWhiteMode || bg == COLOR4D::UNSPECIFIED )
bg = COLOR4D::WHITE;
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
color = GetTextColor();
if( aDimmed )
color = color.Mix( bg, 0.5f );
GRPrintText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetDrawFont() );
}
@ -316,7 +323,7 @@ void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW )
void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const
const TRANSFORM& aTransform, bool aDimmed ) const
{
if( GetText().IsEmpty() || aBackground )
return;
@ -340,6 +347,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
VECTOR2I textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
COLOR4D color;
COLOR4D bg;
if( aPlotter->GetColorMode() )
{
@ -347,12 +355,21 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
color = GetTextColor();
else
color = aPlotter->RenderSettings()->GetLayerColor( GetDefaultLayer() );
bg = aPlotter->RenderSettings()->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED )
bg = COLOR4D::WHITE;
}
else
{
color = COLOR4D::BLACK;
bg = COLOR4D::WHITE;
}
if( aDimmed )
color = color.Mix( bg, 0.5f );
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,

View File

@ -165,7 +165,7 @@ public:
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const override;
const TRANSFORM& aTransform, bool aDimmed ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -210,7 +210,7 @@ private:
* the m_Text
*/
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform, bool aDimmed ) override;
/**
* Calculate the new circle at \a aPosition when editing.

View File

@ -134,9 +134,9 @@ const wxString& LIB_ITEM::GetDefaultFont() const
void LIB_ITEM::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform, bool aDimmed )
{
print( aSettings, aOffset, aData, aTransform );
print( aSettings, aOffset, aData, aTransform, aDimmed );
}

View File

@ -143,9 +143,10 @@ public:
* items what can be filled ). used in printing or moving objects mode or to
* pass reference to the lib symbol for pins.
* @param aTransform Transform Matrix (rotation, mirror ..)
* @param aDimmed Dim the color on the printout
*/
virtual void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform );
const TRANSFORM& aTransform, bool aDimmed );
virtual int GetPenWidth() const = 0;
@ -263,9 +264,10 @@ public:
* @param aOffset Plot offset position.
* @param aFill Flag to indicate whether or not the object is filled.
* @param aTransform The plot transform.
* @param aDimmed if true, reduce color to background
*/
virtual void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const = 0;
const TRANSFORM& aTransform, bool aDimmed ) const = 0;
void SetUnit( int aUnit ) { m_unit = aUnit; }
int GetUnit() const { return m_unit; }
@ -312,7 +314,7 @@ protected:
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
*/
virtual void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) = 0;
const TRANSFORM& aTransform, bool aDimmed ) = 0;
private:
friend class LIB_SYMBOL;

View File

@ -199,7 +199,7 @@ VECTOR2I LIB_PIN::GetPinRoot() const
void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform, bool aDimmed )
{
LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData;
bool drawHiddenFields = opts ? opts->draw_hidden_fields : false;
@ -218,14 +218,15 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
if( IsVisible() || drawHiddenFields )
{
printPinSymbol( aSettings, pos1, orient );
printPinSymbol( aSettings, pos1, orient, aDimmed );
printPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(),
opts->force_draw_pin_text || part->ShowPinNumbers(),
opts->force_draw_pin_text || part->ShowPinNames() );
opts->force_draw_pin_text || part->ShowPinNames(),
aDimmed );
if( showPinType )
printPinElectricalTypeName( aSettings, pos1, orient );
printPinElectricalTypeName( aSettings, pos1, orient, aDimmed );
if( show_connect_point
&& m_type != ELECTRICAL_PINTYPE::PT_NC
@ -233,19 +234,38 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
GRCircle( DC, pos1, TARGET_PIN_RADIUS, 0, color );
}
}
}
void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos, int aOrient )
void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos, int aOrient, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
int MapX1, MapY1, x1, y1;
int width = GetEffectivePenWidth( aSettings );
int posX = aPos.x, posY = aPos.y, len = m_length;
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( !IsVisible() )
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
if( aDimmed )
color = color.Mix( bg, 0.5f );
MapX1 = MapY1 = 0;
x1 = posX;
@ -351,7 +371,7 @@ void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I&
void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName )
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed )
{
if( !aDrawPinName && !aDrawPinNum )
return;
@ -372,8 +392,21 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
/* Get the num and name colors */
COLOR4D NameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
COLOR4D NumColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNUM : LAYER_HIDDEN );
COLOR4D nameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
COLOR4D numColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNUM : LAYER_HIDDEN );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( !IsVisible() )
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
if( aDimmed )
{
nameColor = nameColor.Mix( bg, 0.5f );
numColor = numColor.Mix( bg, 0.5f );
}
int x1 = aPinPos.x;
int y1 = aPinPos.y;
@ -405,14 +438,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
if( aPinOrient == PIN_RIGHT )
{
x = x1 + aTextInside;
GRPrintText( DC, VECTOR2I( x, y1 ), NameColor, name, ANGLE_HORIZONTAL,
GRPrintText( DC, VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL,
pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER,
namePenWidth, false, false, font );
}
else // Orient == PIN_LEFT
{
x = x1 - aTextInside;
GRPrintText( DC, VECTOR2I( x, y1 ), NameColor, name, ANGLE_HORIZONTAL,
GRPrintText( DC, VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL,
pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER,
namePenWidth, false, false, font );
}
@ -420,7 +453,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
if( aDrawPinNum )
{
GRPrintText( DC, VECTOR2I(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor,
GRPrintText( DC, VECTOR2I(( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
number, ANGLE_HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font );
}
@ -434,14 +467,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
if( aDrawPinName )
{
GRPrintText( DC, VECTOR2I( x1, y ), NameColor, name, ANGLE_VERTICAL,
GRPrintText( DC, VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER,
namePenWidth, false, false, font );
}
if( aDrawPinNum )
{
GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font );
}
@ -452,14 +485,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
if( aDrawPinName )
{
GRPrintText( DC, VECTOR2I( x1, y ), NameColor, name, ANGLE_VERTICAL,
GRPrintText( DC, VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER,
namePenWidth, false, false, font );
}
if( aDrawPinNum )
{
GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font );
}
@ -474,14 +507,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
if( aDrawPinName )
{
x = ( x1 + aPinPos.x) / 2;
GRPrintText( DC, VECTOR2I( x, y1 - name_offset ), NameColor, name, ANGLE_HORIZONTAL,
GRPrintText( DC, VECTOR2I( x, y1 - name_offset ), nameColor, name, ANGLE_HORIZONTAL,
pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
namePenWidth, false, false, font );
}
if( aDrawPinNum )
{
x = ( x1 + aPinPos.x) / 2;
GRPrintText( DC, VECTOR2I( x, y1 + num_offset ), NumColor, number, ANGLE_HORIZONTAL,
GRPrintText( DC, VECTOR2I( x, y1 + num_offset ), numColor, number, ANGLE_HORIZONTAL,
pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP,
numPenWidth, false, false, font );
}
@ -491,14 +524,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
if( aDrawPinName )
{
y = ( y1 + aPinPos.y) / 2;
GRPrintText( DC, VECTOR2I( x1 - name_offset, y ), NameColor, name, ANGLE_VERTICAL,
GRPrintText( DC, VECTOR2I( x1 - name_offset, y ), nameColor, name, ANGLE_VERTICAL,
pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
namePenWidth, false, false, font );
}
if( aDrawPinNum )
{
GRPrintText( DC, VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
GRPrintText( DC, VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false, font );
}
@ -509,7 +542,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECTOR2I& aPosition,
int aOrientation )
int aOrientation, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
wxString typeName = GetElectricalTypeName();
@ -527,6 +560,16 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
// Get a suitable color
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PRIVATE_NOTES : LAYER_HIDDEN );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( !IsVisible() )
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
if( aDimmed )
color = color.Mix( bg, 0.5f );
VECTOR2I txtpos = aPosition;
int offset = Millimeter2iu( 0.4 );
@ -561,12 +604,20 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
}
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const VECTOR2I& aPosition, int aOrientation ) const
void LIB_PIN::PlotSymbol( PLOTTER *aPlotter, const VECTOR2I &aPosition, int aOrientation,
bool aDimmed ) const
{
int MapX1, MapY1, x1, y1;
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
aPlotter->SetColor( color );
aPlotter->SetCurrentLineWidth( penWidth );
@ -693,9 +744,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const VECTOR2I& aPosition, int aOri
}
}
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const
void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const
{
wxString name = GetShownName();
wxString number = GetShownNumber();
@ -720,6 +770,16 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPin
/* Get the num and name colors */
COLOR4D nameColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
COLOR4D numColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNUM );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
{
nameColor = nameColor.Mix( bg, 0.5f );
numColor = numColor.Mix( bg, 0.5f );
}
int x1 = aPinPos.x;
int y1 = aPinPos.y;
@ -1064,7 +1124,7 @@ void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
void LIB_PIN::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const
const TRANSFORM& aTransform, bool aDimmed ) const
{
if( !IsVisible() || aBackground )
return;
@ -1072,9 +1132,10 @@ void LIB_PIN::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset
int orient = PinDrawOrient( aTransform );
VECTOR2I pos = aTransform.TransformCoordinate( m_position ) + aOffset;
PlotSymbol( aPlotter, pos, orient );
PlotSymbol( aPlotter, pos, orient, aDimmed );
PlotPinTexts( aPlotter, pos, orient, GetParent()->GetPinNameOffset(),
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames() );
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
aDimmed );
}

View File

@ -148,7 +148,7 @@ public:
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform, bool aDimmed ) override;
/**
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
@ -211,10 +211,11 @@ public:
* If TextInside then the text is been put inside (moving from x1, y1 in
* the opposite direction to x2,y2), otherwise all is drawn outside.
*/
void PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const;
void PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPinOrient, int aTextInside,
bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const;
void PlotSymbol( PLOTTER* aPlotter, const VECTOR2I& aPosition, int aOrientation ) const;
void PlotSymbol( PLOTTER *aPlotter, const VECTOR2I &aPosition, int aOrientation,
bool aDimmed ) const;
void Offset( const VECTOR2I& aOffset ) override;
@ -230,7 +231,7 @@ public:
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const override;
const TRANSFORM& aTransform, bool aDimmed ) const override;
BITMAPS GetMenuImage() const override;
@ -255,7 +256,8 @@ protected:
* Print the pin symbol without text.
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/
void printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos, int aOrientation );
void printPinSymbol( const RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, int aOrientation,
bool aDimmed );
/**
* Put the pin number and pin text info, given the pin line coordinates.
@ -266,13 +268,13 @@ protected:
* Pin Name: substring between '~' is negated
*/
void printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName );
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed );
/**
* Draw the electrical type text of the pin (only for the footprint editor)
*/
void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECTOR2I& aPosition,
int aOrientation );
int aOrientation, bool aDimmed );
private:
/**

View File

@ -131,7 +131,7 @@ void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const
const TRANSFORM& aTransform, bool aDimmed ) const
{
if( IsPrivate() )
return;
@ -218,6 +218,14 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
}
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
aPlotter->SetColor( color );
aPlotter->SetDash( penWidth, lineStyle );
@ -261,7 +269,7 @@ int LIB_SHAPE::GetPenWidth() const
void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform, bool aDimmed )
{
if( IsPrivate() )
return;
@ -281,6 +289,14 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
if( color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
unsigned ptCount = 0;
VECTOR2I* buffer = nullptr;

View File

@ -105,7 +105,7 @@ public:
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const override;
const TRANSFORM& aTransform, bool aDimmed ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -127,7 +127,7 @@ private:
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform, bool aDimmed ) override;
EDA_ANGLE getParentOrientation() const override { return ANGLE_0; }
VECTOR2I getParentPosition() const override { return VECTOR2I(); }

View File

@ -620,7 +620,7 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aUnit,
int aConvert, const LIB_SYMBOL_OPTIONS& aOpts )
int aConvert, const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed )
{
/* draw background for filled items using background option
* Solid lines will be drawn after the background
@ -646,7 +646,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
continue;
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
shape.Print( aSettings, aOffset, (void*) false, aOpts.transform );
shape.Print( aSettings, aOffset, (void*) false, aOpts.transform, aDimmed );
}
}
}
@ -677,33 +677,42 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
if( item.Type() == LIB_PIN_T )
{
item.Print( aSettings, aOffset, (void*) &aOpts, aOpts.transform );
item.Print( aSettings, aOffset, (void*) &aOpts, aOpts.transform, aDimmed );
}
else if( item.Type() == LIB_FIELD_T )
{
item.Print( aSettings, aOffset, (void*) NULL, aOpts.transform );
item.Print( aSettings, aOffset, (void*) NULL, aOpts.transform, aDimmed );
}
else if( item.Type() == LIB_SHAPE_T )
{
LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
bool forceNoFill = shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
shape.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform );
shape.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform, aDimmed );
}
else
{
item.Print( aSettings, aOffset, (void*) false, aOpts.transform );
item.Print( aSettings, aOffset, (void*) false, aOpts.transform, aDimmed );
}
}
}
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const
void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground,
const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed ) const
{
wxASSERT( aPlotter != nullptr );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
aPlotter->SetColor( color );
for( const LIB_ITEM& item : m_drawings )
{
@ -722,17 +731,26 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackgro
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
continue;
item.Plot( aPlotter, aBackground, aOffset, aTransform );
item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
}
}
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform )
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed )
{
wxASSERT( aPlotter != nullptr );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) );
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
aPlotter->SetColor( color );
for( LIB_ITEM& item : m_drawings )
{
@ -757,7 +775,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool
field.SetText( text );
}
item.Plot( aPlotter, aBackground, aOffset, aTransform );
item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
field.SetText( tmp );
}
}

View File

@ -322,9 +322,10 @@ public:
* @param aMulti - unit if multiple units per symbol.
* @param aConvert - Symbol conversion (DeMorgan) if available.
* @param aOpts - Drawing options
* @param aDimmed - Reduce brightness of symbol
*/
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti, int aConvert,
const LIB_SYMBOL_OPTIONS& aOpts );
const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed );
/**
* Plot lib symbol to plotter.
@ -337,9 +338,10 @@ public:
* @param aBackground - A poor-man's Z-order.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix.
* @param aDimmed - Reduce brightness of symbol
*/
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const;
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed ) const;
/**
* Plot Lib Fields only of the symbol to plotter.
@ -351,9 +353,10 @@ public:
* @param aBackground - A poor-man's Z-order.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix.
* @param aDimmed - reduce brightness of fields
*/
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform );
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed );
/**
* Add a new draw \a aItem to the draw object list and sort according to \a aSort.

View File

@ -260,7 +260,7 @@ void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
const TRANSFORM& aTransform ) const
const TRANSFORM& aTransform, bool aDimmed ) const
{
wxASSERT( plotter != nullptr );
@ -270,6 +270,8 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
if( aBackground )
return;
RENDER_SETTINGS* settings = plotter->RenderSettings();
BOX2I bBox = GetBoundingBox();
// convert coordinates from draw Y axis to symbol_editor Y axis
bBox.RevertYAxis();
@ -280,11 +282,18 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
COLOR4D color = GetTextColor();
COLOR4D bg = settings->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = plotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
color = settings->GetLayerColor( LAYER_DEVICE );
RENDER_SETTINGS* settings = plotter->RenderSettings();
if( !IsVisible() )
bg = settings->GetLayerColor( LAYER_HIDDEN );
else if( !plotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
int penWidth = std::max( GetEffectiveTextPenWidth(), settings->GetMinPenWidth() );
@ -312,7 +321,7 @@ KIFONT::FONT* LIB_TEXT::GetDrawFont() const
void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = GetTextColor();
@ -322,6 +331,17 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( !IsVisible() )
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
if( aDimmed )
color = color.Mix( bg, 0.5f );
// Calculate the text orientation, according to the symbol orientation/mirror (needed when
// draw text in schematic)
EDA_ANGLE orient = GetTextAngle();

View File

@ -99,7 +99,7 @@ public:
void NormalizeJustification( bool inverse );
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const override;
const TRANSFORM& aTransform, bool aDimmed ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
@ -122,7 +122,7 @@ private:
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform, bool aDimmed ) override;
};

View File

@ -222,7 +222,7 @@ KIFONT::FONT* LIB_TEXTBOX::GetDrawFont() const
void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform, bool aDimmed )
{
if( IsPrivate() )
return;
@ -247,6 +247,14 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
lineStyle = PLOT_DASH_TYPE::SOLID;
@ -281,6 +289,14 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetMinPenWidth() );
if( aTransform.y1 )
@ -353,7 +369,7 @@ BITMAPS LIB_TEXTBOX::GetMenuImage() const
void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const
const TRANSFORM& aTransform, bool aDimmed ) const
{
wxASSERT( aPlotter != nullptr );
@ -362,7 +378,7 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
if( aBackground )
{
LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform );
LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
return;
}
@ -393,6 +409,14 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )
color = color.Mix( bg, 0.5f );
penWidth = std::max( GetEffectiveTextPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
if( aTransform.y1 )

View File

@ -84,7 +84,7 @@ public:
BITMAPS GetMenuImage() const override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& offset,
const TRANSFORM& aTransform ) const override;
const TRANSFORM& aTransform, bool aDimmed ) const override;
EDA_ITEM* Clone() const override
{
@ -99,7 +99,7 @@ private:
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform, bool aDimmed ) override;
};

View File

@ -349,6 +349,12 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
xproperty->AddAttribute( wxT( "name" ), wxT( "exclude_from_board" ) );
}
if( symbol->GetDNP() )
{
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), wxT( "dnp" ) );
}
if( const std::unique_ptr<LIB_SYMBOL>& part = symbol->GetLibSymbolRef() )
{
if( part->GetDescription().size() )

View File

@ -933,6 +933,14 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
COLOR4D color = settings->GetLayerColor( GetLayer() );
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
COLOR4D bg = settings->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
if( !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( SCH_SYMBOL* parent = dyn_cast<SCH_SYMBOL*>( m_parent ); parent && parent->GetDNP() )
color = color.Mix( bg, 0.5f );
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
color = GetTextColor();
@ -951,6 +959,9 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
{
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
if( parentSymbol->GetDNP() )
color = color.Mix( bg, 0.5f );
if( parentSymbol->GetTransform().y1 ) // Rotate symbol 90 deg.
{
if( orient.IsHorizontal() )

View File

@ -86,4 +86,5 @@
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220820 // Fix broken default symbol instance data.
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220822 // Hyperlinks in text objects
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220903 // Field name visibility
#define SEXPR_SCHEMATIC_FILE_VERSION 20220904 // Do not autoplace field option
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220904 // Do not autoplace field option
#define SEXPR_SCHEMATIC_FILE_VERSION 20220914 // Add support for DNP

View File

@ -183,26 +183,29 @@ SCH_PAINTER::SCH_PAINTER( GAL* aGal ) :
m_schematic( nullptr )
{ }
#define HANDLE_ITEM( type_id, type_name ) \
case type_id: draw( (type_name *) item, aLayer ); break
bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
{
const auto item = dynamic_cast<const EDA_ITEM*>( aItem );
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
if( !item )
return false;
draw( item, aLayer, false );
return false;
}
void SCH_PAINTER::draw( const EDA_ITEM *aItem, int aLayer, bool aDimmed )
{
#ifdef CONNECTIVITY_DEBUG
auto sch_item = dynamic_cast<const SCH_ITEM*>( item );
auto sch_item = dynamic_cast<const SCH_ITEM*>( aItem );
auto conn = sch_item ? sch_item->Connection( *g_CurrentSheet ) : nullptr;
if( conn )
{
auto pos = item->GetBoundingBox().Centre();
auto pos = aItem->GetBoundingBox().Centre();
auto label = conn->Name( true );
m_gal->SetHorizontalJustify( GR_TEXT_H_ALIGN_CENTER );
@ -217,50 +220,96 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
if( m_schSettings.GetDrawBoundingBoxes() )
{
BOX2I box = item->GetBoundingBox();
BOX2I box = aItem->GetBoundingBox();
if( item->Type() == SCH_SYMBOL_T )
box = static_cast<const SCH_SYMBOL*>( item )->GetBodyBoundingBox();
if( aItem->Type() == SCH_SYMBOL_T )
box = static_cast<const SCH_SYMBOL*>( aItem )->GetBodyBoundingBox();
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
m_gal->SetStrokeColor( aItem->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
: COLOR4D( 0.2, 0.2, 0.2, 1 ) );
m_gal->SetLineWidth( Mils2iu( 3 ) );
m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
}
switch( item->Type() )
switch( aItem->Type() )
{
HANDLE_ITEM( LIB_SYMBOL_T, LIB_SYMBOL );
HANDLE_ITEM( LIB_SHAPE_T, LIB_SHAPE );
HANDLE_ITEM( LIB_PIN_T, LIB_PIN );
HANDLE_ITEM( LIB_FIELD_T, LIB_FIELD );
HANDLE_ITEM( LIB_TEXT_T, LIB_TEXT );
HANDLE_ITEM( LIB_TEXTBOX_T, LIB_TEXTBOX );
HANDLE_ITEM( SCH_SYMBOL_T, SCH_SYMBOL );
HANDLE_ITEM( SCH_JUNCTION_T, SCH_JUNCTION );
HANDLE_ITEM( SCH_LINE_T, SCH_LINE );
HANDLE_ITEM( SCH_SHAPE_T, SCH_SHAPE );
HANDLE_ITEM( SCH_TEXT_T, SCH_TEXT );
HANDLE_ITEM( SCH_TEXTBOX_T, SCH_TEXTBOX );
HANDLE_ITEM( SCH_LABEL_T, SCH_LABEL );
HANDLE_ITEM( SCH_DIRECTIVE_LABEL_T, SCH_DIRECTIVE_LABEL );
HANDLE_ITEM( SCH_FIELD_T, SCH_FIELD );
HANDLE_ITEM( SCH_HIER_LABEL_T, SCH_HIERLABEL );
HANDLE_ITEM( SCH_GLOBAL_LABEL_T, SCH_GLOBALLABEL );
HANDLE_ITEM( SCH_SHEET_T, SCH_SHEET );
HANDLE_ITEM( SCH_SHEET_PIN_T, SCH_HIERLABEL );
HANDLE_ITEM( SCH_NO_CONNECT_T, SCH_NO_CONNECT );
HANDLE_ITEM( SCH_BUS_WIRE_ENTRY_T, SCH_BUS_ENTRY_BASE );
HANDLE_ITEM( SCH_BUS_BUS_ENTRY_T, SCH_BUS_ENTRY_BASE );
HANDLE_ITEM( SCH_BITMAP_T, SCH_BITMAP );
HANDLE_ITEM( SCH_MARKER_T, SCH_MARKER );
case LIB_SYMBOL_T:
draw( static_cast<const LIB_SYMBOL*>( aItem ), aLayer );
break;
case LIB_SHAPE_T:
draw( static_cast<const LIB_SHAPE*>( aItem ), aLayer, aDimmed );
break;
case LIB_PIN_T:
draw( static_cast<const LIB_PIN*>( aItem ), aLayer, aDimmed );
break;
case LIB_FIELD_T:
draw( static_cast<const LIB_FIELD*>( aItem ), aLayer, aDimmed );
break;
case LIB_TEXT_T:
draw( static_cast<const LIB_TEXT*>( aItem ), aLayer, aDimmed );
break;
case LIB_TEXTBOX_T:
draw( static_cast<const LIB_TEXTBOX*>( aItem ), aLayer, aDimmed );
break;
case SCH_SYMBOL_T:
draw( static_cast<const SCH_SYMBOL*>( aItem ), aLayer );
break;
case SCH_JUNCTION_T:
draw( static_cast<const SCH_JUNCTION*>( aItem ), aLayer );
break;
case SCH_LINE_T:
draw( static_cast<const SCH_LINE*>( aItem ), aLayer );
break;
case SCH_SHAPE_T:
draw( static_cast<const SCH_SHAPE*>( aItem ), aLayer );
break;
case SCH_TEXT_T:
draw( static_cast<const SCH_TEXT*>( aItem ), aLayer );
break;
case SCH_TEXTBOX_T:
draw( static_cast<const SCH_TEXTBOX*>( aItem ), aLayer );
break;
case SCH_LABEL_T:
draw( static_cast<const SCH_LABEL*>( aItem ), aLayer );
break;
case SCH_DIRECTIVE_LABEL_T:
draw( static_cast<const SCH_DIRECTIVE_LABEL*>( aItem ), aLayer );
break;
case SCH_FIELD_T:
draw( static_cast<const SCH_FIELD*>( aItem ), aLayer, aDimmed );
break;
case SCH_HIER_LABEL_T:
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer );
break;
case SCH_GLOBAL_LABEL_T:
draw( static_cast<const SCH_GLOBALLABEL*>( aItem ), aLayer );
break;
case SCH_SHEET_T:
draw( static_cast<const SCH_SHEET*>( aItem ), aLayer );
break;
case SCH_SHEET_PIN_T:
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer );
break;
case SCH_NO_CONNECT_T:
draw( static_cast<const SCH_NO_CONNECT*>( aItem ), aLayer );
break;
case SCH_BUS_WIRE_ENTRY_T:
draw( static_cast<const SCH_BUS_ENTRY_BASE*>( aItem ), aLayer );
break;
case SCH_BUS_BUS_ENTRY_T:
draw( static_cast<const SCH_BUS_ENTRY_BASE*>( aItem ), aLayer );
break;
case SCH_BITMAP_T:
draw( static_cast<const SCH_BITMAP*>( aItem ), aLayer );
break;
case SCH_MARKER_T:
draw( static_cast<const SCH_MARKER*>( aItem ), aLayer );
break;
default: return false;
default: return;
}
return false;
}
@ -305,7 +354,8 @@ float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const
}
COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows ) const
COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows,
bool aDimmed ) const
{
COLOR4D color = m_schSettings.GetLayerColor( aLayer );
@ -410,6 +460,12 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
color = color.Darken( 0.5f );
}
if( aDimmed )
{
COLOR4D sheetColour = m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
color = color.Mix( sheetColour, 0.5f );
}
return color;
}
@ -587,7 +643,7 @@ void SCH_PAINTER::triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D
void SCH_PAINTER::draw( const LIB_SYMBOL *aSymbol, int aLayer, bool aDrawFields, int aUnit,
int aConvert )
int aConvert, bool aDimmed )
{
if( !aUnit )
aUnit = m_schSettings.m_ShowUnit;
@ -615,12 +671,12 @@ void SCH_PAINTER::draw( const LIB_SYMBOL *aSymbol, int aLayer, bool aDrawFields,
if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
continue;
Draw( &item, aLayer );
draw( &item, aLayer, aDimmed );
}
}
bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer, bool aDimmed )
{
const EDA_SHAPE* shape = dynamic_cast<const EDA_SHAPE*>( aItem );
@ -632,8 +688,8 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aItem, true ) );
m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, true ) );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, true ) );
m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, true, aDimmed ) );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, true, aDimmed ) );
return true;
}
@ -650,7 +706,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
}
m_gal->SetIsFill( true );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false ) );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false, aDimmed ) );
m_gal->SetIsStroke( false );
return true;
}
@ -664,15 +720,27 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
|| shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR ) );
if( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE )
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
{
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false, aDimmed ) );
}
else if( shape && shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
m_gal->SetFillColor( shape->GetFillColor() );
{
COLOR4D fillColour = shape->GetFillColor();
if( aDimmed )
{
fillColour = fillColour.Mix(
m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ), 0.5f );
}
m_gal->SetFillColor( fillColour );
}
if( aItem->GetPenWidth() >= 0 || !shape || !shape->IsFilled() )
{
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aItem, false ) );
m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, false, aDimmed ) );
}
else
{
@ -687,7 +755,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
}
void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer, bool aDNP )
{
if( !isUnitAndConversionShown( aShape ) )
return;
@ -695,12 +763,12 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
if( aShape->IsPrivate() && !m_schSettings.m_IsSymbolEditor )
return;
if( !setDeviceColors( aShape, aLayer ) )
if( !setDeviceColors( aShape, aLayer, aDNP ) )
return;
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows, aDNP );
auto drawShape =
[&]( const LIB_SHAPE* shape )
@ -836,7 +904,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
}
void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer, bool aDimmed )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
@ -863,12 +931,12 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
if( !foundLayer )
return;
COLOR4D color = getRenderColor( aField, aLayer, drawingShadows );
COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
if( !( aField->IsVisible() || aField->IsForceVisible() ) )
{
if( m_schSettings.m_IsSymbolEditor || eeconfig()->m_Appearance.show_hidden_fields )
color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows );
color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows, aDimmed );
else
return;
}
@ -908,7 +976,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
}
void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer )
void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer, bool aDimmed )
{
if( !isUnitAndConversionShown( aText ) )
return;
@ -921,12 +989,12 @@ void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer )
if( drawingShadows && !( aText->IsBrightened() || aText->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aText, LAYER_DEVICE, drawingShadows );
COLOR4D color = getRenderColor( aText, LAYER_DEVICE, drawingShadows, aDimmed );
if( !aText->IsVisible() )
{
if( !m_schematic || eeconfig()->m_Appearance.show_hidden_fields )
color = getRenderColor( aText, LAYER_HIDDEN, drawingShadows );
color = getRenderColor( aText, LAYER_HIDDEN, drawingShadows, aDimmed );
else
return;
}
@ -980,7 +1048,7 @@ void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer )
}
void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer )
void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer, bool aDimmed )
{
if( !isUnitAndConversionShown( aTextBox ) )
return;
@ -993,7 +1061,7 @@ void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer )
if( drawingShadows && !( aTextBox->IsBrightened() || aTextBox->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows );
COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
float borderWidth = getLineWidth( aTextBox, drawingShadows );
auto drawText =
@ -1119,7 +1187,7 @@ void SCH_PAINTER::drawPinDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aC
}
void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
void SCH_PAINTER::draw( const LIB_PIN *aPin, int aLayer, bool aDimmed )
{
if( !isUnitAndConversionShown( aPin ) )
return;
@ -1132,13 +1200,13 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
return;
VECTOR2I pos = mapCoords( aPin->GetPosition() );
COLOR4D color = getRenderColor( aPin, LAYER_PIN, drawingShadows );
COLOR4D color = getRenderColor( aPin, LAYER_PIN, drawingShadows, aDimmed );
if( !aPin->IsVisible() )
{
if( !m_schematic || eeconfig()->m_Appearance.show_hidden_pins )
{
color = getRenderColor( aPin, LAYER_HIDDEN, drawingShadows );
color = getRenderColor( aPin, LAYER_HIDDEN, drawingShadows, aDimmed );
}
else
{
@ -2071,14 +2139,14 @@ static void orientSymbol( LIB_SYMBOL* symbol, int orientation )
}
void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aSymbol->GetFields() )
draw( &field, aLayer );
draw( &field, aLayer, aSymbol->GetDNP() );
}
if( isFieldsLayer( aLayer ) )
@ -2134,7 +2202,8 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
tempPin->ClearFlags( IS_DANGLING );
}
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert(),
aSymbol->GetDNP() );
for( unsigned i = 0; i < tempPins.size(); ++i )
{
@ -2149,7 +2218,7 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
}
void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer )
void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
@ -2161,12 +2230,12 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer )
aLayer = aField->GetLayer();
COLOR4D color = getRenderColor( aField, aLayer, drawingShadows );
COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
if( !( aField->IsVisible() || aField->IsForceVisible() ) )
{
if( !m_schematic || eeconfig()->m_Appearance.show_hidden_fields )
color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows );
color = getRenderColor( aField, LAYER_HIDDEN, drawingShadows, aDimmed );
else
return;
}
@ -2286,7 +2355,7 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aLabel->GetFields() )
draw( &field, aLayer );
draw( &field, aLayer, false );
}
if( isFieldsLayer( aLayer ) )
@ -2329,7 +2398,7 @@ void SCH_PAINTER::draw( const SCH_LABEL *aLabel, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aLabel->GetFields() )
draw( &field, aLayer );
draw( &field, aLayer, false );
}
if( isFieldsLayer( aLayer ) )
@ -2349,7 +2418,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aLabel->GetFields() )
draw( &field, aLayer );
draw( &field, aLayer, false );
}
if( isFieldsLayer( aLayer ) )
@ -2397,7 +2466,7 @@ void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL *aLabel, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aLabel->GetFields() )
draw( &field, aLayer );
draw( &field, aLayer, false );
}
if( isFieldsLayer( aLayer ) )
@ -2458,7 +2527,7 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aSheet->GetFields() )
draw( &field, aLayer );
draw( &field, aLayer, false );
}
if( aLayer == LAYER_HIERLABEL || aLayer == LAYER_SELECTION_SHADOWS )

View File

@ -86,7 +86,7 @@ public:
return luma < 0.5;
}
const COLOR4D& GetBackgroundColor() override
const COLOR4D& GetBackgroundColor() const override
{
return m_layerColors[ LAYER_SCHEMATIC_BACKGROUND ];
}
@ -144,16 +144,17 @@ public:
void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
private:
void draw( LIB_PIN* aPin, int aLayer );
void draw( const LIB_SHAPE* aCircle, int aLayer );
void draw( const EDA_ITEM*, int, bool aDimmed );
void draw( const LIB_PIN* aPin, int aLayer, bool aDimmed );
void draw( const LIB_SHAPE* aCircle, int aLayer, bool aDimmed );
void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
int aConvert = 0 );
void draw( const LIB_FIELD* aField, int aLayer );
void draw( const LIB_TEXT* aText, int aLayer );
void draw( const LIB_TEXTBOX* aTextBox, int aLayer );
void draw( SCH_SYMBOL* aSymbol, int aLayer );
int aConvert = 0, bool aDimmed = false );
void draw( const LIB_FIELD* aField, int aLayer, bool aDimmed );
void draw( const LIB_TEXT* aText, int aLayer, bool aDimmed );
void draw( const LIB_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
void draw( const SCH_SYMBOL* aSymbol, int aLayer );
void draw( const SCH_JUNCTION* aJct, int aLayer );
void draw( const SCH_FIELD* aField, int aLayer );
void draw( const SCH_FIELD* aField, int aLayer, bool aDimmed );
void draw( const SCH_SHAPE* aShape, int aLayer );
void draw( const SCH_TEXTBOX* aTextBox, int aLayer );
void draw( const SCH_TEXT* aText, int aLayer );
@ -182,11 +183,11 @@ private:
bool isUnitAndConversionShown( const LIB_ITEM* aItem ) const;
float getShadowWidth( bool aForHighlight ) const;
COLOR4D getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows ) const;
COLOR4D getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows, bool aDimmed = false ) const;
float getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) const;
float getTextThickness( const EDA_ITEM* aItem ) const;
bool setDeviceColors( const LIB_ITEM* aItem, int aLayer );
bool setDeviceColors( const LIB_ITEM* aItem, int aLayer, bool aDimmed );
void triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
void strokeText( const wxString& aText, const VECTOR2D& aPosition,

View File

@ -2546,6 +2546,11 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
NeedRIGHT();
break;
case T_dnp:
symbol->SetDNP( parseBool() );
NeedRIGHT();
break;
case T_fields_autoplaced:
symbol->SetFieldsAutoplaced();
NeedRIGHT();

View File

@ -721,6 +721,7 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
m_out->Print( aNestLevel + 1, "(in_bom %s)", ( aSymbol->GetIncludeInBom() ) ? "yes" : "no" );
m_out->Print( 0, " (on_board %s)", ( aSymbol->GetIncludeOnBoard() ) ? "yes" : "no" );
m_out->Print( 0, " (dnp %s)", ( aSymbol->GetDNP() ) ? "yes" : "no" );
if( aSymbol->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
m_out->Print( 0, " (fields_autoplaced)" );

View File

@ -147,6 +147,7 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
// Inherit the include in bill of materials and board netlist settings from library symbol.
m_inBom = aSymbol.GetIncludeInBom();
m_onBoard = aSymbol.GetIncludeOnBoard();
m_DNP = false;
}
@ -178,6 +179,7 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
m_isInNetlist = aSymbol.m_isInNetlist;
m_inBom = aSymbol.m_inBom;
m_onBoard = aSymbol.m_onBoard;
m_DNP = aSymbol.m_DNP;
if( aSymbol.m_part )
SetLibSymbol( new LIB_SYMBOL( *aSymbol.m_part.get() ) );
@ -456,11 +458,11 @@ void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
if( m_part )
{
m_part->Print( aSettings, m_pos + aOffset, m_unit, m_convert, opts );
m_part->Print( aSettings, m_pos + aOffset, m_unit, m_convert, opts, GetDNP() );
}
else // Use dummy() part if the actual cannot be found.
{
dummy()->Print( aSettings, m_pos + aOffset, 0, 0, opts );
dummy()->Print( aSettings, m_pos + aOffset, 0, 0, opts, GetDNP() );
}
for( SCH_FIELD& field : m_fields )
@ -1045,6 +1047,7 @@ void SCH_SYMBOL::GetContextualTextVars( wxArrayString* aVars ) const
aVars->push_back( wxT( "SYMBOL_KEYWORDS" ) );
aVars->push_back( wxT( "EXCLUDE_FROM_BOM" ) );
aVars->push_back( wxT( "EXCLUDE_FROM_BOARD" ) );
aVars->push_back( wxT( "DNP" ) );
}
@ -1149,12 +1152,17 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
}
else if( token->IsSameAs( wxT( "EXCLUDE_FROM_BOM" ) ) )
{
* token = this->GetIncludeInBom() ? wxT( "" ) : _( "Excluded from BOM" );
*token = this->GetIncludeInBom() ? wxT( "" ) : _( "Excluded from BOM" );
return true;
}
else if( token->IsSameAs( wxT( "EXCLUDE_FROM_BOARD" ) ) )
{
* token = this->GetIncludeOnBoard() ? wxT( "" ) : _( "Excluded from board" );
*token = this->GetIncludeOnBoard() ? wxT( "" ) : _( "Excluded from board" );
return true;
}
else if( token->IsSameAs( wxT( "DNP" ) ) )
{
*token = this->GetDNP() ? wxT( "" ) : _( "DNP" );
return true;
}
@ -1379,7 +1387,7 @@ void SCH_SYMBOL::SetOrientation( int aOrientation )
}
int SCH_SYMBOL::GetOrientation()
int SCH_SYMBOL::GetOrientation() const
{
int rotate_values[] =
{
@ -1399,18 +1407,18 @@ int SCH_SYMBOL::GetOrientation()
// Try to find the current transform option:
TRANSFORM transform = m_transform;
SCH_SYMBOL temp( *this );
for( int type_rotate : rotate_values )
{
SetOrientation( type_rotate );
temp.SetOrientation( type_rotate );
if( transform == m_transform )
if( transform == temp.GetTransform() )
return type_rotate;
}
// Error: orientation not found in list (should not happen)
wxFAIL_MSG( "Schematic symbol orientation matrix internal error." );
m_transform = transform;
return SYM_NORMAL;
}
@ -2029,7 +2037,8 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
for( bool local_background : { true, false } )
{
tempSymbol.Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp );
tempSymbol.Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp,
GetDNP() );
for( SCH_FIELD field : m_fields )
field.Plot( aPlotter, local_background );
@ -2083,7 +2092,7 @@ void SCH_SYMBOL::PlotPins( PLOTTER* aPlotter ) const
tempPin->SetName( symbolPin->GetShownName() );
tempPin->SetType( symbolPin->GetType() );
tempPin->SetShape( symbolPin->GetShape() );
tempPin->Plot( aPlotter, false, m_pos, transform);
tempPin->Plot( aPlotter, false, m_pos, transform, GetDNP() );
}
}
}

View File

@ -307,7 +307,7 @@ public:
*
* @return the orientation and mirror of the symbol.
*/
int GetOrientation();
int GetOrientation() const;
/**
* Return the list of system text vars & fields for this symbol.
@ -736,6 +736,9 @@ public:
bool GetIncludeOnBoard() const { return m_onBoard; }
void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
bool GetDNP() const { return m_DNP; }
void SetDNP( bool aDNP ) { m_DNP = aDNP; }
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
private:
@ -776,6 +779,7 @@ private:
bool m_isInNetlist; ///< True if the symbol should appear in the netlist
bool m_inBom; ///< True to include in bill of materials export.
bool m_onBoard; ///< True to include in netlist when updating board.
bool m_DNP; ///< True if symbol is set to 'Do Not Populate'.
// Defines the hierarchical path and reference of the symbol. This allows support
// for multiple references to a single sub-sheet.

View File

@ -28,6 +28,7 @@ default_instance
diameter
diamond
directive_label
dnp
do_not_autoplace
dot
edge_clock_high

View File

@ -68,15 +68,15 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
plotPos.x = pageInfo.GetWidthIU( IU_PER_MILS ) / 2;
plotPos.y = pageInfo.GetHeightIU( IU_PER_MILS ) / 2;
m_symbol->Plot( plotter, GetUnit(), GetConvert(), background, plotPos, temp );
m_symbol->Plot( plotter, GetUnit(), GetConvert(), background, plotPos, temp, false );
// Plot lib fields, not plotted by m_symbol->Plot():
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), background, plotPos, temp );
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), background, plotPos, temp, false );
m_symbol->Plot( plotter, GetUnit(), GetConvert(), !background, plotPos, temp );
m_symbol->Plot( plotter, GetUnit(), GetConvert(), !background, plotPos, temp, false );
// Plot lib fields, not plotted by m_symbol->Plot():
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), !background, plotPos, temp );
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), !background, plotPos, temp, false );
}
plotter->EndPlot();
@ -99,5 +99,5 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
plot_offset.x = pagesize.x / 2;
plot_offset.y = pagesize.y / 2;
m_symbol->Print( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS() );
m_symbol->Print( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS(), false );
}

View File

@ -78,7 +78,7 @@ public:
update(); // recompute other shades of the color
}
const COLOR4D& GetBackgroundColor() override
const COLOR4D& GetBackgroundColor() const override
{
return m_layerColors[ LAYER_GERBVIEW_BACKGROUND ];
}

View File

@ -60,7 +60,7 @@ public:
return luma < 0.5;
}
const COLOR4D& GetBackgroundColor() override { return m_backgroundColor; }
const COLOR4D& GetBackgroundColor() const override { return m_backgroundColor; }
void SetBackgroundColor( const COLOR4D& aColor ) override { m_backgroundColor = aColor; }
void SetNormalColor( const COLOR4D& aColor ) { m_normalColor = aColor; }

View File

@ -229,7 +229,7 @@ public:
/**
* Return current background color settings.
*/
virtual const COLOR4D& GetBackgroundColor() = 0;
virtual const COLOR4D& GetBackgroundColor() const = 0;
/**
* Set the background color.

View File

@ -105,8 +105,8 @@ public:
/**
* Get the colors to use in a preview widget to match the preview panel.
*/
virtual const KIGFX::COLOR4D& GetBackgroundColor() = 0;
virtual const KIGFX::COLOR4D& GetForegroundColor() = 0;
virtual const KIGFX::COLOR4D& GetBackgroundColor() const = 0;
virtual const KIGFX::COLOR4D& GetForegroundColor() const = 0;
/**
* Return a footprint preview panel instance via Kiface. May return null

View File

@ -73,7 +73,7 @@ FOOTPRINT_PREVIEW_PANEL::~FOOTPRINT_PREVIEW_PANEL( )
}
const COLOR4D& FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor()
const COLOR4D& FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor() const
{
KIGFX::PAINTER* painter = GetView()->GetPainter();
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
@ -82,7 +82,7 @@ const COLOR4D& FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor()
}
const COLOR4D& FOOTPRINT_PREVIEW_PANEL::GetForegroundColor()
const COLOR4D& FOOTPRINT_PREVIEW_PANEL::GetForegroundColor() const
{
KIGFX::PAINTER* painter = GetView()->GetPainter();
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );

View File

@ -55,8 +55,8 @@ public:
virtual bool DisplayFootprint( const LIB_ID& aFPID ) override;
virtual const KIGFX::COLOR4D& GetBackgroundColor() override;
virtual const KIGFX::COLOR4D& GetForegroundColor() override;
virtual const KIGFX::COLOR4D& GetBackgroundColor() const override;
virtual const KIGFX::COLOR4D& GetForegroundColor() const override;
virtual wxWindow* GetWindow() override;
BOARD* GetBoard() { return m_dummyBoard.get(); }

View File

@ -396,6 +396,46 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint,
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
}
if( ( aNetlistComponent->GetProperties().count( wxT( "dnp" ) ) > 0 )
!= ( ( aPcbFootprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES ) > 0 ) )
{
if( m_isDryRun )
{
if( aNetlistComponent->GetProperties().count( wxT( "dnp" ) ) )
{
msg.Printf( _( "Add %s 'exclude from position files' fabrication attribute." ),
aPcbFootprint->GetReference() );
}
else
{
msg.Printf( _( "Remove %s 'exclude from position files' fabrication attribute." ),
aPcbFootprint->GetReference() );
}
}
else
{
int attributes = aPcbFootprint->GetAttributes();
if( aNetlistComponent->GetProperties().count( wxT( "dnp" ) ) )
{
attributes |= FP_EXCLUDE_FROM_POS_FILES;
msg.Printf( _( "Added %s 'exclude from position files' fabrication attribute." ),
aPcbFootprint->GetReference() );
}
else
{
attributes &= ~FP_EXCLUDE_FROM_POS_FILES;
msg.Printf( _( "Removed %s 'exclude from position files' fabrication attribute." ),
aPcbFootprint->GetReference() );
}
changed = true;
aPcbFootprint->SetAttributes( attributes );
}
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
}
if( changed && copy )
m_commit.Modified( aPcbFootprint, copy );
else

View File

@ -96,7 +96,7 @@ public:
return luma < 0.5;
}
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
const COLOR4D& GetBackgroundColor() const override { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
void SetBackgroundColor( const COLOR4D& aColor ) override
{