Commit 9fb53f0c authored by charras's avatar charras

pcbnew: enhancement in printing function.

parent 3e477651
...@@ -564,7 +564,7 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage ) ...@@ -564,7 +564,7 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
/*************************************************************/ /*************************************************************/
{ {
if( !wxPrintout::OnBeginDocument( startPage, endPage ) ) if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
return FALSE; return false;
return TRUE; return TRUE;
} }
...@@ -699,11 +699,6 @@ void EDA_Printout::DrawPage() ...@@ -699,11 +699,6 @@ void EDA_Printout::DrawPage()
g_IsPrinting = TRUE; g_IsPrinting = TRUE;
int bg_color = g_DrawBgColor; int bg_color = g_DrawBgColor;
// background color can left BLACK only when drawing the full board at once, in color mode
// Switch it to WHITE in others cases
if( s_Print_Black_and_White || ( !m_PrintFrame->PrintUsingSinglePage() ) )
g_DrawBgColor = WHITE;
if( m_Print_Sheet_Ref ) if( m_Print_Sheet_Ref )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 ); m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
...@@ -748,14 +743,29 @@ void EDA_Printout::DrawPage() ...@@ -748,14 +743,29 @@ void EDA_Printout::DrawPage()
s_PrintMaskLayer |= EDGE_LAYER; s_PrintMaskLayer |= EDGE_LAYER;
#endif #endif
g_DrawBgColor = WHITE;
/* when printing in color mode, we use the graphic OR mode that gives the same look as the screen
* But because the backgroud is white when printing, we must use a trick:
* In order to plot on a white background in OR mode we must:
* 1 - Plot all items in black, this creates a local black backgroud
* 2 - Plot in OR mode on black "local" background
*/
if( ! s_Print_Black_and_White )
{
GRForceBlackPen( true );
panel->PrintPage( dc, 0, s_PrintMaskLayer, s_PrintMirror );
GRForceBlackPen( false );
}
panel->PrintPage( dc, 0, s_PrintMaskLayer, s_PrintMirror ); panel->PrintPage( dc, 0, s_PrintMaskLayer, s_PrintMirror );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
g_IsPrinting = FALSE; g_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
SetPenMinWidth( 1 ); SetPenMinWidth( 1 );
GRForceBlackPen( FALSE ); GRForceBlackPen( false );
ActiveScreen->m_StartVisu = tmp_startvisu; ActiveScreen->m_StartVisu = tmp_startvisu;
ActiveScreen->m_DrawOrg = old_org; ActiveScreen->m_DrawOrg = old_org;
......
...@@ -432,7 +432,7 @@ void trace_1_pastille_OVALE_HPGL( wxPoint pos, wxSize size, int aOrient, int mod ...@@ -432,7 +432,7 @@ void trace_1_pastille_OVALE_HPGL( wxPoint pos, wxSize size, int aOrient, int mod
if( modetrace == FILLED ) if( modetrace == FILLED )
{ {
PlotRectangularPad_HPGL( pos, wxSize( size.x, deltaxy ), PlotRectangularPad_HPGL( pos, wxSize( size.x, deltaxy+pen_diam ),
aOrient, modetrace ); aOrient, modetrace );
cx = 0; cy = deltaxy / 2; cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, aOrient ); RotatePoint( &cx, &cy, aOrient );
......
...@@ -51,18 +51,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa ...@@ -51,18 +51,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
m_PrintIsMirrored = aPrintMirrorMode; m_PrintIsMirrored = aPrintMirrorMode;
if( ( g_DrawBgColor == BLACK ) && (GetGRForceBlackPenState( ) == false) ) // The OR mode is used in color mode, but be aware the backgroud *must be BLACK.
{ // One can use the OR mode in this case, and we draw a black background to draw board in OR mode, like on screen // In print page dialog, we first plrint in BLACK, and after reprint in color,
// But because black background are very expensive to draw, we draw in black only the minimun area. // on the black "local" backgroud, in OR mode
// the black print is not made before, only a white page is printed
if( GetGRForceBlackPenState( ) == false )
drawmode = GR_OR; drawmode = GR_OR;
EDA_Rect rect = frame->GetBoard()->m_BoundaryBox;
rect.Inflate( 2000, 2000 ); // Margin in 1/10000 inch around the board to draw the black background.
GRSetDrawMode( aDC, GR_COPY );
// draw in black the minimum page area:
GRFilledRect( &m_ClipBox, aDC, rect.GetX(), rect.GetY(),
rect.GetEnd().x, rect.GetEnd().y, g_DrawBgColor, g_DrawBgColor );
}
/* Print the pcb graphic items (texts, ...) */ /* Print the pcb graphic items (texts, ...) */
GRSetDrawMode( aDC, drawmode ); GRSetDrawMode( aDC, drawmode );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment