From d599648ec7ba288fcc3fcbda47fefe770645648c Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 16 May 2020 10:47:43 -0400 Subject: [PATCH] ADDED: Enable color themes for schematic printing --- common/settings/app_settings.cpp | 9 + .../dialogs/dialog_print_using_printer.cpp | 122 +++- .../dialog_print_using_printer_base.cpp | 78 ++- .../dialog_print_using_printer_base.fbp | 649 +++++++++++------- .../dialogs/dialog_print_using_printer_base.h | 31 +- eeschema/eeschema_config.cpp | 11 +- eeschema/sch_edit_frame.cpp | 2 - eeschema/sch_edit_frame.h | 7 - include/settings/app_settings.h | 11 +- 9 files changed, 590 insertions(+), 330 deletions(-) diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 6193d55bc3..355c85629c 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -66,10 +66,19 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( std::string aFilename, int aSchemaVersion m_params.emplace_back( new PARAM( "lib_tree.column_width", &m_LibTree.column_width, 360 ) ); + m_params.emplace_back( + new PARAM( "printing.background", &m_Printing.background, false ) ); + m_params.emplace_back( new PARAM( "printing.monochrome", &m_Printing.monochrome, true ) ); m_params.emplace_back( new PARAM( "printing.scale", &m_Printing.scale, 1.0 ) ); + m_params.emplace_back( + new PARAM( "printing.use_theme", &m_Printing.use_theme, false ) ); + + m_params.emplace_back( + new PARAM( "printing.color_theme", &m_Printing.color_theme, "" ) ); + m_params.emplace_back( new PARAM( "printing.title_block", &m_Printing.title_block, false ) ); diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index d0e21be94e..de5389c72b 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include @@ -41,6 +43,10 @@ public: DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ); ~DIALOG_PRINT_USING_PRINTER() override; +protected: + void OnMonochromeChecked( wxCommandEvent& event ) override; + void OnUseColorThemeChecked( wxCommandEvent& event ) override; + private: bool TransferDataToWindow() override; bool TransferDataFromWindow() override; @@ -48,7 +54,7 @@ private: void OnPageSetup( wxCommandEvent& event ) override; void OnPrintPreview( wxCommandEvent& event ) override; - void GetPrintOptions(); + void SavePrintOptions(); SCH_EDIT_FRAME* m_parent; }; @@ -132,10 +138,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent DIALOG_PRINT_USING_PRINTER_BASE( aParent ), m_parent( aParent ) { - wxASSERT( aParent != NULL ); - - m_checkReference->SetValue( aParent->GetPrintSheetReference() ); - m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() ); + wxASSERT( aParent ); // We use a sdbSizer to get platform-dependent ordering of the action buttons, but // that requires us to correct the button labels here. @@ -159,12 +162,43 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent DIALOG_PRINT_USING_PRINTER::~DIALOG_PRINT_USING_PRINTER() { - GetPrintOptions(); + SavePrintOptions(); } bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow() { + EESCHEMA_SETTINGS* cfg = m_parent->eeconfig(); + + m_checkReference->SetValue( cfg->m_Printing.title_block ); + m_checkMonochrome->SetValue( cfg->m_Printing.monochrome ); + m_checkBackgroundColor->SetValue( cfg->m_Printing.background ); + m_checkUseColorTheme->SetValue( cfg->m_Printing.use_theme ); + + m_colorTheme->Clear(); + + int width = 0; + int height = 0; + int minwidth = width; + + wxString target = cfg->m_Printing.use_theme ? cfg->m_Printing.color_theme : cfg->m_ColorTheme; + + for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() ) + { + int pos = m_colorTheme->Append( settings->GetName(), static_cast( settings ) ); + + if( settings->GetFilename() == target ) + m_colorTheme->SetSelection( pos ); + + m_colorTheme->GetTextExtent( settings->GetName(), &width, &height ); + minwidth = std::max( minwidth, width ); + } + + m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) ); + + m_lblTheme->Enable( cfg->m_Printing.use_theme ); + m_colorTheme->Enable( cfg->m_Printing.use_theme ); + // Initialize page specific print setup dialog settings. const PAGE_INFO& pageInfo = m_parent->GetScreen()->GetPageSettings(); wxPageSetupDialogData& pageSetupDialogData = m_parent->GetPageSetupData(); @@ -183,14 +217,44 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow() pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.GetWxOrientation() ); + Layout(); + return true; } -void DIALOG_PRINT_USING_PRINTER::GetPrintOptions() +void DIALOG_PRINT_USING_PRINTER::OnUseColorThemeChecked( wxCommandEvent& event ) { - m_parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() ); - m_parent->SetPrintSheetReference( m_checkReference->IsChecked() ); + m_lblTheme->Enable( m_checkUseColorTheme->GetValue() ); + m_colorTheme->Enable( m_checkUseColorTheme->GetValue() ); +} + + +void DIALOG_PRINT_USING_PRINTER::OnMonochromeChecked( wxCommandEvent& event ) +{ + m_checkBackgroundColor->Enable( !m_checkMonochrome->GetValue() ); + + if( m_checkMonochrome->GetValue() ) + m_checkBackgroundColor->SetValue( false ); + else + m_checkBackgroundColor->SetValue( m_parent->eeconfig()->m_Printing.background ); +} + + +void DIALOG_PRINT_USING_PRINTER::SavePrintOptions() +{ + EESCHEMA_SETTINGS* cfg = m_parent->eeconfig(); + + cfg->m_Printing.monochrome = m_checkMonochrome->IsChecked(); + cfg->m_Printing.title_block = m_checkReference->IsChecked(); + cfg->m_Printing.background = m_checkBackgroundColor->IsChecked(); + cfg->m_Printing.use_theme = m_checkUseColorTheme->IsChecked(); + + COLOR_SETTINGS* theme = static_cast( + m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) ); + + if( theme && m_checkUseColorTheme->IsChecked() ) + cfg->m_Printing.color_theme = theme->GetFilename(); } @@ -209,7 +273,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) */ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) { - GetPrintOptions(); + SavePrintOptions(); // Pass two printout objects: for preview, and possible printing. wxString title = _( "Preview" ); @@ -253,7 +317,7 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow() return false; } - GetPrintOptions(); + SavePrintOptions(); wxPrintDialogData printDialogData( m_parent->GetPageSetupData().GetPrintData() ); printDialogData.SetMaxPage( g_RootSheet->CountSheets() ); @@ -331,13 +395,15 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage ) return false; #ifdef DEBUG + EESCHEMA_SETTINGS* cfg = m_parent->eeconfig(); + wxLogDebug( wxT( "Printer name: " ) + m_parent->GetPageSetupData().GetPrintData().GetPrinterName() ); wxLogDebug( wxT( "Paper ID: %d" ), m_parent->GetPageSetupData().GetPrintData().GetPaperId() ); wxLogDebug( wxT( "Color: %d" ), (int)m_parent->GetPageSetupData().GetPrintData().GetColour() ); - wxLogDebug( wxT( "Monochrome: %d" ), m_parent->GetPrintMonochrome() ); + wxLogDebug( wxT( "Monochrome: %d" ), cfg->m_Printing.monochrome ); wxLogDebug( wxT( "Orientation: %d:" ), m_parent->GetPageSetupData().GetPrintData().GetOrientation() ); wxLogDebug( wxT( "Quality: %d"), @@ -367,8 +433,12 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen ) oldZoom = aScreen->GetZoom(); old_org = aScreen->m_DrawOrg; + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + EESCHEMA_SETTINGS* cfg = m_parent->eeconfig(); + COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme ); + // Change scale factor and offset to print the whole page. - bool printReference = m_parent->GetPrintSheetReference(); + bool printReference = cfg->m_Printing.title_block; pageSizeIU = aScreen->GetPageSettings().GetSizeIU(); FitThisSizeToPaper( pageSizeIU ); @@ -415,17 +485,33 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen ) aScreen->m_IsPrinting = true; - COLOR4D bgColor = m_parent->GetDrawBgColor(); - m_parent->SetDrawBgColor( COLOR4D::WHITE ); + COLOR4D savedBgColor = m_parent->GetDrawBgColor(); + COLOR4D bgColor = m_parent->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ); + + if( cfg->m_Printing.background ) + { + if( cfg->m_Printing.use_theme && theme ) + bgColor = theme->GetColor( LAYER_SCHEMATIC_BACKGROUND ); + } + else + { + bgColor = COLOR4D::WHITE; + } + + m_parent->SetDrawBgColor( bgColor ); GRSFilledRect( nullptr, dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(), - fitRect.GetBottom(), 0, COLOR4D::WHITE, COLOR4D::WHITE ); + fitRect.GetBottom(), 0, bgColor, bgColor ); - if( m_parent->GetPrintMonochrome() ) + if( cfg->m_Printing.monochrome ) GRForceBlackPen( true ); KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() ); renderSettings.SetPrintDC( dc ); + + if( cfg->m_Printing.use_theme && theme ) + renderSettings.LoadColors( theme ); + // The worksheet item print code is shared between PCBNew and EESchema, so it's easier // if they just use the PCB layer. renderSettings.SetLayerColor( LAYER_WORKSHEET, @@ -439,7 +525,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen ) aScreen->Print( &renderSettings ); - m_parent->SetDrawBgColor( bgColor ); + m_parent->SetDrawBgColor( savedBgColor ); aScreen->m_IsPrinting = false; GRForceBlackPen( false ); diff --git a/eeschema/dialogs/dialog_print_using_printer_base.cpp b/eeschema/dialogs/dialog_print_using_printer_base.cpp index cf8d31729e..f272b1c174 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.cpp +++ b/eeschema/dialogs/dialog_print_using_printer_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -12,38 +12,64 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); - + wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bleftSizer; bleftSizer = new wxBoxSizer( wxVERTICAL ); - + m_checkReference = new wxCheckBox( this, wxID_ANY, _("Print sheet &reference and title block"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkReference->SetValue(true); + m_checkReference->SetValue(true); m_checkReference->SetToolTip( _("Print (or not) the Frame references.") ); - + bleftSizer->Add( m_checkReference, 0, wxALL, 5 ); - + m_checkMonochrome = new wxCheckBox( this, wxID_ANY, _("Print in &black and white only"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkMonochrome->SetValue(true); - bleftSizer->Add( m_checkMonochrome, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - + m_checkMonochrome->SetValue(true); + bleftSizer->Add( m_checkMonochrome, 0, wxALL, 5 ); + + m_checkBackgroundColor = new wxCheckBox( this, wxID_ANY, _("Print background color"), wxDefaultPosition, wxDefaultSize, 0 ); + bleftSizer->Add( m_checkBackgroundColor, 0, wxALL, 5 ); + + m_checkUseColorTheme = new wxCheckBox( this, wxID_ANY, _("Use a different color theme for printing"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkUseColorTheme->SetValue(true); + bleftSizer->Add( m_checkUseColorTheme, 0, wxALL, 5 ); + + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxHORIZONTAL ); + + m_lblTheme = new wxStaticText( this, wxID_ANY, _("Color theme:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblTheme->Wrap( -1 ); + m_lblTheme->Enable( false ); + + bSizer4->Add( m_lblTheme, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + wxArrayString m_colorThemeChoices; + m_colorTheme = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_colorThemeChoices, 0 ); + m_colorTheme->SetSelection( 0 ); + m_colorTheme->Enable( false ); + + bSizer4->Add( m_colorTheme, 0, wxALL, 5 ); + + + bleftSizer->Add( bSizer4, 1, wxEXPAND|wxLEFT, 5 ); + + bMainSizer->Add( bleftSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 ); - + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - + wxBoxSizer* bbuttonsSizer; bbuttonsSizer = new wxBoxSizer( wxHORIZONTAL ); - + m_buttonPageSetup = new wxButton( this, wxID_ANY, _("Page Setup..."), wxDefaultPosition, wxDefaultSize, 0 ); bbuttonsSizer->Add( m_buttonPageSetup, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - + + bbuttonsSizer->Add( 40, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); @@ -52,19 +78,21 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - + bbuttonsSizer->Add( m_sdbSizer1, 0, wxALL, 5 ); - - + + bMainSizer->Add( bbuttonsSizer, 0, wxEXPAND|wxLEFT, 10 ); - - + + this->SetSizer( bMainSizer ); this->Layout(); bMainSizer->Fit( this ); - + // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) ); + m_checkMonochrome->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnMonochromeChecked ), NULL, this ); + m_checkUseColorTheme->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnUseColorThemeChecked ), NULL, this ); m_buttonPageSetup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this ); m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this ); } @@ -73,7 +101,9 @@ DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) ); + m_checkMonochrome->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnMonochromeChecked ), NULL, this ); + m_checkUseColorTheme->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnUseColorThemeChecked ), NULL, this ); m_buttonPageSetup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this ); m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this ); - + } diff --git a/eeschema/dialogs/dialog_print_using_printer_base.fbp b/eeschema/dialogs/dialog_print_using_printer_base.fbp index 378a4c188c..196500ad7c 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.fbp +++ b/eeschema/dialogs/dialog_print_using_printer_base.fbp @@ -2,7 +2,7 @@ - + C++ 1 source_name @@ -14,11 +14,12 @@ dialog_print_using_printer_base 1000 none + 1 dialog_print_schematic - + . - + 1 1 1 @@ -29,67 +30,32 @@ 0 wxAUI_MGR_DEFAULT - - - + + + 1 1 impl_virtual - - - + + + 0 wxID_ANY - + -1,-1 DIALOG_PRINT_USING_PRINTER_BASE - + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Print - - - - - - - - - - - - - + + + + OnCloseWindow - - - - - - - - - - - - - - - - - - - - - - - - - - - + bMainSizer wxVERTICAL none @@ -98,7 +64,7 @@ wxEXPAND|wxTOP|wxBOTTOM|wxLEFT 1 - + bleftSizer wxVERTICAL none @@ -111,171 +77,389 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Print sheet &reference and title block - + 0 - - + + 0 - + 1 m_checkReference 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 Print (or not) the Frame references. - + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxALL 0 1 1 1 1 - - - - - - - + + + + + + + 1 0 1 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Print in &black and white only - + 0 - - + + 0 - + 1 m_checkMonochrome 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + OnMonochromeChecked + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Print background color + + 0 + + + 0 + + 1 + m_checkBackgroundColor + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use a different color theme for printing + + 0 + + + 0 + + 1 + m_checkUseColorTheme + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnUseColorThemeChecked + + + + 5 + wxEXPAND|wxLEFT + 1 + + + bSizer4 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + Color theme: + 0 + + 0 + + + 0 + + 1 + m_lblTheme + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_colorTheme + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + @@ -289,76 +473,53 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - + + 0 - + 1 m_staticline1 1 - - + + protected 1 - + Resizable 1 - + wxLI_HORIZONTAL ; forward_declare 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -366,7 +527,7 @@ wxEXPAND|wxLEFT 0 - + bbuttonsSizer wxHORIZONTAL none @@ -379,83 +540,68 @@ 1 1 1 - - - - - - - + + + + + + + + 1 0 1 - + 1 + 0 0 + Dock 0 Left 1 - + 1 - + + 0 0 wxID_ANY Page Setup... - + + 0 + 0 - - + + 0 - + 1 m_buttonPageSetup 1 - - + + protected 1 - + + + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnPageSetup - - - - - - - - - - - - - - - - - - - - - - - @@ -481,17 +627,10 @@ 1 0 0 - + m_sdbSizer1 protected OnPrintPreview - - - - - - - diff --git a/eeschema/dialogs/dialog_print_using_printer_base.h b/eeschema/dialogs/dialog_print_using_printer_base.h index 62c3ac4051..5612deb79d 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.h +++ b/eeschema/dialogs/dialog_print_using_printer_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_PRINT_USING_PRINTER_BASE_H__ -#define __DIALOG_PRINT_USING_PRINTER_BASE_H__ +#pragma once #include #include @@ -18,8 +17,13 @@ #include #include #include +#include +#include #include #include +#include +#include +#include #include #include @@ -31,28 +35,33 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM { private: - + protected: wxCheckBox* m_checkReference; wxCheckBox* m_checkMonochrome; + wxCheckBox* m_checkBackgroundColor; + wxCheckBox* m_checkUseColorTheme; + wxStaticText* m_lblTheme; + wxChoice* m_colorTheme; wxStaticLine* m_staticline1; wxButton* m_buttonPageSetup; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Apply; wxButton* m_sdbSizer1Cancel; - + // Virtual event handlers, overide them in your derived class virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } + virtual void OnMonochromeChecked( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUseColorThemeChecked( wxCommandEvent& event ) { event.Skip(); } virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_PRINT_USING_PRINTER_BASE(); - + }; -#endif //__DIALOG_PRINT_USING_PRINTER_BASE_H__ diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index dae6f910a8..cf6acd53e0 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -430,16 +430,9 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) { SCH_BASE_FRAME::SaveSettings( eeconfig() ); - // TODO(JE) do most of these need to live as class members here, or can the sites that need - // the setting just grab a pointer to the EESCHEMA_SETTINGS and look them up directly? + // TODO(JE) do we need to keep m_userUnits around? if( eeconfig() ) - { - eeconfig()->m_Appearance.print_sheet_reference = m_printSheetReference; - - eeconfig()->m_Printing.monochrome = m_printMonochrome; - - eeconfig()->m_System.units = static_cast( m_userUnits ); - } + eeconfig()->m_System.units = static_cast( m_userUnits ); } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index b65ed28f66..1e80c265e0 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -215,8 +215,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): g_ErcSettings = new ERC_SETTINGS(); m_showBorderAndTitleBlock = true; // true to show sheet references - m_printMonochrome = true; - m_printSheetReference = true; m_hasAutoSave = true; m_AboutTitle = "Eeschema"; diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index fd6b6f6010..59c5db71bc 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -126,8 +126,6 @@ private: std::vector m_projectFileParams; std::vector m_configSettings; wxPageSetupDialogData m_pageSetupData; - bool m_printMonochrome; ///< Print monochrome instead of grey scale. - bool m_printSheetReference; SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command. wxString m_netListerCommand; ///< Command line to call a custom net list ///< generator. @@ -560,11 +558,6 @@ public: wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; } - bool GetPrintMonochrome() { return m_printMonochrome; } - void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; } - bool GetPrintSheetReference() { return m_printSheetReference; } - void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; } - void NewProject(); void LoadProject(); diff --git a/include/settings/app_settings.h b/include/settings/app_settings.h index cffc58a3bd..428f88ae01 100644 --- a/include/settings/app_settings.h +++ b/include/settings/app_settings.h @@ -98,10 +98,13 @@ public: struct PRINTING { - bool monochrome; - double scale; - bool title_block; - std::vector layers; ///< List of enabled layers for printing + bool background; ///< Whether or not to print background color + bool monochrome; ///< Whether or not to print in monochrome + double scale; ///< Printout scale + bool use_theme; ///< If false, display color theme will be used + wxString color_theme; ///< Color theme to use for printing + bool title_block; ///< Whether or not to print title block + std::vector layers; ///< List of enabled layers for printing }; struct SYSTEM