2011-10-07 14:41:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
2021-06-08 14:09:24 +00:00
|
|
|
* Copyright (C) 1992-2021 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
|
|
|
|
*/
|
|
|
|
|
2020-02-15 18:44:41 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <general.h>
|
|
|
|
#include <geometry/shape_line_chain.h>
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h>
|
2021-08-18 20:38:14 +00:00
|
|
|
#include <plotters/plotter.h>
|
2020-02-15 18:44:41 +00:00
|
|
|
#include <sch_draw_panel.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_sheet.h>
|
2021-04-06 21:15:49 +00:00
|
|
|
#include <sch_sheet_pin.h>
|
2020-04-14 12:25:00 +00:00
|
|
|
#include <sch_painter.h>
|
2021-08-17 12:19:23 +00:00
|
|
|
#include <schematic.h>
|
2020-02-15 18:44:41 +00:00
|
|
|
#include <trigo.h>
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const VECTOR2I& pos, const wxString& text ) :
|
2019-05-17 16:45:27 +00:00
|
|
|
SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ),
|
2021-05-31 01:20:43 +00:00
|
|
|
m_edge( SHEET_SIDE::UNDEFINED )
|
2008-04-15 19:38:19 +00:00
|
|
|
{
|
2010-09-05 17:01:48 +00:00
|
|
|
SetParent( parent );
|
2008-04-22 16:38:23 +00:00
|
|
|
wxASSERT( parent );
|
2020-11-14 14:29:11 +00:00
|
|
|
m_layer = LAYER_SHEETLABEL;
|
2017-01-23 20:30:11 +00:00
|
|
|
|
|
|
|
SetTextPos( pos );
|
2011-10-21 13:59:15 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
if( parent->IsVerticalOrientation() )
|
2021-11-28 19:06:08 +00:00
|
|
|
SetSide( SHEET_SIDE::TOP );
|
2010-09-05 17:01:48 +00:00
|
|
|
else
|
2021-11-28 19:06:08 +00:00
|
|
|
SetSide( SHEET_SIDE::LEFT );
|
2011-10-21 13:59:15 +00:00
|
|
|
|
2021-10-12 20:05:37 +00:00
|
|
|
m_shape = LABEL_FLAG_SHAPE::L_INPUT;
|
2011-12-08 15:45:01 +00:00
|
|
|
m_isDangling = true;
|
|
|
|
m_number = 2;
|
2008-04-15 19:38:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 14:39:27 +00:00
|
|
|
EDA_ITEM* SCH_SHEET_PIN::Clone() const
|
2010-12-21 15:13:09 +00:00
|
|
|
{
|
|
|
|
return new SCH_SHEET_PIN( *this );
|
2008-04-15 19:38:19 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2019-05-31 12:15:25 +00:00
|
|
|
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
|
2020-04-14 12:25:00 +00:00
|
|
|
SCH_HIERLABEL::Print( aSettings, aOffset );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2011-06-07 15:29:01 +00:00
|
|
|
void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2011-06-07 15:29:01 +00:00
|
|
|
wxCHECK_RET( aItem->Type() == SCH_SHEET_PIN_T,
|
2022-01-25 22:33:37 +00:00
|
|
|
wxString::Format( "SCH_SHEET_PIN object cannot swap data with %s object.",
|
2021-07-16 20:13:26 +00:00
|
|
|
aItem->GetClass() ) );
|
2011-06-07 15:29:01 +00:00
|
|
|
|
2022-01-25 22:33:37 +00:00
|
|
|
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( aItem );
|
|
|
|
|
|
|
|
SCH_HIERLABEL::SwapData( pin );
|
|
|
|
std::swap( m_number, pin->m_number );
|
|
|
|
std::swap( m_edge, pin->m_edge );
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
|
|
|
return aPin == this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
int SCH_SHEET_PIN::GetPenWidth() const
|
2009-06-30 19:21:41 +00:00
|
|
|
{
|
2021-08-17 12:19:23 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
void SCH_SHEET_PIN::SetNumber( int aNumber )
|
|
|
|
{
|
|
|
|
wxASSERT( aNumber >= 2 );
|
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
m_number = aNumber;
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-28 19:06:08 +00:00
|
|
|
void SCH_SHEET_PIN::SetSide( SHEET_SIDE aEdge )
|
2008-04-15 19:38:19 +00:00
|
|
|
{
|
2015-11-03 19:44:05 +00:00
|
|
|
SCH_SHEET* Sheet = GetParent();
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2015-06-27 09:12:32 +00:00
|
|
|
// use SHEET_UNDEFINED_SIDE to adjust text orientation without changing edge
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2015-06-27 09:12:32 +00:00
|
|
|
switch( aEdge )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::LEFT:
|
2015-06-27 09:12:32 +00:00
|
|
|
m_edge = aEdge;
|
2017-01-23 20:30:11 +00:00
|
|
|
SetTextX( Sheet->m_pos.x );
|
2022-01-24 13:40:39 +00:00
|
|
|
SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); // Orientation horiz inverse
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::RIGHT:
|
2015-06-27 09:12:32 +00:00
|
|
|
m_edge = aEdge;
|
2017-01-23 20:30:11 +00:00
|
|
|
SetTextX( Sheet->m_pos.x + Sheet->m_size.x );
|
2022-01-24 13:40:39 +00:00
|
|
|
SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); // Orientation horiz normal
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::TOP:
|
2015-06-27 09:12:32 +00:00
|
|
|
m_edge = aEdge;
|
2017-01-23 20:30:11 +00:00
|
|
|
SetTextY( Sheet->m_pos.y );
|
2022-01-24 13:40:39 +00:00
|
|
|
SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); // Orientation vert BOTTOM
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::BOTTOM:
|
2015-06-27 09:12:32 +00:00
|
|
|
m_edge = aEdge;
|
2017-01-23 20:30:11 +00:00
|
|
|
SetTextY( Sheet->m_pos.y + Sheet->m_size.y );
|
2022-01-24 13:40:39 +00:00
|
|
|
SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); // Orientation vert UP
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2015-06-27 09:12:32 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2008-04-15 19:38:19 +00:00
|
|
|
}
|
2009-05-05 18:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-28 19:06:08 +00:00
|
|
|
enum SHEET_SIDE SCH_SHEET_PIN::GetSide() const
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
return m_edge;
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET_PIN::ConstrainOnEdge( VECTOR2I Pos )
|
2009-05-05 18:25:47 +00:00
|
|
|
{
|
2015-11-03 19:44:05 +00:00
|
|
|
SCH_SHEET* sheet = GetParent();
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
if( sheet == nullptr )
|
2010-09-05 17:01:48 +00:00
|
|
|
return;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2020-02-15 18:44:41 +00:00
|
|
|
int leftSide = sheet->m_pos.x;
|
|
|
|
int rightSide = sheet->m_pos.x + sheet->m_size.x;
|
|
|
|
int topSide = sheet->m_pos.y;
|
|
|
|
int botSide = sheet->m_pos.y + sheet->m_size.y;
|
|
|
|
|
|
|
|
SHAPE_LINE_CHAIN sheetEdge;
|
|
|
|
|
|
|
|
sheetEdge.Append( leftSide, topSide );
|
|
|
|
sheetEdge.Append( rightSide, topSide );
|
|
|
|
sheetEdge.Append( rightSide, botSide );
|
|
|
|
sheetEdge.Append( leftSide, botSide );
|
|
|
|
sheetEdge.Append( leftSide, topSide );
|
2015-07-24 10:23:34 +00:00
|
|
|
|
2020-02-15 18:44:41 +00:00
|
|
|
switch( sheetEdge.NearestSegment( Pos ) )
|
2008-04-15 19:38:19 +00:00
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
case 0: SetSide( SHEET_SIDE::TOP ); break;
|
|
|
|
case 1: SetSide( SHEET_SIDE::RIGHT ); break;
|
|
|
|
case 2: SetSide( SHEET_SIDE::BOTTOM ); break;
|
|
|
|
case 3: SetSide( SHEET_SIDE::LEFT ); break;
|
2020-03-06 20:02:58 +00:00
|
|
|
default: wxASSERT( "Invalid segment number" );
|
2020-02-15 18:44:41 +00:00
|
|
|
}
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2021-11-28 19:06:08 +00:00
|
|
|
switch( GetSide() )
|
2020-02-15 18:44:41 +00:00
|
|
|
{
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::RIGHT:
|
|
|
|
case SHEET_SIDE::LEFT:
|
2017-01-23 20:30:11 +00:00
|
|
|
SetTextY( Pos.y );
|
2011-10-21 13:59:15 +00:00
|
|
|
|
2020-02-15 18:44:41 +00:00
|
|
|
if( GetTextPos().y < topSide )
|
|
|
|
SetTextY( topSide );
|
2011-10-21 13:59:15 +00:00
|
|
|
|
2020-02-15 18:44:41 +00:00
|
|
|
if( GetTextPos().y > botSide )
|
|
|
|
SetTextY( botSide );
|
|
|
|
|
|
|
|
break;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::BOTTOM:
|
|
|
|
case SHEET_SIDE::TOP:
|
2017-01-23 20:30:11 +00:00
|
|
|
SetTextX( Pos.x );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2020-02-15 18:44:41 +00:00
|
|
|
if( GetTextPos().x < leftSide )
|
|
|
|
SetTextX( leftSide );
|
|
|
|
|
|
|
|
if( GetTextPos().x > rightSide )
|
|
|
|
SetTextX( rightSide );
|
|
|
|
|
|
|
|
break;
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2021-05-31 01:20:43 +00:00
|
|
|
case SHEET_SIDE::UNDEFINED:
|
2020-02-15 18:44:41 +00:00
|
|
|
wxASSERT( "Undefined sheet side" );
|
2008-04-15 19:38:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
void SCH_SHEET_PIN::MirrorVertically( int aCenter )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-02-16 20:45:25 +00:00
|
|
|
int p = GetTextPos().y - aCenter;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
SetTextY( aCenter - p );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
switch( m_edge )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
case SHEET_SIDE::TOP: SetSide( SHEET_SIDE::BOTTOM ); break;
|
|
|
|
case SHEET_SIDE::BOTTOM: SetSide( SHEET_SIDE::TOP ); break;
|
2019-05-17 16:45:27 +00:00
|
|
|
default: break;
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-02-16 20:45:25 +00:00
|
|
|
int p = GetTextPos().x - aCenter;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
SetTextX( aCenter - p );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2011-12-08 15:45:01 +00:00
|
|
|
switch( m_edge )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
case SHEET_SIDE::LEFT: SetSide( SHEET_SIDE::RIGHT ); break;
|
|
|
|
case SHEET_SIDE::RIGHT: SetSide( SHEET_SIDE::LEFT ); break;
|
2019-05-17 16:45:27 +00:00
|
|
|
default: break;
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2021-12-29 21:30:11 +00:00
|
|
|
VECTOR2I pt = GetTextPos();
|
|
|
|
VECTOR2I delta = pt - aCenter;
|
2021-11-28 01:16:40 +00:00
|
|
|
|
2022-01-16 21:15:20 +00:00
|
|
|
RotatePoint( pt, aCenter, ANGLE_90 );
|
2021-11-28 01:16:40 +00:00
|
|
|
|
2021-11-28 19:06:08 +00:00
|
|
|
SHEET_SIDE oldSide = GetSide();
|
2022-01-04 01:00:40 +00:00
|
|
|
ConstrainOnEdge( pt );
|
2021-11-28 01:16:40 +00:00
|
|
|
|
|
|
|
// If the new side is the same as the old side, instead mirror across the center of that side.
|
2021-11-28 19:06:08 +00:00
|
|
|
if( GetSide() == oldSide )
|
2021-11-28 01:16:40 +00:00
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
switch( GetSide() )
|
2021-11-28 01:16:40 +00:00
|
|
|
{
|
|
|
|
case SHEET_SIDE::TOP:
|
|
|
|
case SHEET_SIDE::BOTTOM:
|
2022-01-04 01:00:40 +00:00
|
|
|
SetTextPos( VECTOR2I( aCenter.x - delta.x, GetTextPos().y ) );
|
2021-11-28 01:16:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHEET_SIDE::LEFT:
|
|
|
|
case SHEET_SIDE::RIGHT:
|
2022-01-04 01:00:40 +00:00
|
|
|
SetTextPos( VECTOR2I( GetTextPos().x, aCenter.y - delta.y ) );
|
2021-11-28 01:16:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If the new side is opposite to the old side, instead mirror across the center of an adjacent
|
|
|
|
// side.
|
2021-11-28 19:06:08 +00:00
|
|
|
else if( GetSide() == GetOppositeSide( oldSide ) )
|
2021-11-28 01:16:40 +00:00
|
|
|
{
|
2021-11-28 19:06:08 +00:00
|
|
|
switch( GetSide() )
|
2021-11-28 01:16:40 +00:00
|
|
|
{
|
|
|
|
case SHEET_SIDE::TOP:
|
|
|
|
case SHEET_SIDE::BOTTOM:
|
2022-01-04 01:00:40 +00:00
|
|
|
SetTextPos( VECTOR2I( aCenter.x + delta.x, GetTextPos().y ) );
|
2021-11-28 01:16:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHEET_SIDE::LEFT:
|
|
|
|
case SHEET_SIDE::RIGHT:
|
2022-01-04 01:00:40 +00:00
|
|
|
SetTextPos( VECTOR2I( GetTextPos().x, aCenter.y + delta.y ) );
|
2021-11-28 01:16:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
|
2022-01-01 06:04:08 +00:00
|
|
|
std::vector<VECTOR2I>& aPoints, const VECTOR2I& aPos ) const
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2019-08-02 00:10:25 +00:00
|
|
|
/*
|
|
|
|
* These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly
|
|
|
|
* different in 2 cases:
|
2010-11-03 14:13:15 +00:00
|
|
|
* for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
|
|
|
|
* for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
|
|
|
|
*/
|
2021-10-12 20:05:37 +00:00
|
|
|
LABEL_FLAG_SHAPE shape = m_shape;
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
switch( shape )
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2021-10-12 20:05:37 +00:00
|
|
|
case LABEL_FLAG_SHAPE::L_INPUT: shape = LABEL_FLAG_SHAPE::L_OUTPUT; break;
|
|
|
|
case LABEL_FLAG_SHAPE::L_OUTPUT: shape = LABEL_FLAG_SHAPE::L_INPUT; break;
|
|
|
|
default: break;
|
2010-11-03 14:13:15 +00:00
|
|
|
}
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
SCH_HIERLABEL::CreateGraphicShape( aSettings, aPoints, aPos, shape );
|
2010-11-03 14:13:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2022-01-04 01:00:40 +00:00
|
|
|
DANGLING_END_ITEM item( SHEET_LABEL_END, this, GetTextPos() );
|
2010-11-03 14:13:15 +00:00
|
|
|
aItemList.push_back( item );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString SCH_SHEET_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2022-08-22 16:39:19 +00:00
|
|
|
return wxString::Format( _( "Hierarchical Sheet Pin %s" ),
|
|
|
|
KIUI::EllipsizeMenuText( GetShownText() ) );
|
2011-03-25 19:16:05 +00:00
|
|
|
}
|
|
|
|
|
2019-08-02 00:10:25 +00:00
|
|
|
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS SCH_SHEET_PIN::GetMenuImage() const
|
2017-02-20 12:20:39 +00:00
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
return BITMAPS::add_hierar_pin;
|
2017-02-20 12:20:39 +00:00
|
|
|
}
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool SCH_SHEET_PIN::HitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I rect = GetBoundingBox();
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
return rect.Contains( aPoint );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-22 16:38:23 +00:00
|
|
|
#if defined(DEBUG)
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2011-12-14 17:25:42 +00:00
|
|
|
void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os ) const
|
2008-04-22 16:38:23 +00:00
|
|
|
{
|
|
|
|
// XML output:
|
2019-08-02 00:10:25 +00:00
|
|
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">"
|
|
|
|
<< " pin_name=\"" << TO_UTF8( GetText() )
|
2009-11-03 13:26:31 +00:00
|
|
|
<< '"' << "/>\n" << std::flush;
|
2008-04-22 16:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|