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 );
 
   69    COLOR4D GetColor( 
int aLayer ) 
const;
 
   71    COLOR4D GetDefaultColor( 
int aLayer );
 
   73    void SetColor( 
int aLayer, 
const COLOR4D& aColor );
 
   88    static std::vector<COLOR_SETTINGS*> CreateBuiltinColorSettings();
 
 
  116                     std::unordered_map<int, COLOR4D>* aMap, 
bool aReadOnly = 
false ) :
 
 
  127            ( *m_map )[ 
m_key ] = *optval;
 
  128        else if( aResetIfMissing )
 
 
  166    std::unordered_map<int, COLOR4D>* 
m_map;
 
 
void SetDefault() override
 
COLOR4D GetDefault() const
 
bool MatchesFile(const 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)
 
void Load(const JSON_SETTINGS &aSettings, bool aResetIfMissing=true) const override
Loads the value of this parameter from JSON to the underlying storage.
 
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)
 
static const wxString COLOR_BUILTIN_CLASSIC
 
static const wxString COLOR_BUILTIN_DEFAULT
 
bool GetOverrideSchItemColors() const
 
virtual ~COLOR_SETTINGS()
 
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)
 
void SetOverrideSchItemColors(bool aFlag)
 
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...
 
JSON_SETTINGS & operator=(const JSON_SETTINGS &)=delete
 
std::optional< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
 
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig)
Migrates from wxConfig to JSON-based configuration.
 
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
 
A color representation with 4 components: red, green, blue, alpha.
 
PARAM_BASE(std::string aJsonPath, bool aReadOnly)
 
bool m_readOnly
Indicates param pointer should never be overwritten.
 
std::string m_path
Address of the param in the json files.