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, APP_SETTINGS_BASE *aAppSettings)
 
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...
 
bool ResetPanel (APP_SETTINGS_BASE *aAppSettings)
 

Private Attributes

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
 
APP_SETTINGS_BASEm_cfg
 

Detailed Description

Definition at line 40 of file gal_options_panel.h.

Constructor & Destructor Documentation

◆ GAL_OPTIONS_PANEL()

GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL ( wxWindow *  aParent,
APP_SETTINGS_BASE aAppSettings 
)

Definition at line 70 of file gal_options_panel.cpp.

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

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

◆ ResetPanel()

bool GAL_OPTIONS_PANEL::ResetPanel ( APP_SETTINGS_BASE aAppSettings)

Definition at line 264 of file gal_options_panel.cpp.

265{
266 APP_SETTINGS_BASE* saved = m_cfg;
267
268 m_cfg = aAppSettings;
270 m_cfg = saved;
271
272 return true;
273}
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:110
bool TransferDataToWindow() override
Load the panel controls from the given opt.

References m_cfg, and TransferDataToWindow().

Referenced by PANEL_EESCHEMA_DISPLAY_OPTIONS::ResetPanel(), PANEL_SYM_DISPLAY_OPTIONS::ResetPanel(), PANEL_GERBVIEW_DISPLAY_OPTIONS::ResetPanel(), PANEL_PL_EDITOR_DISPLAY_OPTIONS::ResetPanel(), and PANEL_DISPLAY_OPTIONS::ResetPanel().

◆ 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{
246 m_cfg->m_Window.grid.snap = m_gridSnapOptions->GetSelection();
247 m_cfg->m_Window.grid.style = m_gridStyle->GetSelection();
250
253
254#ifndef __WXMAC__
255 m_cfg->m_Graphics.canvas_type = m_renderingEngine->GetSelection() == 0 ?
258#endif
259
260 return true;
261}
WINDOW_SETTINGS m_Window
Definition: app_settings.h:187
@ GAL_TYPE_OPENGL
OpenGL implementation.
@ GAL_TYPE_CAIRO
Cairo implementation.
bool always_show_cursor
Definition: app_settings.h:43
bool fullscreen_cursor
Definition: app_settings.h:44
double line_width
Definition: app_settings.h:59
double min_spacing
Definition: app_settings.h:60
CURSOR_SETTINGS cursor
Definition: app_settings.h:98
GRID_SETTINGS grid
Definition: app_settings.h:99

References CURSOR_SETTINGS::always_show_cursor, APP_SETTINGS_BASE::GRAPHICS::canvas_type, WINDOW_SETTINGS::cursor, CURSOR_SETTINGS::fullscreen_cursor, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, WINDOW_SETTINGS::grid, GRID_SETTINGS::line_width, m_cfg, m_cursorShape, m_forceCursorDisplay, APP_SETTINGS_BASE::m_Graphics, m_gridLineWidth, m_gridMinSpacing, m_gridSnapOptions, m_gridStyle, m_renderingEngine, APP_SETTINGS_BASE::m_Window, GRID_SETTINGS::min_spacing, GRID_SETTINGS::snap, and GRID_SETTINGS::style.

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

◆ TransferDataToWindow()

bool GAL_OPTIONS_PANEL::TransferDataToWindow ( )
override

Load the panel controls from the given opt.

Definition at line 221 of file gal_options_panel.cpp.

222{
223#ifndef __WXMAC__
224 auto canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( m_cfg->m_Graphics.canvas_type );
225
226 if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
227 m_renderingEngine->SetSelection( 0 );
228 else
229 m_renderingEngine->SetSelection( 1 );
230#endif
231
232 m_gridSnapOptions->SetSelection( m_cfg->m_Window.grid.snap );
233 m_gridStyle->SetSelection( m_cfg->m_Window.grid.style );
236
239
240 return true;
241}

References CURSOR_SETTINGS::always_show_cursor, APP_SETTINGS_BASE::GRAPHICS::canvas_type, WINDOW_SETTINGS::cursor, CURSOR_SETTINGS::fullscreen_cursor, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, WINDOW_SETTINGS::grid, GRID_SETTINGS::line_width, m_cfg, m_cursorShape, m_forceCursorDisplay, APP_SETTINGS_BASE::m_Graphics, m_gridLineWidth, m_gridMinSpacing, m_gridSnapOptions, m_gridStyle, m_renderingEngine, APP_SETTINGS_BASE::m_Window, GRID_SETTINGS::min_spacing, GRID_SETTINGS::snap, and GRID_SETTINGS::style.

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

Member Data Documentation

◆ l_gridLineWidth

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidth
private

Definition at line 66 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridLineWidthUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidthUnits
private

Definition at line 68 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacing

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacing
private

Definition at line 70 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacingUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacingUnits
private

Definition at line 72 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridSnapOptions

wxStaticText* GAL_OPTIONS_PANEL::l_gridSnapOptions
private

Definition at line 74 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridSnapSpace

wxStaticText* GAL_OPTIONS_PANEL::l_gridSnapSpace
private

Definition at line 76 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ m_cfg

APP_SETTINGS_BASE* GAL_OPTIONS_PANEL::m_cfg
private

Definition at line 81 of file gal_options_panel.h.

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

◆ m_cursorShape

wxRadioBox* GAL_OPTIONS_PANEL::m_cursorShape
private

◆ m_forceCursorDisplay

wxCheckBox* GAL_OPTIONS_PANEL::m_forceCursorDisplay
private

◆ 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 59 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: