pcbnew: enhancement in printing function.

This commit is contained in:
charras 2009-03-18 16:46:07 +00:00
parent 3e477651c7
commit 9fb53f0c4f
3 changed files with 25 additions and 20 deletions

View File

@ -564,7 +564,7 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
/*************************************************************/
{
if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
return FALSE;
return false;
return TRUE;
}
@ -699,11 +699,6 @@ void EDA_Printout::DrawPage()
g_IsPrinting = TRUE;
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 )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
@ -748,14 +743,29 @@ void EDA_Printout::DrawPage()
s_PrintMaskLayer |= EDGE_LAYER;
#endif
panel->PrintPage( dc, 0, s_PrintMaskLayer, s_PrintMirror );
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 );
g_DrawBgColor = bg_color;
g_IsPrinting = FALSE;
g_IsPrinting = false;
panel->m_ClipBox = tmp;
SetPenMinWidth( 1 );
GRForceBlackPen( FALSE );
GRForceBlackPen( false );
ActiveScreen->m_StartVisu = tmp_startvisu;
ActiveScreen->m_DrawOrg = old_org;

View File

@ -432,7 +432,7 @@ void trace_1_pastille_OVALE_HPGL( wxPoint pos, wxSize size, int aOrient, int mod
if( modetrace == FILLED )
{
PlotRectangularPad_HPGL( pos, wxSize( size.x, deltaxy ),
PlotRectangularPad_HPGL( pos, wxSize( size.x, deltaxy+pen_diam ),
aOrient, modetrace );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, aOrient );

View File

@ -51,18 +51,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
m_PrintIsMirrored = aPrintMirrorMode;
if( ( g_DrawBgColor == BLACK ) && (GetGRForceBlackPenState( ) == false) )
{ // One can use the OR mode in this case, and we draw a black background to draw board in OR mode, like on screen
// But because black background are very expensive to draw, we draw in black only the minimun area.
// The OR mode is used in color mode, but be aware the backgroud *must be BLACK.
// In print page dialog, we first plrint in BLACK, and after reprint in color,
// 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;
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, ...) */
GRSetDrawMode( aDC, drawmode );