diff --git a/common/board_printout.cpp b/common/board_printout.cpp index 7a0cf421ee..0d39dd3fac 100644 --- a/common/board_printout.cpp +++ b/common/board_printout.cpp @@ -106,8 +106,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa // Set the color scheme - auto srcSettings = m_view->GetPainter()->GetSettings(); auto dstSettings = view->GetPainter()->GetSettings(); + dstSettings->LoadColors( m_settings.m_colorSettings ); if( m_settings.m_blackWhite ) { @@ -120,12 +120,11 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa { // Cairo does not support translucent colors on PostScript surfaces // see 'Features support by the PostScript surface' on - // ttps://www.cairographics.org/documentation/using_the_postscript_surface/ - dstSettings->SetLayerColor( i, srcSettings->GetLayerColor( i ).WithAlpha( 1.0 ) ); + // https://www.cairographics.org/documentation/using_the_postscript_surface/ + dstSettings->SetLayerColor( i, dstSettings->GetLayerColor( i ).WithAlpha( 1.0 ) ); } } - setupViewLayers( view, m_settings.m_layerSet ); setupPainter( painter ); @@ -170,6 +169,9 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa gal->SetLookAtPoint( bBox.Centre() ); gal->SetZoomFactor( m_settings.m_scale ); + gal->SetClearColor( dstSettings->GetBackgroundColor() ); + gal->ClearScreen(); + { KIGFX::GAL_DRAWING_CONTEXT ctx( gal ); view->Redraw(); @@ -194,7 +196,8 @@ void BOARD_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView, void BOARD_PRINTOUT::setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPainter ) { - aPainter->GetSettings()->SetBackgroundColor( COLOR4D::WHITE ); + if( !m_settings.m_background ) + aPainter->GetSettings()->SetBackgroundColor( COLOR4D::WHITE ); } diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index 75861380fb..69b63ea133 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -455,7 +455,7 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars() } -COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::ColorSettings() +COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings() { auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>(); diff --git a/cvpcb/display_footprints_frame.h b/cvpcb/display_footprints_frame.h index d8a3ccb825..c9be09cea9 100644 --- a/cvpcb/display_footprints_frame.h +++ b/cvpcb/display_footprints_frame.h @@ -80,7 +80,7 @@ public: bool GetAutoZoom() const { return m_autoZoom; } void SetAutoZoom( bool aEnable ) { m_autoZoom = aEnable; } - COLOR_SETTINGS* ColorSettings() override; + COLOR_SETTINGS* GetColorSettings() override; /** * Function GetGridColor() , virtual diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 3406698e61..bd5ad0812b 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -168,9 +168,9 @@ public: * Helper to retrieve the current color settings * @return a pointer to the active COLOR_SETTINGS */ - virtual COLOR_SETTINGS* ColorSettings() + virtual COLOR_SETTINGS* GetColorSettings() override { - wxFAIL_MSG( "Color settings requested for a frame that does not define them!" ); + wxFAIL_MSG( "Color settings requested for a PCB_BASE_FRAME that does not override!" ); return nullptr; } diff --git a/include/printout.h b/include/printout.h index 80f467259d..018822d15d 100644 --- a/include/printout.h +++ b/include/printout.h @@ -22,6 +22,7 @@ #include <page_info.h> class APP_SETTINGS_BASE; +class COLOR_SETTINGS; /** * PRINT_PARAMETERS @@ -36,6 +37,7 @@ struct PRINTOUT_SETTINGS m_titleBlock = false; m_blackWhite = true; m_pageCount = 0; + m_background = false; } virtual ~PRINTOUT_SETTINGS() @@ -49,8 +51,12 @@ struct PRINTOUT_SETTINGS bool m_titleBlock; ///< Print frame and title block bool m_blackWhite; ///< Print in B&W or Color int m_pageCount; ///< Number of pages to print + bool m_background; ///< Print background color const PAGE_INFO& m_pageInfo; + /// The color settings to be used for printing + COLOR_SETTINGS* m_colorSettings; + /** * Returns true if the drawing border and title block should be printed. */ diff --git a/pcbnew/dialogs/dialog_print_pcbnew.cpp b/pcbnew/dialogs/dialog_print_pcbnew.cpp index 986f2ce8ed..869ab56269 100644 --- a/pcbnew/dialogs/dialog_print_pcbnew.cpp +++ b/pcbnew/dialogs/dialog_print_pcbnew.cpp @@ -29,6 +29,7 @@ #include <confirm.h> #include <base_units.h> #include <pcbnew.h> +#include <pcbnew_settings.h> #include <pcbplot.h> #include <class_board.h> #include <tool/tool_manager.h> @@ -58,6 +59,9 @@ private: void onSelectAllClick( wxCommandEvent& event ); void onDeselectAllClick( wxCommandEvent& event ); + void onUseThemeChecked( wxCommandEvent& event ); + void onColorModeChanged( wxCommandEvent& event ); + ///> (Un)checks all items in a checklist box void setListBoxValue( wxCheckListBox* aList, bool aValue ); @@ -92,6 +96,10 @@ private: wxCheckBox* m_checkboxMirror; wxChoice* m_drillMarksChoice; wxRadioBox* m_boxPagination; + wxCheckBox* m_checkBackground; + wxCheckBox* m_checkUseTheme; + wxStaticText* m_lblTheme; + wxChoice* m_colorTheme; }; @@ -103,6 +111,9 @@ DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent, PCBNEW_P createExtraOptions(); createLeftPanel(); + + m_outputMode->Bind( + wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeChanged, this ); } @@ -137,6 +148,35 @@ bool DIALOG_PRINT_PCBNEW::TransferDataToWindow() m_checkboxNoEdge->SetValue( settings()->m_noEdgeLayer ); m_titleBlock->SetValue( settings()->m_titleBlock ); + PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings(); + + m_checkBackground->SetValue( cfg->m_Printing.background ); + m_checkUseTheme->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<void*>( 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 ) ); + + wxCommandEvent dummy; + onColorModeChanged( dummy ); + // Options to plot pads and vias holes m_drillMarksChoice->SetSelection( settings()->m_drillMarks ); @@ -157,6 +197,29 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions() int rows = optionsSizer->GetEffectiveRowsCount(); int cols = optionsSizer->GetEffectiveColsCount(); + m_checkBackground = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, + _( "Print background color" ), wxDefaultPosition, wxDefaultSize, 0 ); + optionsSizer->Add( m_checkBackground, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 ); + + m_checkUseTheme = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, + _( "Use a different color theme for printing" ), wxDefaultPosition, wxDefaultSize, 0 ); + optionsSizer->Add( m_checkUseTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 ); + + m_checkUseTheme->Bind( + wxEVT_COMMAND_CHECKBOX_CLICKED, &DIALOG_PRINT_PCBNEW::onUseThemeChecked, this ); + + m_lblTheme = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _( "Color theme:" ), + wxDefaultPosition, wxDefaultSize, 0 ); + m_lblTheme->Wrap( -1 ); + optionsSizer->Add( m_lblTheme, wxGBPosition( rows, 0 ), wxGBSpan( 1, 1 ), + wxALIGN_CENTER_VERTICAL | wxALL, 5 ); + + wxArrayString m_colorThemeChoices; + m_colorTheme = new wxChoice( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, + wxDefaultSize, m_colorThemeChoices, 0 ); + m_colorTheme->SetSelection( 0 ); + optionsSizer->Add( m_colorTheme, wxGBPosition( rows++, 1 ), wxGBSpan( 1, 2 ), wxALL, 5 ); + // Drill marks option auto drillMarksLabel = new wxStaticText( box, wxID_ANY, _( "Drill marks:" ) ); std::vector<wxString> drillMarkChoices = @@ -181,7 +244,8 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions() wxBOTTOM | wxRIGHT | wxLEFT, 5 ); optionsSizer->Add( m_checkboxMirror, wxGBPosition( rows + 1, 0 ), wxGBSpan( 1, cols ), wxBOTTOM | wxRIGHT | wxLEFT, 5 ); - optionsSizer->Add( m_boxPagination, wxGBPosition( rows + 2, 0 ), wxGBSpan( 1, cols ), wxALL | wxEXPAND, 5 ); + optionsSizer->Add( m_boxPagination, wxGBPosition( rows + 2, 0 ), wxGBSpan( 1, cols ), + wxALL | wxEXPAND, 5 ); } @@ -255,6 +319,26 @@ void DIALOG_PRINT_PCBNEW::onDeselectAllClick( wxCommandEvent& event ) } +void DIALOG_PRINT_PCBNEW::onUseThemeChecked( wxCommandEvent& event ) +{ + m_lblTheme->Enable( m_checkUseTheme->GetValue() ); + m_colorTheme->Enable( m_checkUseTheme->GetValue() ); +} + + +void DIALOG_PRINT_PCBNEW::onColorModeChanged( wxCommandEvent& event ) +{ + PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings(); + + m_settings->m_blackWhite = m_outputMode->GetSelection(); + + m_checkBackground->Enable( !m_settings->m_blackWhite ); + m_checkUseTheme->Enable( !m_settings->m_blackWhite ); + m_lblTheme->Enable( !m_settings->m_blackWhite && cfg->m_Printing.use_theme ); + m_colorTheme->Enable( !m_settings->m_blackWhite && cfg->m_Printing.use_theme ); +} + + void DIALOG_PRINT_PCBNEW::setListBoxValue( wxCheckListBox* aList, bool aValue ) { for( unsigned int i = 0; i < aList->GetCount(); ++i ) @@ -320,6 +404,29 @@ void DIALOG_PRINT_PCBNEW::saveSettings() settings()->m_mirror = m_checkboxMirror->GetValue(); + PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings(); + + cfg->m_Printing.background = m_checkBackground->GetValue(); + settings()->m_background = cfg->m_Printing.background; + cfg->m_Printing.use_theme = m_checkUseTheme->GetValue(); + + COLOR_SETTINGS* theme = static_cast<COLOR_SETTINGS*>( + m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) ); + + if( theme && m_checkUseTheme->IsChecked() ) + { + cfg->m_Printing.color_theme = theme->GetFilename(); + settings()->m_colorSettings = theme; + } + else + { + // This should always work, but in case it doesn't we fall back on default colors + if( auto pcbframe = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_parent ) ) + settings()->m_colorSettings = pcbframe->GetColorSettings(); + else + settings()->m_colorSettings = m_parent->GetColorSettings(); + } + DIALOG_PRINT_GENERIC::saveSettings(); } diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index d45fd126e7..ddeef39e63 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -456,7 +456,7 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) } -COLOR_SETTINGS* FOOTPRINT_EDIT_FRAME::ColorSettings() +COLOR_SETTINGS* FOOTPRINT_EDIT_FRAME::GetColorSettings() { return Pgm().GetSettingsManager().GetColorSettings( GetFootprintEditorSettings()->m_ColorTheme ); diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index dc6e10bdd2..e6857dd5f8 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -82,7 +82,7 @@ public: void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; - COLOR_SETTINGS* ColorSettings() override; + COLOR_SETTINGS* GetColorSettings() override; const BOX2I GetDocumentExtents() const override; diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index f5473e80f8..86a2b6a405 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -430,7 +430,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor() { - return ColorSettings()->GetColor( LAYER_GRID ); + return GetColorSettings()->GetColor( LAYER_GRID ); } diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 5256b3674f..f994295fc4 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -743,7 +743,7 @@ WINDOW_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetWindowSettings( APP_SETTINGS_BASE* a } -COLOR_SETTINGS* FOOTPRINT_VIEWER_FRAME::ColorSettings() +COLOR_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetColorSettings() { auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>(); @@ -886,7 +886,7 @@ void FOOTPRINT_VIEWER_FRAME::Update3DView( bool aForceReload, const wxString* aT COLOR4D FOOTPRINT_VIEWER_FRAME::GetGridColor() { - return ColorSettings()->GetColor( LAYER_GRID ); + return GetColorSettings()->GetColor( LAYER_GRID ); } diff --git a/pcbnew/footprint_viewer_frame.h b/pcbnew/footprint_viewer_frame.h index d9cdab6e8e..79292c337a 100644 --- a/pcbnew/footprint_viewer_frame.h +++ b/pcbnew/footprint_viewer_frame.h @@ -80,7 +80,7 @@ public: */ bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override; - COLOR_SETTINGS* ColorSettings() override; + COLOR_SETTINGS* GetColorSettings() override; private: wxTextCtrl* m_libFilter; diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index cc1ff2cd9e..a8409619b0 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -294,7 +294,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv ) } -COLOR_SETTINGS* FOOTPRINT_WIZARD_FRAME::ColorSettings() +COLOR_SETTINGS* FOOTPRINT_WIZARD_FRAME::GetColorSettings() { return Pgm().GetSettingsManager().GetColorSettings( GetFootprintEditorSettings()->m_ColorTheme ); diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h index a22823ba02..1980e3e8d6 100644 --- a/pcbnew/footprint_wizard_frame.h +++ b/pcbnew/footprint_wizard_frame.h @@ -85,7 +85,7 @@ public: */ void PythonPluginsReload(); - COLOR_SETTINGS* ColorSettings() override; + COLOR_SETTINGS* GetColorSettings() override; private: diff --git a/pcbnew/grid_layer_box_helpers.cpp b/pcbnew/grid_layer_box_helpers.cpp index f068bdf000..22be5f2d7d 100644 --- a/pcbnew/grid_layer_box_helpers.cpp +++ b/pcbnew/grid_layer_box_helpers.cpp @@ -58,7 +58,7 @@ void GRID_CELL_LAYER_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& // draw the swatch wxBitmap bitmap( 14, 14 ); - COLOR_SETTINGS* cs = m_frame->ColorSettings(); + COLOR_SETTINGS* cs = m_frame->GetColorSettings(); LAYER_SELECTOR::DrawColorSwatch( bitmap, cs->GetColor( ToLAYER_ID( LAYER_PCB_BACKGROUND ) ), cs->GetColor( ToLAYER_ID( value ) ) ); diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 3192f59c98..26ca903470 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -136,7 +136,7 @@ void PCB_BASE_EDIT_FRAME::SetGridVisibility( bool aVisible ) } -COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::ColorSettings() +COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings() { return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme ); } diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index a89d5dfa28..0dfa4e9cbb 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -190,7 +190,7 @@ public: void OnGridSettings( wxCommandEvent& aEvent ) override; - COLOR_SETTINGS* ColorSettings() override; + COLOR_SETTINGS* GetColorSettings() override; protected: /// User defined rotation angle (in tenths of a degree). diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 5c1ec3056b..101a4cc930 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -933,7 +933,7 @@ void PCB_BASE_FRAME::ActivateGalCanvas() auto settings = painter->GetSettings(); auto displ_opts = GetDisplayOptions(); settings->LoadDisplayOptions( displ_opts, ShowPageLimits() ); - settings->LoadColors( ColorSettings() ); + settings->LoadColors( GetColorSettings() ); canvas->GetView()->RecacheAllItems(); canvas->SetEventDispatcher( m_toolDispatcher ); diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index ef0b4dfa3f..cde9016208 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -211,7 +211,7 @@ void PCB_DRAW_PANEL_GAL::UpdateColors() if( frame ) { - cs = frame->ColorSettings(); + cs = frame->GetColorSettings(); } else { diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 086379eeff..cea6011741 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -669,14 +669,14 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) COLOR4D PCB_EDIT_FRAME::GetGridColor() { - return ColorSettings()->GetColor( LAYER_GRID ); + return GetColorSettings()->GetColor( LAYER_GRID ); } void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor ) { - ColorSettings()->SetColor( LAYER_GRID, aColor ); + GetColorSettings()->SetColor( LAYER_GRID, aColor ); GetCanvas()->GetGAL()->SetGridColor( aColor ); } diff --git a/pcbnew/pcb_layer_box_selector.cpp b/pcbnew/pcb_layer_box_selector.cpp index a3f62f6702..5474c38436 100644 --- a/pcbnew/pcb_layer_box_selector.cpp +++ b/pcbnew/pcb_layer_box_selector.cpp @@ -164,7 +164,7 @@ COLOR4D PCB_LAYER_BOX_SELECTOR::getLayerColor( LAYER_NUM aLayer ) const { wxASSERT( m_boardFrame ); - return m_boardFrame->ColorSettings()->GetColor( aLayer ); + return m_boardFrame->GetColorSettings()->GetColor( aLayer ); } diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index 250ba084a1..ab00d7cef7 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -122,7 +122,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn COLOR4D PCB_LAYER_WIDGET::getBackgroundLayerColor() { - return myframe->ColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); + return myframe->GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); } @@ -345,9 +345,9 @@ void PCB_LAYER_WIDGET::ReFillRender() if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color? { // this window frame must have an established BOARD, i.e. after SetBoard() - renderRow.color = myframe->ColorSettings()->GetColor( + renderRow.color = myframe->GetColorSettings()->GetColor( static_cast<GAL_LAYER_ID>( renderRow.id ) ); - renderRow.defaultColor = myframe->ColorSettings()->GetDefaultColor( + renderRow.defaultColor = myframe->GetColorSettings()->GetDefaultColor( static_cast<GAL_LAYER_ID>( renderRow.id ) ); } @@ -453,8 +453,8 @@ void PCB_LAYER_WIDGET::ReFill() } AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, - myframe->ColorSettings()->GetColor( layer ), dsc, true, true, - myframe->ColorSettings()->GetDefaultColor( layer ) ) ); + myframe->GetColorSettings()->GetColor( layer ), dsc, true, true, + myframe->GetColorSettings()->GetDefaultColor( layer ) ) ); if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) ) { @@ -501,9 +501,9 @@ void PCB_LAYER_WIDGET::ReFill() continue; AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, - myframe->ColorSettings()->GetColor( layer ), + myframe->GetColorSettings()->GetColor( layer ), wxGetTranslation( non_cu_seq[i].tooltip ), true, true, - myframe->ColorSettings()->GetDefaultColor( layer ) ) ); + myframe->GetColorSettings()->GetDefaultColor( layer ) ) ); if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) ) { @@ -518,7 +518,7 @@ void PCB_LAYER_WIDGET::ReFill() void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor ) { - COLOR_SETTINGS* cs = myframe->ColorSettings(); + COLOR_SETTINGS* cs = myframe->GetColorSettings(); cs->SetColor( aLayer, aColor ); myframe->GetCanvas()->UpdateColors(); @@ -606,7 +606,7 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor ) { wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END ); - myframe->ColorSettings()->SetColor( aId, aColor ); + myframe->GetColorSettings()->SetColor( aId, aColor ); myframe->GetCanvas()->UpdateColors(); KIGFX::VIEW* view = myframe->GetCanvas()->GetView(); diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 5260aad2c3..6c20ae99de 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -64,7 +64,7 @@ protected: // Virtual function COLOR4D getLayerColor( LAYER_NUM aLayer ) const override { - return m_frame->ColorSettings()->GetColor( aLayer ); + return m_frame->GetColorSettings()->GetColor( aLayer ); } // Returns the name of the layer id diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index f320831dc0..010f286b04 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -100,7 +100,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) change = true; } - active_layer_color = ColorSettings()->GetColor( GetActiveLayer() ); + active_layer_color = GetColorSettings()->GetColor( GetActiveLayer() ); if( m_prevIconVal.previous_active_layer_color != active_layer_color ) { @@ -108,7 +108,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) change = true; } - top_color = ColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP ); + top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP ); if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color ) { @@ -116,7 +116,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) change = true; } - bottom_color = ColorSettings()->GetColor( GetScreen()->m_Route_Layer_BOTTOM ); + bottom_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_BOTTOM ); if( m_prevIconVal.previous_Route_Layer_BOTTOM_color != bottom_color ) { @@ -125,7 +125,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) } int via_type = static_cast<int>( GetDesignSettings().m_CurrentViaType ); - via_color = ColorSettings()->GetColor( LAYER_VIAS + via_type ); + via_color = GetColorSettings()->GetColor( LAYER_VIAS + via_type ); if( m_prevIconVal.previous_via_color != via_color ) { @@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) change = true; } - background_color = ColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); + background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); if( m_prevIconVal.previous_background_color != background_color ) { diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index c6dd0688eb..7507cf844d 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -403,7 +403,7 @@ int PCBNEW_CONTROL::LayerToggle( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent ) { - auto settings = m_frame->ColorSettings(); + auto settings = m_frame->GetColorSettings(); LAYER_NUM currentLayer = m_frame->GetActiveLayer(); KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer ); @@ -429,7 +429,7 @@ int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent ) { - auto settings = m_frame->ColorSettings(); + auto settings = m_frame->GetColorSettings(); LAYER_NUM currentLayer = m_frame->GetActiveLayer(); KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer ); diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 9e4fc7312a..5d9df68ec8 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -182,7 +182,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* bool aShowCopper, bool aFpEditorMode ) { BOARD* board = aFrame->GetBoard(); - COLOR4D backgroundColor = aFrame->ColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); + COLOR4D backgroundColor = aFrame->GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); LSET layers = aShowCopper ? LSET::AllCuMask( board->GetCopperLayerCount() ) : LSET::AllNonCuMask(); @@ -203,7 +203,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* // wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here textWidth = std::max( textWidth, GetTextSize( layerName, aList ).x ); - COLOR4D layerColor = aFrame->ColorSettings()->GetColor( layerID ); + COLOR4D layerColor = aFrame->GetColorSettings()->GetColor( layerID ); auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ); wxIcon icon; icon.CopyFromBitmap( bitmap );