Footprint Editor: make call to DXF importer not possible if a footprint does not exist, to avoid crash. ( It fixes an issue on Unity, where the file menu to call the DXF importer is not always disabled when no footprint loaded)

This commit is contained in:
jean-pierre charras 2015-09-13 16:23:01 +02:00
parent ca1ae0d4a0
commit 8193a898f3
3 changed files with 8 additions and 3 deletions

View File

@ -242,7 +242,8 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
usePlainPCB, modelPath.GetPath(),
aXRef, aYRef ) )
{
wxString msg = _( "Unable to create file " ) + fullFilename;
wxString msg;
msg.Printf( _( "Unable to create file '%s'" ), GetChars( fullFilename ) );
wxMessageBox( msg );
return;
}

View File

@ -839,8 +839,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_GEN_IMPORT_DXF_FILE:
InvokeDXFDialogModuleImport( this, GetBoard()->m_Modules );
m_canvas->Refresh();
if( GetBoard()->m_Modules )
{
InvokeDXFDialogModuleImport( this, GetBoard()->m_Modules );
m_canvas->Refresh();
}
break;
default:

View File

@ -171,6 +171,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_BASE_FRAME::SwitchCanvas )
EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_BASE_FRAME::SwitchCanvas )
// UI update events.
EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected )
EVT_UPDATE_UI( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib )
EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )