26 #include <wx/checkbox.h> 27 #include <wx/choice.h> 28 #include <wx/radiobox.h> 29 #include <wx/spinctrl.h> 30 #include <wx/stattext.h> 31 #include <wx/statbox.h> 69 wxPanel( aParent, wxID_ANY ),
70 m_drawFrame( aDrawFrame ),
71 m_galOptions( aDrawFrame->GetGalDisplayOptions() )
78 wxBoxSizer* sLeftSizer =
new wxBoxSizer( wxVERTICAL );
79 m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
86 wxString engineChoices[] = {
_(
"Accelerated graphics" ),
_(
"Fallback graphics" ) };
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 " 96 sLeftSizer->Add(
m_renderingEngine, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
104 wxStaticBox* sGridOpts =
new wxStaticBox(
this, wxID_ANY,
_(
"Grid Options" ) );
105 wxStaticBoxSizer* sGridSettings;
106 sGridSettings =
new wxStaticBoxSizer( sGridOpts, wxVERTICAL );
108 wxString m_gridStyleChoices[] = {
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 );
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 );
126 l_gridLineWidth =
new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
127 _(
"Grid thickness:" ) );
129 sGridSettingsGrid->Add(
l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
131 m_gridLineWidth =
new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY );
135 sGridSettingsGrid->Add(
m_gridLineWidth, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
142 l_gridMinSpacing =
new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
143 _(
"Min grid spacing:" ) );
145 sGridSettingsGrid->Add(
l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
147 m_gridMinSpacing =
new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY);
151 sGridSettingsGrid->Add(
m_gridMinSpacing, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
159 _(
"Snap to Grid:" ) );
161 sGridSettingsGrid->Add(
l_gridSnapOptions, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
163 wxString gridSnapChoices[] = {
_(
"Always" ),
_(
"When grid shown" ),
_(
"Never" ) };
164 int gridSnapNChoices =
sizeof( gridSnapChoices ) /
sizeof( wxString );
166 wxDefaultPosition, wxDefaultSize, gridSnapNChoices,
170 wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP | wxBOTTOM, 5 );
172 l_gridSnapSpace =
new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY,
_(
"px" ) );
176 wxALIGN_CENTER_VERTICAL | wxALL | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
180 sGridSettings->Add( sGridSettingsGrid, 1, wxALL | wxEXPAND, 5 );
182 sLeftSizer->Add( sGridSettings, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
189 wxStaticBox* sbCursorSettings =
new wxStaticBox(
this, wxID_ANY,
_(
"Cursor Options" ) );
190 wxStaticBoxSizer* sCursorSettings =
new wxStaticBoxSizer( sbCursorSettings, wxVERTICAL );
192 sLeftSizer->Add( sCursorSettings, 1, wxTOP | wxRIGHT | wxEXPAND, 5 );
194 wxString m_CursorShapeChoices[] = {
195 _(
"Small crosshair" ),
196 _(
"Full window crosshair" )
199 int m_CursorShapeNChoices =
sizeof( m_CursorShapeChoices ) /
sizeof( wxString );
201 _(
"Cursor Shape" ), wxDefaultPosition, wxDefaultSize,
202 m_CursorShapeNChoices, m_CursorShapeChoices, 1,
206 m_cursorShape->SetToolTip(
_(
"Cursor shape for drawing, placement and movement tools" ) );
207 sCursorSettings->Add(
m_cursorShape, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 );
266 if( wantedType != currentType )
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleSelectMap
TODO: These are duplicated in gal_display_options - Unify!
wxStaticText * l_gridMinSpacingUnits
wxRadioBox * m_cursorShape
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
wxRadioBox * m_renderingEngine
wxStaticText * l_gridSnapOptions
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.
static const double gridMinSpacingMax
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
The base class for create windows for drawing purpose.
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
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.
GRID_SNAPPING m_gridSnapping
Thickness to render grid lines/dots.
bool TransferDataToWindow() override
Load the panel controls from the given opt.
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...
Use small cross instead of dots for the grid.
wxStaticText * l_gridLineWidthUnits
wxSpinCtrlDouble * m_gridLineWidth
wxStaticText * l_gridLineWidth
static const double gridThicknessStep
static const double gridThicknessMax
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
void ignore_unused(const T &)
static const double gridMinSpacingStep
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
GAL_OPTIONS_PANEL(wxWindow *aParent, EDA_DRAW_FRAME *aDrawFrame)
std::vector< std::pair< T, long > > CFG_MAP
A config value table is a list of native values (usually enums) to a different set of values,...
static const double gridMinSpacingMin
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...
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.