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 ) :
106 auto type = magic_enum::enum_cast<PAGE_SIZE_TYPE>( aPageSize.ToStdString(), magic_enum::case_insensitive );
108 if( !type.has_value() )
111 return SetType( type.value(), aIsPortrait );
122 return p.m_type == aType;
157 std::string typeStr( magic_enum::enum_name(
m_type ) );
158 return wxString( typeStr );
191 if( aWidthInMils < 10 )
208 if( aHeightInMils < 10.0 )
209 aHeightInMils = 10.0;
211 return aHeightInMils;
229 if(
m_size.x != aWidthInMils )
243 if(
m_size.y != aHeightInMils )
257 std::string typeStr( magic_enum::enum_name(
GetType() ) );
258 aFormatter->
Print(
"(paper %s", aFormatter->
Quotew( typeStr ).c_str() );
264 aFormatter->
Print(
" %s %s",
270 aFormatter->
Print(
" portrait" );
272 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