28 #include <wx/radiobut.h> 29 #include <wx/scrolwin.h> 30 #include <wx/stattext.h> 31 #include <wx/treebook.h> 35 std::vector<std::reference_wrapper<RC_ITEM>> aItems,
36 std::map<int, SEVERITY>& aSeverities,
38 wxPanel( aParent->GetTreebook() ),
39 m_severities( aSeverities ),
41 m_pinMapSpecialCase( aPinMapSpecialCase )
43 wxString severities[] = {
_(
"Error" ),
_(
"Warning" ),
_(
"Ignore" ) };
44 int severityCount =
sizeof( severities ) /
sizeof( wxString );
46 wxBoxSizer* panelSizer =
new wxBoxSizer( wxVERTICAL );
47 wxScrolledWindow* scrollWin =
new wxScrolledWindow(
this, wxID_ANY,
48 wxDefaultPosition, wxDefaultSize,
49 wxTAB_TRAVERSAL | wxVSCROLL );
50 bool firstLine =
true;
52 scrollWin->SetScrollRate( 0, 5 );
54 wxFlexGridSizer* gridSizer =
new wxFlexGridSizer( 0, 2, 0, 5 );
55 gridSizer->SetFlexibleDirection( wxBOTH );
56 gridSizer->SetVGap( 5 );
60 int errorCode = item.GetErrorCode();
61 wxString msg = item.GetErrorText();
68 wxStaticText* heading =
new wxStaticText( scrollWin, wxID_ANY, msg );
69 wxFont headingFont = heading->GetFont();
71 heading->SetFont( headingFont.Bold() );
75 gridSizer->AddSpacer( 5 );
76 gridSizer->AddSpacer( 5 );
79 gridSizer->Add( heading, 0, wxALIGN_BOTTOM | wxALL | wxEXPAND, 4 );
80 gridSizer->AddSpacer( 0 );
82 else if( !msg.IsEmpty() )
84 wxStaticText* errorLabel =
new wxStaticText( scrollWin, wxID_ANY, msg + wxT(
":" ) );
85 gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 15 );
89 wxPanel* radioPanel =
new wxPanel( scrollWin );
90 wxBoxSizer* radioSizer =
new wxBoxSizer( wxHORIZONTAL );
92 for(
int i = 0; i < severityCount; ++i )
94 m_buttonMap[ errorCode ][i] =
new wxRadioButton( radioPanel,
95 baseID + errorCode * 10 + i,
97 wxDefaultPosition, wxDefaultSize,
98 i == 0 ? wxRB_GROUP : 0 );
100 wxRIGHT | wxALIGN_CENTER_VERTICAL, 30 );
103 radioPanel->SetSizer( radioSizer );
104 radioPanel->Layout();
105 gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL );
114 wxString pinMapSeverities[] = {
_(
"From Pin Conflicts Map" ), wxEmptyString,
_(
"Ignore" ) };
118 wxStaticText* errorLabel =
new wxStaticText( scrollWin, wxID_ANY, msg + wxT(
":" ) );
119 gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 15 );
121 wxPanel* radioPanel =
new wxPanel( scrollWin );
122 wxBoxSizer* radioSizer =
new wxBoxSizer( wxHORIZONTAL );
124 for(
size_t i = 0; i < 3; ++i )
126 if( pinMapSeverities[i] == wxEmptyString )
128 wxStaticText* spacer =
new wxStaticText( radioPanel, wxID_ANY, wxEmptyString );
129 radioSizer->Add( spacer, 0, wxRIGHT | wxEXPAND, 17 );
133 m_buttonMap[ errorCode ][i] =
new wxRadioButton( radioPanel,
134 baseID + errorCode * 10 + i,
136 wxDefaultPosition, wxDefaultSize,
137 i == 0 ? wxRB_GROUP : 0 );
138 radioSizer->Add(
m_buttonMap[ errorCode ][i], 0, wxEXPAND );
142 radioPanel->SetSizer( radioSizer );
143 radioPanel->Layout();
144 gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL );
147 scrollWin->SetSizer( gridSizer );
149 gridSizer->Fit( scrollWin );
150 panelSizer->Add( scrollWin, 1, wxEXPAND | wxALL, 5 );
152 SetSizer( panelSizer );
154 panelSizer->Fit(
this );
162 int errorCode = item.GetErrorCode();
167 switch( aSettings[ errorCode ] )
179 int newSeverity = aSettings[ pinMapCode ];
191 int errorCode = item.GetErrorCode();
225 int errorCode = item.GetErrorCode();
252 else if(
m_buttonMap[ pinMapCode ][2]->GetValue() )
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
void ImportSettingsFrom(std::map< int, SEVERITY > &aSettings)
wxString GetErrorText() const
bool TransferDataFromWindow() override
RC_ITEM * m_pinMapSpecialCase
For ERC settings; a pointer to ERC_ITEM::pinTableConflict.
bool TransferDataToWindow() override
std::map< int, wxRadioButton *[4]> m_buttonMap
Functions to provide common constants and other functions to assist in making a consistent UI.
std::vector< std::reference_wrapper< RC_ITEM > > m_items
A list of item templates (to get descriptive text and error codes from)
std::map< int, SEVERITY > & m_severities
PANEL_SETUP_SEVERITIES(PAGED_DIALOG *aParent, std::vector< std::reference_wrapper< RC_ITEM >> aItems, std::map< int, SEVERITY > &aSeverities, RC_ITEM *aPinMapSpecialCase=nullptr)
Creates the severities setup panel.