Make drawing sheet loading slightly smarter

This commit is contained in:
Marek Roszko 2021-05-01 14:11:16 -04:00
parent f6f2284851
commit d4bb1cbc63
3 changed files with 21 additions and 8 deletions

View File

@ -806,13 +806,20 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
shortFileName = fileName;
}
SetWksFileName( shortFileName );
DS_DATA_MODEL* ws = new DS_DATA_MODEL;
if( m_drawingSheet == NULL )
m_drawingSheet = new DS_DATA_MODEL;
if( ws->LoadDrawingSheet( fileName ) )
{
if( m_drawingSheet != nullptr )
{
delete m_drawingSheet;
}
m_drawingSheet->LoadDrawingSheet( fileName );
m_drawingSheet = ws;
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
SetWksFileName( shortFileName );
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
}

View File

@ -94,7 +94,10 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
Prj().GetProjectPath() );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename );
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
{
ShowInfoBarError( _( "Error loading drawing sheet" ), true );
}
return true;
}

View File

@ -77,7 +77,10 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
Prj().GetProjectPath() );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename );
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
{
ShowInfoBarError( _( "Error loading drawing sheet" ), true );
}
// Load render settings that aren't stored in PCB_DISPLAY_OPTIONS