Allows bigger max page size (120x120") in Eeschema, Gerbview and Page Layout Editor

Due to its small internal unit, pcbnew still have a max page size of 48x48"

Fixes: lp:1785155
https://bugs.launchpad.net/kicad/+bug/1785155
This commit is contained in:
jean-pierre charras 2018-08-04 13:18:15 +02:00
parent c32fcd1403
commit 0902bbabc5
4 changed files with 41 additions and 16 deletions

View File

@ -50,6 +50,8 @@
#include <worksheet.h> #include <worksheet.h>
#include <dialog_page_settings.h> #include <dialog_page_settings.h>
#define MAX_PAGE_EXAMPLE_SIZE 200
// List of page formats. // List of page formats.
// they are prefixed by "_HKI" (already in use for hotkeys) instead of "_", // they are prefixed by "_HKI" (already in use for hotkeys) instead of "_",
@ -79,7 +81,29 @@ static const wxString pageFmts[] =
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event ) void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
{ {
DIALOG_PAGES_SETTINGS dlg( this ); FRAME_T smallSizeFrames[] =
{
FRAME_PCB, FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_VIEWER,
FRAME_PCB_MODULE_VIEWER_MODAL, FRAME_PCB_FOOTPRINT_WIZARD_MODAL,
FRAME_PCB_FOOTPRINT_PREVIEW,
FRAME_CVPCB_DISPLAY
};
// Fix the max page size: it is MAX_PAGE_SIZE_EDITORS
// or MAX_PAGE_SIZE_PCBNEW for Pcbnew draw frames, due to the small internal
// units that do not allow too large draw areas
wxSize maxPageSize( MAX_PAGE_SIZE_EDITORS_MILS, MAX_PAGE_SIZE_EDITORS_MILS );
for( unsigned ii = 0; ii < DIM( smallSizeFrames ); ii++ )
{
if( IsType( smallSizeFrames[ii] ) )
{
maxPageSize.x = maxPageSize.y = MAX_PAGE_SIZE_PCBNEW_MILS;
break;
}
}
DIALOG_PAGES_SETTINGS dlg( this, maxPageSize );
dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName ); dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
@ -90,18 +114,19 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
} }
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) : DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent, wxSize aMaxUserSizeMils ) :
DIALOG_PAGES_SETTINGS_BASE( parent ), DIALOG_PAGES_SETTINGS_BASE( parent ),
m_initialized( false ), m_initialized( false ),
m_customSizeX( parent, m_userSizeXLabel, m_userSizeXCtrl, m_userSizeXUnits, false, m_customSizeX( parent, m_userSizeXLabel, m_userSizeXCtrl, m_userSizeXUnits, false,
MIN_PAGE_SIZE * IU_PER_MILS, MAX_PAGE_SIZE * IU_PER_MILS ), MIN_PAGE_SIZE * IU_PER_MILS, aMaxUserSizeMils.x * IU_PER_MILS ),
m_customSizeY( parent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits, false, m_customSizeY( parent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits, false,
MIN_PAGE_SIZE * IU_PER_MILS, MAX_PAGE_SIZE * IU_PER_MILS ) MIN_PAGE_SIZE * IU_PER_MILS, aMaxUserSizeMils.y * IU_PER_MILS )
{ {
m_parent = parent; m_parent = parent;
m_screen = m_parent->GetScreen(); m_screen = m_parent->GetScreen();
m_projectPath = Prj().GetProjectPath(); m_projectPath = Prj().GetProjectPath();
m_page_bitmap = NULL; m_page_bitmap = NULL;
m_maxPageSizeMils = aMaxUserSizeMils;
m_tb = m_parent->GetTitleBlock(); m_tb = m_parent->GetTitleBlock();
m_customFmt = false; m_customFmt = false;
m_localPrjConfigChanged = false; m_localPrjConfigChanged = false;
@ -568,8 +593,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
{ {
int lyWidth, lyHeight; int lyWidth, lyHeight;
wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE ), wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE, m_layout_size.x, m_maxPageSizeMils.x ),
Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE ) ); Clamp( MIN_PAGE_SIZE, m_layout_size.y, m_maxPageSizeMils.y ) );
double lyRatio = clamped_layout_size.x < clamped_layout_size.y ? double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
(double) clamped_layout_size.y / clamped_layout_size.x : (double) clamped_layout_size.y / clamped_layout_size.x :

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2013 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -25,11 +25,8 @@
#define _DIALOG_PAGES_SETTINGS_H_ #define _DIALOG_PAGES_SETTINGS_H_
#include <widgets/unit_binder.h> #include <widgets/unit_binder.h>
#include <dialog_page_settings_base.h> #include <dialog_page_settings_base.h>
#define MAX_PAGE_EXAMPLE_SIZE 200
/*! /*!
* DIALOG_PAGES_SETTINGS class declaration * DIALOG_PAGES_SETTINGS class declaration
*/ */
@ -45,6 +42,7 @@ private:
bool m_localPrjConfigChanged; /// the page layuout filename was changed bool m_localPrjConfigChanged; /// the page layuout filename was changed
wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example. wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example.
wxSize m_layout_size; /// Logical page layout size. wxSize m_layout_size; /// Logical page layout size.
wxSize m_maxPageSizeMils; /// The max page size allowed by the caller frame
PAGE_INFO m_pageInfo; /// Temporary page info. PAGE_INFO m_pageInfo; /// Temporary page info.
bool m_customFmt; /// true if the page selection is custom bool m_customFmt; /// true if the page selection is custom
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions). TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).
@ -54,7 +52,7 @@ private:
UNIT_BINDER m_customSizeY; UNIT_BINDER m_customSizeY;
public: public:
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ); DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent, wxSize aMaxUserSizeMils );
~DIALOG_PAGES_SETTINGS(); ~DIALOG_PAGES_SETTINGS();
const wxString GetWksFileName() const wxString GetWksFileName()

View File

@ -35,6 +35,11 @@
#include <richio.h> // for OUTPUTFORMATTER and IO_ERROR #include <richio.h> // for OUTPUTFORMATTER and IO_ERROR
#include <base_units.h> // for IU_PER_MILS #include <base_units.h> // for IU_PER_MILS
/// Min and max page sizes for clamping, in mils.
#define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE_PCBNEW_MILS 48000
#define MAX_PAGE_SIZE_EDITORS_MILS 120000
/** /**
* Class PAGE_INFO * Class PAGE_INFO
@ -218,10 +223,6 @@ private:
wxString m_type; ///< paper type: A4, A3, etc. wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils wxSize m_size; ///< mils
/// Min and max page sizes for clamping.
#define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE 48000
bool m_portrait; ///< true if portrait, false if landscape bool m_portrait; ///< true if portrait, false if landscape
wxPaperSize m_paper_id; ///< wx' style paper id. wxPaperSize m_paper_id; ///< wx' style paper id.

View File

@ -146,7 +146,8 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_SHEET_SET: case ID_SHEET_SET:
{ {
DIALOG_PAGES_SETTINGS dlg( this ); DIALOG_PAGES_SETTINGS dlg( this, wxSize( MAX_PAGE_SIZE_EDITORS_MILS,
MAX_PAGE_SIZE_EDITORS_MILS ) );
dlg.SetWksFileName( GetCurrFileName() ); dlg.SetWksFileName( GetCurrFileName() );
dlg.EnableWksFileNamePicker( false ); dlg.EnableWksFileNamePicker( false );
dlg.ShowModal(); dlg.ShowModal();