ADDED: Enable color themes for PcbNew printing
This commit is contained in:
parent
d599648ec7
commit
f2e003147e
|
@ -106,8 +106,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
|
||||||
|
|
||||||
|
|
||||||
// Set the color scheme
|
// Set the color scheme
|
||||||
auto srcSettings = m_view->GetPainter()->GetSettings();
|
|
||||||
auto dstSettings = view->GetPainter()->GetSettings();
|
auto dstSettings = view->GetPainter()->GetSettings();
|
||||||
|
dstSettings->LoadColors( m_settings.m_colorSettings );
|
||||||
|
|
||||||
if( m_settings.m_blackWhite )
|
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
|
// Cairo does not support translucent colors on PostScript surfaces
|
||||||
// see 'Features support by the PostScript surface' on
|
// see 'Features support by the PostScript surface' on
|
||||||
// ttps://www.cairographics.org/documentation/using_the_postscript_surface/
|
// https://www.cairographics.org/documentation/using_the_postscript_surface/
|
||||||
dstSettings->SetLayerColor( i, srcSettings->GetLayerColor( i ).WithAlpha( 1.0 ) );
|
dstSettings->SetLayerColor( i, dstSettings->GetLayerColor( i ).WithAlpha( 1.0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setupViewLayers( view, m_settings.m_layerSet );
|
setupViewLayers( view, m_settings.m_layerSet );
|
||||||
setupPainter( painter );
|
setupPainter( painter );
|
||||||
|
|
||||||
|
@ -170,6 +169,9 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
|
||||||
gal->SetLookAtPoint( bBox.Centre() );
|
gal->SetLookAtPoint( bBox.Centre() );
|
||||||
gal->SetZoomFactor( m_settings.m_scale );
|
gal->SetZoomFactor( m_settings.m_scale );
|
||||||
|
|
||||||
|
gal->SetClearColor( dstSettings->GetBackgroundColor() );
|
||||||
|
gal->ClearScreen();
|
||||||
|
|
||||||
{
|
{
|
||||||
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
|
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
|
||||||
view->Redraw();
|
view->Redraw();
|
||||||
|
@ -194,6 +196,7 @@ void BOARD_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView,
|
||||||
|
|
||||||
void BOARD_PRINTOUT::setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPainter )
|
void BOARD_PRINTOUT::setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPainter )
|
||||||
{
|
{
|
||||||
|
if( !m_settings.m_background )
|
||||||
aPainter->GetSettings()->SetBackgroundColor( COLOR4D::WHITE );
|
aPainter->GetSettings()->SetBackgroundColor( COLOR4D::WHITE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>();
|
auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
bool GetAutoZoom() const { return m_autoZoom; }
|
bool GetAutoZoom() const { return m_autoZoom; }
|
||||||
void SetAutoZoom( bool aEnable ) { m_autoZoom = aEnable; }
|
void SetAutoZoom( bool aEnable ) { m_autoZoom = aEnable; }
|
||||||
|
|
||||||
COLOR_SETTINGS* ColorSettings() override;
|
COLOR_SETTINGS* GetColorSettings() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGridColor() , virtual
|
* Function GetGridColor() , virtual
|
||||||
|
|
|
@ -168,9 +168,9 @@ public:
|
||||||
* Helper to retrieve the current color settings
|
* Helper to retrieve the current color settings
|
||||||
* @return a pointer to the active 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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <page_info.h>
|
#include <page_info.h>
|
||||||
|
|
||||||
class APP_SETTINGS_BASE;
|
class APP_SETTINGS_BASE;
|
||||||
|
class COLOR_SETTINGS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PRINT_PARAMETERS
|
* PRINT_PARAMETERS
|
||||||
|
@ -36,6 +37,7 @@ struct PRINTOUT_SETTINGS
|
||||||
m_titleBlock = false;
|
m_titleBlock = false;
|
||||||
m_blackWhite = true;
|
m_blackWhite = true;
|
||||||
m_pageCount = 0;
|
m_pageCount = 0;
|
||||||
|
m_background = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~PRINTOUT_SETTINGS()
|
virtual ~PRINTOUT_SETTINGS()
|
||||||
|
@ -49,8 +51,12 @@ struct PRINTOUT_SETTINGS
|
||||||
bool m_titleBlock; ///< Print frame and title block
|
bool m_titleBlock; ///< Print frame and title block
|
||||||
bool m_blackWhite; ///< Print in B&W or Color
|
bool m_blackWhite; ///< Print in B&W or Color
|
||||||
int m_pageCount; ///< Number of pages to print
|
int m_pageCount; ///< Number of pages to print
|
||||||
|
bool m_background; ///< Print background color
|
||||||
const PAGE_INFO& m_pageInfo;
|
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.
|
* Returns true if the drawing border and title block should be printed.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
|
#include <pcbnew_settings.h>
|
||||||
#include <pcbplot.h>
|
#include <pcbplot.h>
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
@ -58,6 +59,9 @@ private:
|
||||||
void onSelectAllClick( wxCommandEvent& event );
|
void onSelectAllClick( wxCommandEvent& event );
|
||||||
void onDeselectAllClick( wxCommandEvent& event );
|
void onDeselectAllClick( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void onUseThemeChecked( wxCommandEvent& event );
|
||||||
|
void onColorModeChanged( wxCommandEvent& event );
|
||||||
|
|
||||||
///> (Un)checks all items in a checklist box
|
///> (Un)checks all items in a checklist box
|
||||||
void setListBoxValue( wxCheckListBox* aList, bool aValue );
|
void setListBoxValue( wxCheckListBox* aList, bool aValue );
|
||||||
|
|
||||||
|
@ -92,6 +96,10 @@ private:
|
||||||
wxCheckBox* m_checkboxMirror;
|
wxCheckBox* m_checkboxMirror;
|
||||||
wxChoice* m_drillMarksChoice;
|
wxChoice* m_drillMarksChoice;
|
||||||
wxRadioBox* m_boxPagination;
|
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();
|
createExtraOptions();
|
||||||
createLeftPanel();
|
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_checkboxNoEdge->SetValue( settings()->m_noEdgeLayer );
|
||||||
m_titleBlock->SetValue( settings()->m_titleBlock );
|
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
|
// Options to plot pads and vias holes
|
||||||
m_drillMarksChoice->SetSelection( settings()->m_drillMarks );
|
m_drillMarksChoice->SetSelection( settings()->m_drillMarks );
|
||||||
|
|
||||||
|
@ -157,6 +197,29 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions()
|
||||||
int rows = optionsSizer->GetEffectiveRowsCount();
|
int rows = optionsSizer->GetEffectiveRowsCount();
|
||||||
int cols = optionsSizer->GetEffectiveColsCount();
|
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
|
// Drill marks option
|
||||||
auto drillMarksLabel = new wxStaticText( box, wxID_ANY, _( "Drill marks:" ) );
|
auto drillMarksLabel = new wxStaticText( box, wxID_ANY, _( "Drill marks:" ) );
|
||||||
std::vector<wxString> drillMarkChoices =
|
std::vector<wxString> drillMarkChoices =
|
||||||
|
@ -181,7 +244,8 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions()
|
||||||
wxBOTTOM | wxRIGHT | wxLEFT, 5 );
|
wxBOTTOM | wxRIGHT | wxLEFT, 5 );
|
||||||
optionsSizer->Add( m_checkboxMirror, wxGBPosition( rows + 1, 0 ), wxGBSpan( 1, cols ),
|
optionsSizer->Add( m_checkboxMirror, wxGBPosition( rows + 1, 0 ), wxGBSpan( 1, cols ),
|
||||||
wxBOTTOM | wxRIGHT | wxLEFT, 5 );
|
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 )
|
void DIALOG_PRINT_PCBNEW::setListBoxValue( wxCheckListBox* aList, bool aValue )
|
||||||
{
|
{
|
||||||
for( unsigned int i = 0; i < aList->GetCount(); ++i )
|
for( unsigned int i = 0; i < aList->GetCount(); ++i )
|
||||||
|
@ -320,6 +404,29 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
|
||||||
|
|
||||||
settings()->m_mirror = m_checkboxMirror->GetValue();
|
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();
|
DIALOG_PRINT_GENERIC::saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(
|
return Pgm().GetSettingsManager().GetColorSettings(
|
||||||
GetFootprintEditorSettings()->m_ColorTheme );
|
GetFootprintEditorSettings()->m_ColorTheme );
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||||
void SaveSettings( 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;
|
const BOX2I GetDocumentExtents() const override;
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
||||||
|
|
||||||
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
|
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
|
||||||
{
|
{
|
||||||
return ColorSettings()->GetColor( LAYER_GRID );
|
return GetColorSettings()->GetColor( LAYER_GRID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>();
|
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()
|
COLOR4D FOOTPRINT_VIEWER_FRAME::GetGridColor()
|
||||||
{
|
{
|
||||||
return ColorSettings()->GetColor( LAYER_GRID );
|
return GetColorSettings()->GetColor( LAYER_GRID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
|
bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
|
||||||
|
|
||||||
COLOR_SETTINGS* ColorSettings() override;
|
COLOR_SETTINGS* GetColorSettings() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxTextCtrl* m_libFilter;
|
wxTextCtrl* m_libFilter;
|
||||||
|
|
|
@ -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(
|
return Pgm().GetSettingsManager().GetColorSettings(
|
||||||
GetFootprintEditorSettings()->m_ColorTheme );
|
GetFootprintEditorSettings()->m_ColorTheme );
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void PythonPluginsReload();
|
void PythonPluginsReload();
|
||||||
|
|
||||||
COLOR_SETTINGS* ColorSettings() override;
|
COLOR_SETTINGS* GetColorSettings() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ void GRID_CELL_LAYER_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC&
|
||||||
|
|
||||||
// draw the swatch
|
// draw the swatch
|
||||||
wxBitmap bitmap( 14, 14 );
|
wxBitmap bitmap( 14, 14 );
|
||||||
COLOR_SETTINGS* cs = m_frame->ColorSettings();
|
COLOR_SETTINGS* cs = m_frame->GetColorSettings();
|
||||||
LAYER_SELECTOR::DrawColorSwatch( bitmap,
|
LAYER_SELECTOR::DrawColorSwatch( bitmap,
|
||||||
cs->GetColor( ToLAYER_ID( LAYER_PCB_BACKGROUND ) ),
|
cs->GetColor( ToLAYER_ID( LAYER_PCB_BACKGROUND ) ),
|
||||||
cs->GetColor( ToLAYER_ID( value ) ) );
|
cs->GetColor( ToLAYER_ID( value ) ) );
|
||||||
|
|
|
@ -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 );
|
return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme );
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ public:
|
||||||
|
|
||||||
void OnGridSettings( wxCommandEvent& aEvent ) override;
|
void OnGridSettings( wxCommandEvent& aEvent ) override;
|
||||||
|
|
||||||
COLOR_SETTINGS* ColorSettings() override;
|
COLOR_SETTINGS* GetColorSettings() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// User defined rotation angle (in tenths of a degree).
|
/// User defined rotation angle (in tenths of a degree).
|
||||||
|
|
|
@ -933,7 +933,7 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
|
||||||
auto settings = painter->GetSettings();
|
auto settings = painter->GetSettings();
|
||||||
auto displ_opts = GetDisplayOptions();
|
auto displ_opts = GetDisplayOptions();
|
||||||
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
|
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
|
||||||
settings->LoadColors( ColorSettings() );
|
settings->LoadColors( GetColorSettings() );
|
||||||
|
|
||||||
canvas->GetView()->RecacheAllItems();
|
canvas->GetView()->RecacheAllItems();
|
||||||
canvas->SetEventDispatcher( m_toolDispatcher );
|
canvas->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
|
|
@ -211,7 +211,7 @@ void PCB_DRAW_PANEL_GAL::UpdateColors()
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
{
|
{
|
||||||
cs = frame->ColorSettings();
|
cs = frame->GetColorSettings();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -669,14 +669,14 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
|
|
||||||
COLOR4D PCB_EDIT_FRAME::GetGridColor()
|
COLOR4D PCB_EDIT_FRAME::GetGridColor()
|
||||||
{
|
{
|
||||||
return ColorSettings()->GetColor( LAYER_GRID );
|
return GetColorSettings()->GetColor( LAYER_GRID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
|
void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
|
||||||
{
|
{
|
||||||
|
|
||||||
ColorSettings()->SetColor( LAYER_GRID, aColor );
|
GetColorSettings()->SetColor( LAYER_GRID, aColor );
|
||||||
GetCanvas()->GetGAL()->SetGridColor( aColor );
|
GetCanvas()->GetGAL()->SetGridColor( aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ COLOR4D PCB_LAYER_BOX_SELECTOR::getLayerColor( LAYER_NUM aLayer ) const
|
||||||
{
|
{
|
||||||
wxASSERT( m_boardFrame );
|
wxASSERT( m_boardFrame );
|
||||||
|
|
||||||
return m_boardFrame->ColorSettings()->GetColor( aLayer );
|
return m_boardFrame->GetColorSettings()->GetColor( aLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn
|
||||||
|
|
||||||
COLOR4D PCB_LAYER_WIDGET::getBackgroundLayerColor()
|
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?
|
if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color?
|
||||||
{
|
{
|
||||||
// this window frame must have an established BOARD, i.e. after SetBoard()
|
// 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 ) );
|
static_cast<GAL_LAYER_ID>( renderRow.id ) );
|
||||||
renderRow.defaultColor = myframe->ColorSettings()->GetDefaultColor(
|
renderRow.defaultColor = myframe->GetColorSettings()->GetDefaultColor(
|
||||||
static_cast<GAL_LAYER_ID>( renderRow.id ) );
|
static_cast<GAL_LAYER_ID>( renderRow.id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,8 +453,8 @@ void PCB_LAYER_WIDGET::ReFill()
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
|
AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
|
||||||
myframe->ColorSettings()->GetColor( layer ), dsc, true, true,
|
myframe->GetColorSettings()->GetColor( layer ), dsc, true, true,
|
||||||
myframe->ColorSettings()->GetDefaultColor( layer ) ) );
|
myframe->GetColorSettings()->GetDefaultColor( layer ) ) );
|
||||||
|
|
||||||
if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
|
if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
|
||||||
{
|
{
|
||||||
|
@ -501,9 +501,9 @@ void PCB_LAYER_WIDGET::ReFill()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
|
AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
|
||||||
myframe->ColorSettings()->GetColor( layer ),
|
myframe->GetColorSettings()->GetColor( layer ),
|
||||||
wxGetTranslation( non_cu_seq[i].tooltip ), true, true,
|
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 ) )
|
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 )
|
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
|
||||||
{
|
{
|
||||||
COLOR_SETTINGS* cs = myframe->ColorSettings();
|
COLOR_SETTINGS* cs = myframe->GetColorSettings();
|
||||||
cs->SetColor( aLayer, aColor );
|
cs->SetColor( aLayer, aColor );
|
||||||
|
|
||||||
myframe->GetCanvas()->UpdateColors();
|
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 );
|
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
|
||||||
|
|
||||||
myframe->ColorSettings()->SetColor( aId, aColor );
|
myframe->GetColorSettings()->SetColor( aId, aColor );
|
||||||
myframe->GetCanvas()->UpdateColors();
|
myframe->GetCanvas()->UpdateColors();
|
||||||
|
|
||||||
KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
|
KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
|
||||||
|
|
|
@ -64,7 +64,7 @@ protected:
|
||||||
// Virtual function
|
// Virtual function
|
||||||
COLOR4D getLayerColor( LAYER_NUM aLayer ) const override
|
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
|
// Returns the name of the layer id
|
||||||
|
|
|
@ -100,7 +100,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
active_layer_color = ColorSettings()->GetColor( GetActiveLayer() );
|
active_layer_color = GetColorSettings()->GetColor( GetActiveLayer() );
|
||||||
|
|
||||||
if( m_prevIconVal.previous_active_layer_color != active_layer_color )
|
if( m_prevIconVal.previous_active_layer_color != active_layer_color )
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
|
||||||
change = true;
|
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 )
|
if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color )
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
|
||||||
change = true;
|
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 )
|
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 );
|
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 )
|
if( m_prevIconVal.previous_via_color != via_color )
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
background_color = ColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
|
background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
|
||||||
|
|
||||||
if( m_prevIconVal.previous_background_color != background_color )
|
if( m_prevIconVal.previous_background_color != background_color )
|
||||||
{
|
{
|
||||||
|
|
|
@ -403,7 +403,7 @@ int PCBNEW_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerAlphaInc( 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();
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
||||||
KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
|
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 )
|
int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
auto settings = m_frame->ColorSettings();
|
auto settings = m_frame->GetColorSettings();
|
||||||
|
|
||||||
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
||||||
KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
|
KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
|
||||||
|
|
|
@ -182,7 +182,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
|
||||||
bool aShowCopper, bool aFpEditorMode )
|
bool aShowCopper, bool aFpEditorMode )
|
||||||
{
|
{
|
||||||
BOARD* board = aFrame->GetBoard();
|
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 layers = aShowCopper ? LSET::AllCuMask( board->GetCopperLayerCount() )
|
||||||
: LSET::AllNonCuMask();
|
: 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
|
// wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
|
||||||
textWidth = std::max( textWidth, GetTextSize( layerName, aList ).x );
|
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 );
|
auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE );
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
icon.CopyFromBitmap( bitmap );
|
icon.CopyFromBitmap( bitmap );
|
||||||
|
|
Loading…
Reference in New Issue