From e73e94ed16a2e0a779114e2360e044c9e6132b4f Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Tue, 9 Sep 2008 16:56:47 +0000 Subject: [PATCH] fixed a bug plotting pins with circles in them --- eeschema/eelibs_draw_components.cpp | 10 +- eeschema/plot.cpp | 215 ++++++++++++++-------------- eeschema/symbdraw.cpp | 6 +- pcbnew/plot_rtn.cpp | 2 +- 4 files changed, 120 insertions(+), 113 deletions(-) diff --git a/eeschema/eelibs_draw_components.cpp b/eeschema/eelibs_draw_components.cpp index e51dc2fe9e..6e45a2c4d7 100644 --- a/eeschema/eelibs_draw_components.cpp +++ b/eeschema/eelibs_draw_components.cpp @@ -418,10 +418,10 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, { int i, x1, y1, x2, y2, t1, t2, orient; LibEDA_BaseStruct* DEntry = NULL; - int CharColor; - int fill_option; - int SetHightColor; - int LineWidth; + int CharColor; + FILL_T fill_option; + int SetHightColor; + int LineWidth; //#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color; #define GETCOLOR( l ) Color < 0 ? SetHightColor ?\ @@ -471,9 +471,11 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, { EXCHG( x1, x2 ); EXCHG( y1, y2 ) } + fill_option = Arc->m_Fill; if ( g_IsPrinting && fill_option == FILLED_WITH_BG_BODYCOLOR && GetGRForceBlackPenState( ) ) fill_option = NO_FILL; + if( Color < 0 ) // Normal Color Layer { if( fill_option == FILLED_WITH_BG_BODYCOLOR ) diff --git a/eeschema/plot.cpp b/eeschema/plot.cpp index 78adf13138..a2c83ac0b5 100644 --- a/eeschema/plot.cpp +++ b/eeschema/plot.cpp @@ -215,141 +215,142 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) switch( DEntry->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 ) ); - PlotArc( pos, t1, t2, Arc->m_Rayon, true, 0 ); + 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 ) ); + 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; 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 ) ); - PlotCercle( pos, Circle->m_Rayon * 2, true, 0 ); + 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 ) ); + 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; case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - { - LibDrawText* Text = (LibDrawText*) DEntry; + { + LibDrawText* Text = (LibDrawText*) DEntry; - /* The text orientation may need to be flipped if the - * transformation matrix causes xy axes to be flipped. */ - t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0); - pos.x = PartX + TransMat[0][0] * Text->m_Pos.x - + TransMat[0][1] * Text->m_Pos.y; - pos.y = PartY + TransMat[1][0] * Text->m_Pos.x - + TransMat[1][1] * Text->m_Pos.y; - SetCurrentLineWidth( -1 ); - PlotGraphicText( g_PlotFormat, pos, CharColor, - Text->m_Text, - t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, - Text->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - } + /* The text orientation may need to be flipped if the + * transformation matrix causes xy axes to be flipped. */ + t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0); + pos.x = PartX + TransMat[0][0] * Text->m_Pos.x + + TransMat[0][1] * Text->m_Pos.y; + pos.y = PartY + TransMat[1][0] * Text->m_Pos.x + + TransMat[1][1] * Text->m_Pos.y; + SetCurrentLineWidth( -1 ); + PlotGraphicText( g_PlotFormat, pos, CharColor, + Text->m_Text, + t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, + Text->m_Size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); + } break; 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 ) ); - PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), true, 0 ); + 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 ) ); + 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; case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */ - { - LibDrawPin* Pin = (LibDrawPin*) DEntry; - if( Pin->m_Attributs & PINNOTDRAW ) { - if( ActiveScreen->m_Type == SCHEMATIC_FRAME ) - break; + LibDrawPin* Pin = (LibDrawPin*) DEntry; + 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; 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 + - 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]; - } + LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry; + Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->n ); + for( ii = 0; ii < polyline->n; ii++ ) + { + Poly[ii * 2] = PartX + + 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 ) - { - SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); - PlotPoly( ii, Poly, true, 0 ); + if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR ) + { + SetColorMapPS( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + 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; default: - ; + D(printf("Drawing Type=%d\n", DEntry->Type() )) ; } /* 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, 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, MapY1 * INVERT_PIN_RADIUS * 2 + y1 ), 'U' ); diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index dcfc2e597a..a61f7a9652 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -27,7 +27,7 @@ static void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ); /* Variables locales */ static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY; 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_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE; + if( m_Filled ) - FlSymbol_Fill = m_Filled->GetSelection(); + FlSymbol_Fill = (FILL_T) m_Filled->GetSelection(); + g_LibSymbolDefaultLineWidth = m_GraphicShapeWidthCtrl->GetValue(); if( CurrentDrawItem ) diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index 91e75c64e3..328e02f226 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -791,7 +791,7 @@ void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius ) break; case PLOT_FORMAT_POST: - PlotCirclePS( centre, radius * 2, 0, thickness); + PlotCirclePS( centre, radius * 2, false, thickness ); break; } }