Commit 834b31b4 authored by jean-pierre charras's avatar jean-pierre charras

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

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)
parent 9a3a92f9
......@@ -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.
......
......@@ -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 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment