1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
|
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 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
* 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
*/
#include <wildcards_and_files_ext.h>
/**
* 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 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
}
const std::string SchematicSymbolFileExtension( "sym" );
const std::string SchematicLibraryFileExtension( "lib" );
const std::string SchematicBackupFileExtension( "bak" );
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" );
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" );
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
wxString SchematicSymbolFileWildcard()
{
return _( "KiCad drawing symbol files (*.sym)|*." ) + FormatWildcardExt( "sym" );
}
wxString SchematicLibraryFileWildcard()
{
return _( "KiCad symbol library files (*.lib)|*." ) + FormatWildcardExt( "lib" );
}
wxString ProjectFileWildcard()
{
return _( "KiCad project files (*.pro)|*." ) + FormatWildcardExt( "pro" );
}
wxString SchematicFileWildcard()
{
return _( "KiCad schematic files (*.sch)|*." ) + FormatWildcardExt( "sch" );
}
wxString EagleSchematicFileWildcard()
{
return _( "Eagle XML schematic files (*.sch)|*." ) + FormatWildcardExt( "sch" );
}
wxString EagleFilesWildcard()
{
return _( "Eagle XML files (*.sch *.brd)|*." ) +
FormatWildcardExt( "sch" ) + ";*." + FormatWildcardExt( "brd" );
}
wxString NetlistFileWildcard()
{
return _( "KiCad netlist files (*.net)|*." ) + FormatWildcardExt( "net" );
}
wxString GerberFileWildcard()
{
return _( "Gerber files (*.pho)|*." ) + FormatWildcardExt( "pho" );
}
wxString LegacyPcbFileWildcard()
{
return _( "KiCad printed circuit board files (*.brd)|*." ) + FormatWildcardExt( "brd" );
}
wxString EaglePcbFileWildcard()
{
return _( "Eagle ver. 6.x XML PCB files (*.brd)|*." ) + FormatWildcardExt( "brd" );
}
wxString PCadPcbFileWildcard()
{
return _( "P-Cad 200x ASCII PCB files (*.pcb)|*." ) + FormatWildcardExt( "pcb" );
}
wxString PcbFileWildcard()
{
return _( "KiCad printed circuit board files (*.kicad_pcb)|*." ) +
FormatWildcardExt( "kicad_pcb" );
}
wxString KiCadFootprintLibFileWildcard()
{
return _( "KiCad footprint files (*.kicad_mod)|*." ) + FormatWildcardExt( "kicad_mod" );
}
wxString KiCadFootprintLibPathWildcard()
{
return _( "KiCad footprint library paths (*.pretty)|*." ) + FormatWildcardExt( "pretty" );
}
wxString LegacyFootprintLibPathWildcard()
{
return _( "Legacy footprint library files (*.mod)|*." ) + FormatWildcardExt( "mod" );
}
wxString EagleFootprintLibPathWildcard()
{
return _( "Eagle ver. 6.x XML library files (*.lbr)|*." ) + FormatWildcardExt( "lbr" );
}
wxString GedaPcbFootprintLibFileWildcard()
{
return _( "Geda PCB footprint library files (*.fp)|*." ) + FormatWildcardExt( "fp" );
}
wxString PageLayoutDescrFileWildcard()
{
return _( "Page layout design files (*.kicad_wks)|*." ) + FormatWildcardExt( "kicad_wks" );
}
// Wildcard for cvpcb component to footprint link file
wxString ComponentFileWildcard()
{
return _( "KiCad symbol footprint link files (*.cmp)|*." ) + FormatWildcardExt( "cmp" );
}
// Wildcard for reports and fabrication documents
wxString DrillFileWildcard()
{
return _( "Drill files (*.drl)|*." ) + FormatWildcardExt( "drl" );
}
wxString SVGFileWildcard()
{
return _( "SVG files (*.svg)|*." ) + FormatWildcardExt( "svg" );
}
wxString HtmlFileWildcard()
{
return _( "HTML files (*.html)|*." ) + FormatWildcardExt( "htm" ) + ";*.," +
FormatWildcardExt( "html" );
}
wxString CsvFileWildcard()
{
return _( "CSV Files (*.csv)|*." ) + FormatWildcardExt( "csv" );
}
wxString PdfFileWildcard()
{
return _( "Portable document format files (*.pdf)|*." ) + FormatWildcardExt( "pdf" );
}
wxString PSFileWildcard()
{
return _( "PostScript files (.ps)|*." ) + FormatWildcardExt( "ps" );
}
wxString ReportFileWildcard()
{
return _( "Report files (*.rpt)|*." ) + FormatWildcardExt( "rpt" );
}
wxString FootprintPlaceFileWildcard()
{
return _( "Footprint place files (*.pos)|*." ) + FormatWildcardExt( "pos" );
}
wxString Shapes3DFileWildcard()
{
return _( "VRML and X3D files (*.wrl *.x3d)|*." ) + FormatWildcardExt( "wrl" ) +
";*." + FormatWildcardExt( "x3d" );
}
wxString IDF3DFileWildcard()
{
return _( "IDFv3 footprint files (*.idf)|*." ) + FormatWildcardExt( "idf" );
}
wxString TextFileWildcard()
{
return _( "Text files (*.txt)|*." ) + FormatWildcardExt( "txt" );
}
wxString ModLegacyExportFileWildcard()
{
return _( "Legacy footprint export files (*.emp)|*." ) + FormatWildcardExt( "emp" );
}
wxString ErcFileWildcard()
{
return _( "Electronic rule check file (.erc)|*." ) + FormatWildcardExt( "erc" );
}
wxString SpiceLibraryFileWildcard()
{
return _( "Spice library file (*.lib)|*." ) + FormatWildcardExt( "lib" );
}
wxString SpiceNetlistFileWildcard()
{
return _( "SPICE netlist file (.cir)|*." ) + FormatWildcardExt( "cir" );
}
wxString CadstarNetlistFileWildcard()
{
return _( "CadStar netlist file (.frp)|*." ) + FormatWildcardExt( "frp" );
}
wxString EquFileWildcard()
{
return _( "Symbol footprint association files (*.equ)|*." ) + FormatWildcardExt( "equ" );
}
wxString ZipFileWildcard()
{
return _( "Zip file (*.zip)|*." ) + FormatWildcardExt( "zip" );
}
wxString GencadFileWildcard()
{
return _( "GenCAD 1.4 board files (.cad)|*." ) + FormatWildcardExt( "cad" );
}
wxString DxfFileWildcard()
{
return _( "DXF Files (*.dxf)|*." ) + FormatWildcardExt( "dxf" );
}
wxString GerberJobFileWildcard()
{
return _( "Gerber job file (*.gbrjob)|*." ) + FormatWildcardExt( "gbrjob" ) +
";.gbrjob";
}
wxString SpecctraDsnFileWildcard()
{
return _( "Specctra DSN file (*.dsn)|*." ) + FormatWildcardExt( "dsn" );
}
wxString IpcD356FileWildcard()
{
return _( "IPC-D-356 Test Files (.d356)|*." ) + FormatWildcardExt( "d356" );
}
wxString WorkbookFileWildcard()
{
return _( "Workbook file (*.wbk)|*." ) + FormatWildcardExt( "wbk" );
}
wxString PngFileWildcard()
{
return _( "PNG file (*.png)|*." ) + FormatWildcardExt( "png" );
}
|