From a1437f4a9558cfa801ee996dcdb696027aa7d766 Mon Sep 17 00:00:00 2001 From: Fabien Corona Date: Tue, 21 Jul 2020 00:00:36 +0000 Subject: [PATCH] Eeschema : Add A5 sheet size --- common/dialogs/dialog_page_settings.cpp | 4 ++++ common/page_info.cpp | 6 +++++- eeschema/dialogs/dialog_plot_schematic.cpp | 1 + eeschema/plot_schematic_HPGL.cpp | 2 ++ include/page_info.h | 4 +++- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index d92477f3da..dd90a54000 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -61,6 +61,7 @@ #define _HKI( x ) wxT( x ) static const wxString pageFmts[] = { + _HKI("A5 148x210mm"), _HKI("A4 210x297mm"), _HKI("A3 297x420mm"), _HKI("A2 420x594mm"), @@ -559,6 +560,8 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings() success = m_pageInfo.SetType( PAGE_INFO::USLedger ); else if( paperType.Contains( PAGE_INFO::GERBER ) ) success = m_pageInfo.SetType( PAGE_INFO::GERBER ); + else if( paperType.Contains( PAGE_INFO::A5 ) ) + success = m_pageInfo.SetType( PAGE_INFO::A5 ); else if( paperType.Contains( PAGE_INFO::A4 ) ) success = m_pageInfo.SetType( PAGE_INFO::A4 ); else if( paperType.Contains( PAGE_INFO::A3 ) ) @@ -808,6 +811,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() static const wxChar* papers[] = { // longest common string first, since sequential search below + PAGE_INFO::A5, PAGE_INFO::A4, PAGE_INFO::A3, PAGE_INFO::A2, diff --git a/common/page_info.cpp b/common/page_info.cpp index 31aa6183bb..fd2bcc5da3 100644 --- a/common/page_info.cpp +++ b/common/page_info.cpp @@ -39,6 +39,7 @@ // Standard paper sizes nicknames. +const wxChar PAGE_INFO::A5[] = wxT( "A5" ); const wxChar PAGE_INFO::A4[] = wxT( "A4" ); const wxChar PAGE_INFO::A3[] = wxT( "A3" ); const wxChar PAGE_INFO::A2[] = wxT( "A2" ); @@ -65,6 +66,7 @@ const wxChar PAGE_INFO::Custom[] = wxT( "User" ); #define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) ) // All MUST be defined as landscape. +const PAGE_INFO PAGE_INFO::pageA5( MMsize( 210, 148 ), wxT( "A5" ), wxPAPER_A5 ); const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 ); const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 ); const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 ); @@ -119,7 +121,9 @@ bool PAGE_INFO::SetType( const wxString& aType, bool aIsPortrait ) bool rc = true; // all are landscape initially - if( aType == pageA4.GetType() ) + if( aType == pageA5.GetType() ) + *this = pageA5; + else if( aType == pageA4.GetType() ) *this = pageA4; else if( aType == pageA3.GetType() ) *this = pageA3; diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index b98cd0e727..1fa62fd3f4 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -216,6 +216,7 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event ) if( fmt == PLOT_FORMAT::HPGL ) { + paperSizes.push_back( _( "A5" ) ); paperSizes.push_back( _( "A4" ) ); paperSizes.push_back( _( "A3" ) ); paperSizes.push_back( _( "A2" ) ); diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp index c3f24a583b..5d58cb0466 100644 --- a/eeschema/plot_schematic_HPGL.cpp +++ b/eeschema/plot_schematic_HPGL.cpp @@ -40,6 +40,7 @@ enum HPGL_PAGEZ_T { PAGE_DEFAULT = 0, + HPGL_PAGE_SIZE_A5, HPGL_PAGE_SIZE_A4, HPGL_PAGE_SIZE_A3, HPGL_PAGE_SIZE_A2, @@ -59,6 +60,7 @@ static const wxChar* plot_sheet_list( int aSize ) { default: case PAGE_DEFAULT: return nullptr; + case HPGL_PAGE_SIZE_A5: return wxT( "A5" ); case HPGL_PAGE_SIZE_A4: return wxT( "A4" ); case HPGL_PAGE_SIZE_A3: return wxT( "A3" ); case HPGL_PAGE_SIZE_A2: return wxT( "A2" ); diff --git a/include/page_info.h b/include/page_info.h index 8ea136a997..f0417823d8 100644 --- a/include/page_info.h +++ b/include/page_info.h @@ -61,6 +61,7 @@ public: // above constructor. // these were once wxStrings, but it caused static construction sequence problems: + static const wxChar A5[]; static const wxChar A4[]; static const wxChar A3[]; static const wxChar A2[]; @@ -84,7 +85,7 @@ public: * commonly associated with that type name. * * @param aStandardPageDescriptionName is a wxString constant giving one of: - * "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", "USLetter", "USLegal", + * "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 @@ -200,6 +201,7 @@ protected: private: // standard pre-defined sizes + static const PAGE_INFO pageA5; static const PAGE_INFO pageA4; static const PAGE_INFO pageA3; static const PAGE_INFO pageA2;