Commit 32c8fdad authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Fix for printing non-consecutive layers or starting with layer > 1 in gerbview.

parent 681090b8
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -175,7 +175,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
                                            wxGROW | wxLEFT | wxRIGHT | wxTOP );
                                            wxGROW | wxLEFT | wxRIGHT | wxTOP );
    }
    }



    // Read the scale adjust option
    // Read the scale adjust option
    int scale_idx = 4; // default selected scale = ScaleList[4] = 1.000
    int scale_idx = 4; // default selected scale = ScaleList[4] = 1.000


@@ -230,6 +229,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
    m_FineAdjustYscaleOpt->Enable(enable);
    m_FineAdjustYscaleOpt->Enable(enable);
}
}



int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
{
{
    int page_count = 0;
    int page_count = 0;
+17 −4
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
                                bool aPrintMirrorMode, void* aData )
                                bool aPrintMirrorMode, void* aData )
{
{
    wxCHECK_RET( aData != NULL, wxT( "aDate cannot be NULL." ) );
    wxCHECK_RET( aData != NULL, wxT( "aData cannot be NULL." ) );


    // Save current draw options, because print mode has specific options:
    // Save current draw options, because print mode has specific options:
    GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
    GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
@@ -60,14 +60,27 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
    m_DisplayOptions.m_IsPrinting = true;
    m_DisplayOptions.m_IsPrinting = true;


    PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData;
    PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData;

    // Find the layer to be printed
    int page = printParameters->m_Flags;    // contains the page number (not necessarily layer number)
    int layer = 0;

    // Find the layer number for the printed page (search through the mask and count bits)
    while( page > 0 )
    {
        if( printLayersMask[layer++] )
            --page;
    }
    --layer;

    std::bitset <GERBER_DRAWLAYERS_COUNT> printCurrLayerMask;
    std::bitset <GERBER_DRAWLAYERS_COUNT> printCurrLayerMask;
    printCurrLayerMask.reset();
    printCurrLayerMask.reset();
    printCurrLayerMask.set(printParameters->m_Flags);   // m_Flags contains the draw layer number
    printCurrLayerMask.set( layer );
    GetGerberLayout()->SetPrintableLayers( printCurrLayerMask );
    GetGerberLayout()->SetPrintableLayers( printCurrLayerMask );
    m_canvas->SetPrintMirrored( aPrintMirrorMode );
    m_canvas->SetPrintMirrored( aPrintMirrorMode );
    bool printBlackAndWhite = printParameters->m_Print_Black_and_White;
    bool printBlackAndWhite = printParameters->m_Print_Black_and_White;


    GetGerberLayout()->Draw( m_canvas, aDC, UNSPECIFIED_DRAWMODE,
    GetGerberLayout()->Draw( m_canvas, aDC, (GR_DRAWMODE) 0,
                             wxPoint( 0, 0 ), printBlackAndWhite );
                             wxPoint( 0, 0 ), printBlackAndWhite );


    m_canvas->SetPrintMirrored( false );
    m_canvas->SetPrintMirrored( false );
+5 −6
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
{
{
    // in gerbview, draw layers are always printed on separate pages
    // in gerbview, draw layers are always printed on separate pages
    // because handling negative objects when using only one page is tricky
    // because handling negative objects when using only one page is tricky
    m_PrintParams.m_Flags = aPage-1;    // = gerber draw layer id
    m_PrintParams.m_Flags = aPage;
    DrawPage();
    DrawPage();


    return true;
    return true;
@@ -261,8 +261,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
    // B&W mode is handled in print page function
    // B&W mode is handled in print page function
    GRForceBlackPen( false );
    GRForceBlackPen( false );


    m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror,
    m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
                         &m_PrintParams );


    m_Parent->SetDrawBgColor( bg_color );
    m_Parent->SetDrawBgColor( bg_color );
    screen->m_IsPrinting = false;
    screen->m_IsPrinting = false;
+4 −4

File changed.

Contains only whitespace changes.