Final symbol library table changes before merge.

Remove all symbol libraries from the project file after remapping to
prevent symbols that should be loaded from the cache being loaded from
a library further up the search order.  Save the project file to clear
all of the libraries so they never get reloaded again.

Remove the symbol library management dialog and menu entries.

Rename the symbol library table dialog menu entry.

Remove all symbol libraries from default project file to prevent clashes
with the cache library.

Fix illegal symbol naming in Eagle plugin.
This commit is contained in:
Wayne Stambaugh 2017-10-31 20:57:57 -04:00
parent 8d995f48de
commit 8fd89c881d
17 changed files with 40 additions and 2492 deletions

View File

@ -40,8 +40,6 @@ set( EESCHEMA_DLGS
dialogs/dialog_edit_libentry_fields_in_lib.cpp
dialogs/dialog_edit_libentry_fields_in_lib_base.cpp
dialogs/dialog_edit_one_field.cpp
dialogs/dialog_eeschema_config.cpp
dialogs/dialog_eeschema_config_fbp.cpp
dialogs/dialog_eeschema_options_base.cpp
dialogs/dialog_eeschema_options.cpp
dialogs/dialog_erc.cpp

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -574,6 +574,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
LibNamesAndPaths( aProject, false, NULL, &lib_names );
// Post symbol library table, this should be empty. Only the cache library should get loaded.
if( !lib_names.empty() )
{
wxProgressDialog lib_dialog( _( "Loading Symbol Libraries" ),

View File

@ -1,489 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2006-2017 KiCad Developers, see AUTHORS.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_eeschema_config.cpp
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <kiway.h>
#include <confirm.h>
#include <gestfich.h>
#include <schframe.h>
#include <invoke_sch_dialog.h>
#include <kiface_i.h>
#include <general.h>
#include <netlist.h>
#include <libeditframe.h>
#include <viewlib_frame.h>
#include <wildcards_and_files_ext.h>
#include <wx/tokenzr.h>
#include <dialog_eeschema_config_fbp.h>
#include <eeschema_config.h>
class SCH_EDIT_FRAME;
class EDA_DRAW_FRAME;
class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP
{
public:
DIALOG_EESCHEMA_CONFIG( wxWindow* aParent,
wxString* aCallersProjectSpecificLibPaths, wxArrayString* aCallersLibNames );
private:
wxConfigBase* m_config;
wxString* m_callers_project_specific_lib_paths;
wxArrayString* m_callers_lib_names;
bool m_lib_list_changed;
bool m_lib_path_changed;
//------ event handlers, overiding the fbp handlers --------------
void OnCloseWindow( wxCloseEvent& event ) override;
/* Remove a library to the library list.
* The real list (m_Parent->m_ComponentLibFiles) is not changed, so the change can be canceled
*/
void OnRemoveLibClick( wxCommandEvent& event ) override;
/* Insert or add a library to the library list:
* The new library is put in list before (insert button) the selection,
* or added (add button) to end of list
* The real list (m_Parent->m_ComponentLibFiles) is not changed, so the change
* can be canceled
*/
void OnAddOrInsertLibClick( wxCommandEvent& event ) override;
void OnAddOrInsertPath( wxCommandEvent& event ) override;
void OnOkClick( wxCommandEvent& event ) override;
void OnCancelClick( wxCommandEvent& event ) override;
void OnRemoveUserPath( wxCommandEvent& event ) override;
void OnButtonUpClick( wxCommandEvent& event ) override;
void OnButtonDownClick( wxCommandEvent& event ) override;
};
DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( wxWindow* aParent,
wxString* aCallersProjectSpecificLibPaths, wxArrayString* aCallersLibNames ) :
DIALOG_EESCHEMA_CONFIG_FBP( aParent ),
m_callers_project_specific_lib_paths( aCallersProjectSpecificLibPaths ),
m_callers_lib_names( aCallersLibNames ),
m_lib_list_changed( false ),
m_lib_path_changed( false )
{
m_ListLibr->InsertItems( *aCallersLibNames, 0 );
// Load user libs paths:
wxArrayString paths;
SEARCH_STACK::Split( &paths, *aCallersProjectSpecificLibPaths );
for( unsigned i=0; i<paths.GetCount(); ++i )
{
wxString path = paths[i];
if( wxFileName::DirExists( Prj().AbsolutePath( path ) ) )
m_listUserPaths->Append( path );
}
// Display actual library paths which come in part from KIFACE::KifaceSearch()
// along with aCallersProjectSpecificLibPaths at the front.
SEARCH_STACK* libpaths = Prj().SchSearchS();
DBG( libpaths->Show( __func__ ); )
for( unsigned ii = 0; ii < libpaths->GetCount(); ii++ )
{
m_DefaultLibraryPathslistBox->Append( (*libpaths)[ii] );
}
// select the first path after the current project's path
if( libpaths->GetCount() > 1 )
m_DefaultLibraryPathslistBox->Select( 1 );
// Load setting for cache rescue
m_config = Kiface().KifaceSettings();
bool rescueNeverShow = false;
m_config->Read( RescueNeverShowEntry, &rescueNeverShow, false );
m_cbRescue->SetValue( !rescueNeverShow );
wxString msg = wxString::Format( _(
"Project '%s'" ),
GetChars( Prj().GetProjectFullName() )
);
SetTitle( msg );
if( GetSizer() )
GetSizer()->SetSizeHints( this );
m_sdbSizer1OK->SetDefault();
}
void DIALOG_EESCHEMA_CONFIG::OnButtonUpClick( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListLibr->GetSelections( selections );
if ( selections.GetCount() <= 0 ) // No selection.
return;
if( selections[0] == 0 ) // The first lib is selected. cannot move up it
return;
wxArrayString libnames = m_ListLibr->GetStrings();
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
std::swap( libnames[jj], libnames[jj-1]);
}
m_ListLibr->Set(libnames);
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListLibr->SetSelection(jj-1);
}
m_lib_list_changed = true;
}
void DIALOG_EESCHEMA_CONFIG::OnButtonDownClick( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListLibr->GetSelections(selections);
if ( selections.GetCount() <= 0 ) // No selection.
return;
// The last lib is selected. cannot move down it
if( selections.Last() == (int)(m_ListLibr->GetCount()-1) )
return;
wxArrayString libnames = m_ListLibr->GetStrings();
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
int jj = selections[ii];
std::swap( libnames[jj], libnames[jj+1]);
}
m_ListLibr->Set( libnames );
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListLibr->SetSelection(jj+1);
}
m_lib_list_changed = true;
}
void DIALOG_EESCHEMA_CONFIG::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
{
// Give caller the changed paths
if( m_lib_path_changed )
{
wxString paths;
for( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii++ )
{
if( ii > 0 )
paths += wxT( ';' );
paths += m_listUserPaths->GetString( ii );
}
*m_callers_project_specific_lib_paths = paths;
}
// Update caller's lib_names if changed.
if( m_lib_list_changed )
{
wxArrayString list;
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ )
list.Add( m_ListLibr->GetString( ii ) );
// Recreate lib list
*m_callers_lib_names = list;
}
m_config->Write( RescueNeverShowEntry, ! m_cbRescue->GetValue() );
EndModal( wxID_OK );
}
void DIALOG_EESCHEMA_CONFIG::OnCloseWindow( wxCloseEvent& event )
{
EndModal( wxID_CANCEL );
}
void DIALOG_EESCHEMA_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListLibr->GetSelections( selections );
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
m_ListLibr->Delete( selections[ii] );
m_lib_list_changed = true;
}
// Select next item after deleted in m_ListLibr
if( m_ListLibr->GetCount() > 0 && selections.GetCount() > 0 )
{
int pos = selections[selections.GetCount()-1];
if( pos >= (int)m_ListLibr->GetCount() )
pos = m_ListLibr->GetCount() - 1;
m_ListLibr->SetSelection( pos );
}
}
void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
{
int ii;
wxString libfilename;
wxArrayInt selections;
PROJECT& prj = Prj();
m_ListLibr->GetSelections( selections );
ii = selections.GetCount();
if( ii > 0 )
ii = selections[0];
else
ii = 0;
wxString selection = m_DefaultLibraryPathslistBox->GetStringSelection();
wxString libpath = Prj().AbsolutePath( selection );
if( !libpath )
{
libpath = prj.GetRString( PROJECT::SCH_LIB_PATH );
}
wxFileDialog filesDialog( this, _( "Library files:" ), libpath,
wxEmptyString, SchematicLibraryFileWildcard,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( filesDialog.ShowModal() != wxID_OK )
return;
wxArrayString filenames;
filesDialog.GetPaths( filenames );
wxFileName fn;
// Build libs paths, to find later a relative path:
wxArrayString paths;
for( unsigned ll=0; ll < m_DefaultLibraryPathslistBox->GetCount(); ++ll )
paths.Add( m_DefaultLibraryPathslistBox->GetString( ll ) );
for( unsigned ll=0; ll < m_listUserPaths->GetCount(); ++ll )
paths.Add( m_listUserPaths->GetString( ll ) );
for( unsigned jj = 0; jj < filenames.GetCount(); jj++ )
{
fn = filenames[jj];
if( jj == 0 )
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
// Extension is not stored, so remove extension:
fn.SetExt( wxEmptyString );
// Try to use relative path:
for( unsigned ll = 0; ll < paths.GetCount(); ll++ )
{
wxFileName relfn = fn;
if( relfn.MakeRelativeTo( paths[ll] ) && relfn.GetPath()[0] != '.' )
{
fn = relfn;
break;
}
}
libfilename = fn.GetFullPath();
// Add or insert new library name, if not already in list
if( m_ListLibr->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
{
m_lib_list_changed = true;
if( event.GetId() == ID_ADD_LIB )
m_ListLibr->Append( libfilename );
else
m_ListLibr->Insert( libfilename, ii++ );
}
else
{
wxString msg = wxString::Format( _(
"'%s' : library already in use" ),
GetChars( libfilename )
);
DisplayError( this, msg );
}
}
}
void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
{
PROJECT& prj = Prj();
wxString abs_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
wxString path;
bool select = EDA_PATH_SELECTOR( _( "Default Path for Libraries" ),
abs_path, wxDD_DEFAULT_STYLE,
this, wxDefaultPosition );
if( !select )
return;
if( !wxFileName::DirExists( abs_path ) ) // Should not occur
return;
// Add or insert path if not already in list
if( m_listUserPaths->FindString( abs_path ) == wxNOT_FOUND )
{
int ipos = m_listUserPaths->GetCount();
if( event.GetId() == wxID_INSERT_PATH )
{
if( ipos )
ipos--;
int jj = m_listUserPaths->GetSelection();
if( jj >= 0 )
ipos = jj;
}
// Ask the user if this is a relative path
int diag = wxMessageBox( _( "Use a relative path?" ), _( "Path type" ),
wxYES_NO | wxICON_QUESTION, this );
if( diag == wxYES )
{
// Make it relative
wxFileName fn = abs_path;
fn.MakeRelativeTo( wxPathOnly( Prj().GetProjectFullName() ) );
path = fn.GetPathWithSep() + fn.GetFullName();
}
else
path = abs_path;
m_listUserPaths->Insert( path, ipos );
m_lib_path_changed = true;
m_DefaultLibraryPathslistBox->InsertItems( 1, &path, ipos+1 );
}
else
{
DisplayError( this, _("Path already in use") );
}
prj.SetRString( PROJECT::SCH_LIB_PATH, abs_path );
}
static void remove_from_listbox( wxListBox* aListBox, const wxString& aText )
{
wxArrayString a;
for( int i=0, cnt = aListBox->GetCount(); i<cnt; ++i )
{
wxString item = aListBox->GetString( i );
if( item != aText )
a.Add( item );
}
aListBox->Clear();
aListBox->InsertItems( a, 0 );
}
void DIALOG_EESCHEMA_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
{
int ii = m_listUserPaths->GetSelection();
if( ii < 0 )
ii = m_listUserPaths->GetCount()-1;
if( ii >= 0 )
{
wxString sel = m_listUserPaths->GetStringSelection();
remove_from_listbox( m_DefaultLibraryPathslistBox, sel );
m_listUserPaths->Delete( ii );
m_lib_path_changed = true;
}
}
bool InvokeEeschemaConfig( wxWindow* aParent,
wxString* aCallersProjectSpecificLibPaths, wxArrayString* aCallersLibNames )
{
DIALOG_EESCHEMA_CONFIG dlg( aParent,
aCallersProjectSpecificLibPaths, aCallersLibNames );
int ret = dlg.ShowModal();
return wxID_OK == ret;
}

View File

@ -1,175 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_eeschema_config_fbp.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxVERTICAL );
m_staticTextLibsList = new wxStaticText( this, wxID_ANY, _("Component library files"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLibsList->Wrap( -1 );
bSizerUpper->Add( m_staticTextLibsList, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerLibsChoice;
bSizerLibsChoice = new wxBoxSizer( wxHORIZONTAL );
m_ListLibr = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Eeschema.\nThe order of this list is important:\nEeschema searchs for a given component using this list order priority.") );
m_ListLibr->SetMinSize( wxSize( 400,250 ) );
bSizerLibsChoice->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonAddLib = new wxButton( this, ID_ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonAddLib->SetToolTip( _("Add a new library after the selected library, and load it") );
bRightSizer->Add( m_buttonAddLib, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
m_buttonIns = new wxButton( this, wxID_ANY, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonIns->SetToolTip( _("Add a new library before the selected library, and load it") );
bRightSizer->Add( m_buttonIns, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
m_buttonRemoveLib = new wxButton( this, ID_REMOVE_LIB, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRemoveLib->SetToolTip( _("Unload the selected library") );
bRightSizer->Add( m_buttonRemoveLib, 0, wxALL|wxEXPAND, 5 );
m_buttonUp = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonUp, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonDown = new wxButton( this, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonDown, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerLibsChoice->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizerUpper->Add( bSizerLibsChoice, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerUpper, 2, wxEXPAND, 5 );
wxBoxSizer* bSizerMiddle;
bSizerMiddle = new wxBoxSizer( wxVERTICAL );
m_staticTextPaths = new wxStaticText( this, wxID_ANY, _("User defined search path"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPaths->Wrap( -1 );
bSizerMiddle->Add( m_staticTextPaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerPathsChoice;
bSizerPathsChoice = new wxBoxSizer( wxHORIZONTAL );
m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is higher than default KiCad paths.") );
m_listUserPaths->SetMinSize( wxSize( 400,90 ) );
bSizerPathsChoice->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bUserPathsButtonsSizer;
bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonAddPath = new wxButton( this, ID_LIB_PATH_SEL, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonAddPath, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
m_buttonInsPath = new wxButton( this, wxID_INSERT_PATH, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonInsPath, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
m_buttonRemovePath = new wxButton( this, wxID_REMOVE_PATH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxALL|wxEXPAND, 5 );
bSizerPathsChoice->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizerMiddle->Add( bSizerPathsChoice, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerMiddle, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerLower;
bSizerLower = new wxBoxSizer( wxVERTICAL );
m_staticTextPathlist = new wxStaticText( this, wxID_ANY, _("Current search path list"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPathlist->Wrap( -1 );
bSizerLower->Add( m_staticTextPathlist, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB );
m_DefaultLibraryPathslistBox->SetToolTip( _("System and user paths used to search and load library files and component doc files.\nSorted by decreasing priority order.") );
bSizerLower->Add( m_DefaultLibraryPathslistBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bSizerLower, 1, wxEXPAND, 5 );
m_cbRescue = new wxCheckBox( this, wxID_ANY, _("Check for cache/library conflicts when loading schematic"), wxDefaultPosition, wxDefaultSize, 0 );
bMainSizer->Add( m_cbRescue, 0, wxALL, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) );
m_ListLibr->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnFilesListClick ), NULL, this );
m_ListLibr->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnFilesListClick ), NULL, this );
m_buttonAddLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonIns->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnButtonUpClick ), NULL, this );
m_buttonDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnButtonDownClick ), NULL, this );
m_buttonAddPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
m_buttonInsPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
m_buttonRemovePath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this );
}
DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) );
m_ListLibr->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnFilesListClick ), NULL, this );
m_ListLibr->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnFilesListClick ), NULL, this );
m_buttonAddLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonIns->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnButtonUpClick ), NULL, this );
m_buttonDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnButtonDownClick ), NULL, this );
m_buttonAddPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
m_buttonInsPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
m_buttonRemovePath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EESCHEMA_CONFIG_FBP_H__
#define __DIALOG_EESCHEMA_CONFIG_FBP_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/listbox.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EESCHEMA_CONFIG_FBP
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EESCHEMA_CONFIG_FBP : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_ADD_LIB = 1000,
ID_REMOVE_LIB,
ID_LIB_PATH_SEL,
wxID_INSERT_PATH,
wxID_REMOVE_PATH
};
wxStaticText* m_staticTextLibsList;
wxListBox* m_ListLibr;
wxButton* m_buttonAddLib;
wxButton* m_buttonIns;
wxButton* m_buttonRemoveLib;
wxButton* m_buttonUp;
wxButton* m_buttonDown;
wxStaticText* m_staticTextPaths;
wxListBox* m_listUserPaths;
wxButton* m_buttonAddPath;
wxButton* m_buttonInsPath;
wxButton* m_buttonRemovePath;
wxStaticText* m_staticTextPathlist;
wxListBox* m_DefaultLibraryPathslistBox;
wxCheckBox* m_cbRescue;
wxStaticLine* m_staticline3;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnFilesListClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddOrInsertLibClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveLibClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonUpClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonDownClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddOrInsertPath( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveUserPath( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_CONFIG_FBP();
};
#endif //__DIALOG_EESCHEMA_CONFIG_FBP_H__

View File

@ -35,12 +35,13 @@
#include <sch_sheet.h>
#include <sch_component.h>
#include <class_sch_screen.h>
#include <schframe.h>
#include <symbol_lib_table.h>
#include <dialog_symbol_remap.h>
DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP( wxWindow* aParent ) :
DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP( SCH_EDIT_FRAME* aParent ) :
DIALOG_SYMBOL_REMAP_BASE( aParent )
{
}
@ -62,6 +63,17 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
}
remapSymbolsToLibTable( m_messagePanel->Reporter() );
// Remove all of the libraries from the legacy library list.
PART_LIBS* libs = Prj().SchLibs();
libs->clear();
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
Prj().SchLibs();
// Update the project file so the library list is cleared.
SCH_EDIT_FRAME* parent = static_cast< SCH_EDIT_FRAME* >( GetParent() );
wxCHECK_RET( parent, "Parent window was not and SCH_EDIT_FRAME" );
parent->SaveProjectSettings( false );
}

View File

@ -37,15 +37,13 @@ class REPORTER;
class DIALOG_SYMBOL_REMAP : public DIALOG_SYMBOL_REMAP_BASE
{
public:
DIALOG_SYMBOL_REMAP( wxWindow* aParent );
DIALOG_SYMBOL_REMAP( SCH_EDIT_FRAME* aParent );
void OnRemapSymbols( wxCommandEvent& aEvent ) override;
private:
/**
* Function getLibsNotInGlobalSymbolLibTable
*
* adds libraries found in the legacy library list to \a aLibs that are not found in
* Add libraries found in the legacy library list to \a aLibs that are not found in
* the global symbol library table.
*
* This function is used to create a project symbol library table when converting

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.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
@ -127,46 +127,6 @@ COLOR4D GetInvisibleItemColor()
}
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{
// Identical to SCH_EDIT_FRAME::InstallConfigFrame()
PROJECT* prj = &Prj();
wxArrayString lib_names;
wxString lib_paths;
try
{
PART_LIBS::LibNamesAndPaths( prj, false, &lib_paths, &lib_names );
}
catch( const IO_ERROR& DBG( ioe ) )
{
DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
return;
}
if( InvokeEeschemaConfig( this, &lib_paths, &lib_names ) )
{
// save the [changed] settings.
PART_LIBS::LibNamesAndPaths( prj, true, &lib_paths, &lib_names );
// Force a reload of the PART_LIBS
prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL );
prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
// Update the schematic symbol library links.
SCH_SCREENS schematic;
schematic.UpdateSymbolLinks();
// There may be no parent window so use KIWAY message to refresh the schematic editor
// in case any symbols have changed.
Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_REFRESH, std::string( "" ), this );
}
}
void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
@ -197,53 +157,6 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{
// Identical to LIB_EDIT_FRAME::InstallConfigFrame()
PROJECT* prj = &Prj();
wxArrayString lib_names;
wxString lib_paths;
try
{
PART_LIBS::LibNamesAndPaths( prj, false, &lib_paths, &lib_names );
}
catch( const IO_ERROR& DBG( ioe ) )
{
DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
return;
}
if( InvokeEeschemaConfig( this, &lib_paths, &lib_names ) )
{
// save the [changed] settings.
PART_LIBS::LibNamesAndPaths( prj, true, &lib_paths, &lib_names );
#if defined(DEBUG)
printf( "%s: lib_names:\n", __func__ );
for( unsigned i=0; i<lib_names.size(); ++i )
{
printf( " %s\n", TO_UTF8( lib_names[i] ) );
}
printf( "%s: lib_paths:'%s'\n", __func__, TO_UTF8( lib_paths ) );
#endif
// Force a reload of the PART_LIBS
prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL );
prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
// Update the schematic symbol library links.
SCH_SCREENS schematic;
schematic.UpdateSymbolLinks();
GetCanvas()->Refresh();
}
}
void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
@ -274,9 +187,11 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
else
{
// Read library list and library path list
Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH, GetProjectFileParametersList() );
Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH,
GetProjectFileParametersList() );
// Read schematic editor setup
Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDITOR, GetProjectFileParametersList() );
Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDITOR,
GetProjectFileParametersList() );
}
}
break;

View File

@ -3,7 +3,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2013-2017 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
@ -98,8 +98,4 @@ int InvokeDialogUpdateFields( SCH_EDIT_FRAME* aCaller,
#define NET_PLUGIN_CHANGE 1
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller );
bool InvokeEeschemaConfig( wxWindow* aParent,
wxString* aCallersProjectSpecificLibPaths, wxArrayString* aCallersLibNames );
#endif // INVOKE_SCH_DIALOG_H_

View File

@ -135,7 +135,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions )
EVT_MENU( ID_CONFIG_REQ, LIB_EDIT_FRAME::InstallConfigFrame )
// Multiple item selection context menu commands.
EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, LIB_EDIT_FRAME::OnSelectItem )

View File

@ -621,16 +621,10 @@ void prepareImportExportMenu( wxMenu* aParentMenu )
static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
{
// Library
AddMenuItem( aParentMenu,
ID_CONFIG_REQ,
_( "Component &Libraries" ),
_( "Configure component libraries and paths" ),
KiBitmap( library_xpm ) );
AddMenuItem( aParentMenu,
ID_EDIT_SYM_LIB_TABLE,
_( "Manage Symbol Library" ),
_( "Manage the symbol library" ),
_( "Manage Symbol Libraries" ),
_( "Edit the global and project symbol library tables." ),
KiBitmap( library_table_xpm ) );
// Options (Preferences on WXMAC)

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -233,16 +233,10 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
wxMenu* preferencesMenu = new wxMenu;
// Library list
AddMenuItem( preferencesMenu,
ID_CONFIG_REQ,
_( "Component &Libraries" ),
_( "Configure component libraries and paths" ),
KiBitmap( library_xpm ) );
AddMenuItem( preferencesMenu,
ID_EDIT_SYM_LIB_TABLE,
_( "Manage Symbol Library" ),
_( "Edit the symbol library table." ),
_( "Manage Symbol Libraries" ),
_( "Edit the global and project symbol library tables." ),
KiBitmap( library_table_xpm ) );
// Default values and options

View File

@ -299,6 +299,16 @@ void SCH_BASE_FRAME::OnEditSymbolLibTable( wxCommandEvent& aEvent )
}
}
LIB_EDIT_FRAME* editor = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
if( this == editor )
{
// There may be no parent window so use KIWAY message to refresh the schematic editor
// in case any symbols have changed.
Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_REFRESH, std::string( "" ), this );
}
LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
if( viewer )

View File

@ -1059,6 +1059,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
std::string kisymbolname = symbolname;
std::replace( kisymbolname.begin(), kisymbolname.end(), ':', '_' );
std::replace( kisymbolname.begin(), kisymbolname.end(), '/', '_' );
std::replace( kisymbolname.begin(), kisymbolname.end(), '"', '_' );
LIB_ALIAS* alias = m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname,
m_properties.get() );
@ -1266,6 +1267,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
string name = kpart->GetName().ToStdString();
std::replace( name.begin(), name.end(), ':', '_' );
std::replace( name.begin(), name.end(), '/', '_' );
std::replace( name.begin(), name.end(), '"', '_' );
kpart->SetName( name );
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_PART( *kpart.get() ),
m_properties.get() );

View File

@ -240,7 +240,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_POPUP_SCH_DUPLICATE_ITEM, SCH_EDIT_FRAME::OnCopySchematicItemRequest )
EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame )
EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,

View File

@ -31,32 +31,3 @@ NetIExt=net
version=1
LibDir=
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=microcontrollers
LibName13=dsp
LibName14=microchip
LibName15=analog_switches
LibName16=motorola
LibName17=texas
LibName18=intel
LibName19=audio
LibName20=interface
LibName21=digital-audio
LibName22=philips
LibName23=display
LibName24=cypress
LibName25=siliconi
LibName26=opto
LibName27=atmel
LibName28=contrib
LibName29=valves