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
|
2012-02-16 20:03:33 +00:00
|
|
|
* Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2017-11-12 00:31:38 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2020-02-13 13:39:52 +00:00
|
|
|
* Copyright (C) 1992-2020 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.h
|
2019-01-01 14:38:57 +00:00
|
|
|
* Definition of file extensions used in Kicad.
|
2012-02-16 20:03:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDE_WILDCARDS_AND_FILES_EXT_H_
|
|
|
|
#define INCLUDE_WILDCARDS_AND_FILES_EXT_H_
|
|
|
|
|
2019-01-05 23:55:14 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2021-05-01 07:50:29 +00:00
|
|
|
#include <wx/string.h>
|
2019-01-05 23:55:14 +00:00
|
|
|
|
2012-02-16 20:03:33 +00:00
|
|
|
/**
|
2017-11-12 00:31:38 +00:00
|
|
|
* \defgroup file_extensions File Extension Definitions
|
|
|
|
*
|
|
|
|
* @note 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.
|
|
|
|
*
|
|
|
|
* @{
|
2012-02-16 20:03:33 +00:00
|
|
|
*/
|
2012-09-28 17:47:41 +00:00
|
|
|
|
2019-09-26 20:09:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.*) ).
|
|
|
|
*
|
|
|
|
* @param aExtension is the extension to test
|
|
|
|
* @param aReference is a vector containing the extensions to test against
|
|
|
|
* @param aCaseSensitive says if the comparison should be case sensitive or not
|
|
|
|
*
|
|
|
|
* @return if the extension matches any reference extensions
|
|
|
|
*/
|
|
|
|
bool compareFileExtensions( const std::string& aExtension,
|
|
|
|
const std::vector<std::string>& aReference, bool aCaseSensitive = false );
|
|
|
|
|
2019-01-01 14:38:57 +00:00
|
|
|
/**
|
2019-01-05 23:55:14 +00:00
|
|
|
* 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:
|
2019-01-01 14:38:57 +00:00
|
|
|
* 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"
|
|
|
|
*
|
2019-01-05 23:55:14 +00:00
|
|
|
* This function produces a case-insensitive filter (so .txt, .TXT and .tXT
|
|
|
|
* are all match if you pass "txt" into the function).
|
|
|
|
*
|
|
|
|
* @param aExts is the list of exts to add to the filter. Do not include the
|
2019-01-08 11:57:39 +00:00
|
|
|
* leading dot. Empty means "allow all files".
|
2019-01-01 14:38:57 +00:00
|
|
|
*
|
|
|
|
* @return the appropriate file dialog wildcard filter list.
|
|
|
|
*/
|
|
|
|
|
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-06-15 03:27:36 +00:00
|
|
|
/**
|
|
|
|
* 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 );
|
2019-01-01 14:38:57 +00:00
|
|
|
|
2021-03-03 01:06:25 +00:00
|
|
|
extern const std::string BackupFileSuffix;
|
|
|
|
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string SchematicSymbolFileExtension;
|
2020-05-15 13:25:11 +00:00
|
|
|
extern const std::string LegacySymbolLibFileExtension;
|
2021-03-03 01:06:25 +00:00
|
|
|
extern const std::string LegacySymbolDocumentFileExtension;
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string SchematicBackupFileExtension;
|
2012-09-28 17:47:41 +00:00
|
|
|
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string VrmlFileExtension;
|
|
|
|
extern const std::string ProjectFileExtension;
|
2020-05-25 17:06:53 +00:00
|
|
|
extern const std::string LegacyProjectFileExtension;
|
2020-05-31 21:42:04 +00:00
|
|
|
extern const std::string ProjectLocalSettingsFileExtension;
|
2020-03-16 13:04:50 +00:00
|
|
|
extern const std::string LegacySchematicFileExtension;
|
|
|
|
extern const std::string KiCadSchematicFileExtension;
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string NetlistFileExtension;
|
|
|
|
extern const std::string GerberFileExtension;
|
|
|
|
extern const std::string GerberJobFileExtension;
|
|
|
|
extern const std::string HtmlFileExtension;
|
2019-08-09 19:37:41 +00:00
|
|
|
extern const std::string EquFileExtension;
|
2021-07-28 17:25:40 +00:00
|
|
|
extern const std::string HotkeyFileExtension;
|
2020-07-03 13:40:31 +00:00
|
|
|
|
|
|
|
extern const std::string ArchiveFileExtension;
|
2012-12-14 16:54:54 +00:00
|
|
|
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string LegacyPcbFileExtension;
|
|
|
|
extern const std::string KiCadPcbFileExtension;
|
2012-12-14 16:54:54 +00:00
|
|
|
#define PcbFileExtension KiCadPcbFileExtension // symlink choice
|
2020-02-13 13:39:52 +00:00
|
|
|
extern const std::string KiCadSymbolLibFileExtension;
|
2021-05-30 22:56:24 +00:00
|
|
|
extern const std::string DrawingSheetFileExtension;
|
2020-09-25 01:26:23 +00:00
|
|
|
extern const std::string DesignRulesFileExtension;
|
2012-12-14 16:54:54 +00:00
|
|
|
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string LegacyFootprintLibPathExtension;
|
|
|
|
extern const std::string PdfFileExtension;
|
|
|
|
extern const std::string MacrosFileExtension;
|
2021-06-14 18:00:08 +00:00
|
|
|
extern const std::string FootprintAssignmentFileExtension;
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string DrillFileExtension;
|
|
|
|
extern const std::string SVGFileExtension;
|
|
|
|
extern const std::string ReportFileExtension;
|
|
|
|
extern const std::string FootprintPlaceFileExtension;
|
|
|
|
extern const std::string KiCadFootprintFileExtension;
|
|
|
|
extern const std::string KiCadFootprintLibPathExtension;
|
|
|
|
extern const std::string GedaPcbFootprintLibFileExtension;
|
|
|
|
extern const std::string EagleFootprintLibPathExtension;
|
2021-05-30 22:56:24 +00:00
|
|
|
extern const std::string DrawingSheetFileExtension;
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string SpecctraDsnFileExtension;
|
2021-07-28 17:25:40 +00:00
|
|
|
extern const std::string SpecctraSessionFileExtension;
|
2018-08-02 22:15:01 +00:00
|
|
|
extern const std::string IpcD356FileExtension;
|
2021-07-04 01:48:12 +00:00
|
|
|
extern const std::string WorkbookFileExtension;
|
2012-02-16 20:03:33 +00:00
|
|
|
|
2018-12-08 13:20:32 +00:00
|
|
|
extern const std::string PngFileExtension;
|
|
|
|
extern const std::string JpegFileExtension;
|
2021-07-28 17:25:40 +00:00
|
|
|
extern const std::string TextFileExtension;
|
2018-12-08 13:20:32 +00:00
|
|
|
|
2019-11-11 20:34:42 +00:00
|
|
|
|
|
|
|
bool IsProtelExtension( const wxString& ext );
|
|
|
|
|
2017-11-12 00:31:38 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2013-01-03 16:33:22 +00:00
|
|
|
|
2012-02-16 20:03:33 +00:00
|
|
|
|
2017-11-12 00:31:38 +00:00
|
|
|
/**
|
|
|
|
* \defgroup file_wildcards File Wildcard Definitions
|
|
|
|
*
|
|
|
|
* @note Please do not changes these. If a different file wildcard is needed, create a new
|
|
|
|
* definition in here. If you create a wildcard definition in another file, make sure
|
|
|
|
* to add it to the Doxygen group "file_extensions" using the "addtogroup" tag and
|
|
|
|
* correct handle the GTK+ file dialog case sensitivity issue.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2019-01-08 11:57:39 +00:00
|
|
|
extern wxString AllFilesWildcard();
|
2018-08-02 22:15:01 +00:00
|
|
|
|
2021-06-14 18:00:08 +00:00
|
|
|
extern wxString FootprintAssignmentFileWildcard();
|
2021-05-30 22:56:24 +00:00
|
|
|
extern wxString DrawingSheetFileWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
extern wxString SchematicSymbolFileWildcard();
|
2020-02-13 13:39:52 +00:00
|
|
|
extern wxString KiCadSymbolLibFileWildcard();
|
2020-05-15 13:25:11 +00:00
|
|
|
extern wxString LegacySymbolLibFileWildcard();
|
2020-07-17 17:32:16 +00:00
|
|
|
extern wxString AllSymbolLibFilesWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
extern wxString ProjectFileWildcard();
|
2020-05-25 20:41:24 +00:00
|
|
|
extern wxString LegacyProjectFileWildcard();
|
|
|
|
extern wxString AllProjectFilesWildcard();
|
2021-11-18 22:31:18 +00:00
|
|
|
extern wxString AllSchematicFilesWildcard();
|
2020-03-16 13:04:50 +00:00
|
|
|
extern wxString KiCadSchematicFileWildcard();
|
|
|
|
extern wxString LegacySchematicFileWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
extern wxString BoardFileWildcard();
|
|
|
|
extern wxString NetlistFileWildcard();
|
|
|
|
extern wxString GerberFileWildcard();
|
|
|
|
extern wxString HtmlFileWildcard();
|
|
|
|
extern wxString CsvFileWildcard();
|
|
|
|
extern wxString LegacyPcbFileWildcard();
|
|
|
|
extern wxString PcbFileWildcard();
|
|
|
|
extern wxString EaglePcbFileWildcard();
|
2020-08-23 19:01:08 +00:00
|
|
|
extern wxString AltiumSchematicFileWildcard();
|
2020-09-08 19:51:22 +00:00
|
|
|
extern wxString CadstarSchematicArchiveFileWildcard();
|
2020-09-27 17:12:32 +00:00
|
|
|
extern wxString CadstarArchiveFilesWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
extern wxString EagleSchematicFileWildcard();
|
|
|
|
extern wxString EagleFilesWildcard();
|
|
|
|
extern wxString PCadPcbFileWildcard();
|
2020-09-06 17:00:02 +00:00
|
|
|
extern wxString CadstarPcbArchiveFileWildcard();
|
2020-04-03 23:22:24 +00:00
|
|
|
extern wxString AltiumDesignerPcbFileWildcard();
|
|
|
|
extern wxString AltiumCircuitStudioPcbFileWildcard();
|
|
|
|
extern wxString AltiumCircuitMakerPcbFileWildcard();
|
2020-07-18 23:27:58 +00:00
|
|
|
extern wxString FabmasterPcbFileWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
extern wxString PdfFileWildcard();
|
|
|
|
extern wxString PSFileWildcard();
|
|
|
|
extern wxString MacrosFileWildcard();
|
|
|
|
extern wxString DrillFileWildcard();
|
|
|
|
extern wxString SVGFileWildcard();
|
|
|
|
extern wxString ReportFileWildcard();
|
|
|
|
extern wxString FootprintPlaceFileWildcard();
|
|
|
|
extern wxString Shapes3DFileWildcard();
|
|
|
|
extern wxString IDF3DFileWildcard();
|
|
|
|
extern wxString DocModulesFileName();
|
|
|
|
extern wxString LegacyFootprintLibPathWildcard();
|
|
|
|
extern wxString KiCadFootprintLibFileWildcard();
|
|
|
|
extern wxString KiCadFootprintLibPathWildcard();
|
|
|
|
extern wxString GedaPcbFootprintLibFileWildcard();
|
|
|
|
extern wxString EagleFootprintLibPathWildcard();
|
|
|
|
extern wxString TextFileWildcard();
|
|
|
|
extern wxString ModLegacyExportFileWildcard();
|
|
|
|
extern wxString ErcFileWildcard();
|
|
|
|
extern wxString SpiceLibraryFileWildcard();
|
|
|
|
extern wxString SpiceNetlistFileWildcard();
|
|
|
|
extern wxString CadstarNetlistFileWildcard();
|
|
|
|
extern wxString EquFileWildcard();
|
|
|
|
extern wxString ZipFileWildcard();
|
|
|
|
extern wxString GencadFileWildcard();
|
|
|
|
extern wxString DxfFileWildcard();
|
|
|
|
extern wxString GerberJobFileWildcard();
|
|
|
|
extern wxString SpecctraDsnFileWildcard();
|
2021-07-28 17:25:40 +00:00
|
|
|
extern wxString SpecctraSessionFileWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
extern wxString IpcD356FileWildcard();
|
|
|
|
extern wxString WorkbookFileWildcard();
|
|
|
|
extern wxString PngFileWildcard();
|
2018-12-08 13:20:32 +00:00
|
|
|
extern wxString JpegFileWildcard();
|
2021-07-28 17:25:40 +00:00
|
|
|
extern wxString HotkeyFileWildcard();
|
2017-11-12 00:31:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2012-02-16 20:03:33 +00:00
|
|
|
#endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_
|