mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Don't presume a selection (potentially KICAD-8VP).
This commit is contained in:
parent
fc0bcdc8a3
commit
34367020c4
@ -282,8 +282,11 @@ void PANEL_COLOR_SETTINGS::createSwatch( int aLayer, const wxString& aName )
|
|||||||
|
|
||||||
void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLayer )
|
void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLayer )
|
||||||
{
|
{
|
||||||
auto selected =
|
int themeSel = m_cbTheme->GetSelection();
|
||||||
static_cast<COLOR_SETTINGS*>( m_cbTheme->GetClientData( m_cbTheme->GetSelection() ) );
|
|
||||||
|
if( themeSel >= 0 )
|
||||||
|
{
|
||||||
|
COLOR_SETTINGS* selected = static_cast<COLOR_SETTINGS*>( m_cbTheme->GetClientData( themeSel ) );
|
||||||
|
|
||||||
wxCHECK_RET( selected, wxT( "Invalid color theme selected" ) );
|
wxCHECK_RET( selected, wxT( "Invalid color theme selected" ) );
|
||||||
|
|
||||||
@ -299,8 +302,7 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
|
|||||||
KIUI::AddMenuItem( &menu, ID_PASTE, _( "Paste color" ), KiBitmap( BITMAPS::paste ) );
|
KIUI::AddMenuItem( &menu, ID_PASTE, _( "Paste color" ), KiBitmap( BITMAPS::paste ) );
|
||||||
|
|
||||||
if( !readOnly && current != saved )
|
if( !readOnly && current != saved )
|
||||||
KIUI::AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ),
|
KIUI::AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ), KiBitmap( BITMAPS::undo ) );
|
||||||
KiBitmap( BITMAPS::undo ) );
|
|
||||||
|
|
||||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
|
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
|
||||||
[&]( wxCommandEvent& aCmd )
|
[&]( wxCommandEvent& aCmd )
|
||||||
@ -325,6 +327,7 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
PopupMenu( &menu );
|
PopupMenu( &menu );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user