2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-04-26 20:21:31 +00:00
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
2011-10-13 19:56:32 +00:00
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* printout_controler.cpp
|
|
|
|
*/
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
// Set this to 1 if you want to test PostScript printing under MSW.
|
|
|
|
#define wxTEST_POSTSCRIPT_IN_MSW 1
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
2012-04-16 01:25:26 +00:00
|
|
|
#include <base_units.h>
|
2012-05-04 17:44:42 +00:00
|
|
|
#ifdef PCBNEW
|
|
|
|
#include <wxBasePcbFrame.h>
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#else
|
|
|
|
#include <wxstruct.h>
|
|
|
|
#include <class_base_screen.h>
|
|
|
|
#include <layers_id_colors_and_visibility.h>
|
|
|
|
#include <gerbview_frame.h>
|
|
|
|
#endif
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <printout_controler.h>
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
// This class is an helper to pass print parameters to print functions
|
|
|
|
PRINT_PARAMETERS::PRINT_PARAMETERS()
|
|
|
|
{
|
2010-02-22 19:56:32 +00:00
|
|
|
m_PenDefaultSize = 50; // A reasonnable minimal value to draw items
|
2009-10-23 07:41:29 +00:00
|
|
|
// mainly that do not have a specifed line width
|
|
|
|
m_PrintScale = 1.0;
|
|
|
|
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
|
|
|
m_Print_Sheet_Ref = false;
|
|
|
|
m_PrintMaskLayer = 0xFFFFFFFF;
|
|
|
|
m_PrintMirror = false;
|
|
|
|
m_Print_Black_and_White = true;
|
|
|
|
m_OptionPrintPage = 1;
|
|
|
|
m_PageCount = 1;
|
|
|
|
m_ForceCentered = false;
|
|
|
|
m_Flags = 0;
|
2010-01-09 20:25:39 +00:00
|
|
|
m_DrillShapeOpt = PRINT_PARAMETERS::SMALL_DRILL_SHAPE;
|
2010-04-21 18:57:34 +00:00
|
|
|
m_PageSetupData = NULL;
|
2009-10-23 07:41:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOARD_PRINTOUT_CONTROLER::BOARD_PRINTOUT_CONTROLER( const PRINT_PARAMETERS& print_params,
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_DRAW_FRAME* parent,
|
2009-10-23 07:41:29 +00:00
|
|
|
const wxString& title ) :
|
|
|
|
wxPrintout( title )
|
|
|
|
{
|
|
|
|
m_PrintParams = print_params; // Make a local copy of parameters.
|
|
|
|
// So they can change in printout controler
|
|
|
|
m_Parent = parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool BOARD_PRINTOUT_CONTROLER::OnPrintPage( int page )
|
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
#ifdef PCBNEW
|
2009-10-23 07:41:29 +00:00
|
|
|
int layers_count = NB_LAYERS;
|
2012-05-04 17:44:42 +00:00
|
|
|
#else
|
|
|
|
int layers_count = LAYER_COUNT;
|
|
|
|
#endif
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
int mask_layer = m_PrintParams.m_PrintMaskLayer;
|
|
|
|
|
|
|
|
// compute layer mask from page number if we want one page per layer
|
2010-03-29 16:42:03 +00:00
|
|
|
if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer
|
2009-10-23 07:41:29 +00:00
|
|
|
{
|
|
|
|
int ii, jj, mask = 1;
|
2011-10-13 19:56:32 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
for( ii = 0, jj = 0; ii < layers_count; ii++ )
|
|
|
|
{
|
|
|
|
if( mask_layer & mask )
|
|
|
|
jj++;
|
2011-10-13 19:56:32 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
if( jj == page )
|
|
|
|
{
|
|
|
|
m_PrintParams.m_PrintMaskLayer = mask;
|
|
|
|
break;
|
|
|
|
}
|
2011-10-13 19:56:32 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
mask <<= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_PrintParams.m_PrintMaskLayer == 0 )
|
|
|
|
return false;
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
#ifdef PCBNEW
|
2011-09-30 18:15:37 +00:00
|
|
|
// In Pcbnew we can want the layer EDGE always printed
|
2009-10-23 07:41:29 +00:00
|
|
|
if( m_PrintParams.m_Flags == 1 )
|
|
|
|
m_PrintParams.m_PrintMaskLayer |= EDGE_LAYER;
|
2012-05-04 17:44:42 +00:00
|
|
|
#endif
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
DrawPage();
|
|
|
|
|
|
|
|
m_PrintParams.m_PrintMaskLayer = mask_layer;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************/
|
|
|
|
void BOARD_PRINTOUT_CONTROLER::GetPageInfo( int* minPage, int* maxPage,
|
|
|
|
int* selPageFrom, int* selPageTo )
|
|
|
|
/*********************************************************/
|
|
|
|
{
|
|
|
|
*minPage = 1;
|
|
|
|
*selPageFrom = 1;
|
|
|
|
|
|
|
|
int icnt = 1;
|
|
|
|
if( m_PrintParams.m_OptionPrintPage == 0 )
|
|
|
|
icnt = m_PrintParams.m_PageCount;
|
|
|
|
|
|
|
|
*maxPage = icnt;
|
|
|
|
*selPageTo = icnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the real print function: print the active screen
|
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
2009-10-23 07:41:29 +00:00
|
|
|
{
|
|
|
|
int tmpzoom;
|
|
|
|
wxPoint tmp_startvisu;
|
|
|
|
wxPoint old_org;
|
2011-12-22 21:57:50 +00:00
|
|
|
wxPoint DrawOffset; // Offset de trace
|
2009-10-23 07:41:29 +00:00
|
|
|
double userscale;
|
|
|
|
double DrawZoom = 1;
|
|
|
|
wxDC* dc = GetDC();
|
2012-05-04 17:44:42 +00:00
|
|
|
BASE_SCREEN* screen = m_Parent->GetScreen();
|
2009-10-23 07:41:29 +00:00
|
|
|
bool printMirror = m_PrintParams.m_PrintMirror;
|
|
|
|
|
|
|
|
wxBusyCursor dummy;
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// Save old draw scale and draw offset
|
2011-02-01 15:46:25 +00:00
|
|
|
tmp_startvisu = screen->m_StartVisu;
|
|
|
|
tmpzoom = screen->GetZoom();
|
|
|
|
old_org = screen->m_DrawOrg;
|
2011-12-22 21:57:50 +00:00
|
|
|
|
|
|
|
// Change draw scale and offset to draw the whole page
|
2011-02-01 15:46:25 +00:00
|
|
|
screen->SetScalingFactor( DrawZoom );
|
|
|
|
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
|
|
|
|
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
|
2009-10-23 07:41:29 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
#ifdef PCBNEW
|
|
|
|
EDA_RECT bbbox= ((PCB_BASE_FRAME*) m_Parent)->GetBoard()->ComputeBoundingBox();
|
|
|
|
#else
|
|
|
|
EDA_RECT bbbox = ((GERBVIEW_FRAME*) m_Parent)->GetLayoutBoundingBox();
|
|
|
|
#endif
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
wxSize pageSizeIU = m_Parent->GetPageSizeIU(); // internal units
|
2011-02-25 16:23:24 +00:00
|
|
|
|
2011-01-19 10:34:56 +00:00
|
|
|
// In module editor, the module is located at 0,0 but for printing
|
2011-12-22 21:57:50 +00:00
|
|
|
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
|
2011-01-19 10:34:56 +00:00
|
|
|
// So the equivalent board must be moved:
|
2012-09-11 19:03:21 +00:00
|
|
|
if( m_Parent->IsType( MODULE_EDITOR_FRAME_TYPE ) )
|
2011-01-19 10:34:56 +00:00
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
|
2011-01-19 10:34:56 +00:00
|
|
|
}
|
2011-02-01 15:46:25 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// Compute the PCB size in internal units
|
2009-10-23 07:41:29 +00:00
|
|
|
userscale = m_PrintParams.m_PrintScale;
|
2011-02-01 15:46:25 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
if( userscale == 0 ) // fit in page
|
2009-10-23 07:41:29 +00:00
|
|
|
{
|
2012-04-25 19:33:24 +00:00
|
|
|
// Margin = 10mm
|
2012-05-04 17:44:42 +00:00
|
|
|
int extra_margin = int( 10 * IU_PER_MM );
|
2011-12-22 21:57:50 +00:00
|
|
|
|
|
|
|
pageSizeIU.x = bbbox.GetWidth() + extra_margin * 2;
|
|
|
|
pageSizeIU.y = bbbox.GetHeight() + extra_margin * 2;
|
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
userscale = 0.99;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage
|
|
|
|
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
|
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
DrawOffset += bbbox.Centre();
|
2011-01-19 10:34:56 +00:00
|
|
|
}
|
2009-10-23 07:41:29 +00:00
|
|
|
|
2010-04-21 18:57:34 +00:00
|
|
|
if( m_PrintParams.m_PageSetupData )
|
|
|
|
{
|
|
|
|
wxSize pagesize;
|
2011-12-22 21:57:50 +00:00
|
|
|
|
|
|
|
pagesize.x = int( pageSizeIU.x / userscale );
|
|
|
|
pagesize.y = int( pageSizeIU.y / userscale );
|
|
|
|
|
|
|
|
FitThisSizeToPageMargins( pagesize, *m_PrintParams.m_PageSetupData );
|
2010-04-21 18:57:34 +00:00
|
|
|
}
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
// Compute Accurate scale 1
|
2010-04-21 18:57:34 +00:00
|
|
|
if( userscale == 1.0 )
|
2009-10-23 07:41:29 +00:00
|
|
|
{
|
2010-04-21 18:57:34 +00:00
|
|
|
// We want a 1:1 scale and margins for printing
|
2011-12-22 21:57:50 +00:00
|
|
|
MapScreenSizeToPaper();
|
2009-10-23 07:41:29 +00:00
|
|
|
int w, h;
|
|
|
|
GetPPIPrinter( &w, &h );
|
2012-04-26 21:34:20 +00:00
|
|
|
double accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (IU_PER_MILS*1000);
|
|
|
|
double accurate_Yscale = ( (double) ( DrawZoom * h ) ) / (IU_PER_MILS*1000);
|
2010-01-13 21:15:54 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
if( IsPreview() ) // Scale must take in account the DC size in Preview
|
|
|
|
{
|
|
|
|
// Get the size of the DC in pixels
|
2010-04-21 18:57:34 +00:00
|
|
|
wxSize PlotAreaSize;
|
2009-10-23 07:41:29 +00:00
|
|
|
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
|
|
|
|
GetPageSizePixels( &w, &h );
|
2010-01-13 21:15:54 +00:00
|
|
|
accurate_Xscale *= PlotAreaSize.x;
|
|
|
|
accurate_Xscale /= (double) w;
|
|
|
|
accurate_Yscale *= PlotAreaSize.y;
|
|
|
|
accurate_Yscale /= (double) h;
|
2009-10-23 07:41:29 +00:00
|
|
|
}
|
|
|
|
accurate_Xscale *= m_PrintParams.m_XScaleAdjust;
|
|
|
|
accurate_Yscale *= m_PrintParams.m_YScaleAdjust;
|
2010-04-21 18:57:34 +00:00
|
|
|
// Fine scale adjust
|
|
|
|
dc->SetUserScale( accurate_Xscale, accurate_Yscale );
|
2009-10-23 07:41:29 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 18:57:34 +00:00
|
|
|
// Get the final size of the DC in pixels
|
|
|
|
wxSize PlotAreaSizeInPixels;
|
|
|
|
dc->GetSize( &PlotAreaSizeInPixels.x, &PlotAreaSizeInPixels.y );
|
|
|
|
double scalex, scaley;
|
|
|
|
dc->GetUserScale(&scalex, &scaley);
|
|
|
|
wxSize PlotAreaSizeInUserUnits;
|
|
|
|
PlotAreaSizeInUserUnits.x = (int) (PlotAreaSizeInPixels.x/scalex);
|
|
|
|
PlotAreaSizeInUserUnits.y = (int) (PlotAreaSizeInPixels.y/scaley);
|
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
/* In some cases the plot origin is the centre of the page
|
|
|
|
* when:
|
|
|
|
* - Asked
|
|
|
|
* - scale > 1
|
|
|
|
* - fit in page
|
|
|
|
*/
|
|
|
|
if( m_PrintParams.m_ForceCentered
|
|
|
|
|| (m_PrintParams.m_PrintScale > 1.0) // scale > 1
|
|
|
|
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
|
|
|
|
{
|
2010-04-21 18:57:34 +00:00
|
|
|
DrawOffset.x -= PlotAreaSizeInUserUnits.x / 2;
|
|
|
|
DrawOffset.y -= PlotAreaSizeInUserUnits.y / 2;
|
2009-10-23 07:41:29 +00:00
|
|
|
}
|
|
|
|
|
2011-02-01 15:46:25 +00:00
|
|
|
screen->m_DrawOrg = DrawOffset;
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
GRResetPenAndBrush( dc );
|
2011-12-29 20:11:42 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
if( m_PrintParams.m_Print_Black_and_White )
|
|
|
|
GRForceBlackPen( true );
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
|
2011-12-29 20:11:42 +00:00
|
|
|
EDA_RECT tmp = *panel->GetClipBox();
|
2009-10-23 07:41:29 +00:00
|
|
|
|
2011-01-17 18:37:58 +00:00
|
|
|
// Set clip box to the max size
|
2011-01-15 18:06:10 +00:00
|
|
|
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
|
|
|
|
// and that allows calculations without overflow
|
2011-12-29 20:11:42 +00:00
|
|
|
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
|
2009-10-23 07:41:29 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
m_Parent->GetScreen()->m_IsPrinting = true;
|
2012-09-02 12:06:47 +00:00
|
|
|
EDA_COLOR_T bg_color = g_DrawBgColor;
|
2009-10-23 07:41:29 +00:00
|
|
|
|
2010-01-13 21:15:54 +00:00
|
|
|
if( m_PrintParams.m_Print_Sheet_Ref )
|
2012-04-25 19:33:24 +00:00
|
|
|
m_Parent->TraceWorkSheet( dc, screen, m_PrintParams.m_PenDefaultSize,
|
2012-08-29 16:59:50 +00:00
|
|
|
IU_PER_MILS, m_Parent->GetScreenDesc() );
|
2010-01-13 21:15:54 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
if( printMirror )
|
|
|
|
{
|
|
|
|
// To plot mirror, we reverse the y axis, and modify the plot y origin
|
|
|
|
dc->SetAxisOrientation( true, true );
|
2011-12-29 20:11:42 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
if( userscale < 1.0 )
|
2011-01-17 18:37:58 +00:00
|
|
|
scaley /= userscale;
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
/* Plot offset y is moved by the y plot area size in order to have
|
|
|
|
* the old draw area in the new draw area, because the draw origin has not moved
|
|
|
|
* (this is the upper left corner) but the Y axis is reversed, therefore the plotting area
|
|
|
|
* is the y coordinate values from - PlotAreaSize.y to 0 */
|
2010-12-18 16:09:06 +00:00
|
|
|
int y_dc_offset = PlotAreaSizeInPixels.y;
|
2011-01-20 16:34:57 +00:00
|
|
|
y_dc_offset = (int) ( ( double ) y_dc_offset * userscale );
|
2010-12-18 16:09:06 +00:00
|
|
|
dc->SetDeviceOrigin( 0, y_dc_offset );
|
2011-01-17 18:37:58 +00:00
|
|
|
int ysize = (int) ( PlotAreaSizeInPixels.y / scaley );
|
2009-10-23 07:41:29 +00:00
|
|
|
DrawOffset.y += ysize;
|
|
|
|
|
|
|
|
/* in order to keep the board position in the sheet
|
|
|
|
* (when user scale <= 1) the y offset in moved by the distance between
|
|
|
|
* the middle of the page and the middle of the board
|
|
|
|
* This is equivalent to put the mirror axis to the board centre
|
|
|
|
* for scales > 1, the DrawOffset was already computed to have the board centre
|
|
|
|
* to the middle of the page.
|
|
|
|
*/
|
2011-12-22 21:57:50 +00:00
|
|
|
wxPoint pcb_centre = bbbox.Centre();
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2009-10-23 07:41:29 +00:00
|
|
|
if( userscale <= 1.0 )
|
|
|
|
DrawOffset.y += pcb_centre.y - (ysize / 2);
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2011-02-01 15:46:25 +00:00
|
|
|
dc->SetLogicalOrigin( screen->m_DrawOrg.x, screen->m_DrawOrg.y );
|
2011-12-29 20:11:42 +00:00
|
|
|
panel->SetClipBox( EDA_RECT( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ),
|
|
|
|
panel->GetClipBox()->GetSize() ) );
|
2009-10-23 07:41:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_DrawBgColor = WHITE;
|
|
|
|
|
|
|
|
/* when printing in color mode, we use the graphic OR mode that gives the same look as the screen
|
2010-03-18 20:35:29 +00:00
|
|
|
* But because the background is white when printing, we must use a trick:
|
2009-10-23 07:41:29 +00:00
|
|
|
* In order to plot on a white background in OR mode we must:
|
2012-04-26 21:34:20 +00:00
|
|
|
* 1 - Plot all items in black, this creates a local black background
|
2009-10-23 07:41:29 +00:00
|
|
|
* 2 - Plot in OR mode on black "local" background
|
|
|
|
*/
|
|
|
|
if( !m_PrintParams.m_Print_Black_and_White )
|
2010-01-09 20:25:39 +00:00
|
|
|
{ // Creates a "local" black background
|
2009-10-23 07:41:29 +00:00
|
|
|
GRForceBlackPen( true );
|
2011-01-17 18:37:58 +00:00
|
|
|
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
|
2009-10-23 07:41:29 +00:00
|
|
|
GRForceBlackPen( false );
|
|
|
|
}
|
|
|
|
|
2011-01-17 18:37:58 +00:00
|
|
|
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
g_DrawBgColor = bg_color;
|
2011-02-05 02:21:11 +00:00
|
|
|
m_Parent->GetScreen()->m_IsPrinting = false;
|
2011-12-29 20:11:42 +00:00
|
|
|
panel->SetClipBox( tmp );
|
2009-10-23 07:41:29 +00:00
|
|
|
|
|
|
|
GRForceBlackPen( false );
|
|
|
|
|
2011-02-01 15:46:25 +00:00
|
|
|
screen->m_StartVisu = tmp_startvisu;
|
|
|
|
screen->m_DrawOrg = old_org;
|
|
|
|
screen->SetZoom( tmpzoom );
|
2009-10-23 07:41:29 +00:00
|
|
|
}
|