From f024bf2289f46f7273722ffc4423614be43039cc Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 29 Jul 2021 16:46:52 +0100 Subject: [PATCH] Don't restrict page sizes unnecessarily. Also don't validate custom sizes unless they are enabled. Fixes https://gitlab.com/kicad/code/kicad/issues/8880 --- common/dialogs/dialog_page_settings.cpp | 14 ++++++++++---- include/page_info.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 7de8349443..c649b05dac 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -202,11 +202,17 @@ bool DIALOG_PAGES_SETTINGS::TransferDataToWindow() bool DIALOG_PAGES_SETTINGS::TransferDataFromWindow() { - if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::MILS ) ) - return false; + int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 ); + const wxString paperType = m_pageFmt[idx]; - if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::MILS ) ) - return false; + if( paperType.Contains( PAGE_INFO::Custom ) ) + { + if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::MILS ) ) + return false; + + if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::MILS ) ) + return false; + } if( SavePageSettings() ) { diff --git a/include/page_info.h b/include/page_info.h index 8b8c5c959c..4de3b85302 100644 --- a/include/page_info.h +++ b/include/page_info.h @@ -36,7 +36,7 @@ #include // for IU_PER_MILS /// Min and max page sizes for clamping, in mils. -#define MIN_PAGE_SIZE_MILS 4000 +#define MIN_PAGE_SIZE_MILS 100 #define MAX_PAGE_SIZE_PCBNEW_MILS 48000 #define MAX_PAGE_SIZE_MILS 120000