34#include <wx/bmpbuttn.h>
35#include <wx/statline.h>
36#include <wx/stattext.h>
41#define ID_MATRIX_0 1800
45#define PINMAP_TYPE_COUNT ( ELECTRICAL_PINTYPES_TOTAL - 1 )
57 m_initialized( false )
60 m_schematic = &parent->Schematic();
61 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(
100 wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
106 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
114 wxBitmapButton*
dummy =
116 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
117 wxSize bitmapSize =
dummy->GetSize();
121 const wxSize text_padding( 2, 1 );
122 const int twiddle = -1;
124 const wxSize text_padding( 8, 6 );
125 const int twiddle = 1;
129 wxPoint pos( 0, charSize.y * 2 );
134 std::vector<wxStaticText*> labels;
139 int y = pos.y + ( ii * ( bitmapSize.y + text_padding.y ) );
141 wxPoint( 5, y + ( bitmapSize.y / 2 ) - ( 12 / 2 ) ) );
142 labels.push_back(
text );
144 int x =
text->GetRect().GetRight();
145 pos.x = std::max( pos.x, x );
151 wxPoint labelPos = labels[ ii ]->GetPosition();
152 labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
153 labelPos.y += twiddle;
154 labels[ ii ]->SetPosition( labelPos );
166 int y = pos.y + (ii * ( bitmapSize.y + text_padding.y ) );
168 for(
int jj = 0; jj <= ii; jj++ )
173 int x = pos.x + ( jj * ( bitmapSize.x + text_padding.x ) );
177 wxPoint textPos( x +
KiROUND( bitmapSize.x / 2 ),
178 y - charSize.y * 2 );
181 wxPoint calloutPos( x +
KiROUND( bitmapSize.x / 2 ),
183 new wxStaticText(
m_matrixPanel, wxID_ANY,
"|", calloutPos );
187 BITMAPS bitmap_butt = BITMAPS::erc_green;
191 wxPoint( x, y ), bitmapSize );
201 wxBitmapButton* btn =
203 wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
207 btn->SetSize( btn->GetSize() + text_padding );
221 BITMAPS bitmap_butt = BITMAPS::INVALID_BITMAP;
227 bitmap_butt = BITMAPS::erc_green;
228 tooltip =
_(
"No error or warning" );
231 case PIN_ERROR::WARNING:
232 bitmap_butt = BITMAPS::ercwarn;
233 tooltip =
_(
"Generate warning" );
236 case PIN_ERROR::PP_ERROR:
237 bitmap_butt = BITMAPS::ercerr;
238 tooltip =
_(
"Generate error" );
247 if( wxBitmapButton* wx_btn =
dynamic_cast<wxBitmapButton*
>( aButton ) )
252 aButton->SetToolTip( tooltip );
259 int id =
event.GetId();
263 wxWindow* butt =
static_cast<wxWindow*
>(
event.GetEventObject() );
266 level = ( level + 1 ) % 3;
279 for(
int jj = 0; jj <= ii; jj++ )
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
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.