2011-10-07 14:41:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-03-23 07:41:47 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2023-02-01 19:14:26 +00:00
|
|
|
* Copyright (C) 1992-2023 Kicad Developers, see AUTHORS.txt for contributors.
|
2011-10-07 14:41:30 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2022-01-24 18:37:54 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <climits>
|
|
|
|
|
2021-03-07 20:31:19 +00:00
|
|
|
#include <bitmaps.h>
|
2020-11-18 01:21:04 +00:00
|
|
|
#include <core/mirror.h>
|
2022-09-09 21:48:13 +00:00
|
|
|
#include <core/kicad_algo.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <sch_draw_panel.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <trigo.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2021-08-18 20:38:14 +00:00
|
|
|
#include <plotters/plotter.h>
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h>
|
2020-10-25 04:49:02 +00:00
|
|
|
#include <widgets/msgpanel.h>
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <math/util.h> // for KiROUND
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <sch_sheet_path.h>
|
2021-04-06 21:15:49 +00:00
|
|
|
#include <sch_sheet_pin.h>
|
2021-02-24 13:48:02 +00:00
|
|
|
#include <sch_symbol.h>
|
2020-06-22 00:43:47 +00:00
|
|
|
#include <sch_painter.h>
|
2020-05-13 02:00:37 +00:00
|
|
|
#include <schematic.h>
|
2020-03-06 03:00:30 +00:00
|
|
|
#include <settings/color_settings.h>
|
2018-04-17 16:25:19 +00:00
|
|
|
#include <trace_helpers.h>
|
2020-03-06 12:05:21 +00:00
|
|
|
#include <pgm_base.h>
|
2021-06-03 12:11:15 +00:00
|
|
|
#include <wx/log.h>
|
2020-03-06 12:05:21 +00:00
|
|
|
|
2022-10-01 00:16:24 +00:00
|
|
|
// N.B. Do not change these values without transitioning the file format
|
|
|
|
#define SHEET_NAME_CANONICAL "Sheetname"
|
|
|
|
#define SHEET_FILE_CANONICAL "Sheetfile"
|
2021-11-27 20:28:35 +00:00
|
|
|
#define USER_FIELD_CANONICAL "Field%d"
|
2020-03-06 12:05:21 +00:00
|
|
|
|
2021-11-27 20:28:35 +00:00
|
|
|
|
|
|
|
const wxString SCH_SHEET::GetDefaultFieldName( int aFieldNdx, bool aTranslated )
|
2020-03-06 12:05:21 +00:00
|
|
|
{
|
2021-11-27 20:28:35 +00:00
|
|
|
if( !aTranslated )
|
|
|
|
{
|
|
|
|
switch( aFieldNdx )
|
|
|
|
{
|
|
|
|
case SHEETNAME: return SHEET_NAME_CANONICAL;
|
|
|
|
case SHEETFILENAME: return SHEET_FILE_CANONICAL;
|
|
|
|
default: return wxString::Format( USER_FIELD_CANONICAL, aFieldNdx );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-06 12:05:21 +00:00
|
|
|
// Fixed values for the mandatory fields
|
|
|
|
switch( aFieldNdx )
|
|
|
|
{
|
2022-05-12 11:05:06 +00:00
|
|
|
case SHEETNAME: return _( SHEET_NAME_CANONICAL );
|
|
|
|
case SHEETFILENAME: return _( SHEET_FILE_CANONICAL );
|
|
|
|
default: return wxString::Format( _( USER_FIELD_CANONICAL ), aFieldNdx );
|
2020-03-06 12:05:21 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-12 14:03:43 +00:00
|
|
|
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, VECTOR2I aSize,
|
2021-11-28 17:32:53 +00:00
|
|
|
FIELDS_AUTOPLACED aAutoplaceFields ) :
|
|
|
|
SCH_ITEM( aParent, SCH_SHEET_T )
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = LAYER_SHEET;
|
2021-11-28 17:32:53 +00:00
|
|
|
m_pos = aPos;
|
|
|
|
m_size = aSize;
|
2021-07-16 20:13:26 +00:00
|
|
|
m_screen = nullptr;
|
2020-03-06 12:05:21 +00:00
|
|
|
|
|
|
|
for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
|
|
|
|
{
|
2021-11-28 17:32:53 +00:00
|
|
|
m_fields.emplace_back( aPos, i, this, GetDefaultFieldName( i ) );
|
2020-03-06 12:05:21 +00:00
|
|
|
m_fields.back().SetVisible( true );
|
|
|
|
|
|
|
|
if( i == SHEETNAME )
|
|
|
|
m_fields.back().SetLayer( LAYER_SHEETNAME );
|
|
|
|
else if( i == SHEETFILENAME )
|
|
|
|
m_fields.back().SetLayer( LAYER_SHEETFILENAME );
|
|
|
|
else
|
|
|
|
m_fields.back().SetLayer( LAYER_SHEETFIELDS );
|
|
|
|
}
|
|
|
|
|
2021-11-28 17:32:53 +00:00
|
|
|
m_fieldsAutoplaced = aAutoplaceFields;
|
|
|
|
AutoAutoplaceFields( nullptr );
|
2020-03-08 02:18:45 +00:00
|
|
|
|
2020-04-04 20:32:14 +00:00
|
|
|
m_borderWidth = 0;
|
|
|
|
m_borderColor = COLOR4D::UNSPECIFIED;
|
|
|
|
m_backgroundColor = COLOR4D::UNSPECIFIED;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
|
|
|
|
SCH_ITEM( aSheet )
|
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
m_pos = aSheet.m_pos;
|
|
|
|
m_size = aSheet.m_size;
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = aSheet.m_layer;
|
2020-02-21 22:20:42 +00:00
|
|
|
const_cast<KIID&>( m_Uuid ) = aSheet.m_Uuid;
|
2020-03-06 12:05:21 +00:00
|
|
|
m_fields = aSheet.m_fields;
|
|
|
|
m_fieldsAutoplaced = aSheet.m_fieldsAutoplaced;
|
2011-12-08 15:45:01 +00:00
|
|
|
m_screen = aSheet.m_screen;
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : aSheet.m_pins )
|
|
|
|
{
|
|
|
|
m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
|
|
|
|
m_pins.back()->SetParent( this );
|
|
|
|
}
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2021-01-19 02:16:48 +00:00
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
field.SetParent( this );
|
|
|
|
|
2020-03-08 02:18:45 +00:00
|
|
|
m_borderWidth = aSheet.m_borderWidth;
|
|
|
|
m_borderColor = aSheet.m_borderColor;
|
|
|
|
m_backgroundColor = aSheet.m_backgroundColor;
|
2021-12-06 12:47:18 +00:00
|
|
|
m_instances = aSheet.m_instances;
|
2020-03-08 02:18:45 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen )
|
|
|
|
m_screen->IncRefCount();
|
2010-12-21 15:13:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET::~SCH_SHEET()
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
// also, look at the associated sheet & its reference count
|
|
|
|
// perhaps it should be deleted also.
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
m_screen->DecRefCount();
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen->GetRefCount() == 0 )
|
|
|
|
delete m_screen;
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2020-01-12 18:40:50 +00:00
|
|
|
|
|
|
|
// We own our pins; delete them
|
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
|
|
|
delete pin;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2012-03-17 14:39:27 +00:00
|
|
|
EDA_ITEM* SCH_SHEET::Clone() const
|
2010-12-21 15:13:09 +00:00
|
|
|
{
|
|
|
|
return new SCH_SHEET( *this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
void SCH_SHEET::SetScreen( SCH_SCREEN* aScreen )
|
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
if( aScreen == m_screen )
|
2011-01-20 16:34:57 +00:00
|
|
|
return;
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
if( m_screen != nullptr )
|
2011-01-20 16:34:57 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
m_screen->DecRefCount();
|
2011-01-20 16:34:57 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen->GetRefCount() == 0 )
|
2011-01-20 16:34:57 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
delete m_screen;
|
2021-07-16 20:13:26 +00:00
|
|
|
m_screen = nullptr;
|
2011-01-20 16:34:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
m_screen = aScreen;
|
2011-01-20 16:34:57 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen )
|
|
|
|
m_screen->IncRefCount();
|
2011-01-20 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SCH_SHEET::GetScreenCount() const
|
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
if( m_screen == nullptr )
|
2011-01-20 16:34:57 +00:00
|
|
|
return 0;
|
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
return m_screen->GetRefCount();
|
2011-01-20 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
bool SCH_SHEET::IsRootSheet() const
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
wxCHECK_MSG( Schematic(), false, "Can't call IsRootSheet without setting a schematic" );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
return &Schematic()->Root() == this;
|
2016-07-06 09:22:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-27 22:28:36 +00:00
|
|
|
void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
|
|
|
|
{
|
2022-09-09 21:48:13 +00:00
|
|
|
auto add =
|
|
|
|
[&]( const wxString& aVar )
|
|
|
|
{
|
|
|
|
if( !alg::contains( *aVars, aVar ) )
|
|
|
|
aVars->push_back( aVar );
|
|
|
|
};
|
|
|
|
|
2020-05-27 22:28:36 +00:00
|
|
|
for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
|
2022-09-09 21:48:13 +00:00
|
|
|
add( m_fields[i].GetCanonicalName().Upper() );
|
2020-07-28 12:11:11 +00:00
|
|
|
|
|
|
|
for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
|
2022-09-09 21:48:13 +00:00
|
|
|
add( m_fields[i].GetName() );
|
|
|
|
|
|
|
|
SCH_SHEET_PATH sheetPath = findSelf();
|
|
|
|
|
|
|
|
if( sheetPath.size() >= 2 )
|
|
|
|
{
|
|
|
|
sheetPath.pop_back();
|
|
|
|
sheetPath.Last()->GetContextualTextVars( aVars );
|
|
|
|
}
|
2023-02-01 19:14:26 +00:00
|
|
|
else if( Schematic() )
|
|
|
|
{
|
|
|
|
Schematic()->GetContextualTextVars( aVars );
|
|
|
|
}
|
2022-09-09 21:48:13 +00:00
|
|
|
|
|
|
|
add( wxT( "#" ) );
|
|
|
|
add( wxT( "##" ) );
|
|
|
|
add( wxT( "SHEETPATH" ) );
|
2020-05-27 22:28:36 +00:00
|
|
|
|
2021-02-12 16:23:24 +00:00
|
|
|
m_screen->GetTitleBlock().GetContextualTextVars( aVars );
|
2020-05-27 22:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-06 13:06:57 +00:00
|
|
|
bool SCH_SHEET::ResolveTextVar( wxString* token, int aDepth ) const
|
|
|
|
{
|
2023-01-17 16:54:08 +00:00
|
|
|
if( !Schematic() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( token->Contains( ':' ) )
|
|
|
|
{
|
|
|
|
if( Schematic()->ResolveCrossReference( token, aDepth + 1 ) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-06 13:06:57 +00:00
|
|
|
for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
|
|
|
|
{
|
|
|
|
if( token->IsSameAs( m_fields[i].GetCanonicalName().Upper() ) )
|
|
|
|
{
|
|
|
|
*token = m_fields[i].GetShownText( aDepth + 1 );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
|
|
|
|
{
|
|
|
|
if( token->IsSameAs( m_fields[i].GetName() ) )
|
|
|
|
{
|
|
|
|
*token = m_fields[i].GetShownText( aDepth + 1 );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-12 16:23:24 +00:00
|
|
|
PROJECT *project = &Schematic()->Prj();
|
|
|
|
|
2022-02-28 20:26:18 +00:00
|
|
|
// We cannot resolve text variables initially on load as we need to first load the screen and
|
|
|
|
// then parse the hierarchy. So skip the resolution if the screen isn't set yet
|
|
|
|
if( m_screen && m_screen->GetTitleBlock().TextVarResolver( token, project ) )
|
2021-02-12 16:23:24 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-05-03 14:52:31 +00:00
|
|
|
if( token->IsSameAs( wxT( "#" ) ) )
|
|
|
|
{
|
2022-09-09 21:48:13 +00:00
|
|
|
*token = wxString::Format( "%s", findSelf().GetPageNumber() );
|
|
|
|
return true;
|
2020-05-03 14:52:31 +00:00
|
|
|
}
|
|
|
|
else if( token->IsSameAs( wxT( "##" ) ) )
|
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
SCH_SHEET_LIST sheetList = Schematic()->GetSheets();
|
2020-05-03 14:52:31 +00:00
|
|
|
*token = wxString::Format( wxT( "%d" ), (int) sheetList.size() );
|
|
|
|
return true;
|
|
|
|
}
|
2022-04-09 14:38:47 +00:00
|
|
|
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
|
|
|
{
|
2022-09-09 21:48:13 +00:00
|
|
|
*token = findSelf().PathHumanReadable();
|
2022-04-09 14:38:47 +00:00
|
|
|
return true;
|
|
|
|
}
|
2022-09-09 21:48:13 +00:00
|
|
|
|
2023-01-17 16:54:08 +00:00
|
|
|
// See if parent can resolve it (these will recurse to ancestors)
|
2022-09-09 21:48:13 +00:00
|
|
|
|
2023-01-17 16:54:08 +00:00
|
|
|
SCH_SHEET_PATH sheetPath = findSelf();
|
2022-09-09 21:48:13 +00:00
|
|
|
|
2023-01-17 16:54:08 +00:00
|
|
|
if( sheetPath.size() >= 2 )
|
|
|
|
{
|
|
|
|
sheetPath.pop_back();
|
|
|
|
|
|
|
|
if( sheetPath.Last()->ResolveTextVar( token, aDepth + 1 ) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( Schematic()->ResolveTextVar( token, aDepth + 1 ) )
|
|
|
|
return true;
|
2022-09-09 21:48:13 +00:00
|
|
|
}
|
2020-05-03 14:52:31 +00:00
|
|
|
|
2020-04-06 13:06:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-07 15:29:01 +00:00
|
|
|
void SCH_SHEET::SwapData( SCH_ITEM* aItem )
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2011-06-07 15:29:01 +00:00
|
|
|
wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
|
2021-10-05 20:15:17 +00:00
|
|
|
wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
|
|
|
|
aItem->GetClass() ) );
|
2011-06-07 15:29:01 +00:00
|
|
|
|
|
|
|
SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
|
|
|
|
|
2015-06-26 13:41:56 +00:00
|
|
|
std::swap( m_pos, sheet->m_pos );
|
|
|
|
std::swap( m_size, sheet->m_size );
|
2020-03-06 12:05:21 +00:00
|
|
|
m_fields.swap( sheet->m_fields );
|
|
|
|
std::swap( m_fieldsAutoplaced, sheet->m_fieldsAutoplaced );
|
2011-06-07 15:29:01 +00:00
|
|
|
m_pins.swap( sheet->m_pins );
|
2008-03-30 16:15:53 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
// Update parent pointers after swapping.
|
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
|
|
|
sheetPin->SetParent( this );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : sheet->m_pins )
|
|
|
|
sheetPin->SetParent( sheet );
|
2020-03-08 02:18:45 +00:00
|
|
|
|
2021-01-24 17:12:13 +00:00
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
field.SetParent( this );
|
|
|
|
|
|
|
|
for( SCH_FIELD& field : sheet->m_fields )
|
|
|
|
field.SetParent( sheet );
|
|
|
|
|
2020-03-08 02:18:45 +00:00
|
|
|
std::swap( m_borderWidth, sheet->m_borderWidth );
|
|
|
|
std::swap( m_borderColor, sheet->m_borderColor );
|
|
|
|
std::swap( m_backgroundColor, sheet->m_backgroundColor );
|
2021-12-06 12:47:18 +00:00
|
|
|
std::swap( m_instances, sheet->m_instances );
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-02 01:19:58 +00:00
|
|
|
void SCH_SHEET::SetFields( const std::vector<SCH_FIELD>& aFields )
|
|
|
|
{
|
|
|
|
m_fields = aFields;
|
|
|
|
int next_id = SHEET_MANDATORY_FIELDS;
|
|
|
|
|
|
|
|
for( int ii = 0; ii < int( m_fields.size() ); )
|
|
|
|
{
|
|
|
|
if( m_fields[ii].GetId() < 0 || m_fields[ii].GetId() >= ssize_t( m_fields.size() ) )
|
|
|
|
m_fields[ii].SetId( next_id++ );
|
|
|
|
|
|
|
|
if( m_fields[ii].GetId() != ii )
|
|
|
|
std::swap( m_fields[ii], m_fields[m_fields[ii].GetId()]);
|
|
|
|
|
|
|
|
if( m_fields[ii].GetId() == ii )
|
|
|
|
++ii;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure that we get the UNIX variant of the file path
|
|
|
|
SetFileName( m_fields[SHEETFILENAME].GetText() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
void SCH_SHEET::AddPin( SCH_SHEET_PIN* aSheetPin )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
wxASSERT( aSheetPin != nullptr );
|
2011-03-30 19:26:05 +00:00
|
|
|
wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-03-25 15:27:15 +00:00
|
|
|
aSheetPin->SetParent( this );
|
2011-03-30 19:26:05 +00:00
|
|
|
m_pins.push_back( aSheetPin );
|
|
|
|
renumberPins();
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void SCH_SHEET::RemovePin( const SCH_SHEET_PIN* aSheetPin )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
wxASSERT( aSheetPin != nullptr );
|
2011-03-30 19:26:05 +00:00
|
|
|
wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
for( auto i = m_pins.begin(); i < m_pins.end(); ++i )
|
2008-03-30 16:15:53 +00:00
|
|
|
{
|
2011-03-30 19:26:05 +00:00
|
|
|
if( *i == aSheetPin )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2011-03-30 19:26:05 +00:00
|
|
|
m_pins.erase( i );
|
|
|
|
renumberPins();
|
2010-06-24 18:31:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-03-30 16:15:53 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
bool SCH_SHEET::HasPin( const wxString& aName ) const
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
2008-03-30 16:15:53 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
if( pin->GetText().CmpNoCase( aName ) == 0 )
|
2010-06-24 18:31:43 +00:00
|
|
|
return true;
|
2008-03-30 16:15:53 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool SCH_SHEET::doIsConnected( const VECTOR2I& aPosition ) const
|
2020-02-04 10:06:30 +00:00
|
|
|
{
|
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
|
|
|
{
|
|
|
|
if( sheetPin->GetPosition() == aPosition )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-17 13:24:22 +00:00
|
|
|
bool SCH_SHEET::IsVerticalOrientation() const
|
2010-09-09 17:37:25 +00:00
|
|
|
{
|
2019-09-02 21:34:50 +00:00
|
|
|
int leftRight = 0;
|
|
|
|
int topBottom = 0;
|
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
switch( pin->GetSide() )
|
2019-09-02 21:34:50 +00:00
|
|
|
{
|
2021-10-05 20:15:17 +00:00
|
|
|
case SHEET_SIDE::LEFT: leftRight++; break;
|
|
|
|
case SHEET_SIDE::RIGHT: leftRight++; break;
|
|
|
|
case SHEET_SIDE::TOP: topBottom++; break;
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::BOTTOM: topBottom++; break;
|
2021-10-05 20:15:17 +00:00
|
|
|
default: break;
|
2019-09-02 21:34:50 +00:00
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
2019-09-02 21:34:50 +00:00
|
|
|
|
|
|
|
return topBottom > 0 && leftRight == 0;
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
bool SCH_SHEET::HasUndefinedPins() const
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
|
|
|
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
|
2019-06-25 23:39:58 +00:00
|
|
|
const SCH_HIERLABEL* HLabel = nullptr;
|
2021-10-05 20:15:17 +00:00
|
|
|
|
|
|
|
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
if( !pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
|
|
|
HLabel = static_cast<SCH_HIERLABEL*>( aItem );
|
|
|
|
break;
|
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
if( HLabel == nullptr ) // Corresponding hierarchical label not found.
|
2010-06-24 18:31:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2021-03-16 20:00:07 +00:00
|
|
|
int bumpToNextGrid( const int aVal, const int aDirection )
|
2011-06-07 15:29:01 +00:00
|
|
|
{
|
2022-09-16 23:42:20 +00:00
|
|
|
constexpr int gridSize = schIUScale.MilsToIU( 50 );
|
2021-03-16 20:00:07 +00:00
|
|
|
|
2021-12-09 16:34:25 +00:00
|
|
|
int base = aVal / gridSize;
|
|
|
|
int excess = abs( aVal % gridSize );
|
|
|
|
|
|
|
|
if( aDirection > 0 )
|
|
|
|
{
|
|
|
|
return ( base + 1 ) * gridSize;
|
|
|
|
}
|
|
|
|
else if( excess > 0 )
|
|
|
|
{
|
|
|
|
return ( base ) * gridSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return ( base - 1 ) * gridSize;
|
|
|
|
}
|
2021-03-16 20:00:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-26 19:56:37 +00:00
|
|
|
int SCH_SHEET::GetMinWidth( bool aFromLeft ) const
|
2021-03-16 20:00:07 +00:00
|
|
|
{
|
|
|
|
int pinsLeft = m_pos.x + m_size.x;
|
|
|
|
int pinsRight = m_pos.x;
|
2011-06-07 15:29:01 +00:00
|
|
|
|
|
|
|
for( size_t i = 0; i < m_pins.size(); i++ )
|
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
SHEET_SIDE edge = m_pins[i]->GetSide();
|
2011-06-07 15:29:01 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
if( edge == SHEET_SIDE::TOP || edge == SHEET_SIDE::BOTTOM )
|
2011-06-07 15:29:01 +00:00
|
|
|
{
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I pinRect = m_pins[i]->GetBoundingBox();
|
2011-06-07 15:29:01 +00:00
|
|
|
|
2021-03-16 20:00:07 +00:00
|
|
|
pinsLeft = std::min( pinsLeft, pinRect.GetLeft() );
|
|
|
|
pinsRight = std::max( pinsRight, pinRect.GetRight() );
|
2011-06-07 15:29:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-16 20:00:07 +00:00
|
|
|
pinsLeft = bumpToNextGrid( pinsLeft, -1 );
|
|
|
|
pinsRight = bumpToNextGrid( pinsRight, 1 );
|
|
|
|
|
|
|
|
int pinMinWidth;
|
|
|
|
|
|
|
|
if( pinsLeft >= pinsRight )
|
|
|
|
pinMinWidth = 0;
|
2023-01-26 19:56:37 +00:00
|
|
|
else if( aFromLeft )
|
2023-01-26 16:13:25 +00:00
|
|
|
pinMinWidth = pinsRight - m_pos.x;
|
2023-01-26 19:56:37 +00:00
|
|
|
else
|
|
|
|
pinMinWidth = m_pos.x + m_size.x - pinsLeft;
|
2021-03-16 20:00:07 +00:00
|
|
|
|
2022-09-16 23:42:20 +00:00
|
|
|
return std::max( pinMinWidth, schIUScale.MilsToIU( MIN_SHEET_WIDTH ) );
|
2011-06-07 15:29:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-26 19:56:37 +00:00
|
|
|
int SCH_SHEET::GetMinHeight( bool aFromTop ) const
|
2011-06-07 15:29:01 +00:00
|
|
|
{
|
2021-03-16 20:00:07 +00:00
|
|
|
int pinsTop = m_pos.y + m_size.y;
|
|
|
|
int pinsBottom = m_pos.y;
|
2011-06-07 15:29:01 +00:00
|
|
|
|
|
|
|
for( size_t i = 0; i < m_pins.size(); i++ )
|
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
SHEET_SIDE edge = m_pins[i]->GetSide();
|
2017-08-23 16:06:33 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
if( edge == SHEET_SIDE::RIGHT || edge == SHEET_SIDE::LEFT )
|
2017-08-23 16:06:33 +00:00
|
|
|
{
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I pinRect = m_pins[i]->GetBoundingBox();
|
2011-06-07 15:29:01 +00:00
|
|
|
|
2021-03-16 20:00:07 +00:00
|
|
|
pinsTop = std::min( pinsTop, pinRect.GetTop() );
|
|
|
|
pinsBottom = std::max( pinsBottom, pinRect.GetBottom() );
|
2017-08-23 16:06:33 +00:00
|
|
|
}
|
2011-06-07 15:29:01 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 20:00:07 +00:00
|
|
|
pinsTop = bumpToNextGrid( pinsTop, -1 );
|
|
|
|
pinsBottom = bumpToNextGrid( pinsBottom, 1 );
|
|
|
|
|
|
|
|
int pinMinHeight;
|
|
|
|
|
|
|
|
if( pinsTop >= pinsBottom )
|
|
|
|
pinMinHeight = 0;
|
2023-01-26 19:56:37 +00:00
|
|
|
else if( aFromTop )
|
2023-01-26 16:13:25 +00:00
|
|
|
pinMinHeight = pinsBottom - m_pos.y;
|
2023-01-26 19:56:37 +00:00
|
|
|
else
|
|
|
|
pinMinHeight = m_pos.y + m_size.y - pinsTop;
|
2021-03-16 20:00:07 +00:00
|
|
|
|
2022-09-16 23:42:20 +00:00
|
|
|
return std::max( pinMinHeight, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) );
|
2011-06-07 15:29:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
void SCH_SHEET::CleanupSheet()
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2021-10-05 20:15:17 +00:00
|
|
|
std::vector<SCH_SHEET_PIN*> pins = m_pins;
|
|
|
|
|
|
|
|
m_pins.clear();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2021-10-05 20:15:17 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : pins )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
|
2021-07-16 20:13:26 +00:00
|
|
|
const SCH_HIERLABEL* HLabel = nullptr;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2021-10-05 20:15:17 +00:00
|
|
|
if( pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) == 0 )
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
|
|
|
HLabel = static_cast<SCH_HIERLABEL*>( aItem );
|
|
|
|
break;
|
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
|
2021-10-05 20:15:17 +00:00
|
|
|
if( HLabel )
|
|
|
|
m_pins.push_back( pin );
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_SHEET_PIN* SCH_SHEET::GetPin( const VECTOR2I& aPosition )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
if( pin->HitTest( aPosition ) )
|
|
|
|
return pin;
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
int SCH_SHEET::GetPenWidth() const
|
2009-06-30 19:21:41 +00:00
|
|
|
{
|
2021-08-17 12:19:23 +00:00
|
|
|
if( GetBorderWidth() > 0 )
|
|
|
|
return GetBorderWidth();
|
|
|
|
|
|
|
|
if( Schematic() )
|
|
|
|
return Schematic()->Settings().m_DefaultLineWidth;
|
|
|
|
|
2022-09-16 23:42:20 +00:00
|
|
|
return schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
|
2009-06-30 19:21:41 +00:00
|
|
|
}
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2022-04-18 05:59:59 +00:00
|
|
|
void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool /* aManual */ )
|
2010-10-20 19:43:58 +00:00
|
|
|
{
|
2022-05-14 12:12:03 +00:00
|
|
|
VECTOR2I textSize = m_fields[SHEETNAME].GetTextSize();
|
|
|
|
int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
|
|
|
|
int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
|
2011-12-08 15:45:01 +00:00
|
|
|
|
2010-10-20 19:43:58 +00:00
|
|
|
if( IsVerticalOrientation() )
|
2020-03-06 20:02:58 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( -margin, m_size.y ) );
|
2021-12-28 22:13:54 +00:00
|
|
|
m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
|
|
m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
|
2022-01-13 12:29:46 +00:00
|
|
|
m_fields[ SHEETNAME ].SetTextAngle( ANGLE_VERTICAL );
|
2020-03-06 20:02:58 +00:00
|
|
|
}
|
2010-10-20 19:43:58 +00:00
|
|
|
else
|
2020-03-06 20:02:58 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( 0, -margin ) );
|
2021-12-28 22:13:54 +00:00
|
|
|
m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
|
|
m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
|
2022-01-13 12:29:46 +00:00
|
|
|
m_fields[ SHEETNAME ].SetTextAngle( ANGLE_HORIZONTAL );
|
2020-03-06 20:02:58 +00:00
|
|
|
}
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
textSize = m_fields[ SHEETFILENAME ].GetTextSize();
|
2020-04-14 12:25:00 +00:00
|
|
|
margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.4 );
|
2011-05-25 10:42:56 +00:00
|
|
|
|
2010-10-20 19:43:58 +00:00
|
|
|
if( IsVerticalOrientation() )
|
2020-03-06 20:02:58 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( m_size.x + margin, m_size.y ) );
|
2021-12-28 22:13:54 +00:00
|
|
|
m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
|
|
m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
2022-01-13 12:29:46 +00:00
|
|
|
m_fields[ SHEETFILENAME ].SetTextAngle( ANGLE_VERTICAL );
|
2020-03-06 20:02:58 +00:00
|
|
|
}
|
2010-10-20 19:43:58 +00:00
|
|
|
else
|
2020-03-06 20:02:58 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( 0, m_size.y + margin ) );
|
2021-12-28 22:13:54 +00:00
|
|
|
m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
|
|
m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
2022-01-13 12:29:46 +00:00
|
|
|
m_fields[ SHEETFILENAME ].SetTextAngle( ANGLE_HORIZONTAL );
|
2020-03-06 20:02:58 +00:00
|
|
|
}
|
2020-03-06 12:05:21 +00:00
|
|
|
|
|
|
|
m_fieldsAutoplaced = FIELDS_AUTOPLACED_AUTO;
|
2010-10-20 19:43:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-10-21 12:50:31 +00:00
|
|
|
void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
|
|
|
|
{
|
2021-10-12 20:05:37 +00:00
|
|
|
aCount = 7;
|
|
|
|
aLayers[0] = LAYER_HIERLABEL;
|
|
|
|
aLayers[1] = LAYER_SHEETNAME;
|
|
|
|
aLayers[2] = LAYER_SHEETFILENAME;
|
|
|
|
aLayers[3] = LAYER_SHEETFIELDS;
|
|
|
|
aLayers[4] = LAYER_SHEET;
|
|
|
|
aLayers[5] = LAYER_SHEET_BACKGROUND;
|
|
|
|
aLayers[6] = LAYER_SELECTION_SHADOWS;
|
2018-10-21 12:50:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-30 23:28:18 +00:00
|
|
|
const BOX2I SCH_SHEET::GetBodyBoundingBox() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I end;
|
2022-08-30 23:28:18 +00:00
|
|
|
BOX2I box( m_pos, m_size );
|
2020-04-14 12:25:00 +00:00
|
|
|
int lineWidth = GetPenWidth();
|
2020-02-20 21:29:21 +00:00
|
|
|
int textLength = 0;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2011-04-29 12:42:04 +00:00
|
|
|
// Calculate bounding box X size:
|
2020-02-20 21:29:21 +00:00
|
|
|
end.x = std::max( m_size.x, textLength );
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2011-04-29 12:42:04 +00:00
|
|
|
// Calculate bounding box pos:
|
2011-12-08 15:45:01 +00:00
|
|
|
end.y = m_size.y;
|
|
|
|
end += m_pos;
|
2011-04-29 12:42:04 +00:00
|
|
|
|
|
|
|
box.SetEnd( end );
|
|
|
|
box.Inflate( lineWidth / 2 );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
return box;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-31 09:15:42 +00:00
|
|
|
const BOX2I SCH_SHEET::GetBoundingBox() const
|
2020-03-06 20:02:58 +00:00
|
|
|
{
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I bbox = GetBodyBoundingBox();
|
2020-03-06 20:02:58 +00:00
|
|
|
|
|
|
|
for( const SCH_FIELD& field : m_fields )
|
2022-08-31 09:15:42 +00:00
|
|
|
bbox.Merge( field.GetBoundingBox() );
|
2020-03-06 12:05:21 +00:00
|
|
|
|
2022-08-31 09:15:42 +00:00
|
|
|
return bbox;
|
2008-03-30 10:14:37 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I SCH_SHEET::GetRotationCenter() const
|
2019-09-02 21:34:50 +00:00
|
|
|
{
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I box( m_pos, m_size );
|
2022-01-01 06:04:08 +00:00
|
|
|
return box.GetCenter();
|
2019-09-02 21:34:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-15 17:03:27 +00:00
|
|
|
int SCH_SHEET::SymbolCount() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
int n = 0;
|
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SYMBOL_T ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2020-11-15 17:03:27 +00:00
|
|
|
if( symbol->GetField( VALUE_FIELD )->GetText().GetChar( 0 ) != '#' )
|
2019-06-25 23:39:58 +00:00
|
|
|
n++;
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2019-06-25 23:39:58 +00:00
|
|
|
|
2020-09-06 12:04:52 +00:00
|
|
|
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
|
2020-11-15 17:03:27 +00:00
|
|
|
n += static_cast<const SCH_SHEET*>( aItem )->SymbolCount();
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
return n;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen )
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2019-11-17 16:43:05 +00:00
|
|
|
// Only check the root sheet once and don't recurse.
|
|
|
|
if( !GetParent() )
|
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
if( m_screen && m_screen->GetFileName().Cmp( aFilename ) == 0 )
|
2019-11-17 16:43:05 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
*aScreen = m_screen;
|
2019-11-17 16:43:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-05 20:15:17 +00:00
|
|
|
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
|
|
|
|
SCH_SCREEN* screen = sheet->m_screen;
|
2011-01-20 16:34:57 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
// Must use the screen's path (which is always absolute) rather than the
|
|
|
|
// sheet's (which could be relative).
|
|
|
|
if( screen && screen->GetFileName().Cmp( aFilename ) == 0 )
|
|
|
|
{
|
|
|
|
*aScreen = screen;
|
|
|
|
return true;
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2011-01-20 16:34:57 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
if( sheet->SearchHierarchy( aFilename, aScreen ) )
|
|
|
|
return true;
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
return false;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2016-02-15 20:24:59 +00:00
|
|
|
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
|
|
|
|
{
|
|
|
|
if( m_screen )
|
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
aList->push_back( this );
|
2016-02-15 20:24:59 +00:00
|
|
|
|
|
|
|
if( m_screen == aScreen )
|
|
|
|
return true;
|
|
|
|
|
2022-07-29 21:02:35 +00:00
|
|
|
for( EDA_ITEM* item : m_screen->Items().OfType( SCH_SHEET_T ) )
|
2016-02-15 20:24:59 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
|
2016-02-15 20:24:59 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
if( sheet->LocatePathOfScreen( aScreen, aList ) )
|
|
|
|
return true;
|
2016-02-15 20:24:59 +00:00
|
|
|
}
|
|
|
|
|
2016-02-27 19:35:45 +00:00
|
|
|
aList->pop_back();
|
2016-02-15 20:24:59 +00:00
|
|
|
}
|
2016-02-27 19:35:45 +00:00
|
|
|
|
2016-02-15 20:24:59 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
int SCH_SHEET::CountSheets() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
int count = 1; //1 = this!!
|
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_screen )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2021-07-07 20:52:55 +00:00
|
|
|
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
|
2019-06-25 23:39:58 +00:00
|
|
|
count += static_cast<SCH_SHEET*>( aItem )->CountSheets();
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
2019-06-25 23:39:58 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
return count;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-26 23:22:32 +00:00
|
|
|
void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2020-12-08 05:50:25 +00:00
|
|
|
aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText() );
|
2020-03-05 12:20:38 +00:00
|
|
|
|
2020-10-24 22:29:29 +00:00
|
|
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
|
2020-05-13 02:00:37 +00:00
|
|
|
{
|
2020-10-24 22:29:29 +00:00
|
|
|
SCH_SHEET_PATH path = schframe->GetCurrentSheet();
|
|
|
|
path.push_back( this );
|
2020-05-13 02:00:37 +00:00
|
|
|
|
2022-12-12 11:00:18 +00:00
|
|
|
aList.emplace_back( _( "Hierarchical Path" ), path.PathHumanReadable( false, true ) );
|
2020-05-13 02:00:37 +00:00
|
|
|
}
|
2020-10-24 22:29:29 +00:00
|
|
|
|
2020-12-08 05:50:25 +00:00
|
|
|
aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText() );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET::Move( const VECTOR2I& aMoveVector )
|
2021-04-06 21:15:49 +00:00
|
|
|
{
|
|
|
|
m_pos += aMoveVector;
|
|
|
|
|
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
|
|
|
pin->Move( aMoveVector );
|
|
|
|
|
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
field.Move( aMoveVector );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET::Rotate( const VECTOR2I& aCenter )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I prev = m_pos;
|
2020-03-06 12:05:21 +00:00
|
|
|
|
2022-01-16 21:15:20 +00:00
|
|
|
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
|
|
|
RotatePoint( &m_size.x, &m_size.y, ANGLE_90 );
|
2010-09-09 17:37:25 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_size.x < 0 )
|
2010-09-09 17:37:25 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
m_pos.x += m_size.x;
|
2015-06-26 13:41:56 +00:00
|
|
|
m_size.x = -m_size.x;
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
2010-09-09 17:37:25 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
if( m_size.y < 0 )
|
2010-09-09 17:37:25 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
m_pos.y += m_size.y;
|
2015-06-26 13:41:56 +00:00
|
|
|
m_size.y = -m_size.y;
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
2010-09-09 17:37:25 +00:00
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
// Pins must be rotated first as that's how we determine vertical vs horizontal
|
|
|
|
// orientation for auto-placement
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2021-03-19 19:55:59 +00:00
|
|
|
sheetPin->Rotate( aCenter );
|
2020-03-06 20:02:58 +00:00
|
|
|
|
|
|
|
if( m_fieldsAutoplaced == FIELDS_AUTOPLACED_AUTO )
|
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
2020-03-06 20:02:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-05 21:41:51 +00:00
|
|
|
// Move the fields to the new position because the parent itself has moved.
|
2020-03-06 20:02:58 +00:00
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
{
|
2021-12-29 21:30:11 +00:00
|
|
|
VECTOR2I pos = field.GetTextPos();
|
2020-03-06 20:02:58 +00:00
|
|
|
pos.x -= prev.x - m_pos.x;
|
|
|
|
pos.y -= prev.y - m_pos.y;
|
|
|
|
field.SetTextPos( pos );
|
|
|
|
}
|
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
2010-09-09 17:37:25 +00:00
|
|
|
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
void SCH_SHEET::MirrorVertically( int aCenter )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-10-28 20:44:58 +00:00
|
|
|
int dy = m_pos.y;
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
MIRROR( m_pos.y, aCenter );
|
2011-12-08 15:45:01 +00:00
|
|
|
m_pos.y -= m_size.y;
|
2021-10-28 20:44:58 +00:00
|
|
|
dy -= m_pos.y; // 0,dy is the move vector for this transform
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2021-02-16 20:45:25 +00:00
|
|
|
sheetPin->MirrorVertically( aCenter );
|
2021-10-28 20:44:58 +00:00
|
|
|
|
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
{
|
2021-12-29 21:30:11 +00:00
|
|
|
VECTOR2I pos = field.GetTextPos();
|
2021-10-28 20:44:58 +00:00
|
|
|
pos.y -= dy;
|
|
|
|
field.SetTextPos( pos );
|
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
2010-09-09 17:37:25 +00:00
|
|
|
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
void SCH_SHEET::MirrorHorizontally( int aCenter )
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
2021-10-28 20:44:58 +00:00
|
|
|
int dx = m_pos.x;
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
MIRROR( m_pos.x, aCenter );
|
2011-12-08 15:45:01 +00:00
|
|
|
m_pos.x -= m_size.x;
|
2021-10-28 20:44:58 +00:00
|
|
|
dx -= m_pos.x; // dx,0 is the move vector for this transform
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2021-02-16 20:45:25 +00:00
|
|
|
sheetPin->MirrorHorizontally( aCenter );
|
2021-10-28 20:44:58 +00:00
|
|
|
|
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
{
|
2021-12-29 21:30:11 +00:00
|
|
|
VECTOR2I pos = field.GetTextPos();
|
2021-10-28 20:44:58 +00:00
|
|
|
pos.x -= dx;
|
|
|
|
field.SetTextPos( pos );
|
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
2020-03-08 02:18:45 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET::SetPosition( const VECTOR2I& aPosition )
|
2015-02-28 16:56:09 +00:00
|
|
|
{
|
|
|
|
// Remember the sheet and all pin sheet positions must be
|
|
|
|
// modified. So use Move function to do that.
|
|
|
|
Move( aPosition - m_pos );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
void SCH_SHEET::Resize( const VECTOR2I& aSize )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
if( aSize == m_size )
|
2010-06-24 18:31:43 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
m_size = aSize;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-03-06 12:05:21 +00:00
|
|
|
// Move the fields if we're in autoplace mode
|
|
|
|
if( m_fieldsAutoplaced == FIELDS_AUTOPLACED_AUTO )
|
2021-07-16 20:13:26 +00:00
|
|
|
AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
2020-03-06 12:05:21 +00:00
|
|
|
|
|
|
|
// Move the sheet labels according to the new sheet size.
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
|
|
|
sheetPin->ConstrainOnEdge( sheetPin->GetPosition() );
|
2009-07-27 14:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-05 02:40:38 +00:00
|
|
|
bool SCH_SHEET::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
2020-03-06 12:05:21 +00:00
|
|
|
// Sheets are searchable via the child field and pin item text.
|
2010-10-20 19:43:58 +00:00
|
|
|
return false;
|
2010-03-16 18:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
void SCH_SHEET::renumberPins()
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2011-03-30 19:26:05 +00:00
|
|
|
int id = 2;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
pin->SetNumber( id );
|
2011-03-30 19:26:05 +00:00
|
|
|
id++;
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-09 21:48:13 +00:00
|
|
|
SCH_SHEET_PATH SCH_SHEET::findSelf() const
|
2022-07-03 15:21:30 +00:00
|
|
|
{
|
2022-09-09 21:48:13 +00:00
|
|
|
wxCHECK_MSG( Schematic(), SCH_SHEET_PATH(), "Can't call findSelf without a schematic" );
|
2022-07-03 15:21:30 +00:00
|
|
|
|
2022-09-09 21:48:13 +00:00
|
|
|
SCH_SHEET_PATH sheetPath = Schematic()->CurrentSheet();
|
2022-07-03 15:21:30 +00:00
|
|
|
|
2022-09-09 21:48:13 +00:00
|
|
|
while( !sheetPath.empty() && sheetPath.Last() != this )
|
|
|
|
sheetPath.pop_back();
|
2022-07-03 15:21:30 +00:00
|
|
|
|
2022-09-09 21:48:13 +00:00
|
|
|
if( sheetPath.empty() )
|
|
|
|
{
|
|
|
|
// If we weren't in the hierarchy, then we must be a child of the current sheet.
|
|
|
|
sheetPath = Schematic()->CurrentSheet();
|
|
|
|
sheetPath.push_back( const_cast<SCH_SHEET*>( this ) );
|
|
|
|
}
|
2022-07-03 15:21:30 +00:00
|
|
|
|
2022-08-27 18:14:57 +00:00
|
|
|
return sheetPath;
|
2022-07-03 15:21:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
void SCH_SHEET::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
wxCHECK2_MSG( sheetPin->Type() == SCH_SHEET_PIN_T, continue,
|
2010-11-03 14:13:15 +00:00
|
|
|
wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
|
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
sheetPin->GetEndPoints( aItemList );
|
2010-11-03 14:13:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-17 02:33:16 +00:00
|
|
|
bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
|
|
|
|
const SCH_SHEET_PATH* aPath )
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2018-10-24 22:49:51 +00:00
|
|
|
bool changed = false;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
|
|
|
changed |= sheetPin->UpdateDanglingState( aItemList );
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2018-10-24 22:49:51 +00:00
|
|
|
return changed;
|
2010-11-03 14:13:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
std::vector<VECTOR2I> SCH_SHEET::GetConnectionPoints() const
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
std::vector<VECTOR2I> retval;
|
2020-09-08 13:27:13 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2020-09-08 13:27:13 +00:00
|
|
|
retval.push_back( sheetPin->GetPosition() );
|
|
|
|
|
|
|
|
return retval;
|
2010-11-03 14:13:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
INSPECT_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData,
|
2022-08-21 19:54:07 +00:00
|
|
|
const std::vector<KICAD_T>& aScanTypes )
|
2010-12-10 19:47:44 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
for( KICAD_T scanType : aScanTypes )
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
|
|
|
// If caller wants to inspect my type
|
2022-08-20 09:27:35 +00:00
|
|
|
if( scanType == SCH_LOCATE_ANY_T || scanType == Type() )
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2022-07-30 00:00:39 +00:00
|
|
|
if( INSPECT_RESULT::QUIT == aInspector( this, nullptr ) )
|
|
|
|
return INSPECT_RESULT::QUIT;
|
2011-03-25 19:16:05 +00:00
|
|
|
}
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_FIELD_T )
|
2020-03-06 20:02:58 +00:00
|
|
|
{
|
|
|
|
// Test the sheet fields.
|
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
{
|
2022-07-30 00:00:39 +00:00
|
|
|
if( INSPECT_RESULT::QUIT == aInspector( &field, this ) )
|
|
|
|
return INSPECT_RESULT::QUIT;
|
2020-03-06 20:02:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_SHEET_PIN_T )
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2011-12-01 16:49:28 +00:00
|
|
|
// Test the sheet labels.
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2022-07-30 00:00:39 +00:00
|
|
|
if( INSPECT_RESULT::QUIT == aInspector( sheetPin, this ) )
|
|
|
|
return INSPECT_RESULT::QUIT;
|
2011-03-25 19:16:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-30 00:00:39 +00:00
|
|
|
return INSPECT_RESULT::CONTINUE;
|
2011-03-25 19:16:05 +00:00
|
|
|
}
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2020-11-17 16:02:47 +00:00
|
|
|
void SCH_SHEET::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
|
|
|
|
{
|
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
aFunction( &field );
|
|
|
|
|
|
|
|
for( SCH_SHEET_PIN* pin : m_pins )
|
|
|
|
aFunction( pin );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString SCH_SHEET::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2020-09-19 16:12:00 +00:00
|
|
|
return wxString::Format( _( "Hierarchical Sheet %s" ),
|
|
|
|
m_fields[ SHEETNAME ].GetText() );
|
2011-03-25 19:16:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS SCH_SHEET::GetMenuImage() const
|
2017-02-20 12:20:39 +00:00
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
return BITMAPS::add_hierarchical_subsheet;
|
2017-02-20 12:20:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2022-08-30 23:28:18 +00:00
|
|
|
BOX2I rect = GetBodyBoundingBox();
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
return rect.Contains( aPosition );
|
2010-12-10 19:47:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool SCH_SHEET::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
2010-12-10 19:47:44 +00:00
|
|
|
{
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I rect = aRect;
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
if( aContained )
|
2020-03-06 20:02:58 +00:00
|
|
|
return rect.Contains( GetBodyBoundingBox() );
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
return rect.Intersects( GetBodyBoundingBox() );
|
2010-12-10 19:47:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-10 19:49:25 +00:00
|
|
|
void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
2011-06-17 13:24:22 +00:00
|
|
|
{
|
2022-02-10 19:49:25 +00:00
|
|
|
if( aBackground && !aPlotter->GetColorMode() )
|
|
|
|
return;
|
|
|
|
|
2020-12-13 22:42:29 +00:00
|
|
|
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
|
|
|
bool override = settings ? settings->m_OverrideItemColors : false;
|
|
|
|
COLOR4D borderColor = GetBorderColor();
|
|
|
|
COLOR4D backgroundColor = GetBackgroundColor();
|
2020-06-22 00:43:47 +00:00
|
|
|
|
|
|
|
if( override || borderColor == COLOR4D::UNSPECIFIED )
|
2020-04-14 12:25:00 +00:00
|
|
|
borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
|
2020-04-05 11:29:58 +00:00
|
|
|
|
2020-06-22 00:43:47 +00:00
|
|
|
if( override || backgroundColor == COLOR4D::UNSPECIFIED )
|
|
|
|
backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
|
|
|
|
|
2022-02-10 19:49:25 +00:00
|
|
|
if( aBackground )
|
2021-08-04 14:47:41 +00:00
|
|
|
{
|
|
|
|
aPlotter->SetColor( backgroundColor );
|
2021-07-18 23:08:54 +00:00
|
|
|
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::FILLED_SHAPE, 1 );
|
2021-08-04 14:47:41 +00:00
|
|
|
}
|
2022-02-10 19:49:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
aPlotter->SetColor( borderColor );
|
2020-06-22 00:43:47 +00:00
|
|
|
|
2022-02-10 19:49:25 +00:00
|
|
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
|
|
|
aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::NO_FILL, penWidth );
|
|
|
|
}
|
2011-06-17 13:24:22 +00:00
|
|
|
|
2022-07-03 15:21:30 +00:00
|
|
|
// Make the sheet object a clickable hyperlink (e.g. for PDF plotter)
|
2022-09-05 22:28:44 +00:00
|
|
|
std::vector<wxString> properties;
|
|
|
|
|
2022-12-16 22:48:36 +00:00
|
|
|
properties.emplace_back( EDA_TEXT::GotoPageHref( findSelf().GetPageNumber() ) );
|
2022-08-27 18:14:57 +00:00
|
|
|
|
2022-09-05 22:28:44 +00:00
|
|
|
for( const SCH_FIELD& field : GetFields() )
|
|
|
|
{
|
|
|
|
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
|
|
|
|
field.GetName(),
|
|
|
|
field.GetShownText() ) );
|
2022-07-03 15:21:30 +00:00
|
|
|
}
|
|
|
|
|
2022-09-05 22:28:44 +00:00
|
|
|
aPlotter->HyperlinkMenu( GetBoundingBox(), properties );
|
|
|
|
|
2021-08-17 12:19:23 +00:00
|
|
|
// Plot sheet pins
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
2022-02-10 19:49:25 +00:00
|
|
|
sheetPin->Plot( aPlotter, aBackground );
|
2021-08-17 11:30:13 +00:00
|
|
|
|
|
|
|
// Plot the fields
|
|
|
|
for( const SCH_FIELD& field : m_fields )
|
2022-02-10 19:49:25 +00:00
|
|
|
field.Plot( aPlotter, aBackground );
|
2011-06-17 13:24:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
|
2020-12-20 18:18:54 +00:00
|
|
|
{
|
|
|
|
wxDC* DC = aSettings->GetPrintDC();
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I pos = m_pos + aOffset;
|
2020-12-20 18:18:54 +00:00
|
|
|
int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
|
|
|
const auto* settings = dynamic_cast<const KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
|
|
|
|
bool override = settings && settings->m_OverrideItemColors;
|
|
|
|
COLOR4D border = GetBorderColor();
|
|
|
|
COLOR4D background = GetBackgroundColor();
|
2020-12-13 22:42:29 +00:00
|
|
|
|
|
|
|
if( override || border == COLOR4D::UNSPECIFIED )
|
|
|
|
border = aSettings->GetLayerColor( LAYER_SHEET );
|
|
|
|
|
|
|
|
if( override || background == COLOR4D::UNSPECIFIED )
|
|
|
|
background = aSettings->GetLayerColor( LAYER_SHEET_BACKGROUND );
|
|
|
|
|
2020-12-15 17:10:24 +00:00
|
|
|
if( GetGRForceBlackPenState() ) // printing in black & white
|
|
|
|
background = COLOR4D::UNSPECIFIED;
|
|
|
|
|
2020-12-13 22:42:29 +00:00
|
|
|
if( background != COLOR4D::UNSPECIFIED )
|
2022-01-28 22:51:34 +00:00
|
|
|
GRFilledRect( DC, pos, pos + m_size, 0, background, background );
|
2020-12-13 22:42:29 +00:00
|
|
|
|
2022-01-28 22:51:34 +00:00
|
|
|
GRRect( DC, pos, pos + m_size, lineWidth, border );
|
2020-12-13 22:42:29 +00:00
|
|
|
|
|
|
|
for( SCH_FIELD& field : m_fields )
|
|
|
|
field.Print( aSettings, aOffset );
|
|
|
|
|
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
|
|
|
sheetPin->Print( aSettings, aOffset );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem )
|
2012-01-09 20:26:55 +00:00
|
|
|
{
|
|
|
|
wxCHECK_MSG( Type() == aItem.Type(), *this,
|
|
|
|
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
|
|
|
|
GetClass() );
|
|
|
|
|
|
|
|
if( &aItem != this )
|
|
|
|
{
|
|
|
|
SCH_ITEM::operator=( aItem );
|
|
|
|
|
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
|
|
|
|
|
|
|
|
m_pos = sheet->m_pos;
|
|
|
|
m_size = sheet->m_size;
|
2020-03-06 12:05:21 +00:00
|
|
|
m_fields = sheet->m_fields;
|
2012-01-09 20:26:55 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : sheet->m_pins )
|
2012-01-09 20:26:55 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
|
|
|
|
m_pins.back()->SetParent( this );
|
2012-01-09 20:26:55 +00:00
|
|
|
}
|
2020-10-18 20:30:37 +00:00
|
|
|
|
2021-12-06 12:47:18 +00:00
|
|
|
for( const SCH_SHEET_INSTANCE& instance : sheet->m_instances )
|
|
|
|
m_instances.emplace_back( instance );
|
2012-01-09 20:26:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-28 20:33:23 +00:00
|
|
|
bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const
|
|
|
|
{
|
|
|
|
if( Type() != aItem.Type() )
|
|
|
|
return Type() < aItem.Type();
|
|
|
|
|
|
|
|
auto sheet = static_cast<const SCH_SHEET*>( &aItem );
|
|
|
|
|
2020-11-24 22:16:41 +00:00
|
|
|
if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText() )
|
2020-03-06 12:05:21 +00:00
|
|
|
return m_fields[ SHEETNAME ].GetText() < sheet->m_fields[ SHEETNAME ].GetText();
|
2020-01-28 20:33:23 +00:00
|
|
|
|
2020-11-24 22:16:41 +00:00
|
|
|
if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText() )
|
2020-03-06 12:05:21 +00:00
|
|
|
return m_fields[ SHEETFILENAME ].GetText() < sheet->m_fields[ SHEETFILENAME ].GetText();
|
2020-01-28 20:33:23 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-25 16:04:45 +00:00
|
|
|
bool SCH_SHEET::addInstance( const SCH_SHEET_PATH& aSheetPath )
|
2020-10-18 20:30:37 +00:00
|
|
|
{
|
2021-12-08 18:36:23 +00:00
|
|
|
wxCHECK( aSheetPath.IsFullPath(), false );
|
2022-11-22 19:35:27 +00:00
|
|
|
wxCHECK( !aSheetPath.Last() || ( aSheetPath.Last()->m_Uuid != m_Uuid ), false );
|
2021-12-06 12:47:18 +00:00
|
|
|
|
|
|
|
for( const SCH_SHEET_INSTANCE& instance : m_instances )
|
|
|
|
{
|
|
|
|
// if aSheetPath is found, nothing to do:
|
2022-10-01 12:44:21 +00:00
|
|
|
if( instance.m_Path == aSheetPath.Path() )
|
2021-12-06 12:47:18 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-12-08 18:36:23 +00:00
|
|
|
wxLogTrace( traceSchSheetPaths, wxT( "Adding instance `%s` to sheet `%s`." ),
|
2022-10-01 12:44:21 +00:00
|
|
|
aSheetPath.Path().AsString(),
|
2023-02-12 21:29:26 +00:00
|
|
|
( GetName().IsEmpty() ) ? wxString( wxT( "root" ) ) : GetName() );
|
2021-12-08 18:36:23 +00:00
|
|
|
|
2021-12-06 12:47:18 +00:00
|
|
|
SCH_SHEET_INSTANCE instance;
|
|
|
|
|
2022-10-01 12:44:21 +00:00
|
|
|
instance.m_Path = aSheetPath.Path();
|
2021-12-06 12:47:18 +00:00
|
|
|
|
|
|
|
// This entry does not exist: add it with an empty page number.
|
|
|
|
m_instances.emplace_back( instance );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-25 16:04:45 +00:00
|
|
|
bool SCH_SHEET::getInstance( SCH_SHEET_INSTANCE& aInstance, const KIID_PATH& aSheetPath,
|
|
|
|
bool aTestFromEnd ) const
|
|
|
|
{
|
|
|
|
for( const SCH_SHEET_INSTANCE& instance : m_instances )
|
|
|
|
{
|
|
|
|
if( !aTestFromEnd )
|
|
|
|
{
|
|
|
|
if( instance.m_Path == aSheetPath )
|
|
|
|
{
|
|
|
|
aInstance = instance;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( instance.m_Path.EndsWith( aSheetPath ) )
|
|
|
|
{
|
|
|
|
aInstance = instance;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-09 15:02:16 +00:00
|
|
|
bool SCH_SHEET::HasRootInstance() const
|
|
|
|
{
|
|
|
|
for( const SCH_SHEET_INSTANCE& instance : m_instances )
|
|
|
|
{
|
|
|
|
if( instance.m_Path.size() == 0 )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const SCH_SHEET_INSTANCE& SCH_SHEET::GetRootInstance() const
|
|
|
|
{
|
|
|
|
for( const SCH_SHEET_INSTANCE& instance : m_instances )
|
|
|
|
{
|
|
|
|
if( instance.m_Path.size() == 0 )
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxFAIL;
|
|
|
|
|
|
|
|
static SCH_SHEET_INSTANCE dummy;
|
|
|
|
|
|
|
|
return dummy;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-22 19:35:27 +00:00
|
|
|
wxString SCH_SHEET::getPageNumber( const SCH_SHEET_PATH& aSheetPath ) const
|
2021-12-06 12:47:18 +00:00
|
|
|
{
|
2021-12-08 18:36:23 +00:00
|
|
|
wxCHECK( aSheetPath.IsFullPath(), wxEmptyString );
|
2022-11-22 19:35:27 +00:00
|
|
|
wxCHECK( !aSheetPath.Last() || ( aSheetPath.Last()->m_Uuid != m_Uuid ), wxEmptyString );
|
2021-12-08 18:36:23 +00:00
|
|
|
|
2021-12-06 12:47:18 +00:00
|
|
|
wxString pageNumber;
|
2022-10-01 12:44:21 +00:00
|
|
|
KIID_PATH path = aSheetPath.Path();
|
2021-12-06 12:47:18 +00:00
|
|
|
|
|
|
|
for( const SCH_SHEET_INSTANCE& instance : m_instances )
|
|
|
|
{
|
|
|
|
if( instance.m_Path == path )
|
|
|
|
{
|
|
|
|
pageNumber = instance.m_PageNumber;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pageNumber;
|
2020-10-18 20:30:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-22 19:35:27 +00:00
|
|
|
void SCH_SHEET::setPageNumber( const SCH_SHEET_PATH& aSheetPath, const wxString& aPageNumber )
|
2020-10-18 20:30:37 +00:00
|
|
|
{
|
2021-12-08 18:36:23 +00:00
|
|
|
wxCHECK( aSheetPath.IsFullPath(), /* void */ );
|
2022-11-22 19:35:27 +00:00
|
|
|
wxCHECK( !aSheetPath.Last() || ( aSheetPath.Last()->m_Uuid != m_Uuid ), /* void */ );
|
2021-12-08 18:36:23 +00:00
|
|
|
|
2022-10-01 12:44:21 +00:00
|
|
|
KIID_PATH path = aSheetPath.Path();
|
2021-12-06 12:47:18 +00:00
|
|
|
|
|
|
|
for( SCH_SHEET_INSTANCE& instance : m_instances )
|
|
|
|
{
|
|
|
|
if( instance.m_Path == path )
|
|
|
|
{
|
|
|
|
instance.m_PageNumber = aPageNumber;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-10-18 20:30:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-27 12:22:27 +00:00
|
|
|
int SCH_SHEET::ComparePageNum( const wxString& aPageNumberA, const wxString& aPageNumberB )
|
2020-11-29 00:10:17 +00:00
|
|
|
{
|
|
|
|
if( aPageNumberA == aPageNumberB )
|
2021-04-11 15:24:11 +00:00
|
|
|
return 0; // A == B
|
2020-11-29 00:10:17 +00:00
|
|
|
|
|
|
|
// First sort numerically if the page numbers are integers
|
|
|
|
long pageA, pageB;
|
|
|
|
bool isIntegerPageA = aPageNumberA.ToLong( &pageA );
|
|
|
|
bool isIntegerPageB = aPageNumberB.ToLong( &pageB );
|
|
|
|
|
|
|
|
if( isIntegerPageA && isIntegerPageB )
|
|
|
|
{
|
2021-04-11 15:24:11 +00:00
|
|
|
if( pageA < pageB )
|
|
|
|
return -1; //A < B
|
2020-11-29 00:10:17 +00:00
|
|
|
else
|
2021-04-11 15:24:11 +00:00
|
|
|
return 1; // A > B
|
2020-11-29 00:10:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Numerical page numbers always before strings
|
|
|
|
if( isIntegerPageA )
|
2021-04-11 15:24:11 +00:00
|
|
|
return -1; //A < B
|
2020-11-29 00:10:17 +00:00
|
|
|
else if( isIntegerPageB )
|
2021-04-11 15:24:11 +00:00
|
|
|
return 1; // A > B
|
2020-11-29 00:10:17 +00:00
|
|
|
|
2021-08-27 20:02:25 +00:00
|
|
|
// If not numeric, then sort as strings using natural sort
|
|
|
|
int result = StrNumCmp( aPageNumberA, aPageNumberB );
|
2020-11-29 00:10:17 +00:00
|
|
|
|
2022-03-25 19:51:05 +00:00
|
|
|
// Divide by zero bad.
|
|
|
|
wxCHECK( result != 0, 0 );
|
|
|
|
|
2022-01-24 18:37:54 +00:00
|
|
|
result = result / std::abs( result );
|
2020-11-29 00:10:17 +00:00
|
|
|
|
2022-01-24 18:37:54 +00:00
|
|
|
return result;
|
2020-11-29 00:10:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-22 16:38:23 +00:00
|
|
|
#if defined(DEBUG)
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2011-12-14 17:25:42 +00:00
|
|
|
void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
|
2008-04-22 16:38:23 +00:00
|
|
|
{
|
|
|
|
// XML output:
|
|
|
|
wxString s = GetClass();
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" << " sheet_name=\""
|
2020-03-06 12:05:21 +00:00
|
|
|
<< TO_UTF8( m_fields[ SHEETNAME ].GetText() ) << '"' << ">\n";
|
2008-04-22 16:38:23 +00:00
|
|
|
|
|
|
|
// show all the pins, and check the linked list integrity
|
2020-01-12 18:40:50 +00:00
|
|
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
|
|
|
sheetPin->Show( nestLevel + 1, os );
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n" << std::flush;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
#endif
|