2022-01-25 22:33:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-08-06 19:20:53 +00:00
|
|
|
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-01-25 22:33:37 +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-08-27 17:23:43 +00:00
|
|
|
#include <base_units.h>
|
2022-01-25 22:33:37 +00:00
|
|
|
#include <pgm_base.h>
|
|
|
|
#include <sch_edit_frame.h>
|
|
|
|
#include <plotters/plotter.h>
|
|
|
|
#include <widgets/msgpanel.h>
|
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <string_utils.h>
|
|
|
|
#include <schematic.h>
|
|
|
|
#include <settings/color_settings.h>
|
|
|
|
#include <sch_painter.h>
|
|
|
|
#include <wx/log.h>
|
|
|
|
#include <dialogs/html_message_box.h>
|
|
|
|
#include <project/project_file.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <sch_textbox.h>
|
2022-08-27 18:14:57 +00:00
|
|
|
#include <tools/sch_navigate_tool.h>
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
SCH_TEXTBOX::SCH_TEXTBOX( SCH_LAYER_ID aLayer, int aLineWidth, FILL_T aFillType,
|
|
|
|
const wxString& aText, KICAD_T aType ) :
|
|
|
|
SCH_SHAPE( SHAPE_T::RECTANGLE, aLayer, aLineWidth, aFillType, aType ),
|
|
|
|
EDA_TEXT( schIUScale, aText )
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
m_layer = aLayer;
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
|
|
SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
|
|
|
SetMultilineAllowed( true );
|
2023-04-09 11:14:21 +00:00
|
|
|
|
2023-08-08 16:32:08 +00:00
|
|
|
m_excludedFromSim = false;
|
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-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCH_TEXTBOX::SCH_TEXTBOX( const SCH_TEXTBOX& aText ) :
|
|
|
|
SCH_SHAPE( aText ),
|
|
|
|
EDA_TEXT( aText )
|
2023-04-09 11:14:21 +00:00
|
|
|
{
|
2023-08-08 16:32:08 +00:00
|
|
|
m_excludedFromSim = aText.m_excludedFromSim;
|
2024-01-20 17:05:21 +00:00
|
|
|
m_marginLeft = aText.m_marginLeft;
|
|
|
|
m_marginTop = aText.m_marginTop;
|
|
|
|
m_marginRight = aText.m_marginRight;
|
|
|
|
m_marginBottom = aText.m_marginBottom;
|
2023-04-09 11:14:21 +00:00
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
int SCH_TEXTBOX::GetLegacyTextMargin() const
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
if( m_layer == LAYER_DEVICE )
|
|
|
|
return KiROUND( GetTextSize().y * 0.8 );
|
|
|
|
else
|
|
|
|
return KiROUND( GetStroke().GetWidth() / 2.0 ) + KiROUND( GetTextSize().y * 0.75 );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_TEXTBOX::MirrorHorizontally( int aCenter )
|
|
|
|
{
|
|
|
|
// Text is NOT really mirrored; it just has its justification flipped
|
|
|
|
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
|
|
|
{
|
2024-02-03 13:43:41 +00:00
|
|
|
if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
|
|
|
|
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
|
|
|
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
|
|
|
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_TEXTBOX::MirrorVertically( int aCenter )
|
|
|
|
{
|
|
|
|
// Text is NOT really mirrored; it just has its justification flipped
|
|
|
|
if( GetTextAngle() == ANGLE_VERTICAL )
|
|
|
|
{
|
2024-02-03 13:43:41 +00:00
|
|
|
if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
|
|
|
|
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
|
|
|
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
|
|
|
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-04 22:51:22 +00:00
|
|
|
void SCH_TEXTBOX::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-04 22:51:22 +00:00
|
|
|
SCH_SHAPE::Rotate( aCenter, aRotateCCW );
|
2022-01-25 22:33:37 +00:00
|
|
|
SetTextAngle( GetTextAngle() == ANGLE_VERTICAL ? ANGLE_HORIZONTAL : ANGLE_VERTICAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_TEXTBOX::Rotate90( bool aClockwise )
|
|
|
|
{
|
|
|
|
SetTextAngle( GetTextAngle() == ANGLE_VERTICAL ? ANGLE_HORIZONTAL : ANGLE_VERTICAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-31 19:11:21 +00:00
|
|
|
VECTOR2I SCH_TEXTBOX::GetDrawPos() const
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
BOX2I bbox;
|
2022-01-25 22:33:37 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( m_layer == LAYER_DEVICE ) // TODO: nuke symbol editor's upside-down coordinate system
|
|
|
|
{
|
|
|
|
bbox = BOX2I( VECTOR2I( std::min( m_start.x, m_end.x ), std::min( -m_start.y, -m_end.y ) ),
|
|
|
|
VECTOR2I( abs( m_end.x - m_start.x ), abs( m_end.y - m_start.y ) ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bbox = BOX2I( m_start, m_end - m_start );
|
|
|
|
|
|
|
|
bbox.Normalize();
|
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
VECTOR2I pos( bbox.GetLeft() + m_marginLeft, bbox.GetBottom() - m_marginBottom );
|
2022-09-02 18:15:40 +00:00
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
if( GetTextAngle().IsVertical() )
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2022-01-31 19:11:21 +00:00
|
|
|
switch( GetHorizJustify() )
|
|
|
|
{
|
|
|
|
case GR_TEXT_H_ALIGN_LEFT:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.y = bbox.GetBottom() - m_marginBottom;
|
2022-09-02 18:15:40 +00:00
|
|
|
break;
|
2022-01-31 19:11:21 +00:00
|
|
|
case GR_TEXT_H_ALIGN_CENTER:
|
2022-09-02 18:15:40 +00:00
|
|
|
pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
|
|
|
|
break;
|
2022-01-31 19:11:21 +00:00
|
|
|
case GR_TEXT_H_ALIGN_RIGHT:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.y = bbox.GetTop() + m_marginTop;
|
2022-09-02 18:15:40 +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-09-02 18:15:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( GetVertJustify() )
|
|
|
|
{
|
|
|
|
case GR_TEXT_V_ALIGN_TOP:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.x = bbox.GetLeft() + m_marginLeft;
|
2022-09-02 18:15:40 +00:00
|
|
|
break;
|
|
|
|
case GR_TEXT_V_ALIGN_CENTER:
|
|
|
|
pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
|
|
|
|
break;
|
|
|
|
case GR_TEXT_V_ALIGN_BOTTOM:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.x = bbox.GetRight() - m_marginRight;
|
2022-09-02 18:15:40 +00:00
|
|
|
break;
|
2024-02-03 13:43:41 +00:00
|
|
|
case GR_TEXT_V_ALIGN_INDETERMINATE:
|
|
|
|
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
|
|
|
|
break;
|
2022-01-31 19:11:21 +00:00
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-31 19:11:21 +00:00
|
|
|
switch( GetHorizJustify() )
|
|
|
|
{
|
|
|
|
case GR_TEXT_H_ALIGN_LEFT:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.x = bbox.GetLeft() + m_marginLeft;
|
2022-09-02 18:15:40 +00:00
|
|
|
break;
|
2022-01-31 19:11:21 +00:00
|
|
|
case GR_TEXT_H_ALIGN_CENTER:
|
2022-09-02 18:15:40 +00:00
|
|
|
pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
|
|
|
|
break;
|
2022-01-31 19:11:21 +00:00
|
|
|
case GR_TEXT_H_ALIGN_RIGHT:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.x = bbox.GetRight() - m_marginRight;
|
2022-09-02 18:15:40 +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-09-02 18:15:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( GetVertJustify() )
|
|
|
|
{
|
|
|
|
case GR_TEXT_V_ALIGN_TOP:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.y = bbox.GetTop() + m_marginTop;
|
2022-09-02 18:15:40 +00:00
|
|
|
break;
|
|
|
|
case GR_TEXT_V_ALIGN_CENTER:
|
|
|
|
pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
|
|
|
|
break;
|
|
|
|
case GR_TEXT_V_ALIGN_BOTTOM:
|
2024-01-20 17:05:21 +00:00
|
|
|
pos.y = bbox.GetBottom() - m_marginBottom;
|
2022-09-02 18:15:40 +00:00
|
|
|
break;
|
2024-02-03 13:43:41 +00:00
|
|
|
case GR_TEXT_V_ALIGN_INDETERMINATE:
|
|
|
|
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
|
|
|
|
break;
|
2022-01-31 19:11:21 +00:00
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
2022-02-01 00:26:37 +00:00
|
|
|
|
2022-09-02 18:15:40 +00:00
|
|
|
return pos;
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_TEXTBOX::SwapData( SCH_ITEM* aItem )
|
|
|
|
{
|
2023-07-08 17:37:47 +00:00
|
|
|
SCH_SHAPE::SwapData( aItem );
|
|
|
|
|
2022-01-25 22:33:37 +00:00
|
|
|
SCH_TEXTBOX* item = static_cast<SCH_TEXTBOX*>( aItem );
|
|
|
|
|
|
|
|
std::swap( m_layer, item->m_layer );
|
2024-01-20 17:05:21 +00:00
|
|
|
std::swap( m_marginLeft, item->m_marginLeft );
|
|
|
|
std::swap( m_marginTop, item->m_marginTop );
|
|
|
|
std::swap( m_marginRight, item->m_marginRight );
|
|
|
|
std::swap( m_marginBottom, item->m_marginBottom );
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
SwapText( *item );
|
|
|
|
SwapAttributes( *item );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SCH_TEXTBOX::operator<( const SCH_ITEM& aItem ) const
|
|
|
|
{
|
|
|
|
if( Type() != aItem.Type() )
|
|
|
|
return Type() < aItem.Type();
|
|
|
|
|
|
|
|
auto other = static_cast<const SCH_TEXTBOX*>( &aItem );
|
|
|
|
|
|
|
|
if( GetLayer() != other->GetLayer() )
|
2024-01-20 17:05:21 +00:00
|
|
|
return GetLayer() < other->GetLayer();
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
if( GetPosition().x != other->GetPosition().x )
|
|
|
|
return GetPosition().x < other->GetPosition().x;
|
|
|
|
|
|
|
|
if( GetPosition().y != other->GetPosition().y )
|
|
|
|
return GetPosition().y < other->GetPosition().y;
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
if( GetMarginLeft() != other->GetMarginLeft() )
|
|
|
|
return GetMarginLeft() < other->GetMarginLeft();
|
|
|
|
|
|
|
|
if( GetMarginTop() != other->GetMarginTop() )
|
|
|
|
return GetMarginTop() < other->GetMarginTop();
|
|
|
|
|
|
|
|
if( GetMarginRight() != other->GetMarginRight() )
|
|
|
|
return GetMarginRight() < other->GetMarginRight();
|
|
|
|
|
|
|
|
if( GetMarginBottom() != other->GetMarginBottom() )
|
|
|
|
return GetMarginBottom() < other->GetMarginBottom();
|
|
|
|
|
2023-08-08 16:32:08 +00:00
|
|
|
if( GetExcludedFromSim() != other->GetExcludedFromSim() )
|
|
|
|
return GetExcludedFromSim() - other->GetExcludedFromSim();
|
2023-04-09 11:14:21 +00:00
|
|
|
|
2022-01-25 22:33:37 +00:00
|
|
|
return GetText() < other->GetText();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-22 20:32:10 +00:00
|
|
|
KIFONT::FONT* SCH_TEXTBOX::getDrawFont() const
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
|
|
|
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
|
|
|
|
|
|
|
if( !font )
|
|
|
|
font = KIFONT::FONT::GetFont( GetDefaultFont(), IsBold(), IsItalic() );
|
|
|
|
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-05 21:35:32 +00:00
|
|
|
void SCH_TEXTBOX::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
|
|
|
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
if( IsPrivate() )
|
|
|
|
return;
|
|
|
|
|
2023-11-25 13:05:45 +00:00
|
|
|
wxDC* DC = aSettings->GetPrintDC();
|
2024-04-15 20:18:54 +00:00
|
|
|
int penWidth = GetEffectivePenWidth( aSettings );
|
2023-11-25 13:05:45 +00:00
|
|
|
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
|
|
|
VECTOR2I pt1 = GetStart();
|
|
|
|
VECTOR2I pt2 = GetEnd();
|
|
|
|
COLOR4D color = GetStroke().GetColor();
|
2024-04-15 20:18:54 +00:00
|
|
|
COLOR4D bg = aSettings->GetBackgroundColor();
|
2023-11-25 13:05:45 +00:00
|
|
|
LINE_STYLE lineStyle = GetStroke().GetLineStyle();
|
2022-01-28 22:51:34 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
|
|
|
bg = COLOR4D::WHITE;
|
|
|
|
|
2024-04-05 21:35:32 +00:00
|
|
|
if( GetFillMode() == FILL_T::FILLED_WITH_COLOR && !blackAndWhiteMode && !aForceNoFill )
|
2022-01-28 22:51:34 +00:00
|
|
|
GRFilledRect( DC, pt1, pt2, 0, GetFillColor(), GetFillColor() );
|
|
|
|
|
2022-01-31 19:11:21 +00:00
|
|
|
if( penWidth > 0 )
|
2022-01-28 22:51:34 +00:00
|
|
|
{
|
2022-01-31 19:11:21 +00:00
|
|
|
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
|
|
|
|
|
2022-04-29 12:51:49 +00:00
|
|
|
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
|
2022-01-31 19:11:21 +00:00
|
|
|
color = aSettings->GetLayerColor( m_layer );
|
2022-01-28 22:51:34 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( aDimmed )
|
|
|
|
{
|
|
|
|
color.Desaturate( );
|
|
|
|
color = color.Mix( bg, 0.5f );
|
|
|
|
}
|
|
|
|
|
2023-11-25 13:05:45 +00:00
|
|
|
if( lineStyle == LINE_STYLE::DEFAULT )
|
|
|
|
lineStyle = LINE_STYLE::SOLID;
|
2022-04-29 12:51:49 +00:00
|
|
|
|
2023-11-25 13:05:45 +00:00
|
|
|
if( lineStyle == LINE_STYLE::SOLID )
|
2022-01-28 22:51:34 +00:00
|
|
|
{
|
2022-01-31 19:11:21 +00:00
|
|
|
GRRect( DC, pt1, pt2, penWidth, color );
|
2022-01-28 22:51:34 +00:00
|
|
|
}
|
2022-01-31 19:11:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
|
2022-01-28 22:51:34 +00:00
|
|
|
|
2022-01-31 19:11:21 +00:00
|
|
|
for( SHAPE* shape : shapes )
|
|
|
|
{
|
2022-04-29 12:51:49 +00:00
|
|
|
STROKE_PARAMS::Stroke( shape, lineStyle, penWidth, aSettings,
|
2024-04-15 20:18:54 +00:00
|
|
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
|
|
|
{
|
|
|
|
if( m_layer == LAYER_DEVICE )
|
|
|
|
{
|
|
|
|
VECTOR2I ptA = aSettings->TransformCoordinate( a ) + aOffset;
|
|
|
|
VECTOR2I ptB = aSettings->TransformCoordinate( b ) + aOffset;
|
|
|
|
GRLine( DC, ptA.x, ptA.y, ptB.x, ptB.y, penWidth, color );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
|
|
|
|
}
|
|
|
|
} );
|
2022-01-31 19:11:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for( SHAPE* shape : shapes )
|
|
|
|
delete shape;
|
|
|
|
}
|
2022-01-28 22:51:34 +00:00
|
|
|
}
|
|
|
|
|
2022-04-29 12:51:49 +00:00
|
|
|
color = GetTextColor();
|
2022-04-27 21:45:22 +00:00
|
|
|
|
2022-04-29 12:51:49 +00:00
|
|
|
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
|
|
|
|
color = aSettings->GetLayerColor( m_layer );
|
2022-04-27 21:45:22 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( aDimmed )
|
|
|
|
{
|
|
|
|
color.Desaturate( );
|
|
|
|
color = color.Mix( bg, 0.5f );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_layer == LAYER_DEVICE )
|
|
|
|
{
|
|
|
|
SCH_TEXTBOX temp( *this );
|
|
|
|
|
|
|
|
if( aSettings->m_Transform.y1 )
|
|
|
|
{
|
|
|
|
temp.SetTextAngle( temp.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
|
|
|
|
: ANGLE_HORIZONTAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
// NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
|
|
|
|
temp.SetStart( VECTOR2I( pt1.x, -pt1.y ) );
|
|
|
|
temp.SetEnd( VECTOR2I( pt2.x, -pt2.y ) );
|
|
|
|
|
|
|
|
GRPrintText( DC, temp.GetDrawPos(), color, temp.GetShownText( true ), temp.GetTextAngle(),
|
|
|
|
temp.GetTextSize(), temp.GetHorizJustify(), temp.GetVertJustify(), penWidth,
|
|
|
|
temp.IsItalic(), temp.IsBold(), getDrawFont(), GetFontMetrics() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EDA_TEXT::Print( aSettings, aOffset, color );
|
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
wxString SCH_TEXTBOX::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
|
|
|
int aDepth ) const
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2023-05-05 13:21:56 +00:00
|
|
|
SCH_SHEET* sheet = nullptr;
|
|
|
|
|
|
|
|
if( aPath )
|
|
|
|
sheet = aPath->Last();
|
|
|
|
|
2022-01-25 22:33:37 +00:00
|
|
|
std::function<bool( wxString* )> textResolver =
|
|
|
|
[&]( wxString* token ) -> bool
|
|
|
|
{
|
2023-05-05 13:21:56 +00:00
|
|
|
if( sheet )
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2023-11-11 17:41:44 +00:00
|
|
|
if( sheet->ResolveTextVar( aPath, token, aDepth + 1 ) )
|
2022-01-25 22:33:37 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
if( HasTextVars() )
|
|
|
|
{
|
|
|
|
if( aDepth < 10 )
|
2023-01-17 16:54:08 +00:00
|
|
|
text = ExpandTextVars( text, &textResolver );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
2023-11-11 17:41:44 +00:00
|
|
|
VECTOR2I size = GetEnd() - GetStart();
|
2024-01-20 17:05:21 +00:00
|
|
|
int colWidth;
|
|
|
|
|
|
|
|
if( GetTextAngle().IsVertical() )
|
|
|
|
colWidth = abs( size.y ) - ( GetMarginTop() + GetMarginBottom() );
|
|
|
|
else
|
|
|
|
colWidth = abs( size.x ) - ( GetMarginLeft() + GetMarginRight() );
|
2022-01-25 22:33:37 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
getDrawFont()->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(),
|
|
|
|
IsItalic() );
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|
|
|
{
|
2022-08-31 12:56:58 +00:00
|
|
|
BOX2I rect = GetBoundingBox();
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
return rect.Contains( aPosition );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool SCH_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2022-08-31 09:33:46 +00:00
|
|
|
BOX2I rect = aRect;
|
2022-01-25 22:33:37 +00:00
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
if( aContained )
|
|
|
|
return rect.Contains( GetBoundingBox() );
|
|
|
|
|
|
|
|
return rect.Intersects( GetBoundingBox() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-27 18:14:57 +00:00
|
|
|
void SCH_TEXTBOX::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
|
|
|
|
{
|
|
|
|
wxCHECK_MSG( IsHypertext(), /* void */,
|
2024-02-09 13:53:22 +00:00
|
|
|
wxT( "Calling a hypertext menu on a SCH_TEXTBOX with no hyperlink?" ) );
|
2022-08-27 18:14:57 +00:00
|
|
|
|
|
|
|
SCH_NAVIGATE_TOOL* navTool = aFrame->GetToolManager()->GetTool<SCH_NAVIGATE_TOOL>();
|
|
|
|
navTool->HypertextCommand( m_hyperlink );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString SCH_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
return wxString::Format( _( "Text Box" ) );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BITMAPS SCH_TEXTBOX::GetMenuImage() const
|
|
|
|
{
|
|
|
|
return BITMAPS::add_textbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-05 21:35:32 +00:00
|
|
|
void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
|
|
|
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
|
2022-01-25 22:33:37 +00:00
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
if( IsPrivate() )
|
|
|
|
return;
|
|
|
|
|
2022-02-10 19:49:25 +00:00
|
|
|
if( aBackground )
|
|
|
|
{
|
2024-04-05 21:35:32 +00:00
|
|
|
SCH_SHAPE::Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
|
2022-02-10 19:49:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
SCH_SHEET_PATH* sheet = Schematic() ? &Schematic()->CurrentSheet() : nullptr;
|
2024-04-06 13:14:44 +00:00
|
|
|
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
|
|
|
|
int penWidth = GetEffectivePenWidth( renderSettings );
|
|
|
|
COLOR4D color = GetStroke().GetColor();
|
2024-04-15 20:18:54 +00:00
|
|
|
COLOR4D bg = renderSettings->GetBackgroundColor();
|
2024-04-06 13:14:44 +00:00
|
|
|
LINE_STYLE lineStyle = GetStroke().GetLineStyle();
|
2022-01-25 22:33:37 +00:00
|
|
|
|
2022-01-31 19:11:21 +00:00
|
|
|
if( penWidth > 0 )
|
|
|
|
{
|
2022-04-29 12:51:49 +00:00
|
|
|
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
2024-04-06 13:14:44 +00:00
|
|
|
color = renderSettings->GetLayerColor( m_layer );
|
2022-03-30 19:37:56 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( aDimmed )
|
|
|
|
{
|
|
|
|
color.Desaturate( );
|
|
|
|
color = color.Mix( bg, 0.5f );
|
|
|
|
}
|
|
|
|
|
2023-11-25 13:05:45 +00:00
|
|
|
if( lineStyle == LINE_STYLE::DEFAULT )
|
|
|
|
lineStyle = LINE_STYLE::SOLID;
|
2022-04-29 12:51:49 +00:00
|
|
|
|
|
|
|
aPlotter->SetColor( color );
|
2022-06-28 18:06:17 +00:00
|
|
|
aPlotter->SetDash( penWidth, lineStyle );
|
2022-01-31 19:11:21 +00:00
|
|
|
aPlotter->Rect( m_start, m_end, FILL_T::NO_FILL, penWidth );
|
2023-11-25 13:05:45 +00:00
|
|
|
aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
|
2022-01-31 19:11:21 +00:00
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
KIFONT::FONT* font = getDrawFont();
|
2022-10-22 20:32:10 +00:00
|
|
|
|
2022-04-29 12:51:49 +00:00
|
|
|
color = GetTextColor();
|
|
|
|
|
|
|
|
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
2024-04-06 13:14:44 +00:00
|
|
|
color = renderSettings->GetLayerColor( m_layer );
|
2022-04-27 21:45:22 +00:00
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
|
|
|
|
bg = COLOR4D::WHITE;
|
|
|
|
|
|
|
|
if( aDimmed )
|
|
|
|
{
|
|
|
|
color.Desaturate( );
|
|
|
|
color = color.Mix( bg, 0.5f );
|
|
|
|
}
|
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
penWidth = GetEffectiveTextPenWidth( renderSettings->GetDefaultPenWidth() );
|
|
|
|
penWidth = std::max( penWidth, renderSettings->GetMinPenWidth() );
|
2022-01-25 22:33:37 +00:00
|
|
|
aPlotter->SetCurrentLineWidth( penWidth );
|
|
|
|
|
|
|
|
std::vector<VECTOR2I> positions;
|
|
|
|
wxArrayString strings_list;
|
2024-03-23 16:50:00 +00:00
|
|
|
wxStringSplit( GetShownText( sheet, true ), strings_list, '\n' );
|
2022-01-25 22:33:37 +00:00
|
|
|
positions.reserve( strings_list.Count() );
|
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
if( m_layer == LAYER_DEVICE )
|
|
|
|
{
|
|
|
|
VECTOR2I start = renderSettings->TransformCoordinate( m_start ) + aOffset;
|
|
|
|
VECTOR2I end = renderSettings->TransformCoordinate( m_end ) + aOffset;
|
|
|
|
SCH_TEXTBOX temp( *this );
|
|
|
|
|
|
|
|
if( renderSettings->m_Transform.y1 )
|
|
|
|
{
|
|
|
|
temp.SetTextAngle( temp.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
|
|
|
|
: ANGLE_HORIZONTAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
// NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
|
|
|
|
temp.SetStart( VECTOR2I( start.x, -start.y ) );
|
|
|
|
temp.SetEnd( VECTOR2I( end.x, -end.y ) );
|
|
|
|
temp.GetLinePositions( positions, (int) strings_list.Count() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetLinePositions( positions, (int) strings_list.Count() );
|
|
|
|
}
|
2022-01-25 22:33:37 +00:00
|
|
|
|
2023-02-24 08:44:25 +00:00
|
|
|
TEXT_ATTRIBUTES attrs = GetAttributes();
|
|
|
|
attrs.m_StrokeWidth = penWidth;
|
|
|
|
attrs.m_Multiline = false;
|
|
|
|
|
2022-01-25 22:33:37 +00:00
|
|
|
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
|
|
|
{
|
2023-08-06 19:20:53 +00:00
|
|
|
aPlotter->PlotText( positions[ii], color, strings_list.Item( ii ), attrs, font,
|
|
|
|
GetFontMetrics() );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
2022-05-14 13:52:53 +00:00
|
|
|
|
|
|
|
if( HasHyperlink() )
|
2022-07-03 15:19:55 +00:00
|
|
|
aPlotter->HyperlinkBox( GetBoundingBox(), GetHyperlink() );
|
2022-01-25 22:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_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-25 22:33:37 +00:00
|
|
|
|
2023-08-08 16:32:08 +00:00
|
|
|
if( m_excludedFromSim )
|
2023-04-09 11:14:21 +00:00
|
|
|
aList.emplace_back( _( "Exclude from" ), _( "Simulation" ) );
|
|
|
|
|
2022-10-22 20:32:10 +00:00
|
|
|
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
2022-04-26 17:52:53 +00:00
|
|
|
|
2022-01-25 22:33:37 +00:00
|
|
|
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
|
|
|
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
|
|
|
aList.emplace_back( _( "Style" ), textStyle[style] );
|
|
|
|
|
2022-09-19 16:09:59 +00:00
|
|
|
aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
2022-03-20 15:57:18 +00:00
|
|
|
|
2022-09-19 16:09:59 +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 16:09:59 +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-25 22:33:37 +00:00
|
|
|
}
|
2023-06-21 01:57:20 +00:00
|
|
|
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
bool SCH_TEXTBOX::operator==( const SCH_ITEM& aOther ) const
|
|
|
|
{
|
|
|
|
if( Type() != aOther.Type() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const SCH_TEXTBOX& other = static_cast<const SCH_TEXTBOX&>( aOther );
|
|
|
|
|
|
|
|
if( m_excludedFromSim != other.m_excludedFromSim )
|
|
|
|
return false;
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
if( GetMarginLeft() != other.GetMarginLeft() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( GetMarginTop() != other.GetMarginTop() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( GetMarginRight() != other.GetMarginRight() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( GetMarginBottom() != other.GetMarginBottom() )
|
|
|
|
return false;
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
return SCH_SHAPE::operator==( aOther ) && EDA_TEXT::operator==( other );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double SCH_TEXTBOX::Similarity( const SCH_ITEM& aOther ) const
|
|
|
|
{
|
2024-04-15 20:18:54 +00:00
|
|
|
if( m_Uuid == aOther.m_Uuid )
|
|
|
|
return 1.0;
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
if( aOther.Type() != Type() )
|
|
|
|
return 0.0;
|
|
|
|
|
|
|
|
auto other = static_cast<const SCH_TEXTBOX&>( aOther );
|
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
double similarity = SimilarityBase( other );
|
2023-09-14 21:39:42 +00:00
|
|
|
|
|
|
|
if( m_excludedFromSim != other.m_excludedFromSim )
|
|
|
|
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 *= SCH_SHAPE::Similarity( aOther );
|
|
|
|
similarity *= EDA_TEXT::Similarity( other );
|
|
|
|
|
|
|
|
return similarity;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-15 20:18:54 +00:00
|
|
|
int SCH_TEXTBOX::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
|
|
|
|
{
|
|
|
|
wxASSERT( aOther.Type() == SCH_TEXTBOX_T );
|
|
|
|
|
|
|
|
int retv = SCH_SHAPE::compare( aOther, aCompareFlags );
|
|
|
|
|
|
|
|
if( retv )
|
|
|
|
return retv;
|
|
|
|
|
|
|
|
const SCH_TEXTBOX* tmp = static_cast<const SCH_TEXTBOX*>( &aOther );
|
|
|
|
|
|
|
|
int result = GetText().CmpNoCase( tmp->GetText() );
|
|
|
|
|
|
|
|
if( result != 0 )
|
|
|
|
return result;
|
|
|
|
|
|
|
|
if( GetTextWidth() != tmp->GetTextWidth() )
|
|
|
|
return GetTextWidth() - tmp->GetTextWidth();
|
|
|
|
|
|
|
|
if( GetTextHeight() != tmp->GetTextHeight() )
|
|
|
|
return GetTextHeight() - tmp->GetTextHeight();
|
|
|
|
|
|
|
|
if( IsBold() != tmp->IsBold() )
|
|
|
|
return IsBold() - tmp->IsBold();
|
|
|
|
|
|
|
|
if( IsItalic() != tmp->IsItalic() )
|
|
|
|
return IsItalic() - tmp->IsItalic();
|
|
|
|
|
|
|
|
if( GetHorizJustify() != tmp->GetHorizJustify() )
|
|
|
|
return GetHorizJustify() - tmp->GetHorizJustify();
|
|
|
|
|
|
|
|
if( GetTextAngle().AsTenthsOfADegree() != tmp->GetTextAngle().AsTenthsOfADegree() )
|
|
|
|
return GetTextAngle().AsTenthsOfADegree() - tmp->GetTextAngle().AsTenthsOfADegree();
|
|
|
|
|
|
|
|
if( GetMarginLeft() != tmp->GetMarginLeft() )
|
|
|
|
return GetMarginLeft() - tmp->GetMarginLeft();
|
|
|
|
|
|
|
|
if( GetMarginTop() != tmp->GetMarginTop() )
|
|
|
|
return GetMarginTop() - tmp->GetMarginTop();
|
|
|
|
|
|
|
|
if( GetMarginRight() != tmp->GetMarginRight() )
|
|
|
|
return GetMarginRight() - tmp->GetMarginRight();
|
|
|
|
|
|
|
|
if( GetMarginBottom() != tmp->GetMarginBottom() )
|
|
|
|
return GetMarginBottom() - tmp->GetMarginBottom();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-06-21 01:57:20 +00:00
|
|
|
static struct SCH_TEXTBOX_DESC
|
|
|
|
{
|
|
|
|
SCH_TEXTBOX_DESC()
|
|
|
|
{
|
|
|
|
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
|
|
|
REGISTER_TYPE( SCH_TEXTBOX );
|
|
|
|
|
|
|
|
propMgr.AddTypeCast( new TYPE_CAST<SCH_TEXTBOX, SCH_SHAPE> );
|
2023-10-30 17:29:38 +00:00
|
|
|
propMgr.AddTypeCast( new TYPE_CAST<SCH_TEXTBOX, EDA_SHAPE> );
|
2023-06-21 01:57:20 +00:00
|
|
|
propMgr.AddTypeCast( new TYPE_CAST<SCH_TEXTBOX, EDA_TEXT> );
|
|
|
|
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( SCH_SHAPE ) );
|
2023-10-30 17:29:38 +00:00
|
|
|
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ) );
|
2023-06-21 01:57:20 +00:00
|
|
|
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ) );
|
|
|
|
|
|
|
|
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
|
2023-10-30 17:29:38 +00:00
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
|
2023-10-30 17:29:38 +00:00
|
|
|
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
|
|
|
|
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Thickness" ) );
|
|
|
|
|
2024-01-20 17:05:21 +00:00
|
|
|
const wxString marginProps = _( "Margins" );
|
|
|
|
|
|
|
|
propMgr.AddProperty( new PROPERTY<SCH_TEXTBOX, int>( _HKI( "Margin Left" ),
|
|
|
|
&SCH_TEXTBOX::SetMarginLeft, &SCH_TEXTBOX::GetMarginLeft,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
propMgr.AddProperty( new PROPERTY<SCH_TEXTBOX, int>( _HKI( "Margin Top" ),
|
|
|
|
&SCH_TEXTBOX::SetMarginTop, &SCH_TEXTBOX::GetMarginTop,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
propMgr.AddProperty( new PROPERTY<SCH_TEXTBOX, int>( _HKI( "Margin Right" ),
|
|
|
|
&SCH_TEXTBOX::SetMarginRight, &SCH_TEXTBOX::GetMarginRight,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
propMgr.AddProperty( new PROPERTY<SCH_TEXTBOX, int>( _HKI( "Margin Bottom" ),
|
|
|
|
&SCH_TEXTBOX::SetMarginBottom, &SCH_TEXTBOX::GetMarginBottom,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
|
|
|
marginProps );
|
|
|
|
|
2023-10-30 17:29:38 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<SCH_TEXTBOX, int>( _HKI( "Text Size" ),
|
2024-01-20 17:05:21 +00:00
|
|
|
&SCH_TEXTBOX::SetSchTextSize, &SCH_TEXTBOX::GetSchTextSize,
|
|
|
|
PROPERTY_DISPLAY::PT_SIZE ),
|
2024-02-28 17:50:51 +00:00
|
|
|
_HKI( "Text Properties" ) );
|
2023-07-16 19:19:03 +00:00
|
|
|
|
|
|
|
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
|
2023-06-21 01:57:20 +00:00
|
|
|
}
|
|
|
|
} _SCH_TEXTBOX_DESC;
|