Fix opening boards with deprecated features.

This commit is contained in:
Alex 2023-05-20 07:00:09 +03:00
parent 4c59365867
commit 9d452a6097
5 changed files with 12 additions and 13 deletions

View File

@ -399,7 +399,7 @@ BOARD* CLIPBOARD_IO::Load( const wxString& aFileName, BOARD* aAppendToMe,
}; };
STRING_LINE_READER reader( result, wxT( "clipboard" ) ); STRING_LINE_READER reader( result, wxT( "clipboard" ) );
PCB_PARSER parser( &reader, aAppendToMe, &queryUser ); PCB_PARSER parser( &reader, aAppendToMe, queryUser );
init( aProperties ); init( aProperties );

View File

@ -990,8 +990,8 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
undefinedLayerNames, undefinedLayerNames,
destLayerName ); destLayerName );
if( !(*m_queryUserCallback)( _( "Undefined Layers Warning" ), wxICON_WARNING, msg, if( !m_queryUserCallback( _( "Undefined Layers Warning" ), wxICON_WARNING, msg,
_( "Rescue" ) ) ) _( "Rescue" ) ) )
{ {
THROW_IO_ERROR( wxT( "CANCEL" ) ); THROW_IO_ERROR( wxT( "CANCEL" ) );
} }
@ -2216,7 +2216,7 @@ void PCB_PARSER::parseSetup()
{ {
// Thick outline fill mode no longer supported. Make sure user is OK with // Thick outline fill mode no longer supported. Make sure user is OK with
// converting fills. // converting fills.
if( !(*m_queryUserCallback)( if( !m_queryUserCallback(
_( "Legacy Zone Warning" ), wxICON_WARNING, _( "Legacy Zone Warning" ), wxICON_WARNING,
_( "The legacy zone fill strategy is no longer supported.\n" _( "The legacy zone fill strategy is no longer supported.\n"
"Convert zones to smoothed polygon fills?" ), "Convert zones to smoothed polygon fills?" ),
@ -5171,7 +5171,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{ {
if( Pgm().IsGUI() && m_queryUserCallback ) if( Pgm().IsGUI() && m_queryUserCallback )
{ {
if( !(*m_queryUserCallback)( if( !m_queryUserCallback(
_( "Legacy Zone Warning" ), wxICON_WARNING, _( "Legacy Zone Warning" ), wxICON_WARNING,
_( "The legacy zone fill strategy is no longer supported.\n" _( "The legacy zone fill strategy is no longer supported.\n"
"Convert zones to smoothed polygon fills?" ), "Convert zones to smoothed polygon fills?" ),
@ -5220,7 +5220,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{ {
if( Pgm().IsGUI() && m_queryUserCallback ) if( Pgm().IsGUI() && m_queryUserCallback )
{ {
if( !(*m_queryUserCallback)( if( !m_queryUserCallback(
_( "Legacy Zone Warning" ), wxICON_WARNING, _( "Legacy Zone Warning" ), wxICON_WARNING,
_( "The segment zone fill mode is no longer supported.\n" _( "The segment zone fill mode is no longer supported.\n"
"Convert zones to smoothed polygon fills?" ), "Convert zones to smoothed polygon fills?" ),

View File

@ -74,7 +74,7 @@ class PCB_PARSER : public PCB_LEXER
{ {
public: public:
PCB_PARSER( LINE_READER* aReader, BOARD* aAppendToMe, PCB_PARSER( LINE_READER* aReader, BOARD* aAppendToMe,
std::function<bool( wxString, int, wxString, wxString )>* aQueryUserCallback, std::function<bool( wxString, int, wxString, wxString )> aQueryUserCallback,
PROGRESS_REPORTER* aProgressReporter = nullptr, unsigned aLineCount = 0 ) : PROGRESS_REPORTER* aProgressReporter = nullptr, unsigned aLineCount = 0 ) :
PCB_LEXER( aReader ), PCB_LEXER( aReader ),
m_board( aAppendToMe ), m_board( aAppendToMe ),
@ -368,7 +368,7 @@ private:
std::vector<GROUP_INFO> m_groupInfos; std::vector<GROUP_INFO> m_groupInfos;
std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )>* m_queryUserCallback; std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )> m_queryUserCallback;
}; };

View File

@ -274,7 +274,7 @@ void PCB_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const STRING_UT
if( sanityResult != wxEmptyString && m_queryUserCallback ) if( sanityResult != wxEmptyString && m_queryUserCallback )
{ {
if( !(*m_queryUserCallback)( if( !m_queryUserCallback(
_( "Internal Group Data Error" ), wxICON_ERROR, _( "Internal Group Data Error" ), wxICON_ERROR,
wxString::Format( _( "Please report this bug. Error validating group " wxString::Format( _( "Please report this bug. Error validating group "
"structure: %s\n\nSave anyway?" ), sanityResult ), "structure: %s\n\nSave anyway?" ), sanityResult ),
@ -2224,8 +2224,7 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
PCB_PLUGIN::PCB_PLUGIN( int aControlFlags ) : PCB_PLUGIN::PCB_PLUGIN( int aControlFlags ) :
m_cache( nullptr ), m_cache( nullptr ),
m_ctl( aControlFlags ), m_ctl( aControlFlags ),
m_mapping( new NETINFO_MAPPING() ), m_mapping( new NETINFO_MAPPING() )
m_queryUserCallback( nullptr )
{ {
init( nullptr ); init( nullptr );
m_out = &m_sf; m_out = &m_sf;

View File

@ -277,7 +277,7 @@ public:
void SetQueryUserCallback( std::function<bool( wxString aTitle, int aIcon, wxString aMessage, void SetQueryUserCallback( std::function<bool( wxString aTitle, int aIcon, wxString aMessage,
wxString aOKButtonTitle )> aCallback ) override wxString aOKButtonTitle )> aCallback ) override
{ {
m_queryUserCallback = &aCallback; m_queryUserCallback = aCallback;
} }
void Save( const wxString& aFileName, BOARD* aBoard, void Save( const wxString& aFileName, BOARD* aBoard,
@ -426,7 +426,7 @@ protected:
NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty net codes NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty net codes
///< are stored with consecutive integers as net codes ///< are stored with consecutive integers as net codes
std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )>* m_queryUserCallback; std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )> m_queryUserCallback;
}; };
#endif // PCB_PLUGIN_H #endif // PCB_PLUGIN_H