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 (PAGE_SIZE_TYPE aType=PAGE_SIZE_TYPE::A3, bool IsPortrait=false)
 
bool SetType (PAGE_SIZE_TYPE aPageSize, bool aIsPortrait=false)
 Set the name of the page type and also the sizes and margins commonly associated with that type name.
 
bool SetType (const wxString &aPageSize, bool aIsPortrait=false)
 
const PAGE_SIZE_TYPEGetType () const
 
wxString GetTypeAsString () const
 
const wxString & GetPageFormatDescription () 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 const std::vector< PAGE_INFO > & GetPageFormatsList ()
 

Protected Member Functions

 PAGE_INFO (const VECTOR2D &aSizeMils, const PAGE_SIZE_TYPE &aType, wxPaperSize aPaperId, const wxString &aDescription=wxEmptyString)
 
void updatePortrait ()
 

Private Attributes

PAGE_SIZE_TYPE 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.
 
wxString m_description
 more human friendly description of page size
 

Static Private Attributes

static std::vector< PAGE_INFOstandardPageSizes
 
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 78 of file page_info.h.

Constructor & Destructor Documentation

◆ PAGE_INFO() [1/2]

PAGE_INFO::PAGE_INFO ( PAGE_SIZE_TYPE aType = PAGE_SIZE_TYPE::A3,
bool IsPortrait = false )

Definition at line 96 of file page_info.cpp.

References m_paper_id, m_size, s_user_height, s_user_width, and SetType().

Referenced by SetType().

◆ PAGE_INFO() [2/2]

PAGE_INFO::PAGE_INFO ( const VECTOR2D & aSizeMils,
const PAGE_SIZE_TYPE & aType,
wxPaperSize aPaperId,
const wxString & aDescription = wxEmptyString )
protected

Definition at line 81 of file page_info.cpp.

References m_description, m_paper_id, m_size, m_type, and 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 255 of file page_info.cpp.

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

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 202 of file page_info.h.

References s_user_height.

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

◆ GetCustomWidthMils()

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

Definition at line 197 of file page_info.h.

References s_user_width.

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

◆ 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 168 of file page_info.h.

References GetHeightMils().

Referenced by EESCHEMA_JOBS_HANDLER::doSymExportSvg(), SCH_EDIT_FRAME::GetDocumentExtents(), GetSizeIU(), SCH_IO_ALTIUM::ParseSheet(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), and plotPdfBackground().

◆ GetHeightMils()

◆ GetHeightMM()

double PAGE_INFO::GetHeightMM ( ) const
inline

Definition at line 148 of file page_info.h.

References m_size.

◆ GetPageFormatDescription()

const wxString & PAGE_INFO::GetPageFormatDescription ( ) const
inline

Definition at line 105 of file page_info.h.

References m_description.

◆ GetPageFormatsList()

const std::vector< PAGE_INFO > & PAGE_INFO::GetPageFormatsList ( )
static

Definition at line 276 of file page_info.cpp.

References standardPageSizes.

Referenced by DIALOG_PAGES_SETTINGS::TransferDataToWindow().

◆ GetPaperId()

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

Definition at line 138 of file page_info.h.

References m_paper_id.

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

◆ GetSizeIU()

const VECTOR2D PAGE_INFO::GetSizeIU ( double aIUScale) const
inline

Gets the page size in internal units.

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 177 of file page_info.h.

References GetHeightIU(), and GetWidthIU().

Referenced by GENDRILL_WRITER_BASE::genDrillMapFile(), GERBVIEW_FRAME::GetPageSizeIU(), SCH_BASE_FRAME::GetPageSizeIU(), initializePlotter(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), SCH_IO_EAGLE::loadSheet(), SCH_IO_LTSPICE_PARSER::Parse(), SCH_PRINTOUT::PrintPage(), GERBVIEW_FRAME::SetPageSettings(), PCB_BASE_FRAME::SetPageSettings(), PL_EDITOR_FRAME::SetPageSettings(), and PL_EDITOR_FRAME::UpdateMsgPanelInfo().

◆ GetSizeMils()

const VECTOR2D & PAGE_INFO::GetSizeMils ( ) const
inline

◆ GetType()

◆ GetTypeAsString()

◆ 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 159 of file page_info.h.

References GetWidthMils().

Referenced by EESCHEMA_JOBS_HANDLER::doSymExportSvg(), SCH_EDIT_FRAME::GetDocumentExtents(), GetSizeIU(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), and plotPdfBackground().

◆ GetWidthMils()

◆ GetWidthMM()

double PAGE_INFO::GetWidthMM ( ) const
inline

Definition at line 143 of file page_info.h.

References m_size.

◆ GetWxOrientation()

wxPrintOrientation PAGE_INFO::GetWxOrientation ( ) const
inline
Returns
ws' style printing orientation (wxPORTRAIT or wxLANDSCAPE).

Definition at line 133 of file page_info.h.

References IsPortrait().

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

◆ IsCustom()

bool PAGE_INFO::IsCustom ( ) const
Returns
true if the type is Custom.

Definition at line 162 of file page_info.cpp.

References m_type, and User.

Referenced by Format(), SCH_IO_KICAD_LEGACY::Format(), DIALOG_PRINT_GENERIC::initPrintData(), PL_EDITOR_FRAME::ToPrinter(), and DIALOG_PRINT::TransferDataToWindow().

◆ IsDefault()

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

Definition at line 110 of file page_info.h.

References A3, m_portrait, and m_type.

◆ 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 221 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 215 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

◆ 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 168 of file page_info.cpp.

References m_portrait, and m_size.

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(), and SCH_PLOTTER::setupPlotPagePDF().

◆ SetType() [1/2]

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

Definition at line 104 of file page_info.cpp.

References SetType().

◆ SetType() [2/2]

bool PAGE_INFO::SetType ( PAGE_SIZE_TYPE aPageSize,
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 115 of file page_info.cpp.

References m_paper_id, m_size, m_type, PAGE_INFO(), result, s_user_height, s_user_width, standardPageSizes, updatePortrait(), and User.

Referenced by GERBVIEW_FRAME::CommonSettingsChanged(), 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(), SetType(), SCH_PLOTTER::setupPlotPagePDF(), and DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().

◆ SetWidthMils()

◆ SetWidthMM()

void PAGE_INFO::SetWidthMM ( double aWidthInMM)
inline

◆ updatePortrait()

void PAGE_INFO::updatePortrait ( )
inlineprotected

Definition at line 74 of file page_info.cpp.

References m_portrait, and m_size.

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

Member Data Documentation

◆ m_description

wxString PAGE_INFO::m_description
private

more human friendly description of page size

Definition at line 232 of file page_info.h.

Referenced by GetPageFormatDescription(), and PAGE_INFO().

◆ m_paper_id

wxPaperSize PAGE_INFO::m_paper_id
private

wx' style paper id.

Definition at line 231 of file page_info.h.

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

◆ m_portrait

bool PAGE_INFO::m_portrait
private

true if portrait, false if landscape

Definition at line 229 of file page_info.h.

Referenced by IsDefault(), IsPortrait(), SetPortrait(), and updatePortrait().

◆ m_size

◆ m_type

PAGE_SIZE_TYPE PAGE_INFO::m_type
private

paper type: A4, A3, etc.

Definition at line 226 of file page_info.h.

Referenced by GetType(), GetTypeAsString(), IsCustom(), IsDefault(), PAGE_INFO(), SetHeightMils(), SetType(), and SetWidthMils().

◆ s_user_height

double PAGE_INFO::s_user_height = 11000
staticprivate

Definition at line 234 of file page_info.h.

Referenced by GetCustomHeightMils(), PAGE_INFO(), SetCustomHeightMils(), and SetType().

◆ s_user_width

double PAGE_INFO::s_user_width = 17000
staticprivate

Definition at line 235 of file page_info.h.

Referenced by GetCustomWidthMils(), PAGE_INFO(), SetCustomWidthMils(), and SetType().

◆ standardPageSizes

std::vector< PAGE_INFO > PAGE_INFO::standardPageSizes
staticprivate
Initial value:
= {
PAGE_INFO( MMsize( 210, 148 ), PAGE_SIZE_TYPE::A5, wxPAPER_A5, _HKI( "A5 148 x 210mm" ) ),
PAGE_INFO( MMsize( 297, 210 ), PAGE_SIZE_TYPE::A4, wxPAPER_A4, _HKI( "A4 210 x 297mm" ) ),
PAGE_INFO( MMsize( 420, 297 ), PAGE_SIZE_TYPE::A3, wxPAPER_A3, _HKI( "A3 297 x 420mm" ) ),
PAGE_INFO( MMsize( 594, 420 ), PAGE_SIZE_TYPE::A2, wxPAPER_A2, _HKI( "A2 420 x 594mm" ) ),
PAGE_INFO( MMsize( 841, 594 ), PAGE_SIZE_TYPE::A1, wxPAPER_A1, _HKI( "A1 594 x 841mm" ) ),
PAGE_INFO( MMsize( 1189, 841 ), PAGE_SIZE_TYPE::A0, wxPAPER_A0, _HKI( "A0 841 x 1189mm" ) ),
PAGE_INFO( VECTOR2D( 11000, 8500 ), PAGE_SIZE_TYPE::A, wxPAPER_LETTER, _HKI( "A 8.5 x 11in" ) ),
PAGE_INFO( VECTOR2D( 17000, 11000 ), PAGE_SIZE_TYPE::B, wxPAPER_TABLOID, _HKI( "B 11 x 17in" ) ),
PAGE_INFO( VECTOR2D( 22000, 17000 ), PAGE_SIZE_TYPE::C, wxPAPER_CSHEET, _HKI( "C 17 x 22in" ) ),
PAGE_INFO( VECTOR2D( 34000, 22000 ), PAGE_SIZE_TYPE::D, wxPAPER_DSHEET, _HKI( "D 22 x 34in" ) ),
PAGE_INFO( VECTOR2D( 44000, 34000 ), PAGE_SIZE_TYPE::E, wxPAPER_ESHEET, _HKI( "E 34 x 44in" ) ),
PAGE_INFO( VECTOR2D( 32000, 32000 ), PAGE_SIZE_TYPE::GERBER, wxPAPER_NONE ),
PAGE_INFO( VECTOR2D( 17000, 11000 ), PAGE_SIZE_TYPE::User, wxPAPER_NONE, _HKI( "User (Custom)" ) ),
PAGE_INFO( VECTOR2D( 11000, 8500 ), PAGE_SIZE_TYPE::USLetter, wxPAPER_LETTER, _HKI("US Letter 8.5 x 11in") ),
PAGE_INFO( VECTOR2D( 14000, 8500 ), PAGE_SIZE_TYPE::USLegal, wxPAPER_LEGAL, _HKI("US Legal 8.5 x 14in") ),
PAGE_INFO( VECTOR2D( 17000, 11000 ), PAGE_SIZE_TYPE::USLedger, wxPAPER_TABLOID, _HKI("US Ledger 11 x 17in") )
}
PAGE_INFO(PAGE_SIZE_TYPE aType=PAGE_SIZE_TYPE::A3, bool IsPortrait=false)
Definition page_info.cpp:96
#define MMsize(x, y)
Definition page_info.cpp:38
#define _HKI(x)
Definition page_info.cpp:44
VECTOR2< double > VECTOR2D
Definition vector2d.h:694

Definition at line 46 of file page_info.h.

Referenced by GetPageFormatsList(), and SetType().


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