2022-01-30 10:52:52 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-01-17 16:54:08 +00:00
|
|
|
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-01-30 10:52:52 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <pcb_edit_frame.h>
|
|
|
|
#include <base_units.h>
|
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <board.h>
|
|
|
|
#include <board_design_settings.h>
|
|
|
|
#include <footprint.h>
|
|
|
|
#include <pcb_textbox.h>
|
|
|
|
#include <pcb_painter.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <string_utils.h>
|
|
|
|
#include <geometry/shape_compound.h>
|
|
|
|
#include <callback_gal.h>
|
|
|
|
#include <convert_basic_shapes_to_polygon.h>
|
2022-09-22 14:05:06 +00:00
|
|
|
#include <macros.h>
|
2023-04-19 02:44:04 +00:00
|
|
|
#include <core/ignore.h>
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
|
2024-01-15 17:29:55 +00:00
|
|
|
PCB_TEXTBOX::PCB_TEXTBOX( BOARD_ITEM* aParent, KICAD_T aType ) :
|
|
|
|
PCB_SHAPE( aParent, aType, SHAPE_T::RECTANGLE ),
|
2023-08-31 02:33:55 +00:00
|
|
|
EDA_TEXT( pcbIUScale ),
|
|
|
|
m_borderEnabled( true )
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
|
|
|
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
|
|
SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
|
|
|
SetMultilineAllowed( true );
|
2024-01-20 17:05:21 +00:00
|
|
|
|
|
|
|
int defaultMargin = GetLegacyTextMargin();
|
|
|
|
m_marginLeft = defaultMargin;
|
|
|
|
m_marginTop = defaultMargin;
|
|
|
|
m_marginRight = defaultMargin;
|
|
|
|
m_marginBottom = defaultMargin;
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PCB_TEXTBOX::~PCB_TEXTBOX()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-02 21:10:13 +00:00
|
|
|
void PCB_TEXTBOX::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings )
|
|
|
|
{
|
|
|
|
PCB_SHAPE::StyleFromSettings( settings );
|
|
|
|
|
|
|
|
SetTextSize( settings.GetTextSize( GetLayer() ) );
|
|
|
|
SetTextThickness( settings.GetTextThickness( GetLayer() ) );
|
|
|
|
SetItalic( settings.GetTextItalic( GetLayer() ) );
|
|
|
|
SetKeepUpright( settings.GetTextUpright( GetLayer() ) );
|
|
|
|
SetMirrored( IsBackLayer( GetLayer() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
int PCB_TEXTBOX::GetLegacyTextMargin() const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2023-02-13 16:58:35 +00:00
|
|
|
return KiROUND( GetStroke().GetWidth() / 2.0 ) + KiROUND( GetTextSize().y * 0.75 );
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-06-02 09:42:13 +00:00
|
|
|
VECTOR2I PCB_TEXTBOX::GetTopLeft() const
|
|
|
|
{
|
|
|
|
EDA_ANGLE rotation = GetDrawRotation();
|
|
|
|
|
|
|
|
if( rotation == ANGLE_90 )
|
|
|
|
return VECTOR2I( GetStartX(), GetEndY() );
|
|
|
|
else if( rotation == ANGLE_180 )
|
|
|
|
return GetEnd();
|
|
|
|
else if( rotation == ANGLE_270 )
|
|
|
|
return VECTOR2I( GetEndX(), GetStartY() );
|
|
|
|
else
|
|
|
|
return GetStart();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VECTOR2I PCB_TEXTBOX::GetBotRight() const
|
|
|
|
{
|
|
|
|
EDA_ANGLE rotation = GetDrawRotation();
|
|
|
|
|
|
|
|
if( rotation == ANGLE_90 )
|
|
|
|
return VECTOR2I( GetEndX(), GetStartY() );
|
|
|
|
else if( rotation == ANGLE_180 )
|
|
|
|
return GetStart();
|
|
|
|
else if( rotation == ANGLE_270 )
|
|
|
|
return VECTOR2I( GetStartX(), GetEndY() );
|
|
|
|
else
|
|
|
|
return GetEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_TEXTBOX::SetTop( int aVal )
|
|
|
|
{
|
|
|
|
EDA_ANGLE rotation = GetDrawRotation();
|
|
|
|
|
|
|
|
if( rotation == ANGLE_90 || rotation == ANGLE_180 )
|
|
|
|
SetEndY( aVal );
|
|
|
|
else
|
|
|
|
SetStartY( aVal );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_TEXTBOX::SetBottom( int aVal )
|
|
|
|
{
|
|
|
|
EDA_ANGLE rotation = GetDrawRotation();
|
|
|
|
|
|
|
|
if( rotation == ANGLE_90 || rotation == ANGLE_180 )
|
|
|
|
SetStartY( aVal );
|
|
|
|
else
|
|
|
|
SetEndY( aVal );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_TEXTBOX::SetLeft( int aVal )
|
|
|
|
{
|
|
|
|
EDA_ANGLE rotation = GetDrawRotation();
|
|
|
|
|
|
|
|
if( rotation == ANGLE_180 || rotation == ANGLE_270 )
|
|
|
|
SetEndX( aVal );
|
|
|
|
else
|
|
|
|
SetStartX( aVal );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_TEXTBOX::SetRight( int aVal )
|
|
|
|
{
|
|
|
|
EDA_ANGLE rotation = GetDrawRotation();
|
|
|
|
|
|
|
|
if( rotation == ANGLE_180 || rotation == ANGLE_270 )
|
|
|
|
SetStartX( aVal );
|
|
|
|
else
|
|
|
|
SetEndX( aVal );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-04 17:13:12 +00:00
|
|
|
void PCB_TEXTBOX::SetTextAngle( const EDA_ANGLE& aAngle )
|
|
|
|
{
|
|
|
|
EDA_ANGLE delta = aAngle.Normalized() - GetTextAngle();
|
|
|
|
Rotate( GetPosition(), delta );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
std::vector<VECTOR2I> PCB_TEXTBOX::GetAnchorAndOppositeCorner() const
|
|
|
|
{
|
|
|
|
std::vector<VECTOR2I> pts;
|
2022-03-30 18:53:41 +00:00
|
|
|
EDA_ANGLE textAngle( GetDrawRotation() );
|
2022-01-30 10:52:52 +00:00
|
|
|
|
2022-03-30 18:53:41 +00:00
|
|
|
textAngle.Normalize();
|
2022-01-30 10:52:52 +00:00
|
|
|
|
2023-11-06 13:29:12 +00:00
|
|
|
if( textAngle.IsCardinal() )
|
2022-03-30 18:53:41 +00:00
|
|
|
{
|
2023-11-06 13:29:12 +00:00
|
|
|
BOX2I bbox = PCB_SHAPE::GetBoundingBox();
|
|
|
|
bbox.Normalize();
|
|
|
|
|
|
|
|
if( textAngle == ANGLE_0 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetLeft(), bbox.GetTop() ) );
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetRight(), bbox.GetTop() ) );
|
|
|
|
}
|
|
|
|
else if( textAngle == ANGLE_90 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetLeft(), bbox.GetBottom() ) );
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetLeft(), bbox.GetTop() ) );
|
|
|
|
}
|
|
|
|
else if( textAngle == ANGLE_180 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetRight(), bbox.GetBottom() ) );
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetLeft(), bbox.GetBottom() ) );
|
|
|
|
}
|
|
|
|
else if( textAngle == ANGLE_270 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetRight(), bbox.GetTop() ) );
|
|
|
|
pts.emplace_back( VECTOR2I( bbox.GetRight(), bbox.GetBottom() ) );
|
|
|
|
}
|
2022-03-30 18:53:41 +00:00
|
|
|
}
|
2022-01-30 10:52:52 +00:00
|
|
|
else
|
2022-03-30 18:53:41 +00:00
|
|
|
{
|
2023-11-06 13:29:12 +00:00
|
|
|
std::vector<VECTOR2I> corners = GetCorners();
|
|
|
|
|
|
|
|
VECTOR2I minX = corners[0];
|
|
|
|
VECTOR2I maxX = corners[0];
|
|
|
|
VECTOR2I minY = corners[0];
|
|
|
|
VECTOR2I maxY = corners[0];
|
|
|
|
|
|
|
|
for( const VECTOR2I& corner : corners )
|
|
|
|
{
|
|
|
|
if( corner.x < minX.x )
|
|
|
|
minX = corner;
|
|
|
|
|
|
|
|
if( corner.x > maxX.x )
|
|
|
|
maxX = corner;
|
|
|
|
|
|
|
|
if( corner.y < minY.y )
|
|
|
|
minY = corner;
|
|
|
|
|
|
|
|
if( corner.y > maxY.y )
|
|
|
|
maxY = corner;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( textAngle < ANGLE_90 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( minX );
|
|
|
|
pts.emplace_back( minY );
|
|
|
|
}
|
|
|
|
else if( textAngle < ANGLE_180 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( maxY );
|
|
|
|
pts.emplace_back( minX );
|
|
|
|
}
|
|
|
|
else if( textAngle < ANGLE_270 )
|
|
|
|
{
|
|
|
|
pts.emplace_back( maxX );
|
|
|
|
pts.emplace_back( maxY );
|
|
|
|
}
|
2022-03-30 18:53:41 +00:00
|
|
|
else
|
2023-11-06 13:29:12 +00:00
|
|
|
{
|
|
|
|
pts.emplace_back( minY );
|
|
|
|
pts.emplace_back( maxX );
|
|
|
|
}
|
2022-03-30 18:53:41 +00:00
|
|
|
}
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
return pts;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VECTOR2I PCB_TEXTBOX::GetDrawPos() const
|
|
|
|
{
|
|
|
|
std::vector<VECTOR2I> corners = GetAnchorAndOppositeCorner();
|
|
|
|
GR_TEXT_H_ALIGN_T effectiveAlignment = GetHorizJustify();
|
|
|
|
VECTOR2I textAnchor;
|
|
|
|
VECTOR2I offset;
|
|
|
|
|
2023-09-18 13:47:38 +00:00
|
|
|
if( IsMirrored() )
|
|
|
|
{
|
2022-01-30 10:52:52 +00:00
|
|
|
switch( GetHorizJustify() )
|
|
|
|
{
|
2024-02-03 13:43:41 +00:00
|
|
|
case GR_TEXT_H_ALIGN_LEFT: effectiveAlignment = GR_TEXT_H_ALIGN_RIGHT; break;
|
|
|
|
case GR_TEXT_H_ALIGN_CENTER: effectiveAlignment = GR_TEXT_H_ALIGN_CENTER; break;
|
|
|
|
case GR_TEXT_H_ALIGN_RIGHT: effectiveAlignment = GR_TEXT_H_ALIGN_LEFT; break;
|
|
|
|
case GR_TEXT_H_ALIGN_INDETERMINATE: wxFAIL_MSG( wxT( "Legal only in dialogs" ) ); break;
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( effectiveAlignment )
|
|
|
|
{
|
|
|
|
case GR_TEXT_H_ALIGN_LEFT:
|
|
|
|
textAnchor = corners[0];
|
2024-01-20 17:05:21 +00:00
|
|
|
offset = VECTOR2I( GetMarginLeft(), GetMarginTop() );
|
2022-01-30 10:52:52 +00:00
|
|
|
break;
|
|
|
|
case GR_TEXT_H_ALIGN_CENTER:
|
|
|
|
textAnchor = ( corners[0] + corners[1] ) / 2;
|
2024-01-20 17:05:21 +00:00
|
|
|
offset = VECTOR2I( 0, GetMarginTop() );
|
2022-01-30 10:52:52 +00:00
|
|
|
break;
|
|
|
|
case GR_TEXT_H_ALIGN_RIGHT:
|
|
|
|
textAnchor = corners[1];
|
2024-01-20 17:05:21 +00:00
|
|
|
offset = VECTOR2I( -GetMarginRight(), GetMarginTop() );
|
2022-01-30 10:52:52 +00:00
|
|
|
break;
|
2024-02-03 13:43:41 +00:00
|
|
|
case GR_TEXT_H_ALIGN_INDETERMINATE:
|
|
|
|
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
|
|
|
|
break;
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RotatePoint( offset, GetDrawRotation() );
|
|
|
|
return textAnchor + offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-07 17:03:06 +00:00
|
|
|
double PCB_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
|
|
|
{
|
|
|
|
constexpr double HIDE = std::numeric_limits<double>::max();
|
|
|
|
|
|
|
|
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( aView->GetPainter() );
|
|
|
|
KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
|
|
|
|
|
|
|
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
|
|
|
{
|
|
|
|
// Hide shadow if the main layer is not shown
|
|
|
|
if( !aView->IsLayerVisible( m_layer ) )
|
|
|
|
return HIDE;
|
|
|
|
|
|
|
|
// Hide shadow on dimmed tracks
|
|
|
|
if( renderSettings->GetHighContrast() )
|
|
|
|
{
|
|
|
|
if( m_layer != renderSettings->GetPrimaryHighContrastLayer() )
|
|
|
|
return HIDE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-20 15:29:09 +00:00
|
|
|
void PCB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
|
|
|
|
{
|
|
|
|
aLayers[0] = GetLayer();
|
|
|
|
aCount = 1;
|
|
|
|
|
|
|
|
if( IsLocked() )
|
|
|
|
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
wxString PCB_TEXTBOX::GetShownText( bool aAllowExtraText, int aDepth ) const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
|
|
|
BOARD* board = dynamic_cast<BOARD*>( GetParent() );
|
|
|
|
|
|
|
|
std::function<bool( wxString* )> pcbTextResolver =
|
|
|
|
[&]( wxString* token ) -> bool
|
|
|
|
{
|
|
|
|
if( token->IsSameAs( wxT( "LAYER" ) ) )
|
|
|
|
{
|
|
|
|
*token = GetLayerName();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-01-17 16:54:08 +00:00
|
|
|
if( board->ResolveTextVar( token, aDepth + 1 ) )
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2023-01-17 16:54:08 +00:00
|
|
|
return true;
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
2023-01-17 16:54:08 +00:00
|
|
|
return false;
|
2022-01-30 10:52:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
if( board && HasTextVars() && aDepth < 10 )
|
2023-01-17 16:54:08 +00:00
|
|
|
text = ExpandTextVars( text, &pcbTextResolver );
|
2022-01-30 10:52:52 +00:00
|
|
|
|
2022-10-22 20:32:10 +00:00
|
|
|
KIFONT::FONT* font = getDrawFont();
|
2022-01-30 10:52:52 +00:00
|
|
|
std::vector<VECTOR2I> corners = GetAnchorAndOppositeCorner();
|
|
|
|
int colWidth = ( corners[1] - corners[0] ).EuclideanNorm();
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
if( GetTextAngle().IsHorizontal() )
|
|
|
|
colWidth -= ( GetMarginLeft() + GetMarginRight() );
|
|
|
|
else
|
|
|
|
colWidth -= ( GetMarginTop() + GetMarginBottom() );
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
|
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
bool PCB_TEXTBOX::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
|
|
|
{
|
|
|
|
return BOARD_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
void PCB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
|
|
|
{
|
|
|
|
// Don't use GetShownText() here; we want to show the user the variable references
|
2022-08-22 16:39:19 +00:00
|
|
|
aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
|
|
|
aList.emplace_back( _( "Status" ), _( "Locked" ) );
|
|
|
|
|
|
|
|
aList.emplace_back( _( "Layer" ), GetLayerName() );
|
|
|
|
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
|
|
|
|
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
|
|
|
|
|
2022-10-22 20:32:10 +00:00
|
|
|
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
|
|
|
aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
|
|
|
aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
2022-03-20 15:57:18 +00:00
|
|
|
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Box Width" ),
|
|
|
|
aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
|
2022-03-20 15:57:18 +00:00
|
|
|
|
2022-09-19 09:25:20 +00:00
|
|
|
aList.emplace_back( _( "Box Height" ),
|
|
|
|
aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ));
|
2022-03-20 15:57:18 +00:00
|
|
|
|
2022-09-19 16:09:59 +00:00
|
|
|
m_stroke.GetMsgPanelInfo( aFrame, aList );
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-02 21:37:24 +00:00
|
|
|
void PCB_TEXTBOX::Move( const VECTOR2I& aMoveVector )
|
|
|
|
{
|
|
|
|
PCB_SHAPE::Move( aMoveVector );
|
|
|
|
EDA_TEXT::Offset( aMoveVector );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
void PCB_TEXTBOX::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
|
|
|
{
|
|
|
|
PCB_SHAPE::Rotate( aRotCentre, aAngle );
|
2023-03-04 17:13:12 +00:00
|
|
|
EDA_TEXT::SetTextAngle( ( GetTextAngle() + aAngle ).Normalized() );
|
2022-04-01 15:11:42 +00:00
|
|
|
|
2023-07-24 16:07:56 +00:00
|
|
|
if( GetTextAngle().IsCardinal() && GetShape() != SHAPE_T::RECTANGLE )
|
2022-04-01 15:11:42 +00:00
|
|
|
{
|
|
|
|
std::vector<VECTOR2I> corners = GetCorners();
|
|
|
|
VECTOR2I diag = corners[2] - corners[0];
|
2022-04-05 13:54:16 +00:00
|
|
|
EDA_ANGLE angle = GetTextAngle();
|
2022-04-01 15:11:42 +00:00
|
|
|
|
2023-07-24 16:07:56 +00:00
|
|
|
SetShape( SHAPE_T::RECTANGLE );
|
2022-04-01 15:11:42 +00:00
|
|
|
SetStart( corners[0] );
|
2022-04-05 13:54:16 +00:00
|
|
|
|
|
|
|
angle.Normalize();
|
|
|
|
|
|
|
|
if( angle == ANGLE_90 )
|
|
|
|
SetEnd( VECTOR2I( corners[0].x + abs( diag.x ), corners[0].y - abs( diag.y ) ) );
|
|
|
|
else if( angle == ANGLE_180 )
|
|
|
|
SetEnd( VECTOR2I( corners[0].x - abs( diag.x ), corners[0].y - abs( diag.y ) ) );
|
|
|
|
else if( angle == ANGLE_270 )
|
|
|
|
SetEnd( VECTOR2I( corners[0].x - abs( diag.x ), corners[0].y + abs( diag.y ) ) );
|
|
|
|
else
|
|
|
|
SetEnd( VECTOR2I( corners[0].x + abs( diag.x ), corners[0].y + abs( diag.y ) ) );
|
2022-04-01 15:11:42 +00:00
|
|
|
}
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-22 14:05:06 +00:00
|
|
|
void PCB_TEXTBOX::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
|
|
|
{
|
2023-11-06 13:29:12 +00:00
|
|
|
// the position and angle are mirrored, but not the text (or its justification)
|
2022-09-22 14:05:06 +00:00
|
|
|
PCB_SHAPE::Mirror( aCentre, aMirrorAroundXAxis );
|
|
|
|
|
2023-11-06 13:29:12 +00:00
|
|
|
if( aMirrorAroundXAxis )
|
|
|
|
EDA_TEXT::SetTextAngle( ANGLE_180 - GetTextAngle() );
|
|
|
|
else
|
|
|
|
EDA_TEXT::SetTextAngle( -GetTextAngle() );
|
2022-09-22 14:05:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
void PCB_TEXTBOX::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|
|
|
{
|
2023-11-06 13:29:12 +00:00
|
|
|
PCB_SHAPE::Flip( aCentre, aFlipLeftRight );
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
if( aFlipLeftRight )
|
2023-03-04 17:13:12 +00:00
|
|
|
EDA_TEXT::SetTextAngle( -GetTextAngle() );
|
2022-01-30 10:52:52 +00:00
|
|
|
else
|
2023-03-04 17:13:12 +00:00
|
|
|
EDA_TEXT::SetTextAngle( ANGLE_180 - GetTextAngle() );
|
2022-10-24 15:22:27 +00:00
|
|
|
|
2022-10-25 11:08:32 +00:00
|
|
|
if( ( GetLayerSet() & LSET::SideSpecificMask() ).any() )
|
2022-10-24 15:22:27 +00:00
|
|
|
SetMirrored( !IsMirrored() );
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|
|
|
{
|
2022-08-31 16:17:14 +00:00
|
|
|
BOX2I rect = GetBoundingBox();
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
return rect.Contains( aPosition );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool PCB_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I rect = aRect;
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
if( aContained )
|
|
|
|
return rect.Contains( GetBoundingBox() );
|
|
|
|
|
|
|
|
return rect.Intersects( GetBoundingBox() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString PCB_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2024-01-11 11:38:03 +00:00
|
|
|
return wxString::Format( _( "PCB Text Box '%s' on %s" ),
|
|
|
|
KIUI::EllipsizeMenuText( GetText() ),
|
|
|
|
GetLayerName() );
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BITMAPS PCB_TEXTBOX::GetMenuImage() const
|
|
|
|
{
|
|
|
|
return BITMAPS::add_textbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EDA_ITEM* PCB_TEXTBOX::Clone() const
|
|
|
|
{
|
|
|
|
return new PCB_TEXTBOX( *this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-11 17:09:25 +00:00
|
|
|
void PCB_TEXTBOX::swapData( BOARD_ITEM* aImage )
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2024-01-15 17:29:55 +00:00
|
|
|
wxASSERT( aImage->Type() == PCB_TEXTBOX_T );
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
std::swap( *((PCB_TEXTBOX*) this), *((PCB_TEXTBOX*) aImage) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-16 23:48:24 +00:00
|
|
|
std::shared_ptr<SHAPE> PCB_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2022-07-25 15:09:27 +00:00
|
|
|
std::shared_ptr<SHAPE_COMPOUND> shape = GetEffectiveTextShape();
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
if( PCB_SHAPE::GetStroke().GetWidth() >= 0 )
|
2022-07-25 15:09:27 +00:00
|
|
|
shape->AddShape( PCB_SHAPE::GetEffectiveShape( aLayer, aFlash ) );
|
|
|
|
|
|
|
|
return shape;
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-29 14:28:48 +00:00
|
|
|
void PCB_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, int aClearance, int aMaxError,
|
2023-05-28 16:20:11 +00:00
|
|
|
ERROR_LOC aErrorLoc ) const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
|
|
|
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
2022-10-22 20:32:10 +00:00
|
|
|
KIFONT::FONT* font = getDrawFont();
|
2022-01-30 10:52:52 +00:00
|
|
|
int penWidth = GetEffectiveTextPenWidth();
|
|
|
|
|
2022-10-16 17:02:12 +00:00
|
|
|
// Note: this function is mainly used in 3D viewer.
|
|
|
|
// the polygonal shape of a text can have many basic shapes,
|
|
|
|
// so combining these shapes can be very useful to create a final shape
|
|
|
|
// swith a lot less vertices to speedup calculations using this final shape
|
|
|
|
// Simplify shapes is not usually always efficient, but in this case it is.
|
|
|
|
SHAPE_POLY_SET buffer;
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
CALLBACK_GAL callback_gal( empty_opts,
|
|
|
|
// Stroke callback
|
|
|
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
|
|
|
{
|
2023-05-29 14:28:48 +00:00
|
|
|
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth, aMaxError, aErrorLoc );
|
2022-01-30 10:52:52 +00:00
|
|
|
},
|
|
|
|
// Triangulation callback
|
|
|
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
|
|
|
{
|
2022-10-16 17:02:12 +00:00
|
|
|
buffer.NewOutline();
|
2022-01-30 10:52:52 +00:00
|
|
|
|
|
|
|
for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
|
2022-10-16 17:02:12 +00:00
|
|
|
buffer.Append( point.x, point.y );
|
2022-01-30 10:52:52 +00:00
|
|
|
} );
|
|
|
|
|
2023-08-06 19:20:53 +00:00
|
|
|
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), GetAttributes(), GetFontMetrics() );
|
2022-10-16 17:02:12 +00:00
|
|
|
|
2023-05-29 14:28:48 +00:00
|
|
|
if( aClearance > 0 || aErrorLoc == ERROR_OUTSIDE )
|
|
|
|
{
|
|
|
|
if( aErrorLoc == ERROR_OUTSIDE )
|
|
|
|
aClearance += aMaxError;
|
|
|
|
|
2023-10-05 07:34:24 +00:00
|
|
|
buffer.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError, true );
|
2023-05-29 14:28:48 +00:00
|
|
|
}
|
2023-05-28 16:20:11 +00:00
|
|
|
else
|
2023-05-29 14:28:48 +00:00
|
|
|
{
|
2023-05-28 16:20:11 +00:00
|
|
|
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
2023-05-29 14:28:48 +00:00
|
|
|
}
|
2023-05-28 16:20:11 +00:00
|
|
|
|
2022-10-21 12:48:45 +00:00
|
|
|
aBuffer.Append( buffer );
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-21 12:48:45 +00:00
|
|
|
void PCB_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
2023-05-29 14:28:48 +00:00
|
|
|
int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
|
2022-10-21 12:48:45 +00:00
|
|
|
bool aIgnoreLineWidth ) const
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2022-10-21 12:48:45 +00:00
|
|
|
// Don't use PCB_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
|
|
|
|
// if there's no background colour.
|
2022-05-18 11:47:34 +00:00
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
int width = GetWidth() + ( 2 * aClearance );
|
2022-05-18 11:47:34 +00:00
|
|
|
|
2023-07-24 16:07:56 +00:00
|
|
|
if( GetShape() == SHAPE_T::RECTANGLE )
|
2023-03-30 11:49:23 +00:00
|
|
|
{
|
|
|
|
std::vector<VECTOR2I> pts = GetRectCorners();
|
2022-05-18 11:47:34 +00:00
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
aBuffer.NewOutline();
|
2022-05-18 11:47:34 +00:00
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
for( const VECTOR2I& pt : pts )
|
|
|
|
aBuffer.Append( pt );
|
2022-05-18 11:47:34 +00:00
|
|
|
|
2023-08-31 02:33:55 +00:00
|
|
|
if( m_borderEnabled && width > 0 )
|
2023-03-30 11:49:23 +00:00
|
|
|
{
|
|
|
|
// Add in segments
|
2023-05-29 14:28:48 +00:00
|
|
|
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aMaxError, aErrorLoc );
|
|
|
|
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aMaxError, aErrorLoc );
|
|
|
|
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aMaxError, aErrorLoc );
|
|
|
|
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aMaxError, aErrorLoc );
|
2023-03-30 11:49:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( GetShape() == SHAPE_T::POLY ) // Non-cardinally-rotated rect
|
2022-01-30 10:52:52 +00:00
|
|
|
{
|
2023-03-30 11:49:23 +00:00
|
|
|
aBuffer.NewOutline();
|
|
|
|
|
|
|
|
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
|
|
|
|
|
2023-11-11 16:01:01 +00:00
|
|
|
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
|
|
|
aBuffer.Append( poly.GetPoint( ii ) );
|
|
|
|
|
2023-08-31 02:33:55 +00:00
|
|
|
if( m_borderEnabled && width > 0 )
|
2023-03-30 11:49:23 +00:00
|
|
|
{
|
|
|
|
for( int ii = 0; ii < poly.SegmentCount(); ++ii )
|
|
|
|
{
|
|
|
|
const SEG& seg = poly.GetSegment( ii );
|
2023-05-29 14:28:48 +00:00
|
|
|
TransformOvalToPolygon( aBuffer, seg.A, seg.B, width, aMaxError, aErrorLoc );
|
2023-03-30 11:49:23 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-25 01:00:19 +00:00
|
|
|
bool PCB_TEXTBOX::IsBorderEnabled() const
|
|
|
|
{
|
2023-08-31 02:33:55 +00:00
|
|
|
return m_borderEnabled;
|
2023-08-25 01:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-31 02:33:55 +00:00
|
|
|
void PCB_TEXTBOX::SetBorderEnabled( bool enabled )
|
2023-08-25 01:00:19 +00:00
|
|
|
{
|
2023-08-31 02:33:55 +00:00
|
|
|
m_borderEnabled = enabled;
|
2023-08-25 01:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-31 11:49:15 +00:00
|
|
|
void PCB_TEXTBOX::SetBorderWidth( const int aSize )
|
|
|
|
{
|
|
|
|
m_stroke.SetWidth( aSize );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
|
|
|
|
bool PCB_TEXTBOX::operator==( const BOARD_ITEM& aBoardItem ) const
|
|
|
|
{
|
|
|
|
if( aBoardItem.Type() != Type() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const PCB_TEXTBOX& other = static_cast<const PCB_TEXTBOX&>( aBoardItem );
|
|
|
|
|
|
|
|
return m_borderEnabled == other.m_borderEnabled && EDA_TEXT::operator==( other );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double PCB_TEXTBOX::Similarity( const BOARD_ITEM& aBoardItem ) const
|
|
|
|
{
|
|
|
|
if( aBoardItem.Type() != Type() )
|
|
|
|
return 0.0;
|
|
|
|
|
|
|
|
const PCB_TEXTBOX& other = static_cast<const PCB_TEXTBOX&>( aBoardItem );
|
|
|
|
|
|
|
|
double similarity = 1.0;
|
|
|
|
|
|
|
|
if( m_borderEnabled != other.m_borderEnabled )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
if( GetMarginLeft() != other.GetMarginLeft() )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
|
|
|
if( GetMarginTop() != other.GetMarginTop() )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
|
|
|
if( GetMarginRight() != other.GetMarginRight() )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
|
|
|
if( GetMarginBottom() != other.GetMarginBottom() )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
similarity *= EDA_TEXT::Similarity( other );
|
|
|
|
|
|
|
|
return similarity;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
static struct PCB_TEXTBOX_DESC
|
|
|
|
{
|
|
|
|
PCB_TEXTBOX_DESC()
|
|
|
|
{
|
2023-11-25 13:05:45 +00:00
|
|
|
ENUM_MAP<LINE_STYLE>& plotDashTypeEnum = ENUM_MAP<LINE_STYLE>::Instance();
|
2023-09-01 12:21:26 +00:00
|
|
|
|
|
|
|
if( plotDashTypeEnum.Choices().GetCount() == 0 )
|
|
|
|
{
|
2023-11-25 13:05:45 +00:00
|
|
|
plotDashTypeEnum.Map( LINE_STYLE::DEFAULT, _HKI( "Default" ) )
|
|
|
|
.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
|
|
|
|
.Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
|
|
|
|
.Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
|
|
|
|
.Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
|
|
|
|
.Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
|
2023-09-01 12:21:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
|
|
|
REGISTER_TYPE( PCB_TEXTBOX );
|
|
|
|
propMgr.AddTypeCast( new TYPE_CAST<PCB_TEXTBOX, PCB_SHAPE> );
|
|
|
|
propMgr.AddTypeCast( new TYPE_CAST<PCB_TEXTBOX, EDA_TEXT> );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( PCB_SHAPE ) );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_TEXT ) );
|
2022-12-02 02:54:12 +00:00
|
|
|
|
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start X" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start Y" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) );
|
2023-08-25 02:32:12 +00:00
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Style" ) );
|
2023-09-04 13:28:43 +00:00
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
|
2024-02-05 06:13:16 +00:00
|
|
|
propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Color" ) );
|
2023-08-31 02:33:55 +00:00
|
|
|
|
2023-09-04 13:24:25 +00:00
|
|
|
const wxString borderProps = _( "Border Properties" );
|
2023-08-31 02:33:55 +00:00
|
|
|
|
2023-11-25 13:05:45 +00:00
|
|
|
void ( PCB_TEXTBOX::*lineStyleSetter )( LINE_STYLE ) = &PCB_TEXTBOX::SetLineStyle;
|
|
|
|
LINE_STYLE ( PCB_TEXTBOX::*lineStyleGetter )() const = &PCB_TEXTBOX::GetLineStyle;
|
2023-08-31 11:49:15 +00:00
|
|
|
|
2023-08-31 02:33:55 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TEXTBOX, bool>( _HKI( "Border" ),
|
2024-01-20 17:05:21 +00:00
|
|
|
&PCB_TEXTBOX::SetBorderEnabled, &PCB_TEXTBOX::IsBorderEnabled ),
|
|
|
|
borderProps );
|
2023-08-31 11:49:15 +00:00
|
|
|
|
2023-11-25 13:05:45 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY_ENUM<PCB_TEXTBOX, LINE_STYLE>( _HKI( "Border Style" ),
|
2024-01-20 17:05:21 +00:00
|
|
|
lineStyleSetter, lineStyleGetter ),
|
|
|
|
borderProps );
|
2023-08-31 11:49:15 +00:00
|
|
|
|
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TEXTBOX, int>( _HKI( "Border Width" ),
|
2024-01-20 17:05:21 +00:00
|
|
|
&PCB_TEXTBOX::SetBorderWidth, &PCB_TEXTBOX::GetBorderWidth,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
borderProps );
|
|
|
|
|
|
|
|
const wxString marginProps = _( "Margins" );
|
|
|
|
|
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TEXTBOX, int>( _HKI( "Margin Left" ),
|
|
|
|
&PCB_TEXTBOX::SetMarginLeft, &PCB_TEXTBOX::GetMarginLeft,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TEXTBOX, int>( _HKI( "Margin Top" ),
|
|
|
|
&PCB_TEXTBOX::SetMarginTop, &PCB_TEXTBOX::GetMarginTop,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TEXTBOX, int>( _HKI( "Margin Right" ),
|
|
|
|
&PCB_TEXTBOX::SetMarginRight, &PCB_TEXTBOX::GetMarginRight,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
propMgr.AddProperty( new PROPERTY<PCB_TEXTBOX, int>( _HKI( "Margin Bottom" ),
|
|
|
|
&PCB_TEXTBOX::SetMarginBottom, &PCB_TEXTBOX::GetMarginBottom,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
|
2022-01-30 10:52:52 +00:00
|
|
|
}
|
|
|
|
} _PCB_TEXTBOX_DESC;
|