Pcbnew, 3D viewer: fix incorrect position of multiline texts.

This commit is contained in:
jean-pierre charras 2013-12-27 08:24:36 +01:00
parent 517ca83fbc
commit f9cc325bd8
3 changed files with 8 additions and 11 deletions

View File

@ -295,7 +295,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount )
std::vector<wxPoint>& aPositions, int aLineCount ) const
{
wxPoint pos = m_Pos; // Position of first line of the
// multiline text according to

View File

@ -275,7 +275,7 @@ public:
* for efficiency reasons
*/
void GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount );
std::vector<wxPoint>& aPositions, int aLineCount ) const;
/**
* Function Format
* outputs the object to \a aFormatter in s-expression form.

View File

@ -290,22 +290,19 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
if( IsMultilineAllowed() )
{
wxPoint pos = GetTextPosition();
wxArrayString* list = wxStringSplit( GetText(), '\n' );
wxPoint offset;
std::vector<wxPoint> positions;
positions.reserve( list->Count() );
GetPositionsOfLinesOfMultilineText( positions, list->Count() );
offset.y = GetInterline();
RotatePoint( &offset, GetOrientation() );
for( unsigned i = 0; i<list->Count(); i++ )
for( unsigned ii = 0; ii < list->Count(); ii++ )
{
wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, color,
wxString txt = list->Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], color,
txt, GetOrientation(), size,
GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(),
true, addTextSegmToPoly );
pos += offset;
}
delete list;