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.

673 lines
20 KiB

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