Plot pdf: fix issue when a 0 sized text is plotted (files are broken): now 0 sized texts are ignored.

pcbnew: remove a false error message when undoing a change on a text, or some other board items (graphic items for instance)
This commit is contained in:
jean-pierre charras 2015-03-18 20:50:42 +01:00
parent 9a3a92f93a
commit 834b31b491
2 changed files with 18 additions and 12 deletions

View File

@ -167,7 +167,8 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
/* OK. Here's a trick. PDF doesn't support circles or circular angles, that's /* OK. Here's a trick. PDF doesn't support circles or circular angles, that's
a fact. You'll have to do with cubic beziers. These *can't* represent a fact. You'll have to do with cubic beziers. These *can't* represent
circular arcs (NURBS can, beziers don't). But there is a widely known circular arcs (NURBS can, beziers don't). But there is a widely known
approximation which is really good */ approximation which is really good
*/
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
double magic = radius * 0.551784; // You don't want to know where this come from double magic = radius * 0.551784; // You don't want to know where this come from
@ -747,6 +748,10 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
bool aBold, bool aBold,
bool aMultilineAllowed ) bool aMultilineAllowed )
{ {
// PDF files do not like 0 sized texts which create broken files.
if( aSize.x == 0 || aSize.y == 0 )
return;
// Fix me: see how to use PDF text mode for multiline texts // Fix me: see how to use PDF text mode for multiline texts
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) ) if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
aMultilineAllowed = false; // the text has only one line. aMultilineAllowed = false; // the text has only one line.

View File

@ -183,12 +183,17 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
void BOARD_ITEM::SwapData( BOARD_ITEM* aImage ) void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
{ {
if( aImage == NULL ) if( aImage == NULL )
{
return; return;
}
// Remark: to create images of edited items to undo, we are using Clone method
// which can duplication of items foe copy, but does not clone all members
// mainly pointers in chain and time stamp, which is set to new, unique value.
// So we have to use the current values of these parameters.
EDA_ITEM * pnext = Next(); EDA_ITEM * pnext = Next();
EDA_ITEM * pback = Back(); EDA_ITEM * pback = Back();
DHEAD* mylist = m_List;
time_t timestamp = GetTimeStamp();
switch( Type() ) switch( Type() )
{ {
@ -286,15 +291,11 @@ void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
break; break;
} }
if( pnext != Next() || pback != Back() ) // Restore pointers and time stamp, to be sure they are not broken
{
Pnext = pnext; Pnext = pnext;
Pback = pback; Pback = pback;
#ifdef DEBUG m_List = mylist;
wxLogMessage( wxT( "SwapData Error: %s Pnext or Pback pointers modified" ), SetTimeStamp( timestamp );
GetClass().GetData() );
#endif
}
} }