30#include <magic_enum.hpp>
38#define MMsize( x, y ) VECTOR2D( EDA_UNIT_UTILS::Mm2mils( x ), EDA_UNIT_UTILS::Mm2mils( y ) )
44#define _HKI( x ) wxT( x )
82 const wxString& aDescription ) :
108 auto type = magic_enum::enum_cast<PAGE_SIZE_TYPE>( aPageSize.ToStdString(), magic_enum::case_insensitive );
110 if( !type.has_value() )
113 return SetType( type.value(), aIsPortrait );
124 return p.m_type == aType;
155 std::string typeStr( magic_enum::enum_name(
m_type ) );
156 return wxString( typeStr );
182 if( aWidthInMils < 10 )
191 if( aHeightInMils < 10.0 )
192 aHeightInMils = 10.0;
194 return aHeightInMils;
212 if(
m_size.x != aWidthInMils )
226 if(
m_size.y != aHeightInMils )
240 std::string typeStr( magic_enum::enum_name(
GetType() ) );
241 aFormatter->
Print(
"(paper %s", aFormatter->
Quotew( typeStr ).c_str() );
247 aFormatter->
Print(
" %s %s",
253 aFormatter->
Print(
" portrait" );
255 aFormatter->
Print(
")" );
Describe the page size and margins of a paper page on which to eventually print or plot.
wxString GetTypeAsString() const
bool m_portrait
true if portrait, false if landscape
void SetPortrait(bool aIsPortrait)
Rotate the paper page 90 degrees.
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.
static void SetCustomWidthMils(double aWidthInMils)
Set the width of Custom page in mils for any custom page constructed or made via SetType() after maki...
static double s_user_width
void SetHeightMils(double aHeightInMils)
static std::vector< PAGE_INFO > standardPageSizes
static double s_user_height
static const std::vector< PAGE_INFO > & GetPageFormatsList()
double GetHeightMils() const
PAGE_INFO(PAGE_SIZE_TYPE aType=PAGE_SIZE_TYPE::A3, bool IsPortrait=false)
void Format(OUTPUTFORMATTER *aFormatter) const
Output the page class to aFormatter in s-expression form.
wxString m_description
more human friendly description of page size
double GetWidthMils() const
void SetWidthMils(double aWidthInMils)
static void SetCustomHeightMils(double aHeightInMils)
Set the height of Custom page in mils for any custom page constructed or made via SetType() after mak...
const PAGE_SIZE_TYPE & GetType() const
PAGE_SIZE_TYPE m_type
paper type: A4, A3, etc.
wxPaperSize m_paper_id
wx' style paper id.
This file contains miscellaneous commonly used macros and functions.
static double clampHeight(double aHeightInMils)
static double clampWidth(double aWidthInMils)
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< double > VECTOR2D