Prefer infobar to logged warnings/messages.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18242
This commit is contained in:
Jeff Young 2024-06-24 16:23:38 +01:00
parent b227bae2c6
commit 92c8ddfddb
1 changed files with 7 additions and 20 deletions

View File

@ -603,8 +603,7 @@ void DRAWING_SHEET_PARSER::readPngdata( DS_DATA_ITEM_BITMAP * aItem )
wxString msg; wxString msg;
STRING_LINE_READER str_reader( tmp, wxT("Png kicad_wks data") ); STRING_LINE_READER str_reader( tmp, wxT("Png kicad_wks data") );
if( ! aItem->m_ImageBitmap->LoadLegacyData( str_reader, msg ) ) aItem->m_ImageBitmap->LoadLegacyData( str_reader, msg );
wxLogMessage(msg);
} }
@ -616,7 +615,7 @@ void DRAWING_SHEET_PARSER::readOption( DS_DATA_ITEM * aItem )
{ {
case T_page1only: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break; case T_page1only: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
case T_notonpage1: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break; case T_notonpage1: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
default: Unexpected( CurText() ); break; default: Unexpected( CurText() ); break;
} }
} }
} }
@ -627,7 +626,9 @@ void DRAWING_SHEET_PARSER::parseGraphic( DS_DATA_ITEM * aItem )
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() ) for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{ {
if( token == T_LEFT ) if( token == T_LEFT )
{
token = NextTok(); token = NextTok();
}
else else
{ {
// If another token than T_LEFT is read here, this is an error // If another token than T_LEFT is read here, this is an error
@ -951,13 +952,9 @@ void DS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const w
{ {
parser.Parse( this ); parser.Parse( this );
} }
catch( const IO_ERROR& ioe ) catch( ... )
{ {
wxLogMessage( ioe.What() ); // best efforts
}
catch( const std::bad_alloc& )
{
wxLogMessage( wxS( "Memory exhaustion reading drawing sheet" ) );
} }
} }
@ -976,7 +973,6 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append
if( !wxFileExists( fullFileName ) ) if( !wxFileExists( fullFileName ) )
{ {
wxLogMessage( _( "Drawing sheet '%s' not found." ), fullFileName );
SetDefaultLayout(); SetDefaultLayout();
return false; return false;
} }
@ -986,8 +982,6 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append
if( ! wksFile.IsOpened() ) if( ! wksFile.IsOpened() )
{ {
wxLogMessage( _( "Drawing sheet '%s' could not be opened." ), fullFileName );
if( !Append ) if( !Append )
SetDefaultLayout(); SetDefaultLayout();
@ -999,7 +993,6 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append
if( wksFile.Read( buffer.get(), filelen ) != filelen ) if( wksFile.Read( buffer.get(), filelen ) != filelen )
{ {
wxLogMessage( _( "Drawing sheet '%s' was not fully read." ), fullFileName.GetData() );
return false; return false;
} }
else else
@ -1015,14 +1008,8 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append
{ {
parser.Parse( this ); parser.Parse( this );
} }
catch( const IO_ERROR& ioe ) catch( ... )
{ {
wxLogMessage( ioe.What() );
return false;
}
catch( const std::bad_alloc& )
{
wxLogMessage( wxS( "Memory exhaustion reading drawing sheet" ) );
return false; return false;
} }
} }