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, EDA_DRAW_FRAME *aDrawFrame)
 
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

EDA_DRAW_FRAMEm_drawFrame
 
wxBoxSizer * m_mainSizer
 
wxRadioBox * m_renderingEngine
 
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
 The GAL options to read/write. More...
 
KIGFX::GAL_DISPLAY_OPTIONSm_galOptions
 

Detailed Description

Definition at line 37 of file gal_options_panel.h.

Constructor & Destructor Documentation

◆ GAL_OPTIONS_PANEL()

GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL ( wxWindow *  aParent,
EDA_DRAW_FRAME aDrawFrame 
)

Definition at line 68 of file gal_options_panel.cpp.

68  :
69  wxPanel( aParent, wxID_ANY ),
70  m_drawFrame( aDrawFrame ),
71  m_galOptions( aDrawFrame->GetGalDisplayOptions() )
72 {
73  // the main sizer that holds "columns" of settings
74  m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
75  SetSizer( m_mainSizer );
76 
77  // second-level sizers that are one "column" of settings each
78  wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
79  m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
80 
81  /*
82  * Rendering engine
83  */
84 #ifndef __WXMAC__
85  {
86  wxString engineChoices[] = { _( "Accelerated graphics" ), _( "Fallback graphics" ) };
87  m_renderingEngine = new wxRadioBox( this, wxID_ANY, _( "Rendering Engine" ),
88  wxDefaultPosition, wxDefaultSize,
89  sizeof( engineChoices ) / sizeof( wxString ),
90  engineChoices, 1, wxRA_SPECIFY_COLS );
91  m_renderingEngine->SetItemToolTip( 0, _( "Hardware-accelerated graphics (recommended)" ) );
92  m_renderingEngine->SetItemToolTip( 1, _( "Software graphics (for computers which do not "
93  "support KiCad's hardware acceleration "
94  "requirements)" ) );
95 
96  sLeftSizer->Add( m_renderingEngine, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
97  }
98 #endif
99 
100  /*
101  * Grid settings subpanel
102  */
103  {
104  wxStaticBox* sGridOpts = new wxStaticBox( this, wxID_ANY, _( "Grid Options" ) );
105  wxStaticBoxSizer* sGridSettings;
106  sGridSettings = new wxStaticBoxSizer( sGridOpts, wxVERTICAL );
107 
108  wxString m_gridStyleChoices[] = {
109  _( "Dots" ),
110  _( "Lines" ),
111  _( "Small crosses" )
112  };
113 
114  int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
115  m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(), wxID_ANY, _( "Grid Style" ),
116  wxDefaultPosition, wxDefaultSize, m_gridStyleNChoices,
117  m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
118  sGridSettings->Add( m_gridStyle, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 );
119 
120  wxFlexGridSizer* sGridSettingsGrid;
121  sGridSettingsGrid = new wxFlexGridSizer( 0, 3, 0, 0 );
122  sGridSettingsGrid->AddGrowableCol( 1 );
123  sGridSettingsGrid->SetFlexibleDirection( wxBOTH );
124  sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
125 
126  l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
127  _( "Grid thickness:" ) );
128  l_gridLineWidth->Wrap( -1 );
129  sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
130 
131  m_gridLineWidth = new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY );
133  m_gridLineWidth->SetIncrement( gridThicknessStep );
134  m_gridLineWidth->SetDigits( 1 );
135  sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
136 
137  l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
138  _( "px" ) );
139  l_gridLineWidthUnits->Wrap( -1 );
140  sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
141 
142  l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
143  _( "Min grid spacing:" ) );
144  l_gridMinSpacing->Wrap( -1 );
145  sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
146 
147  m_gridMinSpacing = new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY);
149  m_gridMinSpacing->SetIncrement( gridMinSpacingStep );
150  m_gridMinSpacing->SetDigits( 0 );
151  sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
152 
153  l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
154  _( "px" ) );
155  l_gridMinSpacingUnits->Wrap( -1 );
156  sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
157 
158  l_gridSnapOptions = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
159  _( "Snap to Grid:" ) );
160  l_gridSnapOptions->Wrap( -1 );
161  sGridSettingsGrid->Add( l_gridSnapOptions, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
162 
163  wxString gridSnapChoices[] = { _( "Always" ), _( "When grid shown" ), _( "Never" ) };
164  int gridSnapNChoices = sizeof( gridSnapChoices ) / sizeof( wxString );
165  m_gridSnapOptions = new wxChoice( sGridSettings->GetStaticBox(), wxID_ANY,
166  wxDefaultPosition, wxDefaultSize, gridSnapNChoices,
167  gridSnapChoices );
168  m_gridSnapOptions->Select( 0 );
169  sGridSettingsGrid->Add( m_gridSnapOptions, 0,
170  wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP | wxBOTTOM, 5 );
171 
172  l_gridSnapSpace = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY, _( "px" ) );
173  l_gridSnapSpace->Wrap( -1 );
174  l_gridSnapSpace->Hide();
175  sGridSettingsGrid->Add( l_gridSnapSpace, 0,
176  wxALIGN_CENTER_VERTICAL | wxALL | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
177  5 );
178 
179 
180  sGridSettings->Add( sGridSettingsGrid, 1, wxALL | wxEXPAND, 5 );
181 
182  sLeftSizer->Add( sGridSettings, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
183  }
184 
185  /*
186  * Cursor settings subpanel
187  */
188  {
189  wxStaticBox* sbCursorSettings = new wxStaticBox( this, wxID_ANY, _( "Cursor Options" ) );
190  wxStaticBoxSizer* sCursorSettings = new wxStaticBoxSizer( sbCursorSettings, wxVERTICAL );
191 
192  sLeftSizer->Add( sCursorSettings, 1, wxTOP | wxRIGHT | wxEXPAND, 5 );
193 
194  wxString m_CursorShapeChoices[] = {
195  _( "Small crosshair" ),
196  _( "Full window crosshair" )
197  };
198 
199  int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
200  m_cursorShape = new wxRadioBox( this, wxID_ANY,
201  _( "Cursor Shape" ), wxDefaultPosition, wxDefaultSize,
202  m_CursorShapeNChoices, m_CursorShapeChoices, 1,
203  wxRA_SPECIFY_COLS );
204 
205  m_cursorShape->SetSelection( 0 );
206  m_cursorShape->SetToolTip( _( "Cursor shape for drawing, placement and movement tools" ) );
207  sCursorSettings->Add( m_cursorShape, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 );
208 
209  m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always show crosshairs" ) );
210  sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
211  }
212 }
wxStaticText * l_gridMinSpacingUnits
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
wxRadioBox * m_cursorShape
wxRadioBox * m_renderingEngine
wxStaticText * l_gridSnapOptions
wxBoxSizer * m_mainSizer
static const double gridMinSpacingMax
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
wxRadioBox * m_gridStyle
wxStaticText * l_gridMinSpacing
static const double gridThicknessMin
wxStaticText * l_gridSnapSpace
EDA_DRAW_FRAME * m_drawFrame
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
The GAL options to read/write.
wxChoice * m_gridSnapOptions
#define _(s)
wxStaticText * l_gridLineWidthUnits
wxSpinCtrlDouble * m_gridLineWidth
wxStaticText * l_gridLineWidth
static const double gridThicknessStep
static const double gridThicknessMax
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, m_mainSizer, and m_renderingEngine.

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 244 of file gal_options_panel.cpp.

245 {
247  m_gridSnapOptions->GetSelection() );
248 
250  m_gridStyle->GetSelection() );
251 
253 
255 
257 
259 
260 #ifndef __WXMAC__
261  EDA_DRAW_PANEL_GAL::GAL_TYPE wantedType = m_renderingEngine->GetSelection() == 0 ?
265 
266  if( wantedType != currentType )
267  m_drawFrame->GetCanvas()->SwitchBackend( wantedType );
268 #endif
269 
270  return true;
271 }
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleSelectMap
TODO: These are duplicated in gal_display_options - Unify!
wxRadioBox * m_cursorShape
wxRadioBox * m_renderingEngine
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
virtual bool SwitchBackend(GAL_TYPE aGalType)
Switch method of rendering graphics.
static const UTIL::CFG_MAP< KIGFX::GRID_SNAPPING > gridSnapConfigVals
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
wxRadioBox * m_gridStyle
EDA_DRAW_FRAME * m_drawFrame
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
The GAL options to read/write.
GRID_SNAPPING m_gridSnapping
Thickness to render grid lines/dots.
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
Minimum pixel distance between displayed grid lines.
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
bool m_fullscreenCursor
Force cursor display.

References EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, EDA_DRAW_PANEL_GAL::GetBackend(), EDA_DRAW_FRAME::GetCanvas(), UTIL::GetValFromConfig(), gridSnapConfigVals, gridStyleSelectMap, m_cursorShape, m_drawFrame, 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, m_renderingEngine, and EDA_DRAW_PANEL_GAL::SwitchBackend().

Referenced by PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GAL_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 215 of file gal_options_panel.cpp.

216 {
217 #ifndef __WXMAC__
219  m_renderingEngine->SetSelection( 0 );
220  else
221  m_renderingEngine->SetSelection( 1 );
222 #else
224 #endif
225 
228 
231 
233 
235 
237 
239 
240  return true;
241 }
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
Snapping options for the grid.
wxRadioBox * m_renderingEngine
static const UTIL::CFG_MAP< KIGFX::GRID_SNAPPING > gridSnapConfigVals
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
wxRadioBox * m_gridStyle
EDA_DRAW_FRAME * m_drawFrame
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
The GAL options to read/write.
GRID_SNAPPING m_gridSnapping
Thickness to render grid lines/dots.
wxChoice * m_gridSnapOptions
wxSpinCtrlDouble * m_gridLineWidth
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
void ignore_unused(const T &)
Definition: ignore.h:24
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
bool m_fullscreenCursor
Force cursor display.
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 EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, EDA_DRAW_PANEL_GAL::GetBackend(), EDA_DRAW_FRAME::GetCanvas(), UTIL::GetConfigForVal(), gridSnapConfigVals, gridStyleSelectMap, ignore_unused(), m_cursorShape, m_drawFrame, 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 m_renderingEngine.

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

Member Data Documentation

◆ l_gridLineWidth

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidth
private

Definition at line 63 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridLineWidthUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidthUnits
private

Definition at line 65 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacing

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacing
private

Definition at line 67 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacingUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacingUnits
private

Definition at line 69 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridSnapOptions

wxStaticText* GAL_OPTIONS_PANEL::l_gridSnapOptions
private

Definition at line 71 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridSnapSpace

wxStaticText* GAL_OPTIONS_PANEL::l_gridSnapSpace
private

Definition at line 73 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ m_cursorShape

wxRadioBox* GAL_OPTIONS_PANEL::m_cursorShape
private

◆ m_drawFrame

EDA_DRAW_FRAME* GAL_OPTIONS_PANEL::m_drawFrame
private

Definition at line 54 of file gal_options_panel.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_forceCursorDisplay

wxCheckBox* GAL_OPTIONS_PANEL::m_forceCursorDisplay
private

The GAL options to read/write.

Definition at line 76 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL(), TransferDataFromWindow(), and TransferDataToWindow().

◆ m_galOptions

KIGFX::GAL_DISPLAY_OPTIONS& GAL_OPTIONS_PANEL::m_galOptions
private

Definition at line 79 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 56 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ m_renderingEngine

wxRadioBox* GAL_OPTIONS_PANEL::m_renderingEngine
private

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