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
 
bool m_magneticGraphics = true
 

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::PCB_GENERAL_SETTINGS ( FRAME_T  aFrameType)

Definition at line 27 of file pcb_general_settings.cpp.

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( "MagneticGraphics", &m_magneticGraphics, true );
40  Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false );
41  Add( "DragSelects", &m_dragSelects, true );
42  break;
43 
45  Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false);
46  Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
47  Add( "DragSelects", &m_dragSelects, true );
48  break;
49 
50  default:
51  break;
52  }
53 }
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

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_magneticGraphics, m_magneticPads, m_magneticTracks, and m_use45DegreeGraphicSegments.

Member Function Documentation

◆ Add() [1/4]

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

Definition at line 93 of file settings.h.

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

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

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

◆ Add() [2/4]

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

Definition at line 98 of file settings.h.

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

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

◆ Add() [3/4]

void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
KIGFX::COLOR4D  aDefaultValue 
)
inlineinherited

Definition at line 103 of file settings.h.

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

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

◆ Add() [4/4]

void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
EDA_COLOR_T  aDefaultValue 
)
inlineinherited

Definition at line 108 of file settings.h.

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

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

◆ Colors()

◆ GetConfigPrefix()

const wxString& SETTINGS::GetConfigPrefix ( )
inlineinherited
Returns
the current prefix

Definition at line 57 of file settings.h.

58  {
59  return m_prefix;
60  }
wxString m_prefix
Definition: settings.h:122

References SETTINGS::m_prefix.

Referenced by COLORS_DESIGN_SETTINGS::setupConfigParams().

◆ getKeyName()

virtual wxString SETTINGS::getKeyName ( const wxString &  aEntryName) const
inlineprotectedvirtualinherited

Reimplemented in TOOL_SETTINGS.

Definition at line 116 of file settings.h.

117  {
118  return aEntryName;
119  }

◆ Load()

void PCB_GENERAL_SETTINGS::Load ( wxConfigBase *  aCfg)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 56 of file pcb_general_settings.cpp.

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

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().

◆ Save()

void PCB_GENERAL_SETTINGS::Save ( wxConfigBase *  aCfg)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 89 of file pcb_general_settings.cpp.

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

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

Referenced by FOOTPRINT_EDIT_FRAME::SaveSettings().

◆ SetConfigPrefix()

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.

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

References SETTINGS::m_prefix.

Referenced by COLORS_DESIGN_SETTINGS::setupConfigParams().

Member Data Documentation

◆ m_colorsSettings

COLORS_DESIGN_SETTINGS PCB_GENERAL_SETTINGS::m_colorsSettings
protected

Definition at line 76 of file pcb_general_settings.h.

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

◆ m_dragSelects

◆ m_editActionChangesTrackWidth

bool PCB_GENERAL_SETTINGS::m_editActionChangesTrackWidth = false

◆ m_frameType

const FRAME_T PCB_GENERAL_SETTINGS::m_frameType
protected

Definition at line 75 of file pcb_general_settings.h.

Referenced by PCB_GENERAL_SETTINGS().

◆ m_legacyAutoDeleteOldTrack

bool PCB_GENERAL_SETTINGS::m_legacyAutoDeleteOldTrack = true

◆ m_legacyDrcOn

◆ m_legacyUse45DegreeTracks

bool PCB_GENERAL_SETTINGS::m_legacyUse45DegreeTracks = true

◆ m_legacyUseTwoSegmentTracks

◆ m_magneticGraphics

◆ m_magneticPads

◆ m_magneticTracks

◆ m_use45DegreeGraphicSegments


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