35#include <wx/bmpbuttn.h>
36#include <wx/statline.h>
37#include <wx/stattext.h>
42#define ID_MATRIX_0 1800
46#define PINMAP_TYPE_COUNT ( ELECTRICAL_PINTYPES_TOTAL - 1 )
58 m_initialized( false )
61 m_schematic = &parent->Schematic();
62 m_btnBackground = wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_WINDOW );
74 for(
int jj = 0; jj <= ii; jj++ )
96 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
99 btn->SetBackgroundColour( wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
105 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
114 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
115 wxSize bitmapSize =
dummy->GetSize();
119 const wxSize text_padding( 2, 1 );
120 const int twiddle = -1;
122 const wxSize text_padding( 8, 6 );
123 const int twiddle = 1;
127 wxPoint pos( 0, charSize.y * 2 );
132 std::vector<wxStaticText*> labels;
137 int y = pos.y + ( ii * ( bitmapSize.y + text_padding.y ) );
139 wxPoint( 5, y + ( bitmapSize.y / 2 ) - ( 12 / 2 ) ) );
140 labels.push_back(
text );
142 int x =
text->GetRect().GetRight();
143 pos.x = std::max( pos.x, x );
149 wxPoint labelPos = labels[ ii ]->GetPosition();
150 labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
151 labelPos.y += twiddle;
152 labels[ ii ]->SetPosition( labelPos );
164 int y = pos.y + (ii * ( bitmapSize.y + text_padding.y ) );
166 for(
int jj = 0; jj <= ii; jj++ )
171 int x = pos.x + ( jj * ( bitmapSize.x + text_padding.x ) );
175 wxPoint textPos( x +
KiROUND( bitmapSize.x / 2 ),
176 y - charSize.y * 2 );
179 wxPoint calloutPos( x +
KiROUND( bitmapSize.x / 2 ),
181 new wxStaticText(
m_matrixPanel, wxID_ANY,
"|", calloutPos );
185 BITMAPS bitmap_butt = BITMAPS::erc_green;
189 wxPoint( x, y ), bitmapSize );
198 wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
202 btn->SetSize( btn->GetSize() + text_padding );
216 BITMAPS bitmap_butt = BITMAPS::INVALID_BITMAP;
222 bitmap_butt = BITMAPS::erc_green;
223 tooltip =
_(
"No error or warning" );
226 case PIN_ERROR::WARNING:
227 bitmap_butt = BITMAPS::ercwarn;
228 tooltip =
_(
"Generate warning" );
231 case PIN_ERROR::PP_ERROR:
232 bitmap_butt = BITMAPS::ercerr;
233 tooltip =
_(
"Generate error" );
242 if( wxBitmapButton* wx_btn =
dynamic_cast<wxBitmapButton*
>( aButton ) )
247 aButton->SetToolTip( tooltip );
254 int id =
event.GetId();
258 wxWindow* butt =
static_cast<wxWindow*
>(
event.GetEventObject() );
261 level = ( level + 1 ) % 3;
274 for(
int jj = 0; jj <= ii; jj++ )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
BITMAPS
A list of all bitmap identifiers.
PIN_ERROR GetPinMapValue(int aFirstType, int aSecondType) const
void SetPinMapValue(int aFirstType, int aSecondType, PIN_ERROR aValue)
Class PANEL_SETUP_PINMAP_BASE.
wxWindow * m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
void changeErrorLevel(wxCommandEvent &event)
void ImportSettingsFrom(PIN_ERROR aPinMap[][ELECTRICAL_PINTYPES_TOTAL])
void setDRCMatrixButtonState(wxWindow *aButton, PIN_ERROR aState)
void reBuildMatrixPanel()
void OnMouseEnter(wxMouseEvent &aEvent)
void OnMouseLeave(wxMouseEvent &aEvent)
void ResetPanel() override
Reset the contents of this panel.
ERC_SETTINGS & ErcSettings() const
Schematic editor (Eeschema) main window.
const wxString CommentERC_V[]
const wxString CommentERC_H[]
PIN_ERROR
The values a pin-to-pin entry in the pin matrix can take on.
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
EVT_COMMAND_RANGE(ID_MATRIX_0, ID_MATRIX_0+(PINMAP_TYPE_COUNT *PINMAP_TYPE_COUNT) - 1, wxEVT_COMMAND_BUTTON_CLICKED, PANEL_SETUP_PINMAP::changeErrorLevel) PANEL_SETUP_PINMAP
#define PINMAP_TYPE_COUNT
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
#define ELECTRICAL_PINTYPES_TOTAL
std::vector< FAB_LAYER_COLOR > dummy
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition of file extensions used in Kicad.