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 );
75 for(
int jj = 0; jj <= ii; jj++ )
97 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
100 btn->SetBackgroundColour(
101 wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
107 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
115 wxBitmapButton*
dummy =
117 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
118 wxSize bitmapSize =
dummy->GetSize();
122 const wxSize text_padding( 2, 1 );
123 const int twiddle = -1;
125 const wxSize text_padding( 8, 6 );
126 const int twiddle = 1;
130 wxPoint pos( 0, charSize.y * 2 );
135 std::vector<wxStaticText*> labels;
140 int y = pos.y + ( ii * ( bitmapSize.y + text_padding.y ) );
142 wxPoint( 5, y + ( bitmapSize.y / 2 ) - ( 12 / 2 ) ) );
143 labels.push_back(
text );
145 int x =
text->GetRect().GetRight();
146 pos.x = std::max( pos.x, x );
152 wxPoint labelPos = labels[ ii ]->GetPosition();
153 labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
154 labelPos.y += twiddle;
155 labels[ ii ]->SetPosition( labelPos );
167 int y = pos.y + (ii * ( bitmapSize.y + text_padding.y ) );
169 for(
int jj = 0; jj <= ii; jj++ )
174 int x = pos.x + ( jj * ( bitmapSize.x + text_padding.x ) );
178 wxPoint textPos( x +
KiROUND( bitmapSize.x / 2 ),
179 y - charSize.y * 2 );
182 wxPoint calloutPos( x +
KiROUND( bitmapSize.x / 2 ),
184 new wxStaticText(
m_matrixPanel, wxID_ANY,
"|", calloutPos );
188 BITMAPS bitmap_butt = BITMAPS::erc_green;
192 wxPoint( x, y ), bitmapSize );
202 wxBitmapButton* btn =
204 wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
208 btn->SetSize( btn->GetSize() + text_padding );
222 BITMAPS bitmap_butt = BITMAPS::INVALID_BITMAP;
228 bitmap_butt = BITMAPS::erc_green;
229 tooltip =
_(
"No error or warning" );
232 case PIN_ERROR::WARNING:
233 bitmap_butt = BITMAPS::ercwarn;
234 tooltip =
_(
"Generate warning" );
237 case PIN_ERROR::PP_ERROR:
238 bitmap_butt = BITMAPS::ercerr;
239 tooltip =
_(
"Generate error" );
248 if( wxBitmapButton* wx_btn =
dynamic_cast<wxBitmapButton*
>( aButton ) )
253 aButton->SetToolTip( tooltip );
260 int id =
event.GetId();
264 wxWindow* butt =
static_cast<wxWindow*
>(
event.GetEventObject() );
267 level = ( level + 1 ) % 3;
280 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.
Common command IDs shared by more than one of the KiCad applications.
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.