Eeschema: remove automatic conversion of time stamp UUIDs.

In order to avoid confusion when loading legacy schematics, updating time
stamp UUIDs is no longer performed.  If users where not experiencing issues
with time stamp clashes with shared schematics then this was probably a
case of me being overly cautious.

The original conversion code has be moved to
SCH_EDIT_FRAME::ConvertTimeStampUuids() so the working functionality is
not lost.  This function should not be used until a way is found to update
the board from the schematics with the appropriate settings.
This commit is contained in:
Wayne Stambaugh 2020-05-07 09:26:43 -04:00
parent c92181621e
commit e253862f77
3 changed files with 46 additions and 25 deletions

View File

@ -432,31 +432,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Update all symbol library links for all sheets. // Update all symbol library links for all sheets.
schematic.UpdateSymbolLinks(); schematic.UpdateSymbolLinks();
// Replace sheet and symbol time stamps with real UUIDs and update symbol instance
// sheet paths using the new UUID based sheet paths.
// Save the time stamp sheet paths.
SCH_SHEET_LIST timeStampSheetPaths( g_RootSheet );
std::vector<KIID_PATH> oldSheetPaths = timeStampSheetPaths.GetPaths();
// The root sheet now gets a permanent UUID.
const_cast<KIID&>( g_RootSheet->m_Uuid ).ConvertTimestampToUuid();
// Change the sheet and symbol time stamps to UUIDs.
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
{
for( auto sheet : screen->Items().OfType( SCH_SHEET_T ) )
const_cast<KIID&>( sheet->m_Uuid ).ConvertTimestampToUuid();
for( auto symbol : screen->Items().OfType( SCH_COMPONENT_T ) )
const_cast<KIID&>( symbol->m_Uuid ).ConvertTimestampToUuid();
}
SCH_SHEET_LIST uuidSheetPaths( g_RootSheet );
timeStampSheetPaths.ReplaceLegacySheetPaths( oldSheetPaths );
if( !cfg || cfg->m_Appearance.show_sexpr_file_convert_warning ) if( !cfg || cfg->m_Appearance.show_sexpr_file_convert_warning )
{ {
wxRichMessageDialog newFileFormatDlg( wxRichMessageDialog newFileFormatDlg(
@ -709,6 +684,7 @@ bool SCH_EDIT_FRAME::SaveProject()
sheetFileName.SetExt( KiCadSchematicFileExtension ); sheetFileName.SetExt( KiCadSchematicFileExtension );
sheet->SetFileName( sheetFileName.GetFullPath() ); sheet->SetFileName( sheetFileName.GetFullPath() );
RefreshItem( sheet );
} }
screen->SetFileName( tmpFn.GetFullPath() ); screen->SetFileName( tmpFn.GetFullPath() );

View File

@ -1228,3 +1228,37 @@ bool SCH_EDIT_FRAME::GetShowAllPins() const
EESCHEMA_SETTINGS* cfg = eeconfig(); EESCHEMA_SETTINGS* cfg = eeconfig();
return cfg->m_Appearance.show_hidden_pins; return cfg->m_Appearance.show_hidden_pins;
} }
void SCH_EDIT_FRAME::ConvertTimeStampUuids()
{
// Remove this once this method is fully implemented. Otherwise, don't use it.
wxCHECK( false, /* void */ );
// Replace sheet and symbol time stamps with real UUIDs and update symbol instance
// sheet paths using the new UUID based sheet paths.
// Save the time stamp sheet paths.
SCH_SHEET_LIST timeStampSheetPaths( g_RootSheet );
std::vector<KIID_PATH> oldSheetPaths = timeStampSheetPaths.GetPaths();
// The root sheet now gets a permanent UUID.
const_cast<KIID&>( g_RootSheet->m_Uuid ).ConvertTimestampToUuid();
SCH_SCREENS schematic;
// Change the sheet and symbol time stamps to UUIDs.
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
{
for( auto sheet : screen->Items().OfType( SCH_SHEET_T ) )
const_cast<KIID&>( sheet->m_Uuid ).ConvertTimestampToUuid();
for( auto symbol : screen->Items().OfType( SCH_COMPONENT_T ) )
const_cast<KIID&>( symbol->m_Uuid ).ConvertTimestampToUuid();
}
SCH_SHEET_LIST uuidSheetPaths( g_RootSheet );
timeStampSheetPaths.ReplaceLegacySheetPaths( oldSheetPaths );
}

View File

@ -1016,6 +1016,17 @@ public:
void FixupJunctions(); void FixupJunctions();
/**
* Convert sheet and symbol legacy time stamp UUIDs to full UUIDs.
*
* @warning This is a work in progress. It only contains the original code that automatically
* updated the UUIDs when loading legacy schematics. This is an incomplete solution
* because a way to force a PCB update from schematic with the update symbol links
* from references setting must be executed to ensure proper synchronization between
* the schematic and board.
*/
void ConvertTimeStampUuids();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };