Fix for printing non-consecutive layers or starting with layer > 1 in gerbview.
This commit is contained in:
parent
681090b8ef
commit
32c8fdad37
|
@ -78,8 +78,8 @@ private:
|
|||
void OnScaleSelectionClick( wxCommandEvent& event );
|
||||
|
||||
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
|
||||
void SetPrintParameters( );
|
||||
void InitValues( );
|
||||
void SetPrintParameters();
|
||||
void InitValues();
|
||||
|
||||
public:
|
||||
bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
|
||||
|
@ -151,8 +151,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
s_pageSetupData = new wxPageSetupDialogData;
|
||||
// Set initial page margins.
|
||||
// Margins are already set in Gerbview, so we can use 0
|
||||
s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
|
||||
s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
|
||||
s_pageSetupData->SetMarginTopLeft( wxPoint( 0, 0 ) );
|
||||
s_pageSetupData->SetMarginBottomRight( wxPoint( 0, 0 ) );
|
||||
}
|
||||
|
||||
s_Parameters.m_PageSetupData = s_pageSetupData;
|
||||
|
@ -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
|
||||
|
||||
|
@ -184,8 +183,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
m_Config->Read( OPTKEY_PRINT_X_FINESCALE_ADJ, &s_Parameters.m_XScaleAdjust );
|
||||
m_Config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &s_Parameters.m_YScaleAdjust );
|
||||
m_Config->Read( OPTKEY_PRINT_SCALE, &scale_idx );
|
||||
m_Config->Read( OPTKEY_PRINT_PAGE_FRAME, &s_Parameters.m_Print_Sheet_Ref, 1);
|
||||
m_Config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1);
|
||||
m_Config->Read( OPTKEY_PRINT_PAGE_FRAME, &s_Parameters.m_Print_Sheet_Ref, 1 );
|
||||
m_Config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1 );
|
||||
|
||||
// Test for a reasonnable scale value. Set to 1 if problem
|
||||
if( s_Parameters.m_XScaleAdjust < MIN_SCALE ||
|
||||
|
@ -208,7 +207,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
m_ScaleOption->SetSelection( scale_idx );
|
||||
scale_idx = m_ScaleOption->GetSelection();
|
||||
s_Parameters.m_PrintScale = s_ScaleList[scale_idx];
|
||||
m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror);
|
||||
m_Print_Mirror->SetValue( s_Parameters.m_PrintMirror );
|
||||
|
||||
|
||||
if( s_Parameters.m_Print_Black_and_White )
|
||||
|
@ -230,6 +229,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
m_FineAdjustYscaleOpt->Enable(enable);
|
||||
}
|
||||
|
||||
|
||||
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
|
||||
{
|
||||
int page_count = 0;
|
||||
|
@ -275,7 +275,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
|
||||
void DIALOG_PRINT_USING_PRINTER::SetPrintParameters()
|
||||
{
|
||||
s_Parameters.m_PrintMirror = m_Print_Mirror->GetValue();
|
||||
s_Parameters.m_Print_Black_and_White =
|
||||
|
@ -331,7 +331,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
|
|||
|
||||
bool DIALOG_PRINT_USING_PRINTER::PreparePrintPrms()
|
||||
{
|
||||
SetPrintParameters( );
|
||||
SetPrintParameters();
|
||||
|
||||
// If no layer selected, we have no plot. prompt user if it happens
|
||||
// because he could think there is a bug in Pcbnew:
|
||||
|
|
|
@ -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;
|
||||
|
@ -59,15 +59,28 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
|
|||
m_DisplayOptions.m_DisplayDCodes = false;
|
||||
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;
|
||||
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 );
|
||||
|
|
|
@ -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;
|
||||
|
@ -238,7 +238,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
|
|||
if( printMirror )
|
||||
{
|
||||
// To plot mirror, we reverse the x axis, and modify the plot x origin
|
||||
dc->SetAxisOrientation( false, false);
|
||||
dc->SetAxisOrientation( false, false );
|
||||
|
||||
/* Plot offset x is moved by the x plot area size in order to have
|
||||
* the old draw area in the new draw area, because the draw origin has not moved
|
||||
|
@ -248,7 +248,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
|
|||
x_dc_offset = KiROUND( x_dc_offset * userscale );
|
||||
dc->SetDeviceOrigin( x_dc_offset, 0 );
|
||||
|
||||
panel->SetClipBox( EDA_RECT( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ),
|
||||
panel->SetClipBox( EDA_RECT( wxPoint( -MAX_VALUE / 2, -MAX_VALUE / 2 ),
|
||||
panel->GetClipBox()->GetSize() ) );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue