Bring panel_pcbnew_color_settings in line with eeschema equivalent.
Also fixes a bug where color changes weren't getting saved because the set of valid layers didn't include the copper layers.
This commit is contained in:
parent
6075112ea0
commit
aa8fb38445
|
@ -38,27 +38,22 @@ PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS( PCB_EDIT_FRAME* aFrame
|
||||||
m_page( nullptr ),
|
m_page( nullptr ),
|
||||||
m_titleBlock( nullptr )
|
m_titleBlock( nullptr )
|
||||||
{
|
{
|
||||||
// Currently this only applies to eeschema
|
|
||||||
m_optOverrideColors->Hide();
|
|
||||||
|
|
||||||
m_colorNamespace = "board";
|
m_colorNamespace = "board";
|
||||||
|
|
||||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||||
|
|
||||||
|
mgr.ReloadColorSettings();
|
||||||
|
|
||||||
PCBNEW_SETTINGS* app_settings = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
PCBNEW_SETTINGS* app_settings = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||||
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
||||||
|
|
||||||
// Store the current settings before reloading below
|
createThemeList( app_settings->m_ColorTheme );
|
||||||
current->Store();
|
|
||||||
mgr.SaveColorSettings( current, "board" );
|
|
||||||
|
|
||||||
m_optOverrideColors->SetValue( current->GetOverrideSchItemColors() );
|
// Currently this only applies to eeschema
|
||||||
|
m_optOverrideColors->Hide();
|
||||||
|
|
||||||
m_currentSettings = new COLOR_SETTINGS( *current );
|
m_currentSettings = new COLOR_SETTINGS( *current );
|
||||||
|
|
||||||
mgr.ReloadColorSettings();
|
|
||||||
createThemeList( app_settings->m_ColorTheme );
|
|
||||||
|
|
||||||
for( int id = GAL_LAYER_ID_START; id < GAL_LAYER_ID_BITMASK_END; id++ )
|
for( int id = GAL_LAYER_ID_START; id < GAL_LAYER_ID_BITMASK_END; id++ )
|
||||||
{
|
{
|
||||||
if( id == LAYER_VIAS || id == LAYER_GRID_AXES || id == LAYER_PADS_PLATEDHOLES
|
if( id == LAYER_VIAS || id == LAYER_GRID_AXES || id == LAYER_PADS_PLATEDHOLES
|
||||||
|
@ -91,8 +86,6 @@ PANEL_PCBNEW_COLOR_SETTINGS::~PANEL_PCBNEW_COLOR_SETTINGS()
|
||||||
|
|
||||||
bool PANEL_PCBNEW_COLOR_SETTINGS::TransferDataFromWindow()
|
bool PANEL_PCBNEW_COLOR_SETTINGS::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
m_currentSettings->SetOverrideSchItemColors( m_optOverrideColors->GetValue() );
|
|
||||||
|
|
||||||
if( !saveCurrentTheme( true ) )
|
if( !saveCurrentTheme( true ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -116,9 +109,7 @@ bool PANEL_PCBNEW_COLOR_SETTINGS::TransferDataToWindow()
|
||||||
|
|
||||||
void PANEL_PCBNEW_COLOR_SETTINGS::createSwatches()
|
void PANEL_PCBNEW_COLOR_SETTINGS::createSwatches()
|
||||||
{
|
{
|
||||||
std::vector<int> layers( m_validLayers );
|
std::sort( m_validLayers.begin(), m_validLayers.end(),
|
||||||
|
|
||||||
std::sort( layers.begin(), layers.end(),
|
|
||||||
[]( int a, int b )
|
[]( int a, int b )
|
||||||
{
|
{
|
||||||
return LayerName( a ) < LayerName( b );
|
return LayerName( a ) < LayerName( b );
|
||||||
|
@ -126,11 +117,11 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createSwatches()
|
||||||
|
|
||||||
// Don't sort board layers by name
|
// Don't sort board layers by name
|
||||||
for( int i = PCBNEW_LAYER_ID_START; i < PCB_LAYER_ID_COUNT; ++i )
|
for( int i = PCBNEW_LAYER_ID_START; i < PCB_LAYER_ID_COUNT; ++i )
|
||||||
layers.insert( layers.begin() + i, i );
|
m_validLayers.insert( m_validLayers.begin() + i, i );
|
||||||
|
|
||||||
BOARD* board = m_frame->GetBoard();
|
BOARD* board = m_frame->GetBoard();
|
||||||
|
|
||||||
for( int layer : layers )
|
for( int layer : m_validLayers )
|
||||||
{
|
{
|
||||||
wxString name = LayerName( layer );
|
wxString name = LayerName( layer );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue