21 #ifndef _COLOR_SETTINGS_H 22 #define _COLOR_SETTINGS_H 24 #include <unordered_map> 61 explicit COLOR_SETTINGS(
const wxString& aFilename = wxT(
"user" ),
62 bool aAbsolutePath =
false );
123 std::unordered_map<int, COLOR4D>* aMap,
bool aReadOnly =
false ) :
134 ( *m_map )[
m_key ] = *optval;
135 else if( aResetIfMissing )
173 std::unordered_map<int, COLOR4D>*
m_map;
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...
bool GetUseBoardStackupColors() const
std::string m_path
the string used to store the param in json files
virtual ~COLOR_SETTINGS()
bool m_overrideSchItemColors
void SetColor(int aLayer, const COLOR4D &aColor)
const wxString & GetName() const
COLOR4D GetDefault() const
COLOR_MAP_PARAM(const std::string &aJsonPath, int aMapKey, COLOR4D aDefault, std::unordered_map< int, COLOR4D > *aMap, bool aReadOnly=false)
void SetDefault() override
void SetOverrideSchItemColors(bool aFlag)
COLOR4D GetDefaultColor(int aLayer)
static std::vector< COLOR_SETTINGS * > CreateBuiltinColorSettings()
Constructs and returns a list of color settings objects based on the built-in color themes.
void SetName(const wxString &aName)
std::unordered_map< int, COLOR4D > m_defaultColors
void Store(JSON_SETTINGS *aSettings) const override
Stores the value of this parameter to the given JSON_SETTINGS object.
COLOR_SETTINGS(const wxString &aFilename=wxT("user"), bool aAbsolutePath=false)
bool MatchesFile(JSON_SETTINGS *aSettings) const override
Checks whether the parameter in memory matches the one in a given JSON file.
std::vector< COLOR4D > m_Palette
m_Pallete stores a list of colors that are used, in order, when a list of colors needs to be generate...
COLOR4D GetColor(int aLayer) const
std::unordered_map< int, COLOR4D > m_colors
Map of all layer colors.
OPT< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
void initFromOther(const COLOR_SETTINGS &aOther)
bool m_readOnly
! True if the parameter pointer should never be overwritten
COLOR_SETTINGS & operator=(const COLOR_SETTINGS &aOther)
std::unordered_map< int, COLOR4D > * m_map
bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
bool m_useBoardStackupColors
Color settings are a bit different than most of the settings objects in that there can be more than o...
bool GetOverrideSchItemColors() const
void SetUseBoardStackupColors(bool aFlag)
A color representation with 4 components: red, green, blue, alpha.
void Load(JSON_SETTINGS *aSettings, bool aResetIfMissing=true) const override
Loads the value of this parameter from JSON to the underlying storage.