KiCad PCB EDA Suite
GAL_OPTIONS_PANEL Class Reference

#include <gal_options_panel.h>

Inheritance diagram for GAL_OPTIONS_PANEL:

Public Member Functions

 GAL_OPTIONS_PANEL (wxWindow *aParent, KIGFX::GAL_DISPLAY_OPTIONS &aGalOpts)
 
bool TransferDataToWindow () override
 Load the panel controls from the given opt. More...
 
bool TransferDataFromWindow () override
 Read the options set in the UI into the given options object. More...
 

Private Attributes

wxBoxSizer * m_mainSizer
 
wxRadioBox * m_gridStyle
 
wxStaticText * l_gridLineWidth
 
wxSpinCtrlDouble * m_gridLineWidth
 
wxStaticText * l_gridLineWidthUnits
 
wxStaticText * l_gridMinSpacing
 
wxSpinCtrlDouble * m_gridMinSpacing
 
wxStaticText * l_gridMinSpacingUnits
 
wxStaticText * l_gridSnapOptions
 
wxChoice * m_gridSnapOptions
 
wxStaticText * l_gridSnapSpace
 
wxRadioBox * m_cursorShape
 
wxCheckBox * m_forceCursorDisplay
 
KIGFX::GAL_DISPLAY_OPTIONSm_galOptions
 

The GAL options to read/write

More...
 

Detailed Description

Definition at line 36 of file gal_options_panel.h.

Constructor & Destructor Documentation

◆ GAL_OPTIONS_PANEL()

GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL ( wxWindow *  aParent,
KIGFX::GAL_DISPLAY_OPTIONS aGalOpts 
)

Definition at line 64 of file gal_options_panel.cpp.

64  :
65  wxPanel( aParent, wxID_ANY ),
66  m_galOptions( aGalOpts )
67 {
68  // the main sizer that holds "columns" of settings
69  m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
70  SetSizer( m_mainSizer );
71 
72  // second-level sizers that are one "column" of settings each
73  wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
74  m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
75 
76  /*
77  * Grid settings subpanel
78  */
79  {
80  wxStaticBox* sGridOpts = new wxStaticBox( this, wxID_ANY, _( "Grid Options" ) );
81  wxStaticBoxSizer* sGridSettings;
82  sGridSettings = new wxStaticBoxSizer( sGridOpts, wxVERTICAL );
83 
84  wxString m_gridStyleChoices[] = {
85  _( "Dots" ),
86  _( "Lines" ),
87  _( "Small crosses" )
88  };
89  int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
90  m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
91  wxID_ANY, _( "Grid Style" ),
92  wxDefaultPosition, wxDefaultSize,
93  m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
94  sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 );
95 
96  wxFlexGridSizer* sGridSettingsGrid;
97  sGridSettingsGrid = new wxFlexGridSizer( 0, 3, 0, 0 );
98  sGridSettingsGrid->AddGrowableCol( 1 );
99  sGridSettingsGrid->SetFlexibleDirection( wxBOTH );
100  sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
101 
102  l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(),
103  wxID_ANY, _( "Grid thickness:" ) );
104  l_gridLineWidth->Wrap( -1 );
105  sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
106 
107  m_gridLineWidth = new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY );
109  m_gridLineWidth->SetIncrement( gridThicknessStep );
110  m_gridLineWidth->SetDigits( 1 );
111  sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
112 
113  l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(),
114  wxID_ANY, _( "px" ) );
115  l_gridLineWidthUnits->Wrap( -1 );
116  sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
117 
118  l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(),
119  wxID_ANY, _( "Min grid spacing:" ) );
120  l_gridMinSpacing->Wrap( -1 );
121  sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
122 
123  m_gridMinSpacing = new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY);
125  m_gridMinSpacing->SetIncrement( gridMinSpacingStep );
126  m_gridMinSpacing->SetDigits( 0 );
127  sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
128 
129  l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(),
130  wxID_ANY, _( "px" ) );
131  l_gridMinSpacingUnits->Wrap( -1 );
132  sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
133 
134  l_gridSnapOptions = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY, _( "Snap to Grid:" ) );
135  l_gridSnapOptions->Wrap( -1 );
136  sGridSettingsGrid->Add( l_gridSnapOptions, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
137 
138  wxString gridSnapChoices[] = { _( "Always"), _("When grid shown"), _("Never") };
139  int gridSnapNChoices = sizeof( gridSnapChoices ) / sizeof( wxString );
140  m_gridSnapOptions = new wxChoice( sGridSettings->GetStaticBox(), wxID_ANY,
141  wxDefaultPosition, wxDefaultSize, gridSnapNChoices, gridSnapChoices );
142  m_gridSnapOptions->Select( 0 );
143  sGridSettingsGrid->Add( m_gridSnapOptions, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5 );
144 
145  l_gridSnapSpace = new wxStaticText( sGridSettings->GetStaticBox(),
146  wxID_ANY, _( "px" ) );
147  l_gridSnapSpace->Wrap( -1 );
148  l_gridSnapSpace->Hide();
149  sGridSettingsGrid->Add( l_gridSnapSpace, 0,
150  wxALIGN_CENTER_VERTICAL | wxALL | wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
151 
152 
153  sGridSettings->Add( sGridSettingsGrid, 1, wxALL | wxEXPAND, 5 );
154 
155  sLeftSizer->Add( sGridSettings, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
156  }
157 
158  /*
159  * Cursor settings subpanel
160  */
161  {
162  auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
163  wxID_ANY, _( "Cursor Options" ) ), wxVERTICAL );
164 
165  sLeftSizer->Add( sCursorSettings, 1, wxTOP | wxRIGHT | wxEXPAND, 5 );
166 
167  wxString m_CursorShapeChoices[] = {
168  _( "Small crosshair" ),
169  _( "Full window crosshair" )
170  };
171 
172  int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
173  m_cursorShape = new wxRadioBox( this, wxID_ANY,
174  _( "Cursor Shape" ), wxDefaultPosition, wxDefaultSize,
175  m_CursorShapeNChoices, m_CursorShapeChoices, 1,
176  wxRA_SPECIFY_COLS );
177 
178  m_cursorShape->SetSelection( 0 );
179  m_cursorShape->SetToolTip( _( "Cursor shape for drawing, placement and movement tools" ) );
180  sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 );
181 
182  m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always show crosshairs" ) );
183  sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
184  }
185 }
wxStaticText * l_gridMinSpacingUnits
wxRadioBox * m_cursorShape
wxStaticText * l_gridSnapOptions
wxBoxSizer * m_mainSizer
static const double gridMinSpacingMax
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
wxRadioBox * m_gridStyle
wxStaticText * l_gridMinSpacing
static const double gridThicknessMin
wxStaticText * l_gridSnapSpace
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
wxChoice * m_gridSnapOptions
wxStaticText * l_gridLineWidthUnits
wxSpinCtrlDouble * m_gridLineWidth
wxStaticText * l_gridLineWidth
static const double gridThicknessStep
static const double gridThicknessMax
#define _(s)
Definition: 3d_actions.cpp:33
static const double gridMinSpacingStep
static const double gridMinSpacingMin

References _, gridMinSpacingMax, gridMinSpacingMin, gridMinSpacingStep, gridThicknessMax, gridThicknessMin, gridThicknessStep, l_gridLineWidth, l_gridLineWidthUnits, l_gridMinSpacing, l_gridMinSpacingUnits, l_gridSnapOptions, l_gridSnapSpace, m_cursorShape, m_forceCursorDisplay, m_gridLineWidth, m_gridMinSpacing, m_gridSnapOptions, m_gridStyle, and m_mainSizer.

Member Function Documentation

◆ TransferDataFromWindow()

bool GAL_OPTIONS_PANEL::TransferDataFromWindow ( )
override

Read the options set in the UI into the given options object.

Definition at line 208 of file gal_options_panel.cpp.

209 {
211  m_gridSnapOptions->GetSelection() );
212 
214  gridStyleSelectMap, m_gridStyle->GetSelection() );
215 
217 
219 
221 
223 
225 
226  return true;
227 }
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleSelectMap
TODO: These are duplicated in gal_display_options - Unify!
wxRadioBox * m_cursorShape
KIGFX::GRID_STYLE m_gridStyle
The grid style to draw the grid in
static const UTIL::CFG_MAP< KIGFX::GRID_SNAPPING > gridSnapConfigVals
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
bool m_forceDisplayCursor
Force cursor display
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
wxRadioBox * m_gridStyle
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
GRID_SNAPPING m_gridSnapping
Snapping options for the grid
wxChoice * m_gridSnapOptions
static CFG_NATIVE_VAL< MAP > GetValFromConfig(const MAP &aMap, long aConf)
Get the native value corresponding to the config value (read from file or UI, probably) and find it i...
Definition: config_map.h:96
wxSpinCtrlDouble * m_gridLineWidth
double m_gridLineWidth
Thickness to render grid lines/dots
bool m_fullscreenCursor
Fullscreen crosshair or small cross

References UTIL::GetValFromConfig(), gridSnapConfigVals, gridStyleSelectMap, m_cursorShape, m_forceCursorDisplay, KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor, m_galOptions, m_gridLineWidth, KIGFX::GAL_DISPLAY_OPTIONS::m_gridLineWidth, m_gridMinSpacing, KIGFX::GAL_DISPLAY_OPTIONS::m_gridMinSpacing, m_gridSnapOptions, KIGFX::GAL_DISPLAY_OPTIONS::m_gridSnapping, m_gridStyle, KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle, and KIGFX::GAL_DISPLAY_OPTIONS::NotifyChanged().

Referenced by PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GAL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow().

◆ TransferDataToWindow()

bool GAL_OPTIONS_PANEL::TransferDataToWindow ( )
override

Load the panel controls from the given opt.

Definition at line 188 of file gal_options_panel.cpp.

189 {
190  m_gridSnapOptions->SetSelection(
192 
193  m_gridStyle->SetSelection( UTIL::GetConfigForVal(
195 
197 
199 
201 
203 
204  return true;
205 }
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleSelectMap
TODO: These are duplicated in gal_display_options - Unify!
wxRadioBox * m_cursorShape
KIGFX::GRID_STYLE m_gridStyle
The grid style to draw the grid in
static const UTIL::CFG_MAP< KIGFX::GRID_SNAPPING > gridSnapConfigVals
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
bool m_forceDisplayCursor
Force cursor display
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
wxRadioBox * m_gridStyle
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
GRID_SNAPPING m_gridSnapping
Snapping options for the grid
wxChoice * m_gridSnapOptions
wxSpinCtrlDouble * m_gridLineWidth
double m_gridLineWidth
Thickness to render grid lines/dots
bool m_fullscreenCursor
Fullscreen crosshair or small cross
static long GetConfigForVal(const MAP &aMap, CFG_NATIVE_VAL< MAP > aVal)
Get the mapped config value (the one to write to file, or use in an index) from the given native (pro...
Definition: config_map.h:69

References UTIL::GetConfigForVal(), gridSnapConfigVals, gridStyleSelectMap, m_cursorShape, m_forceCursorDisplay, KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor, m_galOptions, m_gridLineWidth, KIGFX::GAL_DISPLAY_OPTIONS::m_gridLineWidth, m_gridMinSpacing, KIGFX::GAL_DISPLAY_OPTIONS::m_gridMinSpacing, m_gridSnapOptions, KIGFX::GAL_DISPLAY_OPTIONS::m_gridSnapping, m_gridStyle, and KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle.

Referenced by PANEL_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_GAL_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow().

Member Data Documentation

◆ l_gridLineWidth

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidth
private

Definition at line 58 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridLineWidthUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidthUnits
private

Definition at line 60 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacing

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacing
private

Definition at line 62 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacingUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacingUnits
private

Definition at line 64 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridSnapOptions

wxStaticText* GAL_OPTIONS_PANEL::l_gridSnapOptions
private

Definition at line 66 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridSnapSpace

wxStaticText* GAL_OPTIONS_PANEL::l_gridSnapSpace
private

Definition at line 68 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ m_cursorShape

wxRadioBox* GAL_OPTIONS_PANEL::m_cursorShape
private

◆ m_forceCursorDisplay

wxCheckBox* GAL_OPTIONS_PANEL::m_forceCursorDisplay
private

◆ m_galOptions

KIGFX::GAL_DISPLAY_OPTIONS& GAL_OPTIONS_PANEL::m_galOptions
private

The GAL options to read/write

Definition at line 74 of file gal_options_panel.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_gridLineWidth

wxSpinCtrlDouble* GAL_OPTIONS_PANEL::m_gridLineWidth
private

◆ m_gridMinSpacing

wxSpinCtrlDouble* GAL_OPTIONS_PANEL::m_gridMinSpacing
private

◆ m_gridSnapOptions

wxChoice* GAL_OPTIONS_PANEL::m_gridSnapOptions
private

◆ m_gridStyle

wxRadioBox* GAL_OPTIONS_PANEL::m_gridStyle
private

◆ m_mainSizer

wxBoxSizer* GAL_OPTIONS_PANEL::m_mainSizer
private

Definition at line 54 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().


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