Commit f43f7af5 authored by jean-pierre charras's avatar jean-pierre charras

Modedit: fix issues when printing a footprint. But needs refinement. Work in...

Modedit: fix issues when printing a footprint. But needs refinement. Work in progress (mainly "Fit in page" is not working).
Minor code cleaning
parent e849da18
...@@ -191,7 +191,7 @@ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) ...@@ -191,7 +191,7 @@ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
* because WinEDA_DrawFrame does not know how to print a page * because WinEDA_DrawFrame does not know how to print a page
* This is the reason it is a virtual function * This is the reason it is a virtual function
*/ */
void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,int aPrintMask, void WinEDA_DrawFrame::PrintPage( wxDC* aDC,int aPrintMask,
bool aPrintMirrorMode, void* aData ) bool aPrintMirrorMode, void* aData )
{ {
wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error")); wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error"));
......
...@@ -126,12 +126,11 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j ...@@ -126,12 +126,11 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j
* Function PrintPage (virtual) * Function PrintPage (virtual)
* used to print a page. * used to print a page.
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here * @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here) * @param aData = a pointer on an auxiliary data (not used here)
*/ */
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMask, void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask,
bool aPrintMirrorMode, void* aData) bool aPrintMirrorMode, void* aData)
{ {
if( ! m_component ) if( ! m_component )
......
...@@ -331,12 +331,11 @@ protected: ...@@ -331,12 +331,11 @@ protected:
* used to print a page * used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here * @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMask, virtual void PrintPage( wxDC* aDC, int aPrintMask,
bool aPrintMirrorMode, void* aData = NULL ); bool aPrintMirrorMode, void* aData = NULL );
/** /**
......
...@@ -32,12 +32,11 @@ ...@@ -32,12 +32,11 @@
* Used to print the board (on printer, or when creating SVF files). * Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer * Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context * @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrintMasklayer = a 32 bits mask: bit n = 1 -> layer n is printed * @param aPrintMasklayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (not used here: can be NULL) * @param aData = a pointer to an optional data (not used here: can be NULL)
*/ */
void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMasklayer, void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer,
bool aPrintMirrorMode, void* aData ) bool aPrintMirrorMode, void* aData )
{ {
// Save current draw options, because print mode has specfic options: // Save current draw options, because print mode has specfic options:
...@@ -56,9 +55,6 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrint ...@@ -56,9 +55,6 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrint
GetBoard()->Draw( DrawPanel, aDC, GR_COPY, wxPoint( 0, 0 ) ); GetBoard()->Draw( DrawPanel, aDC, GR_COPY, wxPoint( 0, 0 ) );
if( aPrint_Sheet_Ref )
TraceWorkSheet( aDC, GetScreen(), 0 );
DrawPanel->m_PrintIsMirrored = false; DrawPanel->m_PrintIsMirrored = false;
// Restore draw options: // Restore draw options:
......
...@@ -438,12 +438,11 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -438,12 +438,11 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
/** Virtual function PrintPage /** Virtual function PrintPage
* used to print a page * used to print a page
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMasklayer = a 32 bits mask: bit n = 1 -> layer n is printed * @param aPrintMasklayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, virtual void PrintPage( wxDC* aDC,
int aPrintMasklayer, bool aPrintMirrorMode, int aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL ); void* aData = NULL );
......
...@@ -162,12 +162,11 @@ public: ...@@ -162,12 +162,11 @@ public:
* used to print a page * used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed * @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used) * @param aData = a pointer on an auxiliary data (NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, virtual void PrintPage( wxDC* aDC,
int aPrintMaskLayer, bool aPrintMirrorMode, int aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL ); void * aData = NULL );
......
...@@ -507,12 +507,11 @@ public: ...@@ -507,12 +507,11 @@ public:
* used to print a page * used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here * @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, virtual void PrintPage( wxDC* aDC,
int aPrintMask, bool aPrintMirrorMode, int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL); void * aData = NULL);
......
...@@ -249,14 +249,21 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -249,14 +249,21 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetX( 0 );
panel->m_ClipBox.SetY( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); // Set clip box to the max size
panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
panel->m_ClipBox.SetWidth( MAX_VALUE );
panel->m_ClipBox.SetHeight( MAX_VALUE );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
int bg_color = g_DrawBgColor; int bg_color = g_DrawBgColor;
g_DrawBgColor = WHITE; g_DrawBgColor = WHITE;
m_Parent->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters);
if( aPrint_Frame_Ref )
m_Parent->TraceWorkSheet( &dc, ActiveScreen, s_Parameters.m_PenDefaultSize );
m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
SetLocaleTo_Default(); // revert to the current locale SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
......
...@@ -27,7 +27,8 @@ static double s_ScaleList[] = ...@@ -27,7 +27,8 @@ static double s_ScaleList[] =
// static print data and page setup data, to remember settings during the session // static print data and page setup data, to remember settings during the session
static PRINT_PARAMETERS s_Parameters; static PRINT_PARAMETERS s_Parameters;
static wxPrintData* g_PrintData; static wxPrintData* s_PrintData;
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
/* Dialog to print schematic. Class derived from DIALOG_PRINT_FOR_MODEDIT_BASE /* Dialog to print schematic. Class derived from DIALOG_PRINT_FOR_MODEDIT_BASE
...@@ -61,16 +62,16 @@ void WinEDA_ModuleEditFrame::ToPrinter( wxCommandEvent& event ) ...@@ -61,16 +62,16 @@ void WinEDA_ModuleEditFrame::ToPrinter( wxCommandEvent& event )
* Display the print dialog * Display the print dialog
*/ */
{ {
if( g_PrintData == NULL ) // First print if( s_PrintData == NULL ) // First print
{ {
g_PrintData = new wxPrintData(); s_PrintData = new wxPrintData();
if( !g_PrintData->Ok() ) if( !s_PrintData->Ok() )
{ {
DisplayError( this, _( "Error Init Printer info" ) ); DisplayError( this, _( "Error Init Printer info" ) );
} }
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT; s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT;
g_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER ); s_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER );
} }
DIALOG_PRINT_FOR_MODEDIT* frame = new DIALOG_PRINT_FOR_MODEDIT( this ); DIALOG_PRINT_FOR_MODEDIT* frame = new DIALOG_PRINT_FOR_MODEDIT( this );
...@@ -99,6 +100,17 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( ) ...@@ -99,6 +100,17 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
{ {
SetFocus(); SetFocus();
if( s_pageSetupData == NULL )
{
s_pageSetupData = new wxPageSetupDialogData;
// Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0
s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
}
s_Parameters.m_PageSetupData = s_pageSetupData;
// Read the scale adjust option // Read the scale adjust option
int scale_Select = 3; // default selected scale = ScaleList[3] = 1 int scale_Select = 3; // default selected scale = ScaleList[3] = 1
if( m_Config ) if( m_Config )
...@@ -136,13 +148,13 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event ) ...@@ -136,13 +148,13 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event )
/* Open a dialog box for printer setup (printer options, page size ...) /* Open a dialog box for printer setup (printer options, page size ...)
*/ */
{ {
wxPrintDialogData printDialogData( *g_PrintData ); wxPrintDialogData printDialogData( *s_PrintData );
if( printDialogData.Ok() ) if( printDialogData.Ok() )
{ {
wxPrintDialog printerDialog( this, &printDialogData ); wxPrintDialog printerDialog( this, &printDialogData );
printerDialog.ShowModal(); printerDialog.ShowModal();
*g_PrintData = printerDialog.GetPrintDialogData().GetPrintData(); *s_PrintData = printerDialog.GetPrintDialogData().GetPrintData();
} }
else else
DisplayError( this, _( "Printer Problem!" ) ); DisplayError( this, _( "Printer Problem!" ) );
...@@ -164,7 +176,7 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event ) ...@@ -164,7 +176,7 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
wxPrintPreview* preview = wxPrintPreview* preview =
new wxPrintPreview( new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ), new wxPrintPreview( new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ),
new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ), new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ),
g_PrintData ); s_PrintData );
if( preview == NULL ) if( preview == NULL )
{ {
...@@ -198,7 +210,7 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event ) ...@@ -198,7 +210,7 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
g_PcbPlotOptions.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust; g_PcbPlotOptions.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
g_PcbPlotOptions.m_PlotScale = s_Parameters.m_PrintScale; g_PcbPlotOptions.m_PlotScale = s_Parameters.m_PrintScale;
wxPrintDialogData printDialogData( *g_PrintData ); wxPrintDialogData printDialogData( *s_PrintData );
wxPrinter printer( &printDialogData ); wxPrinter printer( &printDialogData );
BOARD_PRINTOUT_CONTROLER printout( s_Parameters, m_Parent, _( "Print Footprint" ) ); BOARD_PRINTOUT_CONTROLER printout( s_Parameters, m_Parent, _( "Print Footprint" ) );
...@@ -216,6 +228,6 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event ) ...@@ -216,6 +228,6 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
} }
else else
{ {
*g_PrintData = printer.GetPrintDialogData().GetPrintData(); *s_PrintData = printer.GetPrintDialogData().GetPrintData();
} }
} }
...@@ -35,8 +35,8 @@ static double s_ScaleList[] = ...@@ -35,8 +35,8 @@ static double s_ScaleList[] =
#define MAX_SCALE 100.0 #define MAX_SCALE 100.0
// static print data and page setup data, to remember settings during the session // static print data and page setup data, to remember settings during the session
static wxPrintData* g_PrintData; static wxPrintData* s_PrintData;
static wxPageSetupDialogData* g_pageSetupData = (wxPageSetupDialogData*) NULL; static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
static PRINT_PARAMETERS s_Parameters; static PRINT_PARAMETERS s_Parameters;
...@@ -95,16 +95,16 @@ void WinEDA_PcbFrame::ToPrinter( wxCommandEvent& event ) ...@@ -95,16 +95,16 @@ void WinEDA_PcbFrame::ToPrinter( wxCommandEvent& event )
* Display the print dialog * Display the print dialog
*/ */
{ {
if( g_PrintData == NULL ) // First print if( s_PrintData == NULL ) // First print
{ {
g_PrintData = new wxPrintData(); s_PrintData = new wxPrintData();
if( !g_PrintData->Ok() ) if( !s_PrintData->Ok() )
{ {
DisplayError( this, _( "Error Init Printer info" ) ); DisplayError( this, _( "Error Init Printer info" ) );
} }
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT; s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT;
g_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER ); s_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER );
} }
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this ); DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
...@@ -140,16 +140,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -140,16 +140,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
int layer_max = NB_LAYERS; int layer_max = NB_LAYERS;
wxString msg; wxString msg;
BOARD* board = m_Parent->GetBoard(); BOARD* board = m_Parent->GetBoard();
if( g_pageSetupData == NULL ) if( s_pageSetupData == NULL )
{ {
g_pageSetupData = new wxPageSetupDialogData; s_pageSetupData = new wxPageSetupDialogData;
// Set initial page margins. // Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0 // Margins are already set in Pcbnew, so we cans use 0
g_pageSetupData->SetMarginTopLeft(wxPoint(0, 0)); s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
g_pageSetupData->SetMarginBottomRight(wxPoint(0, 0)); s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
} }
s_Parameters.m_PageSetupData = g_pageSetupData; s_Parameters.m_PageSetupData = s_pageSetupData;
// Create layer list. // Create layer list.
int layer; int layer;
...@@ -450,13 +450,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) ...@@ -450,13 +450,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
/* Open a dialog box for printer setup (printer options, page size ...) /* Open a dialog box for printer setup (printer options, page size ...)
*/ */
{ {
*g_pageSetupData = *g_PrintData; *s_pageSetupData = *s_PrintData;
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData); wxPageSetupDialog pageSetupDialog(this, s_pageSetupData);
pageSetupDialog.ShowModal(); pageSetupDialog.ShowModal();
(*g_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData(); (*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
(*g_pageSetupData) = pageSetupDialog.GetPageSetupDialogData(); (*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
} }
...@@ -474,7 +474,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -474,7 +474,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
wxPrintPreview* preview = wxPrintPreview* preview =
new wxPrintPreview( new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ), new wxPrintPreview( new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ),
new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ), new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ),
g_PrintData ); s_PrintData );
if( preview == NULL ) if( preview == NULL )
{ {
...@@ -522,7 +522,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) ...@@ -522,7 +522,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
return; return;
} }
wxPrintDialogData printDialogData( *g_PrintData ); wxPrintDialogData printDialogData( *s_PrintData );
wxPrinter printer( &printDialogData ); wxPrinter printer( &printDialogData );
...@@ -542,7 +542,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) ...@@ -542,7 +542,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
} }
else else
{ {
*g_PrintData = printer.GetPrintDialogData().GetPrintData(); *s_PrintData = printer.GetPrintDialogData().GetPrintData();
} }
} }
...@@ -73,12 +73,11 @@ public: ...@@ -73,12 +73,11 @@ public:
* used to print a page * used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMaskLayer = not used here * @param aPrintMaskLayer = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used) * @param aData = a pointer on an auxiliary data (NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, virtual void PrintPage( wxDC* aDC,
int aPrintMaskLayer, bool aPrintMirrorMode, int aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL); void * aData = NULL);
......
...@@ -25,13 +25,11 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -25,13 +25,11 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
* Used to print the board (on printer, or when creating SVF files). * Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer * Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context * @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed * @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used) * @param aData = a pointer to an optional data (NULL if not used)
*/ */
void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref,
int aPrintMaskLayer, int aPrintMaskLayer,
bool aPrintMirrorMode, bool aPrintMirrorMode,
void * aData) void * aData)
...@@ -96,9 +94,6 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, ...@@ -96,9 +94,6 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
} }
D_PAD::m_PadSketchModePenSize = tmp; D_PAD::m_PadSketchModePenSize = tmp;
if( aPrint_Sheet_Ref )
TraceWorkSheet( aDC, GetScreen(), defaultPenSize );
DrawPanel->m_PrintIsMirrored = false; DrawPanel->m_PrintIsMirrored = false;
DisplayOpt = save_opt; DisplayOpt = save_opt;
...@@ -115,13 +110,11 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, ...@@ -115,13 +110,11 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
* is used to print the board (on printer, or when creating SVF files). * is used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer * Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context * @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed * @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used) * @param aData = a pointer to an optional data (NULL if not used)
*/ */
void WinEDA_PcbFrame::PrintPage( wxDC* aDC, void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref,
int aPrintMaskLayer, int aPrintMaskLayer,
bool aPrintMirrorMode, bool aPrintMirrorMode,
void * aData) void * aData)
...@@ -310,9 +303,6 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC, ...@@ -310,9 +303,6 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
GRForceBlackPen( blackpenstate ); GRForceBlackPen( blackpenstate );
} }
if( aPrint_Sheet_Ref )
TraceWorkSheet( aDC, GetScreen(), defaultPenSize );
DrawPanel->m_PrintIsMirrored = false; DrawPanel->m_PrintIsMirrored = false;
DisplayOpt = save_opt; DisplayOpt = save_opt;
......
...@@ -228,7 +228,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -228,7 +228,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
WinEDA_DrawPanel* panel = m_Parent->DrawPanel; WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
EDA_Rect tmp = panel->m_ClipBox; EDA_Rect tmp = panel->m_ClipBox;
// SEt clip box to the max size // Set clip box to the max size
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow // and that allows calculations without overflow
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) ); panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
...@@ -243,12 +243,9 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -243,12 +243,9 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if( printMirror ) if( printMirror )
{ {
// To plot mirror, we reverse the y axis, and modify the plot y origin // To plot mirror, we reverse the y axis, and modify the plot y origin
double sx, sy;
dc->GetUserScale( &sx, &sy );
dc->SetAxisOrientation( true, true ); dc->SetAxisOrientation( true, true );
if( userscale < 1.0 ) if( userscale < 1.0 )
sy /= userscale; scaley /= userscale;
/* Plot offset y is moved by the y plot area size in order to have /* 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 * the old draw area in the new draw area, because the draw origin has not moved
...@@ -259,7 +256,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -259,7 +256,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
y_dc_offset = (int) y_dc_offset * userscale; y_dc_offset = (int) y_dc_offset * userscale;
dc->SetDeviceOrigin( 0, y_dc_offset ); dc->SetDeviceOrigin( 0, y_dc_offset );
#endif #endif
int ysize = (int) ( PlotAreaSizeInPixels.y / sy ); int ysize = (int) ( PlotAreaSizeInPixels.y / scaley );
DrawOffset.y += ysize; DrawOffset.y += ysize;
/* in order to keep the board position in the sheet /* in order to keep the board position in the sheet
...@@ -291,11 +288,11 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -291,11 +288,11 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if( !m_PrintParams.m_Print_Black_and_White ) if( !m_PrintParams.m_Print_Black_and_White )
{ // Creates a "local" black background { // Creates a "local" black background
GRForceBlackPen( true ); GRForceBlackPen( true );
m_Parent->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams ); m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
GRForceBlackPen( false ); GRForceBlackPen( false );
} }
m_Parent->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams ); m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
m_Parent->GetBaseScreen()->m_IsPrinting = false; m_Parent->GetBaseScreen()->m_IsPrinting = false;
......
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