Revise symbol rescuer to support symbol library table.
Refactor rescue objects so that they can support derivation. Factor out legacy rescuer code to perform legacy project rescues. Create new symbol library table rescuer for rescuing symbol library table based projects. Perform the correct rescue type on project load. Add symbol library table remapping support to the tools menu for run on demand as applicable. Add flag to SCH_SCREENS::UpdateSymbolLinks() to allow forcing the symbol link updates when the library modification hash has not changed.
This commit is contained in:
parent
36f6d4a1f4
commit
c1f7c1778a
|
@ -444,9 +444,6 @@ LIB_ALIAS* PART_LIBS::FindLibraryAlias( const LIB_ID& aLibId, const wxString& aL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* searches all libraries in the list for an entry, using a case insensitive comparison.
|
|
||||||
* Used to find an entry, when the normal (case sensitive) search fails.
|
|
||||||
*/
|
|
||||||
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates,
|
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates,
|
||||||
const wxString& aEntryName,
|
const wxString& aEntryName,
|
||||||
const wxString& aLibraryName )
|
const wxString& aLibraryName )
|
||||||
|
|
|
@ -196,15 +196,18 @@ public:
|
||||||
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
|
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function CheckComponentsToPartsLink
|
* Initialize or reinitialize the weak reference to the #LIB_PART for each #SCH_COMPONENT
|
||||||
* initializes or reinitializes the weak reference
|
* found in m_drawList.
|
||||||
* to the LIB_PART for each SCH_COMPONENT found in m_drawList.
|
*
|
||||||
* It must be called from:
|
* It must be called from:
|
||||||
* - Draw function
|
* - Draw function
|
||||||
* - when loading a schematic file
|
* - when loading a schematic file
|
||||||
* - before creating a netlist (in case a library is modified)
|
* - before creating a netlist (in case a library is modified)
|
||||||
|
* - whenever a symbol library is modified
|
||||||
|
*
|
||||||
|
* @param aForce true forces a refresh even if the library modification has hasn't changed.
|
||||||
*/
|
*/
|
||||||
void CheckComponentsToPartsLinks();
|
void UpdateSymbolLinks( bool aForce = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Draw
|
* Function Draw
|
||||||
|
@ -588,11 +591,12 @@ public:
|
||||||
* found in the full schematic.
|
* found in the full schematic.
|
||||||
*
|
*
|
||||||
* It must be called from:
|
* It must be called from:
|
||||||
* - Draw function
|
* - draw functions
|
||||||
* - when loading a schematic file
|
* - when loading a schematic file
|
||||||
* - before creating a netlist (in case a library is modified)
|
* - before creating a netlist (in case a library is modified)
|
||||||
|
* - whenever any of the libraries are modified.
|
||||||
*/
|
*/
|
||||||
void UpdateSymbolLinks();
|
void UpdateSymbolLinks( bool aForce = false );
|
||||||
|
|
||||||
void TestDanglingEnds();
|
void TestDanglingEnds();
|
||||||
|
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFields( wxCommandEvent& event )
|
||||||
SCH_COMPONENT copy( *m_cmp );
|
SCH_COMPONENT copy( *m_cmp );
|
||||||
std::list<SCH_COMPONENT*> components;
|
std::list<SCH_COMPONENT*> components;
|
||||||
components.push_back( © );
|
components.push_back( © );
|
||||||
InvokeDialogUpdateFields( m_parent, components, false );
|
InvokeDialogUpdateFields( GetParent(), components, false );
|
||||||
|
|
||||||
// Copy fields from the modified component copy to the dialog buffer
|
// Copy fields from the modified component copy to the dialog buffer
|
||||||
m_FieldsBuf.clear();
|
m_FieldsBuf.clear();
|
||||||
|
|
|
@ -38,9 +38,10 @@ class DIALOG_RESCUE_EACH: public DIALOG_RESCUE_EACH_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
|
||||||
* This dialog asks the user which rescuable, cached parts he wants to rescue.
|
* This dialog asks the user which rescuable, cached parts he wants to rescue.
|
||||||
|
*
|
||||||
* Any rejects will be pruned from aCandidates.
|
* Any rejects will be pruned from aCandidates.
|
||||||
|
*
|
||||||
* @param aParent - the SCH_EDIT_FRAME calling this
|
* @param aParent - the SCH_EDIT_FRAME calling this
|
||||||
* @param aRescuer - the active RESCUER instance
|
* @param aRescuer - the active RESCUER instance
|
||||||
* @param aAskShowAgain - if true, a "Never Show Again" button will be included
|
* @param aAskShowAgain - if true, a "Never Show Again" button will be included
|
||||||
|
@ -70,7 +71,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescuer,
|
DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescuer,
|
||||||
bool aAskShowAgain )
|
bool aAskShowAgain )
|
||||||
: DIALOG_RESCUE_EACH_BASE( aParent ),
|
: DIALOG_RESCUE_EACH_BASE( aParent ),
|
||||||
m_Parent( aParent ),
|
m_Parent( aParent ),
|
||||||
m_Rescuer( &aRescuer ),
|
m_Rescuer( &aRescuer ),
|
||||||
|
@ -81,7 +82,7 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescu
|
||||||
|
|
||||||
// Set the info message, customized to include the proper suffix.
|
// Set the info message, customized to include the proper suffix.
|
||||||
wxString info_message =
|
wxString info_message =
|
||||||
_( "It looks like this project was made using older schematic component libraries.\n"
|
_( "It looks like this project was made using older schematic symbol libraries.\n"
|
||||||
"Some parts may need to be relinked to a different symbol name, and some symbols\n"
|
"Some parts may need to be relinked to a different symbol name, and some symbols\n"
|
||||||
"may need to be \"rescued\" (cloned and renamed) into a new library.\n"
|
"may need to be \"rescued\" (cloned and renamed) into a new library.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -157,6 +158,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
|
||||||
|
|
||||||
wxVector<wxVariant> data;
|
wxVector<wxVariant> data;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for( SCH_COMPONENT* each_component : *m_Rescuer->GetComponents() )
|
for( SCH_COMPONENT* each_component : *m_Rescuer->GetComponents() )
|
||||||
{
|
{
|
||||||
if( each_component->GetLibId().Format() != UTF8( selected_part.GetRequestedName() ) )
|
if( each_component->GetLibId().Format() != UTF8( selected_part.GetRequestedName() ) )
|
||||||
|
@ -290,9 +292,9 @@ void DIALOG_RESCUE_EACH::OnNeverShowClick( wxCommandEvent& aEvent )
|
||||||
wxMessageDialog dlg( m_Parent,
|
wxMessageDialog dlg( m_Parent,
|
||||||
_( "Stop showing this tool?\n"
|
_( "Stop showing this tool?\n"
|
||||||
"No changes will be made.\n\n"
|
"No changes will be made.\n\n"
|
||||||
"This setting can be changed from the \"Component Libraries\" dialog,\n"
|
"This setting can be changed from the \"Symbol Libraries\" dialog,\n"
|
||||||
"and the tool can be activated manually from the \"Tools\" menu." ),
|
"and the tool can be activated manually from the \"Tools\" menu." ),
|
||||||
_( "Rescue Components" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
|
_( "Rescue Symbolss" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
|
||||||
int resp = dlg.ShowModal ();
|
int resp = dlg.ShowModal ();
|
||||||
|
|
||||||
if( resp == wxID_YES )
|
if( resp == wxID_YES )
|
||||||
|
|
|
@ -237,7 +237,7 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
|
||||||
}
|
}
|
||||||
|
|
||||||
aReporter.Report( _( "Symbol library table mapping complete!" ), REPORTER::RPT_INFO );
|
aReporter.Report( _( "Symbol library table mapping complete!" ), REPORTER::RPT_INFO );
|
||||||
schematic.UpdateSymbolLinks();
|
schematic.UpdateSymbolLinks( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2008-2017 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2008-2017 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -65,6 +65,7 @@ enum id_eeschema_frm
|
||||||
/* Schematic editor main menubar IDs. */
|
/* Schematic editor main menubar IDs. */
|
||||||
ID_RESCUE_CACHED,
|
ID_RESCUE_CACHED,
|
||||||
ID_EDIT_SYM_LIB_TABLE,
|
ID_EDIT_SYM_LIB_TABLE,
|
||||||
|
ID_REMAP_SYMBOLS,
|
||||||
|
|
||||||
/* Schematic editor horizontal toolbar IDs */
|
/* Schematic editor horizontal toolbar IDs */
|
||||||
ID_HIERARCHY,
|
ID_HIERARCHY,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013-2017 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2013 CERN (www.cern.ch)
|
* Copyright (C) 2013 CERN (www.cern.ch)
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
|
@ -329,22 +329,16 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
|
|
||||||
UpdateFileHistory( fullFileName );
|
UpdateFileHistory( fullFileName );
|
||||||
|
|
||||||
// Check to see whether some old library parts need to be rescued
|
|
||||||
// Only do this if RescueNeverShow was not set.
|
|
||||||
wxConfigBase *config = Kiface().KifaceSettings();
|
|
||||||
bool rescueNeverShow = false;
|
|
||||||
config->Read( RescueNeverShowEntry, &rescueNeverShow, false );
|
|
||||||
|
|
||||||
if( !rescueNeverShow )
|
|
||||||
{
|
|
||||||
RescueProject( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
SCH_SCREENS schematic;
|
SCH_SCREENS schematic;
|
||||||
|
|
||||||
// Convert old projects over to use symbol library table.
|
// Convert old projects over to use symbol library table.
|
||||||
if( schematic.HasNoFullyDefinedLibIds() )
|
if( schematic.HasNoFullyDefinedLibIds() )
|
||||||
{
|
{
|
||||||
|
// Ignore the never show rescue setting for one last rescue of legacy symbol
|
||||||
|
// libraries before remapping to the symbol library table. This ensures the
|
||||||
|
// best remapping results.
|
||||||
|
RescueLegacyProject( false );
|
||||||
|
|
||||||
// Make backups of current schematics just in case something goes wrong.
|
// Make backups of current schematics just in case something goes wrong.
|
||||||
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
||||||
SaveEEFile( screen, false, CREATE_BACKUP_FILE );
|
SaveEEFile( screen, false, CREATE_BACKUP_FILE );
|
||||||
|
@ -353,6 +347,17 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
|
|
||||||
dlgRemap.ShowQuasiModal();
|
dlgRemap.ShowQuasiModal();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check to see whether some old library parts need to be rescued
|
||||||
|
// Only do this if RescueNeverShow was not set.
|
||||||
|
wxConfigBase *config = Kiface().KifaceSettings();
|
||||||
|
bool rescueNeverShow = false;
|
||||||
|
config->Read( RescueNeverShowEntry, &rescueNeverShow, false );
|
||||||
|
|
||||||
|
if( !rescueNeverShow )
|
||||||
|
RescueSymbolLibTableProject( false );
|
||||||
|
}
|
||||||
|
|
||||||
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
|
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
|
||||||
GetScreen()->TestDanglingEnds(); // Only perform the dangling end test on root sheet.
|
GetScreen()->TestDanglingEnds(); // Only perform the dangling end test on root sheet.
|
||||||
|
|
|
@ -108,12 +108,12 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( part )
|
if( part )
|
||||||
{
|
{
|
||||||
// AddPart() does first clone the part before adding.
|
// AddPart() does first clone the part before adding.
|
||||||
archLib->AddPart( part );
|
archLib->AddPart( part );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ again." );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Build links between each components and its part lib LIB_PART
|
// Build links between each components and its part lib LIB_PART
|
||||||
aScreen->CheckComponentsToPartsLinks();
|
aScreen->UpdateSymbolLinks();
|
||||||
|
|
||||||
aScreen->TestDanglingEnds();
|
aScreen->TestDanglingEnds();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2009-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -489,8 +489,14 @@ void prepareToolsMenu( wxMenu* aParentMenu )
|
||||||
|
|
||||||
AddMenuItem( aParentMenu,
|
AddMenuItem( aParentMenu,
|
||||||
ID_RESCUE_CACHED,
|
ID_RESCUE_CACHED,
|
||||||
_( "&Rescue Old Component" ),
|
_( "&Rescue Symbols" ),
|
||||||
_( "Find old components in project and rename/rescue them" ),
|
_( "Find old symbols in project and rename/rescue them" ),
|
||||||
|
KiBitmap( rescue_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( aParentMenu,
|
||||||
|
ID_REMAP_SYMBOLS,
|
||||||
|
_( "Remap Symbols" ),
|
||||||
|
_( "Remap legacy library symbols to symbol library table" ),
|
||||||
KiBitmap( rescue_xpm ) );
|
KiBitmap( rescue_xpm ) );
|
||||||
|
|
||||||
aParentMenu->AppendSeparator();
|
aParentMenu->AppendSeparator();
|
||||||
|
|
|
@ -122,7 +122,7 @@ bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
||||||
SCH_SCREENS schematic;
|
SCH_SCREENS schematic;
|
||||||
schematic.UpdateSymbolLinks();
|
schematic.UpdateSymbolLinks();
|
||||||
SCH_SHEET_LIST sheets( g_RootSheet );
|
SCH_SHEET_LIST sheets( g_RootSheet );
|
||||||
sheets.AnnotatePowerSymbols( Prj().SchLibs() );
|
sheets.AnnotatePowerSymbols();
|
||||||
schematic.SchematicCleanUp();
|
schematic.SchematicCleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
|
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
|
||||||
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2015-2017 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,15 +37,22 @@
|
||||||
* (if aSilentIfNone is true, the notification is silenced).
|
* (if aSilentIfNone is true, the notification is silenced).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <schframe.h>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <boost/ptr_container/ptr_vector.hpp>
|
#include <boost/ptr_container/ptr_vector.hpp>
|
||||||
|
|
||||||
|
#include <properties.h>
|
||||||
|
|
||||||
|
#include <class_libentry.h>
|
||||||
|
#include <sch_legacy_plugin.h>
|
||||||
|
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_PART;
|
||||||
class SCH_COMPONENT;
|
class SCH_COMPONENT;
|
||||||
class RESCUER;
|
class RESCUER;
|
||||||
|
class SCH_EDIT_FRAME;
|
||||||
|
class SCH_LEGACY_PLUGIN;
|
||||||
|
|
||||||
|
|
||||||
enum RESCUE_TYPE
|
enum RESCUE_TYPE
|
||||||
{
|
{
|
||||||
|
@ -53,45 +60,45 @@ enum RESCUE_TYPE
|
||||||
RESCUE_CASE,
|
RESCUE_CASE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RESCUE_CANDIDATE
|
class RESCUE_CANDIDATE
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
wxString m_requested_name;
|
||||||
|
wxString m_new_name;
|
||||||
|
LIB_PART* m_lib_candidate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~RESCUE_CANDIDATE() {}
|
virtual ~RESCUE_CANDIDATE() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetRequestedName
|
|
||||||
* Get the name that was originally requested in the schematic
|
* Get the name that was originally requested in the schematic
|
||||||
*/
|
*/
|
||||||
virtual wxString GetRequestedName() const = 0;
|
virtual wxString GetRequestedName() const { return m_requested_name; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNewName
|
|
||||||
* Get the name we're proposing changing it to
|
* Get the name we're proposing changing it to
|
||||||
*/
|
*/
|
||||||
virtual wxString GetNewName() const = 0;
|
virtual wxString GetNewName() const { return m_new_name; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetCacheCandidate
|
|
||||||
* Get the part that can be loaded from the project cache, if possible, or
|
* Get the part that can be loaded from the project cache, if possible, or
|
||||||
* else NULL.
|
* else NULL.
|
||||||
*/
|
*/
|
||||||
virtual LIB_PART* GetCacheCandidate() const { return NULL; }
|
virtual LIB_PART* GetCacheCandidate() const { return NULL; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetLibCandidate
|
|
||||||
* Get the part the would be loaded from the libraries, if possible, or else
|
* Get the part the would be loaded from the libraries, if possible, or else
|
||||||
* NULL.
|
* NULL.
|
||||||
*/
|
*/
|
||||||
virtual LIB_PART* GetLibCandidate() const { return NULL; }
|
virtual LIB_PART* GetLibCandidate() const { return m_lib_candidate; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetActionDescription
|
|
||||||
* Get a description of the action proposed, for displaying in the UI.
|
* Get a description of the action proposed, for displaying in the UI.
|
||||||
*/
|
*/
|
||||||
virtual wxString GetActionDescription() const = 0;
|
virtual wxString GetActionDescription() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PerformAction
|
|
||||||
* Perform the actual rescue action. If successful, this must log the rescue using
|
* Perform the actual rescue action. If successful, this must log the rescue using
|
||||||
* RESCUER::LogRescue to allow it to be reversed.
|
* RESCUER::LogRescue to allow it to be reversed.
|
||||||
* @return True on success.
|
* @return True on success.
|
||||||
|
@ -99,6 +106,103 @@ public:
|
||||||
virtual bool PerformAction( RESCUER* aRescuer ) = 0;
|
virtual bool PerformAction( RESCUER* aRescuer ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class RESCUE_CASE_CANDIDATE : public RESCUE_CANDIDATE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Grab all possible RESCUE_CASE_CANDIDATE objects into a vector.
|
||||||
|
*
|
||||||
|
* @param aRescuer - the working RESCUER instance.
|
||||||
|
* @param aCandidates - the vector the will hold the candidates.
|
||||||
|
*/
|
||||||
|
static void FindRescues( RESCUER& aRescuer, boost::ptr_vector<RESCUE_CANDIDATE>& aCandidates );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor RESCUE_CANDIDATE
|
||||||
|
* @param aRequestedName - the name the schematic asks for
|
||||||
|
* @param aNewName - the name we want to change it to
|
||||||
|
* @param aLibCandidate - the part that will give us
|
||||||
|
*/
|
||||||
|
RESCUE_CASE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
||||||
|
LIB_PART* aLibCandidate );
|
||||||
|
|
||||||
|
RESCUE_CASE_CANDIDATE() { m_lib_candidate = NULL; }
|
||||||
|
|
||||||
|
virtual wxString GetActionDescription() const override;
|
||||||
|
|
||||||
|
virtual bool PerformAction( RESCUER* aRescuer ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class RESCUE_CACHE_CANDIDATE: public RESCUE_CANDIDATE
|
||||||
|
{
|
||||||
|
LIB_PART* m_cache_candidate;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Grab all possible #RESCUE_CACHE_CANDIDATE objectss into a vector.
|
||||||
|
*
|
||||||
|
* @param aRescuer - the working RESCUER instance.
|
||||||
|
* @param aCandidates - the vector the will hold the candidates.
|
||||||
|
*/
|
||||||
|
static void FindRescues( RESCUER& aRescuer, boost::ptr_vector<RESCUE_CANDIDATE>& aCandidates );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor RESCUE_CACHE_CANDIDATE
|
||||||
|
* @param aRequestedName - the name the schematic asks for
|
||||||
|
* @param aNewName - the name we want to change it to
|
||||||
|
* @param aCacheCandidate - the part from the cache
|
||||||
|
* @param aLibCandidate - the part that would be loaded from the library
|
||||||
|
*/
|
||||||
|
RESCUE_CACHE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
||||||
|
LIB_PART* aCacheCandidate, LIB_PART* aLibCandidate );
|
||||||
|
|
||||||
|
RESCUE_CACHE_CANDIDATE();
|
||||||
|
|
||||||
|
virtual LIB_PART* GetCacheCandidate() const override { return m_cache_candidate; }
|
||||||
|
|
||||||
|
virtual wxString GetActionDescription() const override;
|
||||||
|
|
||||||
|
virtual bool PerformAction( RESCUER* aRescuer ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class RESCUE_SYMBOL_LIB_TABLE_CANDIDATE : public RESCUE_CANDIDATE
|
||||||
|
{
|
||||||
|
LIB_ID m_requested_id;
|
||||||
|
LIB_ID m_new_id;
|
||||||
|
LIB_PART* m_cache_candidate;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Grab all possible RESCUE_SYMBOL_LIB_TABLE_CANDIDATE objects into a vector.
|
||||||
|
*
|
||||||
|
* @param aRescuer - the working RESCUER instance.
|
||||||
|
* @param aCandidates - the vector the will hold the candidates.
|
||||||
|
*/
|
||||||
|
static void FindRescues( RESCUER& aRescuer, boost::ptr_vector<RESCUE_CANDIDATE>& aCandidates );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor RESCUE_CANDIDATE
|
||||||
|
* @param aRequestedName - the name the schematic asks for
|
||||||
|
* @param aNewName - the name we want to change it to
|
||||||
|
* @param aCacheCandidate - the part from the cache
|
||||||
|
* @param aLibCandidate - the part that would be loaded from the library
|
||||||
|
*/
|
||||||
|
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE( const LIB_ID& aRequestedId, const LIB_ID& aNewId,
|
||||||
|
LIB_PART* aCacheCandidate, LIB_PART* aLibCandidate);
|
||||||
|
|
||||||
|
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE();
|
||||||
|
|
||||||
|
virtual LIB_PART* GetCacheCandidate() const override { return m_cache_candidate; }
|
||||||
|
|
||||||
|
virtual wxString GetActionDescription() const override;
|
||||||
|
|
||||||
|
virtual bool PerformAction( RESCUER* aRescuer ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class RESCUE_LOG
|
class RESCUE_LOG
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -107,12 +211,13 @@ public:
|
||||||
wxString new_name;
|
wxString new_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RESCUER
|
class RESCUER
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
friend class DIALOG_RESCUE_EACH;
|
friend class DIALOG_RESCUE_EACH;
|
||||||
|
|
||||||
std::vector<SCH_COMPONENT*> m_components;
|
std::vector<SCH_COMPONENT*> m_components;
|
||||||
PART_LIBS* m_libs;
|
|
||||||
PROJECT* m_prj;
|
PROJECT* m_prj;
|
||||||
SCH_EDIT_FRAME* m_edit_frame;
|
SCH_EDIT_FRAME* m_edit_frame;
|
||||||
|
|
||||||
|
@ -125,74 +230,124 @@ public:
|
||||||
RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject );
|
RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function FindCandidates
|
* Writes out the rescue library. Called after successful PerformAction()s. If this fails,
|
||||||
* Populate the RESCUER with all possible candidates.
|
* undo the actions.
|
||||||
|
*
|
||||||
|
* @return True on success.
|
||||||
*/
|
*/
|
||||||
void FindCandidates();
|
virtual bool WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame ) = 0;
|
||||||
|
|
||||||
|
virtual void OpenRescueLibrary() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate the RESCUER with all possible candidates.
|
||||||
|
*/
|
||||||
|
virtual void FindCandidates() = 0;
|
||||||
|
|
||||||
|
virtual void AddPart( LIB_PART* aNewPart ) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a dialog to allow the user to select rescues.
|
||||||
|
*
|
||||||
|
* @param aAskShowAgain - whether the "Never Show Again" button should be visible
|
||||||
|
*/
|
||||||
|
virtual void InvokeDialog( bool aAskShowAgain ) = 0;
|
||||||
|
|
||||||
|
SCH_EDIT_FRAME* GetFrame() { return m_edit_frame; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function RemoveDuplicates
|
|
||||||
* Filter out duplicately named rescue candidates.
|
* Filter out duplicately named rescue candidates.
|
||||||
*/
|
*/
|
||||||
void RemoveDuplicates();
|
void RemoveDuplicates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetCandidateCount
|
* Returen the number of rescue candidates found.
|
||||||
*/
|
*/
|
||||||
size_t GetCandidateCount() { return m_all_candidates.size(); }
|
size_t GetCandidateCount() { return m_all_candidates.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetChosenCandidateCount
|
* Get the number of resuce candidates chosen by the user.
|
||||||
*/
|
*/
|
||||||
size_t GetChosenCandidateCount() { return m_chosen_candidates.size(); }
|
size_t GetChosenCandidateCount() { return m_chosen_candidates.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetComponents
|
* Get the list of symbols that need rescued.
|
||||||
*/
|
*/
|
||||||
std::vector<SCH_COMPONENT*>* GetComponents() { return &m_components; }
|
std::vector<SCH_COMPONENT*>* GetComponents() { return &m_components; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetLibs
|
* Return the #SCH_PROJECT object for access to the symbol libraries.
|
||||||
*/
|
|
||||||
PART_LIBS* GetLibs() { return m_libs; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetPrj
|
|
||||||
*/
|
*/
|
||||||
PROJECT* GetPrj() { return m_prj; }
|
PROJECT* GetPrj() { return m_prj; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetPartNameSuffix
|
|
||||||
* Return the suffix to add to rescued parts.
|
* Return the suffix to add to rescued parts.
|
||||||
*/
|
*/
|
||||||
wxString GetPartNameSuffix();
|
wxString GetPartNameSuffix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function InvokeDialog
|
* Used by individual #RESCUE_CANDIDATE objects to log a rescue for undoing.
|
||||||
* Display a dialog to allow the user to select rescues.
|
|
||||||
* @param aAskShowAgain - whether the "Never Show Again" button should be visible
|
|
||||||
*/
|
|
||||||
void InvokeDialog( bool aAskShowAgain );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function LogRescue
|
|
||||||
* Used by individual RESCUE_CANDIDATEs to log a rescue for undoing.
|
|
||||||
*/
|
*/
|
||||||
void LogRescue( SCH_COMPONENT *aComponent, const wxString& aOldName,
|
void LogRescue( SCH_COMPONENT *aComponent, const wxString& aOldName,
|
||||||
const wxString& aNewName );
|
const wxString& aNewName );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DoRescues
|
|
||||||
* Perform all chosen rescue actions, logging them to be undone if necessary.
|
* Perform all chosen rescue actions, logging them to be undone if necessary.
|
||||||
|
*
|
||||||
* @return True on success
|
* @return True on success
|
||||||
*/
|
*/
|
||||||
bool DoRescues();
|
bool DoRescues();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UndoRescues
|
|
||||||
* Reverse the effects of all rescues on the project.
|
* Reverse the effects of all rescues on the project.
|
||||||
*/
|
*/
|
||||||
void UndoRescues();
|
void UndoRescues();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class LEGACY_RESCUER : public RESCUER
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::unique_ptr<PART_LIB> m_rescue_lib;
|
||||||
|
PART_LIBS* m_libs;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LEGACY_RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject ) :
|
||||||
|
RESCUER( aEditFrame, aProject )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void FindCandidates() override;
|
||||||
|
|
||||||
|
virtual void InvokeDialog( bool aAskShowAgain ) override;
|
||||||
|
|
||||||
|
virtual void OpenRescueLibrary() override;
|
||||||
|
|
||||||
|
virtual bool WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame ) override;
|
||||||
|
|
||||||
|
virtual void AddPart( LIB_PART* aNewPart ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class SYMBOL_LIB_TABLE_RESCUER : public RESCUER
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi;
|
||||||
|
|
||||||
|
std::unique_ptr< PROPERTIES > m_properties; ///< Library plugin properties
|
||||||
|
|
||||||
|
public:
|
||||||
|
SYMBOL_LIB_TABLE_RESCUER( SCH_EDIT_FRAME& aEditFrame, PROJECT& aProject );
|
||||||
|
|
||||||
|
virtual void FindCandidates() override;
|
||||||
|
|
||||||
|
virtual void InvokeDialog( bool aAskShowAgain ) override;
|
||||||
|
|
||||||
|
virtual void OpenRescueLibrary() override;
|
||||||
|
|
||||||
|
virtual bool WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame ) override;
|
||||||
|
|
||||||
|
virtual void AddPart( LIB_PART* aNewPart ) override;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _LIB_CACHE_RESCUE_H_
|
#endif // _LIB_CACHE_RESCUE_H_
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
LIB_ALIAS* SchGetLibAlias( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
LIB_ALIAS* SchGetLibAlias( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
||||||
wxWindow* aParent, bool aShowErrorMsg )
|
wxWindow* aParent, bool aShowErrorMsg )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
// wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
||||||
wxCHECK_MSG( aLibTable, NULL, "Invalid symbol library table." );
|
wxCHECK_MSG( aLibTable, NULL, "Invalid symbol library table." );
|
||||||
|
|
||||||
LIB_ALIAS* alias = NULL;
|
LIB_ALIAS* alias = NULL;
|
||||||
|
@ -309,7 +309,7 @@ void SCH_BASE_FRAME::OnEditSymbolLibTable( wxCommandEvent& aEvent )
|
||||||
LIB_ALIAS* SCH_BASE_FRAME::GetLibAlias( const LIB_ID& aLibId, bool aUseCacheLib,
|
LIB_ALIAS* SCH_BASE_FRAME::GetLibAlias( const LIB_ID& aLibId, bool aUseCacheLib,
|
||||||
bool aShowErrorMsg )
|
bool aShowErrorMsg )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
// wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
||||||
|
|
||||||
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ LIB_ALIAS* SCH_BASE_FRAME::GetLibAlias( const LIB_ID& aLibId, bool aUseCacheLib,
|
||||||
|
|
||||||
LIB_PART* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg )
|
LIB_PART* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
// wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
||||||
|
|
||||||
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
||||||
|
|
||||||
|
|
|
@ -1744,6 +1744,8 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
|
||||||
|
|
||||||
void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
|
void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
|
||||||
{
|
{
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
// part and alias can differ if alias is not the root
|
// part and alias can differ if alias is not the root
|
||||||
if( PART_SPTR part = m_part.lock() )
|
if( PART_SPTR part = m_part.lock() )
|
||||||
{
|
{
|
||||||
|
@ -1759,7 +1761,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
|
||||||
GetRef( m_currentSheetPath ),
|
GetRef( m_currentSheetPath ),
|
||||||
DARKCYAN ) );
|
DARKCYAN ) );
|
||||||
|
|
||||||
wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
|
msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
|
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
|
||||||
|
|
||||||
|
@ -1800,8 +1802,20 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetField( VALUE )->GetShownText(),
|
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetField( VALUE )->GetShownText(),
|
||||||
DARKCYAN ) );
|
DARKCYAN ) );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Component" ), GetLibId().GetLibItemName(), BROWN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Symbol" ), GetLibId().GetLibItemName(), BROWN ) );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Error: symbol not found!!!" ), RED ) );
|
|
||||||
|
wxString libNickname = GetLibId().GetLibNickname();
|
||||||
|
|
||||||
|
if( libNickname.empty() )
|
||||||
|
{
|
||||||
|
aList.push_back( MSG_PANEL_ITEM( _( "Library" ),
|
||||||
|
_( "No library defined!!!" ), RED ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Symbol not found in %s!!!" ), libNickname );
|
||||||
|
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg , RED ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,12 +479,13 @@ static void parseQuotedString( wxString& aString, FILE_LINE_READER& aReader,
|
||||||
*/
|
*/
|
||||||
class SCH_LEGACY_PLUGIN_CACHE
|
class SCH_LEGACY_PLUGIN_CACHE
|
||||||
{
|
{
|
||||||
|
static int m_modHash; // Keep track of the modification status of the library.
|
||||||
|
|
||||||
wxFileName m_libFileName; // Absolute path and file name is required here.
|
wxFileName m_libFileName; // Absolute path and file name is required here.
|
||||||
wxDateTime m_fileModTime;
|
wxDateTime m_fileModTime;
|
||||||
LIB_ALIAS_MAP m_aliases; // Map of names of LIB_ALIAS pointers.
|
LIB_ALIAS_MAP m_aliases; // Map of names of LIB_ALIAS pointers.
|
||||||
bool m_isWritable;
|
bool m_isWritable;
|
||||||
bool m_isModified;
|
bool m_isModified;
|
||||||
int m_modHash; // Keep track of the modification status of the library.
|
|
||||||
int m_versionMajor;
|
int m_versionMajor;
|
||||||
int m_versionMinor;
|
int m_versionMinor;
|
||||||
int m_libType; // Is this cache a component or symbol library.
|
int m_libType; // Is this cache a component or symbol library.
|
||||||
|
@ -2031,11 +2032,13 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SCH_LEGACY_PLUGIN_CACHE::m_modHash = 1; // starts at 1 and goes up
|
||||||
|
|
||||||
|
|
||||||
SCH_LEGACY_PLUGIN_CACHE::SCH_LEGACY_PLUGIN_CACHE( const wxString& aFullPathAndFileName ) :
|
SCH_LEGACY_PLUGIN_CACHE::SCH_LEGACY_PLUGIN_CACHE( const wxString& aFullPathAndFileName ) :
|
||||||
m_libFileName( aFullPathAndFileName ),
|
m_libFileName( aFullPathAndFileName ),
|
||||||
m_isWritable( true ),
|
m_isWritable( true ),
|
||||||
m_isModified( false ),
|
m_isModified( false )
|
||||||
m_modHash( 1 )
|
|
||||||
{
|
{
|
||||||
m_versionMajor = -1;
|
m_versionMajor = -1;
|
||||||
m_versionMinor = -1;
|
m_versionMinor = -1;
|
||||||
|
|
|
@ -527,7 +527,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREEN::CheckComponentsToPartsLinks()
|
void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
|
||||||
{
|
{
|
||||||
// Initialize or reinitialize the pointer to the LIB_PART for each component
|
// Initialize or reinitialize the pointer to the LIB_PART for each component
|
||||||
// found in m_drawList, but only if needed (change in lib or schematic)
|
// found in m_drawList, but only if needed (change in lib or schematic)
|
||||||
|
@ -539,7 +539,7 @@ void SCH_SCREEN::CheckComponentsToPartsLinks()
|
||||||
int mod_hash = libs->GetModifyHash();
|
int mod_hash = libs->GetModifyHash();
|
||||||
|
|
||||||
// Must we resolve?
|
// Must we resolve?
|
||||||
if( m_modification_sync != mod_hash )
|
if( (m_modification_sync != mod_hash) || aForce )
|
||||||
{
|
{
|
||||||
SCH_TYPE_COLLECTOR c;
|
SCH_TYPE_COLLECTOR c;
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
CheckComponentsToPartsLinks();
|
UpdateSymbolLinks();
|
||||||
|
|
||||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
|
@ -582,7 +582,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
||||||
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
CheckComponentsToPartsLinks();
|
UpdateSymbolLinks();
|
||||||
|
|
||||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
|
@ -1508,10 +1508,10 @@ int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREENS::UpdateSymbolLinks()
|
void SCH_SCREENS::UpdateSymbolLinks( bool aForce )
|
||||||
{
|
{
|
||||||
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||||
screen->CheckComponentsToPartsLinks();
|
screen->UpdateSymbolLinks( aForce );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
|
|
||||||
#include <invoke_sch_dialog.h>
|
#include <invoke_sch_dialog.h>
|
||||||
#include <dialogs/dialog_schematic_find.h>
|
#include <dialogs/dialog_schematic_find.h>
|
||||||
|
#include <dialog_symbol_remap.h>
|
||||||
|
|
||||||
#include <wx/display.h>
|
#include <wx/display.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
|
@ -251,6 +252,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_TOOL( ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
EVT_TOOL( ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
||||||
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
|
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
|
||||||
EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject )
|
EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject )
|
||||||
|
EVT_MENU( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnRemapSymbols )
|
||||||
|
|
||||||
EVT_TOOL( ID_RUN_PCB, SCH_EDIT_FRAME::OnOpenPcbnew )
|
EVT_TOOL( ID_RUN_PCB, SCH_EDIT_FRAME::OnOpenPcbnew )
|
||||||
EVT_TOOL( ID_RUN_PCB_MODULE_EDITOR, SCH_EDIT_FRAME::OnOpenPcbModuleEditor )
|
EVT_TOOL( ID_RUN_PCB_MODULE_EDITOR, SCH_EDIT_FRAME::OnOpenPcbModuleEditor )
|
||||||
|
@ -333,6 +335,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
|
EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
|
||||||
EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
|
EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
|
||||||
EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
|
EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
|
||||||
|
EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols )
|
||||||
|
|
||||||
/* Search dialog events. */
|
/* Search dialog events. */
|
||||||
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
|
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
|
||||||
|
@ -823,6 +826,15 @@ void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent )
|
||||||
|
{
|
||||||
|
SCH_SCREENS schematic;
|
||||||
|
|
||||||
|
// The remapping can only be performed on legacy projects.
|
||||||
|
aEvent.Enable( schematic.HasNoFullyDefinedLibIds() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
|
void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
aEvent.Enable( GetScreen()->IsModify() );
|
aEvent.Enable( GetScreen()->IsModify() );
|
||||||
|
@ -1249,7 +1261,20 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnRescueProject( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnRescueProject( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
RescueProject( true );
|
SCH_SCREENS schematic;
|
||||||
|
|
||||||
|
if( schematic.HasNoFullyDefinedLibIds() )
|
||||||
|
RescueLegacyProject( true );
|
||||||
|
else
|
||||||
|
RescueSymbolLibTableProject( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::OnRemapSymbols( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
DIALOG_SYMBOL_REMAP dlgRemap( this );
|
||||||
|
|
||||||
|
dlgRemap.ShowQuasiModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
|
||||||
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -64,6 +64,7 @@ class DIALOG_SCH_FIND;
|
||||||
class wxFindDialogEvent;
|
class wxFindDialogEvent;
|
||||||
class wxFindReplaceData;
|
class wxFindReplaceData;
|
||||||
class SCHLIB_FILTER;
|
class SCHLIB_FILTER;
|
||||||
|
class RESCUER;
|
||||||
|
|
||||||
|
|
||||||
/// enum used in RotationMiroir()
|
/// enum used in RotationMiroir()
|
||||||
|
@ -890,6 +891,7 @@ private:
|
||||||
void OnOpenCvpcb( wxCommandEvent& event );
|
void OnOpenCvpcb( wxCommandEvent& event );
|
||||||
void OnOpenLibraryEditor( wxCommandEvent& event );
|
void OnOpenLibraryEditor( wxCommandEvent& event );
|
||||||
void OnRescueProject( wxCommandEvent& event );
|
void OnRescueProject( wxCommandEvent& event );
|
||||||
|
void OnRemapSymbols( wxCommandEvent& aEvent );
|
||||||
void OnPreferencesOptions( wxCommandEvent& event );
|
void OnPreferencesOptions( wxCommandEvent& event );
|
||||||
void OnCancelCurrentCommand( wxCommandEvent& aEvent );
|
void OnCancelCurrentCommand( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
|
@ -910,6 +912,7 @@ private:
|
||||||
void OnUpdateSave( wxUpdateUIEvent& aEvent );
|
void OnUpdateSave( wxUpdateUIEvent& aEvent );
|
||||||
void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent );
|
void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent );
|
||||||
void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent );
|
void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent );
|
||||||
|
void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UpdateTitle
|
* Function UpdateTitle
|
||||||
|
@ -1378,7 +1381,9 @@ public:
|
||||||
* if there are no components to rescue, and a "Never Show Again" button is
|
* if there are no components to rescue, and a "Never Show Again" button is
|
||||||
* displayed.
|
* displayed.
|
||||||
*/
|
*/
|
||||||
bool RescueProject( bool aRunningOnDemand );
|
bool rescueProject( RESCUER& aRescuer, bool aRunningOnDemand );
|
||||||
|
bool RescueLegacyProject( bool aRunningOnDemand );
|
||||||
|
bool RescueSymbolLibTableProject( bool aRunningOnDemand );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PrintPage
|
* Function PrintPage
|
||||||
|
|
Loading…
Reference in New Issue