Add highlight hinting to pin severity
This commit is contained in:
parent
94847336a1
commit
8cabc82f1c
|
@ -56,10 +56,30 @@ PANEL_SETUP_PINMAP::PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* paren
|
|||
{
|
||||
m_parent = parent;
|
||||
m_schematic = &parent->Schematic();
|
||||
m_btnBackground = wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_WINDOW );
|
||||
|
||||
reBuildMatrixPanel();
|
||||
}
|
||||
|
||||
PANEL_SETUP_PINMAP::~PANEL_SETUP_PINMAP()
|
||||
{
|
||||
#ifndef __WXMAC__
|
||||
if( m_initialized )
|
||||
{
|
||||
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
|
||||
{
|
||||
for( int jj = 0; jj <= ii; jj++ )
|
||||
{
|
||||
m_buttonList[ii][jj]->Unbind( wxEVT_ENTER_WINDOW,
|
||||
&PANEL_SETUP_PINMAP::OnMouseLeave, this );
|
||||
m_buttonList[ii][jj]->Unbind( wxEVT_LEAVE_WINDOW,
|
||||
&PANEL_SETUP_PINMAP::OnMouseLeave, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_PINMAP::ResetPanel()
|
||||
{
|
||||
|
@ -68,6 +88,22 @@ void PANEL_SETUP_PINMAP::ResetPanel()
|
|||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_PINMAP::OnMouseEnter( wxMouseEvent& aEvent )
|
||||
{
|
||||
wxBitmapButton* btn = static_cast<wxBitmapButton*>( aEvent.GetEventObject() );
|
||||
m_btnBackground = btn->GetBackgroundColour();
|
||||
|
||||
btn->SetBackgroundColour( wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_PINMAP::OnMouseLeave( wxMouseEvent& aEvent )
|
||||
{
|
||||
wxBitmapButton* btn = static_cast<wxBitmapButton*>( aEvent.GetEventObject() );
|
||||
btn->SetBackgroundColour( m_btnBackground );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
|
||||
{
|
||||
// Try to know the size of bitmap button used in drc matrix
|
||||
|
@ -145,15 +181,24 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
|
|||
int id = ID_MATRIX_0 + ii + ( jj * ELECTRICAL_PINTYPES_TOTAL );
|
||||
BITMAPS bitmap_butt = BITMAPS::erc_green;
|
||||
|
||||
delete m_buttonList[ii][jj];
|
||||
#ifdef __WXMAC__
|
||||
BITMAP_BUTTON* btn = new BITMAP_BUTTON( m_matrixPanel, id, KiBitmap( bitmap_butt ),
|
||||
wxPoint( x, y ), bitmapSize );
|
||||
#else
|
||||
if( m_initialized )
|
||||
{
|
||||
m_buttonList[ii][jj]->Unbind(wxEVT_ENTER_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this );
|
||||
m_buttonList[ii][jj]->Unbind(wxEVT_LEAVE_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this );
|
||||
}
|
||||
|
||||
wxBitmapButton* btn = new wxBitmapButton( m_matrixPanel, id, KiBitmap( bitmap_butt ),
|
||||
wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
|
||||
btn->Bind( wxEVT_LEAVE_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this );
|
||||
btn->Bind( wxEVT_ENTER_WINDOW, &PANEL_SETUP_PINMAP::OnMouseEnter, this );
|
||||
#endif
|
||||
btn->SetSize( btn->GetSize() + text_padding );
|
||||
|
||||
delete m_buttonList[ii][jj];
|
||||
m_buttonList[ii][jj] = btn;
|
||||
setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
|
||||
}
|
||||
|
|
|
@ -34,17 +34,21 @@
|
|||
class SCH_EDIT_FRAME;
|
||||
class SCHEMATIC;
|
||||
class BITMAP_BUTTON;
|
||||
class wxColour;
|
||||
|
||||
|
||||
class PANEL_SETUP_PINMAP : public PANEL_SETUP_PINMAP_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* aParent );
|
||||
~PANEL_SETUP_PINMAP();
|
||||
|
||||
void ImportSettingsFrom( PIN_ERROR aPinMap[][ELECTRICAL_PINTYPES_TOTAL] );
|
||||
|
||||
void ResetPanel() override;
|
||||
|
||||
void OnMouseEnter( wxMouseEvent& aEvent );
|
||||
void OnMouseLeave( wxMouseEvent& aEvent );
|
||||
private:
|
||||
void changeErrorLevel( wxCommandEvent& event );
|
||||
void reBuildMatrixPanel();
|
||||
|
@ -54,6 +58,7 @@ private:
|
|||
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
SCHEMATIC* m_schematic;
|
||||
wxColour m_btnBackground;
|
||||
wxWindow* m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
|
||||
bool m_initialized;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue