35#include <wx/bmpbuttn.h>
36#include <wx/statline.h>
37#include <wx/stattext.h>
42#define ID_MATRIX_0 1800
55 m_initialized( false )
58 m_schematic = &parent->Schematic();
59 m_btnBackground = wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_WINDOW );
71 for(
int jj = 0; jj <= ii; jj++ )
93 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
96 btn->SetBackgroundColour( wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
102 wxBitmapButton* btn =
static_cast<wxBitmapButton*
>( aEvent.GetEventObject() );
111 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
112 wxSize bitmapSize =
dummy->GetSize();
116 const wxSize text_padding( 2, 1 );
117 const int twiddle = -1;
119 const wxSize text_padding( 8, 6 );
120 const int twiddle = 1;
124 wxPoint pos( 0, charSize.y * 2 );
129 std::vector<wxStaticText*> labels;
134 int y = pos.y + ( ii * ( bitmapSize.y + text_padding.y ) );
136 wxPoint( 5, y + ( bitmapSize.y / 2 ) - ( 12 / 2 ) ) );
137 labels.push_back(
text );
139 int x =
text->GetRect().GetRight();
140 pos.x = std::max( pos.x, x );
146 wxPoint labelPos = labels[ ii ]->GetPosition();
147 labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
148 labelPos.y += twiddle;
149 labels[ ii ]->SetPosition( labelPos );
161 int y = pos.y + (ii * ( bitmapSize.y + text_padding.y ) );
163 for(
int jj = 0; jj <= ii; jj++ )
168 int x = pos.x + ( jj * ( bitmapSize.x + text_padding.x ) );
172 wxPoint textPos( x +
KiROUND( bitmapSize.x / 2 ),
173 y - charSize.y * 2 );
176 wxPoint calloutPos( x +
KiROUND( bitmapSize.x / 2 ),
178 new wxStaticText(
m_matrixPanel, wxID_ANY,
"|", calloutPos );
182 BITMAPS bitmap_butt = BITMAPS::erc_green;
186 wxPoint( x, y ), bitmapSize );
195 wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
199 btn->SetSize( btn->GetSize() + text_padding );
213 BITMAPS bitmap_butt = BITMAPS::INVALID_BITMAP;
219 bitmap_butt = BITMAPS::erc_green;
220 tooltip =
_(
"No error or warning" );
223 case PIN_ERROR::WARNING:
224 bitmap_butt = BITMAPS::ercwarn;
225 tooltip =
_(
"Generate warning" );
228 case PIN_ERROR::PP_ERROR:
229 bitmap_butt = BITMAPS::ercerr;
230 tooltip =
_(
"Generate error" );
239 if( wxBitmapButton* wx_btn =
dynamic_cast<wxBitmapButton*
>( aButton ) )
240 wx_btn->SetBitmap(
KiBitmap( bitmap_butt ) );
242 ki_btn->SetBitmap(
KiBitmap( bitmap_butt ) );
244 aButton->SetToolTip( tooltip );
251 int id =
event.GetId();
255 wxWindow* butt =
static_cast<wxWindow*
>(
event.GetEventObject() );
258 level = ( level + 1 ) % 3;
271 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...
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+(ELECTRICAL_PINTYPES_TOTAL *ELECTRICAL_PINTYPES_TOTAL) - 1, wxEVT_COMMAND_BUTTON_CLICKED, PANEL_SETUP_PINMAP::changeErrorLevel) PANEL_SETUP_PINMAP
#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.