ADDED: markers for excluded-from-sim items.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15382
This commit is contained in:
Jeff Young 2024-06-03 13:59:40 +01:00
parent 5e1a16e821
commit ec0fdfffff
17 changed files with 2120 additions and 1940 deletions

View File

@ -137,6 +137,7 @@ wxString LayerName( int aLayer )
case LAYER_SHEETLABEL: return _( "Sheet pins" );
case LAYER_NOCONNECT: return _( "No-connect symbols" );
case LAYER_DNP_MARKER: return _( "DNP markers" );
case LAYER_EXCLUDED_FROM_SIM: return _( "Excluded-from-simulation markers" );
case LAYER_ERC_WARN: return _( "ERC warnings" );
case LAYER_ERC_ERR: return _( "ERC errors" );
case LAYER_ERC_EXCLUSION: return _( "ERC exclusions" );

View File

@ -37,14 +37,15 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_DEVICE_BACKGROUND, CSS_COLOR( 255, 255, 194, 1 ) },
{ LAYER_DEVICE, CSS_COLOR( 132, 0, 0, 1 ) },
{ LAYER_SCHEMATIC_CURSOR, CSS_COLOR( 15, 15, 15, 1 ) },
{ LAYER_DNP_MARKER, CSS_COLOR( 220, 9, 13, 0.7 ) },
{ LAYER_DNP_MARKER, CSS_COLOR( 220, 9, 13, 0.85 ) },
{ LAYER_EXCLUDED_FROM_SIM, CSS_COLOR( 194, 194, 194, 0.95 ) },
{ LAYER_ERC_ERR, CSS_COLOR( 230, 9, 13, 0.8 ) },
{ LAYER_ERC_WARN, CSS_COLOR( 209, 146, 0, 0.8 ) },
{ LAYER_ERC_EXCLUSION, CSS_COLOR( 94, 194, 194, 0.8 ) },
{ LAYER_ERC_EXCLUSION, CSS_COLOR( 194, 194, 194, 0.8 ) },
{ LAYER_FIELDS, CSS_COLOR( 132, 0, 132, 1 ) },
{ LAYER_SCHEMATIC_GRID, CSS_COLOR( 181, 181, 181, 1 ) },
{ LAYER_SCHEMATIC_GRID_AXES, CSS_COLOR( 0, 0, 132, 1 ) },
{ LAYER_HIDDEN, CSS_COLOR( 94, 194, 194, 1 ) },
{ LAYER_HIDDEN, CSS_COLOR( 194, 194, 194, 1 ) },
{ LAYER_JUNCTION, CSS_COLOR( 0, 150, 0, 1 ) },
{ LAYER_GLOBLABEL, CSS_COLOR( 132, 0, 0, 1 ) },
{ LAYER_HIERLABEL, CSS_COLOR( 114, 86, 0, 1 ) },
@ -256,7 +257,8 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_DEVICE_BACKGROUND, COLOR4D( LIGHTYELLOW ) },
{ LAYER_DEVICE, COLOR4D( RED ) },
{ LAYER_SCHEMATIC_CURSOR, COLOR4D( BLACK ) },
{ LAYER_DNP_MARKER, COLOR4D( PURERED ).WithAlpha( 0.7 ) },
{ LAYER_DNP_MARKER, COLOR4D( PURERED ).WithAlpha( 0.85 ) },
{ LAYER_EXCLUDED_FROM_SIM, COLOR4D( LIGHTGRAY ).WithAlpha( 0.95 ) },
{ LAYER_ERC_ERR, COLOR4D( PURERED ).WithAlpha( 0.8 ) },
{ LAYER_ERC_WARN, COLOR4D( PUREGREEN ).WithAlpha( 0.8 ) },
{ LAYER_ERC_EXCLUSION, COLOR4D( LIGHTGRAY ) },

View File

@ -63,6 +63,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "schematic.component_outline", LAYER_DEVICE );
CLR( "schematic.cursor", LAYER_SCHEMATIC_CURSOR );
CLR( "schematic.dnp_marker", LAYER_DNP_MARKER );
CLR( "schematic.excluded_from_sim", LAYER_EXCLUDED_FROM_SIM );
CLR( "schematic.erc_error", LAYER_ERC_ERR );
CLR( "schematic.erc_warning", LAYER_ERC_WARN );
CLR( "schematic.erc_exclusion", LAYER_ERC_EXCLUSION );

View File

@ -58,6 +58,7 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf
m_checkShowERCErrors->SetValue( cfg->m_Appearance.show_erc_errors );
m_checkShowERCWarnings->SetValue( cfg->m_Appearance.show_erc_warnings );
m_checkShowERCExclusions->SetValue( cfg->m_Appearance.show_erc_exclusions );
m_cbMarkSimExclusions->SetValue( cfg->m_Appearance.mark_sim_exclusions );
m_checkShowOPVoltages->SetValue( cfg->m_Appearance.show_op_voltages );
m_checkShowOPCurrents->SetValue( cfg->m_Appearance.show_op_currents );
m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits );
@ -100,6 +101,7 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
cfg->m_Appearance.show_erc_warnings = m_checkShowERCWarnings->GetValue();
cfg->m_Appearance.show_erc_errors = m_checkShowERCErrors->GetValue();
cfg->m_Appearance.show_erc_exclusions = m_checkShowERCExclusions->GetValue();
cfg->m_Appearance.mark_sim_exclusions = m_cbMarkSimExclusions->GetValue();
cfg->m_Appearance.show_op_voltages = m_checkShowOPVoltages->GetValue();
cfg->m_Appearance.show_op_currents = m_checkShowOPCurrents->GetValue();
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -65,6 +65,10 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_checkShowERCExclusions = new wxCheckBox( this, wxID_ANY, _("Show ERC exclusions"), wxDefaultPosition, wxDefaultSize, 0 );
bAppearanceSizer->Add( m_checkShowERCExclusions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbMarkSimExclusions = new wxCheckBox( this, wxID_ANY, _("Mark items which are excluded from simulation"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbMarkSimExclusions->SetValue(true);
bAppearanceSizer->Add( m_cbMarkSimExclusions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkShowOPVoltages = new wxCheckBox( this, wxID_ANY, _("Show OP voltages"), wxDefaultPosition, wxDefaultSize, 0 );
bAppearanceSizer->Add( m_checkShowOPVoltages, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -47,6 +47,7 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
wxCheckBox* m_checkShowERCErrors;
wxCheckBox* m_checkShowERCWarnings;
wxCheckBox* m_checkShowERCExclusions;
wxCheckBox* m_cbMarkSimExclusions;
wxCheckBox* m_checkShowOPVoltages;
wxCheckBox* m_checkShowOPCurrents;
wxCheckBox* m_checkPageLimits;

View File

@ -203,6 +203,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_exclusions",
&m_Appearance.show_erc_exclusions, false ) );
m_params.emplace_back( new PARAM<bool>( "appearance.mark_sim_exclusions",
&m_Appearance.mark_sim_exclusions, true ) );
m_params.emplace_back( new PARAM<bool>( "appearance.show_op_voltages",
&m_Appearance.show_op_voltages, true ) );

View File

@ -69,6 +69,7 @@ public:
bool show_hidden_pins;
bool show_hidden_fields;
bool show_directive_labels;
bool mark_sim_exclusions;
bool show_erc_warnings;
bool show_erc_errors;
bool show_erc_exclusions;

View File

@ -229,6 +229,7 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
viewMenu->Add( EE_ACTIONS::toggleERCErrors, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleERCWarnings, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleERCExclusions, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::markSimExclusions, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleOPVoltages, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleOPCurrents, ACTION_MENU::CHECK );

View File

@ -670,6 +670,13 @@ void SCH_EDIT_FRAME::setupUIConditions()
return cfg && cfg->m_Appearance.show_erc_exclusions;
};
auto markSimExclusionsCond =
[this]( const SELECTION& )
{
EESCHEMA_SETTINGS* cfg = eeconfig();
return cfg && cfg->m_Appearance.mark_sim_exclusions;
};
auto showOPVoltagesCond =
[this]( const SELECTION& )
{
@ -740,6 +747,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( EE_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
mgr->SetConditions( EE_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
mgr->SetConditions( EE_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
@ -1489,31 +1497,30 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
{
int flags = 0;
auto invalidateTextVars =
[&flags]( EDA_TEXT* text )
{
if( text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
};
if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
{
item->RunOnChildren(
[&flags]( SCH_ITEM* aChild )
[&invalidateTextVars]( SCH_ITEM* aChild )
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
invalidateTextVars( text );
} );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
invalidateTextVars( text );
return flags;
} );
@ -1982,6 +1989,17 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
auto invalidateTextVars =
[&flags]( EDA_TEXT* text )
{
if( text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
};
if( connection && connection->HasDriverChanged() )
{
connection->ClearDriverChanged();
@ -1991,31 +2009,19 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
if( item )
{
item->RunOnChildren(
[&flags]( SCH_ITEM* aChild )
[&invalidateTextVars]( SCH_ITEM* aChild )
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
invalidateTextVars( text );
} );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
if( flags & KIGFX::GEOMETRY )
GetScreen()->Update( item, false ); // Refresh RTree
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
invalidateTextVars( text );
return flags;
} );

View File

@ -2150,6 +2150,9 @@ wxString SCH_PAINTER::expandLibItemTextVars( const wxString& aSourceText,
void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool DNP = aSymbol->GetDNP();
bool markExclusion = eeconfig()->m_Appearance.mark_sim_exclusions
&& aSymbol->GetExcludedFromSim();
if( m_schSettings.IsPrinting() && drawingShadows )
return;
@ -2157,7 +2160,7 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aSymbol->GetFields() )
draw( &field, aLayer, aSymbol->GetDNP() );
draw( &field, aLayer, DNP || markExclusion );
}
if( isFieldsLayer( aLayer ) )
@ -2228,7 +2231,8 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
tempPin->SetOperatingPoint( symbolPin->GetOperatingPoint() );
}
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetBodyStyle(), aSymbol->GetDNP() );
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetBodyStyle(),
DNP || markExclusion );
for( unsigned i = 0; i < tempPins.size(); ++i )
{
@ -2241,12 +2245,14 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
// IS_SHOWN_AS_BITMAP
}
if( aSymbol->GetDNP() )
if( DNP || markExclusion )
{
int layer = DNP ? LAYER_DNP_MARKER : LAYER_EXCLUDED_FROM_SIM;
BOX2I bbox = aSymbol->GetBodyBoundingBox();
BOX2I pins = aSymbol->GetBodyAndPinsBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
int strokeWidth = 3 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
@ -2259,12 +2265,12 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
m_gal->AdvanceDepth();
m_gal->SetIsStroke( true );
m_gal->SetIsFill( true );
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_DNP_MARKER ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_DNP_MARKER ) );
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
m_gal->DrawSegment( pt1, pt2, strokeWidth );
std::swap( pt1.x, pt2.x );
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
m_gal->DrawSegment( pt1, pt2, strokeWidth );
m_gal->PopDepth();
}
}
@ -2668,6 +2674,9 @@ void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer )
void SCH_PAINTER::draw( const SCH_SHEET* aSheet, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool DNP = aSheet->GetDNP();
bool markExclusion = eeconfig()->m_Appearance.mark_sim_exclusions
&& aSheet->GetExcludedFromSim();
if( m_schSettings.IsPrinting() && drawingShadows )
return;
@ -2675,10 +2684,10 @@ 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, aSheet->GetDNP() );
draw( &field, aLayer, DNP || markExclusion );
for( SCH_SHEET_PIN* sheetPin : aSheet->GetPins() )
draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer, aSheet->GetDNP() );
draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer, DNP || markExclusion );
}
if( isFieldsLayer( aLayer ) )
@ -2711,12 +2720,14 @@ void SCH_PAINTER::draw( const SCH_SHEET* aSheet, int aLayer )
m_gal->DrawRectangle( pos, pos + size );
}
if( aSheet->GetDNP() )
if( DNP || markExclusion )
{
int layer = DNP ? LAYER_DNP_MARKER : LAYER_EXCLUDED_FROM_SIM;
BOX2I bbox = aSheet->GetBodyBoundingBox();
BOX2I pins = aSheet->GetBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
int strokeWidth = 3 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
@ -2729,12 +2740,12 @@ void SCH_PAINTER::draw( const SCH_SHEET* aSheet, int aLayer )
m_gal->AdvanceDepth();
m_gal->SetIsStroke( true );
m_gal->SetIsFill( true );
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_DNP_MARKER ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_DNP_MARKER ) );
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
m_gal->DrawSegment( pt1, pt2, strokeWidth );
std::swap( pt1.x, pt2.x );
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
m_gal->DrawSegment( pt1, pt2, strokeWidth );
m_gal->PopDepth();
}
}

View File

@ -1185,6 +1185,12 @@ TOOL_ACTION EE_ACTIONS::toggleERCExclusions( TOOL_ACTION_ARGS()
.FriendlyName( _( "Show ERC Exclusions" ) )
.Tooltip( _( "Show markers for excluded electrical rules checker violations" ) ) );
TOOL_ACTION EE_ACTIONS::markSimExclusions( TOOL_ACTION_ARGS()
.Name( "eeschema.EditorControl.markSimExclusions" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Mark items excluded from simulation" ) )
.Tooltip( _( "Draw 'X's over items which have been excluded from simulation" ) ) );
TOOL_ACTION EE_ACTIONS::toggleOPVoltages( TOOL_ACTION_ARGS()
.Name( "eeschema.EditorControl.showOperatingPointVoltages" )
.Scope( AS_GLOBAL )

View File

@ -239,6 +239,7 @@ public:
static TOOL_ACTION toggleERCWarnings;
static TOOL_ACTION toggleERCErrors;
static TOOL_ACTION toggleERCExclusions;
static TOOL_ACTION markSimExclusions;
static TOOL_ACTION toggleOPVoltages;
static TOOL_ACTION toggleOPCurrents;
static TOOL_ACTION toggleSyncedPinsMode;

View File

@ -1014,6 +1014,17 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
{
int flags = 0;
auto invalidateTextVars =
[&flags]( EDA_TEXT* text )
{
if( text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
};
// Netclass coloured items
//
if( dynamic_cast<SCH_LINE*>( aItem ) )
@ -1028,31 +1039,19 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
{
item->RunOnChildren(
[&flags]( SCH_ITEM* aChild )
[&invalidateTextVars]( SCH_ITEM* aChild )
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
invalidateTextVars( text );
} );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
if( flags & KIGFX::GEOMETRY )
m_frame->GetScreen()->Update( item, false ); // Refresh RTree
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
invalidateTextVars( text );
return flags;
} );
}
@ -2473,7 +2472,52 @@ int SCH_EDITOR_CONTROL::ToggleERCExclusions( const TOOL_EVENT& aEvent )
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
cfg->m_Appearance.show_erc_exclusions = !cfg->m_Appearance.show_erc_exclusions;
getView()->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
m_frame->GetCanvas()->Refresh();
return 0;
}
int SCH_EDITOR_CONTROL::MarkSimExclusions( const TOOL_EVENT& aEvent )
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
cfg->m_Appearance.mark_sim_exclusions = !cfg->m_Appearance.mark_sim_exclusions;
m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally(
[&]( KIGFX::VIEW_ITEM* aItem ) -> int
{
int flags = 0;
auto invalidateTextVars =
[&flags]( EDA_TEXT* text )
{
if( text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
};
if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
{
item->RunOnChildren(
[&invalidateTextVars]( SCH_ITEM* aChild )
{
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
invalidateTextVars( text );
} );
if( item->GetExcludedFromSim() )
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
invalidateTextVars( text );
return flags;
} );
m_frame->GetCanvas()->Refresh();
return 0;
@ -2741,6 +2785,7 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::ToggleERCWarnings, EE_ACTIONS::toggleERCWarnings.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCErrors, EE_ACTIONS::toggleERCErrors.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCExclusions, EE_ACTIONS::toggleERCExclusions.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::MarkSimExclusions, EE_ACTIONS::markSimExclusions.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleOPVoltages, EE_ACTIONS::toggleOPVoltages.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleOPCurrents, EE_ACTIONS::toggleOPCurrents.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineModeFree.MakeEvent() );

View File

@ -136,6 +136,7 @@ public:
int ToggleERCWarnings( const TOOL_EVENT& aEvent );
int ToggleERCErrors( const TOOL_EVENT& aEvent );
int ToggleERCExclusions( const TOOL_EVENT& aEvent );
int MarkSimExclusions( const TOOL_EVENT& aEvent );
int ToggleOPVoltages( const TOOL_EVENT& aEvent );
int ToggleOPCurrents( const TOOL_EVENT& aEvent );
int ChangeLineMode( const TOOL_EVENT& aEvent );

View File

@ -383,6 +383,7 @@ enum SCH_LAYER_ID: int
LAYER_ERC_WARN,
LAYER_ERC_ERR,
LAYER_ERC_EXCLUSION,
LAYER_EXCLUDED_FROM_SIM,
LAYER_DEVICE_BACKGROUND,
LAYER_SHEET_BACKGROUND,
LAYER_SCHEMATIC_GRID,