diff --git a/common/layer_id.cpp b/common/layer_id.cpp index f0b2b65418..9dcc8f1cda 100644 --- a/common/layer_id.cpp +++ b/common/layer_id.cpp @@ -154,6 +154,7 @@ wxString LayerName( int aLayer ) case LAYER_VIA_THROUGH: return _( "Through Via" ); case LAYER_VIA_BBLIND: return _( "Bl/Buried Via" ); case LAYER_VIA_MICROVIA: return _( "Micro Via" ); + case LAYER_VIAS_HOLES: return _( "Via Holes" ); case LAYER_NON_PLATEDHOLES: return _( "Non Plated Holes" ); case LAYER_RATSNEST: return _( "Ratsnest" ); case LAYER_NO_CONNECTS: return _( "No-Connects" ); diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index c77071792c..6284e9ba8d 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -26,7 +26,7 @@ ///! Update the schema version whenever a migration is required -const int colorsSchemaVersion = 1; +const int colorsSchemaVersion = 2; COLOR_SETTINGS::COLOR_SETTINGS( wxString aFilename ) : @@ -139,7 +139,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( wxString aFilename ) : CLR( "board.select_overlay", LAYER_SELECT_OVERLAY, COLOR4D( PUREGREEN ) ); CLR( "board.through_via", LAYER_VIA_THROUGH, COLOR4D( LIGHTGRAY ) ); CLR( "board.via_blind_buried", LAYER_VIA_BBLIND, COLOR4D( BROWN ) ); - CLR( "board.via_hole", LAYER_VIAS_HOLES, COLOR4D( WHITE ) ); + CLR( "board.via_hole", LAYER_VIAS_HOLES, COLOR4D( 0.5, 0.4, 0, 0.8 ) ); CLR( "board.via_micro", LAYER_VIA_MICROVIA, COLOR4D( CYAN ) ); CLR( "board.via_through", LAYER_VIA_THROUGH, COLOR4D( LIGHTGRAY ) ); CLR( "board.worksheet", LAYER_WORKSHEET, COLOR4D( DARKRED ) ); @@ -266,11 +266,19 @@ bool COLOR_SETTINGS::Migrate() ret &= migrateSchema0to1(); if( ret ) - { - ( *this )[PointerFromString( "meta.version" )] = 1; - } + filever = 1; } + if( filever == 1 ) + { + ret &= migrateSchema1to2(); + + if( ret ) + filever = 2; + } + + ( *this )[PointerFromString( "meta.version" )] = filever; + return ret; } @@ -323,6 +331,17 @@ bool COLOR_SETTINGS::migrateSchema0to1() } +bool COLOR_SETTINGS::migrateSchema1to2() +{ + // Fix LAYER_VIAS_HOLES color - before version 2, this setting had no effect + nlohmann::json::json_pointer ptr( "/board/via_hole"); + + ( *this )[ptr] = COLOR4D( 0.5, 0.4, 0, 0.8 ).ToWxString( wxC2S_CSS_SYNTAX ); + + return true; +} + + COLOR4D COLOR_SETTINGS::GetColor( int aLayer ) const { if( m_colors.count( aLayer ) ) diff --git a/common/settings/json_settings.cpp b/common/settings/json_settings.cpp index b9de808f32..b282b57bae 100644 --- a/common/settings/json_settings.cpp +++ b/common/settings/json_settings.cpp @@ -274,7 +274,7 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) } // And write-out immediately so that we don't lose data if the program later crashes. - SaveToFile( aDirectory ); + SaveToFile( aDirectory, true ); } return success; diff --git a/include/settings/color_settings.h b/include/settings/color_settings.h index 7f8010fdf9..426ec26c95 100644 --- a/include/settings/color_settings.h +++ b/include/settings/color_settings.h @@ -90,6 +90,7 @@ public: private: bool migrateSchema0to1(); + bool migrateSchema1to2(); void initFromOther( const COLOR_SETTINGS& aOther ); diff --git a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp index 56e0e5f7c9..c22678532e 100644 --- a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp @@ -363,7 +363,6 @@ std::set g_excludedLayers = LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_BK, LAYER_PADS_PLATEDHOLES, - LAYER_VIAS_HOLES, LAYER_GP_OVERLAY, LAYER_DRAW_BITMAPS }; diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 233a50f1fc..8c706370d4 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -101,7 +101,6 @@ void PCB_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings ) m_layerColors[i] = aSettings->GetColor( i ); // Default colors for specific layers (not really board layers). - m_layerColors[LAYER_VIAS_HOLES] = COLOR4D( 0.5, 0.4, 0.0, 0.8 ); m_layerColors[LAYER_PADS_PLATEDHOLES] = aSettings->GetColor( LAYER_PCB_BACKGROUND ); m_layerColors[LAYER_VIAS_NETNAMES] = COLOR4D( 0.2, 0.2, 0.2, 0.9 ); m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );