Undo commit -r 6368.

This commit is contained in:
Wayne Stambaugh 2016-02-15 15:22:45 -05:00
parent af2e19d7d9
commit 03bf559465
8 changed files with 45 additions and 52 deletions

View File

@ -6,7 +6,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2013 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
@ -35,18 +35,19 @@
#include <sch_reference_list.h>
#include <class_library.h>
#include <sch_sheet.h>
void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
{
if( aCurrentSheetOnly )
{
m_CurrentSheet->Last()->ClearAnnotation();
SCH_SCREEN* screen = GetScreen();
wxCHECK_RET( screen != NULL, wxT( "Attempt to clear annotation of a NULL screen." ) );
screen->ClearAnnotation( m_CurrentSheet );
}
else
{
m_CurrentSheet->Last()->GetRootSheet()->ClearAnnotation( true );
SCH_SCREENS ScreenList;
ScreenList.ClearAnnotation();
}
// Update the references for the sheet that is currently being displayed.

View File

@ -425,11 +425,11 @@ public:
/**
* Function ClearAnnotation
* clears the annotation for the components in \a aSheet on the screen.
* @param aSheet The sheet of the component annotation to clear. If NULL then
* the entire hierarchy is cleared for this screen.
* clears the annotation for the components in \a aSheetPath on the screen.
* @param aSheetPath The sheet path of the component annotation to clear. If NULL then
* the entire hierarchy is cleared.
*/
void ClearAnnotation( SCH_SHEET* aSheet );
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
/**
* Function GetHierarchicalItems
@ -549,6 +549,12 @@ public:
SCH_SCREEN* GetNext();
SCH_SCREEN* GetScreen( unsigned int aIndex ) const;
/**
* Function ClearAnnotation
* clears the annotation for all components in the hierarchy.
*/
void ClearAnnotation();
/**
* Function SchematicCleanUp
* merges and breaks wire segments in the entire schematic hierarchy.

View File

@ -102,7 +102,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, uns
field = comp->GetRef( path );
ret |= fprintf( f, " ( %s %s",
TO_UTF8( comp->GetPath( path->Last() ) ),
TO_UTF8( comp->GetPath( path ) ),
TO_UTF8( footprint ) );
ret |= fprintf( f, " %s", TO_UTF8( field ) );

View File

@ -432,21 +432,21 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
}
wxString SCH_COMPONENT::GetPath( const SCH_SHEET* aSheet ) const
wxString SCH_COMPONENT::GetPath( const SCH_SHEET_PATH* sheet ) const
{
wxCHECK_MSG( aSheet != NULL, wxEmptyString,
wxCHECK_MSG( sheet != NULL, wxEmptyString,
wxT( "Cannot get component path with invalid sheet object." ) );
wxString str;
str.Printf( wxT( "%8.8lX" ), (long unsigned) m_TimeStamp );
return aSheet->GetPath() + str;
return sheet->Path() + str;
}
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
{
wxString path = GetPath( sheet->Last() );
wxString path = GetPath( sheet );
wxString h_path, h_ref;
wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) );
@ -508,7 +508,7 @@ bool SCH_COMPONENT::IsReferenceStringValid( const wxString& aReferenceString )
void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
{
wxString path = GetPath( sheet->Last() );
wxString path = GetPath( sheet );
bool notInArray = true;
@ -586,7 +586,7 @@ void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp )
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
{
wxString path = GetPath( aSheet->Last() );
wxString path = GetPath( aSheet );
wxString h_path, h_multi;
wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) );
@ -614,7 +614,7 @@ int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
void SCH_COMPONENT::SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection )
{
wxString path = GetPath( aSheet->Last() );
wxString path = GetPath( aSheet );
bool notInArray = true;
@ -751,7 +751,7 @@ void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
}
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET* aSheet )
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
{
bool keepMulti = false;
wxArrayString reference_fields;
@ -783,22 +783,22 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET* aSheet )
// For components with units locked,
// we cannot remove all annotations: part selection must be kept
// For all components: if aSheet is not NULL,
// For all components: if aSheetPath is not NULL,
// remove annotation only for the given path
if( keepMulti || aSheet )
if( keepMulti || aSheetPath )
{
wxString NewHref;
wxString path;
if( aSheet )
path = GetPath( aSheet );
if( aSheetPath )
path = GetPath( aSheetPath );
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
{
// Break hierarchical reference in path, ref and multi selection:
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
{
if( keepMulti ) // Get and keep part selection
multi = reference_fields[2];

View File

@ -244,10 +244,10 @@ public:
/**
* Function ClearAnnotation
* clears exiting component annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: SCH_SHEET value: if NULL remove all annotations,
* else remove annotation relative to \a aSheet.
* @param aSheetPath: SCH_SHEET_PATH value: if NULL remove all annotations,
* else remove annotation relative to this sheetpath
*/
void ClearAnnotation( SCH_SHEET* aSheet );
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
/**
* Function SetTimeStamp
@ -391,8 +391,8 @@ public:
void SwapData( SCH_ITEM* aItem );
// returns a unique ID, in the form of a path determined by \a aSheet.
wxString GetPath( const SCH_SHEET* sheet ) const;
// returns a unique ID, in the form of a path.
wxString GetPath( const SCH_SHEET_PATH* sheet ) const;
/**
* Function IsReferenceStringValid (static)

View File

@ -755,7 +755,7 @@ int SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions )
}
void SCH_SCREEN::ClearAnnotation( SCH_SHEET* aSheet )
void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
{
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
@ -763,7 +763,7 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET* aSheet )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
component->ClearAnnotation( aSheet );
component->ClearAnnotation( aSheetPath );
// Clear the modified component flag set by component->ClearAnnotation
// because we do not use it here and we should not leave this flag set,
@ -1431,6 +1431,13 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
}
void SCH_SCREENS::ClearAnnotation()
{
for( size_t i = 0; i < m_screens.size(); i++ )
m_screens[i]->ClearAnnotation( NULL );
}
void SCH_SCREENS::SchematicCleanUp()
{
for( size_t i = 0; i < m_screens.size(); i++ )

View File

@ -1214,25 +1214,6 @@ wxString SCH_SHEET::GetHumanReadablePath() const
}
void SCH_SHEET::ClearAnnotation( bool aIncludeSubSheets )
{
m_screen->ClearAnnotation( this );
if( aIncludeSubSheets )
{
SCH_ITEM* item = m_screen->GetDrawItems();
while( item )
{
if( item->Type() == SCH_SHEET_T )
static_cast<SCH_SHEET*>( item )->ClearAnnotation( aIncludeSubSheets );
item = item->Next();
}
}
}
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{
wxLogDebug( wxT( "Sheet assignment operator." ) );

View File

@ -633,8 +633,6 @@ public:
*/
wxString GetHumanReadablePath() const;
void ClearAnnotation( bool aIncludeSubSheets = false );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif