You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

704 lines
22 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file eda_text.cpp
  26. * @brief Implementation of base KiCad text object.
  27. */
  28. #include <algorithm> // for max
  29. #include <stddef.h> // for NULL
  30. #include <type_traits> // for swap
  31. #include <vector> // for vector
  32. #include <eda_item.h> // for EDA_ITEM
  33. #include <base_units.h>
  34. #include <basic_gal.h> // for BASIC_GAL, basic_gal
  35. #include <convert_to_biu.h> // for Mils2iu
  36. #include <eda_rect.h> // for EDA_RECT
  37. #include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
  38. #include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
  39. #include <gal/stroke_font.h> // for STROKE_FONT
  40. #include <gr_text.h> // for GRText
  41. #include <string_utils.h> // for UnescapeString
  42. #include <math/util.h> // for KiROUND
  43. #include <math/vector2d.h> // for VECTOR2D
  44. #include <richio.h>
  45. #include <render_settings.h>
  46. #include <trigo.h> // for RotatePoint
  47. #include <i18n_utility.h>
  48. #include <geometry/shape_segment.h>
  49. #include <geometry/shape_compound.h>
  50. #include <wx/debug.h> // for wxASSERT
  51. #include <wx/string.h> // wxString, wxArrayString
  52. #include <wx/gdicmn.h> // for wxPoint,wxSize
  53. class OUTPUTFORMATTER;
  54. class wxFindReplaceData;
  55. EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify( int aHorizJustify )
  56. {
  57. wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
  58. if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
  59. return GR_TEXT_HJUSTIFY_RIGHT;
  60. if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
  61. return GR_TEXT_HJUSTIFY_LEFT;
  62. return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
  63. }
  64. EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
  65. {
  66. wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
  67. if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
  68. return GR_TEXT_VJUSTIFY_BOTTOM;
  69. if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
  70. return GR_TEXT_VJUSTIFY_TOP;
  71. return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
  72. }
  73. EDA_TEXT::EDA_TEXT( const wxString& text ) :
  74. m_text( text ),
  75. m_e( 1 << TE_VISIBLE )
  76. {
  77. int sz = Mils2iu( DEFAULT_SIZE_TEXT );
  78. SetTextSize( wxSize( sz, sz ) );
  79. cacheShownText();
  80. }
  81. EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
  82. m_text( aText.m_text ),
  83. m_e( aText.m_e )
  84. {
  85. cacheShownText();
  86. }
  87. EDA_TEXT::~EDA_TEXT()
  88. {
  89. }
  90. void EDA_TEXT::SetText( const wxString& aText )
  91. {
  92. m_text = aText;
  93. cacheShownText();
  94. }
  95. void EDA_TEXT::CopyText( const EDA_TEXT& aSrc )
  96. {
  97. m_text = aSrc.m_text;
  98. m_shown_text = aSrc.m_shown_text;
  99. m_shown_text_has_text_var_refs = aSrc.m_shown_text_has_text_var_refs;
  100. }
  101. void EDA_TEXT::SetEffects( const EDA_TEXT& aSrc )
  102. {
  103. m_e = aSrc.m_e;
  104. }
  105. void EDA_TEXT::SwapText( EDA_TEXT& aTradingPartner )
  106. {
  107. std::swap( m_text, aTradingPartner.m_text );
  108. std::swap( m_shown_text, aTradingPartner.m_shown_text );
  109. std::swap( m_shown_text_has_text_var_refs, aTradingPartner.m_shown_text_has_text_var_refs );
  110. }
  111. void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
  112. {
  113. std::swap( m_e, aTradingPartner.m_e );
  114. }
  115. int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const
  116. {
  117. int width = GetTextThickness();
  118. if( width <= 1 )
  119. {
  120. width = aDefaultWidth;
  121. if( IsBold() )
  122. width = GetPenSizeForBold( GetTextWidth() );
  123. else if( width <= 1 )
  124. width = GetPenSizeForNormal( GetTextWidth() );
  125. }
  126. // Clip pen size for small texts:
  127. width = Clamp_Text_PenSize( width, GetTextSize(), ALLOW_BOLD_THICKNESS );
  128. return width;
  129. }
  130. bool EDA_TEXT::Replace( const wxFindReplaceData& aSearchData )
  131. {
  132. bool retval = EDA_ITEM::Replace( aSearchData, m_text );
  133. cacheShownText();
  134. return retval;
  135. }
  136. void EDA_TEXT::cacheShownText()
  137. {
  138. if( m_text.IsEmpty() || m_text == wxT( "~" ) ) // ~ is legacy empty-string token
  139. {
  140. m_shown_text = wxEmptyString;
  141. m_shown_text_has_text_var_refs = false;
  142. }
  143. else
  144. {
  145. m_shown_text = UnescapeString( m_text );
  146. m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
  147. }
  148. }
  149. int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const
  150. {
  151. basic_gal.SetFontItalic( IsItalic() );
  152. basic_gal.SetFontBold( IsBold() );
  153. basic_gal.SetFontUnderlined( false );
  154. basic_gal.SetLineWidth( (float) aThickness );
  155. basic_gal.SetGlyphSize( VECTOR2D( GetTextSize() ) );
  156. VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
  157. return KiROUND( tsize.x );
  158. }
  159. wxString EDA_TEXT::ShortenedShownText() const
  160. {
  161. wxString tmp = GetShownText();
  162. tmp.Replace( wxT( "\n" ), wxT( " " ) );
  163. tmp.Replace( wxT( "\r" ), wxT( " " ) );
  164. tmp.Replace( wxT( "\t" ), wxT( " " ) );
  165. if( tmp.Length() > 36 )
  166. tmp = tmp.Left( 34 ) + wxT( "..." );
  167. return tmp;
  168. }
  169. int EDA_TEXT::GetInterline() const
  170. {
  171. return KiROUND( KIGFX::STROKE_FONT::GetInterline( GetTextHeight() ) );
  172. }
  173. EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
  174. {
  175. EDA_RECT rect;
  176. wxArrayString strings;
  177. wxString text = GetShownText();
  178. int thickness = GetEffectiveTextPenWidth();
  179. int linecount = 1;
  180. bool hasOverBar = false; // true if the first line of text as an overbar
  181. if( IsMultilineAllowed() )
  182. {
  183. wxStringSplit( text, strings, '\n' );
  184. if( strings.GetCount() ) // GetCount() == 0 for void strings
  185. {
  186. if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
  187. text = strings.Item( aLine );
  188. else
  189. text = strings.Item( 0 );
  190. linecount = strings.GetCount();
  191. }
  192. }
  193. // Search for overbar symbol. Only text is scanned,
  194. // because only this line can change the bounding box
  195. for( unsigned ii = 1; ii < text.size(); ii++ )
  196. {
  197. if( text[ii-1] == '~' && text[ii] == '{' )
  198. {
  199. hasOverBar = true;
  200. break;
  201. }
  202. }
  203. // calculate the H and V size
  204. const auto& font = basic_gal.GetStrokeFont();
  205. VECTOR2D fontSize( GetTextSize() );
  206. double penWidth( thickness );
  207. int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
  208. int dy = GetInterline();
  209. // Creates bounding box (rectangle) for horizontal, left and top justified text. The
  210. // bounding box will be moved later according to the actual text options
  211. wxSize textsize = wxSize( dx, dy );
  212. wxPoint pos = GetTextPos();
  213. if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
  214. {
  215. pos.y -= aLine * GetInterline();
  216. }
  217. if( aInvertY )
  218. pos.y = -pos.y;
  219. rect.SetOrigin( pos );
  220. if( hasOverBar )
  221. { // A overbar adds an extra size to the text
  222. // Height from the base line text of chars like [ or {
  223. double curr_height = GetTextHeight() * 1.15;
  224. double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
  225. int extra_height = KiROUND( overbarPosition - curr_height );
  226. extra_height += thickness / 2;
  227. textsize.y += extra_height;
  228. rect.Move( wxPoint( 0, -extra_height ) );
  229. }
  230. // for multiline texts and aLine < 0, merge all rectangles
  231. // ( if aLine < 0, we want the full text bounding box )
  232. if( IsMultilineAllowed() && aLine < 0 )
  233. {
  234. for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
  235. {
  236. text = strings.Item( ii );
  237. dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
  238. textsize.x = std::max( textsize.x, dx );
  239. textsize.y += dy;
  240. }
  241. }
  242. rect.SetSize( textsize );
  243. /* Now, calculate the rect origin, according to text justification
  244. * At this point the rectangle origin is the text origin (m_Pos).
  245. * This is true only for left and top text justified texts (using top to bottom Y axis
  246. * orientation). and must be recalculated for others justifications
  247. * also, note the V justification is relative to the first line
  248. */
  249. switch( GetHorizJustify() )
  250. {
  251. case GR_TEXT_HJUSTIFY_LEFT:
  252. if( IsMirrored() )
  253. rect.SetX( rect.GetX() - rect.GetWidth() );
  254. break;
  255. case GR_TEXT_HJUSTIFY_CENTER:
  256. rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
  257. break;
  258. case GR_TEXT_HJUSTIFY_RIGHT:
  259. if( !IsMirrored() )
  260. rect.SetX( rect.GetX() - rect.GetWidth() );
  261. break;
  262. }
  263. switch( GetVertJustify() )
  264. {
  265. case GR_TEXT_VJUSTIFY_TOP:
  266. break;
  267. case GR_TEXT_VJUSTIFY_CENTER:
  268. rect.SetY( rect.GetY() - ( dy / 2) );
  269. break;
  270. case GR_TEXT_VJUSTIFY_BOTTOM:
  271. rect.SetY( rect.GetY() - dy );
  272. break;
  273. }
  274. if( linecount > 1 )
  275. {
  276. int yoffset;
  277. linecount -= 1;
  278. switch( GetVertJustify() )
  279. {
  280. case GR_TEXT_VJUSTIFY_TOP:
  281. break;
  282. case GR_TEXT_VJUSTIFY_CENTER:
  283. yoffset = linecount * GetInterline() / 2;
  284. rect.SetY( rect.GetY() - yoffset );
  285. break;
  286. case GR_TEXT_VJUSTIFY_BOTTOM:
  287. yoffset = linecount * GetInterline();
  288. rect.SetY( rect.GetY() - yoffset );
  289. break;
  290. }
  291. }
  292. // Many fonts draw diacriticals, descenders, etc. outside the X-height of the font. This
  293. // will cacth most (but probably not all) of them.
  294. rect.Inflate( 0, thickness * 1.5 );
  295. rect.Normalize(); // Make h and v sizes always >= 0
  296. return rect;
  297. }
  298. bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
  299. {
  300. EDA_RECT rect = GetTextBox();
  301. wxPoint location = aPoint;
  302. rect.Inflate( aAccuracy );
  303. RotatePoint( &location, GetTextPos(), -GetTextAngle() );
  304. return rect.Contains( location );
  305. }
  306. bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
  307. {
  308. EDA_RECT rect = aRect;
  309. rect.Inflate( aAccuracy );
  310. if( aContains )
  311. return rect.Contains( GetTextBox() );
  312. return rect.Intersects( GetTextBox(), GetTextAngle() );
  313. }
  314. void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
  315. const COLOR4D& aColor, OUTLINE_MODE aFillMode )
  316. {
  317. if( IsMultilineAllowed() )
  318. {
  319. std::vector<wxPoint> positions;
  320. wxArrayString strings;
  321. wxStringSplit( GetShownText(), strings, '\n' );
  322. positions.reserve( strings.Count() );
  323. GetLinePositions( positions, strings.Count() );
  324. for( unsigned ii = 0; ii < strings.Count(); ii++ )
  325. printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
  326. }
  327. else
  328. {
  329. printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
  330. }
  331. }
  332. void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
  333. {
  334. wxPoint pos = GetTextPos(); // Position of first line of the
  335. // multiline text according to
  336. // the center of the multiline text block
  337. wxPoint offset; // Offset to next line.
  338. offset.y = GetInterline();
  339. if( aLineCount > 1 )
  340. {
  341. switch( GetVertJustify() )
  342. {
  343. case GR_TEXT_VJUSTIFY_TOP:
  344. break;
  345. case GR_TEXT_VJUSTIFY_CENTER:
  346. pos.y -= ( aLineCount - 1 ) * offset.y / 2;
  347. break;
  348. case GR_TEXT_VJUSTIFY_BOTTOM:
  349. pos.y -= ( aLineCount - 1 ) * offset.y;
  350. break;
  351. }
  352. }
  353. // Rotate the position of the first line
  354. // around the center of the multiline text block
  355. RotatePoint( &pos, GetTextPos(), GetTextAngle() );
  356. // Rotate the offset lines to increase happened in the right direction
  357. RotatePoint( &offset, GetTextAngle() );
  358. for( int ii = 0; ii < aLineCount; ii++ )
  359. {
  360. aPositions.push_back( pos );
  361. pos += offset;
  362. }
  363. }
  364. void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
  365. const COLOR4D& aColor, OUTLINE_MODE aFillMode,
  366. const wxString& aText, const wxPoint &aPos )
  367. {
  368. wxDC* DC = aSettings->GetPrintDC();
  369. int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
  370. if( aFillMode == SKETCH )
  371. penWidth = -penWidth;
  372. wxSize size = GetTextSize();
  373. if( IsMirrored() )
  374. size.x = -size.x;
  375. GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
  376. GetVertJustify(), penWidth, IsItalic(), IsBold() );
  377. }
  378. wxString EDA_TEXT::GetTextStyleName() const
  379. {
  380. int style = 0;
  381. if( IsItalic() )
  382. style = 1;
  383. if( IsBold() )
  384. style += 2;
  385. wxString stylemsg[4] = {
  386. _("Normal"),
  387. _("Italic"),
  388. _("Bold"),
  389. _("Bold+Italic")
  390. };
  391. return stylemsg[style];
  392. }
  393. bool EDA_TEXT::IsDefaultFormatting() const
  394. {
  395. return ( IsVisible()
  396. && !IsMirrored()
  397. && GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
  398. && GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
  399. && GetTextThickness() == 0
  400. && !IsItalic()
  401. && !IsBold()
  402. && !IsMultilineAllowed()
  403. );
  404. }
  405. void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
  406. {
  407. #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
  408. // and does not define FormatInternalUnits, used here
  409. // however this function should exist
  410. aFormatter->Print( aNestLevel + 1, "(effects" );
  411. // Text size
  412. aFormatter->Print( 0, " (font" );
  413. aFormatter->Print( 0, " (size %s %s)",
  414. FormatInternalUnits( GetTextHeight() ).c_str(),
  415. FormatInternalUnits( GetTextWidth() ).c_str() );
  416. if( GetTextThickness() )
  417. {
  418. aFormatter->Print( 0, " (thickness %s)",
  419. FormatInternalUnits( GetTextThickness() ).c_str() );
  420. }
  421. if( IsBold() )
  422. aFormatter->Print( 0, " bold" );
  423. if( IsItalic() )
  424. aFormatter->Print( 0, " italic" );
  425. aFormatter->Print( 0, ")"); // (font
  426. if( IsMirrored() || GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER
  427. || GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
  428. {
  429. aFormatter->Print( 0, " (justify");
  430. if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
  431. aFormatter->Print( 0, GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ? " left" : " right" );
  432. if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
  433. aFormatter->Print( 0, GetVertJustify() == GR_TEXT_VJUSTIFY_TOP ? " top" : " bottom" );
  434. if( IsMirrored() )
  435. aFormatter->Print( 0, " mirror" );
  436. aFormatter->Print( 0, ")" ); // (justify
  437. }
  438. if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
  439. aFormatter->Print( 0, " hide" );
  440. aFormatter->Print( 0, ")\n" ); // (justify
  441. #endif
  442. }
  443. // Convert the text shape to a list of segment
  444. // each segment is stored as 2 wxPoints: its starting point and its ending point
  445. // we are using GRText to create the segments and therefore a call-back function is needed
  446. // This is a call back function, used by GRText to put each segment in buffer
  447. static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData )
  448. {
  449. std::vector<wxPoint>* cornerBuffer = static_cast<std::vector<wxPoint>*>( aData );
  450. cornerBuffer->push_back( wxPoint( x0, y0 ) );
  451. cornerBuffer->push_back( wxPoint( xf, yf ) );
  452. }
  453. std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const
  454. {
  455. std::vector<wxPoint> cornerBuffer;
  456. wxSize size = GetTextSize();
  457. if( IsMirrored() )
  458. size.x = -size.x;
  459. bool forceBold = true;
  460. int penWidth = 0; // use max-width for bold text
  461. COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
  462. if( IsMultilineAllowed() )
  463. {
  464. wxArrayString strings_list;
  465. wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
  466. std::vector<wxPoint> positions;
  467. positions.reserve( strings_list.Count() );
  468. GetLinePositions( positions, strings_list.Count() );
  469. for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
  470. {
  471. wxString txt = strings_list.Item( ii );
  472. GRText( nullptr, positions[ii], color, txt, GetDrawRotation(), size, GetHorizJustify(),
  473. GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
  474. &cornerBuffer );
  475. }
  476. }
  477. else
  478. {
  479. GRText( nullptr, GetTextPos(), color, GetShownText(), GetDrawRotation(), size,
  480. GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), forceBold,
  481. addTextSegmToBuffer, &cornerBuffer );
  482. }
  483. return cornerBuffer;
  484. }
  485. std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const
  486. {
  487. std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
  488. int penWidth = GetEffectiveTextPenWidth();
  489. std::vector<wxPoint> pts = TransformToSegmentList();
  490. for( unsigned jj = 0; jj < pts.size(); jj += 2 )
  491. shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
  492. return shape;
  493. }
  494. double EDA_TEXT::GetDrawRotation() const
  495. {
  496. return GetTextAngle();
  497. }
  498. static struct EDA_TEXT_DESC
  499. {
  500. EDA_TEXT_DESC()
  501. {
  502. ENUM_MAP<EDA_TEXT_HJUSTIFY_T>::Instance()
  503. .Map( GR_TEXT_HJUSTIFY_LEFT, _HKI( "Left" ) )
  504. .Map( GR_TEXT_HJUSTIFY_CENTER, _HKI( "Center" ) )
  505. .Map( GR_TEXT_HJUSTIFY_RIGHT, _HKI( "Right" ) );
  506. ENUM_MAP<EDA_TEXT_VJUSTIFY_T>::Instance()
  507. .Map( GR_TEXT_VJUSTIFY_TOP, _HKI( "Top" ) )
  508. .Map( GR_TEXT_VJUSTIFY_CENTER, _HKI( "Center" ) )
  509. .Map( GR_TEXT_VJUSTIFY_BOTTOM, _HKI( "Bottom" ) );
  510. PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
  511. REGISTER_TYPE( EDA_TEXT );
  512. propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _HKI( "Text" ),
  513. &EDA_TEXT::SetText, &EDA_TEXT::GetText ) );
  514. propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Thickness" ),
  515. &EDA_TEXT::SetTextThickness,
  516. &EDA_TEXT::GetTextThickness,
  517. PROPERTY_DISPLAY::DISTANCE ) );
  518. propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Italic" ),
  519. &EDA_TEXT::SetItalic,
  520. &EDA_TEXT::IsItalic ) );
  521. propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Bold" ),
  522. &EDA_TEXT::SetBold, &EDA_TEXT::IsBold ) );
  523. propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Mirrored" ),
  524. &EDA_TEXT::SetMirrored,
  525. &EDA_TEXT::IsMirrored ) );
  526. propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Visible" ),
  527. &EDA_TEXT::SetVisible,
  528. &EDA_TEXT::IsVisible ) );
  529. propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Width" ),
  530. &EDA_TEXT::SetTextWidth,
  531. &EDA_TEXT::GetTextWidth,
  532. PROPERTY_DISPLAY::DISTANCE ) );
  533. propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Height" ),
  534. &EDA_TEXT::SetTextHeight,
  535. &EDA_TEXT::GetTextHeight,
  536. PROPERTY_DISPLAY::DISTANCE ) );
  537. propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
  538. EDA_TEXT_HJUSTIFY_T>( _HKI( "Horizontal Justification" ),
  539. &EDA_TEXT::SetHorizJustify,
  540. &EDA_TEXT::GetHorizJustify ) );
  541. propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
  542. EDA_TEXT_VJUSTIFY_T>( _HKI( "Vertical Justification" ),
  543. &EDA_TEXT::SetVertJustify,
  544. &EDA_TEXT::GetVertJustify ) );
  545. }
  546. } _EDA_TEXT_DESC;
  547. ENUM_TO_WXANY( EDA_TEXT_HJUSTIFY_T )
  548. ENUM_TO_WXANY( EDA_TEXT_VJUSTIFY_T )