From 0a0935e0f3b5c2f0e34621ff41a413ff38abfc10 Mon Sep 17 00:00:00 2001
From: Ian McInerney <ian.s.mcinerney@ieee.org>
Date: Sat, 27 Mar 2021 20:02:34 +0000
Subject: [PATCH] Remove ACTIONS::TranslateLegacyId and
 TOOL_DISPATCHER::DispatchWxCommand

After commit 9535153f9e there were no more IDs inside the legacy ID
system. Therefore the entire system for dispatching and looking up
the legacy ideas and handling those events can now be removed and
the tool dispatcher simplified (it no longer needs to know about
the ACTIONS class).
---
 3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp |  2 +-
 3d-viewer/3d_canvas/eda_3d_canvas.cpp        | 14 -------------
 3d-viewer/3d_viewer/eda_3d_viewer.cpp        |  2 +-
 3d-viewer/3d_viewer/tools/3d_actions.h       |  3 ---
 common/draw_panel_gal.cpp                    | 21 --------------------
 common/tool/tool_dispatcher.cpp              | 20 ++-----------------
 cvpcb/cvpcb_mainframe.cpp                    |  3 +--
 cvpcb/display_footprints_frame.cpp           |  2 +-
 cvpcb/tools/cvpcb_actions.h                  |  3 ---
 eeschema/sch_edit_frame.cpp                  |  2 +-
 eeschema/symbol_editor/symbol_edit_frame.cpp |  2 +-
 eeschema/symbol_viewer_frame.cpp             |  2 +-
 eeschema/tools/ee_actions.h                  |  6 ------
 gerbview/gerbview_frame.cpp                  |  2 +-
 gerbview/tools/gerbview_actions.h            |  3 ---
 include/tool/actions.h                       |  9 ---------
 include/tool/tool_dispatcher.h               | 11 +---------
 kicad/kicad_manager_frame.cpp                |  3 +--
 kicad/tools/kicad_manager_actions.h          |  6 ------
 pagelayout_editor/pl_editor_frame.cpp        |  2 +-
 pagelayout_editor/tools/pl_actions.h         |  3 ---
 pcbnew/footprint_edit_frame.cpp              |  2 +-
 pcbnew/footprint_viewer_frame.cpp            |  2 +-
 pcbnew/footprint_wizard_frame.cpp            |  2 +-
 pcbnew/pcb_edit_frame.cpp                    |  2 +-
 pcbnew/tools/pcb_actions.cpp                 |  5 -----
 pcbnew/tools/pcb_actions.h                   |  3 ---
 qa/qa_utils/pcb_test_frame.cpp               | 13 ++++--------
 28 files changed, 21 insertions(+), 129 deletions(-)

diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp
index d4023b53c7..584afa0e7c 100644
--- a/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp
+++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp
@@ -104,7 +104,7 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, FOOTPRI
     m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
 
     m_actions = new EDA_3D_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
     m_previewPane->SetEventDispatcher( m_toolDispatcher );
 
     // Register tools
diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
index 2024781541..eec1bd0d67 100644
--- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp
+++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
@@ -557,20 +557,6 @@ void EDA_3D_CANVAS::DoRePaint()
 void EDA_3D_CANVAS::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
 {
     m_eventDispatcher = aEventDispatcher;
-
-    if( m_eventDispatcher )
-    {
-        m_parent->Connect( wxEVT_TOOL,
-                           wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
-                           nullptr, m_eventDispatcher );
-    }
-    else
-    {
-        // While loop is used to be sure that all event handlers are removed.
-        while( m_parent->Disconnect( wxEVT_TOOL,
-                                     wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
-                                     nullptr, m_eventDispatcher ) );
-    }
 }
 
 
diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp
index 703a14eed3..57ac40ed6f 100644
--- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp
+++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp
@@ -122,7 +122,7 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt
     m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr, config, this );
 
     m_actions = new EDA_3D_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
     m_canvas->SetEventDispatcher( m_toolDispatcher );
 
     // Register tools
diff --git a/3d-viewer/3d_viewer/tools/3d_actions.h b/3d-viewer/3d_viewer/tools/3d_actions.h
index 699dcc8f45..023adc38ea 100644
--- a/3d-viewer/3d_viewer/tools/3d_actions.h
+++ b/3d-viewer/3d_viewer/tools/3d_actions.h
@@ -98,9 +98,6 @@ public:
     static TOOL_ACTION toggleSolderPaste;
     static TOOL_ACTION toggleComments;
     static TOOL_ACTION toggleECO;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
 };
 
 #endif
diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index 18fc5eb5cc..e442134cf0 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -334,27 +334,6 @@ void EDA_DRAW_PANEL_GAL::ForceRefresh()
 void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
 {
     m_eventDispatcher = aEventDispatcher;
-    const wxEventType eventTypes[] = { wxEVT_TOOL };
-
-    if( m_eventDispatcher )
-    {
-        for( wxEventType type : eventTypes )
-        {
-            m_parent->Connect( type, wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
-                               NULL, m_eventDispatcher );
-        }
-    }
-    else
-    {
-        for( wxEventType type : eventTypes )
-        {
-            // While loop is used to be sure that all event handlers are removed.
-            while( m_parent->Disconnect(
-                    type, wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ), NULL,
-                    m_eventDispatcher ) )
-                ;
-        }
-    }
 }
 
 
diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp
index 782cf8efda..cb4dbad49d 100644
--- a/common/tool/tool_dispatcher.cpp
+++ b/common/tool/tool_dispatcher.cpp
@@ -121,9 +121,8 @@ struct TOOL_DISPATCHER::BUTTON_STATE
 };
 
 
-TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, ACTIONS *aActions ) :
-    m_toolMgr( aToolMgr ),
-    m_actions( aActions )
+TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr ) :
+    m_toolMgr( aToolMgr )
 {
     m_buttons.push_back( new BUTTON_STATE( BUT_LEFT, wxEVT_LEFT_DOWN,
                          wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK ) );
@@ -621,18 +620,3 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
     wxLogTrace( kicadTraceToolStack, "TOOL_DISPATCHER::DispatchWxEvent - Wx event skipped: %s",
                 ( aEvent.GetSkipped() ? "true" : "false" ) );
 }
-
-
-void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent )
-{
-    OPT<TOOL_EVENT> evt = m_actions->TranslateLegacyId( aEvent.GetId() );
-
-    if( evt )
-    {
-        wxLogTrace( kicadTraceToolStack, "TOOL_DISPATCHER::DispatchWxCommand %s", evt->Format() );
-
-        m_toolMgr->ProcessEvent( *evt );
-    }
-    else
-        aEvent.Skip();
-}
diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp
index 5c5476d267..9de51b1a08 100644
--- a/cvpcb/cvpcb_mainframe.cpp
+++ b/cvpcb/cvpcb_mainframe.cpp
@@ -232,7 +232,7 @@ void CVPCB_MAINFRAME::setupTools()
     m_actions = new CVPCB_ACTIONS();
     m_toolManager = new TOOL_MANAGER;
     m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Register tools
     m_toolManager->RegisterTool( new COMMON_CONTROL );
@@ -365,7 +365,6 @@ void CVPCB_MAINFRAME::setupEventHandlers()
           } );
 
     // Attach the events to the tool dispatcher
-    Bind( wxEVT_TOOL, &TOOL_DISPATCHER::DispatchWxCommand, m_toolDispatcher );
     Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
     Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
 }
diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp
index a2dd4d8533..f1bd4eb08d 100644
--- a/cvpcb/display_footprints_frame.cpp
+++ b/cvpcb/display_footprints_frame.cpp
@@ -106,7 +106,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
     m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
                                    gal_drawPanel->GetViewControls(), config(), this );
     m_actions = new CVPCB_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
     gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
 
     m_toolManager->RegisterTool( new COMMON_TOOLS );
diff --git a/cvpcb/tools/cvpcb_actions.h b/cvpcb/tools/cvpcb_actions.h
index d0eb3c1d4b..3b94cdb42c 100644
--- a/cvpcb/tools/cvpcb_actions.h
+++ b/cvpcb/tools/cvpcb_actions.h
@@ -69,9 +69,6 @@ public:
     static TOOL_ACTION FilterFPbyFPFilters;
     static TOOL_ACTION filterFPbyPin;
     static TOOL_ACTION FilterFPbyLibrary;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
 };
 
 #endif
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index f4b1067ef1..42326ae2df 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -334,7 +334,7 @@ void SCH_EDIT_FRAME::setupTools()
     m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new EE_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Register tools
     m_toolManager->RegisterTool( new COMMON_CONTROL );
diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp
index 5450792962..c0ceb22cf2 100644
--- a/eeschema/symbol_editor/symbol_edit_frame.cpp
+++ b/eeschema/symbol_editor/symbol_edit_frame.cpp
@@ -298,7 +298,7 @@ void SYMBOL_EDIT_FRAME::setupTools()
     m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new EE_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Register tools
     m_toolManager->RegisterTool( new COMMON_CONTROL );
diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp
index 2efb94925c..5537812d5f 100644
--- a/eeschema/symbol_viewer_frame.cpp
+++ b/eeschema/symbol_viewer_frame.cpp
@@ -231,7 +231,7 @@ void SYMBOL_VIEWER_FRAME::setupTools()
     m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new EE_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Register tools
     m_toolManager->RegisterTool( new COMMON_TOOLS );
diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h
index 416f8f47ea..e15c2f17ad 100644
--- a/eeschema/tools/ee_actions.h
+++ b/eeschema/tools/ee_actions.h
@@ -215,12 +215,6 @@ public:
     static TOOL_ACTION clearHighlight;
     static TOOL_ACTION updateNetHighlighting;
     static TOOL_ACTION highlightNetTool;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
-    {
-        return OPT<TOOL_EVENT>();
-    }
 };
 
 
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 8e00602c45..a57740d0f8 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -1026,7 +1026,7 @@ void GERBVIEW_FRAME::setupTools()
     m_toolManager->SetEnvironment( m_gerberLayout, GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new GERBVIEW_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Register tools
     m_toolManager->RegisterTool( new COMMON_CONTROL );
diff --git a/gerbview/tools/gerbview_actions.h b/gerbview/tools/gerbview_actions.h
index 87b41816f5..62cd0abbd0 100644
--- a/gerbview/tools/gerbview_actions.h
+++ b/gerbview/tools/gerbview_actions.h
@@ -91,9 +91,6 @@ public:
     static TOOL_ACTION highlightComponent;
     static TOOL_ACTION highlightAttribute;
     static TOOL_ACTION highlightDCode;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
 };
 
 #endif  // __GERBVIEW_ACTIONS_H
diff --git a/include/tool/actions.h b/include/tool/actions.h
index 5813fa9dc8..9694edb0d4 100644
--- a/include/tool/actions.h
+++ b/include/tool/actions.h
@@ -181,15 +181,6 @@ public:
     static TOOL_ACTION getInvolved;
     static TOOL_ACTION reportBug;
 
-    /**
-     * Translate legacy tool ids to the corresponding TOOL_ACTION name.
-     *
-     * @param aId is legacy tool id to be translated.
-     * @return std::string is name of the corresponding TOOL_ACTION. It may be empty, if there is
-     *         no corresponding TOOL_ACTION.
-     */
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) = 0;
-
     ///< Cursor control event types
     enum CURSOR_EVENT_TYPE { CURSOR_NONE, CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
                              CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_RIGHT_CLICK,
diff --git a/include/tool/tool_dispatcher.h b/include/tool/tool_dispatcher.h
index 3720e204ea..e4453c09e6 100644
--- a/include/tool/tool_dispatcher.h
+++ b/include/tool/tool_dispatcher.h
@@ -53,9 +53,8 @@ class TOOL_DISPATCHER : public wxEvtHandler
 public:
     /**
      * @param aToolMgr: tool manager instance the events will be sent to.
-     * @param aActions: ACTIONS subclass instance for ACTIONS::TranslateLegacyId().
      */
-    TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, ACTIONS *aActions );
+    TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr );
 
     virtual ~TOOL_DISPATCHER();
 
@@ -77,14 +76,6 @@ public:
      */
     OPT<TOOL_EVENT> GetToolEvent( wxKeyEvent* aKeyEvent, bool* aSpecialKeyFlag );
 
-    /**
-     * Process wxCommands (mostly menu related events) and runs appropriate actions (eg. run the
-     * specified tool).
-     *
-     * @param aEvent is the wxCommandEvent to be processed.
-     */
-    virtual void DispatchWxCommand( wxCommandEvent& aEvent );
-
 private:
     ///< Number of mouse buttons that is handled in events.
     static const int MouseButtonCount = 3;
diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp
index 452ff0ab70..30e8b18346 100644
--- a/kicad/kicad_manager_frame.cpp
+++ b/kicad/kicad_manager_frame.cpp
@@ -201,10 +201,9 @@ void KICAD_MANAGER_FRAME::setupTools()
     m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
     m_actions = new KICAD_MANAGER_ACTIONS();
 
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Attach the events to the tool dispatcher
-    Bind( wxEVT_TOOL, &TOOL_DISPATCHER::DispatchWxCommand, m_toolDispatcher );
     Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
     Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
 
diff --git a/kicad/tools/kicad_manager_actions.h b/kicad/tools/kicad_manager_actions.h
index 9901c72d43..b10535a4a9 100644
--- a/kicad/tools/kicad_manager_actions.h
+++ b/kicad/tools/kicad_manager_actions.h
@@ -53,12 +53,6 @@ public:
 
     static TOOL_ACTION editOtherSch;
     static TOOL_ACTION editOtherPCB;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
-    {
-        return OPT<TOOL_EVENT>();
-    }
 };
 
 
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index 2c58d21359..0985719b43 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -231,7 +231,7 @@ void PL_EDITOR_FRAME::setupTools()
     m_toolManager->SetEnvironment( nullptr, GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new PL_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     GetCanvas()->SetEventDispatcher( m_toolDispatcher );
 
diff --git a/pagelayout_editor/tools/pl_actions.h b/pagelayout_editor/tools/pl_actions.h
index 27a7db9fb0..c6628b3c2a 100644
--- a/pagelayout_editor/tools/pl_actions.h
+++ b/pagelayout_editor/tools/pl_actions.h
@@ -75,9 +75,6 @@ public:
     static TOOL_ACTION refreshPreview;
     static TOOL_ACTION showInspector;
     static TOOL_ACTION previewSettings;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
 };
 
 
diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp
index 22643fce63..502f5af5de 100644
--- a/pcbnew/footprint_edit_frame.cpp
+++ b/pcbnew/footprint_edit_frame.cpp
@@ -929,7 +929,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
     m_toolManager->SetEnvironment( GetBoard(), GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new PCB_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     GetCanvas()->SetEventDispatcher( m_toolDispatcher );
 
diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp
index a80155cca5..4993c5a0d1 100644
--- a/pcbnew/footprint_viewer_frame.cpp
+++ b/pcbnew/footprint_viewer_frame.cpp
@@ -200,7 +200,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
     m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
                                    drawPanel->GetViewControls(), config(), this );
     m_actions = new PCB_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
     drawPanel->SetEventDispatcher( m_toolDispatcher );
 
     m_toolManager->RegisterTool( new PCB_CONTROL );
diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp
index 0912a31df9..997a7708be 100644
--- a/pcbnew/footprint_wizard_frame.cpp
+++ b/pcbnew/footprint_wizard_frame.cpp
@@ -142,7 +142,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
     m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
                                    gal_drawPanel->GetViewControls(), config(), this );
     m_actions = new PCB_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
     gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
 
     m_toolManager->RegisterTool( new PCB_CONTROL );
diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp
index daede80775..e25d30bbaa 100644
--- a/pcbnew/pcb_edit_frame.cpp
+++ b/pcbnew/pcb_edit_frame.cpp
@@ -479,7 +479,7 @@ void PCB_EDIT_FRAME::setupTools()
     m_toolManager->SetEnvironment( m_pcb, GetCanvas()->GetView(),
                                    GetCanvas()->GetViewControls(), config(), this );
     m_actions = new PCB_ACTIONS();
-    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
+    m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
 
     // Register tools
     m_toolManager->RegisterTool( new COMMON_CONTROL );
diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp
index 17c025f2f4..d92fb647b8 100644
--- a/pcbnew/tools/pcb_actions.cpp
+++ b/pcbnew/tools/pcb_actions.cpp
@@ -33,11 +33,6 @@
 #include <router/pns_router.h>
 #include <router/pns_routing_settings.h>
 
-OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
-{
-    return OPT<TOOL_EVENT>();
-}
-
 
 // Actions, being statically-defined, require specialized I18N handling.  We continue to
 // use the _() macro so that string harvesting by the I18N framework doesn't have to be
diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h
index 8d2b617eca..275d6bac91 100644
--- a/pcbnew/tools/pcb_actions.h
+++ b/pcbnew/tools/pcb_actions.h
@@ -475,9 +475,6 @@ public:
     static TOOL_ACTION convertToLines;
     static TOOL_ACTION convertToArc;
     static TOOL_ACTION convertToTracks;
-
-    ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
 };
 
 #endif
diff --git a/qa/qa_utils/pcb_test_frame.cpp b/qa/qa_utils/pcb_test_frame.cpp
index d600fcf1b5..cc2328aeaa 100644
--- a/qa/qa_utils/pcb_test_frame.cpp
+++ b/qa/qa_utils/pcb_test_frame.cpp
@@ -80,7 +80,7 @@ void PCB_TEST_FRAME_BASE::SetBoard( std::shared_ptr<BOARD> b )
     m_galPanel->UpdateColors();
 
 #ifdef USE_TOOL_MANAGER
-    
+
     m_toolManager->SetEnvironment( m_board.get(), m_galPanel->GetView(),
             m_galPanel->GetViewControls(), nullptr );
 
@@ -114,10 +114,6 @@ BOARD* PCB_TEST_FRAME_BASE::LoadAndDisplayBoard( const std::string& filename )
 
 class TEST_ACTIONS : public ACTIONS
 {
-    virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
-    {
-        return OPT<TOOL_EVENT> ();
-    }
 };
 
 void PCB_TEST_FRAME_BASE::createView( wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL_TYPE aGalType )
@@ -127,7 +123,7 @@ void PCB_TEST_FRAME_BASE::createView( wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL
     m_galPanel = std::make_shared<PCB_DRAW_PANEL_GAL>( aParent, -1, wxPoint( 0,
                             0 ), wxDefaultSize, m_displayOptions, aGalType );
     m_galPanel->UpdateColors();
-    
+
     m_galPanel->SetEvtHandlerEnabled( true );
     m_galPanel->SetFocus();
     m_galPanel->Show( true );
@@ -151,13 +147,12 @@ void PCB_TEST_FRAME_BASE::createView( wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL
             m_galPanel->GetViewControls(), nullptr );
 
     m_pcbActions = std::make_unique<TEST_ACTIONS>( );
-    m_toolDispatcher = std::make_unique<TOOL_DISPATCHER>( m_toolManager.get(), m_pcbActions.get() );
+    m_toolDispatcher = std::make_unique<TOOL_DISPATCHER>( m_toolManager.get() );
 
     //m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
     createUserTools();
 
     m_toolManager->InitTools();
-    m_galPanel->SetEventDispatcher( m_toolDispatcher.get() );
     m_toolManager->InvokeTool( "test.DefaultTool" );
 #endif
 
@@ -179,4 +174,4 @@ void PCB_TEST_FRAME_BASE::LoadSettings()
     auto cs = Pgm().GetSettingsManager().GetColorSettings();
     //cs->SetColorContext( COLOR_CONTEXT::PCB );
     cs->Load();
-}
\ No newline at end of file
+}