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
 
wxTextCtrl * m_gridLineWidth
 
wxSpinButton * m_gridLineWidthSpinBtn
 
wxStaticText * l_gridLineWidthUnits
 
wxStaticText * l_gridMinSpacing
 
wxTextCtrl * m_gridMinSpacing
 
wxSpinButton * m_gridMinSpacingSpinBtn
 
wxStaticText * l_gridMinSpacingUnits
 
wxRadioBox * m_cursorShape
 
wxCheckBox * m_forceCursorDisplay
 
KIGFX::GAL_DISPLAY_OPTIONSm_galOptions
 

The GAL options to read/write

More...
 
std::unique_ptr< INCREMENTAL_TEXT_CTRLm_gridSizeIncrementer
 
std::unique_ptr< INCREMENTAL_TEXT_CTRLm_gridMinSpacingIncrementer
 

Detailed Description

Definition at line 34 of file gal_options_panel.h.

Constructor & Destructor Documentation

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

Definition at line 52 of file gal_options_panel.cpp.

References gridMinSpacingMax, gridMinSpacingMin, gridMinSpacingStep, gridThicknessMax, gridThicknessMin, gridThicknessStep, l_gridLineWidth, l_gridLineWidthUnits, l_gridMinSpacing, l_gridMinSpacingUnits, m_cursorShape, m_forceCursorDisplay, m_gridLineWidth, m_gridLineWidthSpinBtn, m_gridMinSpacing, m_gridMinSpacingIncrementer, m_gridMinSpacingSpinBtn, m_gridSizeIncrementer, m_gridStyle, and m_mainSizer.

52  :
53  wxPanel( aParent, wxID_ANY ),
54  m_galOptions( aGalOpts )
55 {
56  // the main sizer that holds "columns" of settings
57  m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
58  SetSizer( m_mainSizer );
59 
60  // second-level sizers that are one "column" of settings each
61  wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
62  m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
63 
64  // @todo LEGACY: not required when legacy is gone
65  const wxString galOnlySuffix = _( " (not supported in Legacy Toolset)" );
66 
67  /*
68  * Grid settings subpanel
69  */
70  {
71  wxStaticBoxSizer* sGridSettings;
72  sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this,
73  wxID_ANY, _( "Grid Options" ) + galOnlySuffix ), wxVERTICAL );
74 
75  wxString m_gridStyleChoices[] = {
76  _( "Dots" ),
77  _( "Lines" ),
78  _( "Small crosses" )
79  };
80  int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
81  m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
82  wxID_ANY, _( "Grid Style" ),
83  wxDefaultPosition, wxDefaultSize,
84  m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
85  sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 );
86 
87  wxFlexGridSizer* sGridSettingsGrid;
88  sGridSettingsGrid = new wxFlexGridSizer( 0, 4, 0, 0 );
89  sGridSettingsGrid->AddGrowableCol( 1 );
90  sGridSettingsGrid->SetFlexibleDirection( wxBOTH );
91  sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
92 
93  l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(),
94  wxID_ANY, _( "Grid thickness:" ) );
95  l_gridLineWidth->Wrap( -1 );
96  sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
97 
98  m_gridLineWidth = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY );
99  sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
100 
101  m_gridLineWidthSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(),
102  wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
103  sGridSettingsGrid->Add( m_gridLineWidthSpinBtn, 0, wxEXPAND | wxALL, 0 );
104 
105  l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(),
106  wxID_ANY, _( "px" ) );
107  l_gridLineWidthUnits->Wrap( -1 );
108  sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
109 
110  l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(),
111  wxID_ANY, _( "Min grid spacing:" ) );
112  l_gridMinSpacing->Wrap( -1 );
113  sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
114 
115  m_gridMinSpacing = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY);
116  sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
117 
118  m_gridMinSpacingSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(),
119  wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
120  sGridSettingsGrid->Add( m_gridMinSpacingSpinBtn, 0, wxEXPAND | wxALL, 0 );
121 
122  l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(),
123  wxID_ANY, _( "px" ) );
124  l_gridMinSpacingUnits->Wrap( -1 );
125  sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALL, 5 );
126 
127  sGridSettings->Add( sGridSettingsGrid, 1, wxALL|wxEXPAND, 5 );
128 
129  sLeftSizer->Add( sGridSettings, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
130 
131  // bind the spin buttons and text boxes
132  m_gridSizeIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
134 
137  m_gridSizeIncrementer->SetPrecision( 1 );
138 
139  m_gridMinSpacingIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
141 
144  m_gridMinSpacingIncrementer->SetPrecision( 0 ); // restrict to ints
145  }
146 
147  /*
148  * Cursor settings subpanel
149  */
150  {
151  wxString cursorDisplayTitle = _( "Cursor Options" );
152 
153  // cursor is not shown in legacy on OSX
154  // @todo LEGACY remove this
155 #ifdef __APPLE__
156  cursorDisplayTitle += galOnlySuffix;
157 #endif
158 
159  auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
160  wxID_ANY, cursorDisplayTitle ), wxVERTICAL );
161 
162  sLeftSizer->Add( sCursorSettings, 1, wxTOP | wxRIGHT | wxEXPAND, 5 );
163 
164  wxString m_CursorShapeChoices[] = {
165  _( "Small crosshair" ),
166  _( "Full window crosshair" )
167  };
168 
169  int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
170  m_cursorShape = new wxRadioBox( this, wxID_ANY,
171  _( "Cursor shape:" ), wxDefaultPosition, wxDefaultSize,
172  m_CursorShapeNChoices, m_CursorShapeChoices, 1,
173  wxRA_SPECIFY_COLS );
174 
175  m_cursorShape->SetSelection( 0 );
176  m_cursorShape->SetToolTip( _( "Cursor shape for drawing, placement and movement tools" ) );
177 
178  sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 );
179 
180 #ifdef __APPLE__
181  // Whole section is galOnly on OSX; no need for further qualifier here
182  m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always show crosshairs" ) );
183 #else
184  // User a shorter galOnly qualifier as otherwise the label is obnoxiously long
185  // @todo LEGACY remove this
186  m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY,
187  _( "Always show crosshairs (not in Legacy)" ) );
188 #endif
189 
190  sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
191  }
192 }
wxStaticText * l_gridMinSpacingUnits
wxTextCtrl * m_gridLineWidth
wxRadioBox * m_cursorShape
wxBoxSizer * m_mainSizer
static const double gridMinSpacingMax
wxTextCtrl * m_gridMinSpacing
std::unique_ptr< INCREMENTAL_TEXT_CTRL > m_gridMinSpacingIncrementer
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
std::unique_ptr< INCREMENTAL_TEXT_CTRL > m_gridSizeIncrementer
wxRadioBox * m_gridStyle
wxStaticText * l_gridMinSpacing
static const double gridThicknessMin
wxCheckBox * m_forceCursorDisplay
wxSpinButton * m_gridLineWidthSpinBtn
wxStaticText * l_gridLineWidthUnits
wxStaticText * l_gridLineWidth
static const double gridThicknessStep
static const double gridThicknessMax
static const double gridMinSpacingStep
static const double gridMinSpacingMin
wxSpinButton * m_gridMinSpacingSpinBtn

Member Function Documentation

bool GAL_OPTIONS_PANEL::TransferDataFromWindow ( )
override

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

Definition at line 212 of file gal_options_panel.cpp.

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

Referenced by PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow().

213 {
215  gridStyleSelectMap, m_gridStyle->GetSelection() );
216 
218 
220 
222 
224 
226 
227  return true;
228 }
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleSelectMap
wxRadioBox * m_cursorShape
KIGFX::GRID_STYLE m_gridStyle
The grid style to draw the grid in
std::unique_ptr< INCREMENTAL_TEXT_CTRL > m_gridMinSpacingIncrementer
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
bool m_forceDisplayCursor
Force cursor display
std::unique_ptr< INCREMENTAL_TEXT_CTRL > m_gridSizeIncrementer
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
wxRadioBox * m_gridStyle
wxCheckBox * m_forceCursorDisplay
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
double m_gridLineWidth
Thickness to render grid lines/dots
bool m_fullscreenCursor
Fullscreen crosshair or small cross
bool GAL_OPTIONS_PANEL::TransferDataToWindow ( )
override

Load the panel controls from the given opt.

Definition at line 195 of file gal_options_panel.cpp.

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

Referenced by PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow().

196 {
197  m_gridStyle->SetSelection( UTIL::GetConfigForVal(
199 
201 
203 
205 
207 
208  return true;
209 }
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleSelectMap
wxRadioBox * m_cursorShape
KIGFX::GRID_STYLE m_gridStyle
The grid style to draw the grid in
std::unique_ptr< INCREMENTAL_TEXT_CTRL > m_gridMinSpacingIncrementer
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
bool m_forceDisplayCursor
Force cursor display
std::unique_ptr< INCREMENTAL_TEXT_CTRL > m_gridSizeIncrementer
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
wxRadioBox * m_gridStyle
wxCheckBox * m_forceCursorDisplay
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

Member Data Documentation

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidth
private

Definition at line 56 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidthUnits
private

Definition at line 59 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacing
private

Definition at line 61 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacingUnits
private

Definition at line 64 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxRadioBox* GAL_OPTIONS_PANEL::m_cursorShape
private
wxCheckBox* GAL_OPTIONS_PANEL::m_forceCursorDisplay
private
KIGFX::GAL_DISPLAY_OPTIONS& GAL_OPTIONS_PANEL::m_galOptions
private

The GAL options to read/write

Definition at line 70 of file gal_options_panel.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

wxTextCtrl* GAL_OPTIONS_PANEL::m_gridLineWidth
private

Definition at line 57 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxSpinButton* GAL_OPTIONS_PANEL::m_gridLineWidthSpinBtn
private

Definition at line 58 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxTextCtrl* GAL_OPTIONS_PANEL::m_gridMinSpacing
private

Definition at line 62 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

std::unique_ptr<INCREMENTAL_TEXT_CTRL> GAL_OPTIONS_PANEL::m_gridMinSpacingIncrementer
private
wxSpinButton* GAL_OPTIONS_PANEL::m_gridMinSpacingSpinBtn
private

Definition at line 63 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

std::unique_ptr<INCREMENTAL_TEXT_CTRL> GAL_OPTIONS_PANEL::m_gridSizeIncrementer
private
wxRadioBox* GAL_OPTIONS_PANEL::m_gridStyle
private
wxBoxSizer* GAL_OPTIONS_PANEL::m_mainSizer
private

Definition at line 52 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().


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