Add grouping for violation severities.

Fixes https://gitlab.com/kicad/code/kicad/issues/6616
This commit is contained in:
Jeff Young 2020-12-06 18:45:05 +00:00
parent 58afaeb9eb
commit d0f9503ee0
3 changed files with 62 additions and 37 deletions

View File

@ -49,6 +49,7 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
wxFlexGridSizer* gridSizer = new wxFlexGridSizer( 0, 2, 0, 5 );
gridSizer->SetFlexibleDirection( wxBOTH );
gridSizer->SetVGap( 5 );
for( const RC_ITEM& item : m_items )
{
@ -58,13 +59,23 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
if( m_pinMapSpecialCase && errorCode == m_pinMapSpecialCase->GetErrorCode() )
continue;
// When msg is empty, for some reason, the current errorCode is not supported
// by the RC_ITEM aDummyItem.
// Skip this errorCode.
if( !msg.IsEmpty() )
if( errorCode == 0 )
{
wxStaticText* heading = new wxStaticText( scrollWin, wxID_ANY, msg );
wxFont headingFont = heading->GetFont();
heading->SetFont( headingFont.Bold() );
gridSizer->AddSpacer( 5 ); // col 1
gridSizer->AddSpacer( 5 ); // col 2
gridSizer->Add( heading, 0, wxALIGN_BOTTOM | wxALL, 4 );
gridSizer->AddSpacer( 0 ); // col 2
}
else if( !msg.IsEmpty() ) // items with no message are for internal use only
{
wxStaticText* errorLabel = new wxStaticText( scrollWin, wxID_ANY, msg + wxT( ":" ) );
gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 4 );
gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 15 );
// OSX can't handle more than 100 radio buttons in a single window (yes, seriously),
// so we have to create a window for each set
@ -76,15 +87,15 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
m_buttonMap[ errorCode ][i] = new wxRadioButton( radioPanel,
baseID + errorCode * 10 + i,
severities[i],
wxDefaultPosition,
wxDefaultSize,
wxDefaultPosition, wxDefaultSize,
i == 0 ? wxRB_GROUP : 0 );
radioSizer->Add( m_buttonMap[ errorCode ][i], 0, wxRIGHT | wxEXPAND, 30 );
radioSizer->Add( m_buttonMap[ errorCode ][i], 0,
wxRIGHT | wxALIGN_CENTER_VERTICAL, 30 );
}
radioPanel->SetSizer( radioSizer );
radioPanel->Layout();
gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 4 );
gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL );
}
}
@ -96,7 +107,7 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
wxString msg = m_pinMapSpecialCase->GetErrorText();
wxStaticText* errorLabel = new wxStaticText( scrollWin, wxID_ANY, msg + wxT( ":" ) );
gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 4 );
gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 15 );
wxPanel* radioPanel = new wxPanel( scrollWin );
wxBoxSizer* radioSizer = new wxBoxSizer( wxHORIZONTAL );
@ -113,16 +124,16 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
m_buttonMap[ errorCode ][i] = new wxRadioButton( radioPanel,
baseID + errorCode * 10 + i,
pinMapSeverities[i],
wxDefaultPosition,
wxDefaultSize,
wxDefaultPosition, wxDefaultSize,
i == 0 ? wxRB_GROUP : 0 );
radioSizer->Add( m_buttonMap[ errorCode ][i], 0, wxEXPAND );
radioSizer->Add( m_buttonMap[ errorCode ][i], 0,
wxEXPAND | wxALIGN_CENTER_VERTICAL );
}
}
radioPanel->SetSizer( radioSizer );
radioPanel->Layout();
gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 4 );
gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL );
}
scrollWin->SetSizer( gridSizer );

View File

@ -38,6 +38,13 @@
// NOTE: Avoid changing the settings key for a DRC item after it has been created
DRC_ITEM DRC_ITEM::heading_electrical( 0, _( "Electrical" ), "" );
DRC_ITEM DRC_ITEM::heading_DFM( 0, _( "Design For Manufacturing" ), "" );
DRC_ITEM DRC_ITEM::heading_schematic_parity( 0, _( "Schematic Parity" ), "" );
DRC_ITEM DRC_ITEM::heading_signal_integrity( 0, _( "Signal Integrity" ), "" );
DRC_ITEM DRC_ITEM::heading_misc( 0, _( "Miscellaneous" ), "" );
DRC_ITEM DRC_ITEM::unconnectedItems( DRCE_UNCONNECTED_ITEMS,
_( "Unconnected items" ),
wxT( "unconnected_items" ) );
@ -110,10 +117,6 @@ DRC_ITEM DRC_ITEM::microviaDrillTooSmall( DRCE_TOO_SMALL_MICROVIA_DRILL,
_( "Micro via drill too small" ),
wxT( "microvia_drill_too_small" ) );
DRC_ITEM DRC_ITEM::keepout( DRCE_KEEPOUT,
_( "Keepout violation" ),
wxT( "keepout" ) );
DRC_ITEM DRC_ITEM::courtyardsOverlap( DRCE_OVERLAPPING_FOOTPRINTS,
_( "Courtyards overlap" ),
wxT( "courtyards_overlap" ) );
@ -191,43 +194,51 @@ DRC_ITEM DRC_ITEM::diffPairUncoupledLengthTooLong( DRCE_DIFF_PAIR_UNCOUPLED_LENG
wxT( "diff_pair_uncoupled_length_too_long" ) );
std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
DRC_ITEM::unconnectedItems,
DRC_ITEM::heading_electrical,
DRC_ITEM::shortingItems,
DRC_ITEM::itemsNotAllowed,
DRC_ITEM::clearance,
DRC_ITEM::tracksCrossing,
DRC_ITEM::copperEdgeClearance,
DRC_ITEM::zonesIntersect,
DRC_ITEM::zoneHasEmptyNet,
DRC_ITEM::clearance,
DRC_ITEM::viaDangling,
DRC_ITEM::trackDangling,
DRC_ITEM::holeNearHole,
DRC_ITEM::heading_DFM,
DRC_ITEM::copperEdgeClearance,
DRC_ITEM::holeClearance,
DRC_ITEM::holeNearHole,
DRC_ITEM::trackWidth,
DRC_ITEM::annularWidth,
DRC_ITEM::drillTooSmall,
DRC_ITEM::padstack,
DRC_ITEM::microviaDrillTooSmall,
DRC_ITEM::keepout,
DRC_ITEM::courtyardsOverlap,
DRC_ITEM::missingCourtyard,
DRC_ITEM::malformedCourtyard,
DRC_ITEM::pthInsideCourtyard,
DRC_ITEM::npthInsideCourtyard,
DRC_ITEM::itemOnDisabledLayer,
DRC_ITEM::invalidOutline,
DRC_ITEM::heading_schematic_parity,
DRC_ITEM::duplicateFootprints,
DRC_ITEM::missingFootprint,
DRC_ITEM::extraFootprint,
DRC_ITEM::netConflict,
DRC_ITEM::unresolvedVariable,
DRC_ITEM::silkOverlaps,
DRC_ITEM::silkMaskClearance,
DRC_ITEM::unconnectedItems,
DRC_ITEM::heading_signal_integrity,
DRC_ITEM::lengthOutOfRange,
DRC_ITEM::skewOutOfRange,
DRC_ITEM::tooManyVias,
DRC_ITEM::diffPairGapOutOfRange,
DRC_ITEM::diffPairUncoupledLengthTooLong
DRC_ITEM::diffPairUncoupledLengthTooLong,
DRC_ITEM::heading_misc,
DRC_ITEM::itemsNotAllowed,
DRC_ITEM::silkOverlaps,
DRC_ITEM::silkMaskClearance,
DRC_ITEM::zonesIntersect,
DRC_ITEM::zoneHasEmptyNet,
DRC_ITEM::padstack,
DRC_ITEM::pthInsideCourtyard,
DRC_ITEM::npthInsideCourtyard,
DRC_ITEM::itemOnDisabledLayer,
DRC_ITEM::unresolvedVariable,
} );
@ -253,7 +264,6 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
case DRCE_VIA_DIAMETER: return std::make_shared<DRC_ITEM>( viaDiameter );
case DRCE_PADSTACK: return std::make_shared<DRC_ITEM>( padstack );
case DRCE_TOO_SMALL_MICROVIA_DRILL: return std::make_shared<DRC_ITEM>( microviaDrillTooSmall );
case DRCE_KEEPOUT: return std::make_shared<DRC_ITEM>( keepout );
case DRCE_OVERLAPPING_FOOTPRINTS: return std::make_shared<DRC_ITEM>( courtyardsOverlap );
case DRCE_MISSING_COURTYARD: return std::make_shared<DRC_ITEM>( missingCourtyard );
case DRCE_MALFORMED_COURTYARD: return std::make_shared<DRC_ITEM>( malformedCourtyard );

View File

@ -51,7 +51,6 @@ enum PCB_DRC_CODE {
DRCE_VIA_DIAMETER, // Via diameter checks (min/max)
DRCE_PADSTACK, // something is wrong with a pad or via stackup
DRCE_TOO_SMALL_MICROVIA_DRILL, // Too small micro via drill
DRCE_KEEPOUT, // A disallowed object is inside a keepout
DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
@ -120,6 +119,12 @@ private:
/// A list of all DRC_ITEM types which are valid error codes
static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
static DRC_ITEM heading_electrical;
static DRC_ITEM heading_DFM;
static DRC_ITEM heading_schematic_parity;
static DRC_ITEM heading_signal_integrity;
static DRC_ITEM heading_misc;
static DRC_ITEM unconnectedItems;
static DRC_ITEM shortingItems;
static DRC_ITEM itemsNotAllowed;
@ -138,7 +143,6 @@ private:
static DRC_ITEM viaDiameter;
static DRC_ITEM padstack;
static DRC_ITEM microviaDrillTooSmall;
static DRC_ITEM keepout;
static DRC_ITEM courtyardsOverlap;
static DRC_ITEM missingCourtyard;
static DRC_ITEM malformedCourtyard;