2012-02-16 20:03:33 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-01-01 14:38:57 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-11-12 00:31:38 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2019-01-01 14:38:57 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-02-16 20:03:33 +00:00
|
|
|
*
|
|
|
|
* 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 wildcards_and_files_ext.cpp
|
2019-01-01 14:38:57 +00:00
|
|
|
* Definition of file extensions used in Kicad.
|
2012-02-16 20:03:33 +00:00
|
|
|
*/
|
|
|
|
#include <wildcards_and_files_ext.h>
|
|
|
|
|
2019-06-15 03:27:36 +00:00
|
|
|
|
|
|
|
wxString formatWildcardExt( const wxString& aWildcard )
|
2017-11-12 00:31:38 +00:00
|
|
|
{
|
|
|
|
wxString wc;
|
|
|
|
#if defined( __WXGTK__ )
|
|
|
|
|
|
|
|
for( auto ch : aWildcard )
|
|
|
|
{
|
|
|
|
if( wxIsalpha( ch ) )
|
|
|
|
wc += wxString::Format( "[%c%c]", wxTolower( ch ), wxToupper( ch ) );
|
|
|
|
else
|
|
|
|
wc += ch;
|
|
|
|
}
|
|
|
|
|
|
|
|
return wc;
|
|
|
|
#else
|
|
|
|
wc = aWildcard;
|
|
|
|
|
|
|
|
return wc;
|
|
|
|
#endif
|
|
|
|
}
|
2012-02-16 20:03:33 +00:00
|
|
|
|
2019-06-15 03:27:36 +00:00
|
|
|
|
2019-01-05 23:55:14 +00:00
|
|
|
wxString AddFileExtListToFilter( const std::vector<std::string>& aExts )
|
2019-01-01 14:38:57 +00:00
|
|
|
{
|
2019-01-08 11:57:39 +00:00
|
|
|
if( aExts.size() == 0 )
|
|
|
|
{
|
|
|
|
// The "all files" wildcard is different on different systems
|
|
|
|
wxString filter;
|
|
|
|
filter << " (" << wxFileSelectorDefaultWildcardStr << ")|"
|
|
|
|
<< wxFileSelectorDefaultWildcardStr;
|
|
|
|
return filter;
|
|
|
|
}
|
|
|
|
|
2019-01-01 16:04:40 +00:00
|
|
|
wxString files_filter = " (";
|
2019-01-01 14:38:57 +00:00
|
|
|
|
|
|
|
// Add extensions to the info message:
|
2019-01-05 23:55:14 +00:00
|
|
|
for( const auto& ext : aExts )
|
2019-01-01 14:38:57 +00:00
|
|
|
{
|
2019-01-01 16:04:40 +00:00
|
|
|
files_filter << " *." << ext;
|
2019-01-01 14:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
files_filter << ")|*.";
|
|
|
|
|
2019-01-01 16:04:40 +00:00
|
|
|
// Add extensions to the filter list, using a formated string (GTK specific):
|
2019-01-05 23:55:14 +00:00
|
|
|
bool first = true;
|
|
|
|
for( const auto& ext : aExts )
|
2019-01-01 14:38:57 +00:00
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
if( !first )
|
2019-01-01 14:38:57 +00:00
|
|
|
files_filter << ";*.";
|
|
|
|
|
2019-01-05 23:55:14 +00:00
|
|
|
first = false;
|
|
|
|
|
2019-01-01 14:38:57 +00:00
|
|
|
files_filter << formatWildcardExt( ext );
|
|
|
|
}
|
|
|
|
|
|
|
|
return files_filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-02 22:15:01 +00:00
|
|
|
const std::string SchematicSymbolFileExtension( "sym" );
|
|
|
|
const std::string SchematicLibraryFileExtension( "lib" );
|
|
|
|
|
|
|
|
const std::string VrmlFileExtension( "wrl" );
|
|
|
|
|
|
|
|
const std::string ProjectFileExtension( "pro" );
|
|
|
|
const std::string SchematicFileExtension( "sch" );
|
|
|
|
const std::string NetlistFileExtension( "net" );
|
|
|
|
const std::string ComponentFileExtension( "cmp" );
|
|
|
|
const std::string GerberFileExtension( "gbr" );
|
|
|
|
const std::string GerberJobFileExtension( "gbrjob" );
|
|
|
|
const std::string HtmlFileExtension( "html" );
|
2019-08-09 19:37:41 +00:00
|
|
|
const std::string EquFileExtension( "equ" );
|
2018-08-02 22:15:01 +00:00
|
|
|
|
|
|
|
const std::string LegacyPcbFileExtension( "brd" );
|
|
|
|
const std::string KiCadPcbFileExtension( "kicad_pcb" );
|
|
|
|
const std::string PageLayoutDescrFileExtension( "kicad_wks" );
|
|
|
|
|
|
|
|
const std::string PdfFileExtension( "pdf" );
|
|
|
|
const std::string MacrosFileExtension( "mcr" );
|
|
|
|
const std::string DrillFileExtension( "drl" );
|
|
|
|
const std::string SVGFileExtension( "svg" );
|
|
|
|
const std::string ReportFileExtension( "rpt" );
|
|
|
|
const std::string FootprintPlaceFileExtension( "pos" );
|
|
|
|
const std::string KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath
|
|
|
|
|
|
|
|
const std::string KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath
|
|
|
|
const std::string LegacyFootprintLibPathExtension( "mod" );
|
|
|
|
const std::string EagleFootprintLibPathExtension( "lbr" );
|
|
|
|
|
|
|
|
const std::string KiCadFootprintFileExtension( "kicad_mod" );
|
|
|
|
const std::string GedaPcbFootprintLibFileExtension( "fp" );
|
|
|
|
const std::string SpecctraDsnFileExtension( "dsn" );
|
|
|
|
const std::string IpcD356FileExtension( "d356" );
|
2017-11-12 00:31:38 +00:00
|
|
|
|
2018-12-08 13:20:32 +00:00
|
|
|
const std::string PngFileExtension( "png" );
|
|
|
|
const std::string JpegFileExtension( "jpg" );
|
|
|
|
|
2017-11-12 00:31:38 +00:00
|
|
|
|
2019-01-08 11:57:39 +00:00
|
|
|
wxString AllFilesWildcard()
|
|
|
|
{
|
|
|
|
return _( "All files" ) + AddFileExtListToFilter( {} );
|
|
|
|
}
|
2012-02-16 20:03:33 +00:00
|
|
|
|
2017-11-12 00:31:38 +00:00
|
|
|
|
|
|
|
wxString SchematicSymbolFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad drawing symbol files" ) + AddFileExtListToFilter( { "sym" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString SchematicLibraryFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad symbol library files" ) + AddFileExtListToFilter( { "lib" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString ProjectFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad project files" ) + AddFileExtListToFilter( { "pro" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString SchematicFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad schematic files" ) + AddFileExtListToFilter( { "sch" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString EagleSchematicFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Eagle XML schematic files" ) + AddFileExtListToFilter( { "sch" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString EagleFilesWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Eagle XML files" ) + AddFileExtListToFilter( { "sch", "brd" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString NetlistFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad netlist files" ) + AddFileExtListToFilter( { "net" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString GerberFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Gerber files" ) + AddFileExtListToFilter( { "pho" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString LegacyPcbFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad printed circuit board files" ) + AddFileExtListToFilter( { "brd" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString EaglePcbFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Eagle ver. 6.x XML PCB files" ) + AddFileExtListToFilter( { "brd" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString PCadPcbFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "P-Cad 200x ASCII PCB files" ) + AddFileExtListToFilter( { "pcb" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString PcbFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad printed circuit board files" ) + AddFileExtListToFilter( { "kicad_pcb" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString KiCadFootprintLibFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad footprint files" ) + AddFileExtListToFilter( { "kicad_mod" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString KiCadFootprintLibPathWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad footprint library paths" ) + AddFileExtListToFilter( { "pretty" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString LegacyFootprintLibPathWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Legacy footprint library files" ) + AddFileExtListToFilter( { "mod" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString EagleFootprintLibPathWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Eagle ver. 6.x XML library files" ) + AddFileExtListToFilter( { "lbr" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString GedaPcbFootprintLibFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Geda PCB footprint library files" ) + AddFileExtListToFilter( { "fp" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString PageLayoutDescrFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Page layout design files" ) + AddFileExtListToFilter( { "kicad_wks" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-16 20:03:33 +00:00
|
|
|
// Wildcard for cvpcb component to footprint link file
|
2017-11-12 00:31:38 +00:00
|
|
|
wxString ComponentFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "KiCad symbol footprint link files" ) + AddFileExtListToFilter( { "cmp" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
2012-02-16 20:03:33 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
// Wildcard for reports and fabrication documents
|
2017-11-12 00:31:38 +00:00
|
|
|
wxString DrillFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Drill files" ) + AddFileExtListToFilter( { "drl", "nc", "xnc" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString SVGFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "SVG files" ) + AddFileExtListToFilter( { "svg" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString HtmlFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "HTML files" ) + AddFileExtListToFilter( { "htm", "html" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString CsvFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "CSV Files" ) + AddFileExtListToFilter( { "csv" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString PdfFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Portable document format files" ) + AddFileExtListToFilter( { "pdf" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString PSFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "PostScript files" ) + AddFileExtListToFilter( { "ps" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString ReportFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Report files" ) + AddFileExtListToFilter( { "rpt" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString FootprintPlaceFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Footprint place files" ) + AddFileExtListToFilter( { "pos" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString Shapes3DFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "VRML and X3D files" ) + AddFileExtListToFilter( { "wrl", "x3d" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString IDF3DFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "IDFv3 footprint files" ) + AddFileExtListToFilter( { "idf" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString TextFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Text files" ) + AddFileExtListToFilter( { "txt" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString ModLegacyExportFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Legacy footprint export files" ) + AddFileExtListToFilter( { "emp" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString ErcFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Electronic rule check file" ) + AddFileExtListToFilter( { "erc" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString SpiceLibraryFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Spice library file" ) + AddFileExtListToFilter( { "lib" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString SpiceNetlistFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "SPICE netlist file" ) + AddFileExtListToFilter( { "cir" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString CadstarNetlistFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "CadStar netlist file" ) + AddFileExtListToFilter( { "frp" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString EquFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Symbol footprint association files" ) + AddFileExtListToFilter( { "equ" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString ZipFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Zip file" ) + AddFileExtListToFilter( { "zip" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString GencadFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "GenCAD 1.4 board files" ) + AddFileExtListToFilter( { "cad" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString DxfFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "DXF Files" ) + AddFileExtListToFilter( { "dxf" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString GerberJobFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Gerber job file" ) + AddFileExtListToFilter( { "gbrjob" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString SpecctraDsnFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Specctra DSN file" ) + AddFileExtListToFilter( { "dsn" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString IpcD356FileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "IPC-D-356 Test Files" ) + AddFileExtListToFilter( { "d356" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString WorkbookFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Workbook file" ) + AddFileExtListToFilter( { "wbk" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString PngFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "PNG file" ) + AddFileExtListToFilter( { "png" } );
|
2017-11-12 00:31:38 +00:00
|
|
|
}
|
2018-12-08 13:20:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxString JpegFileWildcard()
|
|
|
|
{
|
2019-01-05 23:55:14 +00:00
|
|
|
return _( "Jpeg file" ) + AddFileExtListToFilter( { "jpg", "jpeg" } );
|
2018-12-08 13:20:32 +00:00
|
|
|
}
|