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

This commit is contained in:
Maciej Suminski 2015-03-26 18:23:17 +01:00
parent 681090b8ef
commit 32c8fdad37
4 changed files with 38 additions and 26 deletions

View File

@ -175,7 +175,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
wxGROW | wxLEFT | wxRIGHT | wxTOP );
}
// Read the scale adjust option
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);
}
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
{
int page_count = 0;

View File

@ -46,7 +46,7 @@
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
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:
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
@ -60,14 +60,27 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
m_DisplayOptions.m_IsPrinting = true;
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;
printCurrLayerMask.reset();
printCurrLayerMask.set(printParameters->m_Flags); // m_Flags contains the draw layer number
printCurrLayerMask.set( layer );
GetGerberLayout()->SetPrintableLayers( printCurrLayerMask );
m_canvas->SetPrintMirrored( aPrintMirrorMode );
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 );
m_canvas->SetPrintMirrored( false );

View File

@ -81,7 +81,7 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
{
// in gerbview, draw layers are always printed on separate pages
// 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();
return true;
@ -261,8 +261,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
// B&W mode is handled in print page function
GRForceBlackPen( false );
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror,
&m_PrintParams );
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
m_Parent->SetDrawBgColor( bg_color );
screen->m_IsPrinting = false;