2012-06-11 00:47:15 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-03-11 12:08:34 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2021-06-08 14:09:24 +00:00
|
|
|
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
2012-06-11 00:47:15 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file eda_text.cpp
|
|
|
|
* @brief Implementation of base KiCad text object.
|
|
|
|
*/
|
|
|
|
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <algorithm> // for max
|
|
|
|
#include <stddef.h> // for NULL
|
|
|
|
#include <type_traits> // for swap
|
|
|
|
#include <vector> // for vector
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-10-14 01:06:53 +00:00
|
|
|
#include <eda_item.h> // for EDA_ITEM
|
2019-01-08 05:42:50 +00:00
|
|
|
#include <base_units.h>
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <basic_gal.h> // for BASIC_GAL, basic_gal
|
|
|
|
#include <convert_to_biu.h> // for Mils2iu
|
|
|
|
#include <eda_rect.h> // for EDA_RECT
|
|
|
|
#include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
|
|
|
|
#include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
|
|
|
|
#include <gal/stroke_font.h> // for STROKE_FONT
|
|
|
|
#include <gr_text.h> // for GRText
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h> // for UnescapeString
|
2021-06-08 14:09:24 +00:00
|
|
|
#include <math/util.h> // for KiROUND
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <math/vector2d.h> // for VECTOR2D
|
2020-10-24 12:44:03 +00:00
|
|
|
#include <richio.h>
|
2020-10-14 11:29:36 +00:00
|
|
|
#include <render_settings.h>
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <trigo.h> // for RotatePoint
|
2020-10-16 15:51:24 +00:00
|
|
|
#include <i18n_utility.h>
|
2020-07-15 16:22:56 +00:00
|
|
|
#include <geometry/shape_segment.h>
|
|
|
|
#include <geometry/shape_compound.h>
|
|
|
|
|
|
|
|
|
2020-11-23 10:43:22 +00:00
|
|
|
#include <wx/debug.h> // for wxASSERT
|
|
|
|
#include <wx/string.h> // wxString, wxArrayString
|
|
|
|
#include <wx/gdicmn.h> // for wxPoint,wxSize
|
2020-01-07 17:12:59 +00:00
|
|
|
|
|
|
|
class OUTPUTFORMATTER;
|
|
|
|
class wxFindReplaceData;
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2019-10-01 14:03:08 +00:00
|
|
|
|
2019-06-30 22:06:34 +00:00
|
|
|
EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify( int aHorizJustify )
|
|
|
|
{
|
|
|
|
wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
|
|
|
|
|
|
|
|
if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
|
|
|
|
return GR_TEXT_HJUSTIFY_RIGHT;
|
|
|
|
|
|
|
|
if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
|
|
|
|
return GR_TEXT_HJUSTIFY_LEFT;
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
|
|
|
|
{
|
|
|
|
wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
|
|
|
|
|
|
|
|
if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
|
|
|
|
return GR_TEXT_VJUSTIFY_BOTTOM;
|
|
|
|
|
|
|
|
if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
|
|
|
|
return GR_TEXT_VJUSTIFY_TOP;
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-18 20:04:41 +00:00
|
|
|
EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
2019-08-02 00:10:25 +00:00
|
|
|
m_text( text ),
|
2021-03-06 09:27:41 +00:00
|
|
|
m_e( 1 << TE_VISIBLE )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
int sz = Mils2iu( DEFAULT_SIZE_TEXT );
|
|
|
|
SetTextSize( wxSize( sz, sz ) );
|
2021-06-13 11:11:01 +00:00
|
|
|
cacheShownText();
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
2019-08-02 00:10:25 +00:00
|
|
|
m_text( aText.m_text ),
|
|
|
|
m_e( aText.m_e )
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
2021-06-13 11:11:01 +00:00
|
|
|
cacheShownText();
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-11 00:47:15 +00:00
|
|
|
EDA_TEXT::~EDA_TEXT()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-25 04:14:25 +00:00
|
|
|
void EDA_TEXT::SetText( const wxString& aText )
|
|
|
|
{
|
2019-08-02 00:10:25 +00:00
|
|
|
m_text = aText;
|
2021-06-13 11:11:01 +00:00
|
|
|
cacheShownText();
|
2019-04-25 04:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-27 18:57:14 +00:00
|
|
|
void EDA_TEXT::CopyText( const EDA_TEXT& aSrc )
|
|
|
|
{
|
|
|
|
m_text = aSrc.m_text;
|
|
|
|
m_shown_text = aSrc.m_shown_text;
|
2020-04-24 20:33:59 +00:00
|
|
|
m_shown_text_has_text_var_refs = aSrc.m_shown_text_has_text_var_refs;
|
2019-09-27 18:57:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
void EDA_TEXT::SetEffects( const EDA_TEXT& aSrc )
|
2016-04-19 18:35:47 +00:00
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
m_e = aSrc.m_e;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-08-02 00:10:25 +00:00
|
|
|
void EDA_TEXT::SwapText( EDA_TEXT& aTradingPartner )
|
|
|
|
{
|
|
|
|
std::swap( m_text, aTradingPartner.m_text );
|
|
|
|
std::swap( m_shown_text, aTradingPartner.m_shown_text );
|
2020-04-24 20:33:59 +00:00
|
|
|
std::swap( m_shown_text_has_text_var_refs, aTradingPartner.m_shown_text_has_text_var_refs );
|
2019-08-02 00:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
|
|
|
|
{
|
|
|
|
std::swap( m_e, aTradingPartner.m_e );
|
2016-04-19 18:35:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-30 06:59:43 +00:00
|
|
|
int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const
|
2020-04-13 19:55:27 +00:00
|
|
|
{
|
2020-04-14 12:25:00 +00:00
|
|
|
int width = GetTextThickness();
|
2020-04-13 19:55:27 +00:00
|
|
|
|
2020-04-30 06:59:43 +00:00
|
|
|
if( width <= 1 )
|
2020-04-14 12:25:00 +00:00
|
|
|
{
|
2020-04-30 06:59:43 +00:00
|
|
|
width = aDefaultWidth;
|
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
if( IsBold() )
|
|
|
|
width = GetPenSizeForBold( GetTextWidth() );
|
2020-05-12 14:02:24 +00:00
|
|
|
else if( width <= 1 )
|
|
|
|
width = GetPenSizeForNormal( GetTextWidth() );
|
2020-04-14 12:25:00 +00:00
|
|
|
}
|
2020-04-13 19:55:27 +00:00
|
|
|
|
|
|
|
// Clip pen size for small texts:
|
2020-04-21 20:17:01 +00:00
|
|
|
width = Clamp_Text_PenSize( width, GetTextSize(), ALLOW_BOLD_THICKNESS );
|
2020-04-13 19:55:27 +00:00
|
|
|
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-20 18:27:51 +00:00
|
|
|
bool EDA_TEXT::Replace( const wxFindReplaceData& aSearchData )
|
2019-08-02 00:10:25 +00:00
|
|
|
{
|
2020-04-18 11:04:52 +00:00
|
|
|
bool retval = EDA_ITEM::Replace( aSearchData, m_text );
|
2021-06-13 11:11:01 +00:00
|
|
|
cacheShownText();
|
2020-04-18 11:04:52 +00:00
|
|
|
|
|
|
|
return retval;
|
2019-08-02 00:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-13 11:11:01 +00:00
|
|
|
void EDA_TEXT::cacheShownText()
|
|
|
|
{
|
|
|
|
if( m_text.IsEmpty() || m_text == wxT( "~" ) ) // ~ is legacy empty-string token
|
|
|
|
{
|
|
|
|
m_shown_text = wxEmptyString;
|
|
|
|
m_shown_text_has_text_var_refs = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_shown_text = UnescapeString( m_text );
|
|
|
|
m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-18 20:04:41 +00:00
|
|
|
int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
basic_gal.SetFontItalic( IsItalic() );
|
|
|
|
basic_gal.SetFontBold( IsBold() );
|
2020-10-02 20:18:07 +00:00
|
|
|
basic_gal.SetFontUnderlined( false );
|
2019-08-02 00:10:25 +00:00
|
|
|
basic_gal.SetLineWidth( (float) aThickness );
|
2017-01-23 20:30:11 +00:00
|
|
|
basic_gal.SetGlyphSize( VECTOR2D( GetTextSize() ) );
|
2016-03-25 08:26:11 +00:00
|
|
|
|
2020-04-18 20:04:41 +00:00
|
|
|
VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
|
2016-03-25 08:26:11 +00:00
|
|
|
|
|
|
|
return KiROUND( tsize.x );
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
|
2014-09-13 18:15:45 +00:00
|
|
|
|
|
|
|
wxString EDA_TEXT::ShortenedShownText() const
|
|
|
|
{
|
|
|
|
wxString tmp = GetShownText();
|
2017-01-23 20:30:11 +00:00
|
|
|
|
2014-09-13 18:15:45 +00:00
|
|
|
tmp.Replace( wxT( "\n" ), wxT( " " ) );
|
|
|
|
tmp.Replace( wxT( "\r" ), wxT( " " ) );
|
|
|
|
tmp.Replace( wxT( "\t" ), wxT( " " ) );
|
|
|
|
|
2020-03-29 01:12:29 +00:00
|
|
|
if( tmp.Length() > 36 )
|
|
|
|
tmp = tmp.Left( 34 ) + wxT( "..." );
|
2014-09-13 18:15:45 +00:00
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-08-03 23:03:35 +00:00
|
|
|
int EDA_TEXT::GetInterline() const
|
2013-10-25 12:16:18 +00:00
|
|
|
{
|
2019-08-03 23:03:35 +00:00
|
|
|
return KiROUND( KIGFX::STROKE_FONT::GetInterline( GetTextHeight() ) );
|
2013-10-25 12:16:18 +00:00
|
|
|
}
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
|
|
|
EDA_RECT rect;
|
2015-01-15 20:01:53 +00:00
|
|
|
wxArrayString strings;
|
2014-09-13 18:15:45 +00:00
|
|
|
wxString text = GetShownText();
|
2020-04-14 12:25:00 +00:00
|
|
|
int thickness = GetEffectiveTextPenWidth();
|
2013-10-25 12:16:18 +00:00
|
|
|
int linecount = 1;
|
2016-03-23 07:41:47 +00:00
|
|
|
bool hasOverBar = false; // true if the first line of text as an overbar
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsMultilineAllowed() )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2015-01-15 20:01:53 +00:00
|
|
|
wxStringSplit( text, strings, '\n' );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2016-03-11 12:08:34 +00:00
|
|
|
if( strings.GetCount() ) // GetCount() == 0 for void strings
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2021-04-09 19:11:12 +00:00
|
|
|
if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
|
2015-01-15 20:01:53 +00:00
|
|
|
text = strings.Item( aLine );
|
2012-06-11 00:47:15 +00:00
|
|
|
else
|
2015-01-15 20:01:53 +00:00
|
|
|
text = strings.Item( 0 );
|
2013-10-25 12:16:18 +00:00
|
|
|
|
2015-01-15 20:01:53 +00:00
|
|
|
linecount = strings.GetCount();
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-23 07:41:47 +00:00
|
|
|
// Search for overbar symbol. Only text is scanned,
|
|
|
|
// because only this line can change the bounding box
|
|
|
|
for( unsigned ii = 1; ii < text.size(); ii++ )
|
|
|
|
{
|
2021-06-05 13:52:58 +00:00
|
|
|
if( text[ii-1] == '~' && text[ii] == '{' )
|
2016-03-23 07:41:47 +00:00
|
|
|
{
|
|
|
|
hasOverBar = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-11 00:47:15 +00:00
|
|
|
// calculate the H and V size
|
2019-10-21 18:03:54 +00:00
|
|
|
const auto& font = basic_gal.GetStrokeFont();
|
2020-04-14 12:25:00 +00:00
|
|
|
VECTOR2D fontSize( GetTextSize() );
|
2019-10-21 18:03:54 +00:00
|
|
|
double penWidth( thickness );
|
2020-04-18 20:04:41 +00:00
|
|
|
int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
|
2020-04-14 12:25:00 +00:00
|
|
|
int dy = GetInterline();
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
// Creates bounding box (rectangle) for horizontal, left and top justified text. The
|
|
|
|
// bounding box will be moved later according to the actual text options
|
2012-06-11 00:47:15 +00:00
|
|
|
wxSize textsize = wxSize( dx, dy );
|
2017-01-23 20:30:11 +00:00
|
|
|
wxPoint pos = GetTextPos();
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2021-04-09 19:11:12 +00:00
|
|
|
if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
|
|
|
|
{
|
|
|
|
pos.y -= aLine * GetInterline();
|
|
|
|
}
|
|
|
|
|
2012-06-11 00:47:15 +00:00
|
|
|
if( aInvertY )
|
2016-03-26 09:08:09 +00:00
|
|
|
pos.y = -pos.y;
|
2016-03-25 08:26:11 +00:00
|
|
|
|
|
|
|
rect.SetOrigin( pos );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2016-03-23 07:41:47 +00:00
|
|
|
if( hasOverBar )
|
2016-03-25 08:26:11 +00:00
|
|
|
{ // A overbar adds an extra size to the text
|
|
|
|
// Height from the base line text of chars like [ or {
|
2017-01-23 20:30:11 +00:00
|
|
|
double curr_height = GetTextHeight() * 1.15;
|
2020-10-02 20:18:07 +00:00
|
|
|
double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
|
2020-04-14 12:25:00 +00:00
|
|
|
int extra_height = KiROUND( overbarPosition - curr_height );
|
|
|
|
|
2019-10-21 18:03:54 +00:00
|
|
|
extra_height += thickness / 2;
|
2016-03-23 07:41:47 +00:00
|
|
|
textsize.y += extra_height;
|
|
|
|
rect.Move( wxPoint( 0, -extra_height ) );
|
|
|
|
}
|
2012-06-11 00:47:15 +00:00
|
|
|
|
|
|
|
// for multiline texts and aLine < 0, merge all rectangles
|
2016-03-11 12:08:34 +00:00
|
|
|
// ( if aLine < 0, we want the full text bounding box )
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsMultilineAllowed() && aLine < 0 )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2015-01-15 20:01:53 +00:00
|
|
|
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2015-01-15 20:01:53 +00:00
|
|
|
text = strings.Item( ii );
|
2020-04-18 20:04:41 +00:00
|
|
|
dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
|
2019-10-21 18:03:54 +00:00
|
|
|
textsize.x = std::max( textsize.x, dx );
|
2012-06-11 00:47:15 +00:00
|
|
|
textsize.y += dy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rect.SetSize( textsize );
|
|
|
|
|
|
|
|
/* Now, calculate the rect origin, according to text justification
|
|
|
|
* At this point the rectangle origin is the text origin (m_Pos).
|
|
|
|
* This is true only for left and top text justified texts (using top to bottom Y axis
|
|
|
|
* orientation). and must be recalculated for others justifications
|
|
|
|
* also, note the V justification is relative to the first line
|
|
|
|
*/
|
2017-01-23 20:30:11 +00:00
|
|
|
switch( GetHorizJustify() )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
|
|
|
case GR_TEXT_HJUSTIFY_LEFT:
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsMirrored() )
|
2012-06-11 00:47:15 +00:00
|
|
|
rect.SetX( rect.GetX() - rect.GetWidth() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_HJUSTIFY_CENTER:
|
|
|
|
rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
2017-01-23 20:30:11 +00:00
|
|
|
if( !IsMirrored() )
|
2012-06-11 00:47:15 +00:00
|
|
|
rect.SetX( rect.GetX() - rect.GetWidth() );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
switch( GetVertJustify() )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
|
|
|
case GR_TEXT_VJUSTIFY_TOP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_CENTER:
|
2013-10-25 12:16:18 +00:00
|
|
|
rect.SetY( rect.GetY() - ( dy / 2) );
|
2012-06-11 00:47:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
|
|
rect.SetY( rect.GetY() - dy );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-10-25 12:16:18 +00:00
|
|
|
if( linecount > 1 )
|
|
|
|
{
|
|
|
|
int yoffset;
|
|
|
|
linecount -= 1;
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
switch( GetVertJustify() )
|
2013-10-25 12:16:18 +00:00
|
|
|
{
|
|
|
|
case GR_TEXT_VJUSTIFY_TOP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_CENTER:
|
|
|
|
yoffset = linecount * GetInterline() / 2;
|
|
|
|
rect.SetY( rect.GetY() - yoffset );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
2019-08-03 23:03:35 +00:00
|
|
|
yoffset = linecount * GetInterline();
|
2013-10-25 12:16:18 +00:00
|
|
|
rect.SetY( rect.GetY() - yoffset );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-20 22:22:30 +00:00
|
|
|
// Many fonts draw diacriticals, descenders, etc. outside the X-height of the font. This
|
|
|
|
// will cacth most (but probably not all) of them.
|
|
|
|
rect.Inflate( 0, thickness * 1.5 );
|
|
|
|
|
2012-06-11 00:47:15 +00:00
|
|
|
rect.Normalize(); // Make h and v sizes always >= 0
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
|
|
|
{
|
2020-04-14 12:25:00 +00:00
|
|
|
EDA_RECT rect = GetTextBox();
|
2012-06-11 00:47:15 +00:00
|
|
|
wxPoint location = aPoint;
|
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
2017-01-23 20:30:11 +00:00
|
|
|
RotatePoint( &location, GetTextPos(), -GetTextAngle() );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
|
|
|
return rect.Contains( location );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
|
|
|
|
{
|
|
|
|
EDA_RECT rect = aRect;
|
|
|
|
|
|
|
|
rect.Inflate( aAccuracy );
|
|
|
|
|
|
|
|
if( aContains )
|
2020-04-14 12:25:00 +00:00
|
|
|
return rect.Contains( GetTextBox() );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
return rect.Intersects( GetTextBox(), GetTextAngle() );
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-20 18:18:54 +00:00
|
|
|
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
2021-07-26 17:28:37 +00:00
|
|
|
const COLOR4D& aColor, OUTLINE_MODE aFillMode )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsMultilineAllowed() )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2013-11-29 08:13:43 +00:00
|
|
|
std::vector<wxPoint> positions;
|
2015-01-15 20:01:53 +00:00
|
|
|
wxArrayString strings;
|
|
|
|
wxStringSplit( GetShownText(), strings, '\n' );
|
2017-01-23 20:30:11 +00:00
|
|
|
|
2015-01-15 20:01:53 +00:00
|
|
|
positions.reserve( strings.Count() );
|
2013-11-17 01:31:07 +00:00
|
|
|
|
2020-11-10 20:31:52 +00:00
|
|
|
GetLinePositions( positions, strings.Count() );
|
2013-11-17 01:31:07 +00:00
|
|
|
|
2015-01-15 20:01:53 +00:00
|
|
|
for( unsigned ii = 0; ii < strings.Count(); ii++ )
|
2020-04-14 12:25:00 +00:00
|
|
|
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
2020-04-14 12:25:00 +00:00
|
|
|
{
|
|
|
|
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
|
|
|
|
}
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
|
2013-11-29 08:13:43 +00:00
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
wxPoint pos = GetTextPos(); // Position of first line of the
|
|
|
|
// multiline text according to
|
|
|
|
// the center of the multiline text block
|
2013-11-29 08:13:43 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
wxPoint offset; // Offset to next line.
|
2013-11-29 08:13:43 +00:00
|
|
|
|
|
|
|
offset.y = GetInterline();
|
|
|
|
|
|
|
|
if( aLineCount > 1 )
|
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
switch( GetVertJustify() )
|
2013-11-29 08:13:43 +00:00
|
|
|
{
|
|
|
|
case GR_TEXT_VJUSTIFY_TOP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_CENTER:
|
|
|
|
pos.y -= ( aLineCount - 1 ) * offset.y / 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
|
|
pos.y -= ( aLineCount - 1 ) * offset.y;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rotate the position of the first line
|
|
|
|
// around the center of the multiline text block
|
2017-01-23 20:30:11 +00:00
|
|
|
RotatePoint( &pos, GetTextPos(), GetTextAngle() );
|
2014-04-25 16:49:32 +00:00
|
|
|
|
2013-11-29 08:13:43 +00:00
|
|
|
// Rotate the offset lines to increase happened in the right direction
|
2017-01-23 20:30:11 +00:00
|
|
|
RotatePoint( &offset, GetTextAngle() );
|
2013-11-29 08:13:43 +00:00
|
|
|
|
|
|
|
for( int ii = 0; ii < aLineCount; ii++ )
|
|
|
|
{
|
|
|
|
aPositions.push_back( pos );
|
|
|
|
pos += offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-20 18:18:54 +00:00
|
|
|
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
2021-06-08 14:09:24 +00:00
|
|
|
const COLOR4D& aColor, OUTLINE_MODE aFillMode,
|
2020-04-14 12:25:00 +00:00
|
|
|
const wxString& aText, const wxPoint &aPos )
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
2020-04-14 12:25:00 +00:00
|
|
|
wxDC* DC = aSettings->GetPrintDC();
|
|
|
|
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
|
|
|
if( aFillMode == SKETCH )
|
2020-04-14 12:25:00 +00:00
|
|
|
penWidth = -penWidth;
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
wxSize size = GetTextSize();
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsMirrored() )
|
2012-06-11 00:47:15 +00:00
|
|
|
size.x = -size.x;
|
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
|
2020-04-18 20:04:41 +00:00
|
|
|
GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-27 11:03:35 +00:00
|
|
|
wxString EDA_TEXT::GetTextStyleName() const
|
2012-06-11 00:47:15 +00:00
|
|
|
{
|
|
|
|
int style = 0;
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsItalic() )
|
2012-06-11 00:47:15 +00:00
|
|
|
style = 1;
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
if( IsBold() )
|
2012-06-11 00:47:15 +00:00
|
|
|
style += 2;
|
|
|
|
|
|
|
|
wxString stylemsg[4] = {
|
|
|
|
_("Normal"),
|
|
|
|
_("Italic"),
|
|
|
|
_("Bold"),
|
|
|
|
_("Bold+Italic")
|
|
|
|
};
|
|
|
|
|
|
|
|
return stylemsg[style];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool EDA_TEXT::IsDefaultFormatting() const
|
|
|
|
{
|
2020-04-14 12:25:00 +00:00
|
|
|
return ( IsVisible()
|
|
|
|
&& !IsMirrored()
|
|
|
|
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
|
|
|
|
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
|
|
|
|
&& GetTextThickness() == 0
|
2021-03-06 09:27:41 +00:00
|
|
|
&& !IsItalic()
|
|
|
|
&& !IsBold()
|
|
|
|
&& !IsMultilineAllowed()
|
2017-01-23 20:30:11 +00:00
|
|
|
);
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-27 21:44:41 +00:00
|
|
|
|
2012-06-11 00:47:15 +00:00
|
|
|
void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
|
|
|
{
|
2013-05-21 07:18:25 +00:00
|
|
|
#ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
|
2019-01-08 05:42:50 +00:00
|
|
|
// and does not define FormatInternalUnits, used here
|
2013-05-21 07:18:25 +00:00
|
|
|
// however this function should exist
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
aFormatter->Print( aNestLevel + 1, "(effects" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
// Text size
|
|
|
|
aFormatter->Print( 0, " (font" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
aFormatter->Print( 0, " (size %s %s)",
|
|
|
|
FormatInternalUnits( GetTextHeight() ).c_str(),
|
|
|
|
FormatInternalUnits( GetTextWidth() ).c_str() );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( GetTextThickness() )
|
2021-09-27 09:34:32 +00:00
|
|
|
{
|
2021-06-08 14:09:24 +00:00
|
|
|
aFormatter->Print( 0, " (thickness %s)",
|
|
|
|
FormatInternalUnits( GetTextThickness() ).c_str() );
|
2021-09-27 09:34:32 +00:00
|
|
|
}
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( IsBold() )
|
|
|
|
aFormatter->Print( 0, " bold" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( IsItalic() )
|
|
|
|
aFormatter->Print( 0, " italic" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
aFormatter->Print( 0, ")"); // (font
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2021-09-27 09:34:32 +00:00
|
|
|
if( IsMirrored() || GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER
|
|
|
|
|| GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
|
2020-12-20 18:50:45 +00:00
|
|
|
{
|
|
|
|
aFormatter->Print( 0, " (justify");
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
|
2021-09-27 09:34:32 +00:00
|
|
|
aFormatter->Print( 0, GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ? " left" : " right" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
|
2021-09-27 09:34:32 +00:00
|
|
|
aFormatter->Print( 0, GetVertJustify() == GR_TEXT_VJUSTIFY_TOP ? " top" : " bottom" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( IsMirrored() )
|
|
|
|
aFormatter->Print( 0, " mirror" );
|
2021-06-08 14:09:24 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
aFormatter->Print( 0, ")" ); // (justify
|
|
|
|
}
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
|
|
|
|
aFormatter->Print( 0, " hide" );
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2020-12-20 18:50:45 +00:00
|
|
|
aFormatter->Print( 0, ")\n" ); // (justify
|
2012-06-11 00:47:15 +00:00
|
|
|
|
2013-05-21 07:18:25 +00:00
|
|
|
#endif
|
2012-06-11 00:47:15 +00:00
|
|
|
}
|
2014-08-13 15:47:02 +00:00
|
|
|
|
|
|
|
// Convert the text shape to a list of segment
|
|
|
|
// each segment is stored as 2 wxPoints: its starting point and its ending point
|
2019-05-31 12:15:25 +00:00
|
|
|
// we are using GRText to create the segments and therefore a call-back function is needed
|
2014-08-13 15:47:02 +00:00
|
|
|
|
2019-05-31 12:15:25 +00:00
|
|
|
// This is a call back function, used by GRText to put each segment in buffer
|
2018-04-06 13:30:52 +00:00
|
|
|
static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData )
|
2014-08-13 15:47:02 +00:00
|
|
|
{
|
2018-04-06 13:30:52 +00:00
|
|
|
std::vector<wxPoint>* cornerBuffer = static_cast<std::vector<wxPoint>*>( aData );
|
|
|
|
cornerBuffer->push_back( wxPoint( x0, y0 ) );
|
|
|
|
cornerBuffer->push_back( wxPoint( xf, yf ) );
|
2014-08-13 15:47:02 +00:00
|
|
|
}
|
|
|
|
|
2019-05-31 12:15:25 +00:00
|
|
|
|
2020-11-21 11:26:57 +00:00
|
|
|
std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const
|
2014-08-13 15:47:02 +00:00
|
|
|
{
|
2020-11-21 11:26:57 +00:00
|
|
|
std::vector<wxPoint> cornerBuffer;
|
2017-01-23 20:30:11 +00:00
|
|
|
wxSize size = GetTextSize();
|
2014-08-13 15:47:02 +00:00
|
|
|
|
|
|
|
if( IsMirrored() )
|
2015-06-26 13:41:56 +00:00
|
|
|
size.x = -size.x;
|
2014-08-13 15:47:02 +00:00
|
|
|
|
2020-04-13 19:55:27 +00:00
|
|
|
bool forceBold = true;
|
|
|
|
int penWidth = 0; // use max-width for bold text
|
|
|
|
|
2019-05-31 12:15:25 +00:00
|
|
|
COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
|
2014-08-13 15:47:02 +00:00
|
|
|
|
|
|
|
if( IsMultilineAllowed() )
|
|
|
|
{
|
2015-01-15 20:01:53 +00:00
|
|
|
wxArrayString strings_list;
|
|
|
|
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
|
2014-08-13 15:47:02 +00:00
|
|
|
std::vector<wxPoint> positions;
|
2015-01-15 20:01:53 +00:00
|
|
|
positions.reserve( strings_list.Count() );
|
2020-11-10 20:31:52 +00:00
|
|
|
GetLinePositions( positions, strings_list.Count() );
|
2014-08-13 15:47:02 +00:00
|
|
|
|
2015-01-15 20:01:53 +00:00
|
|
|
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
2014-08-13 15:47:02 +00:00
|
|
|
{
|
2015-01-15 20:01:53 +00:00
|
|
|
wxString txt = strings_list.Item( ii );
|
2021-07-15 19:26:35 +00:00
|
|
|
GRText( nullptr, positions[ii], color, txt, GetDrawRotation(), size, GetHorizJustify(),
|
2020-04-18 20:04:41 +00:00
|
|
|
GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
|
2020-11-21 11:26:57 +00:00
|
|
|
&cornerBuffer );
|
2014-08-13 15:47:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-15 19:26:35 +00:00
|
|
|
GRText( nullptr, GetTextPos(), color, GetShownText(), GetDrawRotation(), size,
|
2020-11-27 18:04:30 +00:00
|
|
|
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), forceBold,
|
|
|
|
addTextSegmToBuffer, &cornerBuffer );
|
2014-08-13 15:47:02 +00:00
|
|
|
}
|
2020-11-21 11:26:57 +00:00
|
|
|
|
|
|
|
return cornerBuffer;
|
2014-08-13 15:47:02 +00:00
|
|
|
}
|
2020-02-02 18:40:14 +00:00
|
|
|
|
|
|
|
|
2020-09-19 11:47:43 +00:00
|
|
|
std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const
|
2020-07-15 16:22:56 +00:00
|
|
|
{
|
2020-10-31 19:13:30 +00:00
|
|
|
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
|
2020-07-15 16:22:56 +00:00
|
|
|
int penWidth = GetEffectiveTextPenWidth();
|
2020-11-21 11:26:57 +00:00
|
|
|
std::vector<wxPoint> pts = TransformToSegmentList();
|
2020-07-15 16:22:56 +00:00
|
|
|
|
|
|
|
for( unsigned jj = 0; jj < pts.size(); jj += 2 )
|
|
|
|
shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
|
|
|
|
|
|
|
|
return shape;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-01 16:45:05 +00:00
|
|
|
double EDA_TEXT::GetDrawRotation() const
|
|
|
|
{
|
|
|
|
return GetTextAngle();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
static struct EDA_TEXT_DESC
|
|
|
|
{
|
|
|
|
EDA_TEXT_DESC()
|
|
|
|
{
|
|
|
|
ENUM_MAP<EDA_TEXT_HJUSTIFY_T>::Instance()
|
2020-10-16 15:51:24 +00:00
|
|
|
.Map( GR_TEXT_HJUSTIFY_LEFT, _HKI( "Left" ) )
|
|
|
|
.Map( GR_TEXT_HJUSTIFY_CENTER, _HKI( "Center" ) )
|
|
|
|
.Map( GR_TEXT_HJUSTIFY_RIGHT, _HKI( "Right" ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
ENUM_MAP<EDA_TEXT_VJUSTIFY_T>::Instance()
|
2020-10-16 15:51:24 +00:00
|
|
|
.Map( GR_TEXT_VJUSTIFY_TOP, _HKI( "Top" ) )
|
|
|
|
.Map( GR_TEXT_VJUSTIFY_CENTER, _HKI( "Center" ) )
|
|
|
|
.Map( GR_TEXT_VJUSTIFY_BOTTOM, _HKI( "Bottom" ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
|
|
|
|
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
|
|
|
REGISTER_TYPE( EDA_TEXT );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _HKI( "Text" ),
|
2020-02-02 18:40:14 +00:00
|
|
|
&EDA_TEXT::SetText, &EDA_TEXT::GetText ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Thickness" ),
|
2021-06-08 14:09:24 +00:00
|
|
|
&EDA_TEXT::SetTextThickness,
|
|
|
|
&EDA_TEXT::GetTextThickness,
|
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Italic" ),
|
2021-07-15 19:26:35 +00:00
|
|
|
&EDA_TEXT::SetItalic,
|
|
|
|
&EDA_TEXT::IsItalic ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Bold" ),
|
2021-07-15 19:26:35 +00:00
|
|
|
&EDA_TEXT::SetBold, &EDA_TEXT::IsBold ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Mirrored" ),
|
2021-07-15 19:26:35 +00:00
|
|
|
&EDA_TEXT::SetMirrored,
|
|
|
|
&EDA_TEXT::IsMirrored ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Visible" ),
|
2021-07-15 19:26:35 +00:00
|
|
|
&EDA_TEXT::SetVisible,
|
|
|
|
&EDA_TEXT::IsVisible ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Width" ),
|
2021-06-08 14:09:24 +00:00
|
|
|
&EDA_TEXT::SetTextWidth,
|
|
|
|
&EDA_TEXT::GetTextWidth,
|
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
2020-10-16 15:51:24 +00:00
|
|
|
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Height" ),
|
2021-06-08 14:09:24 +00:00
|
|
|
&EDA_TEXT::SetTextHeight,
|
|
|
|
&EDA_TEXT::GetTextHeight,
|
|
|
|
PROPERTY_DISPLAY::DISTANCE ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
|
|
|
|
EDA_TEXT_HJUSTIFY_T>( _HKI( "Horizontal Justification" ),
|
|
|
|
&EDA_TEXT::SetHorizJustify,
|
|
|
|
&EDA_TEXT::GetHorizJustify ) );
|
|
|
|
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
|
|
|
|
EDA_TEXT_VJUSTIFY_T>( _HKI( "Vertical Justification" ),
|
|
|
|
&EDA_TEXT::SetVertJustify,
|
|
|
|
&EDA_TEXT::GetVertJustify ) );
|
2020-02-02 18:40:14 +00:00
|
|
|
}
|
|
|
|
} _EDA_TEXT_DESC;
|
|
|
|
|
|
|
|
ENUM_TO_WXANY( EDA_TEXT_HJUSTIFY_T )
|
|
|
|
ENUM_TO_WXANY( EDA_TEXT_VJUSTIFY_T )
|