Loading pcbnew/files.cpp +17 −14 Original line number Diff line number Diff line Loading @@ -415,13 +415,22 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF wildcard << wxGetTranslation( PcbFileWildcard ) << wxChar( '|' ) << wxGetTranslation( LegacyPcbFileWildcard ); wxFileDialog dlg( this, _( "Save Board File" ), wxEmptyString, GetBoard()->GetFileName(), wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFileDialog dlg( this, _( "Save Board File As" ), wxEmptyString, GetBoard()->GetFileName(), wildcard, wxFD_SAVE /* wxFileDialog is not equipped to handle multiple wildcards and wxFD_OVERWRITE_PROMPT both together. | wxFD_OVERWRITE_PROMPT */ ); if( dlg.ShowModal() != wxID_OK ) return false; pluginType = ( dlg.GetFilterIndex() == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; int filterNdx = dlg.GetFilterIndex(); pluginType = ( filterNdx == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; // Note: on Linux wxFileDialog is not reliable for noticing a changed filename. pcbFileName = dlg.GetPath(); Loading Loading @@ -492,21 +501,15 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF try { PROPERTIES props; PLUGIN* plugin = IO_MGR::PluginFind( pluginType ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); if( plugin == NULL ) /* if( (PLUGIN*)pi == NULL ) THROW_IO_ERROR( wxString::Format( _( "cannot find file plug in for file format '%s'" ), GetChars( pcbFileName.GetExt() ) ) ); */ wxString header = wxString::Format( wxT( "PCBNEW-BOARD Version %d\n# Created by Pcbnew%s\n\n" ), LEGACY_BOARD_FILE_VERSION, GetBuildVersion().GetData() ); props["header"] = header; plugin->Save( pcbFileName.GetFullPath(), GetBoard(), &props ); pi->Save( pcbFileName.GetFullPath(), GetBoard(), NULL ); } catch( IO_ERROR ioe ) { Loading pcbnew/legacy_plugin.cpp +15 −3 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> #include <wx/ffile.h> #include <legacy_plugin.h> // implement this here Loading @@ -83,8 +84,7 @@ #include <drawtxt.h> #include <convert_to_biu.h> #include <trigo.h> #include <wx/ffile.h> #include <build_version.h> typedef LEGACY_PLUGIN::BIU BIU; Loading Loading @@ -2823,14 +2823,26 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* m_fp = fp; // member function accessibility #if 0 // old school, property "header" was not used by any other plugin. if( m_props ) { // @todo move the header production into this source file. wxString header = (*m_props)["header"]; // save a file header, if caller provided one (with trailing \n hopefully). fprintf( m_fp, "%s", TO_UTF8( header ) ); } #else wxString header = wxString::Format( wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s\n\n" ), LEGACY_BOARD_FILE_VERSION, DateAndTime().GetData(), GetBuildVersion().GetData() ); // save a file header, if caller provided one (with trailing \n hopefully). fprintf( m_fp, "%s", TO_UTF8( header ) ); #endif SaveBOARD( aBoard ); } Loading Loading
pcbnew/files.cpp +17 −14 Original line number Diff line number Diff line Loading @@ -415,13 +415,22 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF wildcard << wxGetTranslation( PcbFileWildcard ) << wxChar( '|' ) << wxGetTranslation( LegacyPcbFileWildcard ); wxFileDialog dlg( this, _( "Save Board File" ), wxEmptyString, GetBoard()->GetFileName(), wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFileDialog dlg( this, _( "Save Board File As" ), wxEmptyString, GetBoard()->GetFileName(), wildcard, wxFD_SAVE /* wxFileDialog is not equipped to handle multiple wildcards and wxFD_OVERWRITE_PROMPT both together. | wxFD_OVERWRITE_PROMPT */ ); if( dlg.ShowModal() != wxID_OK ) return false; pluginType = ( dlg.GetFilterIndex() == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; int filterNdx = dlg.GetFilterIndex(); pluginType = ( filterNdx == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; // Note: on Linux wxFileDialog is not reliable for noticing a changed filename. pcbFileName = dlg.GetPath(); Loading Loading @@ -492,21 +501,15 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF try { PROPERTIES props; PLUGIN* plugin = IO_MGR::PluginFind( pluginType ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); if( plugin == NULL ) /* if( (PLUGIN*)pi == NULL ) THROW_IO_ERROR( wxString::Format( _( "cannot find file plug in for file format '%s'" ), GetChars( pcbFileName.GetExt() ) ) ); */ wxString header = wxString::Format( wxT( "PCBNEW-BOARD Version %d\n# Created by Pcbnew%s\n\n" ), LEGACY_BOARD_FILE_VERSION, GetBuildVersion().GetData() ); props["header"] = header; plugin->Save( pcbFileName.GetFullPath(), GetBoard(), &props ); pi->Save( pcbFileName.GetFullPath(), GetBoard(), NULL ); } catch( IO_ERROR ioe ) { Loading
pcbnew/legacy_plugin.cpp +15 −3 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> #include <wx/ffile.h> #include <legacy_plugin.h> // implement this here Loading @@ -83,8 +84,7 @@ #include <drawtxt.h> #include <convert_to_biu.h> #include <trigo.h> #include <wx/ffile.h> #include <build_version.h> typedef LEGACY_PLUGIN::BIU BIU; Loading Loading @@ -2823,14 +2823,26 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* m_fp = fp; // member function accessibility #if 0 // old school, property "header" was not used by any other plugin. if( m_props ) { // @todo move the header production into this source file. wxString header = (*m_props)["header"]; // save a file header, if caller provided one (with trailing \n hopefully). fprintf( m_fp, "%s", TO_UTF8( header ) ); } #else wxString header = wxString::Format( wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s\n\n" ), LEGACY_BOARD_FILE_VERSION, DateAndTime().GetData(), GetBuildVersion().GetData() ); // save a file header, if caller provided one (with trailing \n hopefully). fprintf( m_fp, "%s", TO_UTF8( header ) ); #endif SaveBOARD( aBoard ); } Loading