27#include <wx/translation.h>
40 m_overrideSchItemColors( false )
46 wxS(
"KiCad Default" ) ) );
52 wxASSERT( s_defaultTheme.count( y ) ); \
53 m_params.emplace_back( new COLOR_MAP_PARAM( x, y, s_defaultTheme.at( y ), &m_colors ) );
215 nlohmann::json::json_pointer ptr(
"/board/via_hole" );
228 for( std::string
path : {
"3d_viewer.background_top",
229 "3d_viewer.background_bottom",
231 "3d_viewer.silkscreen_top",
232 "3d_viewer.silkscreen_bottom",
233 "3d_viewer.solderpaste" } )
235 if( std::optional<COLOR4D> optval = Get<COLOR4D>(
path ) )
236 Set(
path, optval->WithAlpha( 1.0 ) );
245 if( std::optional<COLOR4D> optval = Get<COLOR4D>(
"board.grid" ) )
246 Set(
"board.page_limits", *optval );
248 if( std::optional<COLOR4D> optval = Get<COLOR4D>(
"schematic.grid" ) )
249 Set(
"schematic.page_limits", *optval );
310 wxLogTrace(
traceSettings, wxT(
"Error: COLOR_SETTINGS migration cannot run unmanaged!" ) );
317 wxT(
"migrateSchema0to1: %s doesn't have fpedit settings; skipping." ),
322 wxString filename =
GetFilename().BeforeLast(
'.' ) + wxT(
"_footprints" );
331 fpsettings->
Set(
"board", fpsettings->
At(
"fpedit" ) );
333 fpsettings->
Internals()->erase(
"fpedit" );
335 fpsettings->
SetName( fpsettings->
GetName() + wxS(
" " ) +
_(
"(Footprints)" ) );
350 return COLOR4D::UNSPECIFIED;
364 if( cmp && cmp->
GetKey() == aLayer )
387 defaultTheme->
SetName(
_(
"KiCad Default" ) );
389 defaultTheme->
Load();
392 classicTheme->
SetName(
_(
"KiCad Classic" ) );
401 classicTheme->
m_colors[entry.first] = entry.second;
403 std::vector<COLOR_SETTINGS*> ret;
405 ret.push_back( defaultTheme );
406 ret.push_back( classicTheme );
static const std::map< int, COLOR4D > s_defaultTheme
static const std::map< int, COLOR4D > s_classicTheme
COLOR4D GetDefault() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetName(const wxString &aName)
std::unordered_map< int, COLOR4D > m_defaultColors
void initFromOther(const COLOR_SETTINGS &aOther)
void SetColor(int aLayer, const COLOR4D &aColor)
static std::vector< COLOR_SETTINGS * > CreateBuiltinColorSettings()
Constructs and returns a list of color settings objects based on the built-in color themes.
bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
static const wxString COLOR_BUILTIN_CLASSIC
static const wxString COLOR_BUILTIN_DEFAULT
COLOR4D GetColor(int aLayer) const
COLOR4D GetDefaultColor(int aLayer)
COLOR_SETTINGS & operator=(const COLOR_SETTINGS &aOther)
std::unordered_map< int, COLOR4D > m_colors
Map of all layer colors.
bool m_overrideSchItemColors
COLOR_SETTINGS(const wxString &aFilename=wxT("user"), bool aAbsolutePath=false)
const wxString & GetName() const
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
wxString m_filename
The filename (not including path) of this settings file (inicode)
SETTINGS_MANAGER * m_manager
A pointer to the settings manager managing this file (may be null)
bool Contains(const std::string &aPath) const
SETTINGS_LOC GetLocation() const
void SetLocation(SETTINGS_LOC aLocation)
bool m_writeFile
Whether or not the backing store file should be written.
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
nlohmann::json & At(const std::string &aPath)
Wrappers for the underlying JSON API so that most consumers don't need json.hpp All of these function...
JSON_SETTINGS_INTERNALS * Internals()
std::unique_ptr< JSON_SETTINGS_INTERNALS > m_internals
wxString GetFilename() const
A color representation with 4 components: red, green, blue, alpha.
wxString ToCSSString() const
COLOR_SETTINGS * AddNewColorSettings(const wxString &aFilename)
Registers a new color settings object with the given filename.
const int colorsSchemaVersion
! Update the schema version whenever a migration is required
@ COLORS
The color scheme directory (e.g. ~/.config/kicad/colors/)
@ NETNAMES_LAYER_ID_START
@ LAYER_GERBVIEW_DRAWINGSHEET
@ GERBVIEW_LAYER_ID_START
@ LAYER_GERBVIEW_BACKGROUND
@ LAYER_GERBVIEW_PAGE_LIMITS
@ LAYER_3D_SOLDERMASK_TOP
@ LAYER_3D_BACKGROUND_TOP
@ LAYER_3D_SOLDERMASK_BOTTOM
@ LAYER_3D_SILKSCREEN_TOP
@ LAYER_3D_BACKGROUND_BOTTOM
@ LAYER_3D_SILKSCREEN_BOTTOM
@ LAYER_PAGE_LIMITS
color for drawing the page extents (visibility stored in PCBNEW_SETTINGS::m_ShowPageLimits)
@ LAYER_LOCKED_ITEM_SHADOW
shadow layer for locked items
@ LAYER_CONFLICTS_SHADOW
shadow layer for items flagged conficting
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
@ LAYER_DRC_EXCLUSION
layer for drc markers which have been individually excluded
@ LAYER_PCB_BACKGROUND
PCB background color.
@ LAYER_DRC_WARNING
layer for drc markers with SEVERITY_WARNING
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
@ LAYER_CURSOR
PCB cursor.
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc)
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
@ LAYER_VIA_HOLES
to draw via holes (pad holes do not use this layer)
@ LAYER_DRC_ERROR
layer for drc markers with SEVERITY_ERROR
@ LAYER_EXCLUDED_FROM_SIM
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SCHEMATIC_DRAWINGSHEET
@ LAYER_SCHEMATIC_GRID_AXES
@ LAYER_SCHEMATIC_PAGE_LIMITS
@ LAYER_SELECTION_SHADOWS
@ LAYER_SCHEMATIC_BACKGROUND
@ LAYER_SCHEMATIC_AUX_ITEMS
#define GERBER_DRAWLAYERS_COUNT