Removed a redundant parameter from BOARD_PRINTOUT constructor
This commit is contained in:
parent
ff0909c90c
commit
d3ea63e133
|
@ -66,12 +66,11 @@ void BOARD_PRINTOUT_SETTINGS::Save( wxConfigBase* aConfig )
|
|||
}
|
||||
|
||||
|
||||
BOARD_PRINTOUT::BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
|
||||
const wxSize& aSheetSize, const wxString& aTitle ) :
|
||||
BOARD_PRINTOUT::BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams,
|
||||
const KIGFX::VIEW* aView, const wxString& aTitle ) :
|
||||
wxPrintout( aTitle ), m_settings( aParams )
|
||||
{
|
||||
m_view = aView;
|
||||
m_sheetSize = aSheetSize;
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,10 +125,12 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
|
|||
setupPainter( painter );
|
||||
|
||||
BOX2I bBox; // determine printout bounding box
|
||||
auto sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
|
||||
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ), milsToIU( sheetSizeMils.GetHeight() ) );
|
||||
|
||||
if( m_settings.PrintBorderAndTitleBlock() )
|
||||
{
|
||||
bBox = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( m_sheetSize ) );
|
||||
bBox = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sheetSizeIU ) );
|
||||
view->SetLayerVisible( LAYER_WORKSHEET, true );
|
||||
}
|
||||
else
|
||||
|
@ -150,8 +151,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
|
|||
}
|
||||
else
|
||||
{
|
||||
double scaleX = (double) m_sheetSize.GetWidth() / bBox.GetWidth();
|
||||
double scaleY = (double) m_sheetSize.GetHeight() / bBox.GetHeight();
|
||||
double scaleX = (double) sheetSizeIU.x / bBox.GetWidth();
|
||||
double scaleY = (double) sheetSizeIU.y / bBox.GetHeight();
|
||||
m_settings.m_scale = std::min( scaleX, scaleY );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ private:
|
|||
wxPrintout* createPrintout( const wxString& aTitle ) override
|
||||
{
|
||||
return new GERBVIEW_PRINTOUT( m_parent->GetGerberLayout(), *settings(),
|
||||
m_parent->GetGalCanvas()->GetView(), m_parent->GetPageSettings().GetSizeIU(), aTitle );
|
||||
m_parent->GetGalCanvas()->GetView(), aTitle );
|
||||
}
|
||||
|
||||
GERBVIEW_FRAME* m_parent;
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
|
||||
|
||||
GERBVIEW_PRINTOUT::GERBVIEW_PRINTOUT( GBR_LAYOUT* aLayout, const BOARD_PRINTOUT_SETTINGS& aParams,
|
||||
const KIGFX::VIEW* aView, const wxSize& aSheetSize, const wxString& aTitle ) :
|
||||
BOARD_PRINTOUT( aParams, aView, aSheetSize, aTitle )
|
||||
const KIGFX::VIEW* aView, const wxString& aTitle ) :
|
||||
BOARD_PRINTOUT( aParams, aView, aTitle )
|
||||
{
|
||||
m_layout = aLayout;
|
||||
}
|
||||
|
@ -88,6 +88,12 @@ bool GERBVIEW_PRINTOUT::OnPrintPage( int aPage )
|
|||
}
|
||||
|
||||
|
||||
int GERBVIEW_PRINTOUT::milsToIU( double aMils ) const
|
||||
{
|
||||
return KiROUND( IU_PER_MILS * aMils );
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView,
|
||||
const LSET& aLayerSet )
|
||||
{
|
||||
|
|
|
@ -28,11 +28,13 @@ class GERBVIEW_PRINTOUT : public BOARD_PRINTOUT
|
|||
{
|
||||
public:
|
||||
GERBVIEW_PRINTOUT( GBR_LAYOUT* aLayout, const BOARD_PRINTOUT_SETTINGS& aParams,
|
||||
const KIGFX::VIEW* aView, const wxSize& aSheetSize, const wxString& aTitle );
|
||||
const KIGFX::VIEW* aView, const wxString& aTitle );
|
||||
|
||||
bool OnPrintPage( int aPage ) override;
|
||||
|
||||
protected:
|
||||
int milsToIU( double aMils ) const override;
|
||||
|
||||
void setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView, const LSET& aLayerSet ) override;
|
||||
|
||||
void setupGal( KIGFX::GAL* aGal ) override;
|
||||
|
|
|
@ -65,7 +65,7 @@ class BOARD_PRINTOUT : public wxPrintout
|
|||
{
|
||||
public:
|
||||
BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
|
||||
const wxSize& aSheetSize, const wxString& aTitle );
|
||||
const wxString& aTitle );
|
||||
|
||||
virtual ~BOARD_PRINTOUT() {}
|
||||
|
||||
|
@ -88,6 +88,9 @@ public:
|
|||
int aPageNum = 1, int aPageCount = 1 );
|
||||
|
||||
protected:
|
||||
///> Convert mils to internal units
|
||||
virtual int milsToIU( double aMils ) const = 0;
|
||||
|
||||
///> Enables layers visibility for a printout
|
||||
virtual void setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView, const LSET& aLayerSet );
|
||||
|
||||
|
@ -108,9 +111,6 @@ protected:
|
|||
|
||||
///> Printout parameters
|
||||
BOARD_PRINTOUT_SETTINGS m_settings;
|
||||
|
||||
///> Sheet size expressed in internal units
|
||||
wxSize m_sheetSize;
|
||||
};
|
||||
|
||||
#endif // BOARD_PRINTOUT_H
|
||||
|
|
|
@ -81,7 +81,7 @@ private:
|
|||
wxPrintout* createPrintout( const wxString& aTitle ) override
|
||||
{
|
||||
return new PCBNEW_PRINTOUT( m_parent->GetBoard(), *settings(),
|
||||
m_parent->GetGalCanvas()->GetView(), m_parent->GetPageSettings().GetSizeIU(), aTitle );
|
||||
m_parent->GetGalCanvas()->GetView(), aTitle );
|
||||
}
|
||||
|
||||
PCB_BASE_EDIT_FRAME* m_parent;
|
||||
|
|
|
@ -58,8 +58,8 @@ void PCBNEW_PRINTOUT_SETTINGS::Save( wxConfigBase* aConfig )
|
|||
|
||||
|
||||
PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
|
||||
const KIGFX::VIEW* aView, const wxSize& aSheetSize, const wxString& aTitle ) :
|
||||
BOARD_PRINTOUT( aParams, aView, aSheetSize, aTitle ), m_pcbnewSettings( aParams )
|
||||
const KIGFX::VIEW* aView, const wxString& aTitle ) :
|
||||
BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
|
||||
{
|
||||
m_board = aBoard;
|
||||
}
|
||||
|
@ -109,6 +109,12 @@ bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
|
|||
}
|
||||
|
||||
|
||||
int PCBNEW_PRINTOUT::milsToIU( double aMils ) const
|
||||
{
|
||||
return KiROUND( IU_PER_MILS * aMils );
|
||||
}
|
||||
|
||||
|
||||
void PCBNEW_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView,
|
||||
const LSET& aLayerSet )
|
||||
{
|
||||
|
|
|
@ -51,11 +51,13 @@ class PCBNEW_PRINTOUT : public BOARD_PRINTOUT
|
|||
{
|
||||
public:
|
||||
PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
|
||||
const KIGFX::VIEW* aView, const wxSize& aSheetSize, const wxString& aTitle );
|
||||
const KIGFX::VIEW* aView, const wxString& aTitle );
|
||||
|
||||
bool OnPrintPage( int aPage ) override;
|
||||
|
||||
protected:
|
||||
int milsToIU( double aMils ) const override;
|
||||
|
||||
void setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView, const LSET& aLayerSet ) override;
|
||||
|
||||
void setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPainter ) override;
|
||||
|
|
Loading…
Reference in New Issue