diff --git a/common/dialogs/panel_gal_display_options.cpp b/common/dialogs/panel_gal_display_options.cpp
index 126598a5c9..1f3a963456 100644
--- a/common/dialogs/panel_gal_display_options.cpp
+++ b/common/dialogs/panel_gal_display_options.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2019-2021 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
@@ -24,6 +24,8 @@
 
 #include <dialogs/panel_gal_display_options.h>
 
+#include <wx/treebook.h>
+
 
 PANEL_GAL_DISPLAY_OPTIONS::PANEL_GAL_DISPLAY_OPTIONS( EDA_DRAW_FRAME* aFrame,
                                                       PAGED_DIALOG* aParent ) :
diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp
index bf28780663..c0870b2c7b 100644
--- a/common/dialogs/panel_setup_netclasses.cpp
+++ b/common/dialogs/panel_setup_netclasses.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
- * Copyright (C) 2009-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2009-2021 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
@@ -38,6 +38,8 @@
 #include <widgets/grid_color_swatch_helpers.h>
 #include <widgets/grid_icon_text_helpers.h>
 #include <widgets/grid_text_helpers.h>
+#include <wx/treebook.h>
+
 
 // PCBNEW columns of netclasses grid
 enum {
diff --git a/common/dialogs/panel_setup_severities.cpp b/common/dialogs/panel_setup_severities.cpp
index cbb593db01..6e1daaa560 100644
--- a/common/dialogs/panel_setup_severities.cpp
+++ b/common/dialogs/panel_setup_severities.cpp
@@ -27,6 +27,7 @@
 #include <dialogs/panel_setup_severities.h>
 #include <wx/radiobut.h>
 #include <wx/stattext.h>
+#include <wx/treebook.h>
 
 
 PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp
index 9ad9528274..4f6e5132a1 100644
--- a/common/eda_base_frame.cpp
+++ b/common/eda_base_frame.cpp
@@ -58,6 +58,7 @@
 #include <wx/msgdlg.h>
 #include <wx/stdpaths.h>
 #include <wx/string.h>
+#include <wx/treebook.h>
 #include <kiplatform/app.h>
 #include <kiplatform/ui.h>
 
diff --git a/common/widgets/paged_dialog.cpp b/common/widgets/paged_dialog.cpp
index 212977cb7e..5b0d7ae21d 100644
--- a/common/widgets/paged_dialog.cpp
+++ b/common/widgets/paged_dialog.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2019-2021 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
diff --git a/eeschema/dialogs/dialog_schematic_setup.cpp b/eeschema/dialogs/dialog_schematic_setup.cpp
index 04a7ccd549..92501bb1e4 100644
--- a/eeschema/dialogs/dialog_schematic_setup.cpp
+++ b/eeschema/dialogs/dialog_schematic_setup.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2020-2021 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
@@ -34,6 +34,7 @@
 #include <widgets/infobar.h>
 #include "dialog_schematic_setup.h"
 #include "panel_eeschema_template_fieldnames.h"
+#include <wx/treebook.h>
 
 
 DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index d08d028303..069527a83a 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2014-2021 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
@@ -49,6 +49,7 @@
 #include <wildcards_and_files_ext.h>
 #include <drawing_sheet/ds_data_model.h>
 #include <zoom_defines.h>
+#include <wx/treebook.h>
 
 
 /// Helper for all the old plotting/printing code while it still exists
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 1a62b3fce1..4a69b0e1f4 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -57,6 +57,7 @@
 #include <dialogs/panel_gerbview_display_options.h>
 #include <panel_hotkeys_editor.h>
 #include <wx/wupdlock.h>
+#include <wx/treebook.h>
 
 #include "widgets/gbr_layer_box_selector.h"
 #include "widgets/gerbview_layer_widget.h"
diff --git a/include/widgets/layer_box_selector.h b/include/widgets/layer_box_selector.h
index bed75faed1..eb9d7e2544 100644
--- a/include/widgets/layer_box_selector.h
+++ b/include/widgets/layer_box_selector.h
@@ -2,7 +2,7 @@
  * 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 AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -31,15 +31,11 @@
 
 using KIGFX::COLOR4D;
 
-/* Basic class to build a layer list.
- * this is an basic abstract class to build a layer list selector.
- * To display this list, you should therefore derive this class
+/**
+ * Base class to build a layer list.
  */
 class LAYER_SELECTOR
 {
-protected:
-    bool m_layerhotkeys;
-
 public:
     LAYER_SELECTOR();
 
@@ -49,22 +45,25 @@ public:
 
     bool SetLayersHotkeys( bool value );
 
-    // Fills the layer bitmap aLayerbmp with the layer color
+    // Fill the layer bitmap aLayerbmp with the layer color
     static void DrawColorSwatch( wxBitmap& aLayerbmp, COLOR4D aBackground, COLOR4D aColor );
 
 protected:
-    // Returns a color index from the layer id
+    // Return a color index from the layer id
     virtual COLOR4D getLayerColor( LAYER_NUM aLayer ) const = 0;
 
-    // Returns the name of the layer id
+    // Return the name of the layer id
     virtual wxString getLayerName( LAYER_NUM aLayer ) const = 0;
 
-    // Returns true if the layer id is enabled (i.e. is it should be displayed)
+    // Return true if the layer id is enabled (i.e. is it should be displayed)
     virtual bool isLayerEnabled( LAYER_NUM aLayer ) const = 0;
+
+    bool m_layerhotkeys;
 };
 
 
-/* class to display a layer list in a wxBitmapComboBox.
+/*
+ * Display a layer list in a wxBitmapComboBox.
  */
 class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
 {
diff --git a/include/widgets/msgpanel.h b/include/widgets/msgpanel.h
index f4ebee95b2..6dccaeeadd 100644
--- a/include/widgets/msgpanel.h
+++ b/include/widgets/msgpanel.h
@@ -2,8 +2,8 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
- * Copyright (C) 2011-2012 Wayne Stambaugh <stambaughw@verizon.net>
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2011-2012 Wayne Stambaugh <stambaughw@gmail.com>
+ * Copyright (C) 1992-2021 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
@@ -48,20 +48,10 @@ class EDA_MSG_PANEL;
 
 
 /**
- * EDA_MSG_ITEM
- * is used EDA_MSG_PANEL as the item type for displaying messages.
+ * #EDA_MSG_PANEL items for displaying messages.
  */
 class MSG_PANEL_ITEM
 {
-    int         m_X;
-    int         m_UpperY;
-    int         m_LowerY;
-    wxString    m_UpperText;
-    wxString    m_LowerText;
-    int         m_Padding;
-
-    friend class EDA_MSG_PANEL;
-
 public:
     MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText,
                     int aPadding = MSG_PANEL_DEFAULT_PAD ) :
@@ -91,6 +81,16 @@ public:
 
     void SetPadding( int aPadding )  { m_Padding = aPadding; }
     int GetPadding() const { return m_Padding; }
+
+private:
+    friend class EDA_MSG_PANEL;
+
+    int         m_X;
+    int         m_UpperY;
+    int         m_LowerY;
+    wxString    m_UpperText;
+    wxString    m_LowerText;
+    int         m_Padding;
 };
 
 
@@ -98,31 +98,10 @@ typedef std::vector<MSG_PANEL_ITEM>      MSG_PANEL_ITEMS;
 
 
 /**
- * EDA_MSG_PANEL
- * is a panel to display various information messages.
+ * A panel to display various information messages.
  */
 class EDA_MSG_PANEL : public wxPanel
 {
-protected:
-    MSG_PANEL_ITEMS        m_Items;
-    int                    m_last_x;      ///< the last used x coordinate
-    wxSize                 m_fontSize;
-
-    void showItem( wxDC& dc, const MSG_PANEL_ITEM& aItem );
-
-    void erase( wxDC* DC );
-
-    /**
-     * Function getFontSize
-     * computes the height and width of a 'W' in the system font.
-     */
-    static wxSize computeFontSize();
-
-    /**
-     * Calculate the width and height of a text string using the system UI font.
-     */
-    wxSize computeTextSize( const wxString& text ) const;
-
 public:
     EDA_MSG_PANEL( wxWindow* aParent, int aId,
                    const wxPoint& aPosition, const wxSize& aSize,
@@ -130,9 +109,9 @@ public:
     ~EDA_MSG_PANEL();
 
     /**
-     * Function GetRequiredHeight
-     * returns the required height (in pixels) of a EDA_MSG_PANEL.  This takes
-     * into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT.
+     * Return the required height (in pixels) of a EDA_MSG_PANEL.
+     *
+     * This takes into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT.
      */
     static int GetRequiredHeight();
 
@@ -140,8 +119,7 @@ public:
     void EraseMsgBox();
 
     /**
-     * Function SetMessage
-     * sets a message at \a aXPosition to \a aUpperText and \a aLowerText in the message panel.
+     * Set a message at \a aXPosition to \a aUpperText and \a aLowerText in the message panel.
      *
      * @param aXPosition The horizontal position to display the message or less than zero
      *                   to set the message using the last message position.
@@ -151,8 +129,7 @@ public:
     void SetMessage( int aXPosition, const wxString& aUpperText, const wxString& aLowerText );
 
    /**
-    * Function AppendMessage
-    * appends a message to the message panel.
+    * Append a message to the message panel.
     *
     * This method automatically adjusts for the width of the text string.
     * Making consecutive calls to AppendMessage will append each message
@@ -166,8 +143,7 @@ public:
     void AppendMessage( const wxString& aUpperText, const wxString& aLowerText, int aPadding = 6 );
 
    /**
-    * Function AppendMessage
-    * appends \a aMessageItem to the message panel.
+    * Append \a aMessageItem to the message panel.
     *
     * @param aMessageItem is a reference to an #MSG_PANEL_ITEM containing the message to
     *                     append to the panel.
@@ -179,6 +155,25 @@ public:
     }
 
     DECLARE_EVENT_TABLE()
+
+protected:
+    void showItem( wxDC& dc, const MSG_PANEL_ITEM& aItem );
+
+    void erase( wxDC* DC );
+
+    /**
+     * Compute the height and width of a 'W' in the system font.
+     */
+    static wxSize computeFontSize();
+
+    /**
+     * Calculate the width and height of a text string using the system UI font.
+     */
+    wxSize computeTextSize( const wxString& text ) const;
+
+    MSG_PANEL_ITEMS        m_Items;
+    int                    m_last_x;      ///< the last used x coordinate
+    wxSize                 m_fontSize;
 };
 
 
diff --git a/include/widgets/paged_dialog.h b/include/widgets/paged_dialog.h
index 8abaeb3ced..a535cd72cf 100644
--- a/include/widgets/paged_dialog.h
+++ b/include/widgets/paged_dialog.h
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2017-2021 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
@@ -22,28 +22,13 @@
 #define PAGED_DIALOG_H
 
 #include <dialog_shim.h>
-#include <wx/treebook.h>
 
 
 class WX_INFOBAR;
-
+class wxTreebook;
 
 class PAGED_DIALOG : public DIALOG_SHIM
 {
-private:
-    wxString    m_title;
-
-    bool        m_dirty;
-
-    wxString    m_errorMessage;
-    wxWindow*   m_errorCtrl;    // the control associated with m_errorMessage
-    int         m_errorRow;     // the row if m_errorCtrl is a grid
-    int         m_errorCol;     // the column if m_errorCtrl is a grid
-
-    wxBoxSizer* m_buttonsSizer;
-
-    std::vector<bool> m_macHack;
-
 public:
     PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset,
                   const wxString& aAuxiliaryAction = wxEmptyString );
@@ -79,6 +64,20 @@ protected:
     wxButton*   m_resetButton;
     wxButton*   m_cancelButton;
     WX_INFOBAR* m_infoBar;
+
+private:
+    wxString    m_title;
+
+    bool        m_dirty;
+
+    wxString    m_errorMessage;
+    wxWindow*   m_errorCtrl;    // the control associated with m_errorMessage
+    int         m_errorRow;     // the row if m_errorCtrl is a grid
+    int         m_errorCol;     // the column if m_errorCtrl is a grid
+
+    wxBoxSizer* m_buttonsSizer;
+
+    std::vector<bool> m_macHack;
 };
 
 
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index b8978d4ab3..fe53be9497 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2013 CERN
- * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
  * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
  *
  * This program is free software; you can redistribute it and/or
@@ -63,6 +63,7 @@
 #include <zoom_defines.h>
 
 #include <wx/filedlg.h>
+#include <wx/treebook.h>
 
 
 BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
@@ -924,4 +925,4 @@ void PL_EDITOR_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCo
 bool PL_EDITOR_FRAME::GetPageNumberOption() const
 {
     return m_pageSelectBox->GetSelection() == 0;
-}
\ No newline at end of file
+}
diff --git a/pcbnew/board_stackup_manager/panel_board_finish.cpp b/pcbnew/board_stackup_manager/panel_board_finish.cpp
index 2cd90e2fe0..07e803effd 100644
--- a/pcbnew/board_stackup_manager/panel_board_finish.cpp
+++ b/pcbnew/board_stackup_manager/panel_board_finish.cpp
@@ -27,6 +27,8 @@
 #include <board_stackup_manager/stackup_predefined_prms.h>
 #include "panel_board_finish.h"
 
+#include <wx/treebook.h>
+
 
 PANEL_SETUP_BOARD_FINISH::PANEL_SETUP_BOARD_FINISH( PAGED_DIALOG* aParent, BOARD* aBoard ) :
         PANEL_SETUP_BOARD_FINISH_BASE( aParent->GetTreebook() )
diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp
index 51f1617247..66dbea296a 100644
--- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp
+++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp
@@ -44,6 +44,7 @@
 #include <wx/richmsgdlg.h>
 #include <wx/choicdlg.h>
 #include <wx/dcclient.h>
+#include <wx/treebook.h>
 
 #include <locale_io.h>
 
diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp
index a8c293817e..a56af945e2 100644
--- a/pcbnew/dialogs/dialog_board_setup.cpp
+++ b/pcbnew/dialogs/dialog_board_setup.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2017-2021 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
@@ -42,6 +42,8 @@
 #include "dialog_board_setup.h"
 #include "panel_setup_rules.h"
 
+#include <wx/treebook.h>
+
 using std::placeholders::_1;
 
 DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
diff --git a/pcbnew/dialogs/panel_display_options.cpp b/pcbnew/dialogs/panel_display_options.cpp
index f9d7996078..6e92522211 100644
--- a/pcbnew/dialogs/panel_display_options.cpp
+++ b/pcbnew/dialogs/panel_display_options.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -27,6 +27,7 @@
 #include <pcb_painter.h>
 #include <widgets/paged_dialog.h>
 #include <widgets/gal_options_panel.h>
+#include <wx/treebook.h>
 
 
 static const UTIL::CFG_MAP<PCB_DISPLAY_OPTIONS::TRACE_CLEARANCE_DISPLAY_MODE_T> traceClearanceSelectMap =
diff --git a/pcbnew/dialogs/panel_edit_options.cpp b/pcbnew/dialogs/panel_edit_options.cpp
index 8e8850813f..b7cdc47b6b 100644
--- a/pcbnew/dialogs/panel_edit_options.cpp
+++ b/pcbnew/dialogs/panel_edit_options.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -31,6 +31,8 @@
 #include <ratsnest/ratsnest_view_item.h>
 #include <widgets/paged_dialog.h>
 #include <footprint_edit_frame.h>
+#include <wx/treebook.h>
+
 
 PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS( PCB_BASE_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent ) :
         PANEL_EDIT_OPTIONS_BASE( aParent->GetTreebook() ), m_frame( aFrame )
diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_defaults.cpp
index bbca276211..5f8f40b2f4 100644
--- a/pcbnew/dialogs/panel_fp_editor_defaults.cpp
+++ b/pcbnew/dialogs/panel_fp_editor_defaults.cpp
@@ -31,6 +31,8 @@
 #include <grid_layer_box_helpers.h>
 #include <bitmaps.h>
 
+#include <wx/treebook.h>
+
 class TEXT_ITEMS_GRID_TABLE : public wxGridTableBase
 {
     std::vector<TEXT_ITEM_INFO> m_items;
diff --git a/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp b/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp
index 0e8e2ea3bc..32a1ecd062 100644
--- a/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp
+++ b/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2018 Andrew Lutsenko, anlutsenko at gmail dot com
- * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -33,6 +33,9 @@
 #include <widgets/paged_dialog.h>
 #include <widgets/wx_grid.h>
 
+#include <wx/treebook.h>
+
+
 #define GRID_CELL_MARGIN 4
 
 PANEL_PCBNEW_ACTION_PLUGINS::PANEL_PCBNEW_ACTION_PLUGINS( PCB_EDIT_FRAME* aFrame,
diff --git a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp
index 6613be473d..b0c42cf576 100644
--- a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp
+++ b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
- * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2020-2021 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
@@ -34,6 +34,7 @@
 #include <pcb_painter.h>
 #include <track.h>
 #include <plugins/kicad/kicad_plugin.h>
+#include <wx/treebook.h>
 
 
 std::string g_previewBoard =
diff --git a/pcbnew/dialogs/panel_pcbnew_display_origin.cpp b/pcbnew/dialogs/panel_pcbnew_display_origin.cpp
index 7aaa7b6f3c..21af7b74f6 100644
--- a/pcbnew/dialogs/panel_pcbnew_display_origin.cpp
+++ b/pcbnew/dialogs/panel_pcbnew_display_origin.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
- * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -31,6 +31,9 @@
 #include <pcbnew_id.h>
 #include <widgets/paged_dialog.h>
 
+#include <wx/treebook.h>
+
+
 PANEL_PCBNEW_DISPLAY_ORIGIN::PANEL_PCBNEW_DISPLAY_ORIGIN(
         PCB_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent )
         : PANEL_PCBNEW_DISPLAY_ORIGIN_BASE( aParent->GetTreebook() ),
diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp
index e8f9368db7..7bc1267ea1 100644
--- a/pcbnew/dialogs/panel_setup_layers.cpp
+++ b/pcbnew/dialogs/panel_setup_layers.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2009 Isaac Marino Bavaresco, isaacbavaresco@yahoo.com.br
  * Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
- * Copyright (C) 2009-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2009-2021 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
@@ -35,6 +35,7 @@
 #include <board_stackup_manager/panel_board_stackup.h>
 
 #include <wx/choicdlg.h>
+#include <wx/treebook.h>
 
 
 // some define to choose how copper layers widgets are shown
diff --git a/pcbnew/dialogs/panel_setup_mask_and_paste.cpp b/pcbnew/dialogs/panel_setup_mask_and_paste.cpp
index 6ea0860df5..96491f53c6 100644
--- a/pcbnew/dialogs/panel_setup_mask_and_paste.cpp
+++ b/pcbnew/dialogs/panel_setup_mask_and_paste.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2019-2021 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
@@ -26,6 +26,7 @@
 #include <board_design_settings.h>
 #include <dialogs/dialog_text_entry.h>
 #include <panel_setup_mask_and_paste.h>
+#include <wx/treebook.h>
 
 
 PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE( PAGED_DIALOG* aParent,
diff --git a/pcbnew/dialogs/panel_setup_rules.cpp b/pcbnew/dialogs/panel_setup_rules.cpp
index 82be1297fe..312f5fe3b8 100644
--- a/pcbnew/dialogs/panel_setup_rules.cpp
+++ b/pcbnew/dialogs/panel_setup_rules.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2020-2021 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
@@ -33,6 +33,7 @@
 #include <tool/tool_manager.h>
 #include <panel_setup_rules.h>
 #include <wx_html_report_box.h>
+#include <wx/treebook.h>
 #include <dialogs/html_messagebox.h>
 #include <scintilla_tricks.h>
 #include <drc/drc_rule_parser.h>
diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp
index e2ba63e1e4..f86ad07831 100644
--- a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp
+++ b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp
@@ -28,6 +28,8 @@
 #include <grid_tricks.h>
 #include <panel_setup_text_and_graphics.h>
 
+#include <wx/treebook.h>
+
 
 // Columns of layer classes grid
 enum
diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp
index 7dda87ad93..d9c9e64120 100644
--- a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp
+++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2018-2021 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
@@ -27,6 +27,7 @@
 #include <board_design_settings.h>
 #include <bitmaps.h>
 #include <widgets/wx_grid.h>
+#include <wx/treebook.h>
 #include <grid_tricks.h>
 
 #include <panel_setup_tracks_and_vias.h>
diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp
index ef87d4410e..61d3746600 100644
--- a/pcbnew/footprint_edit_frame.cpp
+++ b/pcbnew/footprint_edit_frame.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  * Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
- * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -78,6 +78,7 @@
 #include <widgets/progress_reporter.h>
 #include <wildcards_and_files_ext.h>
 #include <wx/filedlg.h>
+#include <wx/treebook.h>
 
 
 BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp
index f6a879cd28..80e7702dc7 100644
--- a/pcbnew/pcbnew_config.cpp
+++ b/pcbnew/pcbnew_config.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 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
@@ -43,6 +43,7 @@
 #include <project/net_settings.h>
 #include <project/project_file.h>
 #include <project/project_local_settings.h>
+#include <wx/treebook.h>