Fix opening boards with deprecated features.

(cherry picked from commit 9d452a6097)
This commit is contained in:
Alex 2023-05-20 05:45:50 +03:00
parent 09febce4ce
commit b0ecb5b62d
5 changed files with 9 additions and 10 deletions

View File

@ -434,7 +434,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

@ -5678,7 +5678,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{ {
if( m_showLegacy5ZoneWarning && m_queryUserCallback ) if( m_showLegacy5ZoneWarning && 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?" ),
@ -5718,7 +5718,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{ {
if( m_showLegacySegmentZoneWarning && m_queryUserCallback ) if( m_showLegacySegmentZoneWarning && 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 ),
@ -369,7 +369,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

@ -277,7 +277,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 ),
@ -2349,8 +2349,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,
@ -428,7 +428,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