Commit 699863f8 authored by charras's avatar charras
Browse files

Pcbnew: enhancements in printing (or plot in SVG format)

parent 3e07f5bb
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,17 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.



2010-mar-29, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew
    enhancements in printing or plot in SVG format:
    When printing techncal layers, pads on solder mask or solder paste layers
    where printed in sketch mode.
    Now they are printed as solid shapes, with dimensions according to
    solder past or solder mask clearances.


2010-mar-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
2010-mar-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
================================================================================
++Eeschema
++Eeschema
+1 −2
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@ Subdirectories
bitmaps        - Menu and program icons
bitmaps        - Menu and program icons
CMakeModules   - Modules for the CMAKE build tool
CMakeModules   - Modules for the CMAKE build tool
common         - Sourcecode of the common library (common functions shared across whole suite)
common         - Sourcecode of the common library (common functions shared across whole suite)
cvpcb          - Sourcecode of CvPCB, (eeschema) convert to pcb sourcecode
cvpcb          - Sourcecode of CvPCB, tool to link components with footprints sourcecode
demos          - Some demo examples
demos          - Some demo examples
Documentation  - Misc documentation. Translating the GUI, old changelogs etcetera.
Documentation  - Misc documentation. Translating the GUI, old changelogs etcetera.
eeschema       - Sourcecode of the schematic editor
eeschema       - Sourcecode of the schematic editor
@@ -36,6 +36,5 @@ pcbnew - Sourcecode of the printed circuit board editor
polygon        - Sourcecode of the polygon library
polygon        - Sourcecode of the polygon library
resources      - Resources for installation, freedesktop mime-types for linux
resources      - Resources for installation, freedesktop mime-types for linux
scripts        - Helper scripts. For building, sourcecode packaging, font setting, pcb adjusting.
scripts        - Helper scripts. For building, sourcecode packaging, font setting, pcb adjusting.
share          - ?
template       - Project template(s)
template       - Project template(s)
+45 −4
Original line number Original line Diff line number Diff line
@@ -14,6 +14,13 @@
#include "class_board_design_settings.h"
#include "class_board_design_settings.h"
#include "colors_selection.h"
#include "colors_selection.h"


/* uncomment this line to show this pad with its specfic size and color
 * when it is not on copper layers, and only one solder mask layer or solder paste layer
 * is displayed for this pad
 * After testing this feature,I am not sure this is a good idea
 * but the code is left here.
 */
//#define SHOW_PADMASK_REAL_SIZE_AND_COLOR


/** Draw a pad:
/** Draw a pad:
 *  @param  DC = device context
 *  @param  DC = device context
@@ -35,6 +42,10 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
    int     fillpad = 0;
    int     fillpad = 0;
    wxPoint shape_pos;
    wxPoint shape_pos;
    wxSize  mask_margin;  // margin (clearance) used for some non copper layers
    wxSize  mask_margin;  // margin (clearance) used for some non copper layers
    int showActualMaskSize = 0;     /* == layer number if the actual pad size on mask layer can be displayed
                                      * i.e. if only one layer is shown for this pad
                                      * and this layer is a mask (solder mask or sloder paste
                                      */


    if( m_Flags & DO_NOT_DRAW )
    if( m_Flags & DO_NOT_DRAW )
        return;
        return;
@@ -103,8 +114,15 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
    {
    {
        // If the pad in on only one tech layer, use the layer color
        // If the pad in on only one tech layer, use the layer color
        // else use DARKGRAY
        // else use DARKGRAY
        switch( m_Masque_Layer & ~ALL_CU_LAYERS )
        int mask_non_copper_layers = m_Masque_Layer & ~ALL_CU_LAYERS;
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
        mask_non_copper_layers &= brd->GetVisibleLayers();
#endif
        switch( mask_non_copper_layers )
        {
        {
        case 0:
            break;

        case ADHESIVE_LAYER_BACK:
        case ADHESIVE_LAYER_BACK:
            color = brd->GetLayerColor(ADHESIVE_N_BACK);
            color = brd->GetLayerColor(ADHESIVE_N_BACK);
            break;
            break;
@@ -115,10 +133,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,


        case SOLDERPASTE_LAYER_BACK:
        case SOLDERPASTE_LAYER_BACK:
            color = brd->GetLayerColor(SOLDERPASTE_N_BACK);
            color = brd->GetLayerColor(SOLDERPASTE_N_BACK);
            showActualMaskSize = SOLDERPASTE_N_BACK;
            break;
            break;


        case SOLDERPASTE_LAYER_FRONT:
        case SOLDERPASTE_LAYER_FRONT:
            color = brd->GetLayerColor(SOLDERPASTE_N_FRONT);
            color = brd->GetLayerColor(SOLDERPASTE_N_FRONT);
            showActualMaskSize = SOLDERPASTE_N_FRONT;
            break;
            break;


        case SILKSCREEN_LAYER_BACK:
        case SILKSCREEN_LAYER_BACK:
@@ -131,10 +151,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,


        case SOLDERMASK_LAYER_BACK:
        case SOLDERMASK_LAYER_BACK:
            color = brd->GetLayerColor(SOLDERMASK_N_BACK);
            color = brd->GetLayerColor(SOLDERMASK_N_BACK);
            showActualMaskSize = SOLDERMASK_N_BACK;
            break;
            break;


        case SOLDERMASK_LAYER_FRONT:
        case SOLDERMASK_LAYER_FRONT:
            color = brd->GetLayerColor(SOLDERMASK_N_FRONT);
            color = brd->GetLayerColor(SOLDERMASK_N_FRONT);
            showActualMaskSize = SOLDERMASK_N_FRONT;
            break;
            break;


        case DRAW_LAYER:
        case DRAW_LAYER:
@@ -163,7 +185,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
        }
        }
    }
    }



    // if PAD_SMD pad and high contrast mode
    // if PAD_SMD pad and high contrast mode
    if( ( m_Attribut == PAD_SMD || m_Attribut == PAD_CONN )
    if( ( m_Attribut == PAD_SMD || m_Attribut == PAD_CONN )
       && DisplayOpt.ContrastModeDisplay )
       && DisplayOpt.ContrastModeDisplay )
@@ -211,11 +232,31 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
        }
        }
    }
    }


#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
    if( showActualMaskSize )
    {
        switch( showActualMaskSize )
        {
        case SOLDERMASK_N_BACK:
        case SOLDERMASK_N_FRONT:
            mask_margin.x = mask_margin.y = GetSolderMaskMargin();
            break;

        case SOLDERPASTE_N_BACK:
        case SOLDERPASTE_N_FRONT:
            mask_margin = GetSolderPasteMargin();
            break;

        default:
            break;
        }
    }
#endif

    // if Contrast mode is ON and a technical layer active, show pads on this
    // if Contrast mode is ON and a technical layer active, show pads on this
    // layer so we can see pads on paste or solder layer and the size of the
    // layer so we can see pads on paste or solder layer and the size of the
    // mask
    // mask
    if( DisplayOpt.ContrastModeDisplay
    if( DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER )
        && screen->m_Active_Layer > LAST_COPPER_LAYER )
    {
    {
        if( IsOnLayer( screen->m_Active_Layer ) )
        if( IsOnLayer( screen->m_Active_Layer ) )
        {
        {
+57 −40
Original line number Original line Diff line number Diff line
@@ -41,7 +41,11 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
    TRACK*               pt_piste;
    TRACK*               pt_piste;
    BOARD*               Pcb   = GetBoard();
    BOARD*               Pcb   = GetBoard();
    int                  defaultPenSize = 50;
    int                  defaultPenSize = 50;
    bool                onePagePerLayer = false;

    PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
    PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
    if( printParameters && printParameters->m_OptionPrintPage == 0 )
        onePagePerLayer = true;


    PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
    PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
    if( printParameters )
    if( printParameters )
@@ -51,16 +55,44 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
    }
    }


    save_opt = DisplayOpt;
    save_opt = DisplayOpt;
    if( aPrintMaskLayer & ALL_CU_LAYERS )
    int activeLayer = GetScreen()->m_Active_Layer;
    {

    DisplayOpt.ContrastModeDisplay = false;
    DisplayOpt.DisplayPadFill = true;
    DisplayOpt.DisplayPadFill = true;
    DisplayOpt.DisplayViaFill = true;
    DisplayOpt.DisplayViaFill = true;

    if( (aPrintMaskLayer & ALL_CU_LAYERS) == 0 )
    {
        if( onePagePerLayer )
        {   // We can print mask layers (solder mask and solder paste) with the actual pad sizes
            // To do that, we must set ContrastModeDisplay to true and set the GetScreen()->m_Active_Layer
            // to the current printed layer
            DisplayOpt.ContrastModeDisplay = true;
            DisplayOpt.DisplayPadFill = true;
            
            // Calculate the active layer number to print from its mask layer:
            GetScreen()->m_Active_Layer = 0;
            for(int kk = 0; kk < 32; kk ++ )
            {
                if( ((1 << kk) & aPrintMaskLayer) != 0 )
                {
                    GetScreen()->m_Active_Layer = kk;
                    break;
                }
            }
            
            // pads on Silkscreen layer are usually plot in sketch mode:
            if( (GetScreen()->m_Active_Layer == SILKSCREEN_N_BACK) ||
                (GetScreen()->m_Active_Layer == SILKSCREEN_N_FRONT) )
                DisplayOpt.DisplayPadFill = false;
            
        }
        }
        else
        else
        {
        {
            DisplayOpt.DisplayPadFill = false;
            DisplayOpt.DisplayPadFill = false;
        DisplayOpt.DisplayViaFill = false;
        }
        }
    }
    


    m_DisplayPadFill = DisplayOpt.DisplayPadFill;
    m_DisplayPadFill = DisplayOpt.DisplayPadFill;
    m_DisplayViaFill = DisplayOpt.DisplayViaFill;
    m_DisplayViaFill = DisplayOpt.DisplayViaFill;
@@ -79,7 +111,7 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
    DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
    DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;


    // The OR mode is used in color mode, but be aware the backgroud *must be
    // The OR mode is used in color mode, but be aware the backgroud *must be
    // BLACK.  In the print page dialog, we first plrint in BLACK, and after
    // BLACK.  In the print page dialog, we first print in BLACK, and after
    // reprint in color, on the black "local" backgroud, in OR mode the black
    // reprint in color, on the black "local" backgroud, in OR mode the black
    // print is not made before, only a white page is printed
    // print is not made before, only a white page is printed
    if( GetGRForceBlackPenState() == false )
    if( GetGRForceBlackPenState() == false )
@@ -193,6 +225,7 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
    DrawPanel->m_PrintIsMirrored = false;
    DrawPanel->m_PrintIsMirrored = false;


    DisplayOpt = save_opt;
    DisplayOpt = save_opt;
    GetScreen()->m_Active_Layer = activeLayer;
    m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
    m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
    m_DisplayPadFill = DisplayOpt.DisplayPadFill;
    m_DisplayPadFill = DisplayOpt.DisplayPadFill;
    m_DisplayViaFill = DisplayOpt.DisplayViaFill;
    m_DisplayViaFill = DisplayOpt.DisplayViaFill;
@@ -217,21 +250,6 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
    {
    {
        if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 )
        if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 )
            continue;
            continue;

        // Usually we draw pads in sketch mode on non copper layers:
        if( (aMasklayer & ALL_CU_LAYERS) == 0 )
        {
            int tmp_fill =
                ( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill;

            // Switch in sketch mode
            ( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill = 0;
            pt_pad->Draw( aPanel, aDC, aDraw_mode );
            ( (WinEDA_BasePcbFrame*) aPanel->GetParent() )->m_DisplayPadFill =
                tmp_fill;
        }
        else    // on copper layer, draw pads according to current options
        {
        // Manage hole according to the print drill option
        // Manage hole according to the print drill option
        wxSize drill_tmp = pt_pad->m_Drill;
        wxSize drill_tmp = pt_pad->m_Drill;
        switch ( aDrillShapeOpt )
        switch ( aDrillShapeOpt )
@@ -250,7 +268,6 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
        pt_pad->Draw( aPanel, aDC, aDraw_mode );
        pt_pad->Draw( aPanel, aDC, aDraw_mode );
        pt_pad->m_Drill = drill_tmp;
        pt_pad->m_Drill = drill_tmp;
    }
    }
    }


    /* Print footprint graphic shapes */
    /* Print footprint graphic shapes */
    PtStruct = aModule->m_Drawings;
    PtStruct = aModule->m_Drawings;
+1 −1
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ bool BOARD_PRINTOUT_CONTROLER::OnPrintPage( int page )
    int mask_layer = m_PrintParams.m_PrintMaskLayer;
    int mask_layer = m_PrintParams.m_PrintMaskLayer;


    // compute layer mask from page number if we want one page per layer
    // compute layer mask from page number if we want one page per layer
    if( m_PrintParams.m_OptionPrintPage == 0 )
    if( m_PrintParams.m_OptionPrintPage == 0 )  // One page per layer
    {
    {
        int ii, jj, mask = 1;
        int ii, jj, mask = 1;
        for( ii = 0, jj = 0; ii < layers_count; ii++ )
        for( ii = 0, jj = 0; ii < layers_count; ii++ )
Loading