From 8193a898f35c5eb51712949f978a26b66d04f567 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 13 Sep 2015 16:23:01 +0200 Subject: [PATCH] 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) --- pcbnew/dialogs/dialog_export_vrml.cpp | 3 ++- pcbnew/modedit.cpp | 7 +++++-- pcbnew/moduleframe.cpp | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pcbnew/dialogs/dialog_export_vrml.cpp b/pcbnew/dialogs/dialog_export_vrml.cpp index 286a5e7125..7d7f7280a6 100644 --- a/pcbnew/dialogs/dialog_export_vrml.cpp +++ b/pcbnew/dialogs/dialog_export_vrml.cpp @@ -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; } diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index be1fc3c73d..99b1c923d3 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -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: diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 9e2e9d1733..dbd4a9cce0 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -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 )