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 21144481d2)
This commit is contained in:
jean-pierre charras 2022-03-22 09:40:16 +01:00 committed by Seth Hillbrand
parent f8c92e355b
commit 6127ae92a5
5 changed files with 13 additions and 10 deletions

View File

@ -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 );

View File

@ -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 );
}

View File

@ -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() )

View File

@ -36,9 +36,9 @@
#include <base_units.h> // 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
/**

View File

@ -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 );