21#ifndef _COLOR_SETTINGS_H
22#define _COLOR_SETTINGS_H
24#include <unordered_map>
54 explicit COLOR_SETTINGS(
const wxString& aFilename = wxT(
"user" ),
55 bool aAbsolutePath =
false );
120 std::unordered_map<int, COLOR4D>* aMap,
bool aReadOnly =
false ) :
131 ( *m_map )[
m_key ] = *optval;
132 else if( aResetIfMissing )
170 std::unordered_map<int, COLOR4D>*
m_map;
void SetDefault() override
COLOR4D GetDefault() const
void Load(JSON_SETTINGS *aSettings, bool aResetIfMissing=true) const override
Loads the value of this parameter from JSON to the underlying storage.
bool MatchesFile(JSON_SETTINGS *aSettings) const override
Checks whether the parameter in memory matches the one in a given JSON file.
void Store(JSON_SETTINGS *aSettings) const override
Stores the value of this parameter to the given JSON_SETTINGS object.
COLOR_MAP_PARAM(const std::string &aJsonPath, int aMapKey, COLOR4D aDefault, std::unordered_map< int, COLOR4D > *aMap, bool aReadOnly=false)
std::unordered_map< int, COLOR4D > * m_map
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.
void SetUseBoardStackupColors(bool aFlag)
bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
static const wxString COLOR_BUILTIN_CLASSIC
static const wxString COLOR_BUILTIN_DEFAULT
bool m_useBoardStackupColors
bool GetOverrideSchItemColors() const
COLOR4D GetColor(int aLayer) const
virtual ~COLOR_SETTINGS()
COLOR4D GetDefaultColor(int aLayer)
COLOR_SETTINGS & operator=(const COLOR_SETTINGS &aOther)
std::unordered_map< int, COLOR4D > m_colors
Map of all layer colors.
bool GetUseBoardStackupColors() const
bool m_overrideSchItemColors
void SetOverrideSchItemColors(bool aFlag)
const wxString & GetName() const
std::optional< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
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...
A color representation with 4 components: red, green, blue, alpha.
bool m_readOnly
! True if the parameter pointer should never be overwritten
std::string m_path
the string used to store the param in json files