From 71fd5607354ec7f2065ebb4d05ae6916f6027a0f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 19 Apr 2020 12:34:01 +0100 Subject: [PATCH] Add "Export to other sheets" to paper settings. Fixes https://gitlab.com/kicad/code/kicad/issues/2177 --- common/dialogs/dialog_page_settings.cpp | 14 +- common/dialogs/dialog_page_settings_base.cpp | 34 ++-- common/dialogs/dialog_page_settings_base.fbp | 164 +++++++++++++++++-- common/dialogs/dialog_page_settings_base.h | 4 +- eeschema/eeschema_settings.cpp | 3 + eeschema/eeschema_settings.h | 1 + 6 files changed, 191 insertions(+), 29 deletions(-) diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 639a3208d5..b9c02b651e 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -124,6 +124,7 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS() auto cfg = dynamic_cast( Kiface().KifaceSettings() ); wxASSERT( cfg ); + cfg->m_PageSettings.export_paper = m_PaperExport->GetValue(); cfg->m_PageSettings.export_revision = m_RevisionExport->GetValue(); cfg->m_PageSettings.export_date = m_DateExport->GetValue(); cfg->m_PageSettings.export_title = m_TitleExport->GetValue(); @@ -212,6 +213,7 @@ void DIALOG_PAGES_SETTINGS::initDialog() auto cfg = dynamic_cast( Kiface().KifaceSettings() ); wxASSERT( cfg ); + m_PaperExport->SetValue( cfg->m_PageSettings.export_paper ); m_RevisionExport->SetValue( cfg->m_PageSettings.export_revision ); m_DateExport->SetValue( cfg->m_PageSettings.export_date ); m_TitleExport->SetValue( cfg->m_PageSettings.export_title ); @@ -226,6 +228,7 @@ void DIALOG_PAGES_SETTINGS::initDialog() m_Comment8Export->SetValue( cfg->m_PageSettings.export_comment8 ); m_Comment9Export->SetValue( cfg->m_PageSettings.export_comment9 ); #else + m_PaperExport->Show( false ); m_RevisionExport->Show( false ); m_DateExport->Show( false ); m_TitleExport->Show( false ); @@ -609,17 +612,17 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings() #ifdef EESCHEMA // Exports settings to other sheets if requested: - SCH_SCREEN* screen; - - // Build the screen list SCH_SCREENS ScreenList; - // Update title blocks for all screens - for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) + // Update page info and/or title blocks for all screens + for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen; screen = ScreenList.GetNext() ) { if( screen == m_screen ) continue; + if( m_PaperExport->IsChecked() ) + screen->SetPageSettings( m_pageInfo ); + TITLE_BLOCK tb2 = screen->GetTitleBlock(); if( m_RevisionExport->IsChecked() ) @@ -663,7 +666,6 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings() screen->SetTitleBlock( tb2 ); } - #endif return true; diff --git a/common/dialogs/dialog_page_settings_base.cpp b/common/dialogs/dialog_page_settings_base.cpp index 42e89a4f54..1469d9f949 100644 --- a/common/dialogs/dialog_page_settings_base.cpp +++ b/common/dialogs/dialog_page_settings_base.cpp @@ -27,7 +27,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind bleftSizer->Add( m_staticTextPaper, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bleftSizer->Add( m_staticline2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bleftSizer->Add( m_staticline2, 0, wxEXPAND, 5 ); m_staticTextSize = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSize->Wrap( -1 ); @@ -39,9 +39,12 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind m_paperSizeComboBox->SetSelection( 0 ); bleftSizer->Add( m_paperSizeComboBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bleftSizer->Add( 0, 3, 0, wxEXPAND, 5 ); + m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextOrient->Wrap( -1 ); - bleftSizer->Add( m_staticTextOrient, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bleftSizer->Add( m_staticTextOrient, 0, wxRIGHT|wxLEFT, 5 ); wxString m_orientationComboBoxChoices[] = { _("Landscape"), _("Portrait") }; int m_orientationComboBoxNChoices = sizeof( m_orientationComboBoxChoices ) / sizeof( wxString ); @@ -53,14 +56,17 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind m_staticTextCustSize->Wrap( -1 ); bleftSizer->Add( m_staticTextCustSize, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + bleftSizer->Add( 0, 2, 0, wxEXPAND, 5 ); + wxFlexGridSizer* fgSizer1; - fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizer1 = new wxFlexGridSizer( 0, 3, 3, 0 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_userSizeYLabel = new wxStaticText( this, wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 ); m_userSizeYLabel->Wrap( -1 ); - fgSizer1->Add( m_userSizeYLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer1->Add( m_userSizeYLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_userSizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); #ifdef __WXGTK__ @@ -73,15 +79,15 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind #endif m_userSizeYCtrl->SetToolTip( _("Custom paper height.") ); - fgSizer1->Add( m_userSizeYCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + fgSizer1->Add( m_userSizeYCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_userSizeYUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_userSizeYUnits->Wrap( -1 ); - fgSizer1->Add( m_userSizeYUnits, 0, wxTOP|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer1->Add( m_userSizeYUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); m_userSizeXLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_userSizeXLabel->Wrap( -1 ); - fgSizer1->Add( m_userSizeXLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer1->Add( m_userSizeXLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_userSizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); #ifdef __WXGTK__ @@ -94,18 +100,24 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind #endif m_userSizeXCtrl->SetToolTip( _("Custom paper width.") ); - fgSizer1->Add( m_userSizeXCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + fgSizer1->Add( m_userSizeXCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_userSizeXUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_userSizeXUnits->Wrap( -1 ); - fgSizer1->Add( m_userSizeXUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); + fgSizer1->Add( m_userSizeXUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); bleftSizer->Add( fgSizer1, 0, wxEXPAND|wxBOTTOM, 5 ); - m_staticTextPreview = new wxStaticText( this, wxID_ANY, _("Layout Preview"), wxDefaultPosition, wxDefaultSize, 0 ); + m_PaperExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bleftSizer->Add( m_PaperExport, 0, wxALL, 4 ); + + m_staticline31 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bleftSizer->Add( m_staticline31, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); + + m_staticTextPreview = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPreview->Wrap( -1 ); - bleftSizer->Add( m_staticTextPreview, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 10 ); + bleftSizer->Add( m_staticTextPreview, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); m_PageLayoutExampleBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxFULL_REPAINT_ON_RESIZE|wxBORDER_SIMPLE ); m_PageLayoutExampleBitmap->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); diff --git a/common/dialogs/dialog_page_settings_base.fbp b/common/dialogs/dialog_page_settings_base.fbp index 33178871f6..23a7d9ff07 100644 --- a/common/dialogs/dialog_page_settings_base.fbp +++ b/common/dialogs/dialog_page_settings_base.fbp @@ -139,7 +139,7 @@ 5 - wxEXPAND|wxRIGHT|wxLEFT + wxEXPAND 0 1 @@ -321,9 +321,19 @@ OnPaperSizeChoice + + 5 + wxEXPAND + 0 + + 3 + protected + 0 + + 5 - wxTOP|wxRIGHT|wxLEFT + wxRIGHT|wxLEFT 0 1 @@ -508,6 +518,16 @@ -1 + + 5 + wxEXPAND + 0 + + 2 + protected + 0 + + 5 wxEXPAND|wxBOTTOM @@ -523,10 +543,10 @@ wxFLEX_GROWMODE_SPECIFIED none 0 - 0 + 3 5 - wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -587,7 +607,7 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -652,7 +672,7 @@ 5 - wxTOP|wxRIGHT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -713,7 +733,7 @@ 5 - wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -774,7 +794,7 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -839,7 +859,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT 0 1 @@ -900,9 +920,131 @@ + + 4 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_PaperExport + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 10 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline31 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 10 + wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT 0 1 @@ -932,7 +1074,7 @@ 0 0 wxID_ANY - Layout Preview + Preview 0 0 diff --git a/common/dialogs/dialog_page_settings_base.h b/common/dialogs/dialog_page_settings_base.h index 3e83b06c5c..dd3b35ff8a 100644 --- a/common/dialogs/dialog_page_settings_base.h +++ b/common/dialogs/dialog_page_settings_base.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,6 @@ #include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -56,6 +56,8 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM wxStaticText* m_userSizeXLabel; wxTextCtrl* m_userSizeXCtrl; wxStaticText* m_userSizeXUnits; + wxCheckBox* m_PaperExport; + wxStaticLine* m_staticline31; wxStaticText* m_staticTextPreview; wxStaticBitmap* m_PageLayoutExampleBitmap; wxStaticText* m_staticTextTitleBlock; diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index c452021f26..6a0564185d 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -146,6 +146,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema m_params.emplace_back( new PARAM( "bom.plugins", &m_BomPanel.plugins, "" ) ); + m_params.emplace_back( new PARAM( "page_settings.export_paper", + &m_PageSettings.export_paper, false ) ); + m_params.emplace_back( new PARAM( "page_settings.export_revision", &m_PageSettings.export_revision, false ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index 6bf2624c33..6c0951cb80 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -87,6 +87,7 @@ public: struct PAGE_SETTINGS { + bool export_paper; bool export_revision; bool export_date; bool export_title;