diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index 1274700f87..c13254bc60 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -29,25 +29,8 @@ */ #include -/** - * Format wildcard extension to support case sensitive file dialogs. - * - * The file extension wildcards of the GTK+ file dialog are case sensitive so using all lower - * case characters means that only file extensions that are all lower case will show up in the - * file dialog. The GTK+ file dialog does support regular expressions so the file extension - * is converted to a regular expression ( sch -> [sS][cC][hH] ) when wxWidgets is built against - * GTK+. Please make sure you call this function when adding new file wildcards. - * - * @note When calling wxFileDialog with a default file defined, make sure you include the - * file extension along with the file name. Otherwise, on GTK+ builds, the file - * dialog will append the wildcard regular expression as the file extension which is - * surely not what you want. - * - * @param aWildcard is the extension part of the wild card. - * - * @return the build appropriate file dialog wildcard filter. - */ -static wxString formatWildcardExt( const wxString& aWildcard ) + +wxString formatWildcardExt( const wxString& aWildcard ) { wxString wc; #if defined( __WXGTK__ ) @@ -68,6 +51,7 @@ static wxString formatWildcardExt( const wxString& aWildcard ) #endif } + wxString AddFileExtListToFilter( const std::vector& aExts ) { if( aExts.size() == 0 ) diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h index 3454084a0f..a8692ab621 100644 --- a/include/wildcards_and_files_ext.h +++ b/include/wildcards_and_files_ext.h @@ -69,6 +69,25 @@ wxString AddFileExtListToFilter( const std::vector& aExts ); +/** + * Format wildcard extension to support case sensitive file dialogs. + * + * The file extension wildcards of the GTK+ file dialog are case sensitive so using all lower + * case characters means that only file extensions that are all lower case will show up in the + * file dialog. The GTK+ file dialog does support regular expressions so the file extension + * is converted to a regular expression ( sch -> [sS][cC][hH] ) when wxWidgets is built against + * GTK+. Please make sure you call this function when adding new file wildcards. + * + * @note When calling wxFileDialog with a default file defined, make sure you include the + * file extension along with the file name. Otherwise, on GTK+ builds, the file + * dialog will append the wildcard regular expression as the file extension which is + * surely not what you want. + * + * @param aWildcard is the extension part of the wild card. + * + * @return the build appropriate file dialog wildcard filter. + */ +wxString formatWildcardExt( const wxString& aWildcard ); // Do NOT use wxString for these. wxStrings are not thread-safe, even when const. (For the // curious the UTF8 cacheing strategy puts iterators in a linked list. Insertion and removal diff --git a/pcbnew/import_gfx/dxf_import_plugin.h b/pcbnew/import_gfx/dxf_import_plugin.h index 9288f37523..fb7b1541c8 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.h +++ b/pcbnew/import_gfx/dxf_import_plugin.h @@ -28,9 +28,11 @@ #include "graphics_import_plugin.h" #include "graphics_importer_buffer.h" -#include "dl_dxf.h" -#include "dl_creationadapter.h" -#include "wx/wx.h" +#include +#include +#include +#include + #include class BOARD; @@ -146,10 +148,7 @@ public: const wxArrayString GetFileExtensions() const override { - wxArrayString list; - list.Add( "dxf" ); - list.Add( "DXF" ); - return list; + return wxArrayString( 1, formatWildcardExt( "dxf" ) ); } bool Load( const wxString& aFileName ) override; diff --git a/pcbnew/import_gfx/svg_import_plugin.h b/pcbnew/import_gfx/svg_import_plugin.h index 13c7c3c330..bbd441cdc6 100644 --- a/pcbnew/import_gfx/svg_import_plugin.h +++ b/pcbnew/import_gfx/svg_import_plugin.h @@ -3,7 +3,7 @@ * * Copyright (C) 2016 CERN * @author Janito V. Ferreira Filho - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2019 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,12 +26,13 @@ #ifndef SVG_IMPORT_PLUGIN_H #define SVG_IMPORT_PLUGIN_H -#include "vector" - #include "nanosvg.h" #include "graphics_import_plugin.h" #include +#include + +#include class SVG_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN @@ -44,10 +45,8 @@ public: const wxArrayString GetFileExtensions() const override { - wxArrayString list; - list.Add( "svg" ); - list.Add( "SVG" ); - return list; + + return wxArrayString( 1, formatWildcardExt( "svg" ) ); } /**