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() );
113 wxBitmapButton*
dummy =
115 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
116 wxSize bitmapSize =
dummy->GetSize();
120 const wxSize text_padding( 2, 1 );
121 const int twiddle = -1;
123 const wxSize text_padding( 8, 6 );
124 const int twiddle = 1;
128 wxPoint pos( 0, charSize.y * 2 );
133 std::vector<wxStaticText*> labels;
138 int y = pos.y + ( ii * ( bitmapSize.y + text_padding.y ) );
140 wxPoint( 5, y + ( bitmapSize.y / 2 ) - ( 12 / 2 ) ) );
141 labels.push_back(
text );
143 int x =
text->GetRect().GetRight();
144 pos.x = std::max( pos.x, x );
150 wxPoint labelPos = labels[ ii ]->GetPosition();
151 labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
152 labelPos.y += twiddle;
153 labels[ ii ]->SetPosition( labelPos );
165 int y = pos.y + (ii * ( bitmapSize.y + text_padding.y ) );
167 for(
int jj = 0; jj <= ii; jj++ )
172 int x = pos.x + ( jj * ( bitmapSize.x + text_padding.x ) );
176 wxPoint textPos( x +
KiROUND( bitmapSize.x / 2 ),
177 y - charSize.y * 2 );
180 wxPoint calloutPos( x +
KiROUND( bitmapSize.x / 2 ),
182 new wxStaticText(
m_matrixPanel, wxID_ANY,
"|", calloutPos );
186 BITMAPS bitmap_butt = BITMAPS::erc_green;
190 wxPoint( x, y ), bitmapSize );
198 wxBitmapButton* btn =
200 wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
204 btn->SetSize( btn->GetSize() + text_padding );
218 BITMAPS bitmap_butt = BITMAPS::INVALID_BITMAP;
224 bitmap_butt = BITMAPS::erc_green;
225 tooltip =
_(
"No error or warning" );
228 case PIN_ERROR::WARNING:
229 bitmap_butt = BITMAPS::ercwarn;
230 tooltip =
_(
"Generate warning" );
233 case PIN_ERROR::PP_ERROR:
234 bitmap_butt = BITMAPS::ercerr;
235 tooltip =
_(
"Generate error" );
244 if( wxBitmapButton* wx_btn =
dynamic_cast<wxBitmapButton*
>( aButton ) )
249 aButton->SetToolTip( tooltip );
256 int id =
event.GetId();
260 wxWindow* butt =
static_cast<wxWindow*
>(
event.GetEventObject() );
263 level = ( level + 1 ) % 3;
276 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.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
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.
KICOMMON_API 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
Definition of file extensions used in Kicad.