From 6127ae92a556830c14f7b3d93902f30b363069cf Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 22 Mar 2022 09:40:16 +0100 Subject: [PATCH] PLOTTER: do not clamp coordinates to an arbitrary value. Previously, coordinates were clamped to +- 60 inches. It makes no sense to clamp them at plotter level: max cooed depends on the editor (schematic/board...) Rename MAX_PAGE_SIZE_MILS to MAX_PAGE_SIZE_EESCHEMA_MILS and use it only for Eeschema. Fixes #11196 https://gitlab.com/kicad/code/kicad/issues/11196 (cherry picked from commit 21144481d237bb358c76dd0a60f81119450d15cf) --- eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 8 ++++---- eeschema/sch_view.cpp | 2 +- eeschema/tools/sch_editor_control.cpp | 3 ++- include/page_info.h | 6 +++--- pagelayout_editor/tools/pl_editor_control.cpp | 4 +++- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 3a4ee13711..12283b5f88 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -1569,15 +1569,15 @@ void SCH_SEXPR_PARSER::parsePAGE_INFO( PAGE_INFO& aPageInfo ) // Perform some controls to avoid crashes if the size is edited by hands if( width < MIN_PAGE_SIZE_MILS ) width = MIN_PAGE_SIZE_MILS; - else if( width > MAX_PAGE_SIZE_MILS ) - width = MAX_PAGE_SIZE_MILS; + else if( width > MAX_PAGE_SIZE_EESCHEMA_MILS ) + width = MAX_PAGE_SIZE_EESCHEMA_MILS; int height = Mm2mils( parseDouble( "height" ) ); // height stored in mm so we convert to mils if( height < MIN_PAGE_SIZE_MILS ) height = MIN_PAGE_SIZE_MILS; - else if( height > MAX_PAGE_SIZE_MILS ) - height = MAX_PAGE_SIZE_MILS; + else if( height > MAX_PAGE_SIZE_EESCHEMA_MILS ) + height = MAX_PAGE_SIZE_EESCHEMA_MILS; aPageInfo.SetWidthMils( width ); aPageInfo.SetHeightMils( height ); diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp index 5c71c585f8..9c8e041f40 100644 --- a/eeschema/sch_view.cpp +++ b/eeschema/sch_view.cpp @@ -50,7 +50,7 @@ SCH_VIEW::SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame ) : // Set m_boundary to define the max working area size. The default value is acceptable for // Pcbnew and Gerbview, but too large for Eeschema due to very different internal units. // A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin around the drawing-sheet. - double max_size = Mils2iu( MAX_PAGE_SIZE_MILS ) * 3.0; + double max_size = Mils2iu( MAX_PAGE_SIZE_EESCHEMA_MILS ) * 3.0; m_boundary.SetOrigin( -max_size/4, -max_size/4 ); m_boundary.SetSize( max_size, max_size ); } diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 0888da7bc2..a6ac247ad4 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -129,7 +129,8 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent ) undoCmd.PushItem( wrapper ); m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false ); - DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) ); + DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_EESCHEMA_MILS, + MAX_PAGE_SIZE_EESCHEMA_MILS ) ); dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); if( dlg.ShowModal() ) diff --git a/include/page_info.h b/include/page_info.h index 4de3b85302..b77a3c2cd2 100644 --- a/include/page_info.h +++ b/include/page_info.h @@ -36,9 +36,9 @@ #include // for IU_PER_MILS /// Min and max page sizes for clamping, in mils. -#define MIN_PAGE_SIZE_MILS 100 -#define MAX_PAGE_SIZE_PCBNEW_MILS 48000 -#define MAX_PAGE_SIZE_MILS 120000 +#define MIN_PAGE_SIZE_MILS 100 +#define MAX_PAGE_SIZE_PCBNEW_MILS 48000 +#define MAX_PAGE_SIZE_EESCHEMA_MILS 120000 /** diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp index c1c5c86ac7..53780e95a5 100644 --- a/pagelayout_editor/tools/pl_editor_control.cpp +++ b/pagelayout_editor/tools/pl_editor_control.cpp @@ -89,7 +89,9 @@ int PL_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent ) { m_frame->SaveCopyInUndoList(); - DIALOG_PAGES_SETTINGS dlg( m_frame, IU_PER_MILS, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) ); + DIALOG_PAGES_SETTINGS dlg( m_frame, IU_PER_MILS, + wxSize( MAX_PAGE_SIZE_EESCHEMA_MILS, + MAX_PAGE_SIZE_EESCHEMA_MILS ) ); dlg.SetWksFileName( m_frame->GetCurrentFileName() ); dlg.EnableWksFileNamePicker( false );