From f233f4a0a96d0aec0dbee091ced069832b49587f Mon Sep 17 00:00:00 2001
From: Wayne Stambaugh <stambaughw@gmail.com>
Date: Wed, 28 Jul 2021 13:25:40 -0400
Subject: [PATCH] Expunge EDA_FILE_SELECTOR.

EDA_FILE_SELECTOR was just an obfuscation of wxFileSelector().
---
 common/dialogs/panel_hotkeys_editor.cpp  |  16 ++--
 common/eda_doc.cpp                       |  25 ++----
 common/gestfich.cpp                      |  50 ------------
 common/hotkeys_basic.cpp                 |  11 ++-
 common/pgm_base.cpp                      |   4 +-
 common/wildcards_and_files_ext.cpp       |  15 ++++
 eeschema/dialogs/dialog_bom.cpp          |   6 +-
 eeschema/dialogs/dialog_netlist.cpp      |  12 +--
 eeschema/tools/symbol_editor_control.cpp |  14 ++--
 include/gestfich.h                       |  32 +-------
 include/hotkeys_basic.h                  |   3 +-
 include/wildcards_and_files_ext.h        |   5 ++
 kicad/project_tree_pane.cpp              | 100 +++++++++++------------
 pcbnew/microwave/microwave_polygon.cpp   |   6 +-
 pcbnew/tools/board_editor_control.cpp    |  15 ++--
 15 files changed, 125 insertions(+), 189 deletions(-)

diff --git a/common/dialogs/panel_hotkeys_editor.cpp b/common/dialogs/panel_hotkeys_editor.cpp
index 8b77a2994f..c5cee0fe43 100644
--- a/common/dialogs/panel_hotkeys_editor.cpp
+++ b/common/dialogs/panel_hotkeys_editor.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KICAD, a free EDA CAD application.
  *
- * 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
@@ -27,6 +27,7 @@
 #include <kiway_player.h>
 #include <locale_io.h>
 #include <panel_hotkeys_editor.h>
+#include <wildcards_and_files_ext.h>
 #include <tool/tool_manager.h>
 #include <widgets/button_row_panel.h>
 #include <widgets/ui_common.h>
@@ -188,10 +189,9 @@ void PANEL_HOTKEYS_EDITOR::OnFilterSearch( wxCommandEvent& aEvent )
 
 void PANEL_HOTKEYS_EDITOR::ImportHotKeys()
 {
-    wxString ext  = DEFAULT_HOTKEY_FILENAME_EXT;
-    wxString mask = wxT( "*." ) + ext;
-    wxString filename = EDA_FILE_SELECTOR( _( "Import Hotkeys File:" ), m_frame->GetMruPath(),
-                                           wxEmptyString, ext, mask, this, wxFD_OPEN, true );
+    wxString filename = wxFileSelector( _( "Import Hotkeys File:" ), m_frame->GetMruPath(),
+                                        wxEmptyString, HotkeyFileExtension,
+                                        HotkeyFileWildcard(), wxFD_OPEN, this );
 
     if( filename.IsEmpty() )
         return;
@@ -216,9 +216,9 @@ void PANEL_HOTKEYS_EDITOR::ImportHotKeys()
 
 void PANEL_HOTKEYS_EDITOR::dumpHotkeys()
 {
-    wxString filename = EDA_FILE_SELECTOR( wxT( "Dump Hotkeys File:" ), m_frame->GetMruPath(),
-                                           wxEmptyString, wxT( "txt" ), wxT( "*.txt" ), this,
-                                           wxFD_SAVE, true );
+    wxString filename = wxFileSelector( wxT( "Hotkeys File" ), m_frame->GetMruPath(),
+                                        wxEmptyString, TextFileExtension, TextFileWildcard(),
+                                        wxFD_SAVE, this );
 
     if( filename.IsEmpty() )
         return;
diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp
index 52fd70b100..0854ff8eff 100644
--- a/common/eda_doc.cpp
+++ b/common/eda_doc.cpp
@@ -121,40 +121,33 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT
     /* Compute the full file name */
     if( wxIsAbsolutePath( docname ) || aPaths == nullptr )
         fullfilename = docname;
-    /* If the file exists, this is a trivial case: return the filename
-     * "as this".  the name can be an absolute path, or a relative path
-     * like ./filename or ../<filename>
+    /* If the file exists, this is a trivial case: return the filename "as this".  the name can
+     * be an absolute path, or a relative path like ./filename or ../<filename>.
      */
     else if( wxFileName::FileExists( docname ) )
         fullfilename = docname;
     else
         fullfilename = aPaths->FindValidPath( docname );
 
-    wxString mask( wxT( "*" ) ), extension;
+    wxString extension;
 
 #ifdef __WINDOWS__
-    mask     += wxT( ".*" );
     extension = wxT( ".*" );
 #endif
 
     if( wxIsWild( fullfilename ) )
     {
-        fullfilename = EDA_FILE_SELECTOR( _( "Doc Files" ),
-                                          wxPathOnly( fullfilename ),
-                                          fullfilename,
-                                          extension,
-                                          mask,
-                                          aParent,
-                                          wxFD_OPEN,
-                                          true,
-                                          wxPoint( -1, -1 ) );
+        fullfilename = wxFileSelector( _( "Documentation File" ), wxPathOnly( fullfilename ),
+                                       fullfilename, extension, wxFileSelectorDefaultWildcardStr,
+                                       wxFD_OPEN, aParent );
+
         if( fullfilename.IsEmpty() )
             return false;
     }
 
     if( !wxFileExists( fullfilename ) )
     {
-        msg.Printf( _( "Doc File '%s' not found" ), docname );
+        msg.Printf( _( "Documentation file '%s' not found." ), docname );
         DisplayError( aParent, msg );
         return false;
     }
@@ -197,7 +190,7 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT
 
     if( !success )
     {
-        msg.Printf( _( "Unknown MIME type for doc file '%s'" ), fullfilename );
+        msg.Printf( _( "Unknown MIME type for documentation file '%s'" ), fullfilename );
         DisplayError( aParent, msg );
     }
 
diff --git a/common/gestfich.cpp b/common/gestfich.cpp
index d61ab4abe6..01f4d857e2 100644
--- a/common/gestfich.cpp
+++ b/common/gestfich.cpp
@@ -49,56 +49,6 @@ void AddDelimiterString( wxString& string )
 }
 
 
-wxString EDA_FILE_SELECTOR( const wxString& aTitle,
-                            const wxString& aPath,
-                            const wxString& aFileName,
-                            const wxString& aExtension,
-                            const wxString& aWildcard,
-                            wxWindow*       aParent,
-                            int             aStyle,
-                            const bool      aKeepWorkingDirectory,
-                            const wxPoint&  aPosition,
-                            wxString*       aMruPath )
-{
-    wxString fullfilename;
-    wxString curr_cwd    = wxGetCwd();
-    wxString defaultname = aFileName;
-    wxString defaultpath = aPath;
-    wxString dotted_Ext = wxT(".") + aExtension;
-
-#ifdef __WINDOWS__
-    defaultname.Replace( wxT( "/" ), wxT( "\\" ) );
-    defaultpath.Replace( wxT( "/" ), wxT( "\\" ) );
-#endif
-
-    if( defaultpath.IsEmpty() )
-    {
-        if( aMruPath == nullptr )
-            defaultpath = wxGetCwd();
-        else
-            defaultpath = *aMruPath;
-    }
-
-    wxSetWorkingDirectory( defaultpath );
-
-    fullfilename = wxFileSelector( aTitle, defaultpath, defaultname,
-                                   dotted_Ext, aWildcard,
-                                   aStyle,         // open mode wxFD_OPEN, wxFD_SAVE ..
-                                   aParent, aPosition.x, aPosition.y );
-
-    if( aKeepWorkingDirectory )
-        wxSetWorkingDirectory( curr_cwd );
-
-    if( !fullfilename.IsEmpty() && aMruPath )
-    {
-        wxFileName fn = fullfilename;
-        *aMruPath = fn.GetPath();
-    }
-
-    return fullfilename;
-}
-
-
 wxString FindKicadFile( const wxString& shortname )
 {
     // Test the presence of the file in the directory shortname of
diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp
index 7013679240..8dfd065015 100644
--- a/common/hotkeys_basic.cpp
+++ b/common/hotkeys_basic.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2010 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
@@ -29,6 +29,7 @@
 #include <kicad_string.h>
 #include <eda_base_frame.h>
 #include <eda_draw_frame.h>
+#include <wildcards_and_files_ext.h>
 #include <settings/settings_manager.h>
 
 #include <tool/tool_manager.h>
@@ -50,6 +51,7 @@ struct hotkey_name_descr
     int           m_KeyCode;
 };
 
+
 /* table giving the hotkey name from the hotkey code, for special keys
  * Note : when modifiers (ATL, SHIFT, CTRL) do not modify
  * the code of the key, do need to enter the modified key code
@@ -120,6 +122,7 @@ static struct hotkey_name_descr hotkeyNameList[] =
     { wxT( "" ),             KEY_NON_FOUND                                            }
 };
 
+
 // name of modifier keys.
 // Note: the Ctrl key is Cmd key on Mac OS X.
 // However, in wxWidgets defs, the key WXK_CONTROL is the Cmd key,
@@ -326,7 +329,7 @@ void ReadHotKeyConfig( const wxString& aFileName, std::map<std::string, int>& aH
     if( fileName.IsEmpty() )
     {
         wxFileName fn( "user" );
-        fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
+        fn.SetExt( HotkeyFileExtension );
         fn.SetPath( SETTINGS_MANAGER::GetUserSettingsPath() );
         fileName = fn.GetFullPath();
     }
@@ -362,7 +365,7 @@ int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap )
     std::map<std::string, int> hotkeys;
     wxFileName fn( "user" );
 
-    fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
+    fn.SetExt( HotkeyFileExtension );
     fn.SetPath( SETTINGS_MANAGER::GetUserSettingsPath() );
 
     // Read the existing config (all hotkeys)
@@ -408,7 +411,7 @@ int ReadLegacyHotkeyConfigFile( const wxString& aFilename, std::map<std::string,
 {
     wxFileName fn( aFilename );
 
-    fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
+    fn.SetExt( HotkeyFileExtension );
     fn.SetPath( SETTINGS_MANAGER::GetUserSettingsPath() );
 
     if( !wxFile::Exists( fn.GetFullPath() ) )
diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp
index 1435888a8c..57d4dc9627 100644
--- a/common/pgm_base.cpp
+++ b/common/pgm_base.cpp
@@ -193,8 +193,8 @@ const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEdit
 
     // Show the modal editor and return the file chosen (may be empty if the user cancels
     // the dialog).
-    return EDA_FILE_SELECTOR( _( "Select Preferred Editor" ), path, name, ext, mask, nullptr,
-                              wxFD_OPEN | wxFD_FILE_MUST_EXIST, true );
+    return wxFileSelector( _( "Select Preferred Editor" ), path, name, wxT( "." ) + ext,
+                           mask, wxFD_OPEN | wxFD_FILE_MUST_EXIST, nullptr );
 }
 
 
diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp
index 29ab3e0fde..6c2b791342 100644
--- a/common/wildcards_and_files_ext.cpp
+++ b/common/wildcards_and_files_ext.cpp
@@ -138,6 +138,7 @@ const std::string GerberFileExtension( "gbr" );
 const std::string GerberJobFileExtension( "gbrjob" );
 const std::string HtmlFileExtension( "html" );
 const std::string EquFileExtension( "equ" );
+const std::string HotkeyFileExtension( "hotkeys" );
 
 const std::string ArchiveFileExtension( "zip" );
 
@@ -160,11 +161,13 @@ const std::string GedaPcbFootprintLibFileExtension( "fp" );     // this is a fil
 
 const std::string KiCadFootprintFileExtension( "kicad_mod" );
 const std::string SpecctraDsnFileExtension( "dsn" );
+const std::string SpecctraSessionFileExtension( "ses" );
 const std::string IpcD356FileExtension( "d356" );
 const std::string WorkbookFileExtension( "wbk" );
 
 const std::string PngFileExtension( "png" );
 const std::string JpegFileExtension( "jpg" );
+const std::string TextFileExtension( "txt" );
 
 
 bool IsProtelExtension( const wxString& ext )
@@ -500,6 +503,12 @@ wxString SpecctraDsnFileWildcard()
 }
 
 
+wxString SpecctraSessionFileWildcard()
+{
+    return _( "Specctra Session file" ) + AddFileExtListToFilter( { "ses" } );
+}
+
+
 wxString IpcD356FileWildcard()
 {
     return _( "IPC-D-356 Test Files" ) + AddFileExtListToFilter( { "d356" } );
@@ -522,3 +531,9 @@ wxString JpegFileWildcard()
 {
     return _( "Jpeg file" ) + AddFileExtListToFilter( { "jpg", "jpeg" } );
 }
+
+
+wxString HotkeyFileWildcard()
+{
+    return _( "Hotkey file" ) + AddFileExtListToFilter( { "hotkey" } );
+}
diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp
index 9de4f5254f..261ede5bd7 100644
--- a/eeschema/dialogs/dialog_bom.cpp
+++ b/eeschema/dialogs/dialog_bom.cpp
@@ -417,9 +417,9 @@ wxString DIALOG_BOM::chooseGenerator()
     if( lastPath.IsEmpty() )
         lastPath = PATHS::GetUserPluginsPath();
 
-    wxString fullFileName = EDA_FILE_SELECTOR( _( "Generator files:" ), lastPath, wxEmptyString,
-                                               wxEmptyString, wxFileSelectorDefaultWildcardStr,
-                                               this, wxFD_OPEN, true );
+    wxString fullFileName = wxFileSelector( _( "Generator File" ), lastPath, wxEmptyString,
+                                            wxEmptyString, wxFileSelectorDefaultWildcardStr,
+                                            wxFD_OPEN, this );
 
     return fullFileName;
 }
diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp
index 2710832dbc..563ef5df71 100644
--- a/eeschema/dialogs/dialog_netlist.cpp
+++ b/eeschema/dialogs/dialog_netlist.cpp
@@ -376,8 +376,8 @@ void NETLIST_DIALOG::InstallCustomPages()
 }
 
 
-NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
-                                                       const wxString & aCommandString,
+NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString& aTitle,
+                                                       const wxString& aCommandString,
                                                        NETLIST_TYPE_ID aNetTypeId )
 {
     NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
@@ -686,9 +686,11 @@ void NETLIST_DIALOG_ADD_GENERATOR::OnBrowseGenerators( wxCommandEvent& event )
 #else
     Path = PATHS::GetOSXKicadDataDir() + wxT( "/plugins" );
 #endif
-    FullFileName = EDA_FILE_SELECTOR( _( "Generator files:" ), Path, FullFileName,
-                                      wxEmptyString, wxFileSelectorDefaultWildcardStr,
-                                      this, wxFD_OPEN, true );
+
+    FullFileName = wxFileSelector( _( "Generator File" ), Path, FullFileName,
+                                   wxEmptyString, wxFileSelectorDefaultWildcardStr,
+                                   wxFD_OPEN, this );
+
     if( FullFileName.IsEmpty() )
         return;
 
diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp
index 84bd7842be..c83b2e14b5 100644
--- a/eeschema/tools/symbol_editor_control.cpp
+++ b/eeschema/tools/symbol_editor_control.cpp
@@ -32,7 +32,7 @@
 #include <symbol_viewer_frame.h>
 #include <symbol_tree_model_adapter.h>
 #include <wildcards_and_files_ext.h>
-#include <gestfich.h>
+#include <wildcards_and_files_ext.h>
 #include <bitmaps/bitmap_types.h>
 #include <confirm.h>
 #include <wx/filedlg.h>
@@ -427,15 +427,15 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
         return 0;
     }
 
-    wxString   file_ext = wxT( "svg" );
-    wxString   mask     = wxT( "*." ) + file_ext;
+    wxString   file_ext = SVGFileExtension;
     wxFileName fn( symbol->GetName() );
-    fn.SetExt( file_ext );
+    fn.SetExt( SVGFileExtension );
 
     wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
 
-    wxString fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir, fn.GetFullName(),
-                                               file_ext, mask, m_frame, wxFD_SAVE, true );
+    wxString fullFileName = wxFileSelector( _( "SVG File Name" ), pro_dir, fn.GetFullName(),
+                                            SVGFileExtension, SVGFileWildcard(), wxFD_SAVE,
+                                            m_frame );
 
     if( !fullFileName.IsEmpty() )
     {
@@ -443,7 +443,7 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
         PAGE_INFO pageTemp = pageSave;
 
         wxSize symbolSize = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
-                                                      editFrame->GetConvert() ).GetSize();
+                                                        editFrame->GetConvert() ).GetSize();
 
         // Add a small margin to the plot bounding box
         pageTemp.SetWidthMils(  int( symbolSize.x * 1.2 ) );
diff --git a/include/gestfich.h b/include/gestfich.h
index 7ca140f8a1..ed4119946d 100644
--- a/include/gestfich.h
+++ b/include/gestfich.h
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2009-2014 Jerry Jacobs
- * Copyright (C) 1992-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
+ * Copyright (C) 1992-2021 KiCad Developers, see CHANGELOG.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
@@ -66,36 +66,6 @@ bool CanPrintFile( const wxString& file );
  */
 void KiCopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors );
 
-/**
- * A helper function that wraps a call to wxFileSelector.
- *
- * @param aTitle is a string to display in the dialog title bar.
- * @param aPath is a string contain the default path for the path dialog.
- * @param aFileName is a string containing the default file name.
- * @param aExtension is a string containing the default file extension.
- * @param aWildcard is a string containing the default wildcard.
- * @param aParent is the parent window of the dialog.
- * @param aStyle is the style of the path dialog, wxFD_???.
- * @param aKeepWorkingDirectory determines if current working directory should be set to the
- *                              user selected path.
- * @param aPosition is the position of the dialog.
- * @param aMruPath is a pointer to a string to copy the path selected by the user when
- *                 the OK button is pressed to dismiss the dialog.  This can be NULL.
- * @return the full path and file name of the selected file or wxEmptyString if the user
- *         pressed the cancel button to dismiss the dialog.
- */
-wxString EDA_FILE_SELECTOR( const wxString& aTitle,
-                            const wxString& aPath,
-                            const wxString& aFileName,
-                            const wxString& aExtension,
-                            const wxString& aWildcard,
-                            wxWindow*       aParent,
-                            int             aStyle,
-                            const bool      aKeepWorkingDirectory,
-                            const wxPoint&  aPosition = wxDefaultPosition,
-                            wxString*       aMruPath = nullptr );
-
-
 /**
  * Call the executable file \a ExecFile with the command line parameters \a param.
  */
diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h
index 8134be31e2..f0509b50ee 100644
--- a/include/hotkeys_basic.h
+++ b/include/hotkeys_basic.h
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2004-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
@@ -27,7 +27,6 @@
 #include <wx/string.h>
 #include <map>
 
-#define DEFAULT_HOTKEY_FILENAME_EXT wxT( "hotkeys" )
 #define EESCHEMA_HOTKEY_NAME wxT( "Eeschema" )
 #define PCBNEW_HOTKEY_NAME wxT( "PcbNew" )
 
diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h
index 3d7f538ce3..f793fb2d7a 100644
--- a/include/wildcards_and_files_ext.h
+++ b/include/wildcards_and_files_ext.h
@@ -126,6 +126,7 @@ extern const std::string GerberFileExtension;
 extern const std::string GerberJobFileExtension;
 extern const std::string HtmlFileExtension;
 extern const std::string EquFileExtension;
+extern const std::string HotkeyFileExtension;
 
 extern const std::string ArchiveFileExtension;
 
@@ -150,11 +151,13 @@ extern const std::string GedaPcbFootprintLibFileExtension;
 extern const std::string EagleFootprintLibPathExtension;
 extern const std::string DrawingSheetFileExtension;
 extern const std::string SpecctraDsnFileExtension;
+extern const std::string SpecctraSessionFileExtension;
 extern const std::string IpcD356FileExtension;
 extern const std::string WorkbookFileExtension;
 
 extern const std::string PngFileExtension;
 extern const std::string JpegFileExtension;
+extern const std::string TextFileExtension;
 
 
 bool IsProtelExtension( const wxString& ext );
@@ -233,10 +236,12 @@ extern wxString GencadFileWildcard();
 extern wxString DxfFileWildcard();
 extern wxString GerberJobFileWildcard();
 extern wxString SpecctraDsnFileWildcard();
+extern wxString SpecctraSessionFileWildcard();
 extern wxString IpcD356FileWildcard();
 extern wxString WorkbookFileWildcard();
 extern wxString PngFileWildcard();
 extern wxString JpegFileWildcard();
+extern wxString HotkeyFileWildcard();
 
 /**
  * @}
diff --git a/kicad/project_tree_pane.cpp b/kicad/project_tree_pane.cpp
index 6594882a7f..51caae3f77 100644
--- a/kicad/project_tree_pane.cpp
+++ b/kicad/project_tree_pane.cpp
@@ -106,9 +106,6 @@ static const wxChar* s_allowedExtensionsToList[] = {
  *       library as required.
  */
 
-// File extension definitions.
-const wxChar  TextFileExtension[] = wxT( "txt" );
-
 // Gerber file extension wildcard.
 const wxString GerberFileExtensionWildCard( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" );
 
@@ -505,6 +502,7 @@ wxTreeItemId PROJECT_TREE_PANE::addItemToProjectTree( const wxString& aName,
             bool                  haveFile = dir.GetFirst( &dir_filename );
 
             data->SetPopulated( true );
+
 #ifndef __WINDOWS__
             subdir_populated = aRecurse;
 #endif
@@ -799,12 +797,13 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
     {
         popup_menu.AppendSeparator();
         AddMenuItem( &popup_menu, ID_PROJECT_PRINT,
+
 #ifdef __APPLE__
-                _( "Print..." ),
+                     _( "Print..." ),
 #else
-                _( "Print" ),
+                     _( "Print" ),
 #endif
-                _( "Print the contents of the file" ), KiBitmap( BITMAPS::print_button ) );
+                     _( "Print the contents of the file" ), KiBitmap( BITMAPS::print_button ) );
     }
 
     if( popup_menu.GetMenuItemCount() > 0 )
@@ -969,6 +968,7 @@ void PROJECT_TREE_PANE::onExpand( wxTreeEvent& Event )
             }
 
             itemData->SetPopulated( true );       // set state to populated
+
 #ifndef __WINDOWS__
             subdir_populated = true;
 #endif
@@ -1097,19 +1097,19 @@ void PROJECT_TREE_PANE::onFileSystemEvent( wxFileSystemWatcherEvent& event )
     switch( event.GetChangeType() )
     {
     case wxFSW_EVENT_CREATE:
-        {
-            wxTreeItemId newitem = addItemToProjectTree( pathModified.GetFullPath(), root_id,
-                                                         nullptr, true );
+    {
+        wxTreeItemId newitem =
+                addItemToProjectTree( pathModified.GetFullPath(), root_id, nullptr, true );
 
-            // If we are in the process of renaming a file, select the new one
-            // This is needed for MSW and OSX, since we don't get RENAME events from them, just a
-            // pair of DELETE and CREATE events.
-            if( m_isRenaming && newitem.IsOk() )
-            {
-                m_TreeProject->SelectItem( newitem );
-                m_isRenaming = false;
-            }
+        // If we are in the process of renaming a file, select the new one
+        // This is needed for MSW and OSX, since we don't get RENAME events from them, just a
+        // pair of DELETE and CREATE events.
+        if( m_isRenaming && newitem.IsOk() )
+        {
+            m_TreeProject->SelectItem( newitem );
+            m_isRenaming = false;
         }
+    }
         break;
 
     case wxFSW_EVENT_DELETE:
@@ -1127,45 +1127,45 @@ void PROJECT_TREE_PANE::onFileSystemEvent( wxFileSystemWatcherEvent& event )
         break;
 
     case wxFSW_EVENT_RENAME :
+    {
+        const wxFileName& newpath = event.GetNewPath();
+        wxString newdir = newpath.GetPath();
+        wxString newfn = newpath.GetFullPath();
+
+        while( kid.IsOk() )
         {
-            const wxFileName& newpath = event.GetNewPath();
-            wxString newdir = newpath.GetPath();
-            wxString newfn = newpath.GetFullPath();
+            PROJECT_TREE_ITEM* itemData = GetItemIdData( kid );
 
-            while( kid.IsOk() )
+            if( itemData && itemData->GetFileName() == fn )
             {
-                PROJECT_TREE_ITEM* itemData = GetItemIdData( kid );
-
-                if( itemData && itemData->GetFileName() == fn )
-                {
-                    m_TreeProject->Delete( kid );
-                    break;
-                }
-
-                kid = m_TreeProject->GetNextChild( root_id, cookie );
+                m_TreeProject->Delete( kid );
+                break;
             }
 
-            // Add the new item only if it is not the current project file (root item).
-            // Remember: this code is called by a wxFileSystemWatcherEvent event, and not always
-            // called after an actual file rename, and the cleanup code does not explore the
-            // root item, because it cannot be renamed by the user. Also, ensure the new file
-            // actually exists on the file system before it is readded. On Linux, moving a file
-            // to the trash can cause the same path to be returned in both the old and new paths
-            // of the event, even though the file isn't there anymore.
-            PROJECT_TREE_ITEM* rootData = GetItemIdData( root_id );
-
-            if( newpath.Exists() && ( newfn != rootData->GetFileName() ) )
-            {
-                wxTreeItemId newroot_id = findSubdirTreeItem( newdir );
-                wxTreeItemId newitem = addItemToProjectTree( newfn, newroot_id, nullptr, true );
-
-                // If the item exists, select it
-                if( newitem.IsOk() )
-                    m_TreeProject->SelectItem( newitem );
-            }
-
-            m_isRenaming = false;
+            kid = m_TreeProject->GetNextChild( root_id, cookie );
         }
+
+        // Add the new item only if it is not the current project file (root item).
+        // Remember: this code is called by a wxFileSystemWatcherEvent event, and not always
+        // called after an actual file rename, and the cleanup code does not explore the
+        // root item, because it cannot be renamed by the user. Also, ensure the new file
+        // actually exists on the file system before it is readded. On Linux, moving a file
+        // to the trash can cause the same path to be returned in both the old and new paths
+        // of the event, even though the file isn't there anymore.
+        PROJECT_TREE_ITEM* rootData = GetItemIdData( root_id );
+
+        if( newpath.Exists() && ( newfn != rootData->GetFileName() ) )
+        {
+            wxTreeItemId newroot_id = findSubdirTreeItem( newdir );
+            wxTreeItemId newitem = addItemToProjectTree( newfn, newroot_id, nullptr, true );
+
+            // If the item exists, select it
+            if( newitem.IsOk() )
+                m_TreeProject->SelectItem( newitem );
+        }
+
+        m_isRenaming = false;
+    }
         break;
     }
 
diff --git a/pcbnew/microwave/microwave_polygon.cpp b/pcbnew/microwave/microwave_polygon.cpp
index effaaf8e66..8d003188a9 100644
--- a/pcbnew/microwave/microwave_polygon.cpp
+++ b/pcbnew/microwave/microwave_polygon.cpp
@@ -27,7 +27,6 @@
 #include <confirm.h>
 #include <trigo.h>
 #include <kicad_string.h>
-#include <gestfich.h>
 #include <pcb_edit_frame.h>
 #include <dialog_helpers.h>
 #include <dialog_shim.h>
@@ -172,9 +171,8 @@ void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event )
     wxString fullFileName;
     wxString mask = wxFileSelectorDefaultWildcardStr;
 
-    fullFileName = EDA_FILE_SELECTOR( _( "Read Shape Description File" ), lastpath,
-                                      fullFileName, wxEmptyString, mask, this,
-                                      wxFD_OPEN, true );
+    fullFileName = wxFileSelector( _( "Shape Description File" ), lastpath,
+                                   fullFileName, wxEmptyString, mask, wxFD_OPEN, this );
 
     if( fullFileName.IsEmpty() )
         return;
diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp
index d2891b76cb..936edb295c 100644
--- a/pcbnew/tools/board_editor_control.cpp
+++ b/pcbnew/tools/board_editor_control.cpp
@@ -47,7 +47,6 @@
 #include <dialogs/dialog_page_settings.h>
 #include <dialogs/dialog_update_pcb.h>
 #include <functional>
-#include <gestfich.h>
 #include <kiface_i.h>
 #include <kiway.h>
 #include <memory>
@@ -375,10 +374,12 @@ int BOARD_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent )
     wxString ext;
 
     wxFileName::SplitPath( fullFileName, &path, &name, &ext );
-    name += wxT( ".ses" );
+    name += wxT( "." ) + SpecctraSessionFileExtension;
 
-    fullFileName = EDA_FILE_SELECTOR( _( "Merge Specctra Session file:" ), path, name,
-                                      wxT( ".ses" ), wxT( "*.ses" ), frame(), wxFD_OPEN, false );
+    fullFileName = wxFileSelector( _( "Specctra Session File" ), path, name,
+                                   wxT( "." ) + SpecctraSessionFileExtension,
+                                   SpecctraSessionFileWildcard(), wxFD_OPEN | wxFD_CHANGE_DIR,
+                                   frame() );
 
     if( !fullFileName.IsEmpty() )
         getEditFrame<PCB_EDIT_FRAME>()->ImportSpecctraSession( fullFileName );
@@ -400,9 +401,9 @@ int BOARD_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent )
     else
         fn = fullFileName;
 
-    fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
-                                      SpecctraDsnFileExtension, SpecctraDsnFileWildcard(),
-                                      frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false );
+    fullFileName = wxFileSelector( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
+                                   SpecctraDsnFileExtension, SpecctraDsnFileWildcard(),
+                                   wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR, frame() );
 
     if( !fullFileName.IsEmpty() )
     {