diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 390fbf2d20..57b9705478 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -50,6 +50,8 @@ #include <worksheet.h> #include <dialog_page_settings.h> +#define MAX_PAGE_EXAMPLE_SIZE 200 + // List of page formats. // 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 ) { - 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 ); 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 ), m_initialized( 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, - 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_screen = m_parent->GetScreen(); m_projectPath = Prj().GetProjectPath(); m_page_bitmap = NULL; + m_maxPageSizeMils = aMaxUserSizeMils; m_tb = m_parent->GetTitleBlock(); m_customFmt = false; m_localPrjConfigChanged = false; @@ -568,8 +593,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() { int lyWidth, lyHeight; - wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE ), - Clamp( MIN_PAGE_SIZE, m_layout_size.y, 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, m_maxPageSizeMils.y ) ); double lyRatio = clamped_layout_size.x < clamped_layout_size.y ? (double) clamped_layout_size.y / clamped_layout_size.x : diff --git a/common/dialogs/dialog_page_settings.h b/common/dialogs/dialog_page_settings.h index c202dd29c1..9fc1af1fd7 100644 --- a/common/dialogs/dialog_page_settings.h +++ b/common/dialogs/dialog_page_settings.h @@ -1,7 +1,7 @@ /* * 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 * modify it under the terms of the GNU General Public License @@ -25,11 +25,8 @@ #define _DIALOG_PAGES_SETTINGS_H_ #include <widgets/unit_binder.h> - #include <dialog_page_settings_base.h> -#define MAX_PAGE_EXAMPLE_SIZE 200 - /*! * DIALOG_PAGES_SETTINGS class declaration */ @@ -45,6 +42,7 @@ private: bool m_localPrjConfigChanged; /// the page layuout filename was changed wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example. 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. bool m_customFmt; /// true if the page selection is custom TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions). @@ -54,7 +52,7 @@ private: UNIT_BINDER m_customSizeY; public: - DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ); + DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent, wxSize aMaxUserSizeMils ); ~DIALOG_PAGES_SETTINGS(); const wxString GetWksFileName() diff --git a/include/page_info.h b/include/page_info.h index 20280a1d9e..38730d00e2 100644 --- a/include/page_info.h +++ b/include/page_info.h @@ -35,6 +35,11 @@ #include <richio.h> // for OUTPUTFORMATTER and IO_ERROR #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 @@ -218,10 +223,6 @@ private: wxString m_type; ///< paper type: A4, A3, etc. 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 wxPaperSize m_paper_id; ///< wx' style paper id. diff --git a/pagelayout_editor/events_functions.cpp b/pagelayout_editor/events_functions.cpp index 726841f45d..529c4c7c3f 100644 --- a/pagelayout_editor/events_functions.cpp +++ b/pagelayout_editor/events_functions.cpp @@ -146,7 +146,8 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event ) 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.EnableWksFileNamePicker( false ); dlg.ShowModal();