Prevent duplicate sheet names in schematic editor.
This commit is contained in:
parent
ebaf145467
commit
fd486a11da
|
@ -675,6 +675,23 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCH_SHEET* SCH_SCREEN::GetSheet( const wxString& aName )
|
||||||
|
{
|
||||||
|
for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() )
|
||||||
|
{
|
||||||
|
if( item->Type() != SCH_SHEET_T )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SCH_SHEET* sheet = (SCH_SHEET*) item;
|
||||||
|
|
||||||
|
if( aName.CmpNoCase( sheet->m_SheetName ) == 0 )
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PIN* SCH_SCREEN::GetSheetLabel( const wxPoint& aPosition )
|
SCH_SHEET_PIN* SCH_SCREEN::GetSheetLabel( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
SCH_SHEET_PIN* sheetPin = NULL;
|
SCH_SHEET_PIN* sheetPin = NULL;
|
||||||
|
|
|
@ -65,6 +65,16 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Duplicate sheet names are not valid.
|
||||||
|
const SCH_SHEET* sheet = GetScreen()->GetSheet( dlg.GetSheetName() );
|
||||||
|
|
||||||
|
if( (sheet != NULL) && (sheet != aSheet) )
|
||||||
|
{
|
||||||
|
DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ),
|
||||||
|
GetChars( dlg.GetSheetName() ) ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
bool loadFromFile = false;
|
bool loadFromFile = false;
|
||||||
|
|
|
@ -305,6 +305,16 @@ public:
|
||||||
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent = NULL,
|
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent = NULL,
|
||||||
bool aEndPointOnly = false ) const;
|
bool aEndPointOnly = false ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetSheet
|
||||||
|
* returns a sheet object pointer that is named \a aName.
|
||||||
|
*
|
||||||
|
* @note The screen hierarchy is not descened.
|
||||||
|
* @param aName is the case insensitive name of the sheet.
|
||||||
|
* @return A pointer to the SCH_SHEET object found or NULL.
|
||||||
|
*/
|
||||||
|
SCH_SHEET* GetSheet( const wxString& aName );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetSheetLabel
|
* Function GetSheetLabel
|
||||||
* test the screen if \a aPosition is a sheet label object.
|
* test the screen if \a aPosition is a sheet label object.
|
||||||
|
|
Loading…
Reference in New Issue