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_Use45DegreeGraphicSegments
 
bool m_EditHotkeyChangesTrackWidth
 
bool m_FlipLeftRight
 
MAGNETIC_OPTIONS m_MagneticPads
 
MAGNETIC_OPTIONS m_MagneticTracks
 
bool m_MagneticGraphics
 

Protected Member Functions

virtual wxString getKeyName (const wxString &aEntryName) const
 

Protected Attributes

const FRAME_T m_frameType
 
COLORS_DESIGN_SETTINGS m_colorsSettings
 
wxString m_prefix
 
PARAM_CFG_ARRAY m_params
 

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 28 of file pcb_general_settings.cpp.

28  :
31  m_FlipLeftRight( false ),
34  m_MagneticGraphics( true ),
35  m_frameType( aFrameType ),
36  m_colorsSettings( aFrameType )
37 {
38  switch( m_frameType )
39  {
40  case FRAME_PCB:
41  Add( "Use45DegreeGraphicSegments", &m_Use45DegreeGraphicSegments, false);
42  Add( "MagneticPads", reinterpret_cast<int*>( &m_MagneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
43  Add( "MagneticTracks", reinterpret_cast<int*>( &m_MagneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL );
44  Add( "MagneticGraphics", &m_MagneticGraphics, true );
45  Add( "EditActionChangesTrackWidth", &m_EditHotkeyChangesTrackWidth, false );
46  Add( "FlipLeftRight", &m_FlipLeftRight, false );
47  break;
48 
50  m_params.push_back( new PARAM_CFG_BOOL( "FpEditorUse45DegreeGraphicSegments",
52  nullptr, "Use45DegreeGraphicSegments" ) ); // legacy location
53  m_params.push_back( new PARAM_CFG_INT( "FpEditorMagneticPads",
54  reinterpret_cast<int*>( &m_MagneticPads ),
56  NO_EFFECT, // min
57  CAPTURE_ALWAYS, // max
58  nullptr, "MagneticPads" ) ); // legacy location
59  break;
60 
61  default:
62  break;
63  }
64 }
MAGNETIC_OPTIONS m_MagneticTracks
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
void Add(const wxString &name, int *aPtr, int aDefaultValue)
Definition: settings.h:93
MAGNETIC_OPTIONS m_MagneticPads
Configuration parameter - Integer Class.
Configuration parameter - Boolean Class.
COLORS_DESIGN_SETTINGS m_colorsSettings

References SETTINGS::Add(), CAPTURE_ALWAYS, CAPTURE_CURSOR_IN_TRACK_TOOL, FRAME_PCB, FRAME_PCB_MODULE_EDITOR, m_EditHotkeyChangesTrackWidth, m_FlipLeftRight, m_frameType, m_MagneticGraphics, m_MagneticPads, m_MagneticTracks, SETTINGS::m_params, m_Use45DegreeGraphicSegments, and NO_EFFECT.

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:122
wxString m_prefix
Definition: settings.h:121
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:122
wxString m_prefix
Definition: settings.h:121
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:122
Configuration parameter - SetColor Class.
wxString m_prefix
Definition: settings.h:121
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:122
Configuration parameter - SetColor Class.
wxString m_prefix
Definition: settings.h:121
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:121

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 67 of file pcb_general_settings.cpp.

68 {
69  m_colorsSettings.Load( aCfg );
70 
71 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
72 
73  m_pluginSettings.clear();
74 
75  wxString pluginSettings = aCfg->Read( "ActionPluginButtons" );
76 
77  wxStringTokenizer pluginSettingsTokenizer = wxStringTokenizer( pluginSettings, ";" );
78 
79  while( pluginSettingsTokenizer.HasMoreTokens() )
80  {
81  wxString plugin = pluginSettingsTokenizer.GetNextToken();
82  wxStringTokenizer pluginTokenizer = wxStringTokenizer( plugin, "=" );
83 
84  if( pluginTokenizer.CountTokens() != 2 )
85  {
86  // Bad config
87  continue;
88  }
89 
90  plugin = pluginTokenizer.GetNextToken();
91  m_pluginSettings.push_back( std::make_pair( plugin, pluginTokenizer.GetNextToken() ) );
92  }
93 
94 #endif
95 
96  SETTINGS::Load( aCfg );
97 }
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 DISPLAY_FOOTPRINTS_FRAME::LoadSettings(), FOOTPRINT_EDIT_FRAME::LoadSettings(), and FOOTPRINT_VIEWER_FRAME::LoadSettings().

◆ Save()

void PCB_GENERAL_SETTINGS::Save ( wxConfigBase *  aCfg)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 100 of file pcb_general_settings.cpp.

101 {
102  m_colorsSettings.Save( aCfg );
103 
104 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
105 
106  wxString pluginSettings;
107 
108  for( auto const& entry : m_pluginSettings )
109  {
110  if( !pluginSettings.IsEmpty() )
111  {
112  pluginSettings = pluginSettings + wxT( ";" );
113  }
114  pluginSettings = pluginSettings + entry.first + wxT( "=" ) + entry.second;
115  }
116 
117  aCfg->Write( "ActionPluginButtons" , pluginSettings );
118 
119 #endif
120 
121  SETTINGS::Save( aCfg );
122 }
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:121

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 66 of file pcb_general_settings.h.

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

◆ m_EditHotkeyChangesTrackWidth

◆ m_FlipLeftRight

◆ m_frameType

const FRAME_T PCB_GENERAL_SETTINGS::m_frameType
protected

Definition at line 65 of file pcb_general_settings.h.

Referenced by PCB_GENERAL_SETTINGS().

◆ m_MagneticGraphics

◆ m_MagneticPads

◆ m_MagneticTracks

◆ m_params

PARAM_CFG_ARRAY SETTINGS::m_params
protectedinherited

Definition at line 122 of file settings.h.

Referenced by SETTINGS::Add(), SETTINGS::Load(), PCB_GENERAL_SETTINGS(), and SETTINGS::Save().

◆ m_prefix

wxString SETTINGS::m_prefix
protectedinherited

Definition at line 121 of file settings.h.

Referenced by SETTINGS::Add(), SETTINGS::GetConfigPrefix(), and SETTINGS::SetConfigPrefix().

◆ m_Use45DegreeGraphicSegments


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