Commit 9e096061 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

dcsvg (and therefore KicadSVGFileDC) is now unused. Use SVG plotter only to...

dcsvg (and therefore KicadSVGFileDC)  is now unused. Use SVG plotter only to export a board SVG file.
SVG export does not use no more wxWidgets wxDC.
In pcbnew SVG files can be created by plot menu (in B&W) or export SVG menu (B&W or Color).
Export SVG menu is more suitable to create a view of a board, and plot menu is better to create a B&W document of silkscreen layers.
(In the future, the 2 menus could be merged, because they are not very different).
Note: pcbnew plot code is cleaned, mainly in dialog files, but still needs more cleanup.
parent 436c17f6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ set(COMMON_SRCS
    common_plotSVG_functions.cpp
    confirm.cpp
    copy_to_clipboard.cpp
    dcsvg.cpp
    dialog_shim.cpp
    displlst.cpp
    dlist.cpp
+16 −38
Original line number Diff line number Diff line
@@ -152,54 +152,26 @@ void SVG_PLOTTER::setSVGPlotStyle()
    switch( m_fillMode )
    {
    case NO_FILL:
        fputs( "fill-opacity:0.0;\n", outputFile );
        fputs( "fill-opacity:0.0; ", outputFile );
        break;

    case FILLED_SHAPE:
        fputs( "fill-opacity:1.0;\n", outputFile );
        fputs( "fill-opacity:1.0; ", outputFile );
        break;

    case FILLED_WITH_BG_BODYCOLOR:
        fputs( "fill-opacity:0.6;\n", outputFile );
        fputs( "fill-opacity:0.6; ", outputFile );
        break;
    }

    // output the pen color (RVB values in hex) and opacity
    double pen_opacity = 1.0;      // 0.0 (transparent to 1.0 (solid)
    fprintf( outputFile, "  stroke:#%6.6lX; stroke-opacity:%g;\n",
             m_pen_rgb_color, pen_opacity );

    // output the pen cap
    int pen_cap = 0;    // round, square, butt (currenly not used)

    switch( pen_cap )
    {
    case  1:
        fputs( "stroke-linecap:square; ", outputFile );
        break;

    case  2:
        fputs( "stroke-linecap:butt; ", outputFile );
        break;

    case    0:
    default:
        fputs( "stroke-linecap:round; ", outputFile );
    }

    fputs( "stroke-linejoin:round; ", outputFile );

    int pen_w = (int) userToDeviceSize( GetCurrentLineWidth() );
    fprintf( outputFile,
             "stroke-width:%d\" \n   transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">\n",
             pen_w,
             userToDeviceSize( plotOffset.x ), userToDeviceSize( plotOffset.y ),
             plotScale, plotScale  );
    double pen_w = userToDeviceSize( GetCurrentLineWidth() );
    fprintf( outputFile, "\nstroke:#%6.6lX; stroke-width:%g; stroke-opacity:1; \n",
             m_pen_rgb_color, pen_w  );
    fputs( "stroke-linecap:round; stroke-linejoin:round;\">\n", outputFile );

    m_graphics_changed = false;
}


/* Set the current line width (in IUs) for the next plot
 */
void SVG_PLOTTER::SetCurrentLineWidth( int width )
@@ -487,10 +459,16 @@ bool SVG_PLOTTER::StartPlot( FILE* fout )
    // End of header
    fprintf( outputFile, "  <desc>Picture generated by %s </desc>\n",
             TO_UTF8( creator ) );
    fputs( "<g style=\"fill:black; stroke:black; stroke-width:1\">\n",
           outputFile );
    setSVGPlotStyle();

    // output the pen and brush color (RVB values in hex) and opacity
    double opacity = 1.0;      // 0.0 (transparent to 1.0 (solid)
    fprintf( outputFile,
             "<g style=\"fill:#%6.6lX; fill-opacity:%g;stroke:#%6.6lX; stroke-opacity:%g;\n",
             m_brush_rgb_color, opacity, m_pen_rgb_color, opacity );

    // output the pen cap and line joint
    fputs( "stroke-linecap:round; stroke-linejoin:round; \"\n", outputFile );
    fputs( " transform=\"translate(0 0) scale(1 1)\">\n", outputFile );
    return true;
}

+0 −0

File moved.

+5 −3
Original line number Diff line number Diff line
@@ -118,7 +118,9 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
    if( DC->LogicalToDeviceXRel( width ) < 2 )
        typeaff = LINE;

    radius = m_Size / 4;
    radius = m_Size / 3;
    if( GetShape() )   // shape X
        radius = m_Size / 2;

    switch( typeaff )
    {
@@ -142,9 +144,9 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
    dx2   = 0;
    dy2   = radius;

    if( m_Shape ) /* Form X */
    if( GetShape() )   // shape X
    {
        dx1 = dy1 = ( radius * 7 ) / 5;
        dx1 = dy1 = radius;
        dx2 = dx1;
        dy2 = -dy1;
    }
+2 −2
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ PAD_DRAWINFO::PAD_DRAWINFO()
void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
                  const wxPoint& aOffset )
{
    EDA_COLOR_T color = ColorFromInt(0); // XXX EVIL (it will be ORed later)
    wxSize mask_margin;   // margin (clearance) used for some non copper layers

#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
@@ -143,6 +142,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
    else
        drawInfo.m_ShowPadFilled = false;

    EDA_COLOR_T color = ColorFromInt(0); // XXX EVIL (it will be ORed later)
    if( m_layerMask & LAYER_FRONT )
    {
        color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
@@ -154,7 +154,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
        color = ColorFromInt( color | brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
    }

    if( color == 0 ) // Not on copper layer XXX EVIL check
    if( color == 0 ) // Not on a visible copper layer XXX EVIL check
    {
        // If the pad in on only one tech layer, use the layer color else use DARKGRAY
        int mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
Loading