Page layout editor: fix a wxASSERT when trying to open view menu from the main menubar.

This is due to the fact the same ID was used for a menuitem in menubar, and a tool in toolbars.
This commit is contained in:
jean-pierre charras 2018-04-02 08:30:24 +02:00
parent 747e14f9e1
commit c867de53b8
3 changed files with 5 additions and 3 deletions

View File

@ -92,6 +92,7 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
EVT_TOOL( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
EVT_TOOL( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_ZOOM_SELECTION, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_TOOL( ID_ZOOM_SELECTION, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner)
EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::Process_Special_Functions)
@ -131,6 +132,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetNoToolSelected();
break;
case ID_MENU_ZOOM_SELECTION:
case ID_ZOOM_SELECTION:
// This tool is located on the main toolbar: switch it on or off on click
if( GetToolId() != ID_ZOOM_SELECTION )

View File

@ -141,7 +141,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
AddMenuItem( viewMenu, ID_ZOOM_PAGE, msg, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ) );
msg = AddHotkeyName( _( "Zoom to Selection" ), PlEditorHokeysDescr, HK_ZOOM_SELECTION );
AddMenuItem( viewMenu, ID_ZOOM_SELECTION, msg, wxEmptyString, KiBitmap( zoom_area_xpm ) );
AddMenuItem( viewMenu, ID_MENU_ZOOM_SELECTION, msg, wxEmptyString, KiBitmap( zoom_area_xpm ) );
viewMenu->AppendSeparator();

View File

@ -73,10 +73,10 @@ bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
return true;
}
// If the tool ID_ZOOM_SELECTION is currently in use, add a
// If the tool ID_ZOOM_SELECTION is currently in use, add a close command menu
if( GetToolId() == ID_ZOOM_SELECTION && !busy )
{
AddMenuItem( aPopMenu, ID_NO_TOOL_SELECTED, _( "End Tool" ),
AddMenuItem( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ),
KiBitmap( cursor_xpm ) );
aPopMenu->AppendSeparator();
}