kicad-source/pcbnew/dialogs/dialog_print_pcbnew.cpp

524 lines
16 KiB
C++
Raw Normal View History

2014-10-27 10:14:39 -04:00
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
2016-06-19 20:29:13 +02:00
* Copyright (C) 2010-2016 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch>
2014-10-27 10:14:39 -04:00
*
* 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
*/
2007-05-06 16:03:28 +00:00
#include <fctsys.h>
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-19 19:42:08 -05:00
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <confirm.h>
2018-01-29 21:58:58 +01:00
#include <pcb_edit_frame.h>
#include <footprint_edit_frame.h>
#include <base_units.h>
#include <pcbnew_printout.h>
#include <pcbnew.h>
#include <pcbplot.h>
#include <class_board.h>
#include <enabler.h>
#include <wx/valnum.h>
#include <widgets/unit_binder.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <dialog_print_pcbnew_base.h>
2008-04-18 13:28:56 +00:00
2013-05-04 13:57:09 +02:00
#define PEN_WIDTH_MAX_VALUE ( KiROUND( 5 * IU_PER_MM ) )
#define PEN_WIDTH_MIN_VALUE ( KiROUND( 0.005 * IU_PER_MM ) )
2007-05-06 16:03:28 +00:00
extern int g_DrawDefaultLineThickness;
// Define min and max reasonable values for print scale
#define MIN_SCALE 0.01
#define MAX_SCALE 100.0
2008-04-18 13:28:56 +00:00
2007-05-06 16:03:28 +00:00
// static print data and page setup data, to remember settings during the session
static wxPrintData* s_PrintData;
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
2007-05-06 16:03:28 +00:00
static PRINT_PARAMETERS s_Parameters;
2007-05-06 16:03:28 +00:00
2009-01-17 17:32:20 +00:00
/**
* Dialog to print schematic. Class derived from DIALOG_PRINT_PCBNEW_BASE
2009-01-17 17:32:20 +00:00
* created by wxFormBuilder
*/
class DIALOG_PRINT_PCBNEW : public DIALOG_PRINT_PCBNEW_BASE
2009-01-17 17:32:20 +00:00
{
public:
DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* parent );
~DIALOG_PRINT_PCBNEW() override;
/**
* Set 'print border and title block' to a requested value and hides the
* corresponding checkbox.
*/
void ForcePrintBorder( bool aValue )
{
m_Print_Sheet_Ref->SetValue( aValue );
m_Print_Sheet_Ref->Hide();
}
2009-01-17 17:32:20 +00:00
private:
PCB_BASE_EDIT_FRAME* m_parent;
wxConfigBase* m_config;
// the list of existing board layers in wxCheckListBox, with the board layers id:
std::pair<wxCheckListBox*, int> m_layers[PCB_LAYER_ID_COUNT];
static bool m_ExcludeEdgeLayer;
wxFloatingPointValidator<double> m_scaleValidator;
UNIT_BINDER m_defaultPenWidth;
bool TransferDataToWindow() override;
void OnSelectAllClick( wxCommandEvent& event ) override;
void OnDeselectAllClick( wxCommandEvent& event ) override;
void OnSetCustomScale( wxCommandEvent& event ) override;
2016-09-24 14:53:15 -04:00
void OnPageSetup( wxCommandEvent& event ) override;
void OnPrintPreview( wxCommandEvent& event ) override;
void OnPrintButtonClick( wxCommandEvent& event ) override;
///> (Un)checks all items in a checklist box
void setListBoxValue( wxCheckListBox* aList, bool aValue )
{
for( int i = 0; i < aList->GetCount(); ++i )
aList->Check( i, aValue );
}
2018-04-23 10:54:43 +02:00
void SetPrintParameters();
int SetLayerSetFromListSelection();
PCBNEW_PRINTOUT* createPrintout( const wxString& aTitle )
{
return new PCBNEW_PRINTOUT( m_parent->GetBoard(), s_Parameters,
m_parent->GetGalCanvas()->GetView(), m_parent->GetPageSettings().GetSizeIU(), aTitle );
}
2008-03-04 04:22:27 +00:00
/**
* Select a corresponing scale radio button and update custom scale value if needed.
* @param aValue is the scale value to be selected (0 stands for fit-to-page).
*/
void setScaleValue( double aValue ) const
{
wxASSERT( aValue >= 0.0 );
2008-04-18 13:28:56 +00:00
if( aValue == 0.0 )
{
m_scaleFit->SetValue( true );
}
else if( aValue == 1.0 )
{
m_scale1->SetValue( true );
}
else
{
if( aValue > MAX_SCALE )
{
DisplayInfoMessage( NULL,
_( "Warning: Scale option set to a very large value" ) );
}
2007-05-06 16:03:28 +00:00
if( aValue < MIN_SCALE )
{
DisplayInfoMessage( NULL,
_( "Warning: Scale option set to a very small value" ) );
}
m_scaleCustom->SetValue( true );
m_scaleCustomText->SetValue( wxString::Format( wxT( "%f" ), aValue ) );
}
}
2012-03-26 16:45:05 -05:00
/**
* Return scale value selected in the dialog.
*/
double getScaleValue() const
2008-03-04 04:22:27 +00:00
{
if( m_scale1->GetValue() )
return 1.0;
2008-03-04 04:22:27 +00:00
if( m_scaleFit->GetValue() )
return 0.0;
if( m_scaleCustom->GetValue() )
{
double scale;
2012-03-26 16:45:05 -05:00
wxCHECK( m_scaleCustomText->GetValue().ToDouble( &scale ), 1.0 );
return scale;
}
2012-03-26 16:45:05 -05:00
wxCHECK( false, 1.0 );
2008-03-04 04:22:27 +00:00
}
};
2007-05-06 16:03:28 +00:00
bool DIALOG_PRINT_PCBNEW::m_ExcludeEdgeLayer;
2007-05-06 16:03:28 +00:00
DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* parent ) :
DIALOG_PRINT_PCBNEW_BASE( parent ),
m_parent( parent ),
m_defaultPenWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true,
PEN_WIDTH_MIN_VALUE, PEN_WIDTH_MAX_VALUE )
{
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-19 19:42:08 -05:00
m_config = Kiface().KifaceSettings();
memset( m_layers, 0, sizeof( m_layers ) );
m_scaleValidator.SetRange( 1e-3, 1e3 );
m_scaleCustomText->SetValidator( m_scaleValidator );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Print" ) );
m_sdbSizer1Apply->SetLabel( _( "Print Preview" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1->Layout();
m_sdbSizer1OK->SetDefault();
#if defined(__WXMAC__) or defined(__WXGTK__)
// Preview does not work well on GTK or Mac,
// but these platforms provide native print preview
m_sdbSizer1Apply->Hide();
#endif
FinishDialogSettings();
2009-01-17 17:32:20 +00:00
}
2007-05-06 16:03:28 +00:00
2009-01-17 17:32:20 +00:00
DIALOG_PRINT_PCBNEW::~DIALOG_PRINT_PCBNEW()
{
SetPrintParameters();
if( m_config )
{
m_config->Write( OPTKEY_PRINT_SCALE, getScaleValue() );
m_config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref);
m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
m_config->Write( OPTKEY_PRINT_PAGE_PER_LAYER, s_Parameters.m_OptionPrintPage );
m_config->Write( OPTKEY_PRINT_PADS_DRILL, (long) s_Parameters.m_DrillShapeOpt );
for( unsigned layer = 0; layer < DIM(m_layers); ++layer )
{
if( m_layers[layer].first )
{
wxString key = wxString::Format( OPTKEY_LAYERBASE, layer );
bool value = m_layers[layer].first->IsChecked( m_layers[layer].second );
m_config->Write( key, value );
}
}
}
}
bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
2009-01-17 17:32:20 +00:00
{
wxString msg;
BOARD* board = m_parent->GetBoard();
s_Parameters.m_PageSetupData = s_pageSetupData;
// Create layer list.
for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
{
PCB_LAYER_ID layer = *seq;
2016-06-19 20:29:13 +02:00
int checkIndex;
if( IsCopperLayer( layer ) )
{
2016-06-19 20:29:13 +02:00
checkIndex = m_CopperLayersList->Append( board->GetLayerName( layer ) );
m_layers[layer] = std::make_pair( m_CopperLayersList, checkIndex );
}
else
{
2016-06-19 20:29:13 +02:00
checkIndex = m_TechnicalLayersList->Append( board->GetLayerName( layer ) );
m_layers[layer] = std::make_pair( m_TechnicalLayersList, checkIndex );
}
2016-06-19 20:29:13 +02:00
if( m_config )
{
2016-06-19 20:29:13 +02:00
wxString layerKey;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
bool option;
if( m_config->Read( layerKey, &option ) )
m_layers[layer].first->Check( checkIndex, option );
}
2008-03-04 04:22:27 +00:00
}
// Option for excluding contents of "Edges Pcb" layer
m_Exclude_Edges_Pcb->Show( true );
2008-03-04 04:22:27 +00:00
// Read the scale adjust option
double scale = 1.0;
if( m_config )
2008-03-04 04:22:27 +00:00
{
m_config->Read( OPTKEY_PRINT_SCALE, &scale );
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_PER_LAYER, &s_Parameters.m_OptionPrintPage, 0);
int tmp;
m_config->Read( OPTKEY_PRINT_PADS_DRILL, &tmp, PRINT_PARAMETERS::SMALL_DRILL_SHAPE );
s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) tmp;
2008-03-04 04:22:27 +00:00
}
setScaleValue( scale );
s_Parameters.m_PrintScale = getScaleValue();
m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror);
m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer);
m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref );
2008-03-04 04:22:27 +00:00
// Options to plot pads and vias holes
m_drillMarksChoice->SetSelection( s_Parameters.m_DrillShapeOpt );
m_outputMode->SetSelection( s_Parameters.m_Print_Black_and_White ? 1 : 0 );
2009-01-17 17:32:20 +00:00
m_PagesOption->SetSelection( s_Parameters.m_OptionPrintPage );
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
m_defaultPenWidth.SetValue( s_Parameters.m_PenDefaultSize );
2009-01-17 17:32:20 +00:00
// Update the layout when layers are added
GetSizer()->Fit( this );
return true;
2007-05-06 16:03:28 +00:00
}
2008-03-04 04:22:27 +00:00
int DIALOG_PRINT_PCBNEW::SetLayerSetFromListSelection()
2007-05-06 16:03:28 +00:00
{
int page_count = 0;
s_Parameters.m_PrintMaskLayer = LSET();
for( unsigned layer = 0; layer < DIM(m_layers); ++layer )
2008-03-04 04:22:27 +00:00
{
if( m_layers[layer].first && m_layers[layer].first->IsChecked( m_layers[layer].second ) )
2008-03-04 04:22:27 +00:00
{
page_count++;
s_Parameters.m_PrintMaskLayer.set( layer );
2008-03-04 04:22:27 +00:00
}
}
// In Pcbnew force the EDGE layer to be printed or not with the other layers
m_ExcludeEdgeLayer = m_Exclude_Edges_Pcb->IsChecked();
s_Parameters.m_Flags = m_ExcludeEdgeLayer ? 0 : 1;
if( m_PagesOption->GetSelection() != 0 )
page_count = 1;
s_Parameters.m_PageCount = page_count;
2008-03-04 04:22:27 +00:00
return page_count;
2007-05-06 16:03:28 +00:00
}
2008-03-04 04:22:27 +00:00
void DIALOG_PRINT_PCBNEW::SetPrintParameters()
2007-05-06 16:03:28 +00:00
{
PCB_PLOT_PARAMS plot_opts = m_parent->GetPlotSettings();
s_Parameters.m_PrintMirror = m_Print_Mirror->GetValue();
s_Parameters.m_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue();
s_Parameters.m_Print_Black_and_White = m_outputMode->GetSelection() != 0;
s_Parameters.m_DrillShapeOpt =
(PRINT_PARAMETERS::DrillShapeOptT) m_drillMarksChoice->GetSelection();
s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0;
SetLayerSetFromListSelection();
s_Parameters.m_PrintScale = getScaleValue();
plot_opts.SetScale( s_Parameters.m_PrintScale );
m_parent->SetPlotSettings( plot_opts );
s_Parameters.m_PenDefaultSize = m_defaultPenWidth.GetValue();
g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
2007-05-06 16:03:28 +00:00
}
void DIALOG_PRINT_PCBNEW::OnSelectAllClick( wxCommandEvent& event )
{
setListBoxValue( m_CopperLayersList, true );
setListBoxValue( m_TechnicalLayersList, true );
}
2012-03-26 16:45:05 -05:00
void DIALOG_PRINT_PCBNEW::OnDeselectAllClick( wxCommandEvent& event )
{
setListBoxValue( m_CopperLayersList, false );
setListBoxValue( m_TechnicalLayersList, false );
}
2007-05-06 16:03:28 +00:00
void DIALOG_PRINT_PCBNEW::OnSetCustomScale( wxCommandEvent& event )
{
// Select 'custom scale' radio button when user types in a value in the
// custom scale text box
m_scaleCustom->SetValue( true );
}
void DIALOG_PRINT_PCBNEW::OnPageSetup( wxCommandEvent& event )
2007-05-06 16:03:28 +00:00
{
wxPageSetupDialog pageSetupDialog( this, s_pageSetupData );
pageSetupDialog.ShowModal();
2008-03-04 04:22:27 +00:00
(*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
(*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
2007-05-06 16:03:28 +00:00
}
void DIALOG_PRINT_PCBNEW::OnPrintPreview( wxCommandEvent& event )
2007-05-06 16:03:28 +00:00
{
SetPrintParameters();
2008-03-04 04:22:27 +00:00
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew:
if( s_Parameters.m_PrintMaskLayer == 0 )
{
DisplayError( this, _( "No layer selected" ) );
return;
}
2008-03-04 04:22:27 +00:00
// Pass two printout objects: for preview, and possible printing.
wxString title = _( "Print Preview" );
2008-03-04 04:22:27 +00:00
wxPrintPreview* preview =
new wxPrintPreview( createPrintout( title ), createPrintout( title ), s_PrintData );
2008-03-04 04:22:27 +00:00
preview->SetZoom( 100 );
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, m_parent->GetPosition(),
m_parent->GetSize() );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Center();
2008-03-04 04:22:27 +00:00
// On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
// close the frame using the X box in caption, when the preview frame is run
// from a dialog
frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
// We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
// modal for its caller only.
// An other reason is the fact when closing the frame without this option,
// all top level frames are reenabled.
// With this option, only the parent is reenabled.
// Reenabling all top level frames should be made by the parent dialog.
frame->InitializeWithModality( wxPreviewFrame_WindowModal );
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );
2007-05-06 16:03:28 +00:00
}
void DIALOG_PRINT_PCBNEW::OnPrintButtonClick( wxCommandEvent& event )
2007-05-06 16:03:28 +00:00
{
2018-04-23 10:54:43 +02:00
SetPrintParameters();
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew:
if( s_Parameters.m_PrintMaskLayer == 0 )
{
DisplayError( this, _( "No layer selected" ) );
return;
}
wxPrintDialogData printDialogData( *s_PrintData );
printDialogData.SetMaxPage( s_Parameters.m_PageCount );
2007-05-06 16:03:28 +00:00
2018-04-23 10:54:43 +02:00
wxPrinter printer( &printDialogData );
auto printout = std::unique_ptr<PCBNEW_PRINTOUT>( createPrintout( _( "Print" ) ) );
2007-05-06 16:03:28 +00:00
// Disable 'Print' button to prevent issuing another print
// command before the previous one is finished (causes problems on Windows)
ENABLER printBtnDisable( *m_sdbSizer1OK, false );
2007-05-06 16:03:28 +00:00
if( !printer.Print( this, printout.get(), true ) )
2008-03-04 04:22:27 +00:00
{
if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
DisplayError( this, _( "There was a problem printing." ) );
2008-03-04 04:22:27 +00:00
}
else
{
*s_PrintData = printer.GetPrintDialogData().GetPrintData();
2008-03-04 04:22:27 +00:00
}
2007-05-06 16:03:28 +00:00
}
void PCB_BASE_EDIT_FRAME::preparePrintout()
{
// Selection affects the original item visibility
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
const PAGE_INFO& pageInfo = GetPageSettings();
if( s_PrintData == NULL ) // First print
{
s_PrintData = new wxPrintData();
if( !s_PrintData->Ok() )
DisplayError( this, _( "An error occurred initializing the printer information." ) );
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
}
if( s_pageSetupData == NULL )
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
if( pageInfo.IsCustom() )
{
if( pageInfo.IsPortrait() )
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
Mils2mm( pageInfo.GetHeightMils() ) ) );
else
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
Mils2mm( pageInfo.GetWidthMils() ) ) );
}
*s_PrintData = s_pageSetupData->GetPrintData();
}
void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
preparePrintout();
DIALOG_PRINT_PCBNEW dlg( this );
dlg.ShowModal();
}
void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
preparePrintout();
DIALOG_PRINT_PCBNEW dlg( this );
dlg.ForcePrintBorder( false );
dlg.ShowModal();
}