57            &
m_Display.m_DisplayPageLimits, 
false ) );
 
   60            &
m_Display.m_OpacityModeAlphaValue, 0.6 ) );
 
 
  105        "ShowBorderAndTitleBlock", 
"appearance.show_border_and_titleblock" );
 
  108    ret &= 
fromLegacy<bool>( aCfg, 
"ShowNegativeObjectsOpt", 
"appearance.show_negative_objects" );
 
  111    auto migrate_files = [&] ( 
const std::string& aPath, 
const std::string& aDest )
 
  115        nlohmann::json js = nlohmann::json::array();
 
  117        aCfg->SetPath( aPath );
 
  119        for( 
int i = 0; i < max_history_size; i++ )
 
  121            key.Printf( wxT( 
"file%d" ), i );
 
  122            file = aCfg->Read( key, wxEmptyString );
 
  124            if( !file.IsEmpty() )
 
  125                js.emplace_back( file.ToStdString() );
 
  128        aCfg->SetPath( wxT( 
".." ) );
 
  133    migrate_files( 
"drl_files", 
"system.drill_file_history" );
 
  134    migrate_files( 
"zip_files", 
"system.zip_file_history" );
 
  135    migrate_files( 
"job_files", 
"system.job_file_history" );
 
  141        Set( 
"gerber_to_pcb_layers", nlohmann::json::array() );
 
  145            key.Printf( wxT( 
"GbrLyr%dToPcb" ), i );
 
  147            At( 
"gerber_to_pcb_layers" ).emplace_back( value );
 
  153    auto migrateLegacyColor = [&] ( 
const std::string& aKey, 
int aLayerId ) {
 
  156        if( aCfg->Read( aKey, &str ) )
 
  172        key.Printf( wxT( 
"ColorLayer%dEx" ), i );
 
  173        migrateLegacyColor( key.ToStdString(), 
id );
 
 
  188    for( 
const std::string& candidate : { std::string(
"system.drill_file_history"),
 
  189                                          std::string(
"system.zip_file_history"),
 
  190                                          std::string(
"system.job_file_history") } )
 
  193            histories[candidate] = 
GetJson( candidate ).value();
 
 
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
 
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
 
Color settings are a bit different than most of the settings objects in that there can be more than o...
 
void SetColor(int aLayer, const COLOR4D &aColor)
 
std::vector< wxString > m_JobFileHistory
 
std::vector< wxString > m_DrillFileHistory
 
GBR_DISPLAY_OPTIONS m_Display
 
EXCELLON_DEFAULTS m_ExcellonDefaults
 
std::vector< int > m_GerberToPcbLayerMapping
A list of GERBER_DRAWLAYERS_COUNT length containing a mapping of gerber layers to PCB layers,...
 
std::vector< wxString > m_ZipFileHistory
 
bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
 
std::map< std::string, nlohmann::json > GetFileHistories() override
 
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
 
bool fromLegacy(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig value to a given JSON pointer value.
 
virtual std::map< std::string, nlohmann::json > GetFileHistories()
 
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...
 
std::optional< nlohmann::json > GetJson(const std::string &aPath) const
Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1....
 
bool Contains(const std::string &aPath) const
 
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
 
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...
 
wxString GetFilename() const
 
A color representation with 4 components: red, green, blue, alpha.
 
virtual COMMON_SETTINGS * GetCommonSettings() const
 
virtual SETTINGS_MANAGER & GetSettingsManager() const
 
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely save a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
 
COLOR_SETTINGS * GetMigratedColorSettings()
Return a color theme for storing colors migrated from legacy (5.x and earlier) settings,...
 
#define FMT_MANTISSA_INCH
 
const int gerbviewSchemaVersion
! Update the schema version whenever a migration is required
 
@ LAYER_GERBVIEW_DRAWINGSHEET
 
@ GERBVIEW_LAYER_ID_START
 
@ LAYER_GERBVIEW_BACKGROUND
 
@ LAYER_GERBVIEW_PAGE_LIMITS
 
#define GERBER_DRAWLAYERS_COUNT
Number of draw layers in Gerbview.
 
PGM_BASE & Pgm()
The global program "get" accessor.