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
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
approximation which is really good */
approximation which is really good
*/
SetCurrentLineWidth( width );
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 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
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
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 )
{
if( aImage == NULL )
{
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 * pback = Back();
DHEAD* mylist = m_List;
time_t timestamp = GetTimeStamp();
switch( Type() )
{
@ -286,15 +291,11 @@ void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
break;
}
if( pnext != Next() || pback != Back() )
{
Pnext = pnext;
Pback = pback;
#ifdef DEBUG
wxLogMessage( wxT( "SwapData Error: %s Pnext or Pback pointers modified" ),
GetClass().GetData() );
#endif
}
// Restore pointers and time stamp, to be sure they are not broken
Pnext = pnext;
Pback = pback;
m_List = mylist;
SetTimeStamp( timestamp );
}