GTK+ file dialog wildcard improvements.

The GTK+ file dialog is case sensitive however it does support regular
expressions.  Most of the file dialog wildcards are lower case so only
files with the lower case extensions will show up in the file dialog.
This code adds a method to convert file extensions of any case to the
appropriate (sch -> [sS][cC][hH]) regular expression on GTK+ builds so
all file extension case combinations will show up in the file dialog.

A note to developers: make sure to add a file extension when setting
when setting the default file argument.  If you do don't set an
extension, the GTK+ file dialog will happily append the regular
expression as the file extension which is surely not what you want.

There are still a few known places (mostly gerbview) where there are
some complex wildcard code that has not been converted.

Fixes lp:1720542

https://bugs.launchpad.net/kicad/+bug/1720542
This commit is contained in:
Wayne Stambaugh 2017-11-11 19:31:38 -05:00
parent 61578f9da8
commit 652b969193
44 changed files with 672 additions and 375 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2010 jean-pierre.charras * Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 Kicad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -482,9 +482,8 @@ void BM2CMP_FRAME::OnExportLogo()
if( path.IsEmpty() || !wxDirExists(path) ) if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd(); path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create a logo file" ), wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString,
path, wxEmptyString, PageLayoutDescrFileWildcard(),
wxGetTranslation( PageLayoutDescrFileWildcard ),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = fileDlg.ShowModal(); int diag = fileDlg.ShowModal();
@ -519,9 +518,9 @@ void BM2CMP_FRAME::OnExportPostScript()
if( path.IsEmpty() || !wxDirExists( path ) ) if( path.IsEmpty() || !wxDirExists( path ) )
path = ::wxGetCwd(); path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create a Postscript file" ), wxFileDialog fileDlg( this, _( "Create Postscript File" ),
path, wxEmptyString, path, wxEmptyString,
wxGetTranslation( PSFileWildcard ), PSFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = fileDlg.ShowModal(); int diag = fileDlg.ShowModal();
@ -557,9 +556,9 @@ void BM2CMP_FRAME::OnExportEeschema()
if( path.IsEmpty() || !wxDirExists(path) ) if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd(); path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create a component library file for Eeschema" ), wxFileDialog fileDlg( this, _( "Create Symbol Library" ),
path, wxEmptyString, path, wxEmptyString,
wxGetTranslation( SchematicLibraryFileWildcard ), SchematicLibraryFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = fileDlg.ShowModal(); int diag = fileDlg.ShowModal();
@ -594,9 +593,9 @@ void BM2CMP_FRAME::OnExportPcbnew()
if( path.IsEmpty() || !wxDirExists( path ) ) if( path.IsEmpty() || !wxDirExists( path ) )
path = m_mruPath; path = m_mruPath;
wxFileDialog fileDlg( this, _( "Create a footprint file for Pcbnew" ), wxFileDialog fileDlg( this, _( "Create Footprint Library" ),
path, wxEmptyString, path, wxEmptyString,
wxGetTranslation( KiCadFootprintLibFileWildcard ), KiCadFootprintLibFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = fileDlg.ShowModal(); int diag = fileDlg.ShowModal();

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2015 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -803,9 +803,9 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog()
void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event ) void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
{ {
// Display a file picker dialog // Display a file picker dialog
wxFileDialog fileDialog( this, _( "Select Page Layout Descr File" ), wxFileDialog fileDialog( this, _( "Select Page Layout Description File" ),
m_projectPath, GetWksFileName(), m_projectPath, GetWksFileName(),
PageLayoutDescrFileWildcard, PageLayoutDescrFileWildcard(),
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST ); wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
if( fileDialog.ShowModal() != wxID_OK ) if( fileDialog.ShowModal() != wxID_OK )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 CERN * Copyright (C) 2015 CERN
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2015-2017 KiCad Developers, see change_log.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -237,8 +237,8 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
{ {
wxFileName fn( "./report.txt" ); wxFileName fn( "./report.txt" );
wxFileDialog dlg( this, _( "Save report to file" ), fn.GetPath(), fn.GetName(), wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
TextWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -29,79 +29,349 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
/** /**
* file extensions and wildcards used in kicad. * 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__ )
const wxString SchematicSymbolFileExtension( wxT( "sym" ) ); for( auto ch : aWildcard )
const wxString SchematicLibraryFileExtension( wxT( "lib" ) ); {
const wxString SchematicBackupFileExtension( wxT( "bak" ) ); if( wxIsalpha( ch ) )
wc += wxString::Format( "[%c%c]", wxTolower( ch ), wxToupper( ch ) );
else
wc += ch;
}
const wxString VrmlFileExtension( wxT( "wrl" ) ); return wc;
#else
wc = aWildcard;
const wxString ProjectFileExtension( wxT( "pro" ) ); return wc;
const wxString SchematicFileExtension( wxT( "sch" ) ); #endif
const wxString NetlistFileExtension( wxT( "net" ) ); }
const wxString ComponentFileExtension( wxT( "cmp" ) );
const wxString SchematicSymbolFileExtension( "sym" );
const wxString SchematicLibraryFileExtension( "lib" );
const wxString SchematicBackupFileExtension( "bak" );
const wxString VrmlFileExtension( "wrl" );
const wxString ProjectFileExtension( "pro" );
const wxString SchematicFileExtension( "sch" );
const wxString NetlistFileExtension( "net" );
const wxString ComponentFileExtension( "cmp" );
const wxString GerberFileExtension( "gbr" ); const wxString GerberFileExtension( "gbr" );
const wxString GerberJobFileExtension( "gbrjob" ); const wxString GerberJobFileExtension( "gbrjob" );
const wxString HtmlFileExtension( wxT( "html" ) ); const wxString HtmlFileExtension( wxT( "html" ) );
const wxString LegacyPcbFileExtension( wxT( "brd" ) ); const wxString LegacyPcbFileExtension( "brd" );
const wxString KiCadPcbFileExtension( wxT( "kicad_pcb" ) ); const wxString KiCadPcbFileExtension( "kicad_pcb" );
const wxString PageLayoutDescrFileExtension( wxT( "kicad_wks" ) ); const wxString PageLayoutDescrFileExtension( "kicad_wks" );
const wxString PdfFileExtension( wxT( "pdf" ) ); const wxString PdfFileExtension( "pdf" );
const wxString MacrosFileExtension( wxT( "mcr" ) ); const wxString MacrosFileExtension( "mcr" );
const wxString DrillFileExtension( wxT( "drl" ) ); const wxString DrillFileExtension( "drl" );
const wxString SVGFileExtension( wxT( "svg" ) ); const wxString SVGFileExtension( "svg" );
const wxString ReportFileExtension( wxT( "rpt" ) ); const wxString ReportFileExtension( "rpt" );
const wxString FootprintPlaceFileExtension( wxT( "pos" ) ); const wxString FootprintPlaceFileExtension( "pos" );
const wxString KiCadLib3DShapesPathExtension( wxT( "3dshapes" ) ); ///< 3D shapes default libpath const wxString KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath
const wxString KiCadFootprintLibPathExtension( wxT( "pretty" ) ); ///< KICAD PLUGIN libpath const wxString KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath
const wxString LegacyFootprintLibPathExtension( wxT( "mod" ) ); const wxString LegacyFootprintLibPathExtension( "mod" );
const wxString EagleFootprintLibPathExtension( wxT( "lbr" ) ); const wxString EagleFootprintLibPathExtension( "lbr" );
const wxString KiCadFootprintFileExtension( "kicad_mod" );
const wxString GedaPcbFootprintLibFileExtension( "fp" );
const wxString SpecctraDsnFileExtension( "dsn" );
const wxString IpcD356FileExtension( "d356" );
const wxString KiCadFootprintFileExtension( wxT( "kicad_mod" ) );
const wxString GedaPcbFootprintLibFileExtension( wxT( "fp" ) );
// These strings are wildcards for file selection dialogs.
// Because these are static, one should explicitly call wxGetTranslation
// to display them as translated.
const wxString SchematicSymbolFileWildcard( _( "KiCad drawing symbol file (*.sym)|*.sym" ) );
const wxString SchematicLibraryFileWildcard( _( "KiCad component library file (*.lib)|*.lib" ) );
const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) );
const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) );
const wxString EagleSchematicFileWildcard( _( "Eagle XML schematic file (*.sch)|*.sch" ) );
const wxString EagleFilesWildcard( _( "Eagle XML files (*.sch *.brd)|*.sch;*.brd" ) );
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) );
const wxString PCadPcbFileWildcard( _( "P-Cad 200x ASCII PCB files (*.pcb)|*.pcb" ) );
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre file (*.kicad_mod)|*.kicad_mod" ) );
const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) );
const wxString LegacyFootprintLibPathWildcard( _( "Legacy footprint library file (*.mod)|*.mod" ) );
const wxString EagleFootprintLibPathWildcard( _( "Eagle ver. 6.x XML library files (*.lbr)|*.lbr" ) );
const wxString GedaPcbFootprintLibFileWildcard( _( "Geda PCB footprint library file (*.fp)|*.fp" ) );
const wxString ComponentFileExtensionWildcard( _( "Component-footprint link file (*.cmp)|*cmp" ) );
const wxString PageLayoutDescrFileWildcard( _( "Page layout design file (*.kicad_wks)|*kicad_wks" ) );
// generic:
const wxString AllFilesWildcard( _( "All files (*)|*" ) ); 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)|*.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 // Wildcard for cvpcb component to footprint link file
const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)|*.cmp" ) ); wxString ComponentFileWildcard()
{
return _( "KiCad symbol footprint link files (*.cmp)|*." ) + FormatWildcardExt( "cmp" );
}
// Wildcard for reports and fabrication documents // Wildcard for reports and fabrication documents
const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) ); wxString DrillFileWildcard()
const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) ); {
const wxString HtmlFileWildcard( _( "HTML files (*.html)|*.htm;*.html" ) ); return _( "Drill files (*.drl)|*." ) + FormatWildcardExt( "drl" );
const wxString CsvFileWildcard( _( "CSV Files (*.csv)|*.csv" ) ); }
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString PSFileWildcard( _( "PostScript files (.ps)|*.ps" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" ); wxString SVGFileWildcard()
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" ); {
const wxString Shapes3DFileWildcard( _( "Vrml and x3d files (*.wrl *.x3d)|*.wrl;*.x3d" ) ); return _( "SVG files (*.svg)|*." ) + FormatWildcardExt( "svg" );
const wxString IDF3DFileWildcard( _( "IDFv3 component files (*.idf)|*.idf" ) ); }
const wxString TextWildcard( _( "Text files (*.txt)|*.txt" ) );
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 component 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" );
}

View File

@ -47,8 +47,6 @@
// Constant string definitions for CvPcb // Constant string definitions for CvPcb
const wxString EquFileExtension( wxT( "equ" ) ); const wxString EquFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString EquFilesWildcard( _( "Component/footprint equ files (*.equ)|*.equ" ) );
namespace CV { namespace CV {

View File

@ -229,16 +229,11 @@ void DIALOG_CONFIG_EQUFILES::OnRemoveFiles( wxCommandEvent& event )
} }
/* Insert or add a library to the library list:
* The new library is put in list before (insert button) the selection,
* or added (add button) to end of list
*/
void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event ) void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
{ {
wxString equFilename, wildcard; wxString equFilename;
wxFileName fn; wxFileName fn;
wildcard = EquFilesWildcard;
wxListBox* list = m_ListEquiv; wxListBox* list = m_ListEquiv;
// Get a default path to open the file dialog: // Get a default path to open the file dialog:
@ -250,8 +245,8 @@ void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) ); libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
wxFileDialog FilesDialog( this, _( "Equ files:" ), libpath, wxFileDialog FilesDialog( this, _( "Footprint Association File" ), libpath,
wxEmptyString, wildcard, wxEmptyString, EquFileWildcard(),
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE ); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK ) if( FilesDialog.ShowModal() != wxID_OK )

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -218,9 +218,9 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
{ {
wxString path = wxPathOnly( Prj().GetProjectFullName() ); wxString path = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Load Component Footprint Link File" ), wxFileDialog dlg( this, _( "Load Symbol Footprint Link File" ),
path, wxEmptyString, path, wxEmptyString,
ComponentFileExtensionWildcard, ComponentFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -39,6 +39,7 @@
#include <project.h> #include <project.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <wildcards_and_files_ext.h>
#include <netlist.h> #include <netlist.h>
#include <class_netlist_object.h> #include <class_netlist_object.h>
@ -598,8 +599,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
fn.SetExt( wxT( "erc" ) ); fn.SetExt( wxT( "erc" ) );
wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(), wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
_( "Electronic rule check file (.erc)|*.erc" ), ErcFileWildcard(), wxFD_SAVE );
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2017 Jean-Pierre Charras, jp.charras@wanadoo.fr * Copyright (C) 2013-2017 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 2013-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -631,18 +631,18 @@ bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aNetTypeId,
{ {
case NET_TYPE_SPICE: case NET_TYPE_SPICE:
fileExt = wxT( "cir" ); fileExt = wxT( "cir" );
fileWildcard = _( "SPICE netlist file (.cir)|*.cir" ); fileWildcard = SpiceNetlistFileWildcard();
break; break;
case NET_TYPE_CADSTAR: case NET_TYPE_CADSTAR:
fileExt = wxT( "frp" ); fileExt = wxT( "frp" );
fileWildcard = _( "CadStar netlist file (.frp)|*.frp" ); fileWildcard = CadstarNetlistFileWildcard();
break; break;
case NET_TYPE_PCBNEW: case NET_TYPE_PCBNEW:
case NET_TYPE_ORCADPCB2: case NET_TYPE_ORCADPCB2:
fileExt = NetlistFileExtension; fileExt = NetlistFileExtension;
fileWildcard = NetlistFileWildcard; fileWildcard = NetlistFileWildcard();
break; break;
default: // custom, NET_TYPE_CUSTOM1 and greater default: // custom, NET_TYPE_CUSTOM1 and greater

View File

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "wildcards_and_files_ext.h"
#include "dialog_spice_model.h" #include "dialog_spice_model.h"
#include <netlist_exporters/netlist_exporter_pspice.h> #include <netlist_exporters/netlist_exporter_pspice.h>
@ -718,8 +719,8 @@ void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event )
if( searchPath.IsEmpty() ) if( searchPath.IsEmpty() )
searchPath = Prj().GetProjectPath(); searchPath = Prj().GetProjectPath();
wxFileDialog openDlg( this, wxT( "Select library" ), searchPath, "", wxString wildcards = SpiceLibraryFileWildcard() + "|" + AllFilesWildcard;
"Spice library file (*.lib)|*.lib;*.LIB|Any file|*", wxFileDialog openDlg( this, _( "Select library" ), searchPath, "", wildcards,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( openDlg.ShowModal() == wxID_CANCEL ) if( openDlg.ShowModal() == wxID_CANCEL )

View File

@ -174,7 +174,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(), wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
fn.GetFullName(), ProjectFileWildcard, fn.GetFullName(), ProjectFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -410,7 +410,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
{ {
wxFileDialog dlg( this, _( "Save Project File" ), wxFileDialog dlg( this, _( "Save Project File" ),
fn.GetPath(), fn.GetFullName(), fn.GetPath(), fn.GetFullName(),
ProjectFileWildcard, wxFD_SAVE ); ProjectFileWildcard(), wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -73,7 +73,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
{ {
wxFileDialog dlg( this, _( "Schematic Files" ), wxFileDialog dlg( this, _( "Schematic Files" ),
wxPathOnly( Prj().GetProjectFullName() ), wxPathOnly( Prj().GetProjectFullName() ),
schematicFileName.GetFullName(), SchematicFileWildcard, schematicFileName.GetFullName(), SchematicFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -388,7 +388,7 @@ bool SCH_EDIT_FRAME::AppendOneEEProject()
wxString path = wxPathOnly( Prj().GetProjectFullName() ); wxString path = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Append Schematic" ), path, wxFileDialog dlg( this, _( "Append Schematic" ), path,
wxEmptyString, SchematicFileWildcard, wxEmptyString, SchematicFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -529,7 +529,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
wxString path = wxPathOnly( Prj().GetProjectFullName() ); wxString path = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Import Schematic" ), path, wxFileDialog dlg( this, _( "Import Schematic" ), path,
wxEmptyString, EagleSchematicFileWildcard, wxEmptyString, EagleSchematicFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -50,7 +50,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath, wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath,
wxEmptyString, SchematicLibraryFileWildcard, wxEmptyString, SchematicLibraryFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -117,7 +117,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
title = createLib ? _( "New Symbol Library" ) : _( "Export Symbol" ); title = createLib ? _( "New Symbol Library" ) : _( "Export Symbol" );
wxFileDialog dlg( this, title, m_mruPath, fn.GetFullName(), wxFileDialog dlg( this, title, m_mruPath, fn.GetFullName(),
SchematicLibraryFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); SchematicLibraryFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -318,7 +318,7 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
default_path = search->LastVisitedPath(); default_path = search->LastVisitedPath();
wxFileDialog dlg( this, _( "Symbol Library Name" ), default_path, wxFileDialog dlg( this, _( "Symbol Library Name" ), default_path,
wxEmptyString, SchematicLibraryFileWildcard, wxEmptyString, SchematicLibraryFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 CERN * Copyright (C) 2016 CERN
* Copyright (C) 2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2016-2017 KiCad Developers, see change_log.txt for contributors.
* *
* @author Wayne Stambaugh <stambaughw@gmail.com> * @author Wayne Stambaugh <stambaughw@gmail.com>
* *
@ -132,7 +132,7 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::GuessPluginTypeFromLibPath( const wxString& a
SCH_FILE_T ret = SCH_LEGACY; // default guess, unless detected otherwise. SCH_FILE_T ret = SCH_LEGACY; // default guess, unless detected otherwise.
wxFileName fn( aLibPath ); wxFileName fn( aLibPath );
if( fn.GetExt() == SchematicFileWildcard ) if( fn.GetExt() == SchematicFileExtension )
{ {
ret = SCH_LEGACY; ret = SCH_LEGACY;
} }

View File

@ -1038,11 +1038,10 @@ void SCH_EDIT_FRAME::OnUpdateFields( wxCommandEvent& event )
void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
{ {
// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
wxString pro_dir = m_mruPath; wxString pro_dir = m_mruPath;
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
wxEmptyString, SchematicFileWildcard, wxEmptyString, SchematicFileWildcard(),
wxFD_SAVE ); wxFD_SAVE );
if( dlg.ShowModal() != wxID_CANCEL ) if( dlg.ShowModal() != wxID_CANCEL )
@ -1076,7 +1075,7 @@ void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
wxString pro_dir = m_mruPath; wxString pro_dir = m_mruPath;
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
wxEmptyString, SchematicFileWildcard, wxEmptyString, SchematicFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() != wxID_CANCEL ) if( dlg.ShowModal() != wxID_CANCEL )

View File

@ -29,6 +29,7 @@
#include <kiway.h> #include <kiway.h>
#include <confirm.h> #include <confirm.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <wildcards_and_files_ext.h>
#include <widgets/tuner_slider.h> #include <widgets/tuner_slider.h>
#include <dialogs/dialog_signal_list.h> #include <dialogs/dialog_signal_list.h>
@ -782,7 +783,7 @@ void SIM_PLOT_FRAME::menuNewPlot( wxCommandEvent& aEvent )
void SIM_PLOT_FRAME::menuOpenWorkbook( wxCommandEvent& event ) void SIM_PLOT_FRAME::menuOpenWorkbook( wxCommandEvent& event )
{ {
wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "", wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "",
_( "Workbook file (*.wbk)|*.wbk" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( openDlg.ShowModal() == wxID_CANCEL ) if( openDlg.ShowModal() == wxID_CANCEL )
return; return;
@ -799,8 +800,8 @@ void SIM_PLOT_FRAME::menuSaveWorkbook( wxCommandEvent& event )
if( !CurrentPlot() ) if( !CurrentPlot() )
return; return;
wxFileDialog saveDlg( this, _( "Save simulation workbook" ), m_savedWorkbooksPath, "", wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "",
_( "Workbook file (*.wbk)|*.wbk" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
return; return;
@ -817,8 +818,8 @@ void SIM_PLOT_FRAME::menuSaveImage( wxCommandEvent& event )
if( !CurrentPlot() ) if( !CurrentPlot() )
return; return;
wxFileDialog saveDlg( this, _( "Save plot as image" ), "", "", wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "",
_( "PNG file (*.png)|*.png" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
return; return;
@ -834,8 +835,8 @@ void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event )
const wxChar SEPARATOR = ';'; const wxChar SEPARATOR = ';';
wxFileDialog saveDlg( this, _( "Save plot data" ), "", "", wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "",
"CSV file (*.csv)|*.csv", wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -62,7 +62,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
default_path = search->LastVisitedPath(); default_path = search->LastVisitedPath();
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path, wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
wxEmptyString, SchematicSymbolFileWildcard, wxEmptyString, SchematicSymbolFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -150,11 +150,13 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
return; return;
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH ); wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
if( !default_path ) if( !default_path )
default_path = search->LastVisitedPath(); default_path = search->LastVisitedPath();
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path, wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
part->GetName(), SchematicSymbolFileWildcard, part->GetName() + "." + SchematicSymbolFileExtension,
SchematicSymbolFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -157,6 +157,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
int layercount = 0; int layercount = 0;
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList(); GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
// Count the Gerber layers which are actually currently used // Count the Gerber layers which are actually currently used
for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii ) for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
{ {
@ -174,8 +175,8 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
wxString fileName; wxString fileName;
wxString path = m_mruPath; wxString path = m_mruPath;
wxFileDialog filedlg( this, _( "Board file name:" ), wxFileDialog filedlg( this, _( "Board File Name" ),
path, fileName, PcbFileWildcard, path, fileName, PcbFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( filedlg.ShowModal() == wxID_CANCEL ) if( filedlg.ShowModal() == wxID_CANCEL )

View File

@ -297,8 +297,9 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
if( !filename.IsOk() ) if( !filename.IsOk() )
{ {
filetypes = wxGetTranslation( DrillFileWildcard ); filetypes = DrillFileWildcard();
filetypes << wxT("|"); filetypes << wxT( "|" );
/* All filetypes */ /* All filetypes */
filetypes += wxGetTranslation( AllFilesWildcard ); filetypes += wxGetTranslation( AllFilesWildcard );
@ -545,7 +546,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName ) bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName )
{ {
#define ZipFileExtension "zip" #define ZipFileExtension "zip"
#define ZipFileWildcard _( "Zip file (*.zip)|*.zip;.zip" )
wxFileName filename = aFullFileName; wxFileName filename = aFullFileName;
wxString currentPath; wxString currentPath;
@ -561,7 +562,7 @@ bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName )
_( "Open Zip File" ), _( "Open Zip File" ),
currentPath, currentPath,
filename.GetFullName(), filename.GetFullName(),
ZipFileWildcard, ZipFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -28,6 +28,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wildcards_and_files_ext.h>
#include <gerbview.h> #include <gerbview.h>
#include <richio.h> #include <richio.h>
@ -141,7 +142,6 @@ bool GERBER_JOBFILE_READER::parseTJLayerString( wxString& aText )
bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName ) bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName )
{ {
#define jobFileWildcard _( "Gerber job file (*.gbrjob)|*.gbrjob;.gbrjob" )
wxFileName filename = aFullFileName; wxFileName filename = aFullFileName;
wxString currentPath; wxString currentPath;
@ -156,7 +156,7 @@ bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName )
wxFileDialog dlg( this, _( "Open Gerber Job File" ), wxFileDialog dlg( this, _( "Open Gerber Job File" ),
currentPath, currentPath,
filename.GetFullName(), filename.GetFullName(),
jobFileWildcard, GerberJobFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -3,8 +3,8 @@
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,13 +35,19 @@
#include <wx/wx.h> #include <wx/wx.h>
/** /**
* File extension definitions. Please do not changes these. If a different * \defgroup file_extensions File Extension Definitions
* file extension is needed, create a new definition in the application. *
* Please note, just because they are defined as const doesn't guarantee * @note Please do not changes these. If a different file extension is needed, create a new
* that they cannot be changed. * definition in here. If you create a extension definition in another file, make sure
* Mainly wild cards are most of time translated when displayed * 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.
*
* @{
*/ */
extern const wxString AllFilesWildcard;
extern const wxString SchematicSymbolFileExtension; extern const wxString SchematicSymbolFileExtension;
extern const wxString SchematicLibraryFileExtension; extern const wxString SchematicLibraryFileExtension;
extern const wxString SchematicBackupFileExtension; extern const wxString SchematicBackupFileExtension;
@ -71,44 +77,78 @@ extern const wxString KiCadFootprintFileExtension;
extern const wxString KiCadFootprintLibPathExtension; extern const wxString KiCadFootprintLibPathExtension;
extern const wxString GedaPcbFootprintLibFileExtension; extern const wxString GedaPcbFootprintLibFileExtension;
extern const wxString EagleFootprintLibPathExtension; extern const wxString EagleFootprintLibPathExtension;
extern const wxString ComponentFileExtensionWildcard; extern const wxString ComponentFileExtension;
extern const wxString PageLayoutDescrFileWildcard; extern const wxString PageLayoutDescrFileExtension;
extern const wxString KiCadLib3DShapesPathExtension; extern const wxString KiCadLib3DShapesPathExtension;
extern const wxString SpecctraDsnFileExtension;
extern const wxString IpcD356FileExtension;
/// Proper wxFileDialog wild card definitions. /**
extern const wxString SchematicSymbolFileWildcard; * @}
extern const wxString SchematicLibraryFileWildcard; */
extern const wxString ProjectFileWildcard;
extern const wxString SchematicFileWildcard;
extern const wxString BoardFileWildcard;
extern const wxString NetlistFileWildcard;
extern const wxString GerberFileWildcard;
extern const wxString HtmlFileWildcard;
extern const wxString CsvFileWildcard;
extern const wxString LegacyPcbFileWildcard;
extern const wxString PcbFileWildcard;
extern const wxString EaglePcbFileWildcard;
extern const wxString EagleSchematicFileWildcard;
extern const wxString EagleFilesWildcard;
extern const wxString PCadPcbFileWildcard;
extern const wxString PdfFileWildcard;
extern const wxString PSFileWildcard;
extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard;
extern const wxString ComponentFileWildcard;
extern const wxString DrillFileWildcard;
extern const wxString SVGFileWildcard;
extern const wxString ReportFileWildcard;
extern const wxString FootprintPlaceFileWildcard;
extern const wxString Shapes3DFileWildcard;
extern const wxString IDF3DFileWildcard;
extern const wxString DocModulesFileName;
extern const wxString LegacyFootprintLibPathWildcard;
extern const wxString KiCadFootprintLibFileWildcard;
extern const wxString KiCadFootprintLibPathWildcard;
extern const wxString GedaPcbFootprintLibFileWildcard;
extern const wxString EagleFootprintLibPathWildcard;
extern const wxString TextWildcard;
/**
* \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.
* @{
*/
extern wxString ComponentFileWildcard();
extern wxString PageLayoutDescrFileWildcard();
extern wxString SchematicSymbolFileWildcard();
extern wxString SchematicLibraryFileWildcard();
extern wxString ProjectFileWildcard();
extern wxString SchematicFileWildcard();
extern wxString BoardFileWildcard();
extern wxString NetlistFileWildcard();
extern wxString GerberFileWildcard();
extern wxString HtmlFileWildcard();
extern wxString CsvFileWildcard();
extern wxString LegacyPcbFileWildcard();
extern wxString PcbFileWildcard();
extern wxString EaglePcbFileWildcard();
extern wxString EagleSchematicFileWildcard();
extern wxString EagleFilesWildcard();
extern wxString PCadPcbFileWildcard();
extern wxString PdfFileWildcard();
extern wxString PSFileWildcard();
extern wxString MacrosFileWildcard();
extern wxString ComponentFileWildcard();
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();
extern wxString IpcD356FileWildcard();
extern wxString WorkbookFileWildcard();
extern wxString PngFileWildcard();
/**
* @}
*/
#endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_ #endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_

View File

@ -34,14 +34,13 @@
#include <confirm.h> #include <confirm.h>
#include <kiway.h> #include <kiway.h>
#include "pgm_kicad.h" #include "pgm_kicad.h"
#include "wildcards_and_files_ext.h"
#include "kicad.h" #include "kicad.h"
#define ZipFileExtension wxT( "zip" ) #define ZipFileExtension wxT( "zip" )
#define ZipFileWildcard _( "Zip file (*.zip)|*.zip" )
void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event )
@ -62,7 +61,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
fn.SetExt( ZipFileExtension ); fn.SetExt( ZipFileExtension );
wxFileDialog zipfiledlg( this, _( "Unzip Project" ), fn.GetPath(), wxFileDialog zipfiledlg( this, _( "Unzip Project" ), fn.GetPath(),
fn.GetFullName(), ZipFileWildcard, fn.GetFullName(), ZipFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( zipfiledlg.ShowModal() == wxID_CANCEL ) if( zipfiledlg.ShowModal() == wxID_CANCEL )
@ -144,7 +143,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
wxFileDialog dlg( this, _( "Archive Project Files" ), wxFileDialog dlg( this, _( "Archive Project Files" ),
fileName.GetPath(), fileName.GetFullName(), fileName.GetPath(), fileName.GetFullName(),
ZipFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); ZipFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -69,7 +69,7 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
ClearMsg(); ClearMsg();
wxFileDialog schdlg( this, title, default_dir, wxEmptyString, wxFileDialog schdlg( this, title, default_dir, wxEmptyString,
EagleFilesWildcard, style ); EagleFilesWildcard(), style );
if( schdlg.ShowModal() == wxID_CANCEL ) if( schdlg.ShowModal() == wxID_CANCEL )
return; return;
@ -79,16 +79,20 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
sch.SetExt( SchematicFileExtension ); sch.SetExt( SchematicFileExtension );
wxFileName pro = sch;
wxString protitle = _( "Kicad Project Destination" ); pro.SetExt( ProjectFileExtension );
wxFileDialog prodlg( this, protitle, sch.GetPath(), sch.GetName(), wxString protitle = _( "KiCad Project Destination" );
ProjectFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFileDialog prodlg( this, protitle, pro.GetPath(), pro.GetFullName(),
ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( prodlg.ShowModal() == wxID_CANCEL ) if( prodlg.ShowModal() == wxID_CANCEL )
return; return;
wxFileName pro( prodlg.GetPath() ); pro.SetPath( prodlg.GetPath() );
// Check if the project directory is empty // Check if the project directory is empty
wxDir directory( pro.GetPath() ); wxDir directory( pro.GetPath() );

View File

@ -489,17 +489,12 @@ void KICAD_MANAGER_FRAME::OnOpenTextEditor( wxCommandEvent& event )
void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
{ {
wxString mask( wxT( "*" ) ); wxString wildcard = TextFileWildcard() + "|" + AllFilesWildcard;
#ifdef __WINDOWS__
mask += wxT( ".*" );
#endif
mask = _( "Text file (" ) + mask + wxT( ")|" ) + mask;
wxString default_dir = Prj().GetProjectPath(); wxString default_dir = Prj().GetProjectPath();
wxFileDialog dlg( this, _( "Load File to Edit" ), default_dir, wxFileDialog dlg( this, _( "Load File to Edit" ), default_dir,
wxEmptyString, mask, wxFD_OPEN ); wxEmptyString, wildcard, wxFD_OPEN );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -166,7 +166,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
{ {
wxString default_dir = GetMruPath(); wxString default_dir = GetMruPath();
wxFileDialog dlg( this, _( "Open Existing Project" ), default_dir, wxEmptyString, wxFileDialog dlg( this, _( "Open Existing Project" ), default_dir, wxEmptyString,
ProjectFileWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); ProjectFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
@ -188,7 +188,7 @@ void KICAD_MANAGER_FRAME::OnNewProject( wxCommandEvent& aEvent )
{ {
wxString default_dir = GetMruPath(); wxString default_dir = GetMruPath();
wxFileDialog dlg( this, _( "Create New Project" ), default_dir, wxEmptyString, wxFileDialog dlg( this, _( "Create New Project" ), default_dir, wxEmptyString,
ProjectFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -100,9 +100,6 @@ static const wxChar* s_allowedExtensionsToList[] =
// File extension definitions. // File extension definitions.
const wxChar TextFileExtension[] = wxT( "txt" ); const wxChar TextFileExtension[] = wxT( "txt" );
// File wildcard definitions.
const wxChar TextFileWildcard[] = wxT( "Text files (*.txt)|*.txt" );
// Gerber file extension wildcard. // Gerber file extension wildcard.
const wxString GerberFileExtensionWildCard( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" ); const wxString GerberFileExtensionWildCard( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" );
@ -328,68 +325,68 @@ wxString TREE_PROJECT_FRAME::GetFileWildcard( TreeFileType type )
switch( type ) switch( type )
{ {
case TREE_PROJECT: case TREE_PROJECT:
ext = ProjectFileWildcard; ext = ProjectFileWildcard();
break; break;
case TREE_SCHEMA: case TREE_SCHEMA:
ext = SchematicFileWildcard; ext = SchematicFileWildcard();
break; break;
case TREE_LEGACY_PCB: case TREE_LEGACY_PCB:
case TREE_SEXP_PCB: case TREE_SEXP_PCB:
ext = PcbFileWildcard; ext = PcbFileWildcard();
break; break;
case TREE_GERBER: case TREE_GERBER:
ext = GerberFileWildcard; ext = GerberFileWildcard();
break; break;
case TREE_HTML: case TREE_HTML:
ext = HtmlFileWildcard; ext = HtmlFileWildcard();
break; break;
case TREE_PDF: case TREE_PDF:
ext = PdfFileWildcard; ext = PdfFileWildcard();
break; break;
case TREE_TXT: case TREE_TXT:
ext = TextFileWildcard; ext = TextFileWildcard();
break; break;
case TREE_NET: case TREE_NET:
ext = NetlistFileWildcard; ext = NetlistFileWildcard();
break; break;
case TREE_CMP_LINK: case TREE_CMP_LINK:
ext = ComponentFileWildcard; ext = ComponentFileWildcard();
break; break;
case TREE_REPORT: case TREE_REPORT:
ext = ReportFileWildcard; ext = ReportFileWildcard();
break; break;
case TREE_FP_PLACE: case TREE_FP_PLACE:
ext = FootprintPlaceFileWildcard; ext = FootprintPlaceFileWildcard();
break; break;
case TREE_DRILL: case TREE_DRILL:
ext = DrillFileWildcard; ext = DrillFileWildcard();
break; break;
case TREE_SVG: case TREE_SVG:
ext = SVGFileWildcard; ext = SVGFileWildcard();
break; break;
case TREE_PAGE_LAYOUT_DESCR: case TREE_PAGE_LAYOUT_DESCR:
ext = PageLayoutDescrFileWildcard; ext = PageLayoutDescrFileWildcard();
break; break;
case TREE_FOOTPRINT_FILE: case TREE_FOOTPRINT_FILE:
ext = KiCadFootprintLibFileWildcard; ext = KiCadFootprintLibFileWildcard();
break; break;
case TREE_SCHEMATIC_LIBFILE: case TREE_SCHEMATIC_LIBFILE:
ext = SchematicLibraryFileWildcard; ext = SchematicLibraryFileWildcard();
break; break;
default: // Eliminates unnecessary GCC warning. default: // Eliminates unnecessary GCC warning.

View File

@ -6,6 +6,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -54,10 +56,11 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( filename ) ); ::wxSetWorkingDirectory( ::wxPathOnly( filename ) );
if( LoadPageLayoutDescrFile( filename ) ) if( LoadPageLayoutDescrFile( filename ) )
{ {
wxString msg; wxString msg;
msg.Printf( _("File <%s> loaded"), GetChars( filename ) ); msg.Printf( _( "File <%s> loaded "), GetChars( filename ) );
SetStatusText( msg ); SetStatusText( msg );
} }
@ -65,6 +68,7 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
} }
} }
/* File commands. */ /* File commands. */
void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
{ {
@ -90,7 +94,6 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
break; break;
} }
switch( id ) switch( id )
{ {
case wxID_NEW: case wxID_NEW:
@ -102,17 +105,18 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
case ID_APPEND_DESCR_FILE: case ID_APPEND_DESCR_FILE:
{ {
wxFileDialog openFileDialog(this, _("Append Existing Page Layout File"), wxFileDialog openFileDialog( this, _( "Append Existing Page Layout File" ),
wxEmptyString, wxEmptyString, wxEmptyString,
wxEmptyString, PageLayoutDescrFileWildcard, wxFD_OPEN); PageLayoutDescrFileWildcard(), wxFD_OPEN );
if (openFileDialog.ShowModal() == wxID_CANCEL) if( openFileDialog.ShowModal() == wxID_CANCEL )
return; return;
filename = openFileDialog.GetPath(); filename = openFileDialog.GetPath();
if( ! InsertPageLayoutDescrFile( filename ) ) if( ! InsertPageLayoutDescrFile( filename ) )
{ {
msg.Printf( _("Unable to load %s file"), GetChars( filename ) ); msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
wxMessageBox( msg ); wxMessageBox( msg );
} }
else else
@ -120,7 +124,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
GetScreen()->SetModify(); GetScreen()->SetModify();
RebuildDesignTree(); RebuildDesignTree();
m_canvas->Refresh(); m_canvas->Refresh();
msg.Printf( _("File <%s> inserted"), GetChars( filename ) ); msg.Printf( _( "File <%s> inserted" ), GetChars( filename ) );
SetStatusText( msg ); SetStatusText( msg );
} }
} }
@ -128,22 +132,23 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
case wxID_OPEN: case wxID_OPEN:
{ {
wxFileDialog openFileDialog(this, _("Open"), wxEmptyString, wxFileDialog openFileDialog( this, _( "Open" ), wxEmptyString, wxEmptyString,
wxEmptyString, PageLayoutDescrFileWildcard, wxFD_OPEN); PageLayoutDescrFileWildcard(), wxFD_OPEN );
if (openFileDialog.ShowModal() == wxID_CANCEL) if( openFileDialog.ShowModal() == wxID_CANCEL )
return; return;
filename = openFileDialog.GetPath(); filename = openFileDialog.GetPath();
if( ! LoadPageLayoutDescrFile( filename ) ) if( ! LoadPageLayoutDescrFile( filename ) )
{ {
msg.Printf( _("Unable to load %s file"), GetChars( filename ) ); msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
wxMessageBox( msg ); wxMessageBox( msg );
} }
else else
{ {
OnNewPageLayout(); OnNewPageLayout();
msg.Printf( _("File <%s> loaded"), GetChars( filename ) ); msg.Printf( _( "File <%s> loaded" ), GetChars( filename ) );
SetStatusText( msg ); SetStatusText( msg );
} }
} }
@ -152,7 +157,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
case wxID_SAVE: case wxID_SAVE:
if( !SavePageLayoutDescrFile( filename ) ) if( !SavePageLayoutDescrFile( filename ) )
{ {
msg.Printf( _("Unable to write <%s>"), GetChars( filename ) ); msg.Printf( _( "Unable to write <%s>" ), GetChars( filename ) );
wxMessageBox( msg ); wxMessageBox( msg );
} }
else else
@ -164,10 +169,10 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
case wxID_SAVEAS: case wxID_SAVEAS:
{ {
wxFileDialog openFileDialog(this, _("Save As"), wxEmptyString, wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString,
wxEmptyString, PageLayoutDescrFileWildcard, wxFD_SAVE); PageLayoutDescrFileWildcard(), wxFD_SAVE );
if (openFileDialog.ShowModal() == wxID_CANCEL) if( openFileDialog.ShowModal() == wxID_CANCEL )
return; return;
filename = openFileDialog.GetPath(); filename = openFileDialog.GetPath();
@ -190,6 +195,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
{ {
msg.Printf( _("File <%s> written"), GetChars( filename ) ); msg.Printf( _("File <%s> written"), GetChars( filename ) );
SetStatusText( msg ); SetStatusText( msg );
if( GetCurrFileName().IsEmpty() ) if( GetCurrFileName().IsEmpty() )
SetCurrFileName( filename ); SetCurrFileName( filename );
} }
@ -202,8 +208,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
} }
} }
/* Loads a .kicad_wks page layout descr file
*/
bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName ) bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
{ {
if( wxFileExists( aFullFileName ) ) if( wxFileExists( aFullFileName ) )
@ -218,10 +223,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
return false; return false;
} }
/* Inserts a .kicad_wks page layout descr file
* same as LoadPageLayoutDescrFile, but the new data is added
* to the previous data.
*/
bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName ) bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName )
{ {
if( wxFileExists( aFullFileName ) ) if( wxFileExists( aFullFileName ) )
@ -236,8 +238,6 @@ bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName )
} }
/* Save the current layout in a .kicad_wks page layout descr file
*/
bool PL_EDITOR_FRAME::SavePageLayoutDescrFile( const wxString& aFullFileName ) bool PL_EDITOR_FRAME::SavePageLayoutDescrFile( const wxString& aFullFileName )
{ {
if( ! aFullFileName.IsEmpty() ) if( ! aFullFileName.IsEmpty() )

View File

@ -222,9 +222,9 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
wxString filename = GetCurrFileName(); wxString filename = GetCurrFileName();
if( filename.IsEmpty() ) if( filename.IsEmpty() )
msg = _("Save changes in a new file before closing?"); msg = _( "Save changes in a new file before closing?" );
else else
msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"), msg.Printf( _( "Save the changes in\n<%s>\nbefore closing?" ),
GetChars( filename ) ); GetChars( filename ) );
int ii = DisplayExitDialog( this, msg ); int ii = DisplayExitDialog( this, msg );
@ -243,10 +243,10 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
if( filename.IsEmpty() ) if( filename.IsEmpty() )
{ {
wxFileDialog openFileDialog(this, _("Save As"), wxEmptyString, wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString,
wxEmptyString, PageLayoutDescrFileWildcard, wxFD_SAVE); PageLayoutDescrFileWildcard(), wxFD_SAVE );
if (openFileDialog.ShowModal() == wxID_CANCEL) if(openFileDialog.ShowModal() == wxID_CANCEL )
return; return;
filename = openFileDialog.GetPath(); filename = openFileDialog.GetPath();
@ -254,7 +254,7 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
if( !SavePageLayoutDescrFile( filename ) ) if( !SavePageLayoutDescrFile( filename ) )
{ {
msg.Printf( _("Unable to create <%s>"), GetChars( filename ) ); msg.Printf( _( "Unable to create <%s>" ), GetChars( filename ) );
wxMessageBox( msg ); wxMessageBox( msg );
} }
} }
@ -298,11 +298,13 @@ double PL_EDITOR_FRAME::BestZoom()
return bestzoom; return bestzoom;
} }
static const wxChar designTreeWidthKey[] = wxT("DesignTreeWidth");
static const wxChar propertiesFrameWidthKey[] = wxT("PropertiesFrameWidth"); static const wxChar designTreeWidthKey[] = wxT( "DesignTreeWidth" );
static const wxChar cornerOriginChoiceKey[] = wxT("CornerOriginChoice"); static const wxChar propertiesFrameWidthKey[] = wxT( "PropertiesFrameWidth" );
static const wxChar cornerOriginChoiceKey[] = wxT( "CornerOriginChoice" );
static const wxChar blackBgColorKey[] = wxT( "BlackBgColor" ); static const wxChar blackBgColorKey[] = wxT( "BlackBgColor" );
void PL_EDITOR_FRAME::LoadSettings( wxConfigBase* aCfg ) void PL_EDITOR_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
EDA_DRAW_FRAME::LoadSettings( aCfg ); EDA_DRAW_FRAME::LoadSettings( aCfg );
@ -333,10 +335,6 @@ void PL_EDITOR_FRAME::SaveSettings( wxConfigBase* aCfg )
} }
/*
* Function UpdateTitleAndInfo
* displays the filename (if exists) of the current page layout descr file.
*/
void PL_EDITOR_FRAME::UpdateTitleAndInfo() void PL_EDITOR_FRAME::UpdateTitleAndInfo()
{ {
wxString title; wxString title;
@ -347,20 +345,19 @@ void PL_EDITOR_FRAME::UpdateTitleAndInfo()
SetTitle( title ); SetTitle( title );
} }
/* return the filename of the current layout descr file
*/
const wxString& PL_EDITOR_FRAME::GetCurrFileName() const const wxString& PL_EDITOR_FRAME::GetCurrFileName() const
{ {
return BASE_SCREEN::m_PageLayoutDescrFileName; return BASE_SCREEN::m_PageLayoutDescrFileName;
} }
/* Stores the current layout descr file filename
*/
void PL_EDITOR_FRAME::SetCurrFileName( const wxString& aName ) void PL_EDITOR_FRAME::SetCurrFileName( const wxString& aName )
{ {
BASE_SCREEN::m_PageLayoutDescrFileName = aName; BASE_SCREEN::m_PageLayoutDescrFileName = aName;
} }
void PL_EDITOR_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) void PL_EDITOR_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{ {
m_pageLayout.SetPageSettings( aPageSettings ); m_pageLayout.SetPageSettings( aPageSettings );
@ -397,9 +394,6 @@ void PL_EDITOR_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
} }
/*
* Update the status bar information.
*/
void PL_EDITOR_FRAME::UpdateStatusBar() void PL_EDITOR_FRAME::UpdateStatusBar()
{ {
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen(); PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
@ -509,6 +503,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
// Display units // Display units
} }
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer, void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData ) bool aPrintMirrorMode, void * aData )
{ {
@ -516,6 +511,7 @@ void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
DrawWorkSheet( aDC, GetScreen(), 0, IU_PER_MILS, wxEmptyString ); DrawWorkSheet( aDC, GetScreen(), 0, IU_PER_MILS, wxEmptyString );
} }
void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg ) void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
{ {
@ -565,6 +561,7 @@ void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
UpdateTitleAndInfo(); UpdateTitleAndInfo();
} }
void PL_EDITOR_FRAME::RebuildDesignTree() void PL_EDITOR_FRAME::RebuildDesignTree()
{ {
const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
@ -580,27 +577,27 @@ void PL_EDITOR_FRAME::RebuildDesignTree()
switch( item->GetType() ) switch( item->GetType() )
{ {
case WORKSHEET_DATAITEM::WS_TEXT: case WORKSHEET_DATAITEM::WS_TEXT:
item->m_Name = wxString::Format( wxT("text%d:%s"), ++textId, item->m_Name = wxString::Format( wxT( "text%d:%s" ), ++textId,
GetChars(item->GetClassName()) ); GetChars(item->GetClassName()) );
break; break;
case WORKSHEET_DATAITEM:: WS_SEGMENT: case WORKSHEET_DATAITEM:: WS_SEGMENT:
item->m_Name = wxString::Format( wxT("segm%d:%s"), ++lineId, item->m_Name = wxString::Format( wxT( "segm%d:%s" ), ++lineId,
GetChars(item->GetClassName()) ); GetChars(item->GetClassName()) );
break; break;
case WORKSHEET_DATAITEM::WS_RECT: case WORKSHEET_DATAITEM::WS_RECT:
item->m_Name = wxString::Format( wxT("rect%d:%s"), ++rectId, item->m_Name = wxString::Format( wxT( "rect%d:%s" ), ++rectId,
GetChars(item->GetClassName()) ); GetChars(item->GetClassName()) );
break; break;
case WORKSHEET_DATAITEM::WS_POLYPOLYGON: case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
item->m_Name = wxString::Format( wxT("poly%d:%s"), ++polyId, item->m_Name = wxString::Format( wxT( "poly%d:%s" ), ++polyId,
GetChars(item->GetClassName()) ); GetChars(item->GetClassName()) );
break; break;
case WORKSHEET_DATAITEM::WS_BITMAP: case WORKSHEET_DATAITEM::WS_BITMAP:
item->m_Name = wxString::Format( wxT("bm%d:%s"), ++bitmapId, item->m_Name = wxString::Format( wxT( "bm%d:%s" ), ++bitmapId,
GetChars(item->GetClassName()) ); GetChars(item->GetClassName()) );
break; break;
} }
@ -609,9 +606,7 @@ void PL_EDITOR_FRAME::RebuildDesignTree()
m_treePagelayout->ReCreateDesignTree(); m_treePagelayout->ReCreateDesignTree();
} }
/* Add a new item to the page layout item list.
* aType = WS_TEXT, WS_SEGMENT, WS_RECT, WS_POLYPOLYGON
*/
WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx ) WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx )
{ {
WORKSHEET_DATAITEM * item = NULL; WORKSHEET_DATAITEM * item = NULL;
@ -619,7 +614,7 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx )
switch( aType ) switch( aType )
{ {
case WORKSHEET_DATAITEM::WS_TEXT: case WORKSHEET_DATAITEM::WS_TEXT:
item = new WORKSHEET_DATAITEM_TEXT( wxT("Text") ); item = new WORKSHEET_DATAITEM_TEXT( wxT( "Text") );
break; break;
case WORKSHEET_DATAITEM::WS_SEGMENT: case WORKSHEET_DATAITEM::WS_SEGMENT:
@ -650,6 +645,7 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx )
wxMessageBox( _( "Couldn't load image from <%s>" ), GetChars( fullFilename ) ); wxMessageBox( _( "Couldn't load image from <%s>" ), GetChars( fullFilename ) );
break; break;
} }
BITMAP_BASE* image = new BITMAP_BASE(); BITMAP_BASE* image = new BITMAP_BASE();
if( !image->ReadImageFile( fullFilename ) ) if( !image->ReadImageFile( fullFilename ) )
@ -659,6 +655,7 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx )
delete image; delete image;
break; break;
} }
item = new WORKSHEET_DATAITEM_BITMAP( image ); item = new WORKSHEET_DATAITEM_BITMAP( image );
} }
break; break;
@ -674,17 +671,14 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx )
return item; return item;
} }
/* returns the current selected item, or NULL
*/
WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem() WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem()
{ {
WORKSHEET_DATAITEM* item = m_treePagelayout->GetPageLayoutSelectedItem(); WORKSHEET_DATAITEM* item = m_treePagelayout->GetPageLayoutSelectedItem();
return item; return item;
} }
/* return the page layout item found at position aPosition
* aPosition = the position (in user units) of the reference point
*/
WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
{ {
const PAGE_INFO& pageInfo = GetPageSettings(); const PAGE_INFO& pageInfo = GetPageSettings();
@ -731,21 +725,22 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
if( (drawitem->m_Flags & (LOCATE_STARTPOINT|LOCATE_ENDPOINT)) if( (drawitem->m_Flags & (LOCATE_STARTPOINT|LOCATE_ENDPOINT))
== (LOCATE_STARTPOINT|LOCATE_ENDPOINT) ) == (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
text << wxT(" ") << _("(start or end point)"); text << wxT( " " ) << _( "(start or end point)" );
else else
{ {
if( (drawitem->m_Flags & LOCATE_STARTPOINT) ) if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
text << wxT(" ") << _("(start point)"); text << wxT( " " ) << _( "(start point)" );
if( (drawitem->m_Flags & LOCATE_ENDPOINT) ) if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
text << wxT(" ") << _("(end point)"); text << wxT( " " ) << _( "(end point)" );
} }
if( ! drawitem->GetParent()->m_Info.IsEmpty() ) if( ! drawitem->GetParent()->m_Info.IsEmpty() )
text << wxT(" \"") << drawitem->GetParent()->m_Info << wxT("\""); text << wxT( " \"" ) << drawitem->GetParent()->m_Info << wxT( "\"" );
choices.Add( text ); choices.Add( text );
} }
int selection = wxGetSingleChoiceIndex ( wxEmptyString, int selection = wxGetSingleChoiceIndex ( wxEmptyString,
_( "Selection Clarification" ), _( "Selection Clarification" ),
choices, this ); choices, this );
@ -758,7 +753,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
} }
WORKSHEET_DATAITEM* item = drawitem->GetParent(); WORKSHEET_DATAITEM* item = drawitem->GetParent();
item->ClearFlags(LOCATE_STARTPOINT|LOCATE_ENDPOINT); item->ClearFlags( LOCATE_STARTPOINT|LOCATE_ENDPOINT );
if( (drawitem->m_Flags & LOCATE_STARTPOINT) ) if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
item->SetFlags( LOCATE_STARTPOINT ); item->SetFlags( LOCATE_STARTPOINT );
@ -769,9 +764,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
return item; return item;
} }
/* Must be called to initialize parameters when a new page layout
* description is loaded
*/
void PL_EDITOR_FRAME::OnNewPageLayout() void PL_EDITOR_FRAME::OnNewPageLayout()
{ {
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();

View File

@ -229,7 +229,7 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
GetChars( DataFileNameExt ) ); GetChars( DataFileNameExt ) );
wxFileDialog dlg( m_panelRegulators, wxFileDialog dlg( m_panelRegulators,
_("Select a PCB Calculator data file"), _("Select PCB Calculator Data File"),
wxEmptyString, fullfilename, wxEmptyString, fullfilename,
wildcard, wxFD_OPEN ); wildcard, wxFD_OPEN );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -33,6 +33,7 @@
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <macros.h> #include <macros.h>
#include <project.h> #include <project.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
@ -58,8 +59,6 @@
const wxString CsvFileExtension( wxT( "csv" ) ); // BOM file extension const wxString CsvFileExtension( wxT( "csv" ) ); // BOM file extension
const wxString CsvFileWildcard( _( "Comma separated value files (*.csv)|*.csv" ) );
class cmp class cmp
{ {
@ -94,7 +93,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Save Bill of Materials" ), pro_dir, wxFileDialog dlg( this, _( "Save Bill of Materials" ), pro_dir,
fn.GetFullName(), CsvFileWildcard, fn.GetFullName(), CsvFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -311,7 +311,7 @@ void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
wxString prj_path = Prj().GetProjectPath(); wxString prj_path = Prj().GetProjectPath();
wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path,
fn.GetFullName(), ReportFileWildcard, fn.GetFullName(), ReportFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -37,7 +37,6 @@
#include <class_module.h> #include <class_module.h>
#include <project.h> #include <project.h>
#include <wx_html_report_panel.h> #include <wx_html_report_panel.h>
//#include <reporter.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <dialog_exchange_modules.h> #include <dialog_exchange_modules.h>
@ -427,7 +426,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
// Build the .cmp file name from the board name // Build the .cmp file name from the board name
fn = GetBoard()->GetFileName(); fn = GetBoard()->GetFileName();
fn.SetExt( ComponentFileExtension ); fn.SetExt( ComponentFileExtension );
wildcard = wxGetTranslation( ComponentFileWildcard ); wildcard = ComponentFileWildcard();
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );

View File

@ -30,6 +30,8 @@
#include <kiface_i.h> #include <kiface_i.h>
#include <confirm.h> #include <confirm.h>
#include <gestfich.h> #include <gestfich.h>
#include <wildcards_and_files_ext.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <macros.h> #include <macros.h>
@ -181,11 +183,11 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
const wxString DIALOG_FREEROUTE::createDSN_File() const wxString DIALOG_FREEROUTE::createDSN_File()
{ {
wxFileName fn( m_Parent->GetBoard()->GetFileName() ); wxFileName fn( m_Parent->GetBoard()->GetFileName() );
wxString dsn_ext = wxT( "dsn" ); wxString dsn_ext = SpecctraDsnFileExtension;
fn.SetExt( dsn_ext ); fn.SetExt( dsn_ext );
wxString mask = wxT( "*." ) + dsn_ext; wxString mask = SpecctraDsnFileWildcard();
wxString fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN file:" ), wxString fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ),
fn.GetPath(), fn.GetFullName(), fn.GetPath(), fn.GetFullName(),
dsn_ext, mask, dsn_ext, mask,
this, wxFD_SAVE, false ); this, wxFD_SAVE, false );

View File

@ -28,6 +28,7 @@
#include <class_board.h> #include <class_board.h>
#include <project.h> #include <project.h>
#include <confirm.h> #include <confirm.h>
#include <wildcards_and_files_ext.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
@ -148,7 +149,7 @@ void DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse( wxCommandEvent& aEvent )
wxFileDialog dlg( this, _( "Save GenCAD Board File" ), wxFileDialog dlg( this, _( "Save GenCAD Board File" ),
wxPathOnly( Prj().GetProjectFullName() ), wxPathOnly( Prj().GetProjectFullName() ),
m_filePath->GetValue(), m_filePath->GetValue(),
_( "GenCAD 1.4 board files (.cad)|*.cad" ), GencadFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -455,7 +455,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
defaultPath = wxStandardPaths::Get().GetDocumentsDir(); defaultPath = wxStandardPaths::Get().GetDocumentsDir();
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(), wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(),
wxGetTranslation( ReportFileWildcard ), wxFD_SAVE ); ReportFileWildcard(), wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -6,7 +6,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -147,7 +147,7 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event )
GetChars( lastPath ), GetChars( lastNetlistRead ) ); GetChars( lastPath ), GetChars( lastNetlistRead ) );
wxFileDialog FilesDialog( this, _( "Select Netlist" ), lastPath, lastNetlistRead, wxFileDialog FilesDialog( this, _( "Select Netlist" ), lastPath, lastNetlistRead,
NetlistFileWildcard, wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST ); NetlistFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
if( FilesDialog.ShowModal() != wxID_OK ) if( FilesDialog.ShowModal() != wxID_OK )
return; return;
@ -351,15 +351,15 @@ void DIALOG_NETLIST::OnSaveMessagesToFile( wxCommandEvent& aEvent )
if( !m_parent->GetLastNetListRead().IsEmpty() ) if( !m_parent->GetLastNetListRead().IsEmpty() )
{ {
fn = m_parent->GetLastNetListRead(); fn = m_parent->GetLastNetListRead();
fn.SetExt( wxT( "txt" ) ); fn.SetExt( "txt" );
} }
else else
{ {
fn = wxPathOnly( Prj().GetProjectFullName() ); fn = wxPathOnly( Prj().GetProjectFullName() );
} }
wxFileDialog dlg( this, _( "Save contents of message window" ), fn.GetPath(), fn.GetName(), wxFileDialog dlg( this, _( "Save Contents of Message Window" ), fn.GetPath(), fn.GetFullName(),
TextWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2011-2013 Lorenzo Marcantonio <l.marcantonio@logossrl.com> * Copyright (C) 2011-2013 Lorenzo Marcantonio <l.marcantonio@logossrl.com>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -36,6 +36,7 @@
#include <trigo.h> #include <trigo.h>
#include <build_version.h> #include <build_version.h>
#include <macros.h> #include <macros.h>
#include <wildcards_and_files_ext.h>
#include <pcbnew.h> #include <pcbnew.h>
@ -355,8 +356,8 @@ void PCB_EDIT_FRAME::GenD356File( wxCommandEvent& aEvent )
wxString msg, ext, wildcard; wxString msg, ext, wildcard;
FILE* file; FILE* file;
ext = wxT( "d356" ); ext = IpcD356FileExtension;
wildcard = _( "IPC-D-356 Test Files (.d356)|*.d356" ); wildcard = IpcD356FileWildcard();
fn.SetExt( ext ); fn.SetExt( ext );
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -96,10 +96,10 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
IO_MGR::PCB_FILE_T pluginType; IO_MGR::PCB_FILE_T pluginType;
} loaders[] = } loaders[] =
{ {
{ PcbFileWildcard, IO_MGR::KICAD_SEXP }, // Current Kicad board files { PcbFileWildcard(), IO_MGR::KICAD_SEXP }, // Current Kicad board files
{ LegacyPcbFileWildcard, IO_MGR::LEGACY }, // Old Kicad board files { LegacyPcbFileWildcard(), IO_MGR::LEGACY }, // Old Kicad board files
{ EaglePcbFileWildcard, IO_MGR::EAGLE }, // Import board files { EaglePcbFileWildcard(), IO_MGR::EAGLE }, // Import board files
{ PCadPcbFileWildcard, IO_MGR::PCAD }, // Import board files { PCadPcbFileWildcard(), IO_MGR::PCAD }, // Import board files
}; };
wxFileName fileName( *aFileName ); wxFileName fileName( *aFileName );
@ -141,7 +141,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
} }
wxFileDialog dlg( aParent, wxFileDialog dlg( aParent,
aKicadFilesOnly ? _( "Open Board File" ) : _( "Import Non Kicad Board File" ), aKicadFilesOnly ? _( "Open Board File" ) : _( "Import Non KiCad Board File" ),
path, name, fileFilters, path, name, fileFilters,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
@ -171,7 +171,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
*/ */
bool AskSaveBoardFileName( wxWindow* aParent, wxString* aFileName ) bool AskSaveBoardFileName( wxWindow* aParent, wxString* aFileName )
{ {
wxString wildcard = wxGetTranslation( PcbFileWildcard ); wxString wildcard = PcbFileWildcard();
wxFileName fn = *aFileName; wxFileName fn = *aFileName;
fn.SetExt( KiCadPcbFileExtension ); fn.SetExt( KiCadPcbFileExtension );

View File

@ -7,7 +7,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -31,6 +31,7 @@
#include <kiface_i.h> #include <kiface_i.h>
#include <convert_to_biu.h> #include <convert_to_biu.h>
#include <class_pcb_layer_box_selector.h> #include <class_pcb_layer_box_selector.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
@ -231,7 +232,7 @@ void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event )
wxFileDialog dlg( m_parent, wxFileDialog dlg( m_parent,
_( "Open File" ), _( "Open File" ),
path, filename, path, filename,
"DXF Files (*.dxf)|*.dxf", DxfFileWildcard(),
wxFD_OPEN|wxFD_FILE_MUST_EXIST ); wxFD_OPEN|wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )

View File

@ -91,8 +91,6 @@ static const wxString INFO_LEGACY_LIB_WARN_DELETE(
"and update your footprint lib table\n"\ "and update your footprint lib table\n"\
"before deleting a footprint" ) ); "before deleting a footprint" ) );
static const wxString ModLegacyExportFileWildcard( _( "Legacy foot print export files (*.emp)|*.emp" ) );
#define EXPORT_IMPORT_LASTPATH_KEY wxT( "import_last_path" ) #define EXPORT_IMPORT_LASTPATH_KEY wxT( "import_last_path" )
@ -107,9 +105,9 @@ static wxFileName getFootprintFilenameFromUser( wxWindow* aParent, const wxStrin
static int lastFilterIndex = 0; // To store the last choice during a session. static int lastFilterIndex = 0; // To store the last choice during a session.
wxString wildCard; wxString wildCard;
wildCard << wxGetTranslation( KiCadFootprintLibFileWildcard ) << wxChar( '|' ) wildCard << KiCadFootprintLibFileWildcard() << wxChar( '|' )
<< wxGetTranslation( ModLegacyExportFileWildcard ) << wxChar( '|' ) << ModLegacyExportFileWildcard() << wxChar( '|' )
<< wxGetTranslation( GedaPcbFootprintLibFileWildcard ); << GedaPcbFootprintLibFileWildcard();
wxFileDialog dlg( aParent, FMT_IMPORT_MODULE, aLastPath, wxEmptyString, wildCard, wxFileDialog dlg( aParent, FMT_IMPORT_MODULE, aLastPath, wxEmptyString, wildCard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
@ -350,7 +348,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
fn.SetName( aModule->GetFPID().GetLibItemName() ); fn.SetName( aModule->GetFPID().GetLibItemName() );
wxString wildcard = wxGetTranslation( KiCadFootprintLibFileWildcard ); wxString wildcard = KiCadFootprintLibFileWildcard();
fn.SetExt( KiCadFootprintFileExtension ); fn.SetExt( KiCadFootprintFileExtension );

View File

@ -3,8 +3,8 @@
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -76,7 +76,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER,
m_show_layer_manager_tools ? m_show_layer_manager_tools ?
_("Hide &Layers Manager" ) : _("Show &Layers Manager" )); _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ));
break; break;
case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR: case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR:
@ -215,7 +215,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(), wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
fn.GetFullName(), ProjectFileWildcard, fn.GetFullName(), ProjectFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -292,7 +292,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
{ {
wxFileDialog dlg( this, _( "Save Project File" ), wxFileDialog dlg( this, _( "Save Project File" ),
fn.GetPath(), fn.GetFullName(), fn.GetPath(), fn.GetFullName(),
ProjectFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR ); ProjectFileWildcard(), wxFD_SAVE | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;

View File

@ -49,6 +49,7 @@
#include <class_zone.h> #include <class_zone.h>
#include <class_drawsegment.h> #include <class_drawsegment.h>
#include <base_units.h> #include <base_units.h>
#include <wildcards_and_files_ext.h>
#include <collectors.h> #include <collectors.h>
@ -77,8 +78,8 @@ void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event )
wxString path; wxString path;
wxString name; wxString name;
wxString ext; wxString ext;
wxString dsn_ext = wxT( ".dsn" ); wxString dsn_ext = SpecctraDsnFileExtension;
wxString mask = wxT( "*" ) + dsn_ext; wxString mask = SpecctraDsnFileWildcard();
wxFileName::SplitPath( fullFileName, &path, &name, &ext ); wxFileName::SplitPath( fullFileName, &path, &name, &ext );