From 580a1a6aa0d277af90549470c1317d524c1ac400 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 23 Jul 2014 12:28:48 +0200 Subject: [PATCH] ModEdit: fix some issues due to the fact legacy footprint libraries cannot handle 32 copper layers, and are therefore no more editable: * in file/library save as..., remove option to save a lib under the legacy format (which is not possible and creates an error message) * if the current loaded lib is a legacy lib, when the user try to save or delete a footprint, displays a message which explains what the user should do. * add a suitable dialog to select/create a .pretty folder library (a file dialog or a dir dialog coming from wxWidgets is not friendly usable.) --- pcbnew/CMakeLists.txt | 2 + pcbnew/dialogs/dialog_select_pretty_lib.cpp | 46 ++ pcbnew/dialogs/dialog_select_pretty_lib.h | 52 ++ .../dialogs/dialog_select_pretty_lib_base.cpp | 66 ++ .../dialogs/dialog_select_pretty_lib_base.fbp | 565 ++++++++++++++++++ .../dialogs/dialog_select_pretty_lib_base.h | 58 ++ pcbnew/librairi.cpp | 85 ++- 7 files changed, 843 insertions(+), 31 deletions(-) create mode 100644 pcbnew/dialogs/dialog_select_pretty_lib.cpp create mode 100644 pcbnew/dialogs/dialog_select_pretty_lib.h create mode 100644 pcbnew/dialogs/dialog_select_pretty_lib_base.cpp create mode 100644 pcbnew/dialogs/dialog_select_pretty_lib_base.fbp create mode 100644 pcbnew/dialogs/dialog_select_pretty_lib_base.h diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 875b75076e..ab7f49f4de 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -118,6 +118,8 @@ set( PCBNEW_DIALOGS dialogs/dialog_mask_clearance_base.cpp dialogs/dialog_SVG_print.cpp dialogs/dialog_SVG_print_base.cpp + dialogs/dialog_select_pretty_lib.cpp + dialogs/dialog_select_pretty_lib_base.cpp dialogs/dialog_set_grid.cpp dialogs/dialog_set_grid_base.cpp dialogs/dialog_target_properties_base.cpp diff --git a/pcbnew/dialogs/dialog_select_pretty_lib.cpp b/pcbnew/dialogs/dialog_select_pretty_lib.cpp new file mode 100644 index 0000000000..c080855c27 --- /dev/null +++ b/pcbnew/dialogs/dialog_select_pretty_lib.cpp @@ -0,0 +1,46 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors. + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file dialog_select_pretty_lib.cpp + * @brief A dialog to select/create a .pretty folder which is a + * footprint library. + * footprints are .kicad_mod files inside this folder + */ + +#include + + +DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB( wxWindow* parent ) + :DIALOG_SELECT_PRETTY_LIB_BASE( parent ) +{ + m_dirCtrl->SetPath( wxGetCwd() ); +} + + +void DIALOG_SELECT_PRETTY_LIB::OnSelectFolder( wxTreeEvent& event ) +{ + m_libName->SetValue( m_dirCtrl->GetPath() ); +} diff --git a/pcbnew/dialogs/dialog_select_pretty_lib.h b/pcbnew/dialogs/dialog_select_pretty_lib.h new file mode 100644 index 0000000000..a1f1c59f32 --- /dev/null +++ b/pcbnew/dialogs/dialog_select_pretty_lib.h @@ -0,0 +1,52 @@ +#ifndef __DIALOG_SELECT_PRETTY_LIB_H__ +#define __DIALOG_SELECT_PRETTY_LIB_H__ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors. + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file dialog_select_pretty_lib.h + * @brief A dialog to select/create a .pretty folder which is a + * footprint library. + * footprints are .kicad_mod files inside this folder + */ + +#include + + +class DIALOG_SELECT_PRETTY_LIB : public DIALOG_SELECT_PRETTY_LIB_BASE +{ +public: + DIALOG_SELECT_PRETTY_LIB( wxWindow* parent ); + ~DIALOG_SELECT_PRETTY_LIB() {}; + + const wxString GetPath() { return m_libName->GetValue(); } + +private: + virtual void OnSelectFolder( wxTreeEvent& event ); +}; + + +#endif //__DIALOG_SELECT_PRETTY_LIB_BASE_H__ diff --git a/pcbnew/dialogs/dialog_select_pretty_lib_base.cpp b/pcbnew/dialogs/dialog_select_pretty_lib_base.cpp new file mode 100644 index 0000000000..58dd0f65b6 --- /dev/null +++ b/pcbnew/dialogs/dialog_select_pretty_lib_base.cpp @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Nov 6 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_select_pretty_lib_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_SELECT_PRETTY_LIB_BASE::DIALOG_SELECT_PRETTY_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxSize( 400,300 ), wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_staticText = new wxStaticText( this, wxID_ANY, _("The footprint library is a folder with a name ending by .pretty\nFootprints are .kicad_mod files inside this folder."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText->Wrap( -1 ); + m_staticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizerMain->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_dirCtrl = new wxGenericDirCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxDIRCTRL_DIR_ONLY|wxSUNKEN_BORDER, wxEmptyString, 0 ); + + m_dirCtrl->ShowHidden( false ); + bSizerMain->Add( m_dirCtrl, 1, wxEXPAND | wxALL, 5 ); + + m_staticTextDirname = new wxStaticText( this, wxID_ANY, _("Library (.pretty folder)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDirname->Wrap( -1 ); + bSizerMain->Add( m_staticTextDirname, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_libName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMain->Add( m_libName, 0, wxALL|wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + m_dirCtrl->Connect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_SELECT_PRETTY_LIB_BASE::OnSelectFolder ), NULL, this ); + m_dirCtrl->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( DIALOG_SELECT_PRETTY_LIB_BASE::OnSelectFolder ), NULL, this ); +} + +DIALOG_SELECT_PRETTY_LIB_BASE::~DIALOG_SELECT_PRETTY_LIB_BASE() +{ + // Disconnect Events + m_dirCtrl->Disconnect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_SELECT_PRETTY_LIB_BASE::OnSelectFolder ), NULL, this ); + m_dirCtrl->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( DIALOG_SELECT_PRETTY_LIB_BASE::OnSelectFolder ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_select_pretty_lib_base.fbp b/pcbnew/dialogs/dialog_select_pretty_lib_base.fbp new file mode 100644 index 0000000000..bac0e1981b --- /dev/null +++ b/pcbnew/dialogs/dialog_select_pretty_lib_base.fbp @@ -0,0 +1,565 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_select_pretty_lib_base + 1000 + none + 1 + dialog_select_pretty_lib_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + 400,300 + DIALOG_SELECT_PRETTY_LIB_BASE + + 400,300 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Select Footprint Library Folder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + The footprint library is a folder with a name ending by .pretty Footprints are .kicad_mod files inside this folder. + + 0 + + + 0 + + 1 + m_staticText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_dirCtrl + 1 + + + protected + 1 + + Resizable + 1 + 0 + + wxDIRCTRL_3D_INTERNAL|wxDIRCTRL_DIR_ONLY + + 0 + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnSelectFolder + + + + + + + + + OnSelectFolder + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Library (.pretty folder) + + 0 + + + 0 + + 1 + m_staticTextDirname + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_libName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_select_pretty_lib_base.h b/pcbnew/dialogs/dialog_select_pretty_lib_base.h new file mode 100644 index 0000000000..b1d7eb2aaf --- /dev/null +++ b/pcbnew/dialogs/dialog_select_pretty_lib_base.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Nov 6 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_SELECT_PRETTY_LIB_BASE_H__ +#define __DIALOG_SELECT_PRETTY_LIB_BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_SELECT_PRETTY_LIB_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_SELECT_PRETTY_LIB_BASE : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticText; + wxGenericDirCtrl* m_dirCtrl; + wxStaticText* m_staticTextDirname; + wxTextCtrl* m_libName; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSelectFolder( wxTreeEvent& event ) { event.Skip(); } + + + public: + + DIALOG_SELECT_PRETTY_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Footprint Library Folder"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,300 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_SELECT_PRETTY_LIB_BASE(); + +}; + +#endif //__DIALOG_SELECT_PRETTY_LIB_BASE_H__ diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 502b8c2fce..efe27218e4 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -52,11 +52,13 @@ #include #include +#include + // unique, "file local" translations: #define FMT_OK_OVERWRITE _( "Library '%s' exists, OK to replace ?" ) -#define FMT_CREATE_LIB _( "Create New Library" ) +#define FMT_CREATE_LIB _( "Create New Library Folder (the .pretty Library is the folder)" ) #define FMT_OK_DELETE _( "OK to delete module %s in library '%s'" ) #define FMT_IMPORT_MODULE _( "Import Footprint" ) #define FMT_FILE_NOT_FOUND _( "File '%s' not found" ) @@ -74,22 +76,27 @@ #define FMT_MOD_CREATE _( "New Footprint" ) #define FMT_NO_MODULES _( "No footprints to archive!" ) -#define FMT_LIBRARY _( "Library" ) // window title #define FMT_MOD_EXISTS _( "Footprint %s already exists in library '%s'" ) #define FMT_NO_REF_ABORTED _( "No footprint name defined." ) #define FMT_SELECT_LIB _( "Select Library" ) +static const wxString INFO_LEGACY_LIB_WARN_EDIT( + _( "Writing/modifying legacy libraries (.mod files) is not allowed\n"\ + "Please save the current library to the new .pretty format\n"\ + "and update your footprint lib table\n"\ + "to save your footprint (a .kicad_mod file) in the .pretty library folder" ) ); -static const wxString ModExportFileWildcard( _( "KiCad foot print export files (*.emp)|*.emp" ) ); +static const wxString INFO_LEGACY_LIB_WARN_DELETE( + _( "Modifying legacy libraries (.mod files) is not allowed\n"\ + "Please save the current library under the new .pretty format\n"\ + "before deleting a footprint" ) ); + +static const wxString ModLegacyExportFileWildcard( _( "Legacy foot print export files (*.emp)|*.emp" ) ); static const wxString ModImportFileWildcard( _( "GPcb foot print files (*)|*" ) ); -#define BACKUP_EXT wxT( "bak" ) -#define FILETMP_EXT wxT( "$$$" ) #define EXPORT_IMPORT_LASTPATH_KEY wxT( "import_last_path" ) -const wxString ModExportFileExtension( wxT( "emp" ) ); - MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() { @@ -107,7 +114,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() wxString wildCard; wildCard << wxGetTranslation( KiCadFootprintLibFileWildcard ) << wxChar( '|' ) - << wxGetTranslation( ModExportFileWildcard ) << wxChar( '|' ) + << wxGetTranslation( ModLegacyExportFileWildcard ) << wxChar( '|' ) << wxGetTranslation( ModImportFileWildcard ) << wxChar( '|' ) << wxGetTranslation( GedaPcbFootprintLibFileWildcard ); @@ -349,13 +356,19 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule ) DisplayInfoMessage( this, msg ); } - bool FOOTPRINT_EDIT_FRAME::SaveCurrentModule( const wxString* aLibPath ) { wxString libPath = aLibPath ? *aLibPath : getLibPath(); IO_MGR::PCB_FILE_T piType = IO_MGR::GuessPluginTypeFromLibPath( libPath ); + // Legacy libraries are readable, but writing legacy format is not allowed + if( piType == IO_MGR::LEGACY ) + { + DisplayInfoMessage( this, INFO_LEGACY_LIB_WARN_EDIT ); + return false; + } + try { PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) ); @@ -370,7 +383,6 @@ bool FOOTPRINT_EDIT_FRAME::SaveCurrentModule( const wxString* aLibPath ) return true; } - wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary() { wxFileName fn; @@ -383,19 +395,14 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary() fn.SetPath( path ); } - wxString wildcard; + // Kicad cannot write legacy format libraries, only .pretty new format + // because the legacy format cannot handle current features. + // The lib is actually a directory + wxString wildcard = wxGetTranslation( KiCadFootprintLibPathWildcard ); -// wildcard << wxGetTranslation( LegacyFootprintLibPathWildcard ) << wxChar( '|' ) -// << wxGetTranslation( KiCadFootprintLibPathWildcard ); - wildcard << wxGetTranslation( KiCadFootprintLibPathWildcard ) << wxChar( '|' ) - << wxGetTranslation( LegacyFootprintLibPathWildcard ); - - // prompt user for libPath and PLUGIN (library) type - wxFileDialog dlg( this, FMT_CREATE_LIB, fn.GetPath(), wxEmptyString, - wildcard, wxFD_SAVE - // | wxFD_OVERWRITE_PROMPT overwrite is tested below - // after file extension has been added. - ); + // prompt user for libPath +// wxDirDialog dlg( this, FMT_CREATE_LIB, fn.GetPath(), wxDD_DEFAULT_STYLE ); + DIALOG_SELECT_PRETTY_LIB dlg( this ); if( dlg.ShowModal() == wxID_CANCEL ) return wxEmptyString; @@ -408,17 +415,10 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary() } // wildcard's filter index has legacy in position 0. - IO_MGR::PCB_FILE_T piType = ( dlg.GetFilterIndex() == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; + IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD; // wxFileDialog does not supply nor enforce the file extension, add it here. - if( piType == IO_MGR::LEGACY ) - { - fn.SetExt( LegacyFootprintLibPathExtension ); - } - else - { - fn.SetExt( KiCadFootprintLibPathExtension ); - } + fn.SetExt( KiCadFootprintLibPathExtension ); wxString libPath = fn.GetFullPath(); @@ -474,6 +474,17 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary() { wxString nickname = GetCurrentLib(); + // Legacy libraries are readable, but modifying legacy format is not allowed + // So prompt the user if he try to delete a footprint from a legacy lib + wxString libfullname = Prj().PcbFootprintLibs()->FindRow(nickname)->GetFullURI(); + IO_MGR::PCB_FILE_T piType = IO_MGR::GuessPluginTypeFromLibPath( libfullname ); + + if( piType == IO_MGR::LEGACY ) + { + DisplayInfoMessage( this, INFO_LEGACY_LIB_WARN_DELETE ); + return false; + } + if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) ) { wxString msg = wxString::Format( @@ -591,6 +602,18 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary, SetMsgPanel( aModule ); + + // Legacy libraries are readable, but modifying legacy format is not allowed + // So prompt the user if he try to add/replace a footprint in a legacy lib + wxString libfullname = Prj().PcbFootprintLibs()->FindRow( aLibrary )->GetFullURI(); + IO_MGR::PCB_FILE_T piType = IO_MGR::GuessPluginTypeFromLibPath( libfullname ); + + if( piType == IO_MGR::LEGACY ) + { + DisplayInfoMessage( this, INFO_LEGACY_LIB_WARN_EDIT ); + return false; + } + // Ask what to use as the footprint name in the library wxString footprintName = aModule->GetFPID().GetFootprintName();