KiCad PCB EDA Suite
File Extension Definitions


#define PcbFileExtension   KiCadPcbFileExtension


bool compareFileExtensions (const std::string &aExtension, const std::vector< std::string > &aReference, bool aCaseSensitive=false)
 Compare the given extension against the reference extensions to see if it matches any of the reference extensions. More...
wxString AddFileExtListToFilter (const std::vector< std::string > &aExts)
 Build the wildcard extension file dialog wildcard filter to add to the base message dialog. More...
wxString formatWildcardExt (const wxString &aWildcard)
 Format wildcard extension to support case sensitive file dialogs. More...
bool IsProtelExtension (const wxString &ext)


const std::string BackupFileSuffix
const std::string SchematicSymbolFileExtension
const std::string LegacySymbolLibFileExtension
const std::string LegacySymbolDocumentFileExtension
const std::string SchematicBackupFileExtension
const std::string VrmlFileExtension
const std::string ProjectFileExtension
const std::string LegacyProjectFileExtension
const std::string ProjectLocalSettingsFileExtension
const std::string LegacySchematicFileExtension
const std::string KiCadSchematicFileExtension
const std::string NetlistFileExtension
const std::string GerberFileExtension
const std::string GerberJobFileExtension
const std::string HtmlFileExtension
const std::string EquFileExtension
const std::string ArchiveFileExtension
const std::string LegacyPcbFileExtension
const std::string KiCadPcbFileExtension
const std::string KiCadSymbolLibFileExtension
const std::string PageLayoutDescrFileExtension
const std::string DesignRulesFileExtension
const std::string LegacyFootprintLibPathExtension
const std::string PdfFileExtension
const std::string MacrosFileExtension
const std::string ComponentFileExtension
const std::string DrillFileExtension
const std::string SVGFileExtension
const std::string ReportFileExtension
const std::string FootprintPlaceFileExtension
const std::string KiCadFootprintFileExtension
const std::string KiCadFootprintLibPathExtension
const std::string GedaPcbFootprintLibFileExtension
const std::string EagleFootprintLibPathExtension
const std::string SpecctraDsnFileExtension
const std::string IpcD356FileExtension
const std::string PngFileExtension
const std::string JpegFileExtension

Detailed Description

Please do not changes these. If a different file extension is needed, create a new definition in here. If you create a extension definition in another file, make sure to add it to the Doxygen group "file_extensions" using the "addtogroup" tag. Also note, just because they are defined as const doesn't guarantee that they cannot be changed.

Macro Definition Documentation

◆ PcbFileExtension

#define PcbFileExtension   KiCadPcbFileExtension

Definition at line 134 of file wildcards_and_files_ext.h.

Function Documentation

◆ AddFileExtListToFilter()

wxString AddFileExtListToFilter ( const std::vector< std::string > &  aExts)

Build the wildcard extension file dialog wildcard filter to add to the base message dialog.

For instance, to open .txt files in a file dialog: the base message is for instance "Text files" the ext list is " (*.txt)|*.txt" and the returned string to add to the base message is " (*.txt)|*.txt" the message to display in the dialog is "Text files (*.txt)|*.txt"

This function produces a case-insensitive filter (so .txt, .TXT and .tXT are all match if you pass "txt" into the function).

aExtsis the list of exts to add to the filter. Do not include the leading dot. Empty means "allow all files".
the appropriate file dialog wildcard filter list.

Definition at line 82 of file wildcards_and_files_ext.cpp.

83 {
84  if( aExts.size() == 0 )
85  {
86  // The "all files" wildcard is different on different systems
87  wxString filter;
88  filter << " (" << wxFileSelectorDefaultWildcardStr << ")|"
89  << wxFileSelectorDefaultWildcardStr;
90  return filter;
91  }
93  wxString files_filter = " (";
95  // Add extensions to the info message:
96  for( const std::string& ext : aExts )
97  {
98  if( files_filter.length() > 2 )
99  files_filter << "; ";
101  files_filter << "*." << ext;
102  }
104  files_filter << ")|*.";
106  // Add extensions to the filter list, using a formated string (GTK specific):
107  bool first = true;
108  for( const auto& ext : aExts )
109  {
110  if( !first )
111  files_filter << ";*.";
113  first = false;
115  files_filter << formatWildcardExt( ext );
116  }
118  return files_filter;
119 }
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.

References filter, and formatWildcardExt().

Referenced by AllFilesWildcard(), AllProjectFilesWildcard(), AllSymbolLibFilesWildcard(), AltiumCircuitMakerPcbFileWildcard(), AltiumCircuitStudioPcbFileWildcard(), AltiumDesignerPcbFileWildcard(), AltiumSchematicFileWildcard(), AskLoadBoardFileName(), BOOST_AUTO_TEST_CASE(), CadstarArchiveFilesWildcard(), CadstarNetlistFileWildcard(), CadstarPcbArchiveFileWildcard(), CadstarSchematicArchiveFileWildcard(), ComponentFileWildcard(), CsvFileWildcard(), DrillFileWildcard(), DxfFileWildcard(), EagleFilesWildcard(), EagleFootprintLibPathWildcard(), EaglePcbFileWildcard(), EagleSchematicFileWildcard(), EquFileWildcard(), ErcFileWildcard(), FabmasterPcbFileWildcard(), FootprintPlaceFileWildcard(), GedaPcbFootprintLibFileWildcard(), GencadFileWildcard(), GerberFileWildcard(), GerberJobFileWildcard(), HtmlFileWildcard(), IDF3DFileWildcard(), FIELDS_GRID_TABLE< SCH_FIELD >::initGrid(), IpcD356FileWildcard(), JpegFileWildcard(), KiCadFootprintLibFileWildcard(), KiCadFootprintLibPathWildcard(), KiCadSchematicFileWildcard(), KiCadSymbolLibFileWildcard(), LegacyFootprintLibPathWildcard(), LegacyPcbFileWildcard(), LegacyProjectFileWildcard(), LegacySchematicFileWildcard(), LegacySymbolLibFileWildcard(), ModLegacyExportFileWildcard(), NetlistFileWildcard(), DIALOG_IMPORT_GFX::onBrowseFiles(), DIALOG_NET_INSPECTOR::onReport(), PageLayoutDescrFileWildcard(), PCadPcbFileWildcard(), PcbFileWildcard(), PdfFileWildcard(), PngFileWildcard(), ProjectFileWildcard(), PSFileWildcard(), ReportFileWildcard(), SchematicSymbolFileWildcard(), Shapes3DFileWildcard(), SpecctraDsnFileWildcard(), SpiceLibraryFileWildcard(), SpiceNetlistFileWildcard(), SVGFileWildcard(), TextFileWildcard(), WorkbookFileWildcard(), and ZipFileWildcard().

◆ compareFileExtensions()

bool compareFileExtensions ( const std::string &  aExtension,
const std::vector< std::string > &  aReference,
bool  aCaseSensitive = false 

Compare the given extension against the reference extensions to see if it matches any of the reference extensions.

This function uses the C++ regular expression functionality to perform the comparison, so the reference extensions can be regular expressions of their own right. This means that partial searches can be made, for example ^g.* can be used to see if the first character of the extension is g. The reference extensions are concatenated together as alternatives when doing the evaluation (e.g. (dxf|svg|^g.*) ).

aExtensionis the extension to test
aReferenceis a vector containing the extensions to test against
aCaseSensitivesays if the comparison should be case sensitive or not
if the extension matches any reference extensions

Definition at line 36 of file wildcards_and_files_ext.cpp.

38 {
39  // Form the regular expression string by placing all possible extensions into it as alternatives
40  std::string regexString = "(";
41  bool first = true;
42  for( const auto& ext : aReference )
43  {
44  // The | separate goes between the extensions
45  if( !first )
46  regexString += "|";
47  else
48  first = false;
50  regexString += ext;
51  }
52  regexString += ")";
54  // Create the regex and see if it matches
55  std::regex extRegex( regexString, aCaseSensitive ? std::regex::ECMAScript : std::regex::icase );
56  return std::regex_match( aExtension, extRegex );
57 }

Referenced by BOOST_AUTO_TEST_CASE(), and GRAPHICS_IMPORT_MGR::GetPluginByExt().

◆ formatWildcardExt()

wxString formatWildcardExt ( const wxString &  aWildcard)

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.

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.
aWildcardis the extension part of the wild card.
the build appropriate file dialog wildcard filter.

Definition at line 60 of file wildcards_and_files_ext.cpp.

61 {
62  wxString wc;
63 #if defined( __WXGTK__ )
65  for( auto ch : aWildcard )
66  {
67  if( wxIsalpha( ch ) )
68  wc += wxString::Format( "[%c%c]", wxTolower( ch ), wxToupper( ch ) );
69  else
70  wc += ch;
71  }
73  return wc;
74 #else
75  wc = aWildcard;
77  return wc;
78 #endif
79 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format().

Referenced by AddFileExtListToFilter(), AskLoadBoardFileName(), GRAPHICS_IMPORT_PLUGIN::GetWildcards(), and SCH_EDIT_FRAME::OnImportProject().

◆ IsProtelExtension()

bool IsProtelExtension ( const wxString &  ext)

Definition at line 169 of file wildcards_and_files_ext.cpp.

170 {
171  static wxRegEx protelRE( wxT( "(gm1)|(g[tb][lapos])|(g\\d\\d*)" ), wxRE_ICASE );
173  return protelRE.Matches( ext );
174 }

Referenced by SAVE_AS_TRAVERSER::OnFile().

Variable Documentation

◆ ArchiveFileExtension

◆ BackupFileSuffix

const std::string BackupFileSuffix

◆ ComponentFileExtension

const std::string ComponentFileExtension

◆ DesignRulesFileExtension

◆ DrillFileExtension

◆ EagleFootprintLibPathExtension

const std::string EagleFootprintLibPathExtension

◆ EquFileExtension

const std::string EquFileExtension

◆ FootprintPlaceFileExtension

const std::string FootprintPlaceFileExtension

◆ GedaPcbFootprintLibFileExtension

const std::string GedaPcbFootprintLibFileExtension

◆ GerberFileExtension

const std::string GerberFileExtension

◆ GerberJobFileExtension

◆ HtmlFileExtension

const std::string HtmlFileExtension

◆ IpcD356FileExtension

const std::string IpcD356FileExtension

◆ JpegFileExtension

const std::string JpegFileExtension

◆ KiCadFootprintFileExtension

◆ KiCadFootprintLibPathExtension

◆ KiCadPcbFileExtension

◆ KiCadSchematicFileExtension

◆ KiCadSymbolLibFileExtension

◆ LegacyFootprintLibPathExtension

const std::string LegacyFootprintLibPathExtension

◆ LegacyPcbFileExtension

◆ LegacyProjectFileExtension

◆ LegacySchematicFileExtension

◆ LegacySymbolDocumentFileExtension

const std::string LegacySymbolDocumentFileExtension

◆ LegacySymbolLibFileExtension

◆ MacrosFileExtension

const std::string MacrosFileExtension

◆ NetlistFileExtension

◆ PageLayoutDescrFileExtension

◆ PdfFileExtension

const std::string PdfFileExtension

◆ PngFileExtension

const std::string PngFileExtension

◆ ProjectFileExtension

◆ ProjectLocalSettingsFileExtension

const std::string ProjectLocalSettingsFileExtension

◆ ReportFileExtension

◆ SchematicBackupFileExtension

const std::string SchematicBackupFileExtension

◆ SchematicSymbolFileExtension

const std::string SchematicSymbolFileExtension

◆ SpecctraDsnFileExtension

const std::string SpecctraDsnFileExtension

◆ SVGFileExtension

const std::string SVGFileExtension

◆ VrmlFileExtension

const std::string VrmlFileExtension