gerbview: Removed duplicate zoom-to-selection handler, made the toolbar button checkable

Fixes: lp:1763270
* https://bugs.launchpad.net/kicad/+bug/1763270
This commit is contained in:
Maciej Suminski 2018-04-12 11:51:20 +02:00
parent c421840a9e
commit df8bc93e4b
5 changed files with 1 additions and 27 deletions

View File

@ -205,8 +205,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
KiBitmap( zoom_fit_in_page_xpm ) );
text = AddHotkeyName( _( "Zoom to Selection" ), GerbviewHokeysDescr, HK_ZOOM_SELECTION );
AddMenuItem( viewMenu, ID_MENU_ZOOM_SELECTION, text,
KiBitmap( zoom_area_xpm ) );
AddMenuItem( viewMenu, ID_ZOOM_SELECTION, text, KiBitmap( zoom_area_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "&Redraw" ), GerbviewHokeysDescr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,

View File

@ -49,9 +49,6 @@ OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
return ACTIONS::zoomFitScreen.MakeEvent();
case ID_MENU_ZOOM_SELECTION:
return GERBVIEW_ACTIONS::switchZoomToSelectionTool.MakeEvent();
case ID_ZOOM_SELECTION:
return ACTIONS::zoomTool.MakeEvent();

View File

@ -124,7 +124,6 @@ public:
static TOOL_ACTION switchCursor;
static TOOL_ACTION switchUnits;
static TOOL_ACTION showHelp;
static TOOL_ACTION switchZoomToSelectionTool;
static TOOL_ACTION toBeDone;
// Highlighting

View File

@ -33,9 +33,6 @@ TOOL_ACTION GERBVIEW_ACTIONS::selectionTool( "gerbview.Control.selectionTool",
AS_GLOBAL, 0,
"", "", NULL, AF_ACTIVATE );
TOOL_ACTION GERBVIEW_ACTIONS::switchZoomToSelectionTool( "gerbview.Control.switchZoomToSelectionTool",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ), "", "" );
TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( "gerbview.Control.layerChanged",
AS_GLOBAL, 0,
"", "", NULL, AF_NOTIFY );
@ -260,21 +257,6 @@ int GERBVIEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
}
int GERBVIEW_CONTROL::SwitchZoomToSelectionTool( const TOOL_EVENT& aEvent )
{
// Update the Zoom to Selection Tool state changed from the zoom menuitem
bool state = m_frame->GetToolToggled( ID_ZOOM_SELECTION );
m_frame->GetMainToolBar()->ToggleTool( ID_ZOOM_SELECTION, !state );
m_frame->GetMainToolBar()->Refresh();
// Send the Zoom to Selection Tool event similar to a tool click:
wxCommandEvent evt( wxEVT_TOOL );
evt.SetId( ID_ZOOM_SELECTION );
m_frame->ProcessEvent( evt );
return 0;
}
void GERBVIEW_CONTROL::setTransitions()
{
Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightClear.MakeEvent() );
@ -294,6 +276,4 @@ void GERBVIEW_CONTROL::setTransitions()
Go( &GERBVIEW_CONTROL::ResetCoords, GERBVIEW_ACTIONS::resetCoords.MakeEvent() );
Go( &GERBVIEW_CONTROL::SwitchUnits, GERBVIEW_ACTIONS::switchUnits.MakeEvent() );
Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() );
Go( &GERBVIEW_CONTROL::SwitchZoomToSelectionTool,
GERBVIEW_ACTIONS::switchZoomToSelectionTool.MakeEvent() );
}

View File

@ -60,7 +60,6 @@ public:
int ResetCoords( const TOOL_EVENT& aEvent );
int SwitchUnits( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int SwitchZoomToSelectionTool( const TOOL_EVENT& aEvent ); // On/off main toolbar Zoom to selection tool
///> Sets up handlers for various events.
void setTransitions() override;