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

69 :
70 wxPanel( aParent, wxID_ANY ),
71 m_cfg( aAppSettings )
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}
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 258 of file gal_options_panel.cpp.

259{
260 APP_SETTINGS_BASE* saved = m_cfg;
261
262 m_cfg = aAppSettings;
264 m_cfg = saved;
265
266 return true;
267}
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 238 of file gal_options_panel.cpp.

239{
240 m_cfg->m_Window.grid.snap = m_gridSnapOptions->GetSelection();
241 m_cfg->m_Window.grid.style = m_gridStyle->GetSelection();
244
247
248#ifndef __WXMAC__
249 m_cfg->m_Graphics.canvas_type = m_renderingEngine->GetSelection() == 0 ?
252#endif
253
254 return true;
255}
WINDOW_SETTINGS m_Window
Definition: app_settings.h:193
@ 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 215 of file gal_options_panel.cpp.

216{
217#ifndef __WXMAC__
218 auto canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( m_cfg->m_Graphics.canvas_type );
219
220 if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
221 m_renderingEngine->SetSelection( 0 );
222 else
223 m_renderingEngine->SetSelection( 1 );
224#endif
225
226 m_gridSnapOptions->SetSelection( m_cfg->m_Window.grid.snap );
227 m_gridStyle->SetSelection( m_cfg->m_Window.grid.style );
230
233
234 return true;
235}

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: