From c0909611d3a08940a46aaa1a27c36d943a905a2e Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Tue, 28 May 2019 01:00:33 +0100
Subject: [PATCH] Remove a bunch more legacy editing code.

---
 common/legacy_gal/eda_draw_frame.cpp |  13 -
 common/legacy_wx/eda_draw_frame.cpp  |  12 -
 common/legacy_wx/eda_draw_panel.cpp  | 277 ---------
 cvpcb/display_footprints_frame.cpp   |  68 ---
 cvpcb/display_footprints_frame.h     |   1 -
 eeschema/ee_hotkeys.cpp              | 150 -----
 eeschema/libedit/lib_edit_frame.cpp  |  30 -
 eeschema/libedit/lib_edit_frame.h    |   4 -
 eeschema/sch_draw_panel.cpp          |  64 --
 eeschema/sch_draw_panel.h            |   1 -
 eeschema/sch_edit_frame.h            |   2 -
 eeschema/viewlib_frame.cpp           |  33 --
 eeschema/viewlib_frame.h             |  12 -
 gerbview/CMakeLists.txt              |   2 -
 gerbview/controle.cpp                |  58 --
 gerbview/gerber_collectors.cpp       |   4 +-
 gerbview/gerbview_frame.h            |  15 -
 gerbview/hotkeys.cpp                 |  65 --
 gerbview/onleftclick.cpp             |  61 --
 include/draw_frame.h                 |  22 -
 include/legacy_wx/class_drawpanel.h  |  49 --
 include/pcb_base_frame.h             |  32 -
 pagelayout_editor/hotkeys.cpp        |  82 ---
 pagelayout_editor/pl_editor_frame.h  |  12 -
 pcbnew/CMakeLists.txt                |  13 -
 pcbnew/attribut.cpp                  | 126 ----
 pcbnew/controle.cpp                  | 314 ----------
 pcbnew/drag.h                        |  30 -
 pcbnew/dragsegm.cpp                  | 105 ----
 pcbnew/edgemod.cpp                   | 408 -------------
 pcbnew/edit.cpp                      | 278 ++-------
 pcbnew/edit_pcb_text.cpp             | 284 ---------
 pcbnew/editedge.cpp                  | 296 ----------
 pcbnew/editrack.cpp                  | 232 +-------
 pcbnew/edtxtmod.cpp                  | 334 -----------
 pcbnew/footprint_edit_frame.cpp      |  35 --
 pcbnew/footprint_edit_frame.h        |  82 ---
 pcbnew/footprint_editor_onclick.cpp  | 275 ---------
 pcbnew/footprint_editor_utils.cpp    | 205 +------
 pcbnew/footprint_viewer_frame.cpp    |  32 -
 pcbnew/footprint_viewer_frame.h      |  12 -
 pcbnew/footprint_wizard_frame.cpp    |  36 --
 pcbnew/footprint_wizard_frame.h      |  12 -
 pcbnew/highlight.cpp                 | 112 ----
 pcbnew/hotkeys.cpp                   | 110 +---
 pcbnew/hotkeys.h                     |   3 -
 pcbnew/hotkeys_board_editor.cpp      | 512 ----------------
 pcbnew/hotkeys_footprint_editor.cpp  | 127 ----
 pcbnew/microwave.cpp                 | 199 -------
 pcbnew/move-drag_pads.cpp            | 114 ----
 pcbnew/move_or_drag_track.cpp        | 126 ----
 pcbnew/onleftclick.cpp               | 578 ------------------
 pcbnew/pcb_edit_frame.h              | 209 -------
 pcbnew/pcb_footprint_edit_utils.cpp  | 272 +--------
 pcbnew/pcbnew_id.h                   |  25 -
 pcbnew/zones_by_polygon.cpp          | 846 +--------------------------
 56 files changed, 100 insertions(+), 7311 deletions(-)
 delete mode 100644 gerbview/controle.cpp
 delete mode 100644 gerbview/onleftclick.cpp
 delete mode 100644 pcbnew/attribut.cpp
 delete mode 100644 pcbnew/controle.cpp
 delete mode 100644 pcbnew/edgemod.cpp
 delete mode 100644 pcbnew/edit_pcb_text.cpp
 delete mode 100644 pcbnew/editedge.cpp
 delete mode 100644 pcbnew/edtxtmod.cpp
 delete mode 100644 pcbnew/footprint_editor_onclick.cpp
 delete mode 100644 pcbnew/highlight.cpp
 delete mode 100644 pcbnew/hotkeys_board_editor.cpp
 delete mode 100644 pcbnew/hotkeys_footprint_editor.cpp
 delete mode 100644 pcbnew/move-drag_pads.cpp
 delete mode 100644 pcbnew/move_or_drag_track.cpp
 delete mode 100644 pcbnew/onleftclick.cpp

diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp
index 84e777a2a5..098fd0ee87 100644
--- a/common/legacy_gal/eda_draw_frame.cpp
+++ b/common/legacy_gal/eda_draw_frame.cpp
@@ -83,7 +83,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
     EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
     EVT_MENU_CLOSE( EDA_DRAW_FRAME::OnMenuOpen )
     EVT_MENU_HIGHLIGHT_ALL( EDA_DRAW_FRAME::OnMenuOpen )
-    EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
 END_EVENT_TABLE()
 
 
@@ -364,12 +363,6 @@ void EDA_DRAW_FRAME::ReCreateMenuBar()
 }
 
 
-bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
-{
-    return false;
-}
-
-
 int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
                                        wxString* aFullFileName )
 {
@@ -410,12 +403,6 @@ double EDA_DRAW_FRAME::GetZoom()
 }
 
 
-void EDA_DRAW_FRAME::OnMouseEvent( wxMouseEvent& event )
-{
-    event.Skip();
-}
-
-
 void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
 {
     m_toolMsg = msg;
diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp
index ed7327f8e8..d4d5b6c543 100644
--- a/common/legacy_wx/eda_draw_frame.cpp
+++ b/common/legacy_wx/eda_draw_frame.cpp
@@ -100,7 +100,6 @@ static const wxString MaxUndoItemsEntry(wxT( "DevelMaxUndoItems" ) );
 BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
     EVT_CHAR_HOOK( EDA_DRAW_FRAME::OnCharHook )
 
-    EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
     EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
     EVT_MENU_CLOSE( EDA_DRAW_FRAME::OnMenuOpen )
     EVT_MENU_HIGHLIGHT_ALL( EDA_DRAW_FRAME::OnMenuOpen )
@@ -387,11 +386,6 @@ void EDA_DRAW_FRAME::ReCreateMenuBar()
 }
 
 
-bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
-{
-    return false;
-}
-
 int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
                                        wxString* aFullFileName )
 {
@@ -495,12 +489,6 @@ double EDA_DRAW_FRAME::GetZoom()
 }
 
 
-void EDA_DRAW_FRAME::OnMouseEvent( wxMouseEvent& event )
-{
-    event.Skip();
-}
-
-
 void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
 {
     m_toolMsg = msg;
diff --git a/common/legacy_wx/eda_draw_panel.cpp b/common/legacy_wx/eda_draw_panel.cpp
index 248e6202fe..182e027263 100644
--- a/common/legacy_wx/eda_draw_panel.cpp
+++ b/common/legacy_wx/eda_draw_panel.cpp
@@ -62,14 +62,10 @@ BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow )
 #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
     EVT_MAGNIFY( EDA_DRAW_PANEL::OnMagnify )
 #endif
-    EVT_MOUSE_EVENTS( EDA_DRAW_PANEL::OnMouseEvent )
-    EVT_CHAR( EDA_DRAW_PANEL::OnKeyEvent )
-    EVT_CHAR_HOOK( EDA_DRAW_PANEL::OnKeyEvent )
     EVT_PAINT( EDA_DRAW_PANEL::OnPaint )
     EVT_ERASE_BACKGROUND( EDA_DRAW_PANEL::OnEraseBackground )
     EVT_SCROLLWIN( EDA_DRAW_PANEL::OnScroll )
     EVT_ACTIVATE( EDA_DRAW_PANEL::OnActivate )
-    EVT_TIMER( ID_MOUSE_DOUBLECLICK, EDA_DRAW_PANEL::OnTimer )
     EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, EDA_DRAW_PANEL::OnPan )
 END_EVENT_TABLE()
 
@@ -351,14 +347,6 @@ void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event )
 }
 
 
-void EDA_DRAW_PANEL::OnTimer( wxTimerEvent& event )
-{
-    INSTALL_UNBUFFERED_DC( DC, this );
-    DC.SetBackground( *wxBLACK_BRUSH );
-    GetParent()->OnLeftClick( &DC, m_CursorClickPos );
-}
-
-
 void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
 {
     int id = event.GetEventType();
@@ -827,33 +815,6 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoi
 }
 
 
-bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
-{
-    wxPoint pos;
-    wxMenu  MasterMenu;
-
-    INSTALL_UNBUFFERED_DC( dc, this );
-
-    pos = event.GetLogicalPosition( dc );
-
-    if( !GetParent()->OnRightClick( pos, &MasterMenu ) )
-        return false;
-
-    GetParent()->AddMenuZoomAndGrid( &MasterMenu );
-
-    pos = event.GetPosition();
-    m_ignoreMouseEvents = true;
-    PopupMenu( &MasterMenu, pos );
-
-    // The ZoomAndGrid menu is only invoked over empty space so there's no point in warping
-    // the cursor back to the crosshair, and it's very annoying if one clicked out of the menu.
-
-    m_ignoreMouseEvents = false;
-
-    return true;
-}
-
-
 void EDA_DRAW_PANEL::OnMouseEntering( wxMouseEvent& aEvent )
 {
     // This is an ugly hack that fixes some cross hair display bugs when the mouse leaves the
@@ -1025,177 +986,6 @@ void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event )
 #endif
 
 
-void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
-{
-    int          localbutt = 0;
-    BASE_SCREEN* screen = GetScreen();
-
-    if( !screen )
-        return;
-
-    /* Adjust value to filter mouse displacement before consider the drag
-     * mouse is really a drag command, not just a movement while click
-     */
-#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
-
-    if( event.Leaving() )
-        m_canStartBlock = -1;
-
-    if( !IsMouseCaptured() )          // No mouse capture in progress.
-        SetAutoPanRequest( false );
-
-    if( GetParent()->IsActive() )
-        SetFocus();
-    else
-        return;
-
-    if( !event.IsButton() && !event.Moving() && !event.Dragging() )
-        return;
-
-    if( event.RightDown() )
-    {
-        OnRightClick( event );
-        return;
-    }
-
-    if( m_ignoreMouseEvents )
-        return;
-
-    if( event.LeftDown() )
-        localbutt = GR_M_LEFT_DOWN;
-
-    if( event.ButtonDClick( 1 ) )
-        localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
-
-    if( event.MiddleDown() )
-        localbutt = GR_M_MIDDLE_DOWN;
-
-    INSTALL_UNBUFFERED_DC( DC, this );
-    DC.SetBackground( *wxBLACK_BRUSH );
-
-    // Compute the cursor position in drawing (logical) units.
-    GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
-
-    int kbstat = 0;
-
-    if( event.ShiftDown() )
-        kbstat |= GR_KB_SHIFT;
-
-    if( event.ControlDown() )
-        kbstat |= GR_KB_CTRL;
-
-    if( event.AltDown() )
-        kbstat |= GR_KB_ALT;
-
-    // Calling Double Click and Click functions :
-    if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
-    {
-        if( m_ClickTimer )
-        {
-            m_ClickTimer->Stop();
-            wxDELETE( m_ClickTimer );
-        }
-        GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
-
-        // inhibit a response to the mouse left button release,
-        // because we have a double click, and we do not want a new
-        // OnLeftClick command at end of this Double Click
-        m_ignoreNextLeftButtonRelease = true;
-    }
-    else if( event.LeftUp() )
-    {
-        // A block command is in progress: a left up is the end of block
-        // or this is the end of a double click, already seen
-        // Note also m_ignoreNextLeftButtonRelease can be set by
-        // the call to OnLeftClick(), so do not change it after calling OnLeftClick
-        m_ignoreNextLeftButtonRelease = false;
-    }
-    else if( !event.LeftIsDown() )
-    {
-        /* be sure there is a response to a left button release command
-         * even when a LeftUp event is not seen.  This happens when a
-         * double click opens a dialog box, and the release mouse button
-         * is made when the dialog box is opened.
-         */
-        m_ignoreNextLeftButtonRelease = false;
-    }
-
-    if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) )
-    {
-        m_PanStartCenter = GetParent()->GetScrollCenterPosition();
-        m_PanStartEventPosition = event.GetPosition();
-
-        INSTALL_UNBUFFERED_DC( dc, this );
-        CrossHairOff( &dc );
-        SetCursor( wxCURSOR_SIZING );
-    }
-
-    if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) )
-    {
-        INSTALL_UNBUFFERED_DC( dc, this );
-        CrossHairOn( &dc );
-        SetCursor( (wxStockCursor) m_currentCursor );
-    }
-
-    if( event.MiddleIsDown() )
-    {
-        wxPoint currentPosition = event.GetPosition();
-
-        double scale = GetParent()->GetScreen()->GetScalingFactor();
-        int x = m_PanStartCenter.x +
-                KiROUND( (double) ( m_PanStartEventPosition.x - currentPosition.x ) / scale );
-        int y = m_PanStartCenter.y +
-                KiROUND( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );
-
-        GetParent()->RedrawScreen( wxPoint( x, y ), false );
-    }
-
-    // Calling the general function on mouse changes (and pseudo key commands)
-    GetParent()->GeneralControl( &DC, event.GetLogicalPosition( DC ), 0 );
-
-    /*******************************/
-    /* Control of block commands : */
-    /*******************************/
-
-    // Command block can't start if mouse is dragging a new panel
-    static EDA_DRAW_PANEL* lastPanel;
-    if( lastPanel != this )
-    {
-        m_minDragEventCount = 0;
-        m_canStartBlock   = -1;
-    }
-
-    /* A new command block can start after a release buttons
-     * and if the drag is enough
-     * This is to avoid a false start block when a dialog box is dismissed,
-     * or when changing panels in hierarchy navigation
-     * or when clicking while and moving mouse
-     */
-    if( !event.LeftIsDown() && !event.MiddleIsDown() )
-    {
-        m_minDragEventCount = 0;
-        m_canStartBlock   = 0;
-
-        /* Remember the last cursor position when a drag mouse starts
-         * this is the last position ** before ** clicking a button
-         * this is useful to start a block command from the point where the
-         * mouse was clicked first
-         * (a filter creates a delay for the real block command start, and
-         * we must remember this point)
-         */
-        m_CursorStartPos = GetParent()->GetCrossHairPosition();
-    }
-
-    lastPanel = this;
-
-#ifdef __WXGTK3__
-    // Screen has to be updated on every operation, otherwise the cursor leaves a trail (when xor
-    // operation is changed to copy) or is not updated at all.
-    Refresh();
-#endif
-}
-
-
 void EDA_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
 {
     wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) );
@@ -1203,73 +993,6 @@ void EDA_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
 }
 
 
-void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
-{
-    int localkey;
-    wxPoint pos;
-
-    wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnKeyEvent %s", dump( event ) );
-
-    localkey = event.GetKeyCode();
-    bool keyWasHandled = false;
-
-    switch( localkey )
-    {
-    default:
-        break;
-
-    case WXK_ESCAPE:
-        m_abortRequest = true;
-
-        if( IsMouseCaptured() )
-            EndMouseCapture();
-        else
-            EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
-
-        keyWasHandled = true;   // The key is captured: the key event must not be skipped
-        break;
-    }
-
-    /* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
-     * They have an ascii code from 1 to 27 remapped
-     * to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
-     */
-    if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
-        localkey += 'A' - 1;
-
-    /* Disallow shift for keys that have two keycodes on them (e.g. number and
-     * punctuation keys) leaving only the "letter keys" of A-Z.
-     * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
-     * and Ctrl-( and Ctrl-5 (FR layout).
-     * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
-     */
-    bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
-                       ( localkey >= 'a' && localkey <= 'z' );
-
-    if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
-        localkey |= GR_KB_SHIFT;
-
-    if( event.ControlDown() )
-        localkey |= GR_KB_CTRL;
-
-    if( event.AltDown() )
-        localkey |= GR_KB_ALT;
-
-    INSTALL_UNBUFFERED_DC( DC, this );
-
-    // Some key commands use the current mouse position: refresh it.
-    pos = wxGetMousePosition() - GetScreenPosition();
-
-    // Compute the cursor position in drawing units.  Also known as logical units to wxDC.
-    pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
-
-    GetParent()->SetMousePosition( pos );
-
-    if( !GetParent()->GeneralControl( &DC, pos, localkey ) && !keyWasHandled )
-        event.Skip();   // Skip this event only when the key was not handled
-}
-
-
 void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
 {
     int x, y;
diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp
index d855f10edb..0f097a6033 100644
--- a/cvpcb/display_footprints_frame.cpp
+++ b/cvpcb/display_footprints_frame.cpp
@@ -333,74 +333,6 @@ void DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL()
 }
 
 
-bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
-        EDA_KEY aHotKey )
-{
-    bool eventHandled = true;
-
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    wxPoint pos = aPosition;
-    wxPoint oldpos = GetCrossHairPosition();
-    GeneralControlKeyMovement( aHotKey, &pos, true );
-
-    switch( aHotKey )
-    {
-    case WXK_F1:
-        cmd.SetId( ID_KEY_ZOOM_IN );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case WXK_F2:
-        cmd.SetId( ID_KEY_ZOOM_OUT );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case WXK_F3:
-        cmd.SetId( ID_ZOOM_REDRAW );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case WXK_F4:
-        cmd.SetId( ID_POPUP_ZOOM_CENTER );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case WXK_HOME:
-        cmd.SetId( ID_ZOOM_PAGE );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case ' ':
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case GR_KB_ALT + '3':
-        cmd.SetId( ID_CVPCB_SHOW3D_FRAME );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    default:
-        eventHandled = false;
-    }
-
-    SetCrossHairPosition( pos );
-    RefreshCrossHair( oldpos, aPosition, aDC );
-
-    UpdateStatusBar();    /* Display new cursor coordinates */
-
-    return eventHandled;
-}
-
-
 void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
 {
     bool forceRecreateIfNotOwner = true;
diff --git a/cvpcb/display_footprints_frame.h b/cvpcb/display_footprints_frame.h
index 7a8d41b3ca..6371c89b3a 100644
--- a/cvpcb/display_footprints_frame.h
+++ b/cvpcb/display_footprints_frame.h
@@ -108,7 +108,6 @@ public:
      */
     COLOR4D GetGridColor() override;
 
-    bool    GeneralControl( wxDC* DC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
     void    InstallOptionsDisplay( wxCommandEvent& event );
     MODULE* Get_Module( const wxString& CmpName );
 
diff --git a/eeschema/ee_hotkeys.cpp b/eeschema/ee_hotkeys.cpp
index b64fd418c0..f52f737ce6 100644
--- a/eeschema/ee_hotkeys.cpp
+++ b/eeschema/ee_hotkeys.cpp
@@ -392,66 +392,6 @@ EDA_HOTKEY* SCH_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-/*
- * Hot keys.  Commands are case insensitive.
- */
-bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
-{
-    if( aHotKey == 0 )
-        return false;
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-
-    /* Convert lower to upper case (the usual toupper function has problem
-     * with non ascii codes like function keys */
-    if( (aHotKey >= 'a') && (aHotKey <= 'z') )
-        aHotKey += 'A' - 'a';
-
-    // Search command from key :
-    EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
-
-    if( hotKey == NULL )
-        hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List );
-
-    if( hotKey == NULL )
-        return false;
-
-    switch( hotKey->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:       // Display Current hotkey list
-        DisplayHotkeyList( this, g_Schematic_Hotkeys_Descr );
-        break;
-
-    case HK_PREFERENCES:
-        cmd.SetId( wxID_PREFERENCES );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_RESET_LOCAL_COORD:         // Reset the relative coord
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_CANVAS_CAIRO:
-    case HK_CANVAS_OPENGL:
-        {
-            EDA_HOTKEY_CLIENT_DATA data( aPosition );
-            cmd.SetInt( hotKey->m_Idcommand );
-            cmd.SetClientObject( &data );
-            cmd.SetId( hotKey->m_IdMenuEvent );
-            GetEventHandler()->ProcessEvent( cmd );
-        }
-        break;
-    }
-
-    // Hot key handled.
-    return true;
-}
-
-
 EDA_HOTKEY* LIB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
 {
     EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
@@ -463,52 +403,6 @@ EDA_HOTKEY* LIB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
-{
-    if( aHotKey == 0 )
-        return false;
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem
-     * with non ascii codes like function keys */
-    if( (aHotKey >= 'a') && (aHotKey <= 'z') )
-        aHotKey += 'A' - 'a';
-
-    EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
-
-    if( hotKey == NULL )
-        hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List );
-
-    if( hotKey == NULL )
-        return false;
-
-    switch( hotKey->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:       // Display Current hotkey list
-        DisplayHotkeyList( this, g_Libedit_Hotkeys_Descr );
-        break;
-
-    case HK_PREFERENCES:
-        cmd.SetId( wxID_PREFERENCES );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_RESET_LOCAL_COORD:         // Reset the relative coord
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-    }
-
-    // Hot key handled.
-    return true;
-}
-
-
 EDA_HOTKEY* LIB_VIEW_FRAME::GetHotKeyDescription( int aCommand ) const
 {
     EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
@@ -520,47 +414,3 @@ EDA_HOTKEY* LIB_VIEW_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
-{
-    if( aHotKey == 0 )
-        return false;
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem with non ascii
-     * codes like function keys */
-    if( (aHotKey >= 'a') && (aHotKey <= 'z') )
-        aHotKey += 'A' - 'a';
-
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        return false;
-
-    switch( HK_Descr->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:                   // Display Current hotkey list
-        DisplayHotkeyList( this, g_Viewlib_Hotkeys_Descr );
-        break;
-
-    case HK_RESET_LOCAL_COORD:      // set local (relative) coordinate origin
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_CANVAS_CAIRO:
-    case HK_CANVAS_OPENGL:
-        cmd.SetInt( HK_Descr->m_Idcommand );
-        cmd.SetId( HK_Descr->m_IdMenuEvent );
-        GetEventHandler()->ProcessEvent( cmd );
-    }
-
-    return true;
-}
diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp
index fa3611b2f3..c094f43826 100644
--- a/eeschema/libedit/lib_edit_frame.cpp
+++ b/eeschema/libedit/lib_edit_frame.cpp
@@ -1034,33 +1034,3 @@ void LIB_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
     GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
 }
 
-
-bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    bool    keyHandled = false;
-    wxPoint pos = aPosition;
-
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    if( aHotKey )
-        keyHandled = GeneralControlKeyMovement( aHotKey, &pos, true );
-
-    GetGalCanvas()->GetViewControls()->SetSnapping( false );
-    SetCrossHairPosition( pos, false );
-
-    if( aHotKey && OnHotKey( aDC, aHotKey, aPosition, NULL ) )
-        keyHandled = true;
-
-    // Make sure current-part highlighting doesn't get lost in seleciton highlighting
-    ClearSearchTreeSelection();
-
-    UpdateStatusBar();
-
-    return keyHandled;
-}
-
diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h
index c97b00dab2..bd805bafe4 100644
--- a/eeschema/libedit/lib_edit_frame.h
+++ b/eeschema/libedit/lib_edit_frame.h
@@ -323,10 +323,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
-
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
-
     void LoadSettings( wxConfigBase* aCfg ) override;
     void SaveSettings( wxConfigBase* aCfg ) override;
 
diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp
index de8e5ea77a..8b3b704791 100644
--- a/eeschema/sch_draw_panel.cpp
+++ b/eeschema/sch_draw_panel.cpp
@@ -46,7 +46,6 @@ using namespace std::placeholders;
 
 // Events used by EDA_DRAW_PANEL
 BEGIN_EVENT_TABLE( SCH_DRAW_PANEL, wxScrolledCanvas )
-      EVT_CHAR( SCH_DRAW_PANEL::OnKeyEvent )
       EVT_CHAR_HOOK( SCH_DRAW_PANEL::OnCharHook )
       EVT_PAINT( SCH_DRAW_PANEL::onPaint )
 END_EVENT_TABLE()
@@ -84,7 +83,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
     // on updated viewport data.
     m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
 
-    Connect( wxEVT_CHAR, wxKeyEventHandler( SCH_DRAW_PANEL::OnKeyEvent ), NULL, this );
     Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
 
     Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
@@ -254,68 +252,6 @@ void SCH_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
 }
 
 
-void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
-{
-    SCH_BASE_FRAME* frame = (SCH_BASE_FRAME*) m_parent;
-    int             localkey = event.GetKeyCode();
-    bool            keyWasHandled = false;
-
-    if( localkey == WXK_ESCAPE )
-    {
-        m_abortRequest = true;
-
-        if( frame->IsModal() )
-            frame->DismissModal( wxID_CANCEL );
-        else
-            GetParent()->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
-
-        keyWasHandled = true;   // The key is captured: the key event will be not skipped
-    }
-
-    /* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
-     * They have an ascii code from 1 to 27 remapped
-     * to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
-     */
-    if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
-        localkey += 'A' - 1;
-
-    /* Disallow shift for keys that have two keycodes on them (e.g. number and
-     * punctuation keys) leaving only the "letter keys" of A-Z.
-     * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
-     * and Ctrl-( and Ctrl-5 (FR layout).
-     * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
-     */
-    bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
-                       ( localkey >= 'a' && localkey <= 'z' );
-
-    if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
-        localkey |= GR_KB_SHIFT;
-
-    if( event.ControlDown() )
-        localkey |= GR_KB_CTRL;
-
-    if( event.AltDown() )
-        localkey |= GR_KB_ALT;
-
-
-    // Some key commands use the current mouse position: refresh it.
-    //pos = wxGetMousePosition() - GetScreenPosition();
-
-    // Compute the cursor position in drawing units.  Also known as logical units to wxDC.
-    //pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
-
-    auto p =  GetViewControls()->GetCursorPosition( false );
-
-    wxPoint pos ((int)p.x, (int)p.y);
-
-    GetParent()->SetMousePosition( pos );
-
-    // a Key event has to be skipped only if it is not handled:
-    if( !GetParent()->GeneralControl( nullptr, pos, localkey ) && !keyWasHandled )
-        event.Skip();
-}
-
-
 void SCH_DRAW_PANEL::onPaint( wxPaintEvent& aEvent )
 {
     if( !m_gal->IsInitialized() || !m_gal->IsVisible() )
diff --git a/eeschema/sch_draw_panel.h b/eeschema/sch_draw_panel.h
index 24c6ac51bc..6dca355640 100644
--- a/eeschema/sch_draw_panel.h
+++ b/eeschema/sch_draw_panel.h
@@ -41,7 +41,6 @@ public:
     void DisplaySheet( const SCH_SCREEN *aScreen );
 
     bool SwitchBackend( GAL_TYPE aGalType ) override;
-    void OnKeyEvent( wxKeyEvent& event );
     void OnCharHook( wxKeyEvent& event );
 
     void SetEnableMousewheelPan( bool aEnable ) override;
diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h
index 56def36c6b..3d80232379 100644
--- a/eeschema/sch_edit_frame.h
+++ b/eeschema/sch_edit_frame.h
@@ -310,8 +310,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem ) override;
-
     /**
      * Must be called after a schematic change in order to set the "modify" flag of the
      * current screen and update the date in frame reference.
diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp
index 6c8ce686f7..f589e8bd24 100644
--- a/eeschema/viewlib_frame.cpp
+++ b/eeschema/viewlib_frame.cpp
@@ -846,39 +846,6 @@ void LIB_VIEW_FRAME::OnAddPartToSchematic( wxCommandEvent& aEvent )
 }
 
 
-bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    bool eventHandled = true;
-
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    wxPoint pos = aPosition;
-    GeneralControlKeyMovement( aHotKey, &pos, true );
-
-    // Update cursor position.
-    SetCrossHairPosition( pos, true );
-
-    if( aHotKey )
-    {
-        SCH_SCREEN* screen = GetScreen();
-
-        if( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
-            eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
-        else
-            eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
-    }
-
-    UpdateStatusBar();    // Display cursor coordinates info.
-
-    return eventHandled;
-}
-
-
 void LIB_VIEW_FRAME::OnDisplayHotkeyList( wxCommandEvent& event )
 {
     DisplayHotkeyList( this, g_Viewlib_Hotkeys_Descr );
diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h
index 2f7f743438..f984843ed4 100644
--- a/eeschema/viewlib_frame.h
+++ b/eeschema/viewlib_frame.h
@@ -97,21 +97,9 @@ public:
     void OnSetRelativeOffset( wxCommandEvent& event );
     void OnSelectSymbol( wxCommandEvent& aEvent );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) override;
-
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Handle hot key events.
-     *
-     * <p>
-     * Some commands are relative to the item under the mouse cursor.  Commands are
-     * case insensitive
-     * </p>
-     */
-    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem ) override;
-
     /**
      * Displays the hotkey dialog
      */
diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt
index e73fcba6ab..32f4d40816 100644
--- a/gerbview/CMakeLists.txt
+++ b/gerbview/CMakeLists.txt
@@ -40,7 +40,6 @@ set( GERBVIEW_SRCS
     gbr_layer_box_selector.cpp
     X2_gerber_attributes.cpp
     clear_gbr_drawlayers.cpp
-    controle.cpp
     dcode.cpp
     draw_gerber_screen.cpp
     evaluate.cpp
@@ -55,7 +54,6 @@ set( GERBVIEW_SRCS
     job_file_reader.cpp
     locate.cpp
     menubar.cpp
-    onleftclick.cpp
     readgerb.cpp
     rs274_read_XY_and_IJ_coordinates.cpp
     rs274d.cpp
diff --git a/gerbview/controle.cpp b/gerbview/controle.cpp
deleted file mode 100644
index 267d5d91a2..0000000000
--- a/gerbview/controle.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 1992-2017 <Jean-Pierre Charras>
- * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file gerbview/controle.cpp
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <gerbview_frame.h>
-
-
-bool GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    wxPoint pos = aPosition;
-    wxPoint oldpos = GetCrossHairPosition();
-    bool eventHandled = GeneralControlKeyMovement( aHotKey, &pos, true );
-
-    SetCrossHairPosition( pos );
-    RefreshCrossHair( oldpos, aPosition, aDC );
-
-    if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
-    {
-        eventHandled = true;
-    }
-
-    UpdateStatusBar();
-
-    return eventHandled;
-}
diff --git a/gerbview/gerber_collectors.cpp b/gerbview/gerber_collectors.cpp
index 639fcab5ea..2eb2fc3357 100644
--- a/gerbview/gerber_collectors.cpp
+++ b/gerbview/gerber_collectors.cpp
@@ -30,9 +30,7 @@ const KICAD_T GERBER_COLLECTOR::AllItems[] = {
 /**
  * Function Inspect
  * is the examining function within the INSPECTOR which is passed to the
- * Iterate function.  Searches and collects all the objects that the old
- * function PcbGeneralLocateAndDisplay() would find, except that it keeps all
- * that it finds and does not do any displaying.
+ * Iterate function.
  *
  * @param testItem An EDA_ITEM to examine.
  * @param testData not used here.
diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h
index 6554b7628e..dddbb9badf 100644
--- a/gerbview/gerbview_frame.h
+++ b/gerbview/gerbview_frame.h
@@ -230,8 +230,6 @@ public:
     void ReCreateOptToolbar();
 
     void ReCreateMenuBar() override;
-    void OnLeftClick( wxDC* aDC, const wxPoint& aMousePos ) override;
-    void OnLeftDClick( wxDC* aDC, const wxPoint& aMousePos ) override;
     void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
     double BestZoom() override;
     void UpdateStatusBar() override;
@@ -463,17 +461,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Function OnHotKey.
-     *  ** Commands are case insensitive **
-     *  Some commands are relatives to the item under the mouse cursor
-     * @param aDC = current device context
-     * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
-     * @param aPosition The cursor position in logical (drawing) units.
-     * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
-     */
-    bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
-
     GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
 
     void Process_Config( wxCommandEvent& event );
@@ -568,8 +555,6 @@ public:
     bool LoadGerberJobFile( const wxString& aFileName );
 
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
-
     /**
      * Set Size Items (Lines, Flashes) from DCodes List
      */
diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp
index 40162f0f7c..4f44400ce8 100644
--- a/gerbview/hotkeys.cpp
+++ b/gerbview/hotkeys.cpp
@@ -150,68 +150,3 @@ EDA_HOTKEY* GERBVIEW_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem )
-{
-    #define CHANGE( x ) ( x ) = not (x )
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem with non ascii
-     * codes like function keys */
-    if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
-        aHotkeyCode += 'A' - 'a';
-
-    EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, gerbviewHotkeyList );
-
-    if( HK_Descr == NULL )
-        return false;
-
-    switch( HK_Descr->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:       // Display Current hotkey list
-        DisplayHotkeyList( this, GerbviewHotkeysDescr );
-        break;
-
-    case HK_PREFERENCES:
-        cmd.SetId( wxID_PREFERENCES );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_RESET_LOCAL_COORD:         // Reset the relative coord
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_SWITCH_LAYER_TO_PREVIOUS:
-        if( GetActiveLayer() > 0 )
-        {
-            SetActiveLayer( GetActiveLayer() - 1, true );
-            m_canvas->Refresh();
-        }
-        break;
-
-    case HK_SWITCH_LAYER_TO_NEXT:
-        if( GetActiveLayer() < GERBER_DRAWLAYERS_COUNT - 1 )
-        {
-            SetActiveLayer( GetActiveLayer() + 1, true );
-            m_canvas->Refresh();
-        }
-        break;
-
-    case HK_CANVAS_CAIRO:
-        cmd.SetId( ID_MENU_CANVAS_CAIRO );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_CANVAS_OPENGL:
-        cmd.SetId( ID_MENU_CANVAS_OPENGL );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-    }
-
-    return true;
-}
diff --git a/gerbview/onleftclick.cpp b/gerbview/onleftclick.cpp
deleted file mode 100644
index e2a7a26026..0000000000
--- a/gerbview/onleftclick.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2011-2014 Jean-Pierre Charras  jp.charras at wanadoo.fr
- * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-
-#include <gerbview.h>
-#include <gerbview_frame.h>
-#include <gerber_file_image.h>
-#include <gerber_file_image_list.h>
-#include <dialog_helpers.h>
-#include <gerbview_id.h>
-
-/* Process the command triggered by the left button of the mouse
- * currently: just display info in the message panel.
- */
-void GERBVIEW_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
-{
-    SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
-
-    GERBER_DRAW_ITEM* DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
-
-    GetScreen()->SetCurItem( DrawStruct );
-
-    if( DrawStruct == NULL )
-    {
-        GERBER_FILE_IMAGE* gerber = GetGbrImage( GetActiveLayer() );
-
-        if( gerber )
-            gerber->DisplayImageInfo( this );
-    }
-}
-
-
-/* Called on a double click of left mouse button.
- */
-void GERBVIEW_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
-{
-    // Currently: no nothing
-}
diff --git a/include/draw_frame.h b/include/draw_frame.h
index d9d63e5b82..fef732e5bb 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -425,7 +425,6 @@ public:
     virtual void ExecuteRemoteCommand( const char* cmdline ){}
 
     void OnMenuOpen( wxMenuEvent& event );
-    void  OnMouseEvent( wxMouseEvent& event );
 
     /**
      * After calling this function, if the left mouse button
@@ -455,9 +454,6 @@ public:
      */
     virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
 
-    virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
-                           EDA_ITEM* aItem = NULL );
-
     /**
      * Add standard zoom commands and submenu zoom and grid selection to a popup menu
      * uses zoom hotkeys info base to add hotkeys info to menu commands
@@ -609,22 +605,6 @@ public:
     // EDA_DRAW_FRAME.
     void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
 
-    /**
-     * Perform application specific control using \a aDC at \a aPosition in logical units.
-     * <p>
-     * Override this function for application specific control.  This function gets
-     * called on every mouse and key event.
-     *</p>
-     * @param aDC A device context.
-     * @param aPosition The current cursor position in logical (drawing) units.
-     * @param aHotKey A key event used for application specific control if not zero.
-     * @return true if the hotkey code is handled (captured).
-     */
-    virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
-    {
-        return false;
-    }
-
     /**
      * Recalculate the size of toolbars and display panel when the frame size changes.
      */
@@ -723,8 +703,6 @@ public:
     wxString        GetToolMsg() { return m_toolMsg; }
     virtual void    RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
     virtual void    OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
-    virtual void    OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) {}
-    virtual bool    OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) { return true; }
     virtual void    ToolOnRightClick( wxCommandEvent& event );
     void            AdjustScrollBars( const wxPoint& aCenterPosition );
 
diff --git a/include/legacy_wx/class_drawpanel.h b/include/legacy_wx/class_drawpanel.h
index b0cf925132..a077ee89f7 100644
--- a/include/legacy_wx/class_drawpanel.h
+++ b/include/legacy_wx/class_drawpanel.h
@@ -215,17 +215,6 @@ public:
      */
     void OnActivate( wxActivateEvent& event );
 
-    /**
-     * Function OnTimer
-     * handle timer events
-     * <p>
-     * The class will start a timer when a mouse-up event is handled.  If a
-     * double-click event is not handled inside of a specified interval,
-     * the timer event will fire, causing the single-click event to be handled.
-     * Otherwise, the system will process the double-click.
-     */
-    void OnTimer( wxTimerEvent& event );
-
     /**
      * Function DoPrepareDC
      * sets up the device context \a aDC for drawing.
@@ -269,10 +258,8 @@ public:
 #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
     void OnMagnify( wxMouseEvent& event );
 #endif
-    void OnMouseEvent( wxMouseEvent& event );
     void OnMouseEntering( wxMouseEvent& aEvent );
     void OnMouseLeaving( wxMouseEvent& event );
-    void OnKeyEvent( wxKeyEvent& event );
     void OnCharHook( wxKeyEvent& event );
 
     void OnPan( wxCommandEvent& event );
@@ -287,13 +274,6 @@ public:
     void SetGrid( const wxRealPoint& size );
     wxRealPoint GetGrid();
 
-    /**
-     * Function OnRightClick
-     * builds and displays a context menu on a right mouse button click.
-     * @return true if the context menu is shown, or false
-     */
-    bool OnRightClick( wxMouseEvent& event );
-
     /**
      * Function IsPointOnDisplay
      * @param aPosition The position to test in logical (drawing) units.
@@ -470,33 +450,4 @@ public:
 };
 
 
-/**
- * Class EDA_CROSS_HAIR_MANAGER
- * is used to hide the cross hair and restore it when the class goes out of scope.
- */
-class EDA_CROSS_HAIR_MANAGER
-{
-public:
-    EDA_CROSS_HAIR_MANAGER( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) :
-        m_panel( aPanel ),
-        m_dc( aDC )
-    {
-        if( aPanel && aDC )
-            aPanel->CrossHairOff( aDC );
-    }
-
-    ~EDA_CROSS_HAIR_MANAGER()
-    {
-        if( m_panel && m_dc )
-            m_panel->CrossHairOn( m_dc );
-    }
-
-private:
-    EDA_DRAW_PANEL* m_panel;
-    wxDC* m_dc;
-
-    DECLARE_NO_COPY_CLASS( EDA_CROSS_HAIR_MANAGER )
-};
-
-
 #endif  /* #ifndef PANEL_WXSTRUCT_H */
diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h
index 44b06dc4f4..ba7e22e047 100644
--- a/include/pcb_base_frame.h
+++ b/include/pcb_base_frame.h
@@ -240,23 +240,6 @@ public:
      */
     virtual bool CreateAndShow3D_Frame( bool aForceRecreateIfNotOwner );
 
-    /**
-     * Function PcbGeneralLocateAndDisplay
-     * searches for an item under the mouse cursor.
-     * Items are searched first on the current working layer.
-     * If nothing found, an item will be searched without layer restriction.
-     * If more than one item is found meeting the current working layer
-     * criterion, then a popup menu is shown which allows the user to pick
-     * which item he/she is interested in.  Once an item is chosen, then it
-     * is make the "current item" and the status window is updated to reflect
-     * this.
-     *
-     * @param aHotKeyCode The hotkey which relates to the caller and determines
-     *                    the type of search to be performed.  If zero, then
-     *                    the mouse tools will be tested instead.
-     */
-    BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
-
     void ProcessItemSelection( wxCommandEvent& event );
 
     /**
@@ -341,21 +324,6 @@ public:
      */
     void PlaceModule( MODULE* aModule, wxDC* aDC, bool aRecreateRatsnest = true );
 
-    // module texts
-    void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
-    void DeleteTextModule( TEXTE_MODULE* Text );
-    void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
-    void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
-
-    /**
-     * Function ResetTextSize
-     * resets given field text size and width to current settings in
-     * Preferences->Dimensions->Texts and Drawings.
-     * @param aItem is the item to be reset, either TEXTE_PCB or TEXTE_MODULE.
-     * @param aDC is the drawing context.
-     */
-    void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC );
-
     void InstallPadOptionsFrame( D_PAD* pad );
 
     void AddPad( MODULE* Module, bool draw );
diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp
index 9868af5126..f4869eee0a 100644
--- a/pagelayout_editor/hotkeys.cpp
+++ b/pagelayout_editor/hotkeys.cpp
@@ -139,85 +139,3 @@ EDA_HOTKEY* PL_EDITOR_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-bool PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
-                                EDA_ITEM* aItem )
-{
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem with non ascii
-     * codes like function keys */
-    if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
-        aHotkeyCode += 'A' - 'a';
-
-    EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_PlEditor_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        return false;
-
-    switch( HK_Descr->m_Idcommand )
-    {
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_LEFT_CLICK:
-        OnLeftClick( aDC, aPosition );
-        break;
-
-    case HK_LEFT_DCLICK:    // Simulate a double left click: generate 2 events
-        OnLeftClick( aDC, aPosition );
-        OnLeftDClick( aDC, aPosition );
-        break;
-
-    case HK_NEW:
-        cmd.SetId( wxID_NEW );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_OPEN:
-        cmd.SetId( wxID_OPEN );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_SAVE:
-        cmd.SetId( wxID_SAVE );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_SAVEAS:
-        cmd.SetId( wxID_SAVEAS );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_PRINT:
-        cmd.SetId( wxID_PRINT );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_RESET_LOCAL_COORD:      // Reset the relative coord
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_HELP:       // Display Current hotkey list
-        DisplayHotkeyList( this, PlEditorHotkeysDescr );
-        break;
-
-    case HK_PREFERENCES:
-        cmd.SetId( wxID_PREFERENCES );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_SET_GRID_ORIGIN:
-        SetGridOrigin( GetCrossHairPosition() );
-        break;
-
-    default:
-        wxMessageBox( wxT( "Unknown hotkey" ) );
-        return false;
-    }
-
-    return true;
-}
diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h
index 3053922e87..dc97f7515b 100644
--- a/pagelayout_editor/pl_editor_frame.h
+++ b/pagelayout_editor/pl_editor_frame.h
@@ -217,18 +217,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Function OnHotKey.
-     *  ** Commands are case insensitive **
-     *  Some commands are relatives to the item under the mouse cursor
-     * @param aDC = current device context
-     * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
-     * @param aPosition The cursor position in logical (drawing) units.
-     * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
-     */
-    bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
-                   EDA_ITEM* aItem = NULL ) override;
-
     /**
      * Function ToPrinter
      * Open a dialog frame to print layers
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 5300e3ce86..f6ede020b5 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -232,31 +232,24 @@ set( PCBNEW_CLASS_SRCS
     action_plugin.cpp
     array_creator.cpp
     array_pad_name_provider.cpp
-    attribut.cpp
     board_netlist_updater.cpp
     build_BOM_from_board.cpp
     connect.cpp
-    controle.cpp
     cross-probing.cpp
     deltrack.cpp
     dimension.cpp
     dragsegm.cpp
     drc.cpp
     drc_clearance_test_functions.cpp
-    edgemod.cpp
     edit.cpp
-    edit_pcb_text.cpp
     edit_track_width.cpp
-    editedge.cpp
     editrack-part2.cpp
     editrack.cpp
-    edtxtmod.cpp
     event_handlers_tracks_vias_sizes.cpp
     files.cpp
     footprint_info_impl.cpp
     footprint_wizard.cpp
     footprint_editor_utils.cpp
-    footprint_editor_onclick.cpp
     footprint_editor_options.cpp
     fp_tree_synchronizing_adapter.cpp
     footprint_edit_frame.cpp
@@ -266,10 +259,7 @@ set( PCBNEW_CLASS_SRCS
     generate_footprint_info.cpp
     grid_layer_box_helpers.cpp
     grid_layer_box_helpers.h
-    highlight.cpp
     hotkeys.cpp
-    hotkeys_board_editor.cpp
-    hotkeys_footprint_editor.cpp
     initpcb.cpp
     layer_widget.cpp
     load_select_footprint.cpp
@@ -278,10 +268,7 @@ set( PCBNEW_CLASS_SRCS
     menubar_pcb_editor.cpp
     microwave.cpp
     minimun_spanning_tree.cpp
-    move-drag_pads.cpp
-    move_or_drag_track.cpp
     netlist.cpp
-    onleftclick.cpp
     pad_edit_functions.cpp
     pad_naming.cpp
     pcb_base_edit_frame.cpp
diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp
deleted file mode 100644
index 662cdae714..0000000000
--- a/pcbnew/attribut.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
- * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file attribut.cpp
- * @brief Track attribute flags editing.
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <gr_basic.h>
-#include <pcb_edit_frame.h>
-#include <msgpanel.h>
-
-#include <pcbnew.h>
-#include <protos.h>
-
-#include <class_track.h>
-#include <class_board.h>
-
-
-/* Attribute change for 1 track segment.
- *  Attributes are
- *  TRACK_LOCKED       protection against global delete
- *  TRACK_AR           AutoRouted segment
- */
-void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
-{
-    if( track == NULL )
-        return;
-
-    OnModify();
-    m_canvas->CrossHairOff( DC );   // Erase cursor shape
-    track->SetState( TRACK_LOCKED, Flag_On );
-    track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
-    m_canvas->CrossHairOn( DC );    // Display cursor shape
-
-    MSG_PANEL_ITEMS items;
-    track->GetMsgPanelInfo( m_UserUnits, items );
-    SetMsgPanel( items );
-}
-
-
-/* Attribute change for an entire track */
-void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
-{
-    TRACK* Track;
-    int    nb_segm;
-
-    if( track == NULL )
-        return;
-
-    m_canvas->CrossHairOff( DC );   // Erase cursor shape
-    Track = GetBoard()->MarkTrace( GetBoard()->m_Track, track, &nb_segm, NULL, NULL, true );
-    DrawTraces( m_canvas, DC, Track, nb_segm, GR_OR | GR_HIGHLIGHT );
-
-    for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
-    {
-        Track->SetState( TRACK_LOCKED, Flag_On );
-        Track->SetState( BUSY, false );
-        Track = Track->Next();
-    }
-
-    m_canvas->CrossHairOn( DC );    // Display cursor shape
-
-    OnModify();
-}
-
-
-/* Modify the flag TRACK_LOCKED according to Flag_On value,
- *  for all the segments related to net_code.
- *  if net_code < 0 all the segments are modified.
- */
-void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
-{
-    TRACK* Track = GetBoard()->m_Track;
-
-    /* search the first segment for the selected net_code */
-    if( net_code >= 0 )
-    {
-        for( ; Track != NULL; Track = Track->Next() )
-        {
-            if( net_code == Track->GetNetCode() )
-                break;
-        }
-    }
-
-    m_canvas->CrossHairOff( DC );     // Erase cursor shape
-
-    while( Track )                  /* Flag change */
-    {
-        if( ( net_code >= 0 ) && ( net_code != Track->GetNetCode() ) )
-            break;
-
-        OnModify();
-        Track->SetState( TRACK_LOCKED, Flag_On );
-        Track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
-        Track = Track->Next();
-    }
-
-    m_canvas->CrossHairOn( DC );    // Display cursor shape
-    OnModify();
-}
diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp
deleted file mode 100644
index c8e21c7346..0000000000
--- a/pcbnew/controle.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file pcbnew/controle.cpp
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <pcb_edit_frame.h>
-#include <pcbnew_id.h>
-#include <class_board.h>
-#include <class_module.h>
-#include <class_zone.h>
-
-#include <pcbnew.h>
-#include <protos.h>
-#include <collectors.h>
-#include <menus_helpers.h>
-
-//external functions used here:
-extern bool Magnetize( PCB_BASE_EDIT_FRAME* frame, int aCurrentTool,
-                       wxSize aGridSize, wxPoint on_grid, wxPoint* curpos );
-
-
-/**
- * Function AllAreModulesAndReturnSmallestIfSo
- * tests that all items in the collection are MODULEs and if so, returns the
- * smallest MODULE.
- * @return BOARD_ITEM* - The smallest or NULL.
- */
-static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
-{
-#if 0   // Dick: this is not consistent with name of this function, and does not
-        // work correctly using 'M' (move hotkey) when another module's (2nd module) reference
-        // is under a module (first module) and you want to move the reference.
-        // Another way to fix this would be to
-        // treat module text as copper layer content, and put the module text into
-        // the primary list.  I like the coded behavior best.  If it breaks something
-        // perhaps you need a different test before calling this function, which should
-        // do what its name says it does.
-    int count = aCollector->GetPrimaryCount();     // try to use preferred layer
-    if( 0 == count ) count = aCollector->GetCount();
-#else
-    int count = aCollector->GetCount();
-#endif
-
-    for( int i = 0; i<count;  ++i )
-    {
-        if( (*aCollector)[i]->Type() != PCB_MODULE_T )
-            return NULL;
-    }
-
-    // all are modules, now find smallest MODULE
-
-    int minDim = 0x7FFFFFFF;
-    int minNdx = 0;
-
-    for( int i = 0;  i<count;  ++i )
-    {
-        MODULE* module = (MODULE*) (*aCollector)[i];
-
-        int     lx = module->GetBoundingBox().GetWidth();
-        int     ly = module->GetBoundingBox().GetHeight();
-
-        int     lmin = std::min( lx, ly );
-
-        if( lmin < minDim )
-        {
-            minDim = lmin;
-            minNdx = i;
-        }
-    }
-
-    return (*aCollector)[minNdx];
-}
-
-
-// JEY TODO: RETIRE THIS
-BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
-{
-    BOARD_ITEM* item;
-
-    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
-    auto displ_opts = (PCB_DISPLAY_OPTIONS*)( GetDisplayOptions() );
-
-    // Assign to scanList the proper item types desired based on tool type
-    // or hotkey that is in play.
-
-    const KICAD_T* scanList = NULL;
-
-    if( aHotKeyCode )
-    {
-        // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
-        // when searching is needed from a hotkey handler
-    }
-    else if( GetToolId() == ID_NO_TOOL_SELECTED )
-    {
-        scanList = (displ_opts->m_DisplayZonesMode == 0) ?
-                   GENERAL_COLLECTOR::AllBoardItems :
-                   GENERAL_COLLECTOR::AllButZones;
-    }
-    else
-    {
-        switch( GetToolId() )
-        {
-        case ID_LOCAL_RATSNEST_BUTT:
-            scanList = GENERAL_COLLECTOR::PadsOrModules;
-            break;
-
-        case ID_TRACK_BUTT:
-            scanList = GENERAL_COLLECTOR::Tracks;
-            break;
-
-        case ID_PCB_MODULE_BUTT:
-            scanList = GENERAL_COLLECTOR::Modules;
-            break;
-
-        case ID_PCB_ZONES_BUTT:
-        case ID_PCB_KEEPOUT_BUTT:
-            scanList = GENERAL_COLLECTOR::Zones;
-            break;
-
-        default:
-            scanList = displ_opts->m_DisplayZonesMode == 0 ?
-                       GENERAL_COLLECTOR::AllBoardItems :
-                       GENERAL_COLLECTOR::AllButZones;
-        }
-    }
-
-    m_Collector->Collect( m_Pcb, scanList, RefPos( true ), guide );
-
-#if 0
-    // debugging: print out the collected items, showing their priority order too.
-    for( int i = 0; i<m_Collector->GetCount();  ++i )
-        (*m_Collector)[i]->Show( 0, std::cout );
-#endif
-
-    // Trigger the selection of the current edge for zones
-    for( int ii = 0;  ii < m_Collector->GetCount(); ii++ )
-    {
-        item = (*m_Collector)[ii];
-
-        if( item->Type() == PCB_ZONE_AREA_T )
-        {
-            // We need to do the selection now because the menu text depends on it
-            ZONE_CONTAINER *zone = static_cast<ZONE_CONTAINER*>( item );
-            int  accuracy = KiROUND( 5 * guide.OnePixelInIU() );
-            zone->SetSelectedCorner( RefPos( true ), accuracy );
-        }
-    }
-
-    if( m_Collector->GetCount() <= 1 )
-    {
-        item = (*m_Collector)[0];
-        SetCurItem( item );
-    }
-
-    // If the count is 2, and first item is a pad or module text, and the 2nd item is its
-    // parent module:
-    else if( m_Collector->GetCount() == 2
-             && ( (*m_Collector)[0]->Type() == PCB_PAD_T || (*m_Collector)[0]->Type() ==
-                 PCB_MODULE_TEXT_T )
-             && (*m_Collector)[1]->Type() == PCB_MODULE_T && (*m_Collector)[0]->GetParent()==
-             (*m_Collector)[1] )
-    {
-        item = (*m_Collector)[0];
-        SetCurItem( item );
-    }
-    // if all are modules, find the smallest one among the primary choices
-    else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL )
-    {
-        SetCurItem( item );
-    }
-
-    else    // we can't figure out which item user wants, do popup menu so user can choose
-    {
-        wxMenu itemMenu;
-
-        // Give a title to the selection menu. This is also a cancel menu item
-        AddMenuItem( &itemMenu, wxID_NONE, _( "Clarify Selection" ),
-                     KiBitmap( info_xpm ) );
-        itemMenu.AppendSeparator();
-
-        int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
-
-        for( int i = 0;  i<limit;  ++i )
-        {
-            wxString    text;
-            item = (*m_Collector)[i];
-
-            text = item->GetSelectMenuText( m_UserUnits );
-
-            BITMAP_DEF xpm = item->GetMenuImage();
-
-            AddMenuItem( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, KiBitmap( xpm ) );
-        }
-
-        /* @todo: rather than assignment to true, these should be increment and decrement
-         * operators throughout _everywhere_.
-         *  That way we can handle nesting.
-         *  But I tried that and found there cases where the assignment to true (converted to
-         * a m_IgnoreMouseEvents++ )
-         *  was not balanced with the -- (now m_IgnoreMouseEvents=false), so I had to revert.
-         *  Somebody should track down these and make them balanced.
-         *  m_canvas->SetIgnoreMouseEvents( true );
-         */
-
-        // this menu's handler is void PCB_BASE_FRAME::ProcessItemSelection()
-        // and it calls SetCurItem() which in turn calls DisplayInfo() on the item.
-        m_canvas->SetAbortRequest( true );   // changed in false if an item is selected
-        PopupMenu( &itemMenu );
-
-        m_canvas->MoveCursorToCrossHair();
-
-        // The function ProcessItemSelection() has set the current item, return it.
-        if( m_canvas->GetAbortRequest() )     // Nothing selected
-            item = NULL;
-        else
-            item = GetCurItem();
-    }
-
-    return item;
-}
-
-
-bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
-    // for next cursor position
-    // ( shift or ctrl key down are PAN command with mouse wheel)
-    bool snapToGrid = true;
-
-    if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
-        snapToGrid = false;
-
-    wxPoint oldpos = GetCrossHairPosition();
-    wxPoint pos = aPosition;
-    bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
-
-    // Put cursor in new position, according to the zoom keys (if any).
-    SetCrossHairPosition( pos, snapToGrid );
-
-    /* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
-     * cursor is left off grid this is better to reach items to delete off grid,
-     */
-    if( GetToolId() == ID_PCB_DELETE_ITEM_BUTT )
-        snapToGrid = false;
-
-    wxPoint curs_pos = pos;
-
-    wxRealPoint gridSize = GetScreen()->GetGridSize();
-    wxSize igridsize;
-    igridsize.x = KiROUND( gridSize.x );
-    igridsize.y = KiROUND( gridSize.y );
-
-    if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
-    {
-        SetCrossHairPosition( pos, false );
-    }
-    else
-    {
-        // If there's no intrusion and DRC is active, we pass the cursor
-        // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
-        if( !Settings().m_legacyDrcOn || !g_CurrentTrackSegment ||
-            (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
-            !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
-                              GetScreen()->m_Active_Layer, RefPos( true ) ) )
-        {
-            SetCrossHairPosition( curs_pos, snapToGrid );
-        }
-    }
-
-    RefreshCrossHair( oldpos, aPosition, aDC );
-
-    if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
-    {
-        keyHandled = true;
-    }
-
-    UpdateStatusBar();    // Display new cursor coordinates
-
-    return keyHandled;
-}
diff --git a/pcbnew/drag.h b/pcbnew/drag.h
index e3f4e4464c..b9fced958b 100644
--- a/pcbnew/drag.h
+++ b/pcbnew/drag.h
@@ -172,34 +172,4 @@ void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC );
  */
 void EraseDragList();
 
-/**
- * Function Collect_TrackSegmentsToDrag.
- * used to collect track segments in drag track segment
- * Build the list of tracks connected to the ref point by calling
- * AddSegmentToDragList for each selected track
- * Net codes must be up to date, because only tracks having the right net code are tested.
- *
- * @param aPcb A point the the #BOARD object to collect track segment to drag.
- * @param aRefPos = reference point of connection
- * @param aLayerMask = layers mask to collect tracks
- * @param aNetCode = the net code to consider
- * @param aMaxDist = max distance from aRefPos to a track end candidate to collect the track
- */
-void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LSET aLayerMask,
-                                  int aNetCode, int aMaxDist );
-
-/* Add aTrack to the drag list
- * flag = STARTPOINT (if the point to drag is the start point of Track)
- * or ENDPOINT (if the point to drag is the end point of Track)
- */
-void AddSegmentToDragList( int flag, TRACK* aTrack );
-
-/*
- * Undraw the track segments in list, and set the EDIT flag
- * Usually called after the track list is built, to prepare
- * the redraw of the list when the mouse is moved
- */
-void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC );
-
-
 #endif    // _DRAG_H_
diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp
index 5a5b25d3ba..2c4d53b752 100644
--- a/pcbnew/dragsegm.cpp
+++ b/pcbnew/dragsegm.cpp
@@ -299,108 +299,3 @@ void EraseDragList()
 }
 
 
-void AddSegmentToDragList( int flag, TRACK* aTrack )
-{
-    DRAG_SEGM_PICKER wrapper( aTrack );
-
-    if( flag & STARTPOINT )
-    {
-        wrapper.m_TempFlags |= STARTPOINT;
-        aTrack->SetFlags( STARTPOINT );
-    }
-
-    if( flag & ENDPOINT )
-    {
-        wrapper.m_TempFlags |= ENDPOINT;
-        aTrack->SetFlags( ENDPOINT );
-    }
-
-    g_DragSegmentList.push_back( wrapper );
-}
-
-
-void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LSET aLayerMask,
-                                  int aNetCode, int aMaxDist )
-{
-    TRACK* track = aPcb->m_Track->GetStartNetCode( aNetCode );
-
-    for( ; track; track = track->Next() )
-    {
-        if( track->GetNetCode() != aNetCode )   // not the same netcode: all candidates tested
-            break;
-
-        if( !( aLayerMask & track->GetLayerSet() ).any() )
-            continue;                       // Cannot be connected, not on the same layer
-
-        if( track->IsDragging() )
-            continue;                       // already put in list
-
-        STATUS_FLAGS flag = 0;
-        int maxdist = std::max( aMaxDist, track->GetWidth() / 2 );
-
-        if( (track->GetFlags() & STARTPOINT) == 0 )
-        {
-            wxPoint delta = track->GetStart() - aRefPos;
-
-            if( std::abs( delta.x ) <= maxdist && std::abs( delta.y ) <= maxdist )
-            {
-                int dist = KiROUND( EuclideanNorm( delta ) );
-
-                if( dist <= maxdist )
-                {
-                    flag |= STARTPOINT;
-
-                    if( track->Type() == PCB_VIA_T )
-                        flag |= ENDPOINT;
-                }
-            }
-        }
-
-        if( (track->GetFlags() & ENDPOINT) == 0 )
-        {
-            wxPoint delta = track->GetEnd() - aRefPos;
-
-            if( std::abs( delta.x ) <= maxdist && std::abs( delta.y ) <= maxdist )
-            {
-                int dist = KiROUND( EuclideanNorm( delta ) );
-
-                if( dist <= maxdist )
-                    flag |= ENDPOINT;
-            }
-        }
-
-        // Note: vias will be flagged with both STARTPOINT and ENDPOINT
-        // and must not be entered twice.
-        if( flag )
-        {
-            AddSegmentToDragList( flag, track );
-
-            // If a connected via is found at location aRefPos,
-            // collect also tracks connected by this via.
-            if( track->Type() == PCB_VIA_T )
-                Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->GetLayerSet(),
-                                             aNetCode, track->GetWidth() / 2 );
-        }
-    }
-}
-
-
-void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
-{
-    for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-    {
-        TRACK* track = g_DragSegmentList[ii].m_Track;
-
-        track->Draw( aCanvas, aDC, GR_XOR );
-        track->SetState( IN_EDIT, false );
-        track->SetFlags( IS_DRAGGED );
-
-        if( g_DragSegmentList[ii].m_TempFlags & STARTPOINT )
-            track->SetFlags( STARTPOINT );
-
-        if( g_DragSegmentList[ii].m_TempFlags & ENDPOINT )
-            track->SetFlags( ENDPOINT );
-
-        track->Draw( aCanvas, aDC, GR_XOR );
-    }
-}
diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp
deleted file mode 100644
index d244aa3bfb..0000000000
--- a/pcbnew/edgemod.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
- * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file edgemod.cpp:
- * @brief Functions to edit graphic items used to draw footprint edges.
- *
- * @todo - Arc functions not compete but menus are ready to use.
- */
-
-#include <fctsys.h>
-#include <trigo.h>
-#include <gr_basic.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-#include <pcb_edit_frame.h>
-#include <base_units.h>
-#include <dialog_text_entry.h>
-
-#include <footprint_edit_frame.h>
-#include <class_board.h>
-#include <class_module.h>
-#include <class_edge_mod.h>
-
-#include <pcbnew.h>
-
-
-static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                               bool erase );
-static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
-static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                                           const wxPoint& aPosition, bool aErase );
-
-static double  ArcValue = 900;
-static wxPoint MoveVector;              // Move vector for move edge
-static wxPoint CursorInitialPosition;   // Mouse cursor initial position for move command
-
-
-void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC )
-{
-    if( aEdge == NULL )
-        return;
-
-    aEdge->Draw( m_canvas, DC, GR_XOR );
-    aEdge->SetFlags( IS_MOVED );
-    MoveVector.x   = MoveVector.y = 0;
-    CursorInitialPosition    = GetCrossHairPosition();
-    m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
-    SetCurItem( aEdge );
-    m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* aEdge )
-{
-    if( aEdge == NULL )
-        return;
-
-    aEdge->Move( -MoveVector );
-
-    aEdge->ClearFlags();
-    m_canvas->SetMouseCapture( NULL, NULL );
-    SetCurItem( NULL );
-    OnModify();
-
-    MODULE* module = (MODULE*) aEdge->GetParent();
-    module->CalculateBoundingBox();
-
-    m_canvas->Refresh( );
-}
-
-
-/* Redraw the current moved graphic item when mouse is moving
- * Use this function to show an existing outline, in move command
-*/
-static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                                           const wxPoint& aPosition, bool aErase )
-{
-    BASE_SCREEN* screen = aPanel->GetScreen();
-    EDGE_MODULE* edge   = (EDGE_MODULE*) screen->GetCurItem();
-
-    if( edge == NULL )
-        return;
-
-    MODULE* module = (MODULE*) edge->GetParent();
-
-    if( aErase )
-    {
-        edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
-    }
-
-    MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);
-
-    edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
-
-    module->CalculateBoundingBox();
-}
-
-
-/* Redraw the current graphic item during its creation
- * Use this function to show a new outline, in begin command
- */
-static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                               bool aErase )
-{
-    BASE_SCREEN* screen = aPanel->GetScreen();
-    EDGE_MODULE* edge   = (EDGE_MODULE*) screen->GetCurItem();
-
-    if( edge == NULL )
-        return;
-
-    MODULE* module = (MODULE*) edge->GetParent();
-
-    //  if( erase )
-    {
-        edge->Draw( aPanel, aDC, GR_XOR );
-    }
-
-    edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
-
-    // Update relative coordinate.
-    edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
-
-    wxPoint pt( edge->GetEnd0() );
-
-    RotatePoint( &pt, -module->GetOrientation() );
-
-    edge->SetEnd0( pt );
-
-    edge->Draw( aPanel, aDC, GR_XOR );
-
-    module->CalculateBoundingBox();
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
-{
-    MODULE* module = GetBoard()->m_Modules;
-
-    SaveCopyInUndoList( module, UR_CHANGED );
-
-    if( aEdge == NULL )
-    {
-        for( BOARD_ITEM *item = module->GraphicalItemsList(); item; item = item->Next() )
-        {
-            aEdge = dyn_cast<EDGE_MODULE*>( item );
-
-            if( aEdge )
-                aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
-        }
-    }
-    else
-    {
-        aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
-    }
-
-    OnModify();
-    module->CalculateBoundingBox();
-    module->SetLastEditTime();
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
-{
-    // note: if aEdge == NULL, all outline segments will be modified
-
-    MODULE*     module = GetBoard()->m_Modules;
-    PCB_LAYER_ID    layer = F_SilkS;
-    bool        modified = false;
-
-    if( aEdge )
-        layer = aEdge->GetLayer();
-
-    // Ask for the new layer
-    PCB_LAYER_ID new_layer = SelectLayer( layer, Edge_Cuts );
-
-    if( layer < 0 )
-        return;
-
-    if( IsCopperLayer( new_layer ) )
-    {
-        // an edge is put on a copper layer, and it is very dangerous.
-        // A confirmation is requested
-        if( !IsOK( this,
-                   _( "The graphic item will be on a copper layer.\n"
-                      "This is very dangerous. Are you sure?" ) ) )
-            return;
-    }
-
-    if( !aEdge )
-    {
-        for( BOARD_ITEM *item = module->GraphicalItemsList() ; item != NULL;
-                item = item->Next() )
-        {
-            aEdge = dyn_cast<EDGE_MODULE*>( item );
-
-            if( aEdge && (aEdge->GetLayer() != new_layer) )
-            {
-                if( ! modified )    // save only once
-                    SaveCopyInUndoList( module, UR_CHANGED );
-                aEdge->SetLayer( new_layer );
-                modified = true;
-            }
-        }
-    }
-    else if( aEdge->GetLayer() != new_layer )
-    {
-        SaveCopyInUndoList( module, UR_CHANGED );
-        aEdge->SetLayer( new_layer );
-        modified = true;
-    }
-
-    if( modified )
-    {
-        module->CalculateBoundingBox();
-        module->SetLastEditTime();
-    }
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* aEdge )
-{
-    if( aEdge == NULL )
-        return;
-
-    if( aEdge->Type() != PCB_MODULE_EDGE_T )
-    {
-        wxLogDebug( wxT( "StructType error: PCB_MODULE_EDGE_T expected" ) );
-        return;
-    }
-
-    MODULE* module = (MODULE*) aEdge->GetParent();
-
-    // Delete segment.
-    aEdge->DeleteStructure();
-    module->SetLastEditTime();
-    module->CalculateBoundingBox();
-    OnModify();
-}
-
-
-/* abort function in moving outline.
- */
-static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
-    EDGE_MODULE* edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
-
-    Panel->SetMouseCapture( NULL, NULL );
-
-    if( edge && ( edge->Type() == PCB_MODULE_EDGE_T ) )
-    {
-        if( edge->IsNew() )   // On aborting, delete new outline.
-        {
-            MODULE* module = (MODULE*) edge->GetParent();
-            edge->Draw( Panel, DC, GR_XOR, MoveVector );
-            edge->DeleteStructure();
-            module->CalculateBoundingBox();
-        }
-        else   // On aborting, move existing outline to its initial position.
-        {
-            edge->Draw( Panel, DC, GR_XOR, MoveVector );
-            edge->ClearFlags();
-            edge->Draw( Panel, DC, GR_OR );
-        }
-    }
-
-    Panel->GetScreen()->SetCurItem( NULL );
-}
-
-
-EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
-                                                      wxDC*        DC,
-                                                      STROKE_T     type_edge )
-{
-    MODULE* module = GetBoard()->m_Modules;
-
-    if( module == NULL )
-        return NULL;
-
-    if( aEdge == NULL )       // Start a new edge item
-    {
-        SaveCopyInUndoList( module, UR_CHANGED );
-
-        aEdge = new EDGE_MODULE( module );
-        MoveVector.x = MoveVector.y = 0;
-
-        // Add the new item to the Drawings list head
-        module->GraphicalItemsList().PushFront( aEdge );
-
-        // Update characteristics of the segment or arc.
-        aEdge->SetFlags( IS_NEW );
-        aEdge->SetAngle( 0 );
-        aEdge->SetShape( type_edge );
-
-        if( aEdge->GetShape() == S_ARC )
-            aEdge->SetAngle( ArcValue );
-
-        aEdge->SetWidth( GetDesignSettings().GetLineThickness( GetActiveLayer() ) );
-        aEdge->SetLayer( GetActiveLayer() );
-
-        // Initialize the starting point of the new segment or arc
-        aEdge->SetStart( GetCrossHairPosition() );
-
-        // Initialize the ending point of the new segment or arc
-        aEdge->SetEnd( aEdge->GetStart() );
-
-        // Initialize the relative coordinates
-        aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
-
-        RotatePoint( &aEdge->m_Start0, -module->GetOrientation() );
-
-        aEdge->m_End0 = aEdge->m_Start0;
-        module->CalculateBoundingBox();
-        m_canvas->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline );
-    }
-    /* Segment creation in progress.
-     * The ending coordinate is updated by the function
-     * ShowNewEdgeModule() called on move mouse event
-     * during the segment creation
-     */
-    else
-    {
-        if( type_edge == S_SEGMENT )
-        {
-            if( aEdge->m_Start0 != aEdge->m_End0 )
-            {
-                aEdge->Draw( m_canvas, DC, GR_OR );
-
-                EDGE_MODULE* newedge = new EDGE_MODULE( *aEdge );
-
-                // insert _after_ aEdge, which is the same as inserting before aEdge->Next()
-                module->GraphicalItemsList().Insert( newedge, aEdge->Next() );
-                aEdge->ClearFlags();
-
-                aEdge = newedge;     // point now new item
-
-                aEdge->SetFlags( IS_NEW );
-                aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
-                aEdge->SetStart( GetCrossHairPosition() );
-                aEdge->SetEnd( aEdge->GetStart() );
-
-                // Update relative coordinate.
-                aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
-
-                wxPoint pt( aEdge->GetStart0() );
-
-                RotatePoint( &pt, -module->GetOrientation() );
-
-                aEdge->SetStart0( pt );
-
-                aEdge->SetEnd0( aEdge->GetStart0() );
-
-                module->CalculateBoundingBox();
-                module->SetLastEditTime();
-                OnModify();
-            }
-        }
-        else
-        {
-            wxLogDebug( wxT( "Begin_Edge() error" ) );
-        }
-    }
-
-    return aEdge;
-}
-
-
-void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* aEdge )
-{
-    MODULE* module = GetBoard()->m_Modules;
-
-    if( aEdge )
-    {
-        aEdge->ClearFlags();
-
-        // If last segment length is 0: remove it
-        if( aEdge->GetStart() == aEdge->GetEnd() )
-            aEdge->DeleteStructure();
-    }
-
-    module->CalculateBoundingBox();
-    module->SetLastEditTime();
-    OnModify();
-    m_canvas->SetMouseCapture( NULL, NULL );
-}
diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp
index fdf79ff3e1..cd8e87f96a 100644
--- a/pcbnew/edit.cpp
+++ b/pcbnew/edit.cpp
@@ -48,6 +48,8 @@
 #include <class_track.h>
 #include <class_zone.h>
 #include <class_pcb_text.h>
+#include <class_pcb_target.h>
+#include <class_dimension.h>
 #include <footprint_viewer_frame.h>
 #include <pcb_layer_box_selector.h>
 #include <dialog_drc.h>
@@ -79,16 +81,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
     case wxID_COPY:
     case ID_TOOLBARH_PCB_SELECT_LAYER:
     case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
-    case ID_POPUP_PCB_PLACE_THROUGH_VIA:
-    case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
-    case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
-    case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
-    case ID_POPUP_PCB_PLACE_MICROVIA:
-    case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
-    case ID_POPUP_PCB_FILL_ALL_ZONES:
-    case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES:
-    case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
-    case ID_POPUP_PCB_FILL_ZONE:
         break;
 
     default:        // Finish (abort) the command
@@ -179,137 +171,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
         InstallNetlistFrame( &dc );
         break;
 
-    case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
-        /* change the position of initial segment when creating new tracks
-         * switch from _/  to -\ .
-         * If a track is in progress, it will be redrawn
-        */
-        if( m_canvas->IsMouseCaptured() )
-            m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
-
-        g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
-
-        if( m_canvas->IsMouseCaptured() )
-            m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
-
-        break;
-
-    case ID_POPUP_PCB_PLACE_MICROVIA:
-        if( !IsMicroViaAcceptable() )
-            break;
-        // fall through
-    case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
-    case ID_POPUP_PCB_PLACE_THROUGH_VIA:
-    case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
-    case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
-        m_canvas->MoveCursorToCrossHair();
-
-        if( GetCurItem()->IsDragging() )
-        {
-            // JEY TODO: reachable?
-            PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
-        }
-        else
-        {
-            BOARD_DESIGN_SETTINGS &settings = GetDesignSettings();
-            VIATYPE_T v_type = settings.m_CurrentViaType;
-            switch( id )
-            {
-            case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
-            case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
-                settings.m_CurrentViaType = VIA_BLIND_BURIED;
-                break;
-
-            case ID_POPUP_PCB_PLACE_MICROVIA:
-                settings.m_CurrentViaType = VIA_MICROVIA;
-                break;
-
-            default:
-                settings.m_CurrentViaType = VIA_THROUGH;
-                break;
-            }
-
-            // place via and switch layer.
-            if( id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA ||
-                id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA )
-            {
-                m_canvas->SetIgnoreMouseEvents( true );
-
-                wxPoint dlgPosition;
-
-                wxGetMousePosition( &dlgPosition.x, &dlgPosition.y );
-
-                PCB_LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition );
-
-                m_canvas->SetIgnoreMouseEvents( false );
-                m_canvas->MoveCursorToCrossHair();
-
-                if( GetActiveLayer() != layer )
-                {
-                    GetScreen()->m_Route_Layer_TOP    = GetActiveLayer();
-                    GetScreen()->m_Route_Layer_BOTTOM = layer;
-                    Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
-                }
-            }
-
-            else
-                Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
-
-            settings.m_CurrentViaType = v_type;
-
-            if( displ_opts->m_ContrastModeDisplay )
-                m_canvas->Refresh();
-        }
-        break;
-
-    case ID_POPUP_PCB_FILL_ALL_ZONES:
-        m_canvas->MoveCursorToCrossHair();
-        Fill_All_Zones();
-        m_canvas->Refresh();
-        SetMsgPanel( GetBoard() );
-        break;
-
-    case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
-        if( ( GetCurItem() )->Type() == PCB_ZONE_AREA_T )
-        {
-            ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
-            zone_container->UnFill();
-            GetBoard()->GetConnectivity()->Update( zone_container );
-            OnModify();
-            SetMsgPanel( GetBoard() );
-            m_canvas->Refresh();
-        }
-
-        Compile_Ratsnest( &dc, false );
-        SetCurItem( NULL );
-        break;
-
-    case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
-        for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
-        {
-            // Remove filled areas in zone
-            ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
-            zone_container->UnFill();
-            GetBoard()->GetConnectivity()->Update( zone_container );
-        }
-
-        Compile_Ratsnest( &dc, false );
-        SetCurItem( NULL );        // CurItem might be deleted by this command, clear the pointer
-        OnModify();
-        SetMsgPanel( GetBoard() );
-        m_canvas->Refresh();
-        break;
-
-    case ID_POPUP_PCB_FILL_ZONE:
-    {
-        m_canvas->MoveCursorToCrossHair();
-        ZONE_FILLER filler( GetBoard() );
-        filler.Fill( { (ZONE_CONTAINER*) GetCurItem() } );
-        SetMsgPanel( GetBoard() );
-        m_canvas->Refresh();
-        break;
-    }
-
     case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
         SelectCopperLayerPair();
         break;
@@ -321,14 +182,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
             m_canvas->Refresh( true );
         break;
 
-    case ID_POPUP_PCB_MOVE_EXACT:
-        moveExact();
-        break;
-
-    case ID_POPUP_PCB_CREATE_ARRAY:
-        createArray();
-        break;
-
     case ID_MENU_PCB_CLEAN:
         Clean_Pcb();
         break;
@@ -369,75 +222,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
 }
 
 
-void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
-{
-    if( Item == NULL )
-        return;
-
-    switch( Item->Type() )
-    {
-    case PCB_MODULE_T:
-        Delete_Module( (MODULE*) Item, DC );
-        break;
-
-    case PCB_DIMENSION_T:
-        DeleteDimension( (DIMENSION*) Item, DC );
-        break;
-
-    case PCB_TARGET_T:
-        DeleteTarget( (PCB_TARGET*) Item, DC );
-        break;
-
-    case PCB_LINE_T:
-        Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
-        break;
-
-    case PCB_TEXT_T:
-        Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
-        break;
-
-    case PCB_TRACE_T:
-        Delete_Track( DC, (TRACK*) Item );
-        break;
-
-    case PCB_VIA_T:
-        Delete_Segment( DC, (TRACK*) Item );
-        break;
-
-    case PCB_ZONE_AREA_T:
-        {
-            SetCurItem( NULL );
-            int netcode = ( (ZONE_CONTAINER*) Item )->GetNetCode();
-            Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
-            TestNetConnection( NULL, netcode );
-            SetMsgPanel( GetBoard() );
-        }
-        break;
-
-    case PCB_MARKER_T:
-        if( Item == GetCurItem() )
-            SetCurItem( NULL );
-
-        ( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR );
-
-        // delete the marker, and free memory.  Don't use undo stack.
-        GetBoard()->Delete( Item );
-        break;
-
-    case PCB_PAD_T:
-    case PCB_MODULE_TEXT_T:
-    case PCB_MODULE_EDGE_T:
-        break;
-
-    case TYPE_NOT_INIT:
-    case PCB_T:
-    default:
-        wxLogDebug( wxT( "Remove: item type %d unknown." ), Item->Type() );
-        break;
-    }
-}
-
-
 void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
 {
     PCB_LAYER_ID curLayer = GetActiveLayer();
@@ -719,3 +503,61 @@ void PCB_BASE_EDIT_FRAME::createArray()
 
     array_creator.Invoke();
 }
+
+
+void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
+{
+    switch( aItem->Type() )
+    {
+    case PCB_TRACE_T:
+    case PCB_VIA_T:
+        Edit_TrackSegm_Width( aDC, static_cast<TRACK*>( aItem ) );
+        break;
+
+    case PCB_TEXT_T:
+        InstallTextOptionsFrame( aItem, aDC );
+        break;
+
+    case PCB_PAD_T:
+        InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
+        break;
+
+    case PCB_MODULE_T:
+        InstallFootprintPropertiesDialog( static_cast<MODULE*>( aItem ), aDC );
+        break;
+
+    case PCB_TARGET_T:
+        ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ), aDC );
+        break;
+
+    case PCB_DIMENSION_T:
+        ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ), aDC );
+        break;
+
+    case PCB_MODULE_TEXT_T:
+        InstallTextOptionsFrame( aItem, aDC );
+        break;
+
+    case PCB_LINE_T:
+        InstallGraphicItemPropertiesDialog( aItem );
+        break;
+
+    case PCB_ZONE_AREA_T:
+        Edit_Zone_Params( aDC, static_cast<ZONE_CONTAINER*>( aItem ) );
+        break;
+
+    default:
+        break;
+    }
+}
+
+
+void PCB_EDIT_FRAME::HighLight( wxDC* DC )
+{
+    if( GetBoard()->IsHighLightNetON() )
+        GetBoard()->HighLightOFF();
+    else
+        GetBoard()->HighLightON();
+
+    GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() );
+}
diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp
deleted file mode 100644
index 4f9ac7ba4d..0000000000
--- a/pcbnew/edit_pcb_text.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file edit_pcb_text.cpp
- * @brief Editing of text on copper and technical layers (TEXTE_PCB class)
- */
-
-#include <fctsys.h>
-#include <gr_basic.h>
-#include <class_drawpanel.h>
-#include <pcbnew.h>
-#include <pcb_edit_frame.h>
-#include <macros.h>
-
-#include <class_board.h>
-#include <class_pcb_text.h>
-#include <class_board_item.h>
-
-
-static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                            bool aErase );
-static void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC );
-
-
-static TEXTE_PCB s_TextCopy( (BOARD_ITEM*) NULL ); // copy of the edited text used to
-                                                   // undo/redo/abort a complex edit command
-
-
-/*
- * Abort current text edit progress.
- * If a text is selected, its initial coord are regenerated
- */
-void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
-    TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
-    ( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
-
-    Panel->SetMouseCapture( NULL, NULL );
-
-    if( TextePcb == NULL )  // Should not occur
-        return;
-
-#ifndef USE_WX_OVERLAY
-    TextePcb->Draw( Panel, DC, GR_XOR );
-#endif
-
-    if( TextePcb->IsNew() )  // If new: remove it
-    {
-        TextePcb->DeleteStructure();
-        return;
-    }
-
-
-    TextePcb->SwapData( &s_TextCopy );
-    TextePcb->ClearFlags();
-#ifndef USE_WX_OVERLAY
-    TextePcb->Draw( Panel, DC, GR_OR );
-#else
-    Panel->Refresh();
-#endif
-}
-
-
-/*
- *  Place the current text being moving
- */
-void PCB_EDIT_FRAME::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
-{
-    m_canvas->SetMouseCapture( NULL, NULL );
-    SetCurItem( NULL );
-
-    if( TextePcb == NULL )
-        return;
-
-    TextePcb->Draw( m_canvas, DC, GR_OR );
-    OnModify();
-
-    if( TextePcb->IsNew() )  // If new: prepare undo command
-    {
-        SaveCopyInUndoList( TextePcb, UR_NEW );
-        TextePcb->ClearFlags();
-        return;
-    }
-
-    if( TextePcb->IsMoving() ) // If moved only
-    {
-        SaveCopyInUndoList( TextePcb, UR_MOVED,
-                            TextePcb->GetTextPos() - s_TextCopy.GetTextPos() );
-    }
-    else
-    {
-        // Restore initial params
-        TextePcb->SwapData( &s_TextCopy );
-        // Prepare undo command
-        SaveCopyInUndoList( TextePcb, UR_CHANGED );
-        // Restore current params
-        TextePcb->SwapData( &s_TextCopy );
-    }
-
-    TextePcb->ClearFlags();
-#ifdef USE_WX_OVERLAY
-    m_canvas->Refresh();
-#endif
-}
-
-
-void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aErase )
-{
-    if( aTextePcb == NULL )
-        return;
-
-    // if it is an existing item: prepare a copy to undo/abort command
-    if( !aTextePcb->IsNew() )
-        s_TextCopy = *aTextePcb;
-
-    aTextePcb->SetFlags( IS_MOVED );
-    SetMsgPanel( aTextePcb );
-
-#ifdef USE_WX_OVERLAY
-    m_canvas->Refresh();
-#endif
-
-    SetCrossHairPosition( aTextePcb->GetTextPos() );
-    m_canvas->MoveCursorToCrossHair();
-
-    m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
-    SetCurItem( aTextePcb );
-    m_canvas->CallMouseCapture( aDC, wxDefaultPosition, aErase );
-}
-
-
-// Move  PCB text following the cursor.
-static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                            bool aErase )
-{
-    TEXTE_PCB* TextePcb = (TEXTE_PCB*) aPanel->GetScreen()->GetCurItem();
-
-    if( TextePcb == NULL )
-        return;
-
-    if( aErase )
-        TextePcb->Draw( aPanel, aDC, GR_XOR );
-
-    TextePcb->SetTextPos( aPanel->GetParent()->GetCrossHairPosition() );
-
-    TextePcb->Draw( aPanel, aDC, GR_XOR );
-}
-
-
-void PCB_EDIT_FRAME::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
-{
-    if( TextePcb == NULL )
-        return;
-
-    TextePcb->Draw( m_canvas, DC, GR_XOR );
-
-    SaveCopyInUndoList( TextePcb, UR_DELETED );
-    TextePcb->UnLink();
-    m_canvas->SetMouseCapture( NULL, NULL );
-    SetCurItem( NULL );
-}
-
-
-TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
-{
-    TEXTE_PCB* textePcb = new TEXTE_PCB( GetBoard() );
-
-    if( aText )
-    {
-        *textePcb = *aText;
-        GetBoard()->Add( textePcb );
-        textePcb->SetFlags( IS_NEW );
-        if( aDC )
-            StartMoveTextePcb( textePcb, aDC, false ); // Don't erase aText when copying
-    }
-    else
-    {
-        GetBoard()->Add( textePcb );
-        textePcb->SetFlags( IS_NEW );
-
-        PCB_LAYER_ID layer = GetActiveLayer();
-
-        textePcb->SetLayer( layer );
-
-        // Set the mirrored option for layers on the BACK side of the board
-        if( layer == B_Cu || layer == B_SilkS ||
-            layer == B_Paste || layer == B_Mask ||
-            layer == B_Adhes
-            )
-            textePcb->SetMirrored( true );
-
-        textePcb->SetTextSize( GetBoard()->GetDesignSettings().GetTextSize( layer ) );
-        textePcb->SetTextPos( GetCrossHairPosition() );
-        textePcb->SetThickness( GetBoard()->GetDesignSettings().GetTextThickness( layer ) );
-        textePcb->SetItalic( GetBoard()->GetDesignSettings().GetTextItalic( layer ) );
-
-        InstallTextOptionsFrame( textePcb, aDC );
-
-        if( textePcb->GetText().IsEmpty() )
-        {
-            textePcb->DeleteStructure();
-            textePcb = NULL;
-        }
-        else if( aDC )
-        {
-            StartMoveTextePcb( textePcb, aDC );
-        }
-    }
-
-    return textePcb;
-}
-
-
-void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
-{
-    if( TextePcb == NULL )
-        return;
-
-    // Erase previous text:
-    TextePcb->Draw( m_canvas, DC, GR_XOR );
-
-    TextePcb->SetTextAngle( TextePcb->GetTextAngle() + 900 );
-
-    // Redraw text in new position:
-    TextePcb->Draw( m_canvas, DC, GR_XOR );
-    SetMsgPanel( TextePcb );
-
-    if( TextePcb->GetEditFlags() == 0 )    // i.e. not edited, or moved
-        SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetTextPos() );
-    else                 // set flag edit, to show it was a complex command
-        TextePcb->SetFlags( IN_EDIT );
-
-    OnModify();
-#ifdef USE_WX_OVERLAY
-    m_canvas->Refresh();
-#endif
-}
-
-
-void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC )
-{
-    if( aTextePcb == NULL )
-        return;
-
-    aTextePcb->Draw( m_canvas, aDC, GR_XOR );
-
-    aTextePcb->Flip( aTextePcb->GetTextPos() );
-
-    aTextePcb->Draw( m_canvas, aDC, GR_XOR );
-    SetMsgPanel( aTextePcb );
-
-    if( aTextePcb->GetEditFlags() == 0 )    // i.e. not edited, or moved
-        SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetTextPos() );
-    else                 // set edit flag, for the current command
-        aTextePcb->SetFlags( IN_EDIT );
-
-    OnModify();
-#ifdef USE_WX_OVERLAY
-    m_canvas->Refresh();
-#endif
-}
diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp
deleted file mode 100644
index 7ed568e02e..0000000000
--- a/pcbnew/editedge.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file editedge.cpp
- * @brief Edit segments and edges of PCB.
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-#include <pcb_edit_frame.h>
-#include <gr_basic.h>
-
-#include <pcbnew.h>
-#include <protos.h>
-#include <macros.h>
-
-#include <class_board.h>
-#include <class_drawsegment.h>
-
-
-static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC );
-static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
-static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                          bool aErase );
-
-
-static wxPoint s_InitialPosition;  // Initial cursor position.
-static wxPoint s_LastPosition;     // Current cursor position.
-
-
-// Start move of a graphic element type DRAWSEGMENT
-void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
-{
-    if( drawitem == NULL )
-        return;
-
-    drawitem->Draw( m_canvas, DC, GR_XOR );
-    drawitem->SetFlags( IS_MOVED );
-    s_InitialPosition = s_LastPosition = GetCrossHairPosition();
-    SetMsgPanel( drawitem );
-    m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge );
-    SetCurItem( drawitem );
-    m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
-}
-
-
-/*
- * Place graphic element of type DRAWSEGMENT.
- */
-void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
-{
-    if( drawitem == NULL )
-        return;
-
-    drawitem->ClearFlags();
-    SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition);
-    drawitem->Draw( m_canvas, DC, GR_OR );
-    m_canvas->SetMouseCapture( NULL, NULL );
-    SetCurItem( NULL );
-    OnModify();
-}
-
-/*
- * Redraw segment during cursor movement.
- */
-static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                          bool aErase )
-{
-    DRAWSEGMENT* segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
-
-    if( segment == NULL )
-        return;
-
-    if( aErase )
-        segment->Draw( aPanel, aDC, GR_XOR );
-
-    wxPoint delta;
-    delta = aPanel->GetParent()->GetCrossHairPosition() - s_LastPosition;
-
-    segment->Move( delta );
-
-    s_LastPosition = aPanel->GetParent()->GetCrossHairPosition();
-
-    segment->Draw( aPanel, aDC, GR_XOR );
-}
-
-
-void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
-{
-    auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
-    bool tmp = displ_opts->m_DisplayDrawItemsFill;
-
-    if( Segment == NULL )
-        return;
-
-    if( Segment->IsNew() )  // Trace in progress.
-    {
-        // Delete current segment.
-        displ_opts->m_DisplayDrawItemsFill = SKETCH;
-        Segment->Draw( m_canvas, DC, GR_XOR );
-        Segment->DeleteStructure();
-        displ_opts->m_DisplayDrawItemsFill = tmp;
-        SetCurItem( NULL );
-    }
-    else if( Segment->GetEditFlags() == 0 )    // i.e. not edited, or moved
-    {
-        Segment->Draw( m_canvas, DC, GR_XOR );
-        Segment->ClearFlags();
-        SaveCopyInUndoList(Segment, UR_DELETED);
-        Segment->UnLink();
-        SetCurItem( NULL );
-        OnModify();
-    }
-}
-
-
-static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC )
-{
-    DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
-
-    if( Segment == NULL )
-    {
-        aPanel->SetMouseCapture( NULL, NULL );
-        return;
-    }
-
-    if( Segment->IsNew() )
-    {
-        aPanel->CallMouseCapture( DC, wxDefaultPosition, false );
-        Segment ->DeleteStructure();
-        Segment = NULL;
-    }
-    else
-    {
-        wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
-        aPanel->GetParent()->SetCrossHairPosition( s_InitialPosition );
-        aPanel->CallMouseCapture( DC, wxDefaultPosition, true );
-        aPanel->GetParent()->SetCrossHairPosition( pos );
-        Segment->ClearFlags();
-        Segment->Draw( aPanel, DC, GR_OR );
-    }
-
-#ifdef USE_WX_OVERLAY
-    aPanel->Refresh();
-#endif
-
-    aPanel->SetMouseCapture( NULL, NULL );
-    ( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL );
-}
-
-
-/* Initialize the drawing of a segment of type other than trace.
- */
-DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC )
-{
-    int          lineWidth;
-    DRAWSEGMENT* DrawItem;
-
-    lineWidth = GetDesignSettings().GetLineThickness( GetActiveLayer() );
-
-    if( Segment == NULL )        // Create new segment.
-    {
-        SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
-        Segment->SetFlags( IS_NEW );
-        Segment->SetLayer( GetActiveLayer() );
-        Segment->SetWidth( lineWidth );
-        Segment->SetShape( shape );
-        Segment->SetAngle( 900 );
-        Segment->SetStart( GetCrossHairPosition() );
-        Segment->SetEnd( GetCrossHairPosition() );
-        m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
-    }
-    else
-    {
-        // The ending point coordinate Segment->m_End was updated by the function
-        // DrawSegment() called on a move mouse event during the segment creation
-        if( Segment->GetStart() != Segment->GetEnd() )
-        {
-            if( Segment->GetShape() == S_SEGMENT )
-            {
-                SaveCopyInUndoList( Segment, UR_NEW );
-                GetBoard()->Add( Segment );
-
-                OnModify();
-                Segment->ClearFlags();
-
-                Segment->Draw( m_canvas, DC, GR_OR );
-
-                DrawItem = Segment;
-
-                SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
-
-                Segment->SetFlags( IS_NEW );
-                Segment->SetLayer( DrawItem->GetLayer() );
-                Segment->SetWidth( lineWidth );
-                Segment->SetShape( DrawItem->GetShape() );
-                Segment->SetType( DrawItem->GetType() );
-                Segment->SetAngle( DrawItem->GetAngle() );
-                Segment->SetStart( DrawItem->GetEnd() );
-                Segment->SetEnd( DrawItem->GetEnd() );
-                DrawSegment( m_canvas, DC, wxDefaultPosition, false );
-            }
-            else
-            {
-                End_Edge( Segment, DC );
-                Segment = NULL;
-            }
-        }
-    }
-
-    return Segment;
-}
-
-
-void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
-{
-    if( Segment == NULL )
-        return;
-
-    Segment->Draw( m_canvas, DC, GR_OR );
-
-    // Delete if segment length is zero.
-    if( Segment->GetStart() == Segment->GetEnd() )
-    {
-        Segment->DeleteStructure();
-    }
-    else
-    {
-        Segment->ClearFlags();
-        GetBoard()->Add( Segment );
-        OnModify();
-        SaveCopyInUndoList( Segment, UR_NEW );
-    }
-
-    m_canvas->SetMouseCapture( NULL, NULL );
-    SetCurItem( NULL );
-}
-
-
-/* Redraw segment during cursor movement
- */
-static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
-{
-    DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
-    auto frame = (PCB_EDIT_FRAME*) ( aPanel->GetParent() );
-    if( Segment == NULL )
-        return;
-
-    auto displ_opts = (PCB_DISPLAY_OPTIONS*) ( aPanel->GetDisplayOptions() );
-    bool tmp = displ_opts->m_DisplayDrawItemsFill;
-
-    displ_opts->m_DisplayDrawItemsFill = SKETCH;
-
-    if( aErase )
-        Segment->Draw( aPanel, aDC, GR_XOR );
-
-    if( frame->Settings().m_use45DegreeGraphicSegments && Segment->GetShape() == S_SEGMENT )
-    {
-        wxPoint pt;
-
-        pt = CalculateSegmentEndPoint( aPanel->GetParent()->GetCrossHairPosition(),
-                                       Segment->GetStart() );
-        Segment->SetEnd( pt );
-    }
-    else    // here the angle is arbitrary
-    {
-        Segment->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
-    }
-
-    Segment->Draw( aPanel, aDC, GR_XOR );
-    displ_opts->m_DisplayDrawItemsFill = tmp;
-}
diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp
index 2e533dbf6f..62d311120c 100644
--- a/pcbnew/editrack.cpp
+++ b/pcbnew/editrack.cpp
@@ -46,9 +46,7 @@
 static void Abort_Create_Track( EDA_DRAW_PANEL* panel, wxDC* DC );
 void        ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
                                           const wxPoint& aPosition, bool aErase );
-static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
-static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
-static void EnsureEndTrackOnPad( D_PAD* Pad );
+static void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end );
 
 // A PICKED_ITEMS_LIST to store tracks  which are modified/added/deleted
 // during a track editing:
@@ -410,126 +408,6 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
 }
 
 
-bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
-{
-    LSET layerMask( GetScreen()->m_Active_Layer );
-
-    if( aTrack == NULL )
-        return false;
-
-    if( Settings().m_legacyDrcOn &&
-        BAD_DRC == m_drc->DrcOnCreatingTrack( g_CurrentTrackSegment, GetBoard()->m_Track ) )
-        return false;
-
-    // Saving the coordinate of end point of the trace
-    wxPoint pos = g_CurrentTrackSegment->GetEnd();
-
-    DBG( g_CurrentTrackList.VerifyListIntegrity(); );
-
-    if( Begin_Route( aTrack, aDC ) == NULL )
-        return false;
-
-    // Update last track position
-    ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, true );
-    // Erase the last drawings
-    ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
-
-    DBG( g_CurrentTrackList.VerifyListIntegrity(); );
-
-    /* The track here is now chained to the list of track segments.
-     * It must be seen in the area of net
-     * As close as possible to the segment base (or end), because
-     * This helps to reduce the computing time */
-
-    // Attaching the end point of the new track to a pad or a track
-    BOARD_CONNECTED_ITEM* lockPoint = GetBoard()->GetLockPoint( pos, layerMask );
-
-    if( lockPoint )
-    {
-        if( lockPoint->Type() ==  PCB_PAD_T )     // End of track is on a pad.
-        {
-            EnsureEndTrackOnPad( (D_PAD*) lockPoint );
-        }
-        else        // If end point of is on a different track,
-                    // creates a lock point if not exists
-        {
-             // Creates a lock point, if not already exists:
-            wxPoint hp = g_CurrentTrackSegment->GetEnd();
-            lockPoint = GetBoard()->CreateLockPoint( hp, (TRACK*) lockPoint, &s_ItemsListPicker );
-            g_CurrentTrackSegment->SetEnd(hp);
-        }
-    }
-
-    // Delete null length segments:
-    DeleteNullTrackSegments( GetBoard(), g_CurrentTrackList );
-
-    // Insert new segments if they exist.
-    // g_FirstTrackSegment can be NULL on a double click on the starting point
-    if( g_FirstTrackSegment != NULL )
-    {
-        int    netcode    = g_FirstTrackSegment->GetNetCode();
-        TRACK* firstTrack = g_FirstTrackSegment;
-        int    newCount   = 0;
-
-        // Put entire new current segment list in BOARD, and prepare undo command
-        TRACK* track;
-        TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() );
-
-        while( ( track = g_CurrentTrackList.PopFront() ) != nullptr )
-        {
-            ITEM_PICKER picker( track, UR_NEW );
-            s_ItemsListPicker.PushItem( picker );
-            GetBoard()->m_Track.Insert( track, insertBeforeMe );
-            GetBoard()->GetConnectivity()->Add( track );
-            track->ClearFlags();
-            track->SetState( BUSY, false );
-            newCount++;
-        }
-
-        // delete the old track, if it exists and is redundant
-        if( Settings().m_legacyAutoDeleteOldTrack )
-        {
-            EraseRedundantTrack( aDC, firstTrack, newCount, &s_ItemsListPicker );
-        }
-
-        SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
-        s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
-
-        // Erase old ratsnest
-        if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
-        {
-            GRSetDrawMode( aDC, GR_XOR );
-            DrawGeneralRatsnest( aDC, 0 );
-        }
-
-        // compute and display the new ratsnest
-        TestNetConnection( aDC, netcode );
-        OnModify();
-        SetMsgPanel( GetBoard() );
-
-        // Redraw the entire new track.
-        DrawTraces( m_canvas, aDC, firstTrack, newCount, GR_OR );
-    }
-
-    wxASSERT( g_FirstTrackSegment == NULL );
-    wxASSERT( g_CurrentTrackSegment == NULL );
-    wxASSERT( g_CurrentTrackList.GetCount() == 0 );
-
-    if( GetBoard()->IsHighLightNetON() )
-        HighLight( aDC );
-
-    GetBoard()->PopHighLight();
-
-    if( GetBoard()->IsHighLightNetON() )
-        GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() );
-
-    m_canvas->SetMouseCapture( NULL, NULL );
-    SetCurItem( NULL );
-
-    return true;
-}
-
-
 TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const wxPoint& aRef )
 {
     int     net   = aTrack->GetNetCode();
@@ -963,111 +841,3 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
 }
 
 
-/* Delete track segments which have len = 0 after creating a new track
- *  return a pointer on the first segment (start of track list)
- */
-void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
-{
-    if( aTrackList.GetCount() == 0 )
-        return;
-
-    TRACK*      track = aTrackList.GetFirst();
-    TRACK*      firsttrack = track;
-    TRACK*      oldtrack;
-
-    BOARD_CONNECTED_ITEM* lockPoint = track->start;
-
-    while( track != NULL )
-    {
-        oldtrack = track;
-        track    = track->Next();
-
-        if( !oldtrack->IsNull() )
-        {
-            continue;
-        }
-
-        // NULL segment, delete it
-        if( firsttrack == oldtrack )
-            firsttrack = track;
-
-        delete aTrackList.Remove( oldtrack );
-    }
-
-    if( aTrackList.GetCount() == 0 )
-        return;         // all the new track segments have been deleted
-
-    // we must set the pointers on connected items and the connection status
-    oldtrack = track = firsttrack;
-    firsttrack->start = NULL;
-
-    while( track != NULL )
-    {
-        oldtrack = track;
-        track    = track->Next();
-        oldtrack->end = track;
-
-        if( track )
-            track->start = oldtrack;
-
-        oldtrack->SetStatus( 0 );
-    }
-
-    firsttrack->start = lockPoint;
-
-    if( lockPoint && lockPoint->Type()==PCB_PAD_T )
-        firsttrack->SetState( BEGIN_ONPAD, true );
-
-    track = firsttrack;
-
-    while( track != NULL )
-    {
-        TRACK* next_track = track->Next();
-        lockPoint = pcb->GetPad( track, ENDPOINT_END );
-
-        if( lockPoint )
-        {
-            track->end = lockPoint;
-            track->SetState( END_ONPAD, true );
-
-            if( next_track )
-            {
-                next_track->start = lockPoint;
-                next_track->SetState( BEGIN_ONPAD, true );
-            }
-        }
-
-        track = next_track;
-    }
-}
-
-
-/* Ensure the end point of g_CurrentTrackSegment is on the pad "Pad"
- *  if no, create a new track segment if necessary
- *  and move current (or new) end segment on pad
- */
-void EnsureEndTrackOnPad( D_PAD* aPad )
-{
-    if( g_CurrentTrackSegment->GetEnd() == aPad->GetPosition() ) // Ok !
-    {
-        g_CurrentTrackSegment->end = aPad;
-        g_CurrentTrackSegment->SetState( END_ONPAD, true );
-        return;
-    }
-
-    TRACK* lasttrack = g_CurrentTrackSegment;
-
-    if( !g_CurrentTrackSegment->IsNull() )
-    {
-        // Must create a new segment, from track end to pad center
-        g_CurrentTrackList.PushBack( (TRACK*)lasttrack->Clone() );
-
-        lasttrack->end = g_CurrentTrackSegment;
-    }
-
-    g_CurrentTrackSegment->SetEnd( aPad->GetPosition() );
-    g_CurrentTrackSegment->SetState( END_ONPAD, false );
-
-    g_CurrentTrackSegment->end = aPad;
-    g_CurrentTrackSegment->SetState( END_ONPAD, true );
-}
diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp
deleted file mode 100644
index f909ad4b2f..0000000000
--- a/pcbnew/edtxtmod.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file edtxtmod.cpp
- * @brief Edit texts in footprints.
- */
-
-#include <fctsys.h>
-#include <gr_basic.h>
-#include <common.h>
-#include <class_drawpanel.h>
-#include <draw_graphic_text.h>
-#include <trigo.h>
-#include <pcb_base_frame.h>
-#include <macros.h>
-
-#include <pcbnew.h>
-#include <pcb_edit_frame.h>
-#include <footprint_edit_frame.h>
-
-#include <class_board.h>
-#include <class_module.h>
-#include <class_text_mod.h>
-#include <class_pcb_text.h>
-
-
-static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                                   bool aErase );
-static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC );
-
-
-wxPoint        MoveVector;              // Move vector for move edge, exported
-                                        // to dialog_edit mod_text.cpp
-static wxPoint TextInitialPosition;     // Mouse cursor initial position for
-                                        // undo/abort move command
-static double  TextInitialOrientation;  // module text initial orientation for
-                                        // undo/abort move+rot command+rot
-
-
-/* Add a new graphical text to the active module (footprint)
- *  Note there always are 2 mandatory texts: reference and value.
- *  New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
- */
-TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC )
-{
-    TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
-
-    text->SetFlags( IS_NEW );
-
-    if( LSET::AllTechMask().test( GetActiveLayer() ) )    // i.e. a possible layer for a text
-        text->SetLayer( GetActiveLayer() );
-
-    InstallTextOptionsFrame( text, NULL );
-
-    if( text->GetText().IsEmpty() )
-    {
-        delete text;
-        return NULL;
-    }
-
-    // Add the new text object to the beginning of the footprint draw list.
-    if( aModule )
-        aModule->GraphicalItemsList().PushFront( text );
-
-    text->ClearFlags();
-
-    if( aDC )
-        text->Draw( m_canvas, aDC, GR_OR );
-
-    SetMsgPanel( text );
-
-    return text;
-}
-
-
-void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
-{
-    if( Text == NULL )
-        return;
-
-    MODULE* module = (MODULE*) Text->GetParent();
-
-    if( module && module->GetEditFlags() == 0 && Text->GetEditFlags() == 0 ) // prepare undo command
-    {
-        if( IsType( FRAME_PCB ) )
-            SaveCopyInUndoList( module, UR_CHANGED );
-    }
-
-    // we expect MoveVector to be (0,0) if there is no move in progress
-    Text->Draw( m_canvas, DC, GR_XOR, MoveVector );
-
-    Text->SetTextAngle( Text->GetTextAngle() + 900 );
-
-    Text->Draw( m_canvas, DC, GR_XOR, MoveVector );
-    SetMsgPanel( Text );
-
-    if( module )
-        module->SetLastEditTime();
-
-    OnModify();
-}
-
-
-void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* aText )
-{
-    MODULE* module;
-
-    if( aText == NULL )
-        return;
-
-    module = static_cast<MODULE*>( aText->GetParent() );
-
-    if( aText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
-    {
-        if( module && module->GetEditFlags() == 0 && aText->GetEditFlags() == 0 )
-        {
-            if( IsType( FRAME_PCB ) )
-                SaveCopyInUndoList( module, UR_CHANGED );
-        }
-
-        m_canvas->RefreshDrawingRect( aText->GetBoundingBox() );
-        aText->DeleteStructure();
-        OnModify();
-
-        if( module )
-            module->SetLastEditTime();
-    }
-}
-
-
-/**
- * Abort text move in progress.
- *
- * If a text is selected, its initial coordinates are regenerated.
- */
-static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
-    BASE_SCREEN*  screen = Panel->GetScreen();
-    TEXTE_MODULE* Text   = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
-    MODULE*       Module;
-
-    Panel->SetMouseCapture( NULL, NULL );
-
-    if( Text == NULL )
-        return;
-
-    Module = static_cast<MODULE*>( Text->GetParent() );
-
-    Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector );
-    Text->Draw( Panel, DC, GR_XOR, MoveVector );
-
-    // If the text was moved (the move does not change internal data)
-    // it could be rotated while moving. So set old value for orientation
-    if( Text->IsMoving() )
-        Text->SetTextAngle( TextInitialOrientation );
-
-    // Redraw the text
-    Panel->RefreshDrawingRect( Text->GetBoundingBox() );
-
-    // leave it at (0,0) so we can use it Rotate when not moving.
-    MoveVector.x = MoveVector.y = 0;
-
-    Text->ClearFlags();
-    Module->ClearFlags();
-
-    screen->SetCurItem( NULL );
-}
-
-
-void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
-{
-    if( Text == NULL )
-        return;
-
-    MODULE *Module = static_cast<MODULE*>( Text->GetParent() );
-
-    Text->SetFlags( IS_MOVED );
-    Module->SetFlags( IN_EDIT );
-
-    MoveVector.x = MoveVector.y = 0;
-
-    TextInitialPosition    = Text->GetTextPos();
-    TextInitialOrientation = Text->GetTextAngle();
-
-    // Center cursor on initial position of text
-    SetCrossHairPosition( TextInitialPosition );
-    m_canvas->MoveCursorToCrossHair();
-
-    SetMsgPanel( Text );
-    SetCurItem( Text );
-    m_canvas->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule );
-    m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
-}
-
-
-void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
-{
-    if( Text != NULL )
-    {
-        m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
-        Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
-
-        // Update the coordinates for anchor.
-        MODULE* Module = static_cast<MODULE*>( Text->GetParent() );
-
-        if( Module )
-        {
-            // Prepare undo command (a rotation can be made while moving)
-            double tmp = Text->GetTextAngle();
-            Text->SetTextAngle( TextInitialOrientation );
-
-            if( IsType( FRAME_PCB ) )
-                SaveCopyInUndoList( Module, UR_CHANGED );
-            else
-                SaveCopyInUndoList( Module, UR_CHANGED );
-
-            Text->SetTextAngle( tmp );
-
-            // Set the new position for text.
-            Text->SetTextPos( GetCrossHairPosition() );
-            wxPoint textRelPos = Text->GetTextPos() - Module->GetPosition();
-            RotatePoint( &textRelPos, -Module->GetOrientation() );
-            Text->SetPos0( textRelPos );
-            Text->ClearFlags();
-            Module->ClearFlags();
-            Module->SetLastEditTime();
-            OnModify();
-
-            // Redraw text.
-            m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
-        }
-        else
-        {
-            Text->SetTextPos( GetCrossHairPosition() );
-        }
-    }
-
-    // leave it at (0,0) so we can use it Rotate when not moving.
-    MoveVector.x = MoveVector.y = 0;
-
-    m_canvas->SetMouseCapture( NULL, NULL );
-}
-
-
-static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
-                                   bool aErase )
-{
-    BASE_SCREEN*  screen = aPanel->GetScreen();
-    TEXTE_MODULE* Text   = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
-
-    if( Text == NULL )
-        return;
-
-    // Erase umbilical and text if necessary
-    if( aErase )
-    {
-        Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
-        Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
-    }
-
-    MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();
-
-    // Draw umbilical if text moved
-    if( MoveVector.x || MoveVector.y )
-        Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
-
-    // Redraw text
-    Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
-}
-
-
-void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
-{
-    wxSize newSize = GetDesignSettings().GetTextSize( aItem->GetLayer() );
-    int newThickness = GetDesignSettings().GetTextThickness( aItem->GetLayer() );
-    bool newItalic = GetDesignSettings().GetTextItalic( aItem->GetLayer() );
-
-    if( aItem->Type() == PCB_TEXT_T )
-    {
-        TEXTE_PCB* text = static_cast<TEXTE_PCB*>( aItem );
-
-        // Exit if there's nothing to do
-        if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
-            return;
-
-        SaveCopyInUndoList( text, UR_CHANGED );
-        text->SetTextSize( newSize );
-        text->SetThickness( newThickness );
-        text->SetItalic( newItalic );
-    }
-
-    else if( aItem->Type() ==  PCB_MODULE_TEXT_T )
-    {
-        TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );
-
-        // Exit if there's nothing to do
-        if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
-            return;
-
-        SaveCopyInUndoList( text->GetParent(), UR_CHANGED );
-        text->SetTextSize( newSize );
-        text->SetThickness( newThickness );
-        text->SetItalic( newItalic );
-    }
-    else
-        return;
-
-    if( aDC )
-        m_canvas->Refresh();
-
-    OnModify();
-}
diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp
index 3099c1b9fa..ef5232f7ea 100644
--- a/pcbnew/footprint_edit_frame.cpp
+++ b/pcbnew/footprint_edit_frame.cpp
@@ -686,41 +686,6 @@ void FOOTPRINT_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
 }
 
 
-bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
-    // for next cursor position
-    // ( shift or ctrl key down are PAN command with mouse wheel)
-    bool snapToGrid = true;
-
-    if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
-        snapToGrid = false;
-
-    wxPoint oldpos = GetCrossHairPosition();
-    wxPoint pos = aPosition;
-    bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
-
-    SetCrossHairPosition( pos, snapToGrid );
-    RefreshCrossHair( oldpos, aPosition, aDC );
-
-    if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
-    {
-        keyHandled = true;
-    }
-
-    UpdateStatusBar();
-
-    return keyHandled;
-}
-
-
 void FOOTPRINT_EDIT_FRAME::OnModify()
 {
     PCB_BASE_FRAME::OnModify();
diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h
index e71d0731e3..c59d1863c8 100644
--- a/pcbnew/footprint_edit_frame.h
+++ b/pcbnew/footprint_edit_frame.h
@@ -124,15 +124,6 @@ public:
 
     void ReCreateVToolbar() override;
     void ReCreateOptToolbar() override;
-    void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
-
-    /**
-     * Handle the double click in the footprint editor.
-     *
-     * If the double clicked item is editable: call the corresponding editor.
-     */
-    void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
-
 
     /**
      * @brief (Re)Create the menubar for the module editor frame
@@ -161,15 +152,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Handle hot key events.
-     * <p>
-     * Some commands are relative to the item under the mouse cursor.  Commands are
-     * case insensitive
-     * </p>
-     */
-    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
-
     BOARD_ITEM* PrepareItemForHotkey( bool failIfCurrentlyEdited );
 
     /**
@@ -177,7 +159,6 @@ public:
      */
     void Show3D_Frame( wxCommandEvent& event ) override;
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
     void OnVerticalToolbar( wxCommandEvent& aEvent );
 
     /**
@@ -240,16 +221,12 @@ public:
      */
     bool Clear_Pcb( bool aQuery );
 
-    BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
-
     /// Return the LIB_ID of the part selected in the footprint or the part being edited.
     LIB_ID getTargetFPID() const;
 
     /// Return the LIB_ID of the part being edited.
     LIB_ID GetLoadedFPID() const;
 
-    void RemoveStruct( EDA_ITEM* Item );
-
     /**
      * Perform a geometric transform on the current footprint.
      */
@@ -297,51 +274,6 @@ public:
 
     // functions to edit footprint edges
 
-    /**
-     * Change the width of module perimeter lines, EDGE_MODULEs.
-     *
-     * param ModuleSegmentWidth (global) = new width
-     * @param aEdge = edge to edit, or NULL.  If aEdge == NULL change
-     *               the width of all footprint's edges
-     */
-    void Edit_Edge_Width( EDGE_MODULE* aEdge );
-
-    /**
-     * Change the EDGE_MODULE Edge layer,  (The new layer will be asked)
-     * if Edge == NULL change the layer of the entire footprint edges
-     *
-     * @param Edge = edge to edit, or NULL
-     */
-    void Edit_Edge_Layer( EDGE_MODULE* Edge );
-
-    /**
-     * Delete EDGE_MODULE ddge.
-     *
-     * @param Edge = edge to delete
-     */
-    void Delete_Edge_Module( EDGE_MODULE* Edge );
-
-    /**
-     * Creates a new edge item (line, arc ..).
-     *
-     * @param Edge = if NULL: create new edge else terminate edge and create a new edge
-     * @param DC = current Device Context
-     * @param type_edge = S_SEGMENT,S_ARC ..
-     * @return the new created edge.
-     */
-    EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, STROKE_T type_edge );
-
-    /**
-     * Terminate a move or create edge function.
-     */
-    void End_Edge_Module( EDGE_MODULE* Edge );
-
-    /// Function to initialize the move function params of a graphic item type DRAWSEGMENT
-    void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
-
-    /// Function to place a graphic item type EDGE_MODULE currently moved
-    void Place_EdgeMod( EDGE_MODULE* drawitem );
-
     /**
      * Delete the given module from its library.
      */
@@ -474,14 +406,6 @@ protected:
     void restoreLastFootprint();
     void retainLastFootprint();
 
-    /**
-     * Creates a new text for the footprint
-     * @param aModule is the owner of the text
-     * @param aDC is the current DC (can be NULL )
-     * @return a pointer to the new text, or NULL if aborted
-     */
-    TEXTE_MODULE* CreateTextModule( MODULE* aModule, wxDC* aDC );
-
 private:
 
     /**
@@ -490,12 +414,6 @@ private:
     void editFootprintProperties( MODULE* aFootprint );
 
     bool saveFootprintInLibrary( MODULE* aModule, const wxString& aLibraryName );
-
-    /**
-     * Move the selected item exactly, popping up a dialog to allow the
-     * user the enter the move delta
-     */
-    void moveExact();
 };
 
 #endif      // FOOTPRINT_EDIT_FRAME_H
diff --git a/pcbnew/footprint_editor_onclick.cpp b/pcbnew/footprint_editor_onclick.cpp
deleted file mode 100644
index edfd273b05..0000000000
--- a/pcbnew/footprint_editor_onclick.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file footprint_editor_onclick.cpp
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-#include <gr_basic.h>
-
-#include <class_board.h>
-#include <class_module.h>
-#include <class_edge_mod.h>
-#include <origin_viewitem.h>
-
-#include <pcbnew.h>
-#include <pcbnew_id.h>
-#include <tools/pcbnew_control.h>
-#include <hotkeys.h>
-#include <footprint_edit_frame.h>
-#include <dialog_edit_footprint_for_fp_editor.h>
-#include <menus_helpers.h>
-
-
-void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
-{
-    BOARD_ITEM* item = GetCurItem();
-
-    m_canvas->CrossHairOff( DC );
-
-    if( GetToolId() == ID_NO_TOOL_SELECTED )
-    {
-        if( item && item->GetEditFlags() ) // Move item command in progress
-        {
-            switch( item->Type() )
-            {
-            case PCB_MODULE_TEXT_T:
-                PlaceTexteModule( static_cast<TEXTE_MODULE*>( item ), DC );
-                break;
-
-            case PCB_MODULE_EDGE_T:
-                SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
-                Place_EdgeMod( static_cast<EDGE_MODULE*>( item ) );
-                break;
-
-            case PCB_PAD_T:
-                PlacePad( static_cast<D_PAD*>( item ), DC );
-                break;
-
-            default:
-                wxLogDebug( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
-                            item->Type(), item->GetEditFlags() );
-                item->ClearFlags();
-            }
-        }
-
-        else
-        {
-            if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
-               && !wxGetKeyState( WXK_CONTROL ) )
-                item = ModeditLocateAndDisplay();
-
-            SetCurItem( item );
-        }
-    }
-
-    item = GetCurItem();
-    bool no_item_edited = item == NULL || item->GetEditFlags() == 0;
-
-    switch( GetToolId() )
-    {
-    case ID_NO_TOOL_SELECTED:
-        break;
-
-    case ID_MODEDIT_CIRCLE_TOOL:
-    case ID_MODEDIT_ARC_TOOL:
-    case ID_MODEDIT_LINE_TOOL:
-        if( no_item_edited )
-        {
-            STROKE_T shape = S_SEGMENT;
-
-            if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL )
-                shape = S_CIRCLE;
-
-            if( GetToolId() == ID_MODEDIT_ARC_TOOL )
-                shape = S_ARC;
-
-            SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
-        }
-        else if( item->IsNew() )
-        {
-            if( ( (EDGE_MODULE*) item )->GetShape() == S_CIRCLE )
-            {
-                End_Edge_Module( (EDGE_MODULE*) item );
-                SetCurItem( NULL );
-                m_canvas->Refresh();
-            }
-            else if( ( (EDGE_MODULE*) item )->GetShape() == S_ARC )
-            {
-                End_Edge_Module( (EDGE_MODULE*) item );
-                SetCurItem( NULL );
-                m_canvas->Refresh();
-            }
-            else if( ( (EDGE_MODULE*) item )->GetShape() == S_SEGMENT )
-            {
-                SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, S_SEGMENT ) );
-            }
-            else
-                wxLogDebug( wxT( "ProcessCommand error: unknown shape" ) );
-        }
-        break;
-
-    case ID_MODEDIT_DELETE_TOOL:
-        if( ! no_item_edited )    // Item in edit, cannot delete it
-            break;
-
-        item = ModeditLocateAndDisplay();
-
-        if( item && item->Type() != PCB_MODULE_T ) // Cannot delete the module itself
-        {
-            SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
-            RemoveStruct( item );
-            SetCurItem( NULL );
-        }
-
-        break;
-
-    case ID_MODEDIT_ANCHOR_TOOL:
-        {
-            MODULE* module = GetBoard()->m_Modules;
-
-            if( module == NULL || module->GetEditFlags() != 0 )
-                break;
-
-            SaveCopyInUndoList( module, UR_CHANGED );
-
-            // set the new relative internal local coordinates of footprint items
-            wxPoint moveVector = module->GetPosition() - GetCrossHairPosition();
-            module->MoveAnchorPosition( moveVector );
-
-            // Usually, we do not need to change twice the anchor position,
-            // so deselect the active tool
-            SetNoToolSelected();
-            SetCurItem( NULL );
-            m_canvas->Refresh();
-        }
-        break;
-
-    case ID_MODEDIT_PLACE_GRID_COORD:
-        PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
-                                       new KIGFX::ORIGIN_VIEWITEM( GetBoard()->GetGridOrigin(), UR_TRANSIENT ),
-                                       GetCrossHairPosition() );
-        m_canvas->Refresh();
-        break;
-
-    case ID_MODEDIT_TEXT_TOOL:
-        if( GetBoard()->m_Modules == NULL )
-            break;
-
-        SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
-        CreateTextModule( GetBoard()->m_Modules, DC );
-        break;
-
-    case ID_MODEDIT_PAD_TOOL:
-        if( GetBoard()->m_Modules )
-        {
-            SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
-            AddPad( GetBoard()->m_Modules, true );
-        }
-
-        break;
-
-    case ID_MODEDIT_MEASUREMENT_TOOL:
-        DisplayError( this, _( "Measurement Tool not available in Legacy Toolset" ) );
-        SetNoToolSelected();
-        break;
-
-    default:
-        wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::ProcessCommand error" ) );
-        SetNoToolSelected();
-    }
-
-    m_canvas->CrossHairOn( DC );
-}
-
-
-/*
- * Called on a mouse left button double click
- */
-void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
-{
-    BOARD_ITEM* item = GetCurItem();
-
-    switch( GetToolId() )
-    {
-    case ID_NO_TOOL_SELECTED:
-        if( item == NULL || item->GetEditFlags() == 0 )
-            item = ModeditLocateAndDisplay();
-
-        if( item == NULL || item->GetEditFlags() != 0 )
-            break;
-
-        // Item found
-        SetCurItem( item );
-        OnEditItemRequest( DC, item );
-        break;      // end case 0
-
-    case ID_PCB_ADD_LINE_BUTT:
-    {
-        if( item && item->IsNew() )
-        {
-            End_Edge_Module( (EDGE_MODULE*) item );
-            SetCurItem( NULL );
-            m_canvas->Refresh();
-        }
-
-        break;
-    }
-
-    default:
-        break;
-    }
-}
-
-
-void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
-{
-    switch( aItem->Type() )
-    {
-    case PCB_PAD_T:
-        InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
-        m_canvas->MoveCursorToCrossHair();
-        break;
-
-    case PCB_MODULE_T:
-        editFootprintProperties( (MODULE*) aItem );
-        m_canvas->MoveCursorToCrossHair();
-        m_canvas->Refresh();
-        break;
-
-    case PCB_MODULE_TEXT_T:
-        InstallTextOptionsFrame( aItem, aDC );
-        break;
-
-    case PCB_MODULE_EDGE_T :
-        InstallGraphicItemPropertiesDialog( aItem );
-        break;
-
-    default:
-        break;
-    }
-}
diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp
index ebd1a41acb..f5f1a3791a 100644
--- a/pcbnew/footprint_editor_utils.cpp
+++ b/pcbnew/footprint_editor_utils.cpp
@@ -71,109 +71,6 @@
 using namespace std::placeholders;
 
 
-// Functions defined in block_module_editor, but used here
-// These 3 functions are used in modedit to rotate, mirror or move the
-// whole footprint so they are called with force_all = true
-void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
-void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
-void MoveMarkedItemsExactly( MODULE* module, const wxPoint& centre,
-                             const wxPoint& translation, double rotation,
-                             bool force_all = false );
-
-
-BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
-{
-    BOARD_ITEM* item = GetCurItem();
-
-    if( GetBoard()->m_Modules == NULL )
-        return NULL;
-
-    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
-
-    // Assign to scanList the proper item types desired based on tool type
-    // or hotkey that is in play.
-
-    const KICAD_T* scanList = NULL;
-
-    if( aHotKeyCode )
-    {
-        // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
-        // int aHotKeyCode ) when searching is needed from a hotkey handler
-    }
-    else
-    {
-        scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
-    }
-
-    m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );
-
-    // Remove redundancies: when an item is found, we can remove the module from list
-    if( m_Collector->GetCount() > 1 )
-    {
-        for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
-        {
-            item = (*m_Collector)[ii];
-
-            if( item->Type() != PCB_MODULE_T )
-                continue;
-
-            m_Collector->Remove( ii );
-            ii--;
-        }
-    }
-
-    if( m_Collector->GetCount() <= 1 )
-    {
-        item = (*m_Collector)[0];
-        SetCurItem( item );
-    }
-    else    // we can't figure out which item user wants, do popup menu so user can choose
-    {
-        wxMenu      itemMenu;
-
-        // Give a title to the selection menu. It also allows one to close the popup menu without any action
-        AddMenuItem( &itemMenu, wxID_NONE, _( "Clarify Selection" ),
-                     KiBitmap( info_xpm ) );
-        itemMenu.AppendSeparator();
-
-        int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
-
-        for( int ii = 0; ii<limit; ++ii )
-        {
-            item = (*m_Collector)[ii];
-
-            wxString    text = item->GetSelectMenuText( GetUserUnits() );
-            BITMAP_DEF  xpm  = item->GetMenuImage();
-
-            AddMenuItem( &itemMenu,
-                         ID_POPUP_PCB_ITEM_SELECTION_START + ii,
-                         text,
-                         KiBitmap( xpm ) );
-        }
-
-        // this menu's handler is void
-        // PCB_BASE_FRAME::ProcessItemSelection()
-        // and it calls SetCurItem() which in turn calls DisplayInfo() on the
-        // item.
-        m_canvas->SetAbortRequest( true );   // changed in false if an item is selected
-        PopupMenu( &itemMenu );              // m_AbortRequest = false if an item is selected
-
-        m_canvas->MoveCursorToCrossHair();
-        m_canvas->SetIgnoreMouseEvents( false );
-
-        // The function ProcessItemSelection() has set the current item, return it.
-        item = GetCurItem();
-    }
-
-    if( item )
-    {
-        SetMsgPanel( item );
-    }
-
-    return item;
-}
-
-
 void FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard( wxCommandEvent& event )
 {
     Load_Module_From_BOARD( NULL );
@@ -588,16 +485,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
 
     break;
 
-    case ID_POPUP_PCB_MOVE_EXACT:
-        moveExact();
-        break;
-
-    case ID_POPUP_PCB_CREATE_ARRAY:
-        createArray();
-        break;
-
-    // JEY TODO: many (most? all?) of these are legacy-only and can be removed.
-
     case ID_GEN_IMPORT_GRAPHICS_FILE:
         if( GetBoard()->m_Modules )
         {
@@ -626,44 +513,6 @@ void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
 }
 
 
-void FOOTPRINT_EDIT_FRAME::moveExact()
-{
-    wxPoint         translation;
-    double          rotation;
-    ROTATION_ANCHOR rotationAnchor = ROTATE_AROUND_ITEM_ANCHOR;
-
-    DIALOG_MOVE_EXACT dialog( this, translation, rotation, rotationAnchor );
-    int ret = dialog.ShowModal();
-
-    if( ret == wxID_OK )
-    {
-        SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
-
-        BOARD_ITEM* item = GetScreen()->GetCurItem();
-
-        item->Move( translation );
-
-        switch( rotationAnchor )
-        {
-        case ROTATE_AROUND_ITEM_ANCHOR:
-            item->Rotate( item->GetPosition(), rotation );
-            break;
-        case ROTATE_AROUND_USER_ORIGIN:
-            item->Rotate( GetScreen()->m_O_Curseur, rotation );
-            break;
-        default:
-            wxFAIL_MSG( "Rotation choice shouldn't have been available in this context." );
-        }
-
-
-        item->Rotate( item->GetPosition(), rotation );
-        m_canvas->Refresh();
-    }
-
-    m_canvas->MoveCursorToCrossHair();
-}
-
-
 void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
 {
     int id = aEvent.GetId();
@@ -738,55 +587,35 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
 }
 
 
-void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
+void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
 {
-    if( Item == NULL )
-        return;
-
-    switch( Item->Type() )
+    switch( aItem->Type() )
     {
     case PCB_PAD_T:
-        DeletePad( (D_PAD*) Item, false );
-        break;
-
-    case PCB_MODULE_TEXT_T:
-    {
-        TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( Item );
-
-        switch( text->GetType() )
-        {
-        case TEXTE_MODULE::TEXT_is_REFERENCE:
-            DisplayError( this, _( "Cannot delete REFERENCE!" ) );
-            break;
-
-        case TEXTE_MODULE::TEXT_is_VALUE:
-            DisplayError( this, _( "Cannot delete VALUE!" ) );
-            break;
-
-        case TEXTE_MODULE::TEXT_is_DIVERS:
-            DeleteTextModule( text );
-        }
-    }
-    break;
-
-    case PCB_MODULE_EDGE_T:
-        Delete_Edge_Module( (EDGE_MODULE*) Item );
-        m_canvas->Refresh();
+        InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
+        m_canvas->MoveCursorToCrossHair();
         break;
 
     case PCB_MODULE_T:
+        editFootprintProperties( (MODULE*) aItem );
+        m_canvas->MoveCursorToCrossHair();
+        m_canvas->Refresh();
+        break;
+
+    case PCB_MODULE_TEXT_T:
+        InstallTextOptionsFrame( aItem, aDC );
+        break;
+
+    case PCB_MODULE_EDGE_T :
+        InstallGraphicItemPropertiesDialog( aItem );
         break;
 
     default:
-    {
-        wxString Line;
-        Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() );
-        wxMessageBox( Line );
-    }
-    break;
+        break;
     }
 }
 
+
 COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
 {
     return Settings().Colors().GetItemColor( LAYER_GRID );
diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp
index c827bc2822..fe4fb43bb5 100644
--- a/pcbnew/footprint_viewer_frame.cpp
+++ b/pcbnew/footprint_viewer_frame.cpp
@@ -652,38 +652,6 @@ bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent
 }
 
 
-bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    bool eventHandled = true;
-
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    wxPoint oldpos = GetCrossHairPosition();
-    wxPoint pos = aPosition;
-    GeneralControlKeyMovement( aHotKey, &pos, true );
-
-    if( aHotKey )
-    {
-        eventHandled = OnHotKey( aDC, aHotKey, aPosition );
-    }
-
-    SetCrossHairPosition( pos );
-    RefreshCrossHair( oldpos, aPosition, aDC );
-
-    UpdateStatusBar();    // Display new cursor coordinates
-
-    return eventHandled;
-}
-
-
 void FOOTPRINT_VIEWER_FRAME::Show3D_Frame( wxCommandEvent& event )
 {
     EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
diff --git a/pcbnew/footprint_viewer_frame.h b/pcbnew/footprint_viewer_frame.h
index efa1b96b60..8a7b3fc201 100644
--- a/pcbnew/footprint_viewer_frame.h
+++ b/pcbnew/footprint_viewer_frame.h
@@ -135,21 +135,9 @@ private:
 
     void InstallDisplayOptions( wxCommandEvent& event );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
-
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Function OnHotKey
-     * handle hot key events.
-     * <p?
-     * Some commands are relative to the item under the mouse cursor.  Commands are
-     * case insensitive
-     * </p>
-     */
-    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
-
     void LoadSettings( wxConfigBase* aCfg ) override;
     void SaveSettings( wxConfigBase* aCfg ) override;
 
diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp
index adb3579516..091950c70e 100644
--- a/pcbnew/footprint_wizard_frame.cpp
+++ b/pcbnew/footprint_wizard_frame.cpp
@@ -590,42 +590,6 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
 }
 
 
-bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
-    // Filter out the 'fake' mouse motion after a keyboard movement
-    if( !aHotKey && m_movingCursorWithKeyboard )
-    {
-        m_movingCursorWithKeyboard = false;
-        return false;
-    }
-
-    wxCommandEvent  cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    wxPoint pos = aPosition;
-    wxPoint oldpos = GetCrossHairPosition();
-    bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, true );
-
-    switch( aHotKey )
-    {
-    case ' ':
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        keyHandled = true;
-        break;
-
-    default:
-        break;
-    }
-
-    SetCrossHairPosition( pos );
-    RefreshCrossHair( oldpos, aPosition, aDC );
-
-    UpdateStatusBar();    // Display new cursor coordinates
-
-    return keyHandled;
-}
-
-
 void FOOTPRINT_WIZARD_FRAME::Show3D_Frame( wxCommandEvent& event )
 {
     EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h
index 12d726544f..6d8c330ffa 100644
--- a/pcbnew/footprint_wizard_frame.h
+++ b/pcbnew/footprint_wizard_frame.h
@@ -182,21 +182,9 @@ private:
     void                ClickOnPageList( wxCommandEvent& event );
     void                OnSetRelativeOffset( wxCommandEvent& event );
 
-    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
-
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Function OnHotKey
-     * handle hot key events.
-     * <p?
-     * Some commands are relative to the item under the mouse cursor.  Commands are
-     * case insensitive
-     * </p>
-     */
-    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
-
     void                LoadSettings( wxConfigBase* aCfg ) override;
     void                SaveSettings( wxConfigBase* aCfg ) override;
 
diff --git a/pcbnew/highlight.cpp b/pcbnew/highlight.cpp
deleted file mode 100644
index 8b4f0a27d8..0000000000
--- a/pcbnew/highlight.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file highlight.cpp
- * @brief Highlight nets.
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <pcb_edit_frame.h>
-#include <kicad_device_context.h>
-
-#include <class_board.h>
-#include <class_track.h>
-#include <class_zone.h>
-
-#include <pcbnew.h>
-#include <collectors.h>
-
-
-int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
-{
-    int netcode = -1;
-
-    if( GetBoard()->IsHighLightNetON() )
-        HighLight( DC );
-
-    // use this scheme because a pad is a higher priority than a track in the
-    // search, and finding a pad, instead of a track on a pad,
-    // allows us to fire a message to Eeschema.
-
-    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
-
-    // optionally, modify the "guide" here as needed using its member functions
-
-    m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsOrTracks,
-                          RefPos( true ), guide );
-
-    if( m_Collector->GetCount() == 0 )
-        m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::Zones,
-                              RefPos( true ), guide );
-
-    BOARD_ITEM* item = (*m_Collector)[0];
-
-    if( item )
-    {
-        switch( item->Type() )
-        {
-        case PCB_PAD_T:
-            netcode = ( (D_PAD*) item )->GetNetCode();
-            SendMessageToEESCHEMA( item );
-            break;
-
-        case PCB_TRACE_T:
-        case PCB_VIA_T:
-            // since these classes are all derived from TRACK, use a common
-            // GetNet() function:
-            netcode = ( (TRACK*) item )->GetNetCode();
-            break;
-
-        case PCB_ZONE_AREA_T:
-            netcode = ( (ZONE_CONTAINER*) item )->GetNetCode();
-            break;
-
-        default:
-            ;   // until somebody changes GENERAL_COLLECTOR::PadsOrTracks,
-                // this should not happen.
-        }
-    }
-
-    if( netcode >= 0 )
-    {
-        GetBoard()->SetHighLightNet( netcode );
-        HighLight( DC );
-    }
-
-    return netcode;      // HitTest() failed.
-}
-
-
-void PCB_EDIT_FRAME::HighLight( wxDC* DC )
-{
-    if( GetBoard()->IsHighLightNetON() )
-        GetBoard()->HighLightOFF();
-    else
-        GetBoard()->HighLightON();
-
-    GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() );
-}
diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp
index 7c9bdf3656..26a4e60759 100644
--- a/pcbnew/hotkeys.cpp
+++ b/pcbnew/hotkeys.cpp
@@ -22,13 +22,10 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-/**
- * @file pcbnew/hotkeys.cpp
- */
-
 #include <fctsys.h>
 #include <pcbnew.h>
 #include <pcb_edit_frame.h>
+#include <footprint_edit_frame.h>
 #include <footprint_viewer_frame.h>
 #include <footprint_wizard_frame.h>
 #include <pcbnew_id.h>
@@ -583,57 +580,6 @@ EDA_HOTKEY* FOOTPRINT_VIEWER_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-bool FOOTPRINT_VIEWER_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
-                                       EDA_ITEM* aItem )
-{
-    if( aHotKey == 0 )
-        return false;
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem with non ascii
-     * codes like function keys */
-    if( (aHotKey >= 'a') && (aHotKey <= 'z') )
-        aHotKey += 'A' - 'a';
-
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromHotkey( aHotKey, module_viewer_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        return false;
-
-    switch( HK_Descr->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:                   // Display Current hotkey list
-        DisplayHotkeyList( this, g_Module_Viewer_Hotkeys_Descr );
-        break;
-
-    case HK_RESET_LOCAL_COORD:      // set local (relative) coordinate origin
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_LEFT_CLICK:
-        OnLeftClick( aDC, aPosition );
-        break;
-
-    case HK_LEFT_DCLICK:    // Simulate a double left click: generate 2 events
-        OnLeftClick( aDC, aPosition );
-        OnLeftDClick( aDC, aPosition );
-        break;
-    }
-
-    return true;
-}
-
-
-
 EDA_HOTKEY* FOOTPRINT_WIZARD_FRAME::GetHotKeyDescription( int aCommand ) const
 {
     EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
@@ -642,47 +588,23 @@ EDA_HOTKEY* FOOTPRINT_WIZARD_FRAME::GetHotKeyDescription( int aCommand ) const
 }
 
 
-bool FOOTPRINT_WIZARD_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
-                                       EDA_ITEM* aItem )
+EDA_HOTKEY* PCB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
 {
-    if( aHotKey == 0 )
-        return false;
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem with non ascii
-     * codes like function keys */
-    if( (aHotKey >= 'a') && (aHotKey <= 'z') )
-        aHotKey += 'A' - 'a';
-
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
+    EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
 
     if( HK_Descr == NULL )
-        return false;
+        HK_Descr = GetDescriptorFromCommand( aCommand, board_edit_Hotkey_List );
 
-    switch( HK_Descr->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:                   // Display Current hotkey list
-        DisplayHotkeyList( this, g_Module_Viewer_Hotkeys_Descr );
-        break;
-
-    case HK_RESET_LOCAL_COORD:      // set local (relative) coordinate origin
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_LEFT_CLICK:
-        OnLeftClick( aDC, aPosition );
-        break;
-
-    case HK_LEFT_DCLICK:    // Simulate a double left click: generate 2 events
-        OnLeftClick( aDC, aPosition );
-        OnLeftDClick( aDC, aPosition );
-        break;
-    }
-    return true;
+    return HK_Descr;
+}
+
+
+EDA_HOTKEY* FOOTPRINT_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
+{
+    EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
+
+    if( HK_Descr == NULL )
+        HK_Descr = GetDescriptorFromCommand( aCommand, module_edit_Hotkey_List );
+
+    return HK_Descr;
 }
diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h
index a6ef64d4c0..ab2943d895 100644
--- a/pcbnew/hotkeys.h
+++ b/pcbnew/hotkeys.h
@@ -139,15 +139,12 @@ extern struct EDA_HOTKEY_CONFIG g_Module_Editor_Hotkeys_Descr[];
 extern struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hotkeys_Descr[];
 
 // List of common hotkey descriptors
-// used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp
 extern EDA_HOTKEY* common_Hotkey_List[];
 
 // List of hotkey descriptors for pcbnew
-// used in hotkeys_board_editor.cpp
 extern EDA_HOTKEY* board_edit_Hotkey_List[];
 
 // List of hotkey descriptors for the module editor
-// used in hotkeys_module_editor.cpp
 extern EDA_HOTKEY* module_edit_Hotkey_List[];
 
 
diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp
deleted file mode 100644
index e997ac8e7c..0000000000
--- a/pcbnew/hotkeys_board_editor.cpp
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2009 Jean-Pierre Charras, jp.charras@wanadoo.fr
- * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file hotkeys_board_editor.cpp
- */
-
-#include <fctsys.h>
-#include <pcb_edit_frame.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-
-#include <class_board.h>
-#include <class_module.h>
-#include <class_track.h>
-#include <class_pcb_text.h>
-#include <class_pcb_target.h>
-#include <class_drawsegment.h>
-#include <origin_viewitem.h>
-
-#include <pcbnew.h>
-#include <pcbnew_id.h>
-#include <hotkeys.h>
-#include <class_zone.h>
-#include <tool/tool_manager.h>
-#include <tools/pcbnew_control.h>
-#include <tools/selection_tool.h>
-#include <tool/actions.h>
-
-/* How to add a new hotkey:
- * see hotkeys.cpp
- */
-
-
-EDA_HOTKEY* PCB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
-{
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromCommand( aCommand, board_edit_Hotkey_List );
-
-    return HK_Descr;
-}
-
-
-bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
-                               EDA_ITEM* aItem )
-{
-    if( aHotkeyCode == 0 )
-        return false;
-
-    SELECTION&  selection = GetToolManager()->GetTool<SELECTION_TOOL>()->GetSelection();
-    bool        itemCurrentlyEdited = selection.Front() && selection.Front()->GetEditFlags();
-    MODULE*     module = NULL;
-    int         evt_type = 0;       //Used to post a wxCommandEvent on demand
-    PCB_SCREEN* screen = GetScreen();
-    auto        displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
-
-    /* Convert lower to upper case
-     * (the usual toupper function has problem with non ascii codes like function keys
-     */
-    if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
-        aHotkeyCode += 'A' - 'a';
-
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, common_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, board_edit_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        return false;
-
-    int hk_id = HK_Descr->m_Idcommand;
-
-    // Create a wxCommandEvent that will be posted in some hot keys functions
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    LAYER_NUM  ll;
-
-    switch( hk_id )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_LEFT_CLICK:
-        OnLeftClick( aDC, aPosition );
-        break;
-
-    case HK_LEFT_DCLICK:    // Simulate a double left click: generate 2 events
-        OnLeftClick( aDC, aPosition );
-        OnLeftDClick( aDC, aPosition );
-        break;
-
-    case HK_SWITCH_TRACK_WIDTH_TO_NEXT:
-        if( GetCanvas()->IsMouseCaptured() )
-            GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
-
-        if( GetDesignSettings().GetTrackWidthIndex() < GetDesignSettings().m_TrackWidthList.size() - 1 )
-            GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().GetTrackWidthIndex() + 1 );
-        else
-            GetDesignSettings().SetTrackWidthIndex( 0 );
-
-        if( GetCanvas()->IsMouseCaptured() )
-            GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
-
-        break;
-
-    case HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS:
-        if( GetCanvas()->IsMouseCaptured() )
-            GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
-
-        if( GetDesignSettings().GetTrackWidthIndex() <= 0 )
-            GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().m_TrackWidthList.size() -1 );
-        else
-            GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().GetTrackWidthIndex() - 1 );
-
-        if( GetCanvas()->IsMouseCaptured() )
-            GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
-
-        break;
-
-    case HK_SWITCH_GRID_TO_FASTGRID1:
-        SetFastGrid1();
-        break;
-
-    case HK_SWITCH_GRID_TO_FASTGRID2:
-        SetFastGrid2();
-        break;
-
-    case HK_SWITCH_GRID_TO_NEXT:
-        evt_type = ID_POPUP_GRID_NEXT;
-        break;
-
-    case HK_SWITCH_GRID_TO_PREVIOUS:
-        evt_type = ID_POPUP_GRID_PREV;
-        break;
-
-    case HK_SWITCH_LAYER_TO_PREVIOUS:
-        ll = GetActiveLayer();
-
-        if( !IsCopperLayer( ll ) )
-            break;
-
-        if( ll == F_Cu )
-            ll = B_Cu;
-        else if( ll == B_Cu )
-            ll = ToLAYER_ID( GetBoard()->GetCopperLayerCount() - 2 );
-        else
-            ll = ll - 1;
-
-        SwitchLayer( aDC, ToLAYER_ID( ll ) );
-        break;
-
-    case HK_SWITCH_LAYER_TO_NEXT:
-        ll = GetActiveLayer();
-
-        if( !IsCopperLayer( ll ) )
-            break;
-
-        if( ll == B_Cu )
-            ll = F_Cu;
-        else if( ++ll >= GetBoard()->GetCopperLayerCount() - 1 )
-            ll = B_Cu;
-
-        SwitchLayer( aDC, ToLAYER_ID( ll ) );
-        break;
-
-    case HK_SWITCH_LAYER_TO_COMPONENT:
-        SwitchLayer( aDC, F_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_COPPER:
-        SwitchLayer( aDC, B_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_INNER1:
-        SwitchLayer( aDC, In1_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_INNER2:
-        SwitchLayer( aDC, In2_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_INNER3:
-        SwitchLayer( aDC, In3_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_INNER4:
-        SwitchLayer( aDC, In4_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_INNER5:
-        SwitchLayer( aDC, In5_Cu );
-        break;
-
-    case HK_SWITCH_LAYER_TO_INNER6:
-        SwitchLayer( aDC, In6_Cu );
-        break;
-
-    case HK_HELP: // Display Current hotkey list
-        DisplayHotkeyList( this, g_Board_Editor_Hotkeys_Descr );
-        break;
-
-    case HK_PREFERENCES:
-        evt_type = wxID_PREFERENCES;
-        break;
-
-    case HK_ADD_MODULE:
-        evt_type = ID_PCB_MODULE_BUTT;
-        break;
-
-    case HK_RESET_LOCAL_COORD:  // Set the relative coord
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_SET_GRID_ORIGIN:
-        PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
-                                       new KIGFX::ORIGIN_VIEWITEM( GetGridOrigin(), UR_TRANSIENT ),
-                                       GetCrossHairPosition() );
-        m_canvas->Refresh();
-        break;
-
-    case HK_RESET_GRID_ORIGIN:
-        PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
-                                       new KIGFX::ORIGIN_VIEWITEM( GetGridOrigin(), UR_TRANSIENT ),
-                                       wxPoint( 0, 0 ) );
-        m_canvas->Refresh();
-        break;
-
-    case HK_SWITCH_TRACK_DISPLAY_MODE:
-        displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
-        m_canvas->Refresh();
-        break;
-
-    case HK_BACK_SPACE:
-        m_toolManager->RunAction( ACTIONS::doDelete );
-        break;
-
-    case HK_GET_AND_MOVE_FOOTPRINT:
-        if( !itemCurrentlyEdited )
-            evt_type = ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST;
-
-        break;
-
-    case HK_OPEN:
-        if( !itemCurrentlyEdited )
-            evt_type = ID_LOAD_FILE ;
-
-        break;
-
-    case HK_SAVE:
-        if( !itemCurrentlyEdited )
-            evt_type = ID_SAVE_BOARD;
-
-        break;
-
-    case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
-        if( GetToolId() != ID_TRACK_BUTT )
-            return true;
-
-        if( !itemCurrentlyEdited )                         // no track in progress: nothing to do
-            break;
-
-        if( GetCurItem()->Type() != PCB_TRACE_T )           // Should not occur
-            return true;
-
-        if( !GetCurItem()->IsNew() )
-            return true;
-
-        // place micro via and switch layer
-        if( IsMicroViaAcceptable() )
-            evt_type = ID_POPUP_PCB_PLACE_MICROVIA;
-
-        break;
-
-    case HK_ADD_BLIND_BURIED_VIA:
-    case HK_ADD_THROUGH_VIA: // Switch to alternate layer and Place a via if a track is in progress
-        if( GetBoard()->GetDesignSettings().m_BlindBuriedViaAllowed &&
-            hk_id == HK_ADD_BLIND_BURIED_VIA  )
-            GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED;
-        else
-            GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_THROUGH;
-
-        if( !itemCurrentlyEdited ) // no track in progress: switch layer only
-        {
-            Other_Layer_Route( NULL, aDC );
-            if( displ_opts->m_ContrastModeDisplay )
-                m_canvas->Refresh();
-            break;
-        }
-
-        if( GetToolId() != ID_TRACK_BUTT )
-            return true;
-
-        if( GetCurItem()->Type() != PCB_TRACE_T )
-            return true;
-
-        if( !GetCurItem()->IsNew() )
-            return true;
-
-        evt_type = hk_id == HK_ADD_BLIND_BURIED_VIA ?
-            ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA : ID_POPUP_PCB_PLACE_THROUGH_VIA;
-        break;
-
-    case HK_SEL_LAYER_AND_ADD_THROUGH_VIA:
-    case HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA:
-        if( GetCurItem() == NULL || !GetCurItem()->IsNew() ||
-            GetCurItem()->Type() != PCB_TRACE_T )
-            break;
-
-        evt_type = hk_id == HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA ?
-            ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA :
-            ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA;
-        break;
-
-    case HK_SWITCH_TRACK_POSTURE:
-        /* change the position of initial segment when creating new tracks
-         * switch from _/  to -\ .
-         */
-        evt_type = ID_POPUP_PCB_SWITCH_TRACK_POSTURE ;
-        break;
-
-    case HK_ADD_NEW_TRACK: // Start new track, if possible
-        OnHotkeyBeginRoute( aDC );
-        break;
-
-    case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
-        // get any module, locked or not locked and toggle its locked status
-        if( !itemCurrentlyEdited )
-        {
-            wxPoint pos = RefPos( true );
-            module = GetBoard()->GetFootprint( pos, screen->m_Active_Layer, true );
-        }
-        else if( GetCurItem()->Type() == PCB_MODULE_T )
-        {
-            module = (MODULE*) GetCurItem();
-        }
-
-        if( module )
-        {
-            SetCurItem( module );
-            module->SetLocked( !module->IsLocked() );
-            OnModify();
-            SetMsgPanel( module );
-        }
-        break;
-
-    case HK_MOVE_ITEM_EXACT:
-    case HK_DUPLICATE:
-    case HK_DUPLICATE_ITEM_AND_INCREMENT:
-    case HK_CREATE_ARRAY:
-        OnHotkeyDuplicateOrArrayItem( HK_Descr->m_Idcommand );
-        break;
-
-    case HK_SWITCH_HIGHCONTRAST_MODE: // switch to high contrast mode and refresh the canvas
-        displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
-        m_canvas->Refresh();
-        break;
-
-    case HK_CANVAS_CAIRO:
-        evt_type = ID_MENU_CANVAS_CAIRO;
-        break;
-
-    case HK_CANVAS_OPENGL:
-        evt_type = ID_MENU_CANVAS_OPENGL;
-        break;
-
-    case HK_ZONE_FILL_OR_REFILL:
-        evt_type = ID_POPUP_PCB_FILL_ALL_ZONES;
-        break;
-
-    case HK_ZONE_REMOVE_FILLED:
-        evt_type = ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES;
-        break;
-    }
-
-    if( evt_type != 0 )
-    {
-        wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
-        evt.SetEventObject( this );
-        evt.SetId( evt_type );
-        GetEventHandler()->ProcessEvent( evt );
-    }
-
-    return true;
-}
-
-
-TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
-{
-    if( !IsCopperLayer( GetActiveLayer() ) )
-        return NULL;
-
-    bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetEditFlags();
-
-    // Ensure the track tool is active
-    if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited )
-    {
-        wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-        cmd.SetEventObject( this );
-        cmd.SetId( ID_TRACK_BUTT );
-        GetEventHandler()->ProcessEvent( cmd );
-    }
-
-    if( GetToolId() != ID_TRACK_BUTT )
-        return NULL;
-
-    TRACK* track = NULL;
-
-    if( !itemCurrentlyEdited )     // no track in progress:
-    {
-        track = Begin_Route( NULL, aDC );
-        SetCurItem( track );
-
-        if( track )
-            m_canvas->SetAutoPanRequest( true );
-    }
-    else if( GetCurItem()->IsNew() )
-    {
-        track = Begin_Route( (TRACK*) GetCurItem(), aDC );
-
-        // SetCurItem() must not write to the msg panel
-        // because a track info is displayed while moving the mouse cursor
-        if( track )      // A new segment was created
-            SetCurItem( track, false );
-
-        m_canvas->SetAutoPanRequest( true );
-    }
-
-    return track;
-}
-
-
-bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand )
-{
-    BOARD_ITEM* item = GetCurItem();
-    bool itemCurrentlyEdited = item && item->GetEditFlags();
-
-    if( itemCurrentlyEdited )
-        return false;
-
-    item = PcbGeneralLocateAndDisplay();
-
-    if( item == NULL )
-        return false;
-
-    SetCurItem( item );
-
-    int evt_type = 0;       // Used to post a wxCommandEvent on demand
-
-    bool canDuplicate = true;
-
-    switch( item->Type() )
-    {
-    // Only handle items we know we can handle
-    case PCB_PAD_T:
-        canDuplicate = false;
-        // no break
-    case PCB_MODULE_T:
-    case PCB_LINE_T:
-    case PCB_TEXT_T:
-    case PCB_TRACE_T:
-    case PCB_ZONE_AREA_T:
-    case PCB_TARGET_T:
-    case PCB_DIMENSION_T:
-        switch( aIdCommand )
-        {
-        case HK_CREATE_ARRAY:
-            if( canDuplicate )
-                evt_type = ID_POPUP_PCB_CREATE_ARRAY;
-            break;
-
-        case HK_MOVE_ITEM_EXACT:
-            evt_type = ID_POPUP_PCB_MOVE_EXACT;
-            break;
-
-        default:
-            // We don't handle other commands here
-            break;
-        }
-        break;
-
-    default:
-        evt_type = 0;
-        break;
-    }
-
-    return PostCommandMenuEvent( evt_type );
-}
diff --git a/pcbnew/hotkeys_footprint_editor.cpp b/pcbnew/hotkeys_footprint_editor.cpp
deleted file mode 100644
index 1c0d02d5fb..0000000000
--- a/pcbnew/hotkeys_footprint_editor.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2010-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file hotkeys_module_editor.cpp
- */
-
-#include <fctsys.h>
-#include <pcbnew.h>
-#include <footprint_edit_frame.h>
-#include <pcbnew_id.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-#include <board_design_settings.h>
-#include <origin_viewitem.h>
-#include <tools/pcbnew_control.h>
-
-#include <hotkeys.h>
-
-/* How to add a new hotkey:
- * See hotkeys.cpp
- */
-
-EDA_HOTKEY* FOOTPRINT_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
-{
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromCommand( aCommand, module_edit_Hotkey_List );
-
-    return HK_Descr;
-}
-
-
-bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
-                                     EDA_ITEM* aItem )
-{
-    if( aHotKey == 0 )
-        return false;
-
-    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
-    cmd.SetEventObject( this );
-
-    /* Convert lower to upper case (the usual toupper function has problem with non ascii
-     * codes like function keys */
-    if( (aHotKey >= 'a') && (aHotKey <= 'z') )
-        aHotKey += 'A' - 'a';
-
-    EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
-
-    if( HK_Descr == NULL )
-        return false;
-
-    switch( HK_Descr->m_Idcommand )
-    {
-    default:
-    case HK_NOT_FOUND:
-        return false;
-
-    case HK_HELP:                   // Display Current hotkey list
-        DisplayHotkeyList( this, g_Module_Editor_Hotkeys_Descr );
-        break;
-
-    case HK_PREFERENCES:
-        cmd.SetId( wxID_PREFERENCES );
-        GetEventHandler()->ProcessEvent( cmd );
-        break;
-
-    case HK_RESET_LOCAL_COORD:      // set local (relative) coordinate origin
-        GetScreen()->m_O_Curseur = GetCrossHairPosition();
-        break;
-
-    case HK_LEFT_CLICK:
-        OnLeftClick( aDC, aPosition );
-        break;
-
-    case HK_LEFT_DCLICK:    // Simulate a double left click: generate 2 events
-        OnLeftClick( aDC, aPosition );
-        OnLeftDClick( aDC, aPosition );
-        break;
-
-    case HK_SET_GRID_ORIGIN:
-        PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
-                                       new KIGFX::ORIGIN_VIEWITEM( GetGridOrigin(), UR_TRANSIENT ),
-                                       GetCrossHairPosition() );
-        m_canvas->Refresh();
-        break;
-
-    case HK_RESET_GRID_ORIGIN:
-        PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
-                                       new KIGFX::ORIGIN_VIEWITEM( GetGridOrigin(), UR_TRANSIENT ),
-                                       wxPoint( 0, 0 ) );
-        m_canvas->Refresh();
-        break;
-
-    case HK_CREATE_ARRAY:
-        PostCommandMenuEvent( ID_POPUP_PCB_CREATE_ARRAY );
-    }
-
-    return true;
-}
-
-
diff --git a/pcbnew/microwave.cpp b/pcbnew/microwave.cpp
index d72d821715..9413eab61f 100644
--- a/pcbnew/microwave.cpp
+++ b/pcbnew/microwave.cpp
@@ -59,130 +59,9 @@ static wxSize  ShapeSize;
 static int     PolyShapeType;
 
 
-static void Exit_Self( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
-
-static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel,
-                                              wxDC*           aDC,
-                                              const wxPoint&  aPosition,
-                                              bool            aErase );
-
-
 ///> An inductor pattern temporarily used during mu-wave inductor creation
 static MWAVE::INDUCTOR_PATTERN s_inductor_pattern;
 
-///> A flag set to true when mu-wave inductor is being created
-static bool s_inductorInProgress = false;
-
-
-/* This function shows on screen the bounding box of the inductor that will be
- * created at the end of the build inductor process
- */
-static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                                              const wxPoint& aPosition, bool aErase )
-{
-    /* Calculate the orientation and size of the box containing the inductor:
-     * the box is a rectangle with height = length/2
-     * the shape is defined by a rectangle, nor necessary horizontal or vertical
-     */
-    GRSetDrawMode( aDC, GR_XOR );
-
-    wxPoint poly[5];
-    wxPoint pt    = s_inductor_pattern.m_End - s_inductor_pattern.m_Start;
-    double  angle = -ArcTangente( pt.y, pt.x );
-    int     len   = KiROUND( EuclideanNorm( pt ) );
-
-    // calculate corners
-    pt.x = 0; pt.y = len / 4;
-    RotatePoint( &pt, angle );
-    poly[0] = s_inductor_pattern.m_Start + pt;
-    poly[1] = s_inductor_pattern.m_End + pt;
-    pt.x    = 0; pt.y = -len / 4;
-    RotatePoint( &pt, angle );
-    poly[2] = s_inductor_pattern.m_End + pt;
-    poly[3] = s_inductor_pattern.m_Start + pt;
-    poly[4] = poly[0];
-
-    if( aErase )
-    {
-        GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
-    }
-
-    s_inductor_pattern.m_End = aPanel->GetParent()->GetCrossHairPosition();
-    pt    = s_inductor_pattern.m_End - s_inductor_pattern.m_Start;
-    angle = -ArcTangente( pt.y, pt.x );
-    len   = KiROUND( EuclideanNorm( pt ) );
-
-    // calculate new corners
-    pt.x = 0; pt.y = len / 4;
-    RotatePoint( &pt, angle );
-    poly[0] = s_inductor_pattern.m_Start + pt;
-    poly[1] = s_inductor_pattern.m_End + pt;
-    pt.x    = 0; pt.y = -len / 4;
-    RotatePoint( &pt, angle );
-    poly[2] = s_inductor_pattern.m_End + pt;
-    poly[3] = s_inductor_pattern.m_Start + pt;
-    poly[4] = poly[0];
-
-    GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
-}
-
-
-void Exit_Self( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
-{
-    if( aPanel->IsMouseCaptured() )
-        aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
-
-    s_inductorInProgress = false;
-    aPanel->SetMouseCapture( NULL, NULL );
-}
-
-
-void PCB_EDIT_FRAME::Begin_Self( wxDC* DC )
-{
-    if( s_inductorInProgress )
-    {
-        m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
-        m_canvas->SetMouseCapture( NULL, NULL );
-
-        wxString errorMessage;
-
-        // Prepare parameters for inductor
-        // s_inductor_pattern.m_Start is already initialized,
-        // when s_inductor_pattern.m_Flag == false
-        s_inductor_pattern.m_Width = GetDesignSettings().GetCurrentTrackWidth();
-        s_inductor_pattern.m_End = GetCrossHairPosition();
-
-        wxASSERT( s_inductorInProgress );
-        s_inductorInProgress = false;
-
-        MODULE* footprint = MWAVE::CreateMicrowaveInductor( s_inductor_pattern, this, errorMessage );
-
-        if( footprint )
-        {
-            SetMsgPanel( footprint );
-            footprint->Draw( m_canvas, DC, GR_OR );
-        }
-
-        else if( !errorMessage.IsEmpty() )
-            DisplayError( this, errorMessage );
-
-        return;
-    }
-
-    s_inductor_pattern.m_Start = GetCrossHairPosition();
-    s_inductor_pattern.m_End   = s_inductor_pattern.m_Start;
-
-    s_inductorInProgress = true;
-
-    // Update the initial coordinates.
-    GetScreen()->m_O_Curseur = GetCrossHairPosition();
-    UpdateStatusBar();
-
-    m_canvas->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self );
-    m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
-}
-
-
 MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue,
                                                    int aTextSize, int aPadCount )
 {
@@ -683,81 +562,3 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
     OnModify();
     return module;
 }
-
-
-void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
-{
-    int      gap_size, oX;
-    D_PAD*   pad, * next_pad;
-    wxString msg;
-
-    if( aModule == NULL )
-        return;
-
-    // Test if module is a gap type (name begins with GAP, and has 2 pads).
-    msg = aModule->GetReference().Left( 3 );
-
-    if( msg != wxT( "GAP" ) )
-        return;
-
-    pad = aModule->PadsList();
-
-    if( pad == NULL )
-    {
-        DisplayError( this, _( "No pad for this footprint." ) );
-        return;
-    }
-
-    next_pad = pad->Next();
-
-    if( next_pad == NULL )
-    {
-        DisplayError( this, _( "Only one pad for this footprint." ) );
-        return;
-    }
-
-    aModule->Draw( m_canvas, DC, GR_XOR );
-
-    // Calculate the current dimension.
-    gap_size = next_pad->GetPos0().x - pad->GetPos0().x - pad->GetSize().x;
-
-    // Entrer the desired length of the gap.
-    msg = StringFromValue( GetUserUnits(), gap_size );
-    WX_TEXT_ENTRY_DIALOG dlg( this, _( "Gap:" ), _( "Create Microwave Gap" ), msg );
-
-    if( dlg.ShowModal() != wxID_OK )
-        return; // cancelled by user
-
-    msg = dlg.GetValue();
-    gap_size = ValueFromString( GetUserUnits(), msg );
-
-    // Updating sizes of pads forming the gap.
-    int tw = GetDesignSettings().GetCurrentTrackWidth();
-    pad->SetSize( wxSize( tw, tw ) );
-
-    pad->SetY0( 0 );
-    oX = -( gap_size + pad->GetSize().x ) / 2;
-    pad->SetX0( oX );
-
-    wxPoint padpos = pad->GetPos0() + aModule->GetPosition();
-
-    RotatePoint( &padpos.x, &padpos.y,
-                 aModule->GetPosition().x, aModule->GetPosition().y, aModule->GetOrientation() );
-
-    pad->SetPosition( padpos );
-
-    tw = GetDesignSettings().GetCurrentTrackWidth();
-    next_pad->SetSize( wxSize( tw, tw ) );
-
-    next_pad->SetY0( 0 );
-    next_pad->SetX0( oX + gap_size + next_pad->GetSize().x );
-
-    padpos = next_pad->GetPos0() + aModule->GetPosition();
-
-    RotatePoint( &padpos.x, &padpos.y,
-                 aModule->GetPosition().x, aModule->GetPosition().y, aModule->GetOrientation() );
-
-    next_pad->SetPosition( padpos );
-
-    aModule->Draw( m_canvas, DC, GR_OR );
-}
diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp
deleted file mode 100644
index 7ad07d5e69..0000000000
--- a/pcbnew/move-drag_pads.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-/**
- * @file move-drag_pads.cpp
- * @brief Edit footprint pads.
- */
-
-#include <fctsys.h>
-#include <gr_basic.h>
-#include <common.h>
-#include <class_drawpanel.h>
-#include <trigo.h>
-#include <pcb_base_frame.h>
-
-#include <class_board.h>
-#include <class_module.h>
-
-#include <pcbnew.h>
-#include <drag.h>
-
-
-static wxPoint Pad_OldPos;
-
-
-// Routine to place a moved pad.
-void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
-{
-    int     dX, dY;
-    TRACK*  track;
-
-    if( aPad == NULL )
-        return;
-
-    MODULE* module = aPad->GetParent();
-
-    ITEM_PICKER       picker( NULL, UR_CHANGED );
-    PICKED_ITEMS_LIST pickList;
-
-    // Save dragged track segments in undo list
-    for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-    {
-        track = g_DragSegmentList[ii].m_Track;
-
-        // Set the old state
-        if( g_DragSegmentList[ii].m_Pad_Start )
-            track->SetStart( Pad_OldPos );
-
-        if( g_DragSegmentList[ii].m_Pad_End )
-            track->SetEnd( Pad_OldPos );
-
-        picker.SetItem( track );
-        pickList.PushItem( picker );
-    }
-
-    // Save old module and old items values
-    aPad->ClearFlags();
-    wxPoint pad_curr_position = aPad->GetPosition();
-
-    aPad->SetPosition( Pad_OldPos );
-
-    if( g_DragSegmentList.size() == 0 )
-        SaveCopyInUndoList( module, UR_CHANGED );
-    else
-    {
-        picker.SetItem( module );
-        pickList.PushItem( picker );
-        SaveCopyInUndoList( pickList, UR_CHANGED );
-    }
-
-    aPad->SetPosition( pad_curr_position );
-    aPad->Draw( m_canvas, DC, GR_XOR );
-
-    // Redraw dragged track segments
-    for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-    {
-        track = g_DragSegmentList[ii].m_Track;
-
-        // Set the new state
-        if( g_DragSegmentList[ii].m_Pad_Start )
-            track->SetStart( aPad->GetPosition() );
-
-        if( g_DragSegmentList[ii].m_Pad_End )
-            track->SetEnd( aPad->GetPosition() );
-
-        if( DC )
-            track->Draw( m_canvas, DC, GR_XOR );
-
-        track->SetState( IN_EDIT, false );
-        track->ClearFlags();
-
-        if( DC )
-            track->Draw( m_canvas, DC, GR_OR );
-    }
-
-    // Compute local coordinates (i.e refer to module position and for module orient = 0)
-    dX = aPad->GetPosition().x - Pad_OldPos.x;
-    dY = aPad->GetPosition().y - Pad_OldPos.y;
-
-    RotatePoint( &dX, &dY, -module->GetOrientation() );
-
-    aPad->SetX0( dX + aPad->GetPos0().x );
-    aPad->SetY0( dY + aPad->GetPos0().y );
-
-    if( DC )
-        aPad->Draw( m_canvas, DC, GR_OR );
-
-    module->CalculateBoundingBox();
-    module->SetLastEditTime();
-
-    EraseDragList();
-
-    OnModify();
-    m_canvas->SetMouseCapture( NULL, NULL );
-}
diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp
deleted file mode 100644
index 4a44bf5403..0000000000
--- a/pcbnew/move_or_drag_track.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file move_or_drag_track.cpp
- * @brief Track editing routines to move and drag track segments or node.
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-#include <pcb_edit_frame.h>
-#include <trigo.h>
-#include <macros.h>
-#include <gr_basic.h>
-
-#include <class_board.h>
-
-#include <pcbnew.h>
-#include <drc.h>
-#include <drag.h>
-#include <pcbnew_id.h>
-
-
-static PICKED_ITEMS_LIST s_ItemsListPicker;
-
-
-// Place a dragged (or moved) track segment or via
-bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
-{
-    int        errdrc;
-
-    if( Track == NULL )
-        return false;
-
-    int current_net_code = Track->GetNetCode();
-
-    // DRC control:
-    if( Settings().m_legacyDrcOn )
-    {
-        errdrc = m_drc->DrcOnCreatingTrack( Track, GetBoard()->m_Track );
-
-        if( errdrc == BAD_DRC )
-            return false;
-
-        // Test the dragged segments
-        for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-        {
-            errdrc = m_drc->DrcOnCreatingTrack( g_DragSegmentList[ii].m_Track, GetBoard()->m_Track );
-
-            if( errdrc == BAD_DRC )
-                return false;
-        }
-    }
-
-    // DRC Ok: place track segments
-    Track->ClearFlags();
-    Track->SetState( IN_EDIT, false );
-
-    // Draw dragged tracks
-    for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-    {
-        Track = g_DragSegmentList[ii].m_Track;
-        Track->SetState( IN_EDIT, false );
-        Track->ClearFlags();
-
-        /* Test the connections modified by the move
-         *  (only pad connection must be tested, track connection will be
-         * tested by TestNetConnection() ) */
-        LSET layerMask( Track->GetLayer() );
-
-        Track->start = GetBoard()->GetPadFast( Track->GetStart(), layerMask );
-
-        if( Track->start )
-            Track->SetState( BEGIN_ONPAD, true );
-        else
-            Track->SetState( BEGIN_ONPAD, false );
-
-        Track->end = GetBoard()->GetPadFast( Track->GetEnd(), layerMask );
-
-        if( Track->end )
-            Track->SetState( END_ONPAD, true );
-        else
-            Track->SetState( END_ONPAD, false );
-    }
-
-    EraseDragList();
-
-    SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
-    s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
-
-    GetBoard()->PopHighLight();
-
-    OnModify();
-    m_canvas->SetMouseCapture( NULL, NULL );
-
-    if( current_net_code > 0 )
-        TestNetConnection( DC, current_net_code );
-
-    m_canvas->Refresh();
-
-    return true;
-}
diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp
deleted file mode 100644
index dadfe36589..0000000000
--- a/pcbnew/onleftclick.cpp
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
- * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
- * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-/**
- * @file pcbnew/onleftclick.cpp
- * @brief Functions called when the left button is clicked or double clicked.
- */
-
-#include <fctsys.h>
-#include <class_drawpanel.h>
-#include <confirm.h>
-#include <pcb_edit_frame.h>
-#include <msgpanel.h>
-
-#include <class_board.h>
-#include <class_drawsegment.h>
-#include <class_dimension.h>
-#include <class_zone.h>
-#include <class_pcb_text.h>
-#include <class_text_mod.h>
-#include <class_module.h>
-#include <class_pcb_target.h>
-#include <origin_viewitem.h>
-#include <project.h>
-
-#include <pcbnew.h>
-#include <pcbnew_id.h>
-#include <menus_helpers.h>
-#include <tools/pcb_editor_control.h>
-#include <tools/pcbnew_control.h>
-
-
-/* Handle the left button mouse click, when a tool is active
- */
-void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
-{
-    BOARD_ITEM* curr_item = GetCurItem();
-    bool        exit = false;
-    bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
-
-    if( no_tool || ( curr_item && curr_item->GetEditFlags() ) )
-    {
-        m_canvas->SetAutoPanRequest( false );
-
-        if( curr_item && curr_item->GetEditFlags() ) // Command in progress
-        {
-            m_canvas->SetIgnoreMouseEvents( true );
-            m_canvas->CrossHairOff( aDC );
-
-            switch( curr_item->Type() )
-            {
-            case PCB_ZONE_AREA_T:
-                if( curr_item->IsNew() )
-                {
-                    m_canvas->SetAutoPanRequest( true );
-                    Begin_Zone( aDC );
-                }
-                else
-                {
-                    End_Move_Zone_Corner_Or_Outlines( aDC, static_cast<ZONE_CONTAINER*>( curr_item ) );
-                }
-
-                exit = true;
-                break;
-
-            case PCB_TRACE_T:
-            case PCB_VIA_T:
-                if( curr_item->IsDragging() )
-                {
-                    PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( curr_item ), aDC );
-                    exit = true;
-                }
-
-                break;
-
-            case PCB_TEXT_T:
-                Place_Texte_Pcb( static_cast<TEXTE_PCB*>( curr_item ), aDC );
-                exit = true;
-                break;
-
-            case PCB_MODULE_TEXT_T:
-                PlaceTexteModule( static_cast<TEXTE_MODULE*>( curr_item ), aDC );
-                exit = true;
-                break;
-
-            case PCB_PAD_T:
-                PlacePad( static_cast<D_PAD*>( curr_item ), aDC );
-                exit = true;
-                break;
-
-            case PCB_MODULE_T:
-                PlaceModule( static_cast<MODULE*>( curr_item ), aDC );
-                exit = true;
-                break;
-
-            case PCB_TARGET_T:
-                PlaceTarget( static_cast<PCB_TARGET*>( curr_item ), aDC );
-                exit = true;
-                break;
-
-            case PCB_LINE_T:
-                if( no_tool )   // when no tools: existing item moving.
-                {
-                    Place_DrawItem( static_cast<DRAWSEGMENT*>( curr_item ), aDC );
-                    exit = true;
-                }
-
-                break;
-
-            case PCB_DIMENSION_T:
-                if( ! curr_item->IsNew() )
-                {   // We are moving the text of an existing dimension. Place it
-                    PlaceDimensionText( static_cast<DIMENSION*>( curr_item ), aDC );
-                    exit = true;
-                }
-                break;
-
-            case PCB_MARKER_T:              // MARKER_PCB, a marker used to show something
-                curr_item->ClearFlags();    // Not reason to have flags set
-                exit = true;
-                break;
-
-            default:
-                DisplayError( this,
-                        wxString::Format(
-                        "PCB_EDIT_FRAME::OnLeftClick() err: curr_item type %d m_Flags != 0 (%X)",
-                        curr_item->Type(), curr_item->GetEditFlags() ) );
-                exit = true;
-                break;
-            }
-
-            m_canvas->SetIgnoreMouseEvents( false );
-            m_canvas->CrossHairOn( aDC );
-
-            if( exit )
-                return;
-        }
-        else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
-                && !wxGetKeyState( WXK_CONTROL ) )
-        {
-            curr_item = PcbGeneralLocateAndDisplay();
-
-            if( curr_item )
-                SendMessageToEESCHEMA( curr_item );
-        }
-    }
-
-    if( curr_item ) // display netclass info for zones, tracks and pads
-    {
-        switch( curr_item->Type() )
-        {
-        case PCB_ZONE_AREA_T:
-        case PCB_TRACE_T:
-        case PCB_VIA_T:
-        case PCB_PAD_T:
-            SetCurrentNetClass(
-                ((BOARD_CONNECTED_ITEM*)curr_item)->GetNetClassName() );
-            break;
-
-        default:
-           break;
-        }
-    }
-
-    switch( GetToolId() )
-    {
-    case ID_MAIN_MENUBAR:
-    case ID_NO_TOOL_SELECTED:
-    case ID_ZOOM_SELECTION:
-        break;
-
-    case ID_PCB_HIGHLIGHT_BUTT:
-    {
-        int netcode = SelectHighLight( aDC );
-
-        if( netcode < 0 )
-            SetMsgPanel( GetBoard() );
-        else
-        {
-            NETINFO_ITEM* net = GetBoard()->FindNet( netcode );
-
-            if( net )
-            {
-                MSG_PANEL_ITEMS items;
-                net->GetMsgPanelInfo( m_UserUnits, items );
-                SetMsgPanel( items );
-            }
-        }
-    }
-    break;
-
-    case ID_LOCAL_RATSNEST_BUTT:
-        curr_item = PcbGeneralLocateAndDisplay();
-        Show_1_Ratsnest( curr_item, aDC );
-
-        if( curr_item )
-            SendMessageToEESCHEMA( curr_item );
-
-        break;
-
-    case ID_PCB_TARGET_BUTT:
-        if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
-        {
-            SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) );
-            m_canvas->MoveCursorToCrossHair();
-        }
-        else if( curr_item->Type() == PCB_TARGET_T )
-        {
-            PlaceTarget( (PCB_TARGET*) curr_item, aDC );
-        }
-        else
-        {
-            wxLogDebug( wxT( "OnLeftClick err: not a PCB_TARGET_T" ) );
-        }
-
-        break;
-
-    case ID_PCB_CIRCLE_BUTT:
-    case ID_PCB_ARC_BUTT:
-    case ID_PCB_ADD_LINE_BUTT:
-        {
-            STROKE_T shape = S_SEGMENT;
-
-            if( GetToolId() == ID_PCB_CIRCLE_BUTT )
-                shape = S_CIRCLE;
-
-            if( GetToolId() == ID_PCB_ARC_BUTT )
-                shape = S_ARC;
-
-            if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
-            {
-                curr_item = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC );
-                SetCurItem( curr_item );
-                m_canvas->SetAutoPanRequest( true );
-            }
-            else if( curr_item
-                   && (curr_item->Type() == PCB_LINE_T)
-                   && curr_item->IsNew() )
-            {
-                curr_item = (BOARD_ITEM*) Begin_DrawSegment( (DRAWSEGMENT*) curr_item, shape, aDC );
-                SetCurItem( curr_item );
-                m_canvas->SetAutoPanRequest( true );
-            }
-        }
-        break;
-
-    case ID_TRACK_BUTT:
-        if( !IsCopperLayer( GetActiveLayer() ) )
-        {
-            DisplayError( this, _( "Tracks on Copper layers only" ) );
-            break;
-        }
-
-        if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
-        {
-            curr_item = (BOARD_ITEM*) Begin_Route( NULL, aDC );
-            SetCurItem( curr_item );
-
-            if( curr_item )
-                m_canvas->SetAutoPanRequest( true );
-        }
-        else if( curr_item && curr_item->IsNew() )
-        {
-            TRACK* track = Begin_Route( (TRACK*) curr_item, aDC );
-
-            // SetCurItem() must not write to the msg panel
-            // because a track info is displayed while moving the mouse cursor
-            if( track )  // A new segment was created
-                SetCurItem( curr_item = (BOARD_ITEM*) track, false );
-
-            m_canvas->SetAutoPanRequest( true );
-        }
-
-        break;
-
-    case ID_PCB_ZONES_BUTT:
-    case ID_PCB_KEEPOUT_BUTT:
-        /* ZONE or KEEPOUT Tool is selected. Determine action for a left click:
-         *  this can be start a new zone or select and move an existing zone outline corner
-         *  if found near the mouse cursor
-         */
-        if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
-        {
-            if( Begin_Zone( aDC ) )
-            {
-                m_canvas->SetAutoPanRequest( true );
-                curr_item = GetBoard()->m_CurrentZoneContour;
-                GetScreen()->SetCurItem( curr_item );
-            }
-        }
-        else if( curr_item && (curr_item->Type() == PCB_ZONE_AREA_T) && curr_item->IsNew() )
-        {   // Add a new corner to the current outline being created:
-            m_canvas->SetAutoPanRequest( true );
-            Begin_Zone( aDC );
-            curr_item = GetBoard()->m_CurrentZoneContour;
-            GetScreen()->SetCurItem( curr_item );
-        }
-        else
-        {
-            wxLogDebug( wxT( "PCB_EDIT_FRAME::OnLeftClick() zone internal error" ) );
-        }
-
-        break;
-
-    case ID_PCB_ADD_TEXT_BUTT:
-        if( Edge_Cuts == GetActiveLayer() )
-        {
-            DisplayError( this,
-                          _( "Texts not allowed on Edge Cut layer" ) );
-            break;
-        }
-
-        if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
-        {
-            SetCurItem( CreateTextePcb( aDC ) );
-            m_canvas->MoveCursorToCrossHair();
-            m_canvas->SetAutoPanRequest( true );
-        }
-        else if( curr_item->Type() == PCB_TEXT_T )
-        {
-            Place_Texte_Pcb( (TEXTE_PCB*) curr_item, aDC );
-            m_canvas->SetAutoPanRequest( false );
-        }
-        else
-        {
-            wxLogDebug( wxT( "OnLeftClick err: not a PCB_TEXT_T" ) );
-        }
-
-        break;
-
-    case ID_PCB_DIMENSION_BUTT:
-        if( IsCopperLayer( GetActiveLayer() ) || GetActiveLayer() == Edge_Cuts )
-        {
-            DisplayError( this, _( "Dimension not allowed on Copper or Edge Cut layers" ) );
-            break;
-        }
-
-        if( !curr_item || !curr_item->GetEditFlags() )
-        {
-            curr_item = (BOARD_ITEM*) EditDimension( NULL, aDC );
-            SetCurItem( curr_item );
-            m_canvas->SetAutoPanRequest( true );
-        }
-        else if( curr_item && (curr_item->Type() == PCB_DIMENSION_T) && curr_item->IsNew() )
-        {
-            curr_item = (BOARD_ITEM*) EditDimension( (DIMENSION*) curr_item, aDC );
-            SetCurItem( curr_item );
-            m_canvas->SetAutoPanRequest( true );
-        }
-        else
-        {
-            wxLogDebug( wxT( "PCB_EDIT_FRAME::OnLeftClick() error item is not a DIMENSION" ) );
-        }
-
-        break;
-
-    case ID_PCB_DELETE_ITEM_BUTT:
-        if( !curr_item || !curr_item->GetEditFlags() )
-        {
-            curr_item = PcbGeneralLocateAndDisplay();
-
-            if( curr_item && curr_item->GetEditFlags() == 0 )
-            {
-                RemoveStruct( curr_item, aDC );
-                SetCurItem( curr_item = NULL );
-            }
-        }
-
-        break;
-
-    case ID_PCB_PLACE_OFFSET_COORD_BUTT:
-        PCB_EDITOR_CONTROL::SetDrillOrigin( GetGalCanvas()->GetView(), this,
-                                            new KIGFX::ORIGIN_VIEWITEM( GetAuxOrigin(), UR_TRANSIENT ),
-                                            GetCrossHairPosition() );
-        m_canvas->Refresh();
-        break;
-
-    case ID_PCB_PLACE_GRID_COORD_BUTT:
-        PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
-                                       new KIGFX::ORIGIN_VIEWITEM( GetBoard()->GetGridOrigin(), UR_TRANSIENT ),
-                                       GetCrossHairPosition() );
-        m_canvas->Refresh();
-        break;
-
-    case ID_PCB_DRAW_VIA_BUTT:
-        DisplayError( this, _( "Via Tool not available in Legacy Toolset" ) );
-        SetNoToolSelected();
-        break;
-
-    case ID_PCB_MEASUREMENT_TOOL:
-        DisplayError( this, _( "Measurement Tool not available in Legacy Toolset" ) );
-        SetNoToolSelected();
-        break;
-
-    default:
-        wxLogDebug( wxT( "PCB_EDIT_FRAME::OnLeftClick() id error" ) );
-        SetNoToolSelected();
-        break;
-    }
-}
-
-
-/* handle the double click on the mouse left button
- */
-void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
-{
-    BOARD_ITEM* curr_item = GetCurItem();
-
-    switch( GetToolId() )
-    {
-    case ID_NO_TOOL_SELECTED:
-        if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
-            curr_item = PcbGeneralLocateAndDisplay();
-
-        if( curr_item == NULL || curr_item->GetEditFlags() != 0 )
-            break;
-
-        SendMessageToEESCHEMA( curr_item );
-
-        // An item is found
-        SetCurItem( curr_item );
-
-        switch( curr_item->Type() )
-        {
-        case PCB_TRACE_T:
-        case PCB_VIA_T:
-            if( curr_item->IsNew() )
-            {
-                if( End_Route( (TRACK*) curr_item, aDC ) )
-                    m_canvas->SetAutoPanRequest( false );
-            }
-            else if( curr_item->GetEditFlags() == 0 )
-            {
-                Edit_TrackSegm_Width( aDC, (TRACK*) curr_item );
-            }
-
-            break;
-
-        case PCB_TEXT_T:
-        case PCB_PAD_T:
-        case PCB_MODULE_T:
-        case PCB_TARGET_T:
-        case PCB_DIMENSION_T:
-        case PCB_MODULE_TEXT_T:
-            OnEditItemRequest( aDC, curr_item );
-            m_canvas->MoveCursorToCrossHair();
-            break;
-
-        case PCB_LINE_T:
-            OnEditItemRequest( aDC, curr_item );
-            break;
-
-        case PCB_ZONE_AREA_T:
-            if( curr_item->GetEditFlags() )
-                break;
-
-            OnEditItemRequest( aDC, curr_item );
-            break;
-
-        default:
-            break;
-        }
-
-        break;      // end case 0
-
-    case ID_TRACK_BUTT:
-        if( curr_item && curr_item->IsNew() )
-        {
-            if( End_Route( (TRACK*) curr_item, aDC ) )
-                m_canvas->SetAutoPanRequest( false );
-        }
-
-        break;
-
-    case ID_PCB_ZONES_BUTT:
-    case ID_PCB_KEEPOUT_BUTT:
-        if( End_Zone( aDC ) )
-        {
-            m_canvas->SetAutoPanRequest( false );
-            SetCurItem( NULL );
-        }
-
-        break;
-
-    case ID_PCB_ADD_LINE_BUTT:
-    case ID_PCB_ARC_BUTT:
-    case ID_PCB_CIRCLE_BUTT:
-        if( curr_item == NULL )
-            break;
-
-        if( curr_item->Type() != PCB_LINE_T )
-        {
-            DisplayErrorMessage( this, "Item type is incorrect",
-                                 wxString::Format( "Selected item type is %d\n"
-                                         "Expected: %d", curr_item->Type(), PCB_LINE_T ) );
-            m_canvas->SetAutoPanRequest( false );
-            break;
-        }
-
-        if( curr_item->IsNew() )
-        {
-            End_Edge( (DRAWSEGMENT*) curr_item, aDC );
-            m_canvas->SetAutoPanRequest( false );
-            SetCurItem( NULL );
-        }
-
-        break;
-    }
-}
-
-
-void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
-{
-    switch( aItem->Type() )
-    {
-    case PCB_TRACE_T:
-    case PCB_VIA_T:
-        Edit_TrackSegm_Width( aDC, static_cast<TRACK*>( aItem ) );
-        break;
-
-    case PCB_TEXT_T:
-        InstallTextOptionsFrame( aItem, aDC );
-        break;
-
-    case PCB_PAD_T:
-        InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
-        break;
-
-    case PCB_MODULE_T:
-        InstallFootprintPropertiesDialog( static_cast<MODULE*>( aItem ), aDC );
-        break;
-
-    case PCB_TARGET_T:
-        ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ), aDC );
-        break;
-
-    case PCB_DIMENSION_T:
-        ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ), aDC );
-        break;
-
-    case PCB_MODULE_TEXT_T:
-        InstallTextOptionsFrame( aItem, aDC );
-        break;
-
-    case PCB_LINE_T:
-        InstallGraphicItemPropertiesDialog( aItem );
-        break;
-
-    case PCB_ZONE_AREA_T:
-        Edit_Zone_Params( aDC, static_cast<ZONE_CONTAINER*>( aItem ) );
-        break;
-
-    default:
-        break;
-    }
-}
diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index a4dfc5f374..b547cc45b9 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -217,14 +217,6 @@ protected:
      */
     virtual bool isAutoSaveRequired() const override;
 
-    /**
-     * Function duplicateZone
-     * duplicates the given zone.
-     * @param aDC is the current Device Context.
-     * @param aZone is the zone to duplicate
-     */
-    void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
-
     /**
      * Function moveExact
      * Move the selected item exactly
@@ -469,38 +461,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
 
-    /**
-     * Function OnHotKey.
-     *  ** Commands are case insensitive **
-     *  Some commands are relatives to the item under the mouse cursor
-     * @param aDC = current device context
-     * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
-     * @param aPosition The cursor position in logical (drawing) units.
-     * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
-     */
-    bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
-
-    /**
-     * Function OnHotkeyDuplicateOrArrayItem
-     * Duplicate an item (optionally incrementing if necessary and possible)
-     * or invoke array dialog and create an array
-     * @param aIdCommand = the hotkey command id
-     * @return true if item duplicated or arrayed
-     */
-    bool OnHotkeyDuplicateOrArrayItem( int aIdCommand );
-
-    /**
-     * Function OnHotkeyBeginRoute
-     * If the current active layer is a copper layer,
-     * and if no item currently edited, start a new track segmenton
-     * the current copper layer.
-     * If a new track is in progress, terminate the current segment and
-     * start a new one.
-     * @param aDC = current device context
-     * @return a reference to the track if a track is created, or NULL
-     */
-    TRACK * OnHotkeyBeginRoute( wxDC* aDC );
-
     void OnCloseWindow( wxCloseEvent& Event ) override;
     void Process_Special_Functions( wxCommandEvent& event );
     void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
@@ -615,8 +575,6 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
     void UseGalCanvas( bool aEnable ) override;
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
-
     /**
      * Function ShowBoardSetupDialog
      */
@@ -628,10 +586,6 @@ public:
 
     void PrepareLayerIndicator();
 
-    /* mouse functions events: */
-    void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
-    void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
-
     void OnSelectOptionToolbar( wxCommandEvent& event );
     void OnFlipPcbView( wxCommandEvent& event );
     void ToolOnRightClick( wxCommandEvent& event ) override;
@@ -952,51 +906,12 @@ public:
 
     void Swap_Layers( wxCommandEvent& event );
 
-    // Handling texts on the board
-    void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
-    void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC );
-    TEXTE_PCB* CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText = NULL );
-    void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
-    void StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aErase = true );
-    void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
-
     // Graphic Segments type DRAWSEGMENT
     void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
-    void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
 
     // Footprint editing (see also PCB_BASE_FRAME)
     void InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC );
 
-    /**
-     * Function StartMoveModule
-     * Initialize a drag or move pad command
-     * @param aModule = the module to move or drag
-     * @param aDC = the current device context
-     * @param aDragConnectedTracks = true to drag connected tracks,
-     *                               false to just move the module
-     */
-    void StartMoveModule( MODULE* aModule, wxDC* aDC, bool aDragConnectedTracks );
-
-    /**
-     * Function Delete Module
-     * Remove a footprint from m_Modules linked list and put it in undelete buffer
-     * The ratsnest and pad list are recalculated
-     * @param aModule = footprint to delete
-     * @param aDC = currentDevice Context. if NULL: do not redraw new ratsnest
-     */
-    bool Delete_Module( MODULE* aModule, wxDC* aDC );
-
-    /**
-     * Function Change_Side_Module
-     * Flip a footprint (switch layer from component or component to copper)
-     * The mirroring is made from X axis
-     * if a footprint is not on copper or component layer it is not flipped
-     * (it could be on an adhesive layer, not supported at this time)
-     * @param Module the footprint to flip
-     * @param  DC Current Device Context. if NULL, no redraw
-     */
-    void Change_Side_Module( MODULE* Module, wxDC* DC );
-
     int InstallExchangeModuleFrame( MODULE* aModule, bool updateMode, bool selectedMode );
 
     /**
@@ -1014,9 +929,6 @@ public:
 
     // loading modules: see PCB_BASE_FRAME
 
-    // Board handling
-    void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
-
     /**
      * Function OnEditItemRequest
      * Install the corresponding dialog editor for the given item
@@ -1025,12 +937,6 @@ public:
      */
     void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) override;
 
-    /**
-     * Locate track or pad and highlight the corresponding net.
-     * @return The Netcode, or -1 if no net located.
-     */
-    int SelectHighLight( wxDC* DC );
-
     /**
      * Function HighLight.
      * highlights the net at the current cursor position.
@@ -1117,21 +1023,6 @@ public:
      */
     TRACK* Begin_Route( TRACK* aTrack, wxDC* aDC );
 
-    /**
-     * Function End_Route
-     * Terminates a track currently being created
-     * @param aTrack = the current track segment in progress
-     * @param aDC = the current device context
-     * @return true if the track was created, false if not (due to a DRC error)
-     */
-    bool End_Route( TRACK* aTrack, wxDC* aDC );
-
-    void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
-    void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
-    void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
-
-    bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC );
-
     void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override;
 
     /**
@@ -1185,34 +1076,6 @@ public:
 
     // zone handling
 
-    /**
-     * Function Delete_LastCreatedCorner
-     * Used only while creating a new zone outline
-     * Remove and delete the current outline segment in progress
-     * @return 0 if no corner in list, or corner number
-     */
-    int Delete_LastCreatedCorner( wxDC* DC );
-
-    /**
-     * Function Begin_Zone
-     * either initializes the first segment of a new zone, or adds an
-     * intermediate segment.
-     * A new zone can be:
-     * created from scratch: the user will be prompted to define parameters (layer, clearence ...)
-     * created from a similar zone (s_CurrentZone is used): parameters are copied from
-     * s_CurrentZone
-     * created as a cutout (an hole) inside s_CurrentZone
-     */
-    int Begin_Zone( wxDC* DC );
-
-    /**
-     * Function End_Zone
-     * terminates (if no DRC error ) the zone edge creation process
-     * @param DC = current Device Context
-     * @return true if Ok, false if DRC error
-     */
-    bool End_Zone( wxDC* DC );
-
     /**
      * Function Fill_Zone
      *  Calculate the zone filling for the outline zone_container
@@ -1236,63 +1099,12 @@ public:
     void Check_All_Zones( wxWindow* aActiveWindow );
 
 
-    /**
-     * Function Add_Zone_Cutout
-     * Add a cutout zone to a given zone outline
-     * @param DC = current Device Context
-     * @param zone_container = parent zone outline
-     */
-    void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
-
-    /**
-     * Function Add_Similar_Zone
-     * Add a zone to a given zone outline.
-     * if the zones are overlapping they will be merged
-     * @param DC = current Device Context
-     * @param zone_container = parent zone outline
-     */
-    void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
-
     /**
      * Function Edit_Zone_Params
      * Edit params (layer, clearance, ...) for a zone outline
      */
     void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container );
 
-    /**
-     * Function Start_Move_Zone_Corner
-     * Prepares a move corner in a zone outline,
-     * called from a move corner command (IsNewCorner = false),
-     * or a create new cornet command (IsNewCorner = true )
-     */
-    void Start_Move_Zone_Corner( wxDC*           DC,
-                                 ZONE_CONTAINER* zone_container,
-                                 int             corner_id,
-                                 bool            IsNewCorner );
-
-    /**
-     * Function Start_Move_Zone_Corner
-     * Prepares a drag edge in an existing zone outline,
-     */
-    void Start_Move_Zone_Drag_Outline_Edge( wxDC*            DC,
-                                            ZONE_CONTAINER* zone_container,
-                                            int             corner_id );
-
-    /**
-     * Function End_Move_Zone_Corner_Or_Outlines
-     * Terminates a move corner in a zone outline, or a move zone outlines
-     * @param DC = current Device Context (can be NULL)
-     * @param zone_container: the given zone
-     */
-    void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
-
-    /**
-     * Function End_Move_Zone_Corner_Or_Outlines
-     * Remove the currently selected corner in a zone outline
-     * the .m_CornerSelection is used as corner selection
-     */
-    void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
-
     /**
      * Function Delete_Zone
      * Remove the zone which include the segment aZone, or the zone which have
@@ -1306,24 +1118,12 @@ public:
      */
     void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
 
-    /**
-     * Function Start_Move_Zone_Outlines
-     * Initialize parameters to move an existing zone outlines.
-     * @param DC = current Device Context (can be NULL)
-     * @param zone_container: the given zone to move
-     */
-    void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
-
     // Target handling
     PCB_TARGET* CreateTarget( wxDC* DC );
     void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
     void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
     void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
 
-    // Graphic segments type DRAWSEGMENT handling:
-    DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
-    void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
-    void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
 
     // Dimension handling:
     void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
@@ -1461,13 +1261,6 @@ public:
      */
     void SendCrossProbeNetName( const wxString& aNetName );
 
-    /**
-     * Function Edit_Gap
-     * edits the GAP module if it has changed the position and/or size of the pads that
-     * form the gap get a new value.
-     */
-    void Edit_Gap( wxDC* DC, MODULE* Module );
-
     /**
      * Function CreateMuWaveBaseFootprint
      * create a basic footprint for micro wave applications.
@@ -1490,8 +1283,6 @@ public:
 
     MODULE* Create_MuWavePolygonShape();
 
-    void Begin_Self( wxDC* DC );
-
     void ShowChangedLanguage() override;
 
     /**
diff --git a/pcbnew/pcb_footprint_edit_utils.cpp b/pcbnew/pcb_footprint_edit_utils.cpp
index 4772608913..0d52345e37 100644
--- a/pcbnew/pcb_footprint_edit_utils.cpp
+++ b/pcbnew/pcb_footprint_edit_utils.cpp
@@ -24,10 +24,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-/**
- * @file modules.cpp
- */
-
 #include <fctsys.h>
 #include <gr_basic.h>
 #include <class_drawpanel.h>
@@ -35,28 +31,18 @@
 #include <pcb_edit_frame.h>
 #include <trigo.h>
 #include <macros.h>
-
 #include <class_board.h>
 #include <class_module.h>
-
 #include <pcbnew.h>
 #include <drag.h>
 #include <dialog_get_footprint_by_name.h>
 
 #include <connectivity/connectivity_data.h>
 
-static void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                           const wxPoint& aPosition, bool aErase );
-static void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC );
+static MODULE*           s_ModuleInitialCopy = NULL;   // Copy of module for abort/undo command
 
-
-static MODULE*           s_ModuleInitialCopy = NULL;    /* Copy of module for
-                                                         * abort/undo command
-                                                         */
-static PICKED_ITEMS_LIST s_PickedList;                  /* a picked list to
-                                                         * save initial module
-                                                         * and dragged tracks
-                                                         */
+static PICKED_ITEMS_LIST s_PickedList;                 // a pick-list to save initial module
+                                                       //   and dragged tracks
 
 
 MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
@@ -97,258 +83,6 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
 }
 
 
-void PCB_EDIT_FRAME::StartMoveModule( MODULE* aModule, wxDC* aDC,
-                                      bool aDragConnectedTracks )
-{
-    if( aModule == NULL )
-        return;
-
-    if( s_ModuleInitialCopy )
-        delete s_ModuleInitialCopy;
-
-    s_PickedList.ClearItemsList();  // Should be empty, but...
-
-    // Creates a copy of the current module, for abort and undo commands
-    s_ModuleInitialCopy = (MODULE*)aModule->Clone();
-    s_ModuleInitialCopy->SetParent( GetBoard() );
-    s_ModuleInitialCopy->ClearFlags();
-
-    SetCurItem( aModule );
-    GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
-    aModule->SetFlags( IS_MOVED );
-
-    /* Show ratsnest. */
-    if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
-        DrawGeneralRatsnest( aDC );
-
-    EraseDragList();
-
-    if( aDragConnectedTracks )
-    {
-        DRAG_LIST drglist( GetBoard() );
-        drglist.BuildDragListe( aModule );
-
-        ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
-
-        for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-        {
-            TRACK* segm = g_DragSegmentList[ii].m_Track;
-            itemWrapper.SetItem( segm );
-            itemWrapper.SetLink( segm->Clone() );
-            itemWrapper.GetLink()->SetState( IN_EDIT, false );
-            s_PickedList.PushItem( itemWrapper );
-        }
-
-        UndrawAndMarkSegmentsToDrag( m_canvas, aDC );
-    }
-
-    GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
-    m_canvas->SetMouseCapture( MoveFootprint, Abort_MoveOrCopyModule );
-    m_canvas->SetAutoPanRequest( true );
-
-    // Erase the module.
-    if( aDC )
-    {
-        aModule->SetFlags( DO_NOT_DRAW );
-        m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
-        aModule->ClearFlags( DO_NOT_DRAW );
-    }
-
-    m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
-}
-
-
-/* Called on a move or copy module command abort
- */
-void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
-    TRACK*               pt_segm;
-    MODULE*              module;
-    PCB_EDIT_FRAME*      pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
-
-    module = (MODULE*) pcbframe->GetScreen()->GetCurItem();
-    pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
-    Panel->SetMouseCapture( NULL, NULL );
-
-    if( module )
-    {
-        // Erase the current footprint on screen
-        module->DrawOutlinesWhenMoving( Panel, DC, g_Offset_Module );
-
-        /* If a move command: return to old position
-         * If a copy command, delete the new footprint
-         */
-        if( module->IsMoving() )
-        {
-            /* Restore old position for dragged tracks */
-            for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
-            {
-                pt_segm = g_DragSegmentList[ii].m_Track;
-                pt_segm->Draw( Panel, DC, GR_XOR );
-                pt_segm->SetState( IN_EDIT, false );
-                pt_segm->ClearFlags();
-                g_DragSegmentList[ii].RestoreInitialValues();
-                pt_segm->Draw( Panel, DC, GR_OR );
-            }
-
-            EraseDragList();
-            module->ClearFlags( IS_MOVED );
-        }
-
-        if( module->IsNew() )  // Copy command: delete new footprint
-        {
-            module->DeleteStructure();
-            module = NULL;
-            pcbframe->GetBoard()->m_Status_Pcb = 0;
-            pcbframe->GetBoard()->BuildListOfNets();
-        }
-    }
-
-    /* Redraw the module. */
-    if( module && s_ModuleInitialCopy )
-    {
-        if( s_ModuleInitialCopy->GetOrientation() != module->GetOrientation() )
-            pcbframe->Rotate_Module( NULL, module, s_ModuleInitialCopy->GetOrientation(), false );
-
-        if( s_ModuleInitialCopy->GetLayer() != module->GetLayer() )
-            pcbframe->Change_Side_Module( module, NULL );
-
-        module->Draw( Panel, DC, GR_OR );
-    }
-
-    pcbframe->SetCurItem( NULL );
-
-    delete s_ModuleInitialCopy;
-    s_ModuleInitialCopy = NULL;
-    s_PickedList.ClearListAndDeleteItems();
-
-    // Display ratsnest is allowed
-    pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
-
-    if( pcbframe->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
-        pcbframe->DrawGeneralRatsnest( DC );
-
-#ifdef __WXMAC__
-    Panel->Refresh();
-#endif
-}
-
-
-/* Redraw the footprint when moving the mouse.
- */
-void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
-{
-    MODULE* module = (MODULE*) aPanel->GetScreen()->GetCurItem();
-
-    if( module == NULL )
-        return;
-
-    /* Erase current footprint. */
-    if( aErase )
-    {
-        module->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
-    }
-
-    /* Redraw the module at the new position. */
-    g_Offset_Module = module->GetPosition() - aPanel->GetParent()->GetCrossHairPosition();
-    module->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
-
-    DrawSegmentWhileMovingFootprint( aPanel, aDC );
-}
-
-
-bool PCB_EDIT_FRAME::Delete_Module( MODULE* aModule, wxDC* aDC )
-{
-    wxString msg;
-
-    if( aModule == NULL )
-        return false;
-
-    SetMsgPanel( aModule );
-
-    /* Remove module from list, and put it in undo command list */
-    m_Pcb->Remove( aModule );
-    aModule->SetState( IS_DELETED, true );
-    SaveCopyInUndoList( aModule, UR_DELETED );
-
-    if( aDC && GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
-        Compile_Ratsnest( aDC, true );
-
-    // Redraw the full screen to ensure perfect display of board and ratsnest.
-    if( aDC )
-        m_canvas->Refresh();
-
-    OnModify();
-
-    return true;
-}
-
-
-void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
-{
-    if( Module == NULL )
-        return;
-
-    if( ( Module->GetLayer() != F_Cu ) && ( Module->GetLayer() != B_Cu ) )
-        return;
-
-    OnModify();
-
-    if( !Module->IsMoving() )        // This is a simple flip, no other edit in progress
-    {
-
-        if( DC )
-        {
-            Module->SetFlags( DO_NOT_DRAW );
-            m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
-            Module->ClearFlags( DO_NOT_DRAW );
-        }
-
-        /* Show ratsnest if necessary. */
-        if( DC && GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
-            DrawGeneralRatsnest( DC );
-
-        g_Offset_Module.x = 0;
-        g_Offset_Module.y = 0;
-    }
-    else    // Module is being moved.
-    {
-        /* Erase footprint and draw outline if it has been already drawn. */
-        if( DC )
-        {
-            Module->DrawOutlinesWhenMoving( m_canvas, DC, g_Offset_Module );
-            DrawSegmentWhileMovingFootprint( m_canvas, DC );
-        }
-    }
-
-    /* Flip the module */
-    Module->Flip( Module->GetPosition() );
-    m_Pcb->GetConnectivity()->Update( Module );
-    SetMsgPanel( Module );
-
-    if( !Module->IsMoving() ) /* Inversion simple */
-    {
-        if( DC )
-        {
-            Module->Draw( m_canvas, DC, GR_OR );
-
-            if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
-                Compile_Ratsnest( DC, true );
-        }
-    }
-    else
-    {
-        if( DC )
-        {
-            Module->DrawOutlinesWhenMoving( m_canvas, DC, g_Offset_Module );
-            DrawSegmentWhileMovingFootprint( m_canvas, DC );
-        }
-
-    }
-    m_Pcb->GetConnectivity()->Update( Module );
-}
-
-
 void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aRecreateRatsnest )
 {
     wxPoint newpos;
diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h
index 5d4fb2eb67..5a2a6c2012 100644
--- a/pcbnew/pcbnew_id.h
+++ b/pcbnew/pcbnew_id.h
@@ -57,26 +57,7 @@ enum pcbnew_ids
     ID_MENU_PCB_FLIP_VIEW,
 
     ID_POPUP_PCB_START_RANGE,
-
-    ID_POPUP_PCB_MOVE_EXACT,
-    ID_POPUP_PCB_CREATE_ARRAY,
-
-    ID_POPUP_PCB_END_LINE,
-
-    ID_POPUP_PCB_FILL_ALL_ZONES,
-    ID_POPUP_PCB_FILL_ZONE,
-    ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES,
-    ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
-
-    ID_POPUP_PCB_PLACE_THROUGH_VIA,
-    ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA,
-    ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA,
-    ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA,
-    ID_POPUP_PCB_PLACE_MICROVIA,
-    ID_POPUP_PCB_SWITCH_TRACK_POSTURE,
-
     ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
-
     ID_POPUP_PCB_END_RANGE,
 
     // Tracks and vias sizes general options
@@ -203,7 +184,6 @@ enum pcbnew_ids
 
     ID_DRC_CONTROL,
     ID_PCB_GLOBAL_DELETE,
-    ID_POPUP_PCB_DELETE_TRACKSEG,
     ID_TOOLBARH_PCB_SELECT_LAYER,
 
     // Module editor right vertical tool bar commands.
@@ -237,14 +217,9 @@ enum pcbnew_ids
     ID_MODEDIT_PAD_SETTINGS,
     ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
     ID_MODEDIT_EDIT_MODULE_PROPERTIES,
-    ID_MODEDIT_TRANSFORM_MODULE,
-    ID_MODEDIT_MODULE_ROTATE,
-    ID_MODEDIT_MODULE_MIRROR,
-    ID_MODEDIT_MODULE_MOVE_EXACT,
     ID_MODEDIT_IMPORT_PART,
     ID_MODEDIT_EXPORT_PART,
     ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
-    ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
 
     ID_MODVIEW_LIB_LIST,
     ID_MODVIEW_FOOTPRINT_LIST,
diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp
index 16e594f4f0..1b8833d27a 100644
--- a/pcbnew/zones_by_polygon.cpp
+++ b/pcbnew/zones_by_polygon.cpp
@@ -24,10 +24,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-/**
- * @file zones_by_polygon.cpp
- */
-
 #include <fctsys.h>
 #include <kiface_i.h>
 #include <class_drawpanel.h>
@@ -51,817 +47,11 @@
 
 #include <zone_filler.h>
 
-// Outline creation:
-static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC );
-static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                                            const wxPoint& aPosition, bool aErase );
-
-// Corner moving
-static void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC );
-static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel,
-                                                          wxDC*           aDC,
-                                                          const wxPoint&  aPosition,
-                                                          bool            aErase );
-
 // Local variables
-static wxPoint         s_CornerInitialPosition;     // Used to abort a move corner command
-static bool            s_CornerIsNew;               // Used to abort a move corner command (if it is a new corner, it must be deleted)
-static bool            s_AddCutoutToCurrentZone;    // if true, the next outline will be added to s_CurrentZone
-static ZONE_CONTAINER* s_CurrentZone;               // if != NULL, these ZONE_CONTAINER params will be used for the next zone
-static wxPoint         s_CursorLastPosition;        // in move zone outline, last cursor position. Used to calculate the move vector
-static PICKED_ITEMS_LIST s_PickedList;              // a picked list to save zones for undo/redo command
-static PICKED_ITEMS_LIST s_AuxiliaryList;           // a picked list to store zones that are deleted or added when combined
+static PICKED_ITEMS_LIST s_PickedList;    // a picked list to save zones for undo/redo command
+static PICKED_ITEMS_LIST s_AuxiliaryList; // a picked list to store zones that are deleted or added when combined
 
 
-void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* aZone )
-{
-    if( !aZone )
-        return;
-
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = aZone;
-
-    // set zone settings to the current zone
-    ZONE_SETTINGS  zoneInfo = GetZoneSettings();
-    zoneInfo << *aZone;
-    SetZoneSettings( zoneInfo );
-
-    // Use the general event handler to set others params (like toolbar)
-    wxCommandEvent evt;
-    evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_BUTT : ID_PCB_ZONES_BUTT );
-    OnSelectTool( evt );
-}
-
-
-void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone )
-{
-    if( !aZone )
-        return;
-
-    s_AddCutoutToCurrentZone = true;
-    s_CurrentZone = aZone;
-
-    // set zones setup to the current zone
-    ZONE_SETTINGS zoneInfo = GetZoneSettings();
-    zoneInfo << *aZone;
-    SetZoneSettings( zoneInfo );
-
-    // Use the general event handle to set others params (like toolbar)
-    wxCommandEvent evt;
-    evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_BUTT : ID_PCB_ZONES_BUTT );
-    OnSelectTool( evt );
-}
-
-
-void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
-{
-    ZONE_SETTINGS zoneSettings;
-    zoneSettings << *aZone;
-    int dialogResult;
-
-    if( aZone->GetIsKeepout() )
-        dialogResult = InvokeKeepoutAreaEditor( this, &zoneSettings );
-    else if( aZone->IsOnCopperLayer() )
-        dialogResult = InvokeCopperZonesEditor( this, &zoneSettings );
-    else
-        dialogResult = InvokeNonCopperZonesEditor( this, &zoneSettings );
-
-    if( dialogResult != wxID_OK )
-        return;
-
-    // If the new zone is on the same layer as the the initial zone we'll end up combining
-    // them which will result in a no-op.  Might as well exit here.
-    if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) )
-    {
-        DisplayErrorMessage( this, _( "The duplicated zone cannot be on the same layers as the original zone." ) );
-        return;
-    }
-    else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
-    {
-        DisplayErrorMessage( this, _(  "The duplicated zone cannot be on the same layer as the original zone." ) );
-        return;
-    }
-
-    ZONE_CONTAINER* newZone = new ZONE_CONTAINER( *aZone );
-    newZone->UnFill();
-    zoneSettings.ExportSetting( *newZone );
-    newZone->Hatch();
-
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    s_PickedList.ClearListAndDeleteItems();
-    SaveCopyOfZones( s_PickedList, GetBoard(), newZone->GetNetCode(), newZone->GetLayer() );
-    GetBoard()->Add( newZone );
-
-    ITEM_PICKER picker( newZone, UR_NEW );
-    s_PickedList.PushItem( picker );
-
-    GetScreen()->SetCurItem( NULL );       // This outline may be deleted when merging outlines
-
-    // Combine zones if possible
-    GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, newZone );
-
-    // Redraw zones
-    GetBoard()->RedrawAreasOutlines( m_canvas, aDC, GR_OR, newZone->GetLayer() );
-    GetBoard()->RedrawFilledAreas( m_canvas, aDC, GR_OR, newZone->GetLayer() );
-
-    DRC drc( this );
-
-    if( GetBoard()->GetAreaIndex( newZone ) >= 0 && drc.TestZoneToZoneOutline( newZone, true ) )
-        DisplayInfoMessage( this, _( "Warning: The new zone fails DRC" ) );
-
-    UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
-    SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED );
-    s_PickedList.ClearItemsList();
-
-    OnModify();
-}
-
-
-int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC )
-{
-    ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
-
-    if( !zone )
-        return 0;
-
-    if( !zone->GetNumCorners() )
-        return 0;
-
-    zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR );
-
-    if( zone->GetNumCorners() > 2 )
-    {
-        zone->Outline()->RemoveVertex( zone->GetNumCorners() - 1 );
-
-        if( m_canvas->IsMouseCaptured() )
-            m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
-    }
-    else
-    {
-        m_canvas->SetMouseCapture( NULL, NULL );
-        SetCurItem( NULL );
-        zone->RemoveAllContours();
-        zone->ClearFlags();
-    }
-
-    return zone->GetNumCorners();
-}
-
-
-/**
- * Function Abort_Zone_Create_Outline
- * cancels the Begin_Zone command if at least one EDGE_ZONE was created.
- */
-static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
-    PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
-    ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
-
-    if( zone )
-    {
-        zone->DrawWhileCreateOutline( Panel, DC, GR_XOR );
-        zone->RemoveAllContours();
-        if( zone->IsNew() )
-        {
-            delete zone;
-            pcbframe->GetBoard()->m_CurrentZoneContour = NULL;
-        }
-        else
-            zone->ClearFlags();
-    }
-
-    pcbframe->SetCurItem( NULL );
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-    Panel->SetMouseCapture( NULL, NULL );
-}
-
-
-void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone,
-                                             int corner_id, bool IsNewCorner )
-{
-    if( aZone->IsOnCopperLayer() ) // Show the Net
-    {
-        if( GetBoard()->IsHighLightNetON() && DC )
-        {
-            HighLight( DC );  // Remove old highlight selection
-        }
-
-        ZONE_SETTINGS zoneInfo = GetZoneSettings();
-        zoneInfo.m_NetcodeSelection = aZone->GetNetCode();
-        SetZoneSettings( zoneInfo );
-
-        GetBoard()->SetHighLightNet( aZone->GetNetCode() );
-
-        if( DC )
-            HighLight( DC );
-    }
-
-
-    // Prepare copy of old zones, for undo/redo.
-    // if the corner is new, remove it from list, save and insert it in list
-    VECTOR2I corner = aZone->Outline()->Vertex( corner_id );
-
-    if ( IsNewCorner )
-        aZone->Outline()->RemoveVertex( corner_id );
-
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    s_PickedList.ClearListAndDeleteItems();
-
-    SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
-
-    if ( IsNewCorner )
-        aZone->Outline()->InsertVertex(corner_id-1, corner );
-
-    aZone->SetFlags( IN_EDIT );
-    m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
-                                Abort_Zone_Move_Corner_Or_Outlines );
-    s_CornerInitialPosition = static_cast<wxPoint>( aZone->GetCornerPosition( corner_id ) );
-    s_CornerIsNew = IsNewCorner;
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-}
-
-
-void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC*           DC,
-                                                        ZONE_CONTAINER* aZone,
-                                                        int             corner_id )
-{
-    aZone->SetFlags( IS_DRAGGED );
-    aZone->SetSelectedCorner( corner_id );
-    m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
-                                Abort_Zone_Move_Corner_Or_Outlines );
-    s_CursorLastPosition     = s_CornerInitialPosition = GetCrossHairPosition();
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-
-    s_PickedList.ClearListAndDeleteItems();
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
-}
-
-
-void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* aZone )
-{
-    // Show the Net
-    if( aZone->IsOnCopperLayer() ) // Show the Net
-    {
-        if( GetBoard()->IsHighLightNetON() )
-        {
-            HighLight( DC );  // Remove old highlight selection
-        }
-
-        ZONE_SETTINGS zoneInfo = GetZoneSettings();
-        zoneInfo.m_NetcodeSelection = aZone->GetNetCode();
-        SetZoneSettings( zoneInfo );
-
-        GetBoard()->SetHighLightNet( aZone->GetNetCode() );
-        HighLight( DC );
-    }
-
-    s_PickedList.ClearListAndDeleteItems();
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
-
-    aZone->SetFlags( IS_MOVED );
-    m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
-                                Abort_Zone_Move_Corner_Or_Outlines );
-    s_CursorLastPosition = s_CornerInitialPosition = GetCrossHairPosition();
-    s_CornerIsNew = false;
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-}
-
-
-void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* aZone )
-{
-    aZone->ClearFlags();
-    m_canvas->SetMouseCapture( NULL, NULL );
-
-    if( DC )
-        aZone->Draw( m_canvas, DC, GR_OR );
-
-    OnModify();
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-
-    SetCurItem( NULL );       // This outline can be deleted when merging outlines
-
-    // Combine zones if possible
-    GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone );
-    m_canvas->Refresh();
-
-    int ii = GetBoard()->GetAreaIndex( aZone );     // test if aZone exists
-
-    if( ii < 0 )
-        aZone = NULL;                          // was removed by combining zones
-
-    UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
-    SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
-    s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
-
-    DRC drc( this );
-    int error_count = drc.TestZoneToZoneOutline( aZone, true );
-
-    if( error_count )
-    {
-        DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
-    }
-}
-
-
-void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone )
-{
-    OnModify();
-
-    if( aZone->Outline()->TotalVertices() <= 3 )
-    {
-        m_canvas->RefreshDrawingRect( aZone->GetBoundingBox() );
-
-        if( DC )
-        {  // Remove the full zone because this is no more an area
-            aZone->UnFill();
-            aZone->DrawFilledArea( m_canvas, DC, GR_XOR );
-        }
-
-        GetBoard()->Delete( aZone );
-        return;
-    }
-
-    PCB_LAYER_ID layer = aZone->GetLayer();
-
-    if( DC )
-    {
-        GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer );
-        GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer );
-    }
-
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    s_PickedList. ClearListAndDeleteItems();
-    SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
-    aZone->Outline()->RemoveVertex( aZone->GetSelectedCorner() );
-
-    // modify zones outlines according to the new aZone shape
-    GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone );
-
-    if( DC )
-    {
-        GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );
-        GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer );
-    }
-
-    UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
-    SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
-    s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
-
-    int ii = GetBoard()->GetAreaIndex( aZone );     // test if aZone exists
-
-    if( ii < 0 )
-        aZone = NULL;   // aZone does not exist anymore, after combining zones
-
-    DRC drc( this );
-    int error_count = drc.TestZoneToZoneOutline( aZone, true );
-
-    if( error_count )
-    {
-        DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
-    }
-}
-
-
-/**
- * Function Abort_Zone_Move_Corner_Or_Outlines
- * cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
- */
-void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
-    PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
-    ZONE_CONTAINER* zone     = (ZONE_CONTAINER*) pcbframe->GetCurItem();
-
-    if( zone->IsMoving() )
-    {
-        wxPoint offset;
-        offset = s_CornerInitialPosition - s_CursorLastPosition;
-        zone->Move( offset );
-    }
-    else if( zone->IsDragging() )
-    {
-        wxPoint offset = s_CornerInitialPosition - s_CursorLastPosition;
-        int selection = zone->GetSelectedCorner();
-        zone->MoveEdge( offset, selection );
-    }
-    else
-    {
-        if( s_CornerIsNew )
-        {
-            zone->Outline()->RemoveVertex( zone->GetSelectedCorner() );
-        }
-        else
-        {
-            wxPoint pos = s_CornerInitialPosition;
-            zone->Outline()->Vertex( zone->GetSelectedCorner() ) = pos;
-        }
-    }
-
-    Panel->SetMouseCapture( NULL, NULL );
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    s_PickedList. ClearListAndDeleteItems();
-    Panel->Refresh();
-
-    pcbframe->SetCurItem( NULL );
-    zone->ClearFlags();
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-}
-
-
-/// Redraws the zone outline when moving a corner according to the cursor position
-void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                                                   const wxPoint& aPosition, bool aErase )
-{
-    PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
-    ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
-
-    if( aErase )    // Undraw edge in old position
-    {
-        zone->Draw( aPanel, aDC, GR_XOR );
-    }
-
-    wxPoint pos = pcbframe->GetCrossHairPosition();
-
-    if( zone->IsMoving() )
-    {
-        wxPoint offset;
-        offset = pos - s_CursorLastPosition;
-        zone->Move( offset );
-        s_CursorLastPosition = pos;
-    }
-    else if( zone->IsDragging() )
-    {
-        wxPoint offset = pos - s_CursorLastPosition;
-        int selection = zone->GetSelectedCorner();
-        zone->MoveEdge( offset, selection );
-        s_CursorLastPosition = pos;
-    }
-    else
-    {
-        zone->Outline()->Vertex( zone->GetSelectedCorner() ) = pos;
-    }
-
-    zone->Draw( aPanel, aDC, GR_XOR );
-}
-
-
-
-int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
-{
-    ZONE_SETTINGS zoneInfo = GetZoneSettings();
-
-    // verify if s_CurrentZone exists (could be deleted since last selection) :
-    int ii;
-    for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
-    {
-        if( s_CurrentZone == GetBoard()->GetArea( ii ) )
-            break;
-    }
-
-    if( ii >= GetBoard()->GetAreaCount() ) // Not found: could be deleted since last selection
-    {
-        s_AddCutoutToCurrentZone = false;
-        s_CurrentZone = NULL;
-    }
-
-    ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
-
-    // Verify if a new zone is allowed on this layer:
-    if( zone == NULL  )
-    {
-        if( GetToolId() == ID_PCB_KEEPOUT_BUTT && !IsCopperLayer( GetActiveLayer() ) )
-        {
-            DisplayErrorMessage( this,
-                          _( "Error: a keepout area is allowed only on copper layers" ) );
-            return 0;
-        }
-    }
-
-    // If no zone contour in progress, a new zone is being created,
-    if( zone == NULL )
-    {
-        zone = GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
-        zone->SetFlags( IS_NEW );
-        zone->SetTimeStamp( GetNewTimeStamp() );
-    }
-
-    if( zone->GetNumCorners() == 0 )    // Start a new contour: init zone params (net, layer ...)
-    {
-        if( !s_CurrentZone )            // A new outline is created, from scratch
-        {
-            int dialogResult;
-
-            // Prompt user for parameters:
-            m_canvas->SetIgnoreMouseEvents( true );
-
-            if( IsCopperLayer( GetActiveLayer() ) )
-            {
-                // Put a zone on a copper layer
-                if( GetBoard()->GetHighLightNetCode() > 0 )
-                {
-                    zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
-                    zone->SetNetCode( zoneInfo.m_NetcodeSelection );
-                }
-
-                double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
-
-                wxConfigBase* cfg = Kiface().KifaceSettings();
-                cfg->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
-                zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);
-
-                tmp = ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL;
-                cfg->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, &tmp );
-                zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );
-
-                tmp = ZONE_CLEARANCE_MIL;
-                cfg->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY, &tmp );
-                zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );
-
-                tmp = ZONE_THICKNESS_MIL;
-                cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
-                zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
-
-                if( GetToolId() == ID_PCB_KEEPOUT_BUTT )
-                {
-                    zoneInfo.SetIsKeepout( true );
-                    // Netcode, netname and some other settings are irrelevant,
-                    // so ensure they are cleared
-                    zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
-                    zoneInfo.SetCornerSmoothingType( ZONE_SETTINGS::SMOOTHING_NONE );
-                    zoneInfo.SetCornerRadius( 0 );
-
-                    dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo );
-                }
-                else
-                {
-                    zoneInfo.m_CurrentZone_Layer = GetActiveLayer();    // Preselect a layer
-                    zoneInfo.SetIsKeepout( false );
-                    dialogResult = InvokeCopperZonesEditor( this, &zoneInfo );
-                }
-            }
-            else   // Put a zone on a non copper layer (technical layer)
-            {
-                zoneInfo.m_CurrentZone_Layer = GetActiveLayer();   // Preselect a layer
-                zoneInfo.SetIsKeepout( false );
-                zoneInfo.m_NetcodeSelection = 0;                   // No net for non copper zones
-                dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
-            }
-
-            m_canvas->MoveCursorToCrossHair();
-            m_canvas->SetIgnoreMouseEvents( false );
-
-            if( dialogResult == wxID_CANCEL )
-            {
-                GetBoard()->m_CurrentZoneContour = NULL;
-                delete zone;
-                return 0;
-            }
-
-            // Switch active layer to the selected zone layer
-            SetActiveLayer( zoneInfo.m_CurrentZone_Layer );
-            SetZoneSettings( zoneInfo );
-            OnModify();
-        }
-        else
-        {
-            // Start a new contour: init zone params (net and layer) from an existing
-            // zone (add cutout or similar zone)
-
-            zoneInfo.m_CurrentZone_Layer = s_CurrentZone->GetLayer();
-            SetActiveLayer( s_CurrentZone->GetLayer() );
-
-            zoneInfo << *s_CurrentZone;
-
-            SetZoneSettings( zoneInfo );
-            OnModify();
-        }
-
-        // Show the Net for zones on copper layers
-        if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) &&
-            !zoneInfo.GetIsKeepout() )
-        {
-            if( s_CurrentZone )
-            {
-                zoneInfo.m_NetcodeSelection = s_CurrentZone->GetNetCode();
-                GetBoard()->SetZoneSettings( zoneInfo );
-            }
-
-            if( GetBoard()->IsHighLightNetON() )
-            {
-                HighLight( DC );    // Remove old highlight selection
-            }
-
-            GetBoard()->SetHighLightNet( zoneInfo.m_NetcodeSelection );
-            HighLight( DC );
-        }
-
-        if( !s_AddCutoutToCurrentZone )
-            s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
-    }
-
-    // if first segment
-    if( zone->GetNumCorners() == 0 )
-    {
-        zoneInfo.ExportSetting( *zone );
-
-        // A duplicated corner is needed; null segments are removed when the zone is finished.
-        zone->AppendCorner( GetCrossHairPosition(), -1 );
-        // Add the duplicate corner:
-        zone->AppendCorner( GetCrossHairPosition(), -1, true );
-
-        if( Settings().m_legacyDrcOn && (m_drc->DrcOnCreatingZone( zone, 0 ) == BAD_DRC)
-            && zone->IsOnCopperLayer() )
-        {
-            zone->ClearFlags();
-            zone->RemoveAllContours();
-
-            // use the form of SetCurItem() which does not write to the msg panel,
-            // SCREEN::SetCurItem(), so the DRC error remains on screen.
-            // PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
-            GetScreen()->SetCurItem( NULL );
-            DisplayErrorMessage( this, _( "DRC error: this start point is inside or too close another area" ) );
-            return 0;
-        }
-
-        SetCurItem( zone );
-        m_canvas->SetMouseCapture( Show_New_Edge_While_Move_Mouse, Abort_Zone_Create_Outline );
-    }
-    else    // edge in progress:
-    {
-        ii = zone->GetNumCorners() - 1;
-
-        // edge in progress : the current corner coordinate was set
-        // by Show_New_Edge_While_Move_Mouse
-        if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
-        {
-            if( !Settings().m_legacyDrcOn || !zone->IsOnCopperLayer()
-                || ( m_drc->DrcOnCreatingZone( zone, ii - 1 ) == OK_DRC ) )
-            {
-                // Ok, we can add a new corner
-                if( m_canvas->IsMouseCaptured() )
-                    m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
-
-                // It is necessary to allow duplication of the points, as we have to handle the
-                // continuous drawing while creating the zone at the same time as we build it. Null
-                // segments are removed when the zone is finished, in End_Zone.
-                zone->AppendCorner( GetCrossHairPosition(), -1, true );
-
-                SetCurItem( zone );     // calls DisplayInfo().
-
-                if( m_canvas->IsMouseCaptured() )
-                    m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
-            }
-        }
-    }
-
-    return zone->GetNumCorners();
-}
-
-
-bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
-{
-    ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
-
-    if( !zone )
-        return true;
-
-    // Validate the current outline:
-    if( zone->GetNumCorners() <= 2 )   // An outline must have 3 corners or more
-    {
-        Abort_Zone_Create_Outline( m_canvas, DC );
-        return true;
-    }
-
-    // Remove the last corner if is is at the same location as the prevoius corner
-    zone->Outline()->RemoveNullSegments();
-
-    // Validate the current edge:
-    int icorner = zone->GetNumCorners() - 1;
-    if( zone->IsOnCopperLayer() )
-    {
-        if( Settings().m_legacyDrcOn &&
-            m_drc->DrcOnCreatingZone( zone, icorner - 1 ) == BAD_DRC )  // we can't validate last edge
-            return false;
-
-        if( Settings().m_legacyDrcOn &&
-            m_drc->DrcOnCreatingZone( zone, icorner ) == BAD_DRC )      // we can't validate the closing edge
-        {
-            DisplayErrorMessage( this, _( "DRC error: closing this area creates a DRC error with another area" ) );
-            m_canvas->MoveCursorToCrossHair();
-            return false;
-        }
-    }
-
-    zone->ClearFlags();
-
-    zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR );
-
-    m_canvas->SetMouseCapture( NULL, NULL );
-
-    // Undraw old drawings, because they can have important changes
-    PCB_LAYER_ID layer = zone->GetLayer();
-    GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer );
-    GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer );
-
-    // Save initial zones configuration, for undo/redo, before adding new zone
-    s_AuxiliaryList.ClearListAndDeleteItems();
-    s_PickedList.ClearListAndDeleteItems();
-    SaveCopyOfZones(s_PickedList, GetBoard(), zone->GetNetCode(), zone->GetLayer() );
-
-    // Put new zone in list
-    if( !s_CurrentZone )
-    {
-        GetBoard()->Add( zone );
-
-        // Add this zone in picked list, as new item
-        ITEM_PICKER picker( zone, UR_NEW );
-        s_PickedList.PushItem( picker );
-    }
-    else    // Append this outline as a cutout to an existing zone
-    {
-        s_CurrentZone->Outline()->AddHole( zone->Outline()->Outline( 0 ) );
-
-        zone->RemoveAllContours();      // All corners are copied in s_CurrentZone. Free corner list.
-        zone = s_CurrentZone;
-    }
-
-    s_AddCutoutToCurrentZone = false;
-    s_CurrentZone = NULL;
-    GetBoard()->m_CurrentZoneContour = NULL;
-
-    GetScreen()->SetCurItem( NULL );       // This outline can be deleted when merging outlines
-
-    // Combine zones if possible :
-    GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, zone );
-
-    // Redraw the real edge zone :
-    GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );
-    GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer );
-
-    int ii = GetBoard()->GetAreaIndex( zone );   // test if zone exists
-
-    if( ii < 0 )
-        zone = NULL;                        // was removed by combining zones
-
-    DRC drc( this );
-    int error_count = drc.TestZoneToZoneOutline( zone, true );
-
-    if( error_count )
-    {
-        DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
-    }
-
-    UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
-    SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
-    s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
-
-    OnModify();
-    return true;
-}
-
-
-/* Redraws the zone outlines when moving mouse
- */
-static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
-                                            const wxPoint& aPosition, bool aErase )
-{
-    PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
-    wxPoint         c_pos    = pcbframe->GetCrossHairPosition();
-    ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
-
-    if( !zone )
-        return;
-
-    int icorner = zone->GetNumCorners() - 1;
-
-    if( icorner < 1 )
-        return;     // We must have 2 (or more) corners
-
-    if( aErase )    // Undraw edge in old position
-    {
-        zone->DrawWhileCreateOutline( aPanel, aDC );
-    }
-
-    // Redraw the current edge in its new position
-    if( pcbframe->GetZoneSettings().m_Zone_45_Only )
-    {
-        // calculate the new position as allowed
-        wxPoint StartPoint = static_cast<wxPoint>( zone->GetCornerPosition( icorner - 1 ) );
-        c_pos = CalculateSegmentEndPoint( c_pos, StartPoint );
-    }
-
-    zone->SetCornerPosition( icorner, c_pos );
-
-    zone->DrawWhileCreateOutline( aPanel, aDC );
-}
-
 void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
 {
     int           dialogResult;
@@ -977,35 +167,3 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
 
     s_PickedList.ClearItemsList();  // s_ItemsListPicker is no longer owner of picked items
 }
-
-
-void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* aZone )
-{
-    // Get contour in which the selected corner is
-    SHAPE_POLY_SET::VERTEX_INDEX indices;
-
-    // If the selected corner does not exist, abort
-    if( !aZone->Outline()->GetRelativeIndices( aZone->GetSelectedCorner(), &indices ) )
-        throw( std::out_of_range( "Zone selected corner does not exist" ) );
-
-    EDA_RECT dirty = aZone->GetBoundingBox();
-
-    // Remove current filling:
-    aZone->UnFill();
-
-    if( indices.m_contour == 0 )    // This is the main outline: remove all
-    {
-        SaveCopyInUndoList( aZone, UR_DELETED );
-        GetBoard()->Remove( aZone );
-    }
-
-    else
-    {
-        SaveCopyInUndoList( aZone, UR_CHANGED );
-        aZone->Outline()->RemoveContour( indices.m_contour, indices.m_polygon );
-    }
-
-    m_canvas->RefreshDrawingRect( dirty );
-
-    OnModify();
-}