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
 
wxChoice * m_choiceAntialiasing
 
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 62 of file gal_options_panel.cpp.

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

62  :
63  wxPanel( aParent, wxID_ANY ),
64  m_galOptions( aGalOpts )
65 {
66  // the main sizer that holds "columns" of settings
67  m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
68  SetSizer( m_mainSizer );
69 
70  // second-level sizers that are one "column" of settings each
71  wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
72  m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
73 
74  // @todo LEGACY: not required when legacy is gone
75  const wxString galOnlySuffix = _( " (OpenGL && Cairo)" );
76 
77  /*
78  * Anti-aliasing subpanel
79  */
80  {
81  wxStaticBoxSizer* sOpenGLRenderingSizer;
82  sOpenGLRenderingSizer = new wxStaticBoxSizer( new wxStaticBox( this,
83  wxID_ANY, _( "OpenGL Rendering:" ) ), wxVERTICAL );
84 
85  wxString m_choiceAntialiasingChoices[] = {
86  _( "No Antialiasing" ),
87  _( "Subpixel Antialiasing (High Quality)" ),
88  _( "Subpixel Antialiasing (Ultra Quality)" ),
89  _( "Supersampling (2x)" ),
90  _( "Supersampling (4x)" )
91  };
92  int m_choiceAntialiasingNChoices = sizeof( m_choiceAntialiasingChoices ) / sizeof( wxString );
93  m_choiceAntialiasing = new wxChoice( sOpenGLRenderingSizer->GetStaticBox(),
94  wxID_ANY, wxDefaultPosition, wxDefaultSize,
95  m_choiceAntialiasingNChoices, m_choiceAntialiasingChoices, 0 );
96  sOpenGLRenderingSizer->Add( m_choiceAntialiasing, 0, wxALL|wxEXPAND, 5 );
97 
98  sLeftSizer->Add( sOpenGLRenderingSizer, 0, wxALL|wxEXPAND, 5 );
99  }
100 
101  /*
102  * Grid setting subpanel
103  */
104  {
105  wxStaticBoxSizer* sGridSettings;
106  sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this,
107  wxID_ANY, _( "Grid Display" ) + galOnlySuffix ), wxVERTICAL );
108 
109  wxString m_gridStyleChoices[] = {
110  _( "Dots" ),
111  _( "Lines" ),
112  _( "Small crosses" )
113  };
114  int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
115  m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
116  wxID_ANY, _( "Grid Style" ),
117  wxDefaultPosition, wxDefaultSize,
118  m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
119  sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 );
120 
121  wxFlexGridSizer* sGridSettingsGrid;
122  sGridSettingsGrid = new wxFlexGridSizer( 0, 4, 0, 0 );
123  sGridSettingsGrid->AddGrowableCol( 1 );
124  sGridSettingsGrid->SetFlexibleDirection( wxBOTH );
125  sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
126 
127  l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(),
128  wxID_ANY, _( "Grid thickness:" ) );
129  l_gridLineWidth->Wrap( -1 );
130  sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
131 
132  m_gridLineWidth = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY );
133  sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND, 5 );
134 
135  m_gridLineWidthSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(),
136  wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
137  sGridSettingsGrid->Add( m_gridLineWidthSpinBtn, 0, wxEXPAND | wxALL, 0 );
138 
139  l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(),
140  wxID_ANY, _( "px" ) );
141  l_gridLineWidthUnits->Wrap( -1 );
142  sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
143 
144  l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(),
145  wxID_ANY, _( "Min grid spacing:" ) );
146  l_gridMinSpacing->Wrap( -1 );
147  sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
148 
149  m_gridMinSpacing = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY);
150  sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND, 5 );
151 
152  m_gridMinSpacingSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(),
153  wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
154  sGridSettingsGrid->Add( m_gridMinSpacingSpinBtn, 0, wxEXPAND | wxALL, 0 );
155 
156  l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(),
157  wxID_ANY, _( "px" ) );
158  l_gridMinSpacingUnits->Wrap( -1 );
159  sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALL, 5 );
160 
161  sGridSettings->Add( sGridSettingsGrid, 1, wxALL|wxEXPAND, 5 );
162 
163  sLeftSizer->Add( sGridSettings, 0, wxALL | wxEXPAND, 5 );
164 
165  // bind the spin buttons and text boxes
166  m_gridSizeIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
168 
171  m_gridSizeIncrementer->SetPrecision( 1 );
172 
173  m_gridMinSpacingIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
175 
178  m_gridMinSpacingIncrementer->SetPrecision( 0 ); // restrict to ints
179  }
180 
181  {
182  auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
183  wxID_ANY, _( "Cursor Display" ) ), wxVERTICAL );
184 
185  sLeftSizer->Add( sCursorSettings, 1, wxALL | wxEXPAND, 5 );
186 
187  wxString m_CursorShapeChoices[] = {
188  _( "Small cross" ),
189  _( "Full screen cursor" )
190  };
191 
192  wxString cursorShapeTitle = _( "Cursor Shape" );
193 
194  // cursor is not shown in legacy on OSX, so this setting won't
195  // do anything there
196  // @todo LEGACY remove this
197 #ifdef __APPLE__
198  cursorShapeTitle += galOnlySuffix;
199 #endif
200 
201  int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
202  m_cursorShape = new wxRadioBox( this, wxID_ANY,
203  cursorShapeTitle, wxDefaultPosition, wxDefaultSize,
204  m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS );
205 
206  m_cursorShape->SetSelection( 0 );
207  m_cursorShape->SetToolTip( _( "Main cursor shape selection (small cross or large cursor)" ) );
208 
209  sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 );
210 
211  m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always display cursor" ) + galOnlySuffix );
212 
213  sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
214  }
215 }
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
wxChoice * m_choiceAntialiasing
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 238 of file gal_options_panel.cpp.

References aaModeSelectMap, UTIL::GetValFromConfig(), KIGFX::GAL_DISPLAY_OPTIONS::gl_antialiasing_mode, gridStyleSelectMap, m_choiceAntialiasing, 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 DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), and DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow().

239 {
241  aaModeSelectMap, m_choiceAntialiasing->GetSelection() );
242 
244  gridStyleSelectMap, m_gridStyle->GetSelection() );
245 
247 
249 
251 
253 
255 
256  return true;
257 }
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
static const UTIL::CFG_MAP< KIGFX::OPENGL_ANTIALIASING_MODE > aaModeSelectMap
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
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
wxCheckBox * m_forceCursorDisplay
wxChoice * m_choiceAntialiasing
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 218 of file gal_options_panel.cpp.

References aaModeSelectMap, UTIL::GetConfigForVal(), KIGFX::GAL_DISPLAY_OPTIONS::gl_antialiasing_mode, gridStyleSelectMap, m_choiceAntialiasing, 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 DIALOG_DISPLAY_OPTIONS::initOptDialog(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataToWindow(), and DIALOG_DISPLAY_OPTIONS::TransferDataToWindow().

219 {
222 
223  m_gridStyle->SetSelection( UTIL::GetConfigForVal(
225 
227 
229 
231 
233 
234  return true;
235 }
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
static const UTIL::CFG_MAP< KIGFX::OPENGL_ANTIALIASING_MODE > aaModeSelectMap
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
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
wxCheckBox * m_forceCursorDisplay
wxChoice * m_choiceAntialiasing
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 58 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidthUnits
private

Definition at line 61 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacing
private

Definition at line 63 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacingUnits
private

Definition at line 66 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxChoice* GAL_OPTIONS_PANEL::m_choiceAntialiasing
private
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 72 of file gal_options_panel.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

wxTextCtrl* GAL_OPTIONS_PANEL::m_gridLineWidth
private

Definition at line 59 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxSpinButton* GAL_OPTIONS_PANEL::m_gridLineWidthSpinBtn
private

Definition at line 60 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

wxTextCtrl* GAL_OPTIONS_PANEL::m_gridMinSpacing
private

Definition at line 64 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 65 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: