KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PAGE_INFO Class Reference

Describe the page size and margins of a paper page on which to eventually print or plot. More...

#include <page_info.h>

Public Member Functions

 PAGE_INFO (const wxString &aType=PAGE_INFO::A3, bool IsPortrait=false)
 
bool SetType (const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
 Set the name of the page type and also the sizes and margins commonly associated with that type name.
 
const wxString & GetType () const
 
bool IsDefault () const
 
bool IsCustom () const
 
void SetPortrait (bool aIsPortrait)
 Rotate the paper page 90 degrees.
 
bool IsPortrait () const
 
wxPrintOrientation GetWxOrientation () const
 
wxPaperSize GetPaperId () const
 
void SetWidthMM (double aWidthInMM)
 
void SetWidthMils (double aWidthInMils)
 
double GetWidthMils () const
 
double GetWidthMM () const
 
void SetHeightMM (double aHeightInMM)
 
void SetHeightMils (double aHeightInMils)
 
double GetHeightMils () const
 
double GetHeightMM () const
 
const VECTOR2DGetSizeMils () const
 
int GetWidthIU (double aIUScale) const
 Gets the page width in IU.
 
int GetHeightIU (double aIUScale) const
 Gets the page height in IU.
 
const VECTOR2D GetSizeIU (double aIUScale) const
 Gets the page size in internal units.
 
void Format (OUTPUTFORMATTER *aFormatter) const
 Output the page class to aFormatter in s-expression form.
 

Static Public Member Functions

static void SetCustomWidthMils (double aWidthInMils)
 Set the width of Custom page in mils for any custom page constructed or made via SetType() after making this call.
 
static void SetCustomHeightMils (double aHeightInMils)
 Set the height of Custom page in mils for any custom page constructed or made via SetType() after making this call.
 
static double GetCustomWidthMils ()
 
static double GetCustomHeightMils ()
 

Static Public Attributes

static const wxChar A5 [] = wxT( "A5" )
 
static const wxChar A4 [] = wxT( "A4" )
 
static const wxChar A3 [] = wxT( "A3" )
 
static const wxChar A2 [] = wxT( "A2" )
 
static const wxChar A1 [] = wxT( "A1" )
 
static const wxChar A0 [] = wxT( "A0" )
 
static const wxChar A [] = wxT( "A" )
 
static const wxChar B [] = wxT( "B" )
 
static const wxChar C [] = wxT( "C" )
 
static const wxChar D [] = wxT( "D" )
 
static const wxChar E [] = wxT( "E" )
 
static const wxChar GERBER [] = wxT( "GERBER" )
 
static const wxChar USLetter [] = wxT( "USLetter" )
 
static const wxChar USLegal [] = wxT( "USLegal" )
 
static const wxChar USLedger [] = wxT( "USLedger" )
 
static const wxChar Custom [] = wxT( "User" )
 "User" defined page type
 

Protected Member Functions

 PAGE_INFO (const VECTOR2D &aSizeMils, const wxString &aName, wxPaperSize aPaperId)
 

Private Member Functions

void updatePortrait ()
 
void setMargins ()
 

Private Attributes

wxString m_type
 paper type: A4, A3, etc.
 
VECTOR2D m_size
 mils
 
bool m_portrait
 true if portrait, false if landscape
 
wxPaperSize m_paper_id
 wx' style paper id.
 

Static Private Attributes

static const PAGE_INFO pageA5
 
static const PAGE_INFO pageA4
 
static const PAGE_INFO pageA3
 
static const PAGE_INFO pageA2
 
static const PAGE_INFO pageA1
 
static const PAGE_INFO pageA0
 
static const PAGE_INFO pageA
 
static const PAGE_INFO pageB
 
static const PAGE_INFO pageC
 
static const PAGE_INFO pageD
 
static const PAGE_INFO pageE
 
static const PAGE_INFO pageGERBER
 
static const PAGE_INFO pageUSLetter
 
static const PAGE_INFO pageUSLegal
 
static const PAGE_INFO pageUSLedger
 
static const PAGE_INFO pageUser
 
static double s_user_height = 11000
 
static double s_user_width = 17000
 

Detailed Description

Describe the page size and margins of a paper page on which to eventually print or plot.

Paper sizes are often described in inches. Here paper is described in 1/1000th of an inch (mils). For convenience there are some read only accessors for internal units which is a compile time calculation, not runtime.

Author
Dick Hollenbeck

Definition at line 58 of file page_info.h.

Constructor & Destructor Documentation

◆ PAGE_INFO() [1/2]

PAGE_INFO::PAGE_INFO ( const wxString &  aType = PAGE_INFO::A3,
bool  IsPortrait = false 
)

Definition at line 114 of file page_info.cpp.

References SetType().

◆ PAGE_INFO() [2/2]

PAGE_INFO::PAGE_INFO ( const VECTOR2D aSizeMils,
const wxString &  aName,
wxPaperSize  aPaperId 
)
protected

Definition at line 103 of file page_info.cpp.

References updatePortrait().

Member Function Documentation

◆ Format()

void PAGE_INFO::Format ( OUTPUTFORMATTER aFormatter) const

Output the page class to aFormatter in s-expression form.

Parameters
aFormatterThe OUTPUTFORMATTER object to write to.
Exceptions
IO_ERRORon write error.

Definition at line 273 of file page_info.cpp.

References Custom, GetHeightMils(), GetType(), GetWidthMils(), IsCustom(), IsPortrait(), OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

Referenced by SCH_IO_KICAD_SEXPR::Format(), and PCB_IO_KICAD_SEXPR::formatGeneral().

◆ GetCustomHeightMils()

static double PAGE_INFO::GetCustomHeightMils ( )
inlinestatic
Returns
custom paper height in mils.

Definition at line 196 of file page_info.h.

Referenced by BOARD::operator==(), PL_EDITOR_FRAME::SaveSettings(), and DIALOG_PAGES_SETTINGS::TransferDataToWindow().

◆ GetCustomWidthMils()

static double PAGE_INFO::GetCustomWidthMils ( )
inlinestatic
Returns
custom paper width in mils.

Definition at line 191 of file page_info.h.

Referenced by BOARD::operator==(), PL_EDITOR_FRAME::SaveSettings(), and DIALOG_PAGES_SETTINGS::TransferDataToWindow().

◆ GetHeightIU()

int PAGE_INFO::GetHeightIU ( double  aIUScale) const
inline

Gets the page height in IU.

Parameters
aIUScaleThe IU scale, this is most likely always going to be IU_PER_MILS variable being passed. Note, this constexpr variable changes depending on application, hence why it is passed.

Definition at line 162 of file page_info.h.

Referenced by SCH_PLOTTER::createHPGLFiles(), EESCHEMA_JOBS_HANDLER::doSymExportSvg(), SCH_EDIT_FRAME::GetDocumentExtents(), ALTIUM_PCB::Parse(), SCH_IO_ALTIUM::ParseSheet(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), KIGFX::SCH_VIEW::ResizeSheetWorkingArea(), and PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview().

◆ GetHeightMils()

◆ GetHeightMM()

double PAGE_INFO::GetHeightMM ( ) const
inline

Definition at line 142 of file page_info.h.

◆ GetPaperId()

wxPaperSize PAGE_INFO::GetPaperId ( ) const
inline
Returns
wxPrintData's style paper id associated with page type name.

Definition at line 132 of file page_info.h.

Referenced by DIALOG_PRINT_GENERIC::initPrintData(), BOARD::operator==(), PL_EDITOR_FRAME::ToPrinter(), and DIALOG_PRINT_USING_PRINTER::TransferDataToWindow().

◆ GetSizeIU()

◆ GetSizeMils()

◆ GetType()

◆ GetWidthIU()

int PAGE_INFO::GetWidthIU ( double  aIUScale) const
inline

Gets the page width in IU.

Parameters
aIUScaleThe IU scale, this is most likely always going to be IU_PER_MILS variable being passed. Note, this constexpr variable changes depending on application, hence why it is passed.

Definition at line 153 of file page_info.h.

Referenced by SCH_PLOTTER::createHPGLFiles(), EESCHEMA_JOBS_HANDLER::doSymExportSvg(), SCH_EDIT_FRAME::GetDocumentExtents(), ALTIUM_PCB::Parse(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), KIGFX::SCH_VIEW::ResizeSheetWorkingArea(), and PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview().

◆ GetWidthMils()

◆ GetWidthMM()

double PAGE_INFO::GetWidthMM ( ) const
inline

Definition at line 137 of file page_info.h.

◆ GetWxOrientation()

wxPrintOrientation PAGE_INFO::GetWxOrientation ( ) const
inline

◆ IsCustom()

bool PAGE_INFO::IsCustom ( ) const

◆ IsDefault()

bool PAGE_INFO::IsDefault ( ) const
inline
Returns
True if the object has the default page settings which are A3, landscape.

Definition at line 104 of file page_info.h.

References A3.

◆ IsPortrait()

◆ SetCustomHeightMils()

void PAGE_INFO::SetCustomHeightMils ( double  aHeightInMils)
static

Set the height of Custom page in mils for any custom page constructed or made via SetType() after making this call.

Definition at line 239 of file page_info.cpp.

References clampHeight(), and s_user_height.

Referenced by PL_EDITOR_FRAME::LoadSettings(), SCH_IO_ALTIUM::ParseSheet(), and DIALOG_PAGES_SETTINGS::SavePageSettings().

◆ SetCustomWidthMils()

void PAGE_INFO::SetCustomWidthMils ( double  aWidthInMils)
static

Set the width of Custom page in mils for any custom page constructed or made via SetType() after making this call.

Definition at line 233 of file page_info.cpp.

References clampWidth(), and s_user_width.

Referenced by PL_EDITOR_FRAME::LoadSettings(), SCH_IO_ALTIUM::ParseSheet(), and DIALOG_PAGES_SETTINGS::SavePageSettings().

◆ SetHeightMils()

◆ SetHeightMM()

void PAGE_INFO::SetHeightMM ( double  aHeightInMM)
inline

◆ setMargins()

void PAGE_INFO::setMargins ( )
private

◆ SetPortrait()

void PAGE_INFO::SetPortrait ( bool  aIsPortrait)

Rotate the paper page 90 degrees.

This PAGE_INFO may either be in portrait or landscape mode. Use this function to change from one mode to the other mode.

Parameters
aIsPortraitif true and not already in portrait mode, will change this PAGE_INFO to portrait mode. Or if false and not already in landscape mode, will change this PAGE_INFO to landscape mode.

Definition at line 187 of file page_info.cpp.

References m_portrait, m_size, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_PLOTTER::createPSFiles(), SCH_IO_KICAD_LEGACY::loadPageSettings(), PCB_IO_KICAD_LEGACY::loadSHEET(), PCB_IO_KICAD_SEXPR_PARSER::parsePAGE_INFO(), SCH_IO_KICAD_SEXPR_PARSER::parsePAGE_INFO(), SCH_PLOTTER::plotOneSheetSVG(), DIALOG_PAGES_SETTINGS::SavePageSettings(), and SCH_PLOTTER::setupPlotPagePDF().

◆ SetType()

bool PAGE_INFO::SetType ( const wxString &  aStandardPageDescriptionName,
bool  aIsPortrait = false 
)

Set the name of the page type and also the sizes and margins commonly associated with that type name.

Parameters
aStandardPageDescriptionNameis a wxString constant giving one of: "A5" "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", "USLetter", "USLegal", "USLedger", or "User". If "User" then the width and height are custom, and will be set according to previous calls to static PAGE_INFO::SetUserWidthMils() and static PAGE_INFO::SetUserHeightMils();
aIsPortraitSet to true to set page orientation to portrait mode.
Returns
true if aStandarePageDescription was a recognized type.

Definition at line 120 of file page_info.cpp.

References GetType(), m_size, pageA, pageA0, pageA1, pageA2, pageA3, pageA4, pageA5, pageB, pageC, pageD, pageE, pageGERBER, pageUser, pageUSLedger, pageUSLegal, pageUSLetter, s_user_height, s_user_width, updatePortrait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_PLOTTER::createHPGLFiles(), SCH_PLOTTER::createPSFiles(), DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog(), SCH_IO_KICAD_LEGACY::loadPageSettings(), GERBVIEW_FRAME::LoadSettings(), PL_EDITOR_FRAME::LoadSettings(), PCB_IO_KICAD_LEGACY::loadSHEET(), PAGE_INFO(), PCB_IO_KICAD_SEXPR_PARSER::parsePAGE_INFO(), SCH_IO_KICAD_SEXPR_PARSER::parsePAGE_INFO(), SCH_IO_ALTIUM::ParseSheet(), SCH_PLOTTER::plotOneSheetSVG(), DIALOG_PAGES_SETTINGS::SavePageSettings(), SCH_PLOTTER::setupPlotPagePDF(), and DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().

◆ SetWidthMils()

◆ SetWidthMM()

void PAGE_INFO::SetWidthMM ( double  aWidthInMM)
inline

◆ updatePortrait()

void PAGE_INFO::updatePortrait ( )
inlineprivate

Definition at line 96 of file page_info.cpp.

References m_portrait, m_size, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PAGE_INFO(), SetHeightMils(), SetType(), and SetWidthMils().

Member Data Documentation

◆ A

const wxChar PAGE_INFO::A = wxT( "A" )
static

◆ A0

const wxChar PAGE_INFO::A0 = wxT( "A0" )
static

◆ A1

const wxChar PAGE_INFO::A1 = wxT( "A1" )
static

◆ A2

const wxChar PAGE_INFO::A2 = wxT( "A2" )
static

◆ A3

const wxChar PAGE_INFO::A3 = wxT( "A3" )
static

◆ A4

◆ A5

const wxChar PAGE_INFO::A5 = wxT( "A5" )
static

◆ B

const wxChar PAGE_INFO::B = wxT( "B" )
static

◆ C

const wxChar PAGE_INFO::C = wxT( "C" )
static

◆ Custom

◆ D

const wxChar PAGE_INFO::D = wxT( "D" )
static

◆ E

const wxChar PAGE_INFO::E = wxT( "E" )
static

◆ GERBER

const wxChar PAGE_INFO::GERBER = wxT( "GERBER" )
static

Definition at line 78 of file page_info.h.

Referenced by DIALOG_PAGES_SETTINGS::SavePageSettings().

◆ m_paper_id

wxPaperSize PAGE_INFO::m_paper_id
private

wx' style paper id.

Definition at line 238 of file page_info.h.

Referenced by SetHeightMils(), and SetWidthMils().

◆ m_portrait

bool PAGE_INFO::m_portrait
private

true if portrait, false if landscape

Definition at line 236 of file page_info.h.

Referenced by SetPortrait(), and updatePortrait().

◆ m_size

VECTOR2D PAGE_INFO::m_size
private

mils

Definition at line 234 of file page_info.h.

Referenced by SetHeightMils(), SetPortrait(), SetType(), SetWidthMils(), and updatePortrait().

◆ m_type

wxString PAGE_INFO::m_type
private

paper type: A4, A3, etc.

Definition at line 233 of file page_info.h.

Referenced by IsCustom(), SetHeightMils(), and SetWidthMils().

◆ pageA

const PAGE_INFO PAGE_INFO::pageA
staticprivate

Definition at line 218 of file page_info.h.

Referenced by SetType().

◆ pageA0

const PAGE_INFO PAGE_INFO::pageA0
staticprivate

Definition at line 217 of file page_info.h.

Referenced by SetType().

◆ pageA1

const PAGE_INFO PAGE_INFO::pageA1
staticprivate

Definition at line 216 of file page_info.h.

Referenced by SetType().

◆ pageA2

const PAGE_INFO PAGE_INFO::pageA2
staticprivate

Definition at line 215 of file page_info.h.

Referenced by SetType().

◆ pageA3

const PAGE_INFO PAGE_INFO::pageA3
staticprivate

Definition at line 214 of file page_info.h.

Referenced by SetType().

◆ pageA4

const PAGE_INFO PAGE_INFO::pageA4
staticprivate

Definition at line 213 of file page_info.h.

Referenced by SetType().

◆ pageA5

const PAGE_INFO PAGE_INFO::pageA5
staticprivate

Definition at line 212 of file page_info.h.

Referenced by SetType().

◆ pageB

const PAGE_INFO PAGE_INFO::pageB
staticprivate

Definition at line 219 of file page_info.h.

Referenced by SetType().

◆ pageC

const PAGE_INFO PAGE_INFO::pageC
staticprivate

Definition at line 220 of file page_info.h.

Referenced by SetType().

◆ pageD

const PAGE_INFO PAGE_INFO::pageD
staticprivate

Definition at line 221 of file page_info.h.

Referenced by SetType().

◆ pageE

const PAGE_INFO PAGE_INFO::pageE
staticprivate

Definition at line 222 of file page_info.h.

Referenced by SetType().

◆ pageGERBER

const PAGE_INFO PAGE_INFO::pageGERBER
staticprivate

Definition at line 223 of file page_info.h.

Referenced by SetType().

◆ pageUser

const PAGE_INFO PAGE_INFO::pageUser
staticprivate

Definition at line 229 of file page_info.h.

Referenced by SetType().

◆ pageUSLedger

const PAGE_INFO PAGE_INFO::pageUSLedger
staticprivate

Definition at line 227 of file page_info.h.

Referenced by SetType().

◆ pageUSLegal

const PAGE_INFO PAGE_INFO::pageUSLegal
staticprivate

Definition at line 226 of file page_info.h.

Referenced by SetType().

◆ pageUSLetter

const PAGE_INFO PAGE_INFO::pageUSLetter
staticprivate

Definition at line 225 of file page_info.h.

Referenced by SetType().

◆ s_user_height

double PAGE_INFO::s_user_height = 11000
staticprivate

Definition at line 240 of file page_info.h.

Referenced by SetCustomHeightMils(), and SetType().

◆ s_user_width

double PAGE_INFO::s_user_width = 17000
staticprivate

Definition at line 241 of file page_info.h.

Referenced by SetCustomWidthMils(), and SetType().

◆ USLedger

const wxChar PAGE_INFO::USLedger = wxT( "USLedger" )
static

◆ USLegal

const wxChar PAGE_INFO::USLegal = wxT( "USLegal" )
static

◆ USLetter

const wxChar PAGE_INFO::USLetter = wxT( "USLetter" )
static

The documentation for this class was generated from the following files: