fixed a bug plotting pins with circles in them
This commit is contained in:
parent
9fdc316d27
commit
e73e94ed16
|
@ -418,10 +418,10 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
{
|
{
|
||||||
int i, x1, y1, x2, y2, t1, t2, orient;
|
int i, x1, y1, x2, y2, t1, t2, orient;
|
||||||
LibEDA_BaseStruct* DEntry = NULL;
|
LibEDA_BaseStruct* DEntry = NULL;
|
||||||
int CharColor;
|
int CharColor;
|
||||||
int fill_option;
|
FILL_T fill_option;
|
||||||
int SetHightColor;
|
int SetHightColor;
|
||||||
int LineWidth;
|
int LineWidth;
|
||||||
|
|
||||||
//#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color;
|
//#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color;
|
||||||
#define GETCOLOR( l ) Color < 0 ? SetHightColor ?\
|
#define GETCOLOR( l ) Color < 0 ? SetHightColor ?\
|
||||||
|
@ -471,9 +471,11 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
{
|
{
|
||||||
EXCHG( x1, x2 ); EXCHG( y1, y2 )
|
EXCHG( x1, x2 ); EXCHG( y1, y2 )
|
||||||
}
|
}
|
||||||
|
|
||||||
fill_option = Arc->m_Fill;
|
fill_option = Arc->m_Fill;
|
||||||
if ( g_IsPrinting && fill_option == FILLED_WITH_BG_BODYCOLOR && GetGRForceBlackPenState( ) )
|
if ( g_IsPrinting && fill_option == FILLED_WITH_BG_BODYCOLOR && GetGRForceBlackPenState( ) )
|
||||||
fill_option = NO_FILL;
|
fill_option = NO_FILL;
|
||||||
|
|
||||||
if( Color < 0 ) // Normal Color Layer
|
if( Color < 0 ) // Normal Color Layer
|
||||||
{
|
{
|
||||||
if( fill_option == FILLED_WITH_BG_BODYCOLOR )
|
if( fill_option == FILLED_WITH_BG_BODYCOLOR )
|
||||||
|
|
|
@ -215,141 +215,142 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
|
||||||
switch( DEntry->Type() )
|
switch( DEntry->Type() )
|
||||||
{
|
{
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
{
|
|
||||||
LibDrawArc* Arc = (LibDrawArc*) DEntry;
|
|
||||||
t1 = Arc->t1; t2 = Arc->t2;
|
|
||||||
pos.x = PartX + TransMat[0][0] * Arc->m_Pos.x +
|
|
||||||
TransMat[0][1] * Arc->m_Pos.y;
|
|
||||||
pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x +
|
|
||||||
TransMat[1][1] * Arc->m_Pos.y;
|
|
||||||
MapAngles( &t1, &t2, TransMat );
|
|
||||||
if ( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
||||||
{
|
{
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
LibDrawArc* Arc = (LibDrawArc*) DEntry;
|
||||||
PlotArc( pos, t1, t2, Arc->m_Rayon, true, 0 );
|
t1 = Arc->t1; t2 = Arc->t2;
|
||||||
|
pos.x = PartX + TransMat[0][0] * Arc->m_Pos.x +
|
||||||
|
TransMat[0][1] * Arc->m_Pos.y;
|
||||||
|
pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x +
|
||||||
|
TransMat[1][1] * Arc->m_Pos.y;
|
||||||
|
MapAngles( &t1, &t2, TransMat );
|
||||||
|
if ( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
|
{
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
|
PlotArc( pos, t1, t2, Arc->m_Rayon, true, 0 );
|
||||||
|
}
|
||||||
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
||||||
|
PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill == FILLED_SHAPE ? true : false, Arc->m_Width );
|
||||||
}
|
}
|
||||||
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
||||||
PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill == FILLED_SHAPE ? true : false, Arc->m_Width );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||||
{
|
|
||||||
LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
|
|
||||||
pos.x = PartX + TransMat[0][0] * Circle->m_Pos.x +
|
|
||||||
TransMat[0][1] * Circle->m_Pos.y;
|
|
||||||
pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x +
|
|
||||||
TransMat[1][1] * Circle->m_Pos.y;
|
|
||||||
if ( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
||||||
{
|
{
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
|
||||||
PlotCercle( pos, Circle->m_Rayon * 2, true, 0 );
|
pos.x = PartX + TransMat[0][0] * Circle->m_Pos.x +
|
||||||
|
TransMat[0][1] * Circle->m_Pos.y;
|
||||||
|
pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x +
|
||||||
|
TransMat[1][1] * Circle->m_Pos.y;
|
||||||
|
|
||||||
|
if ( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
|
{
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
|
PlotCercle( pos, Circle->m_Rayon * 2, true, 0 );
|
||||||
|
}
|
||||||
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
||||||
|
PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill == FILLED_SHAPE ? true : false, Circle->m_Width );
|
||||||
}
|
}
|
||||||
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
||||||
PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill == FILLED_SHAPE ? true : false, Circle->m_Width );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||||
{
|
{
|
||||||
LibDrawText* Text = (LibDrawText*) DEntry;
|
LibDrawText* Text = (LibDrawText*) DEntry;
|
||||||
|
|
||||||
/* The text orientation may need to be flipped if the
|
/* The text orientation may need to be flipped if the
|
||||||
* transformation matrix causes xy axes to be flipped. */
|
* transformation matrix causes xy axes to be flipped. */
|
||||||
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
|
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
|
||||||
pos.x = PartX + TransMat[0][0] * Text->m_Pos.x
|
pos.x = PartX + TransMat[0][0] * Text->m_Pos.x
|
||||||
+ TransMat[0][1] * Text->m_Pos.y;
|
+ TransMat[0][1] * Text->m_Pos.y;
|
||||||
pos.y = PartY + TransMat[1][0] * Text->m_Pos.x
|
pos.y = PartY + TransMat[1][0] * Text->m_Pos.x
|
||||||
+ TransMat[1][1] * Text->m_Pos.y;
|
+ TransMat[1][1] * Text->m_Pos.y;
|
||||||
SetCurrentLineWidth( -1 );
|
SetCurrentLineWidth( -1 );
|
||||||
PlotGraphicText( g_PlotFormat, pos, CharColor,
|
PlotGraphicText( g_PlotFormat, pos, CharColor,
|
||||||
Text->m_Text,
|
Text->m_Text,
|
||||||
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
||||||
Text->m_Size,
|
Text->m_Size,
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
case COMPONENT_RECT_DRAW_TYPE:
|
||||||
{
|
|
||||||
LibDrawSquare* Square = (LibDrawSquare*) DEntry;
|
|
||||||
x1 = PartX + TransMat[0][0] * Square->m_Pos.x
|
|
||||||
+ TransMat[0][1] * Square->m_Pos.y;
|
|
||||||
y1 = PartY + TransMat[1][0] * Square->m_Pos.x
|
|
||||||
+ TransMat[1][1] * Square->m_Pos.y;
|
|
||||||
x2 = PartX + TransMat[0][0] * Square->m_End.x
|
|
||||||
+ TransMat[0][1] * Square->m_End.y;
|
|
||||||
y2 = PartY + TransMat[1][0] * Square->m_End.x
|
|
||||||
+ TransMat[1][1] * Square->m_End.y;
|
|
||||||
|
|
||||||
if ( draw_bgfill && Square->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
|
||||||
{
|
{
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
LibDrawSquare* Square = (LibDrawSquare*) DEntry;
|
||||||
PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), true, 0 );
|
x1 = PartX + TransMat[0][0] * Square->m_Pos.x
|
||||||
|
+ TransMat[0][1] * Square->m_Pos.y;
|
||||||
|
y1 = PartY + TransMat[1][0] * Square->m_Pos.x
|
||||||
|
+ TransMat[1][1] * Square->m_Pos.y;
|
||||||
|
x2 = PartX + TransMat[0][0] * Square->m_End.x
|
||||||
|
+ TransMat[0][1] * Square->m_End.y;
|
||||||
|
y2 = PartY + TransMat[1][0] * Square->m_End.x
|
||||||
|
+ TransMat[1][1] * Square->m_End.y;
|
||||||
|
|
||||||
|
if ( draw_bgfill && Square->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
|
{
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
|
PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), true, 0 );
|
||||||
|
}
|
||||||
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
||||||
|
PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), Square->m_Fill == FILLED_SHAPE ? true : false, Square->m_Width );
|
||||||
}
|
}
|
||||||
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
||||||
PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), Square->m_Fill == FILLED_SHAPE ? true : false, Square->m_Width );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
||||||
{
|
|
||||||
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
|
||||||
if( Pin->m_Attributs & PINNOTDRAW )
|
|
||||||
{
|
{
|
||||||
if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
|
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
||||||
break;
|
if( Pin->m_Attributs & PINNOTDRAW )
|
||||||
|
{
|
||||||
|
if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calcul de l'orientation reelle de la Pin */
|
||||||
|
orient = Pin->ReturnPinDrawOrient( TransMat );
|
||||||
|
/* compute Pin Pos */
|
||||||
|
x2 = PartX + TransMat[0][0] * Pin->m_Pos.x
|
||||||
|
+ TransMat[0][1] * Pin->m_Pos.y;
|
||||||
|
y2 = PartY + TransMat[1][0] * Pin->m_Pos.x
|
||||||
|
+ TransMat[1][1] * Pin->m_Pos.y;
|
||||||
|
|
||||||
|
/* Dessin de la pin et du symbole special associe */
|
||||||
|
SetCurrentLineWidth( -1 );
|
||||||
|
PlotPinSymbol( x2, y2, Pin->m_PinLen, orient, Pin->m_PinShape );
|
||||||
|
wxPoint pinpos( x2, y2 );
|
||||||
|
Pin->PlotPinTexts( pinpos, orient,
|
||||||
|
Entry->m_TextInside,
|
||||||
|
Entry->m_DrawPinNum, Entry->m_DrawPinName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calcul de l'orientation reelle de la Pin */
|
|
||||||
orient = Pin->ReturnPinDrawOrient( TransMat );
|
|
||||||
/* compute Pin Pos */
|
|
||||||
x2 = PartX + TransMat[0][0] * Pin->m_Pos.x
|
|
||||||
+ TransMat[0][1] * Pin->m_Pos.y;
|
|
||||||
y2 = PartY + TransMat[1][0] * Pin->m_Pos.x
|
|
||||||
+ TransMat[1][1] * Pin->m_Pos.y;
|
|
||||||
|
|
||||||
/* Dessin de la pin et du symbole special associe */
|
|
||||||
SetCurrentLineWidth( -1 );
|
|
||||||
PlotPinSymbol( x2, y2, Pin->m_PinLen, orient, Pin->m_PinShape );
|
|
||||||
wxPoint pinpos( x2, y2 );
|
|
||||||
Pin->PlotPinTexts( pinpos, orient,
|
|
||||||
Entry->m_TextInside,
|
|
||||||
Entry->m_DrawPinNum, Entry->m_DrawPinName );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||||
{
|
|
||||||
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
|
|
||||||
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->n );
|
|
||||||
for( ii = 0; ii < polyline->n; ii++ )
|
|
||||||
{
|
{
|
||||||
Poly[ii * 2] = PartX +
|
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
|
||||||
TransMat[0][0] * polyline->PolyList[ii * 2] +
|
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->n );
|
||||||
TransMat[0][1] * polyline->PolyList[ii * 2 + 1];
|
for( ii = 0; ii < polyline->n; ii++ )
|
||||||
Poly[ii * 2 + 1] = PartY +
|
{
|
||||||
TransMat[1][0] * polyline->PolyList[ii * 2] +
|
Poly[ii * 2] = PartX +
|
||||||
TransMat[1][1] * polyline->PolyList[ii * 2 + 1];
|
TransMat[0][0] * polyline->PolyList[ii * 2] +
|
||||||
}
|
TransMat[0][1] * polyline->PolyList[ii * 2 + 1];
|
||||||
|
Poly[ii * 2 + 1] = PartY +
|
||||||
|
TransMat[1][0] * polyline->PolyList[ii * 2] +
|
||||||
|
TransMat[1][1] * polyline->PolyList[ii * 2 + 1];
|
||||||
|
}
|
||||||
|
|
||||||
if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
PlotPoly( ii, Poly, true, 0 );
|
PlotPoly( ii, Poly, true, 0 );
|
||||||
|
}
|
||||||
|
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
||||||
|
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
||||||
|
PlotPoly( ii, Poly, polyline->m_Fill == FILLED_SHAPE ? true : false, polyline->m_Width );
|
||||||
|
MyFree( Poly );
|
||||||
}
|
}
|
||||||
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
|
|
||||||
SetColorMapPS( ReturnLayerColor( LAYER_DEVICE ) );
|
|
||||||
PlotPoly( ii, Poly, polyline->m_Fill == FILLED_SHAPE ? true : false, polyline->m_Width );
|
|
||||||
MyFree( Poly );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
D(printf("Drawing Type=%d\n", DEntry->Type() )) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fin Switch */
|
/* Fin Switch */
|
||||||
|
@ -512,7 +513,9 @@ static void PlotPinSymbol( int posX, int posY, int len, int orient, int Shape )
|
||||||
{
|
{
|
||||||
PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
|
PlotCercle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
|
||||||
MapY1 * INVERT_PIN_RADIUS + y1),
|
MapY1 * INVERT_PIN_RADIUS + y1),
|
||||||
false, INVERT_PIN_RADIUS * 2 );
|
INVERT_PIN_RADIUS * 2, // diameter
|
||||||
|
false, // fill
|
||||||
|
-1 ); // width
|
||||||
|
|
||||||
Move_Plume( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
|
Move_Plume( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
|
||||||
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' );
|
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' );
|
||||||
|
|
|
@ -27,7 +27,7 @@ static void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos );
|
||||||
/* Variables locales */
|
/* Variables locales */
|
||||||
static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY;
|
static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY;
|
||||||
static wxPoint InitPosition, StartCursor, ItemPreviousPos;
|
static wxPoint InitPosition, StartCursor, ItemPreviousPos;
|
||||||
static int FlSymbol_Fill = NO_FILL;
|
static FILL_T FlSymbol_Fill = NO_FILL;
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
|
@ -46,8 +46,10 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
g_FlDrawSpecificConvert = m_CommonConvert->GetValue() ? FALSE : TRUE;
|
g_FlDrawSpecificConvert = m_CommonConvert->GetValue() ? FALSE : TRUE;
|
||||||
g_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE;
|
g_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE;
|
||||||
|
|
||||||
if( m_Filled )
|
if( m_Filled )
|
||||||
FlSymbol_Fill = m_Filled->GetSelection();
|
FlSymbol_Fill = (FILL_T) m_Filled->GetSelection();
|
||||||
|
|
||||||
g_LibSymbolDefaultLineWidth = m_GraphicShapeWidthCtrl->GetValue();
|
g_LibSymbolDefaultLineWidth = m_GraphicShapeWidthCtrl->GetValue();
|
||||||
|
|
||||||
if( CurrentDrawItem )
|
if( CurrentDrawItem )
|
||||||
|
|
|
@ -791,7 +791,7 @@ void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLOT_FORMAT_POST:
|
case PLOT_FORMAT_POST:
|
||||||
PlotCirclePS( centre, radius * 2, 0, thickness);
|
PlotCirclePS( centre, radius * 2, false, thickness );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue