Expose via holes to color theme properly

This commit is contained in:
Jon Evans 2020-10-02 21:07:35 -04:00
parent cea1a56f5f
commit 45d7f2b6f5
6 changed files with 27 additions and 8 deletions

View File

@ -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" );

View File

@ -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 ) )

View File

@ -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;

View File

@ -90,6 +90,7 @@ public:
private:
bool migrateSchema0to1();
bool migrateSchema1to2();
void initFromOther( const COLOR_SETTINGS& aOther );

View File

@ -363,7 +363,6 @@ std::set<int> g_excludedLayers =
LAYER_MOD_TEXT_FR,
LAYER_MOD_TEXT_BK,
LAYER_PADS_PLATEDHOLES,
LAYER_VIAS_HOLES,
LAYER_GP_OVERLAY,
LAYER_DRAW_BITMAPS
};

View File

@ -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 );