diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 82e28890eb..650192c352 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * 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 * modify it under the terms of the GNU General Public License @@ -482,9 +482,8 @@ void BM2CMP_FRAME::OnExportLogo() if( path.IsEmpty() || !wxDirExists(path) ) path = ::wxGetCwd(); - wxFileDialog fileDlg( this, _( "Create a logo file" ), - path, wxEmptyString, - wxGetTranslation( PageLayoutDescrFileWildcard ), + wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString, + PageLayoutDescrFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); int diag = fileDlg.ShowModal(); @@ -519,9 +518,9 @@ void BM2CMP_FRAME::OnExportPostScript() if( path.IsEmpty() || !wxDirExists( path ) ) path = ::wxGetCwd(); - wxFileDialog fileDlg( this, _( "Create a Postscript file" ), + wxFileDialog fileDlg( this, _( "Create Postscript File" ), path, wxEmptyString, - wxGetTranslation( PSFileWildcard ), + PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); int diag = fileDlg.ShowModal(); @@ -557,9 +556,9 @@ void BM2CMP_FRAME::OnExportEeschema() if( path.IsEmpty() || !wxDirExists(path) ) path = ::wxGetCwd(); - wxFileDialog fileDlg( this, _( "Create a component library file for Eeschema" ), + wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString, - wxGetTranslation( SchematicLibraryFileWildcard ), + SchematicLibraryFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); int diag = fileDlg.ShowModal(); @@ -594,9 +593,9 @@ void BM2CMP_FRAME::OnExportPcbnew() if( path.IsEmpty() || !wxDirExists( path ) ) path = m_mruPath; - wxFileDialog fileDlg( this, _( "Create a footprint file for Pcbnew" ), + wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString, - wxGetTranslation( KiCadFootprintLibFileWildcard ), + KiCadFootprintLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); int diag = fileDlg.ShowModal(); diff --git a/common/config_params.cpp b/common/config_params.cpp index 0d56708b97..f522a08341 100644 --- a/common/config_params.cpp +++ b/common/config_params.cpp @@ -2,8 +2,8 @@ * 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) 2008-2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2008 Wayne Stambaugh + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 819d68a893..e45e58c10d 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -1,7 +1,7 @@ /* * 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 * 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 ) { // Display a file picker dialog - wxFileDialog fileDialog( this, _( "Select Page Layout Descr File" ), + wxFileDialog fileDialog( this, _( "Select Page Layout Description File" ), m_projectPath, GetWksFileName(), - PageLayoutDescrFileWildcard, + PageLayoutDescrFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST ); if( fileDialog.ShowModal() != wxID_OK ) diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp index 244abfc4c2..c00083e2d5 100644 --- a/common/dialogs/wx_html_report_panel.cpp +++ b/common/dialogs/wx_html_report_panel.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * * 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" ); - wxFileDialog dlg( this, _( "Save report to file" ), fn.GetPath(), fn.GetName(), - TextWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(), + TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() != wxID_OK ) return; diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index c872db7f11..81d8e94dcc 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -2,8 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2008-2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2008 Wayne Stambaugh + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,79 +29,349 @@ #include /** - * 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" ) ); -const wxString SchematicLibraryFileExtension( wxT( "lib" ) ); -const wxString SchematicBackupFileExtension( wxT( "bak" ) ); + for( auto ch : aWildcard ) + { + 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" ) ); -const wxString SchematicFileExtension( wxT( "sch" ) ); -const wxString NetlistFileExtension( wxT( "net" ) ); -const wxString ComponentFileExtension( wxT( "cmp" ) ); + return wc; +#endif +} + + +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 GerberJobFileExtension( "gbrjob" ); const wxString HtmlFileExtension( wxT( "html" ) ); -const wxString LegacyPcbFileExtension( wxT( "brd" ) ); -const wxString KiCadPcbFileExtension( wxT( "kicad_pcb" ) ); -const wxString PageLayoutDescrFileExtension( wxT( "kicad_wks" ) ); +const wxString LegacyPcbFileExtension( "brd" ); +const wxString KiCadPcbFileExtension( "kicad_pcb" ); +const wxString PageLayoutDescrFileExtension( "kicad_wks" ); -const wxString PdfFileExtension( wxT( "pdf" ) ); -const wxString MacrosFileExtension( wxT( "mcr" ) ); -const wxString DrillFileExtension( wxT( "drl" ) ); -const wxString SVGFileExtension( wxT( "svg" ) ); -const wxString ReportFileExtension( wxT( "rpt" ) ); -const wxString FootprintPlaceFileExtension( wxT( "pos" ) ); -const wxString KiCadLib3DShapesPathExtension( wxT( "3dshapes" ) ); ///< 3D shapes default libpath +const wxString PdfFileExtension( "pdf" ); +const wxString MacrosFileExtension( "mcr" ); +const wxString DrillFileExtension( "drl" ); +const wxString SVGFileExtension( "svg" ); +const wxString ReportFileExtension( "rpt" ); +const wxString FootprintPlaceFileExtension( "pos" ); +const wxString KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath -const wxString KiCadFootprintLibPathExtension( wxT( "pretty" ) ); ///< KICAD PLUGIN libpath -const wxString LegacyFootprintLibPathExtension( wxT( "mod" ) ); -const wxString EagleFootprintLibPathExtension( wxT( "lbr" ) ); +const wxString KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath +const wxString LegacyFootprintLibPathExtension( "mod" ); +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 (*)|*" ) ); + +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 -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 -const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) ); -const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) ); -const wxString HtmlFileWildcard( _( "HTML files (*.html)|*.htm;*.html" ) ); -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" ); -const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" ); -const wxString Shapes3DFileWildcard( _( "Vrml and x3d files (*.wrl *.x3d)|*.wrl;*.x3d" ) ); -const wxString IDF3DFileWildcard( _( "IDFv3 component files (*.idf)|*.idf" ) ); -const wxString TextWildcard( _( "Text files (*.txt)|*.txt" ) ); +wxString DrillFileWildcard() +{ + return _( "Drill files (*.drl)|*." ) + FormatWildcardExt( "drl" ); +} + + +wxString SVGFileWildcard() +{ + return _( "SVG files (*.svg)|*." ) + FormatWildcardExt( "svg" ); +} + + +wxString HtmlFileWildcard() +{ + return _( "HTML files (*.html)|*." ) + FormatWildcardExt( "htm" ) + ";*.," + + FormatWildcardExt( "html" ); +} + + +wxString CsvFileWildcard() +{ + return _( "CSV Files (*.csv)|*." ) + FormatWildcardExt( "csv" ); +} + + +wxString PdfFileWildcard() +{ + return _( "Portable document format files (*.pdf)|*." ) + FormatWildcardExt( "pdf" ); +} + + +wxString PSFileWildcard() +{ + return _( "PostScript files (.ps)|*." ) + FormatWildcardExt( "ps" ); +} + + +wxString ReportFileWildcard() +{ + return _( "Report files (*.rpt)|*." ) + FormatWildcardExt( "rpt" ); +} + + +wxString FootprintPlaceFileWildcard() +{ + return _( "Footprint place files (*.pos)|*." ) + FormatWildcardExt( "pos" ); +} + + +wxString Shapes3DFileWildcard() +{ + return _( "VRML and X3D files (*.wrl *.x3d)|*." ) + FormatWildcardExt( "wrl" ) + + ";*." + FormatWildcardExt( "x3d" ); +} + + +wxString IDF3DFileWildcard() +{ + return _( "IDFv3 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" ); +} diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 6c4b2d29c4..97e7f04535 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -47,8 +47,6 @@ // Constant string definitions for CvPcb 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 { diff --git a/cvpcb/dialogs/dialog_config_equfiles.cpp b/cvpcb/dialogs/dialog_config_equfiles.cpp index aebc9497e9..6d41a5bc46 100644 --- a/cvpcb/dialogs/dialog_config_equfiles.cpp +++ b/cvpcb/dialogs/dialog_config_equfiles.cpp @@ -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 ) { - wxString equFilename, wildcard; + wxString equFilename; wxFileName fn; - wildcard = EquFilesWildcard; wxListBox* list = m_ListEquiv; // 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 ) ); - wxFileDialog FilesDialog( this, _( "Equ files:" ), libpath, - wxEmptyString, wildcard, + wxFileDialog FilesDialog( this, _( "Footprint Association File" ), libpath, + wxEmptyString, EquFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_MULTIPLE ); if( FilesDialog.ShowModal() != wxID_OK ) diff --git a/eeschema/backanno.cpp b/eeschema/backanno.cpp index 71a581189b..e194c71104 100644 --- a/eeschema/backanno.cpp +++ b/eeschema/backanno.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * 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 * 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() ); - wxFileDialog dlg( this, _( "Load Component Footprint Link File" ), + wxFileDialog dlg( this, _( "Load Symbol Footprint Link File" ), path, wxEmptyString, - ComponentFileExtensionWildcard, + ComponentFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index cbf972d24a..8e811a40d3 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -2,8 +2,8 @@ * 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) 2012-2016 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012 Wayne Stambaugh + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -598,8 +599,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) fn.SetExt( wxT( "erc" ) ); wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(), - _( "Electronic rule check file (.erc)|*.erc" ), - wxFD_SAVE ); + ErcFileWildcard(), wxFD_SAVE ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index cb938df573..a78ec84c00 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -2,7 +2,7 @@ * 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-2015 Wayne Stambaugh + * Copyright (C) 2013 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -197,7 +197,7 @@ private: * @return true for known netlist type, false for custom formats */ bool FilenamePrms( NETLIST_TYPE_ID aNetTypeId, - wxString * aExt, wxString * aWildCard ); + wxString * aExt, wxString * aWildCard ); DECLARE_EVENT_TABLE() }; @@ -620,7 +620,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aNetTypeId, - wxString * aExt, wxString * aWildCard ) + wxString * aExt, wxString * aWildCard ) { wxString fileExt; wxString fileWildcard; @@ -631,18 +631,18 @@ bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aNetTypeId, { case NET_TYPE_SPICE: fileExt = wxT( "cir" ); - fileWildcard = _( "SPICE netlist file (.cir)|*.cir" ); + fileWildcard = SpiceNetlistFileWildcard(); break; case NET_TYPE_CADSTAR: fileExt = wxT( "frp" ); - fileWildcard = _( "CadStar netlist file (.frp)|*.frp" ); + fileWildcard = CadstarNetlistFileWildcard(); break; case NET_TYPE_PCBNEW: case NET_TYPE_ORCADPCB2: fileExt = NetlistFileExtension; - fileWildcard = NetlistFileWildcard; + fileWildcard = NetlistFileWildcard(); break; default: // custom, NET_TYPE_CUSTOM1 and greater diff --git a/eeschema/dialogs/dialog_spice_model.cpp b/eeschema/dialogs/dialog_spice_model.cpp index a281583a6a..d475e199c5 100644 --- a/eeschema/dialogs/dialog_spice_model.cpp +++ b/eeschema/dialogs/dialog_spice_model.cpp @@ -22,6 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "wildcards_and_files_ext.h" #include "dialog_spice_model.h" #include @@ -718,8 +719,8 @@ void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event ) if( searchPath.IsEmpty() ) searchPath = Prj().GetProjectPath(); - wxFileDialog openDlg( this, wxT( "Select library" ), searchPath, "", - "Spice library file (*.lib)|*.lib;*.LIB|Any file|*", + wxString wildcards = SpiceLibraryFileWildcard() + "|" + AllFilesWildcard; + wxFileDialog openDlg( this, _( "Select library" ), searchPath, "", wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( openDlg.ShowModal() == wxID_CANCEL ) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index da89ad6454..c81973bd31 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -174,7 +174,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event ) fn.SetExt( ProjectFileExtension ); wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(), - fn.GetFullName(), ProjectFileWildcard, + fn.GetFullName(), ProjectFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -410,7 +410,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave ) { wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(), fn.GetFullName(), - ProjectFileWildcard, wxFD_SAVE ); + ProjectFileWildcard(), wxFD_SAVE ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index c8265f3712..08ac4d0b16 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -73,7 +73,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName, { wxFileDialog dlg( this, _( "Schematic Files" ), wxPathOnly( Prj().GetProjectFullName() ), - schematicFileName.GetFullName(), SchematicFileWildcard, + schematicFileName.GetFullName(), SchematicFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -388,7 +388,7 @@ bool SCH_EDIT_FRAME::AppendOneEEProject() wxString path = wxPathOnly( Prj().GetProjectFullName() ); wxFileDialog dlg( this, _( "Append Schematic" ), path, - wxEmptyString, SchematicFileWildcard, + wxEmptyString, SchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -529,7 +529,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent ) wxString path = wxPathOnly( Prj().GetProjectFullName() ); wxFileDialog dlg( this, _( "Import Schematic" ), path, - wxEmptyString, EagleSchematicFileWildcard, + wxEmptyString, EagleSchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index 083c968801..6cbb1ea460 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -50,7 +50,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event ) m_lastDrawItem = NULL; wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath, - wxEmptyString, SchematicLibraryFileWildcard, + wxEmptyString, SchematicLibraryFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -117,7 +117,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event ) title = createLib ? _( "New Symbol Library" ) : _( "Export Symbol" ); 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 ) return; diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 0637e5c8d7..a6821326fb 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -318,7 +318,7 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) default_path = search->LastVisitedPath(); wxFileDialog dlg( this, _( "Symbol Library Name" ), default_path, - wxEmptyString, SchematicLibraryFileWildcard, + wxEmptyString, SchematicLibraryFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/eeschema/sch_io_mgr.cpp b/eeschema/sch_io_mgr.cpp index 9259147f78..ce98084771 100644 --- a/eeschema/sch_io_mgr.cpp +++ b/eeschema/sch_io_mgr.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * @@ -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. wxFileName fn( aLibPath ); - if( fn.GetExt() == SchematicFileWildcard ) + if( fn.GetExt() == SchematicFileExtension ) { ret = SCH_LEGACY; } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index f7ccf0f403..9a6320ad68 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -1038,11 +1038,10 @@ void SCH_EDIT_FRAME::OnUpdateFields( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event ) { -// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); wxString pro_dir = m_mruPath; wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, - wxEmptyString, SchematicFileWildcard, + wxEmptyString, SchematicFileWildcard(), wxFD_SAVE ); if( dlg.ShowModal() != wxID_CANCEL ) @@ -1076,7 +1075,7 @@ void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event ) wxString pro_dir = m_mruPath; wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, - wxEmptyString, SchematicFileWildcard, + wxEmptyString, SchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() != wxID_CANCEL ) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index de3bebc25a..f8c5a5bd2f 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -782,7 +783,7 @@ void SIM_PLOT_FRAME::menuNewPlot( wxCommandEvent& aEvent ) void SIM_PLOT_FRAME::menuOpenWorkbook( wxCommandEvent& event ) { 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 ) return; @@ -799,8 +800,8 @@ void SIM_PLOT_FRAME::menuSaveWorkbook( wxCommandEvent& event ) if( !CurrentPlot() ) return; - wxFileDialog saveDlg( this, _( "Save simulation workbook" ), m_savedWorkbooksPath, "", - _( "Workbook file (*.wbk)|*.wbk" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "", + WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; @@ -817,8 +818,8 @@ void SIM_PLOT_FRAME::menuSaveImage( wxCommandEvent& event ) if( !CurrentPlot() ) return; - wxFileDialog saveDlg( this, _( "Save plot as image" ), "", "", - _( "PNG file (*.png)|*.png" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "", + PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; @@ -834,8 +835,8 @@ void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event ) const wxChar SEPARATOR = ';'; - wxFileDialog saveDlg( this, _( "Save plot data" ), "", "", - "CSV file (*.csv)|*.csv", wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "", + CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index 004bf4ed3b..7f57e78196 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -2,7 +2,7 @@ * 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) 2008-2017 Wayne Stambaugh + * Copyright (C) 2008 Wayne Stambaugh * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -62,7 +62,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol() default_path = search->LastVisitedPath(); wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path, - wxEmptyString, SchematicSymbolFileWildcard, + wxEmptyString, SchematicSymbolFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -150,11 +150,13 @@ void LIB_EDIT_FRAME::SaveOneSymbol() return; wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH ); + if( !default_path ) default_path = search->LastVisitedPath(); wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path, - part->GetName(), SchematicSymbolFileWildcard, + part->GetName() + "." + SchematicSymbolFileExtension, + SchematicSymbolFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index c444799bff..1ba608d0ce 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -2,7 +2,7 @@ * 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) 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 * modify it under the terms of the GNU General Public License @@ -157,6 +157,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) int layercount = 0; GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList(); + // Count the Gerber layers which are actually currently used for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii ) { @@ -174,8 +175,8 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) wxString fileName; wxString path = m_mruPath; - wxFileDialog filedlg( this, _( "Board file name:" ), - path, fileName, PcbFileWildcard, + wxFileDialog filedlg( this, _( "Board File Name" ), + path, fileName, PcbFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( filedlg.ShowModal() == wxID_CANCEL ) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index f3de9a57bd..0c6bd8ff62 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -297,8 +297,9 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) if( !filename.IsOk() ) { - filetypes = wxGetTranslation( DrillFileWildcard ); - filetypes << wxT("|"); + filetypes = DrillFileWildcard(); + filetypes << wxT( "|" ); + /* All filetypes */ filetypes += wxGetTranslation( AllFilesWildcard ); @@ -545,7 +546,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName ) { #define ZipFileExtension "zip" -#define ZipFileWildcard _( "Zip file (*.zip)|*.zip;.zip" ) + wxFileName filename = aFullFileName; wxString currentPath; @@ -561,7 +562,7 @@ bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName ) _( "Open Zip File" ), currentPath, filename.GetFullName(), - ZipFileWildcard, + ZipFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/gerbview/job_file_reader.cpp b/gerbview/job_file_reader.cpp index c8da6a14b4..9390b80476 100644 --- a/gerbview/job_file_reader.cpp +++ b/gerbview/job_file_reader.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -141,7 +142,6 @@ bool GERBER_JOBFILE_READER::parseTJLayerString( wxString& aText ) bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName ) { -#define jobFileWildcard _( "Gerber job file (*.gbrjob)|*.gbrjob;.gbrjob" ) wxFileName filename = aFullFileName; wxString currentPath; @@ -156,7 +156,7 @@ bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName ) wxFileDialog dlg( this, _( "Open Gerber Job File" ), currentPath, filename.GetFullName(), - jobFileWildcard, + GerberJobFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h index c113e48932..bc3fbff5c9 100644 --- a/include/wildcards_and_files_ext.h +++ b/include/wildcards_and_files_ext.h @@ -3,8 +3,8 @@ * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2008-2012 Wayne Stambaugh - * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2008 Wayne Stambaugh + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,13 +35,19 @@ #include /** - * File extension definitions. Please do not changes these. If a different - * file extension is needed, create a new definition in the application. - * Please note, just because they are defined as const doesn't guarantee - * that they cannot be changed. - * Mainly wild cards are most of time translated when displayed + * \defgroup file_extensions File Extension Definitions + * + * @note Please do not changes these. If a different file extension is needed, create a new + * definition in here. If you create a extension definition in another file, make sure + * to add it to the Doxygen group "file_extensions" using the "addtogroup" tag. Also + * note, just because they are defined as const doesn't guarantee that they cannot be + * changed. + * + * @{ */ +extern const wxString AllFilesWildcard; + extern const wxString SchematicSymbolFileExtension; extern const wxString SchematicLibraryFileExtension; extern const wxString SchematicBackupFileExtension; @@ -71,44 +77,78 @@ extern const wxString KiCadFootprintFileExtension; extern const wxString KiCadFootprintLibPathExtension; extern const wxString GedaPcbFootprintLibFileExtension; extern const wxString EagleFootprintLibPathExtension; -extern const wxString ComponentFileExtensionWildcard; -extern const wxString PageLayoutDescrFileWildcard; +extern const wxString ComponentFileExtension; +extern const wxString PageLayoutDescrFileExtension; 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_ diff --git a/kicad/files-io.cpp b/kicad/files-io.cpp index 8ec6ebabd3..f7f2ea23d8 100644 --- a/kicad/files-io.cpp +++ b/kicad/files-io.cpp @@ -34,14 +34,13 @@ #include #include - #include "pgm_kicad.h" +#include "wildcards_and_files_ext.h" #include "kicad.h" #define ZipFileExtension wxT( "zip" ) -#define ZipFileWildcard _( "Zip file (*.zip)|*.zip" ) void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event ) @@ -62,7 +61,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) fn.SetExt( ZipFileExtension ); wxFileDialog zipfiledlg( this, _( "Unzip Project" ), fn.GetPath(), - fn.GetFullName(), ZipFileWildcard, + fn.GetFullName(), ZipFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( zipfiledlg.ShowModal() == wxID_CANCEL ) @@ -144,7 +143,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event ) wxFileDialog dlg( this, _( "Archive Project Files" ), fileName.GetPath(), fileName.GetFullName(), - ZipFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + ZipFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/kicad/import_project.cpp b/kicad/import_project.cpp index f5d56b7939..d702138380 100644 --- a/kicad/import_project.cpp +++ b/kicad/import_project.cpp @@ -69,7 +69,7 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event ) ClearMsg(); wxFileDialog schdlg( this, title, default_dir, wxEmptyString, - EagleFilesWildcard, style ); + EagleFilesWildcard(), style ); if( schdlg.ShowModal() == wxID_CANCEL ) return; @@ -79,16 +79,20 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event ) sch.SetExt( SchematicFileExtension ); + wxFileName pro = sch; - wxString protitle = _( "Kicad Project Destination" ); + pro.SetExt( ProjectFileExtension ); - wxFileDialog prodlg( this, protitle, sch.GetPath(), sch.GetName(), - ProjectFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxString protitle = _( "KiCad Project Destination" ); + + wxFileDialog prodlg( this, protitle, pro.GetPath(), pro.GetFullName(), + ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( prodlg.ShowModal() == wxID_CANCEL ) return; - wxFileName pro( prodlg.GetPath() ); + pro.SetPath( prodlg.GetPath() ); + // Check if the project directory is empty wxDir directory( pro.GetPath() ); diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index d55988a42c..2433baebd1 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -489,17 +489,12 @@ void KICAD_MANAGER_FRAME::OnOpenTextEditor( 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(); wxFileDialog dlg( this, _( "Load File to Edit" ), default_dir, - wxEmptyString, mask, wxFD_OPEN ); + wxEmptyString, wildcard, wxFD_OPEN ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index f1cb7d57a4..dbc41f3280 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -166,7 +166,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) { wxString default_dir = GetMruPath(); 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 ) return; @@ -188,7 +188,7 @@ void KICAD_MANAGER_FRAME::OnNewProject( wxCommandEvent& aEvent ) { wxString default_dir = GetMruPath(); 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 ) return; diff --git a/kicad/tree_project_frame.cpp b/kicad/tree_project_frame.cpp index a3d9992019..07f1d991c3 100644 --- a/kicad/tree_project_frame.cpp +++ b/kicad/tree_project_frame.cpp @@ -100,9 +100,6 @@ static const wxChar* s_allowedExtensionsToList[] = // File extension definitions. const wxChar TextFileExtension[] = wxT( "txt" ); -// File wildcard definitions. -const wxChar TextFileWildcard[] = wxT( "Text files (*.txt)|*.txt" ); - // Gerber file extension wildcard. const wxString GerberFileExtensionWildCard( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" ); @@ -328,68 +325,68 @@ wxString TREE_PROJECT_FRAME::GetFileWildcard( TreeFileType type ) switch( type ) { case TREE_PROJECT: - ext = ProjectFileWildcard; + ext = ProjectFileWildcard(); break; case TREE_SCHEMA: - ext = SchematicFileWildcard; + ext = SchematicFileWildcard(); break; case TREE_LEGACY_PCB: case TREE_SEXP_PCB: - ext = PcbFileWildcard; + ext = PcbFileWildcard(); break; case TREE_GERBER: - ext = GerberFileWildcard; + ext = GerberFileWildcard(); break; case TREE_HTML: - ext = HtmlFileWildcard; + ext = HtmlFileWildcard(); break; case TREE_PDF: - ext = PdfFileWildcard; + ext = PdfFileWildcard(); break; case TREE_TXT: - ext = TextFileWildcard; + ext = TextFileWildcard(); break; case TREE_NET: - ext = NetlistFileWildcard; + ext = NetlistFileWildcard(); break; case TREE_CMP_LINK: - ext = ComponentFileWildcard; + ext = ComponentFileWildcard(); break; case TREE_REPORT: - ext = ReportFileWildcard; + ext = ReportFileWildcard(); break; case TREE_FP_PLACE: - ext = FootprintPlaceFileWildcard; + ext = FootprintPlaceFileWildcard(); break; case TREE_DRILL: - ext = DrillFileWildcard; + ext = DrillFileWildcard(); break; case TREE_SVG: - ext = SVGFileWildcard; + ext = SVGFileWildcard(); break; case TREE_PAGE_LAYOUT_DESCR: - ext = PageLayoutDescrFileWildcard; + ext = PageLayoutDescrFileWildcard(); break; case TREE_FOOTPRINT_FILE: - ext = KiCadFootprintLibFileWildcard; + ext = KiCadFootprintLibFileWildcard(); break; case TREE_SCHEMATIC_LIBFILE: - ext = SchematicLibraryFileWildcard; + ext = SchematicLibraryFileWildcard(); break; default: // Eliminates unnecessary GCC warning. diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp index 9cc6339ed5..1b45bede9d 100644 --- a/pagelayout_editor/files.cpp +++ b/pagelayout_editor/files.cpp @@ -6,6 +6,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 CERN + * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Jean-Pierre Charras, jp.charras at wanadoo.fr * * This program is free software; you can redistribute it and/or @@ -54,17 +56,19 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event ) m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); ::wxSetWorkingDirectory( ::wxPathOnly( filename ) ); - if( LoadPageLayoutDescrFile( filename ) ) - { - wxString msg; - msg.Printf( _("File <%s> loaded"), GetChars( filename ) ); - SetStatusText( msg ); - } - OnNewPageLayout(); + if( LoadPageLayoutDescrFile( filename ) ) + { + wxString msg; + msg.Printf( _( "File <%s> loaded "), GetChars( filename ) ); + SetStatusText( msg ); + } + + OnNewPageLayout(); } } + /* File commands. */ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) { @@ -90,7 +94,6 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) break; } - switch( id ) { case wxID_NEW: @@ -102,17 +105,18 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) case ID_APPEND_DESCR_FILE: { - wxFileDialog openFileDialog(this, _("Append Existing Page Layout File"), - wxEmptyString, - wxEmptyString, PageLayoutDescrFileWildcard, wxFD_OPEN); + wxFileDialog openFileDialog( this, _( "Append Existing Page Layout File" ), + wxEmptyString, wxEmptyString, + PageLayoutDescrFileWildcard(), wxFD_OPEN ); - if (openFileDialog.ShowModal() == wxID_CANCEL) + if( openFileDialog.ShowModal() == wxID_CANCEL ) return; filename = openFileDialog.GetPath(); + if( ! InsertPageLayoutDescrFile( filename ) ) { - msg.Printf( _("Unable to load %s file"), GetChars( filename ) ); + msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) ); wxMessageBox( msg ); } else @@ -120,7 +124,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) GetScreen()->SetModify(); RebuildDesignTree(); m_canvas->Refresh(); - msg.Printf( _("File <%s> inserted"), GetChars( filename ) ); + msg.Printf( _( "File <%s> inserted" ), GetChars( filename ) ); SetStatusText( msg ); } } @@ -128,22 +132,23 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) case wxID_OPEN: { - wxFileDialog openFileDialog(this, _("Open"), wxEmptyString, - wxEmptyString, PageLayoutDescrFileWildcard, wxFD_OPEN); + wxFileDialog openFileDialog( this, _( "Open" ), wxEmptyString, wxEmptyString, + PageLayoutDescrFileWildcard(), wxFD_OPEN ); - if (openFileDialog.ShowModal() == wxID_CANCEL) + if( openFileDialog.ShowModal() == wxID_CANCEL ) return; filename = openFileDialog.GetPath(); + if( ! LoadPageLayoutDescrFile( filename ) ) { - msg.Printf( _("Unable to load %s file"), GetChars( filename ) ); + msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) ); wxMessageBox( msg ); } else { OnNewPageLayout(); - msg.Printf( _("File <%s> loaded"), GetChars( filename ) ); + msg.Printf( _( "File <%s> loaded" ), GetChars( filename ) ); SetStatusText( msg ); } } @@ -152,7 +157,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) case wxID_SAVE: if( !SavePageLayoutDescrFile( filename ) ) { - msg.Printf( _("Unable to write <%s>"), GetChars( filename ) ); + msg.Printf( _( "Unable to write <%s>" ), GetChars( filename ) ); wxMessageBox( msg ); } else @@ -164,10 +169,10 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) case wxID_SAVEAS: { - wxFileDialog openFileDialog(this, _("Save As"), wxEmptyString, - wxEmptyString, PageLayoutDescrFileWildcard, wxFD_SAVE); + wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString, + PageLayoutDescrFileWildcard(), wxFD_SAVE ); - if (openFileDialog.ShowModal() == wxID_CANCEL) + if( openFileDialog.ShowModal() == wxID_CANCEL ) return; filename = openFileDialog.GetPath(); @@ -190,6 +195,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) { msg.Printf( _("File <%s> written"), GetChars( filename ) ); SetStatusText( msg ); + if( GetCurrFileName().IsEmpty() ) 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 ) { if( wxFileExists( aFullFileName ) ) @@ -218,10 +223,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName ) 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 ) { 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 ) { if( ! aFullFileName.IsEmpty() ) diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index f75abd3343..a14b2480fa 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -222,9 +222,9 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event ) wxString filename = GetCurrFileName(); if( filename.IsEmpty() ) - msg = _("Save changes in a new file before closing?"); + msg = _( "Save changes in a new file before closing?" ); else - msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"), + msg.Printf( _( "Save the changes in\n<%s>\nbefore closing?" ), GetChars( filename ) ); int ii = DisplayExitDialog( this, msg ); @@ -243,10 +243,10 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event ) { if( filename.IsEmpty() ) { - wxFileDialog openFileDialog(this, _("Save As"), wxEmptyString, - wxEmptyString, PageLayoutDescrFileWildcard, wxFD_SAVE); + wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString, + PageLayoutDescrFileWildcard(), wxFD_SAVE ); - if (openFileDialog.ShowModal() == wxID_CANCEL) + if(openFileDialog.ShowModal() == wxID_CANCEL ) return; filename = openFileDialog.GetPath(); @@ -254,7 +254,7 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event ) if( !SavePageLayoutDescrFile( filename ) ) { - msg.Printf( _("Unable to create <%s>"), GetChars( filename ) ); + msg.Printf( _( "Unable to create <%s>" ), GetChars( filename ) ); wxMessageBox( msg ); } } @@ -298,11 +298,13 @@ double PL_EDITOR_FRAME::BestZoom() return bestzoom; } -static const wxChar designTreeWidthKey[] = wxT("DesignTreeWidth"); -static const wxChar propertiesFrameWidthKey[] = wxT("PropertiesFrameWidth"); -static const wxChar cornerOriginChoiceKey[] = wxT("CornerOriginChoice"); + +static const wxChar designTreeWidthKey[] = wxT( "DesignTreeWidth" ); +static const wxChar propertiesFrameWidthKey[] = wxT( "PropertiesFrameWidth" ); +static const wxChar cornerOriginChoiceKey[] = wxT( "CornerOriginChoice" ); static const wxChar blackBgColorKey[] = wxT( "BlackBgColor" ); + void PL_EDITOR_FRAME::LoadSettings( wxConfigBase* 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() { wxString title; @@ -347,20 +345,19 @@ void PL_EDITOR_FRAME::UpdateTitleAndInfo() SetTitle( title ); } -/* return the filename of the current layout descr file - */ + const wxString& PL_EDITOR_FRAME::GetCurrFileName() const { return BASE_SCREEN::m_PageLayoutDescrFileName; } -/* Stores the current layout descr file filename - */ + void PL_EDITOR_FRAME::SetCurrFileName( const wxString& aName ) { BASE_SCREEN::m_PageLayoutDescrFileName = aName; } + void PL_EDITOR_FRAME::SetPageSettings( const PAGE_INFO& 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() { PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen(); @@ -509,6 +503,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar() // Display units } + void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer, 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 ); } + void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg ) { @@ -565,6 +561,7 @@ void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg ) UpdateTitleAndInfo(); } + void PL_EDITOR_FRAME::RebuildDesignTree() { const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); @@ -580,27 +577,27 @@ void PL_EDITOR_FRAME::RebuildDesignTree() switch( item->GetType() ) { 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()) ); break; 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()) ); break; 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()) ); break; 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()) ); break; 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()) ); break; } @@ -609,59 +606,59 @@ void PL_EDITOR_FRAME::RebuildDesignTree() 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 * item = NULL; switch( aType ) { - case WORKSHEET_DATAITEM::WS_TEXT: - item = new WORKSHEET_DATAITEM_TEXT( wxT("Text") ); - break; + case WORKSHEET_DATAITEM::WS_TEXT: + item = new WORKSHEET_DATAITEM_TEXT( wxT( "Text") ); + break; - case WORKSHEET_DATAITEM::WS_SEGMENT: - item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_SEGMENT ); - break; + case WORKSHEET_DATAITEM::WS_SEGMENT: + item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_SEGMENT ); + break; - case WORKSHEET_DATAITEM::WS_RECT: - item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_RECT ); - break; + case WORKSHEET_DATAITEM::WS_RECT: + item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_RECT ); + break; - case WORKSHEET_DATAITEM::WS_POLYPOLYGON: - item = new WORKSHEET_DATAITEM_POLYPOLYGON(); - break; + case WORKSHEET_DATAITEM::WS_POLYPOLYGON: + item = new WORKSHEET_DATAITEM_POLYPOLYGON(); + break; - case WORKSHEET_DATAITEM::WS_BITMAP: + case WORKSHEET_DATAITEM::WS_BITMAP: + { + wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString, + _( "Image Files " ) + wxImage::GetImageExtWildcard(), + wxFD_OPEN ); + + if( fileDlg.ShowModal() != wxID_OK ) + return NULL; + + wxString fullFilename = fileDlg.GetPath(); + + if( !wxFileExists( fullFilename ) ) { - wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString, - _( "Image Files " ) + wxImage::GetImageExtWildcard(), - wxFD_OPEN ); - - if( fileDlg.ShowModal() != wxID_OK ) - return NULL; - - wxString fullFilename = fileDlg.GetPath(); - - if( !wxFileExists( fullFilename ) ) - { - wxMessageBox( _( "Couldn't load image from <%s>" ), GetChars( fullFilename ) ); - break; - } - BITMAP_BASE* image = new BITMAP_BASE(); - - if( !image->ReadImageFile( fullFilename ) ) - { - wxMessageBox( _( "Couldn't load image from <%s>" ), - GetChars( fullFilename ) ); - delete image; - break; - } - item = new WORKSHEET_DATAITEM_BITMAP( image ); - } + wxMessageBox( _( "Couldn't load image from <%s>" ), GetChars( fullFilename ) ); break; + } + + BITMAP_BASE* image = new BITMAP_BASE(); + + if( !image->ReadImageFile( fullFilename ) ) + { + wxMessageBox( _( "Couldn't load image from <%s>" ), + GetChars( fullFilename ) ); + delete image; + break; + } + + item = new WORKSHEET_DATAITEM_BITMAP( image ); + } + break; } if( item == NULL ) @@ -674,17 +671,14 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx ) return item; } -/* returns the current selected item, or NULL - */ + WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem() { WORKSHEET_DATAITEM* item = m_treePagelayout->GetPageLayoutSelectedItem(); 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 ) { 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)) == (LOCATE_STARTPOINT|LOCATE_ENDPOINT) ) - text << wxT(" ") << _("(start or end point)"); + text << wxT( " " ) << _( "(start or end point)" ); else { if( (drawitem->m_Flags & LOCATE_STARTPOINT) ) - text << wxT(" ") << _("(start point)"); + text << wxT( " " ) << _( "(start point)" ); if( (drawitem->m_Flags & LOCATE_ENDPOINT) ) - text << wxT(" ") << _("(end point)"); + text << wxT( " " ) << _( "(end point)" ); } if( ! drawitem->GetParent()->m_Info.IsEmpty() ) - text << wxT(" \"") << drawitem->GetParent()->m_Info << wxT("\""); + text << wxT( " \"" ) << drawitem->GetParent()->m_Info << wxT( "\"" ); choices.Add( text ); } + int selection = wxGetSingleChoiceIndex ( wxEmptyString, _( "Selection Clarification" ), choices, this ); @@ -758,7 +753,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) } WORKSHEET_DATAITEM* item = drawitem->GetParent(); - item->ClearFlags(LOCATE_STARTPOINT|LOCATE_ENDPOINT); + item->ClearFlags( LOCATE_STARTPOINT|LOCATE_ENDPOINT ); if( (drawitem->m_Flags & LOCATE_STARTPOINT) ) item->SetFlags( LOCATE_STARTPOINT ); @@ -769,9 +764,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) return item; } -/* Must be called to initialize parameters when a new page layout - * description is loaded - */ + void PL_EDITOR_FRAME::OnNewPageLayout() { GetScreen()->ClearUndoRedoList(); diff --git a/pcb_calculator/regulators_funct.cpp b/pcb_calculator/regulators_funct.cpp index d4bfc6309f..15df02a572 100644 --- a/pcb_calculator/regulators_funct.cpp +++ b/pcb_calculator/regulators_funct.cpp @@ -224,12 +224,12 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event ) wxString fullfilename = GetDataFilename(); wxString wildcard; - wildcard.Printf( _("PCB Calculator data file (*.%s)|*.%s"), + wildcard.Printf( _("PCB Calculator data file (*.%s)|*.%s"), GetChars( DataFileNameExt ), GetChars( DataFileNameExt ) ); wxFileDialog dlg( m_panelRegulators, - _("Select a PCB Calculator data file"), + _("Select PCB Calculator Data File"), wxEmptyString, fullfilename, wildcard, wxFD_OPEN ); diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index 921eaf9d7f..5b76e21293 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -2,7 +2,7 @@ * 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) 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 * modify it under the terms of the GNU General Public License @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -58,8 +59,6 @@ const wxString CsvFileExtension( wxT( "csv" ) ); // BOM file extension -const wxString CsvFileWildcard( _( "Comma separated value files (*.csv)|*.csv" ) ); - class cmp { @@ -94,7 +93,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); wxFileDialog dlg( this, _( "Save Bill of Materials" ), pro_dir, - fn.GetFullName(), CsvFileWildcard, + fn.GetFullName(), CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 5ce52e00dc..a249229023 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -311,7 +311,7 @@ void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event ) wxString prj_path = Prj().GetProjectPath(); wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, - fn.GetFullName(), ReportFileWildcard, + fn.GetFullName(), ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) diff --git a/pcbnew/dialogs/dialog_exchange_modules.cpp b/pcbnew/dialogs/dialog_exchange_modules.cpp index 8c51dcf900..00d53effa6 100644 --- a/pcbnew/dialogs/dialog_exchange_modules.cpp +++ b/pcbnew/dialogs/dialog_exchange_modules.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2013-2016 Wayne Stambaugh + * Copyright (C) 2013 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -37,7 +37,6 @@ #include #include #include -//#include #include #include @@ -427,7 +426,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) // Build the .cmp file name from the board name fn = GetBoard()->GetFileName(); fn.SetExt( ComponentFileExtension ); - wildcard = wxGetTranslation( ComponentFileWildcard ); + wildcard = ComponentFileWildcard(); wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); diff --git a/pcbnew/dialogs/dialog_freeroute_exchange.cpp b/pcbnew/dialogs/dialog_freeroute_exchange.cpp index bdfb2a8160..6bf4dab080 100644 --- a/pcbnew/dialogs/dialog_freeroute_exchange.cpp +++ b/pcbnew/dialogs/dialog_freeroute_exchange.cpp @@ -30,6 +30,8 @@ #include #include #include +#include + #include #include #include @@ -181,11 +183,11 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event ) const wxString DIALOG_FREEROUTE::createDSN_File() { wxFileName fn( m_Parent->GetBoard()->GetFileName() ); - wxString dsn_ext = wxT( "dsn" ); + wxString dsn_ext = SpecctraDsnFileExtension; 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(), dsn_ext, mask, this, wxFD_SAVE, false ); diff --git a/pcbnew/dialogs/dialog_gencad_export_options.cpp b/pcbnew/dialogs/dialog_gencad_export_options.cpp index 684172a7f6..b86afffa1e 100644 --- a/pcbnew/dialogs/dialog_gencad_export_options.cpp +++ b/pcbnew/dialogs/dialog_gencad_export_options.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -146,10 +147,10 @@ void DIALOG_GENCAD_EXPORT_OPTIONS::createOptCheckboxes() void DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse( wxCommandEvent& aEvent ) { wxFileDialog dlg( this, _( "Save GenCAD Board File" ), - wxPathOnly( Prj().GetProjectFullName() ), - m_filePath->GetValue(), - _( "GenCAD 1.4 board files (.cad)|*.cad" ), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxPathOnly( Prj().GetProjectFullName() ), + m_filePath->GetValue(), + GencadFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index e15585301a..6cc40746af 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -455,7 +455,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) defaultPath = wxStandardPaths::Get().GetDocumentsDir(); wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(), - wxGetTranslation( ReportFileWildcard ), wxFD_SAVE ); + ReportFileWildcard(), wxFD_SAVE ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 30bf95a7b0..c6f68fd168 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -6,7 +6,7 @@ /* * 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 * 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 ) ); 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 ) return; @@ -351,15 +351,15 @@ void DIALOG_NETLIST::OnSaveMessagesToFile( wxCommandEvent& aEvent ) if( !m_parent->GetLastNetListRead().IsEmpty() ) { fn = m_parent->GetLastNetListRead(); - fn.SetExt( wxT( "txt" ) ); + fn.SetExt( "txt" ); } else { fn = wxPathOnly( Prj().GetProjectFullName() ); } - wxFileDialog dlg( this, _( "Save contents of message window" ), fn.GetPath(), fn.GetName(), - TextWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxFileDialog dlg( this, _( "Save Contents of Message Window" ), fn.GetPath(), fn.GetFullName(), + TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() != wxID_OK ) return; diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index 25d0293b47..bc08af95ba 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011-2013 Lorenzo Marcantonio - * 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 * modify it under the terms of the GNU General Public License @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -355,8 +356,8 @@ void PCB_EDIT_FRAME::GenD356File( wxCommandEvent& aEvent ) wxString msg, ext, wildcard; FILE* file; - ext = wxT( "d356" ); - wildcard = _( "IPC-D-356 Test Files (.d356)|*.d356" ); + ext = IpcD356FileExtension; + wildcard = IpcD356FileWildcard(); fn.SetExt( ext ); wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 87829e4b13..50e7ea7f0f 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -2,8 +2,8 @@ * 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) 2011-2016 Wayne Stambaugh - * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -96,10 +96,10 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo IO_MGR::PCB_FILE_T pluginType; } loaders[] = { - { PcbFileWildcard, IO_MGR::KICAD_SEXP }, // Current Kicad board files - { LegacyPcbFileWildcard, IO_MGR::LEGACY }, // Old Kicad board files - { EaglePcbFileWildcard, IO_MGR::EAGLE }, // Import board files - { PCadPcbFileWildcard, IO_MGR::PCAD }, // Import board files + { PcbFileWildcard(), IO_MGR::KICAD_SEXP }, // Current Kicad board files + { LegacyPcbFileWildcard(), IO_MGR::LEGACY }, // Old Kicad board files + { EaglePcbFileWildcard(), IO_MGR::EAGLE }, // Import board files + { PCadPcbFileWildcard(), IO_MGR::PCAD }, // Import board files }; wxFileName fileName( *aFileName ); @@ -141,7 +141,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo } wxFileDialog dlg( aParent, - aKicadFilesOnly ? _( "Open Board File" ) : _( "Import Non Kicad Board File" ), + aKicadFilesOnly ? _( "Open Board File" ) : _( "Import Non KiCad Board File" ), path, name, fileFilters, 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 ) { - wxString wildcard = wxGetTranslation( PcbFileWildcard ); + wxString wildcard = PcbFileWildcard(); wxFileName fn = *aFileName; fn.SetExt( KiCadPcbFileExtension ); diff --git a/pcbnew/import_dxf/dialog_dxf_import.cpp b/pcbnew/import_dxf/dialog_dxf_import.cpp index c56e4d63f0..1d8e113efd 100644 --- a/pcbnew/import_dxf/dialog_dxf_import.cpp +++ b/pcbnew/import_dxf/dialog_dxf_import.cpp @@ -7,7 +7,7 @@ * 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) 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 * modify it under the terms of the GNU General Public License @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -231,7 +232,7 @@ void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event ) wxFileDialog dlg( m_parent, _( "Open File" ), path, filename, - "DXF Files (*.dxf)|*.dxf", + DxfFileWildcard(), wxFD_OPEN|wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() != wxID_OK ) diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 897651be37..6b28c9073f 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -91,8 +91,6 @@ static const wxString INFO_LEGACY_LIB_WARN_DELETE( "and update your footprint lib table\n"\ "before deleting a footprint" ) ); -static const wxString ModLegacyExportFileWildcard( _( "Legacy foot print export files (*.emp)|*.emp" ) ); - #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. wxString wildCard; - wildCard << wxGetTranslation( KiCadFootprintLibFileWildcard ) << wxChar( '|' ) - << wxGetTranslation( ModLegacyExportFileWildcard ) << wxChar( '|' ) - << wxGetTranslation( GedaPcbFootprintLibFileWildcard ); + wildCard << KiCadFootprintLibFileWildcard() << wxChar( '|' ) + << ModLegacyExportFileWildcard() << wxChar( '|' ) + << GedaPcbFootprintLibFileWildcard(); wxFileDialog dlg( aParent, FMT_IMPORT_MODULE, aLastPath, wxEmptyString, wildCard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); @@ -350,7 +348,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule ) fn.SetName( aModule->GetFPID().GetLibItemName() ); - wxString wildcard = wxGetTranslation( KiCadFootprintLibFileWildcard ); + wxString wildcard = KiCadFootprintLibFileWildcard(); fn.SetExt( KiCadFootprintFileExtension ); diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index e820937a2f..d08cd7a985 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -3,8 +3,8 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012-2016 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012 Wayne Stambaugh + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -76,7 +76,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, m_show_layer_manager_tools ? - _("Hide &Layers Manager" ) : _("Show &Layers Manager" )); + _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" )); break; case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR: @@ -215,7 +215,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) fn.SetExt( ProjectFileExtension ); wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(), - fn.GetFullName(), ProjectFileWildcard, + fn.GetFullName(), ProjectFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -292,7 +292,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave ) { wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(), fn.GetFullName(), - ProjectFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR ); + ProjectFileWildcard(), wxFD_SAVE | wxFD_CHANGE_DIR ); if( dlg.ShowModal() == wxID_CANCEL ) return; diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 668e014bc5..357aabb4bb 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include @@ -77,8 +78,8 @@ void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event ) wxString path; wxString name; wxString ext; - wxString dsn_ext = wxT( ".dsn" ); - wxString mask = wxT( "*" ) + dsn_ext; + wxString dsn_ext = SpecctraDsnFileExtension; + wxString mask = SpecctraDsnFileWildcard(); wxFileName::SplitPath( fullFileName, &path, &name, &ext );