KiCad PCB EDA Suite
PCB_GENERAL_SETTINGS Class Reference

#include <pcb_general_settings.h>

Inheritance diagram for PCB_GENERAL_SETTINGS:
SETTINGS

Public Member Functions

 PCB_GENERAL_SETTINGS (FRAME_T aFrameType)
 
void Load (wxConfigBase *aCfg) override
 
void Save (wxConfigBase *aCfg) override
 
COLORS_DESIGN_SETTINGSColors ()
 
void SetConfigPrefix (const wxString &aPrefix)
 Set a prefix that will be prepent to the keywords when adding a setting in list. More...
 
const wxString & GetConfigPrefix ()
 
void Add (const wxString &name, int *aPtr, int aDefaultValue)
 
void Add (const wxString &name, bool *aPtr, bool aDefaultValue)
 
void Add (const wxString &name, KIGFX::COLOR4D *aPtr, KIGFX::COLOR4D aDefaultValue)
 
void Add (const wxString &name, KIGFX::COLOR4D *aPtr, EDA_COLOR_T aDefaultValue)
 

Public Attributes

bool m_legacyDrcOn = true
 
bool m_legacyAutoDeleteOldTrack = true
 
bool m_legacyUse45DegreeTracks = true
 
bool m_legacyUseTwoSegmentTracks = true
 
bool m_editActionChangesTrackWidth = false
 
MAGNETIC_PAD_OPTION_VALUES m_magneticPads = CAPTURE_CURSOR_IN_TRACK_TOOL
 
MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL
 

Static Public Attributes

static bool m_use45DegreeGraphicSegments = false
 
static bool m_dragSelects = true
 

Protected Member Functions

virtual wxString getKeyName (const wxString &aEntryName) const
 

Protected Attributes

const FRAME_T m_frameType
 
COLORS_DESIGN_SETTINGS m_colorsSettings
 

Detailed Description

Definition at line 40 of file pcb_general_settings.h.

Constructor & Destructor Documentation

PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS ( FRAME_T  aFrameType)

Definition at line 27 of file pcb_general_settings.cpp.

References SETTINGS::Add(), CAPTURE_CURSOR_IN_TRACK_TOOL, FRAME_PCB, FRAME_PCB_MODULE_EDITOR, m_dragSelects, m_editActionChangesTrackWidth, m_frameType, m_legacyAutoDeleteOldTrack, m_legacyUse45DegreeTracks, m_legacyUseTwoSegmentTracks, m_magneticPads, m_magneticTracks, and m_use45DegreeGraphicSegments.

28  : m_frameType( aFrameType ), m_colorsSettings( aFrameType )
29 {
30  switch( m_frameType )
31  {
32  case FRAME_PCB:
33  Add( "LegacyAutoDeleteOldTrack", &m_legacyAutoDeleteOldTrack, true );
34  Add( "LegacyUse45DegreeTracks",&m_legacyUse45DegreeTracks, true);
35  Add( "LegacyUseTwoSegmentTracks", &m_legacyUseTwoSegmentTracks, true);
36  Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false);
37  Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
38  Add( "MagneticTracks", reinterpret_cast<int*>( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL );
39  Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false );
40  Add( "DragSelects", &m_dragSelects, true );
41  break;
42 
44  Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false);
45  Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
46  Add( "DragSelects", &m_dragSelects, true );
47  break;
48 
49  default:
50  break;
51  }
52 }
MAGNETIC_PAD_OPTION_VALUES m_magneticPads
void Add(const wxString &name, int *aPtr, int aDefaultValue)
Definition: settings.h:93
static bool m_use45DegreeGraphicSegments
MAGNETIC_PAD_OPTION_VALUES m_magneticTracks
COLORS_DESIGN_SETTINGS m_colorsSettings

Member Function Documentation

void SETTINGS::Add ( const wxString &  name,
int *  aPtr,
int  aDefaultValue 
)
inlineinherited

Definition at line 93 of file settings.h.

References SETTINGS::m_params, and SETTINGS::m_prefix.

Referenced by PCB_GENERAL_SETTINGS(), and COLORS_DESIGN_SETTINGS::setupConfigParams().

94  {
95  m_params.push_back( new PARAM_CFG_INT ( m_prefix+name, aPtr, aDefaultValue ) );
96  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:123
wxString m_prefix
Definition: settings.h:122
Configuration parameter - Integer Class.
const char * name
Definition: DXF_plotter.cpp:61
void SETTINGS::Add ( const wxString &  name,
bool *  aPtr,
bool  aDefaultValue 
)
inlineinherited

Definition at line 98 of file settings.h.

References SETTINGS::m_params, and SETTINGS::m_prefix.

99  {
100  m_params.push_back( new PARAM_CFG_BOOL ( m_prefix+name, aPtr, aDefaultValue ) );
101  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:123
wxString m_prefix
Definition: settings.h:122
Configuration parameter - Boolean Class.
const char * name
Definition: DXF_plotter.cpp:61
void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
KIGFX::COLOR4D  aDefaultValue 
)
inlineinherited

Definition at line 103 of file settings.h.

References SETTINGS::m_params, and SETTINGS::m_prefix.

104  {
105  m_params.push_back( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
106  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:123
Configuration parameter - SetColor Class.
wxString m_prefix
Definition: settings.h:122
const char * name
Definition: DXF_plotter.cpp:61
void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
EDA_COLOR_T  aDefaultValue 
)
inlineinherited

Definition at line 108 of file settings.h.

References SETTINGS::m_params, and SETTINGS::m_prefix.

109  {
110  m_params.push_back( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
111  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:123
Configuration parameter - SetColor Class.
wxString m_prefix
Definition: settings.h:122
const char * name
Definition: DXF_plotter.cpp:61
const wxString& SETTINGS::GetConfigPrefix ( )
inlineinherited
Returns
the current prefix

Definition at line 57 of file settings.h.

References SETTINGS::getKeyName(), SETTINGS::Load(), SETTINGS::m_prefix, and SETTINGS::Save().

Referenced by COLORS_DESIGN_SETTINGS::setupConfigParams().

58  {
59  return m_prefix;
60  }
wxString m_prefix
Definition: settings.h:122
virtual wxString SETTINGS::getKeyName ( const wxString &  aEntryName) const
inlineprotectedvirtualinherited

Reimplemented in TOOL_SETTINGS.

Definition at line 116 of file settings.h.

Referenced by SETTINGS::GetConfigPrefix().

117  {
118  return aEntryName;
119  }
void PCB_GENERAL_SETTINGS::Load ( wxConfigBase *  aCfg)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 55 of file pcb_general_settings.cpp.

References COLORS_DESIGN_SETTINGS::Load(), SETTINGS::Load(), and m_colorsSettings.

Referenced by FOOTPRINT_EDIT_FRAME::LoadSettings(), DISPLAY_FOOTPRINTS_FRAME::LoadSettings(), and FOOTPRINT_VIEWER_FRAME::LoadSettings().

56 {
57  m_colorsSettings.Load( aCfg );
58 
59 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
60 
61  m_pluginSettings.clear();
62 
63  wxString pluginSettings = aCfg->Read( "ActionPluginButtons" );
64 
65  wxStringTokenizer pluginSettingsTokenizer = wxStringTokenizer( pluginSettings, ";" );
66 
67  while( pluginSettingsTokenizer.HasMoreTokens() )
68  {
69  wxString plugin = pluginSettingsTokenizer.GetNextToken();
70  wxStringTokenizer pluginTokenizer = wxStringTokenizer( plugin, "=" );
71 
72  if( pluginTokenizer.CountTokens() != 2 )
73  {
74  // Bad config
75  continue;
76  }
77 
78  plugin = pluginTokenizer.GetNextToken();
79  m_pluginSettings.push_back( std::make_pair( plugin, pluginTokenizer.GetNextToken() ) );
80  }
81 
82 #endif
83 
84  SETTINGS::Load( aCfg );
85 }
virtual void Load(wxConfigBase *aConfig)
Definition: settings.cpp:26
COLORS_DESIGN_SETTINGS m_colorsSettings
virtual void Load(wxConfigBase *aConfig) override
void PCB_GENERAL_SETTINGS::Save ( wxConfigBase *  aCfg)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 88 of file pcb_general_settings.cpp.

References m_colorsSettings, m_dragSelects, m_use45DegreeGraphicSegments, COLORS_DESIGN_SETTINGS::Save(), and SETTINGS::Save().

Referenced by FOOTPRINT_EDIT_FRAME::SaveSettings().

89 {
90  m_colorsSettings.Save( aCfg );
91 
92 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
93 
94  wxString pluginSettings;
95 
96  for( auto const& entry : m_pluginSettings )
97  {
98  if( !pluginSettings.IsEmpty() )
99  {
100  pluginSettings = pluginSettings + wxT( ";" );
101  }
102  pluginSettings = pluginSettings + entry.first + wxT( "=" ) + entry.second;
103  }
104 
105  aCfg->Write( "ActionPluginButtons" , pluginSettings );
106 
107 #endif
108 
109  SETTINGS::Save( aCfg );
110 }
virtual void Save(wxConfigBase *aConfig)
Definition: settings.cpp:39
virtual void Save(wxConfigBase *aConfig) override
COLORS_DESIGN_SETTINGS m_colorsSettings
void SETTINGS::SetConfigPrefix ( const wxString &  aPrefix)
inlineinherited

Set a prefix that will be prepent to the keywords when adding a setting in list.

Parameters
aPrefixis the string to prepend to the keywords

Definition at line 50 of file settings.h.

References SETTINGS::m_prefix.

Referenced by COLORS_DESIGN_SETTINGS::setupConfigParams().

51  {
52  m_prefix = aPrefix;
53  }
wxString m_prefix
Definition: settings.h:122

Member Data Documentation

COLORS_DESIGN_SETTINGS PCB_GENERAL_SETTINGS::m_colorsSettings
protected

Definition at line 75 of file pcb_general_settings.h.

Referenced by Colors(), Load(), and Save().

bool PCB_GENERAL_SETTINGS::m_editActionChangesTrackWidth = false
const FRAME_T PCB_GENERAL_SETTINGS::m_frameType
protected

Definition at line 74 of file pcb_general_settings.h.

Referenced by PCB_GENERAL_SETTINGS().

bool PCB_GENERAL_SETTINGS::m_legacyAutoDeleteOldTrack = true
bool PCB_GENERAL_SETTINGS::m_legacyUse45DegreeTracks = true

The documentation for this class was generated from the following files: