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
 
wxRadioBox * m_gridStyle
 
wxStaticText * l_gridLineWidth
 
wxSpinCtrlDouble * m_gridLineWidth
 
wxStaticText * l_gridLineWidthUnits
 
wxStaticText * l_gridMinSpacing
 
wxSpinCtrlDouble * m_gridMinSpacing
 
wxStaticText * l_gridMinSpacingUnits
 
wxRadioBox * m_cursorShape
 
wxCheckBox * m_forceCursorDisplay
 
KIGFX::GAL_DISPLAY_OPTIONSm_galOptions
 

The GAL options to read/write

More...
 

Detailed Description

Definition at line 36 of file gal_options_panel.h.

Constructor & Destructor Documentation

◆ GAL_OPTIONS_PANEL()

GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL ( wxWindow *  aParent,
KIGFX::GAL_DISPLAY_OPTIONS aGalOpts 
)

Definition at line 57 of file gal_options_panel.cpp.

57  :
58  wxPanel( aParent, wxID_ANY ),
59  m_galOptions( aGalOpts )
60 {
61  // the main sizer that holds "columns" of settings
62  m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
63  SetSizer( m_mainSizer );
64 
65  // second-level sizers that are one "column" of settings each
66  wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
67  m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
68 
69  /*
70  * Grid settings subpanel
71  */
72  {
73  wxStaticBox* sGridOpts = new wxStaticBox( this, wxID_ANY, _( "Grid Options" ) );
74  wxStaticBoxSizer* sGridSettings;
75  sGridSettings = new wxStaticBoxSizer( sGridOpts, wxVERTICAL );
76 
77  wxString m_gridStyleChoices[] = {
78  _( "Dots" ),
79  _( "Lines" ),
80  _( "Small crosses" )
81  };
82  int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
83  m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(),
84  wxID_ANY, _( "Grid Style" ),
85  wxDefaultPosition, wxDefaultSize,
86  m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
87  sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 );
88 
89  wxFlexGridSizer* sGridSettingsGrid;
90  sGridSettingsGrid = new wxFlexGridSizer( 0, 3, 0, 0 );
91  sGridSettingsGrid->AddGrowableCol( 1 );
92  sGridSettingsGrid->SetFlexibleDirection( wxBOTH );
93  sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
94 
95  l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(),
96  wxID_ANY, _( "Grid thickness:" ) );
97  l_gridLineWidth->Wrap( -1 );
98  sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
99 
100  m_gridLineWidth = new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY );
102  m_gridLineWidth->SetIncrement( gridThicknessStep );
103  m_gridLineWidth->SetDigits( 1 );
104  sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
105 
106  l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(),
107  wxID_ANY, _( "px" ) );
108  l_gridLineWidthUnits->Wrap( -1 );
109  sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
110 
111  l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(),
112  wxID_ANY, _( "Min grid spacing:" ) );
113  l_gridMinSpacing->Wrap( -1 );
114  sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
115 
116  m_gridMinSpacing = new wxSpinCtrlDouble( sGridSettings->GetStaticBox(), wxID_ANY);
118  m_gridMinSpacing->SetIncrement( gridMinSpacingStep );
119  m_gridMinSpacing->SetDigits( 0 );
120  sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
121 
122  l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(),
123  wxID_ANY, _( "px" ) );
124  l_gridMinSpacingUnits->Wrap( -1 );
125  sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
126 
127  sGridSettings->Add( sGridSettingsGrid, 1, wxALL | wxEXPAND, 5 );
128 
129  sLeftSizer->Add( sGridSettings, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 );
130  }
131 
132  /*
133  * Cursor settings subpanel
134  */
135  {
136  auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
137  wxID_ANY, _( "Cursor Options" ) ), wxVERTICAL );
138 
139  sLeftSizer->Add( sCursorSettings, 1, wxTOP | wxRIGHT | wxEXPAND, 5 );
140 
141  wxString m_CursorShapeChoices[] = {
142  _( "Small crosshair" ),
143  _( "Full window crosshair" )
144  };
145 
146  int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString );
147  m_cursorShape = new wxRadioBox( this, wxID_ANY,
148  _( "Cursor Shape" ), wxDefaultPosition, wxDefaultSize,
149  m_CursorShapeNChoices, m_CursorShapeChoices, 1,
150  wxRA_SPECIFY_COLS );
151 
152  m_cursorShape->SetSelection( 0 );
153  m_cursorShape->SetToolTip( _( "Cursor shape for drawing, placement and movement tools" ) );
154  sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 );
155 
156  m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always show crosshairs" ) );
157  sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
158  }
159 }
wxStaticText * l_gridMinSpacingUnits
wxRadioBox * m_cursorShape
wxBoxSizer * m_mainSizer
static const double gridMinSpacingMax
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
wxRadioBox * m_gridStyle
wxStaticText * l_gridMinSpacing
static const double gridThicknessMin
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
#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, m_cursorShape, m_forceCursorDisplay, m_gridLineWidth, m_gridMinSpacing, m_gridStyle, and m_mainSizer.

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

180 {
182  gridStyleSelectMap, m_gridStyle->GetSelection() );
183 
185 
187 
189 
191 
193 
194  return true;
195 }
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
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
bool m_forceDisplayCursor
Force cursor display
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
wxRadioBox * m_gridStyle
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
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
Thickness to render grid lines/dots
bool m_fullscreenCursor
Fullscreen crosshair or small cross

References UTIL::GetValFromConfig(), gridStyleSelectMap, m_cursorShape, 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_gridStyle, KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle, and KIGFX::GAL_DISPLAY_OPTIONS::NotifyChanged().

Referenced by PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_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 162 of file gal_options_panel.cpp.

163 {
164  m_gridStyle->SetSelection( UTIL::GetConfigForVal(
166 
168 
170 
172 
174 
175  return true;
176 }
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
KIGFX::GAL_DISPLAY_OPTIONS & m_galOptions
The GAL options to read/write
bool m_forceDisplayCursor
Force cursor display
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
wxRadioBox * m_gridStyle
wxSpinCtrlDouble * m_gridMinSpacing
wxCheckBox * m_forceCursorDisplay
wxSpinCtrlDouble * m_gridLineWidth
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

References UTIL::GetConfigForVal(), gridStyleSelectMap, m_cursorShape, 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_gridStyle, and KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle.

Referenced by PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow().

Member Data Documentation

◆ l_gridLineWidth

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidth
private

Definition at line 58 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridLineWidthUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridLineWidthUnits
private

Definition at line 60 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacing

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacing
private

Definition at line 62 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ l_gridMinSpacingUnits

wxStaticText* GAL_OPTIONS_PANEL::l_gridMinSpacingUnits
private

Definition at line 64 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().

◆ m_cursorShape

wxRadioBox* GAL_OPTIONS_PANEL::m_cursorShape
private

◆ m_forceCursorDisplay

wxCheckBox* GAL_OPTIONS_PANEL::m_forceCursorDisplay
private

◆ m_galOptions

KIGFX::GAL_DISPLAY_OPTIONS& GAL_OPTIONS_PANEL::m_galOptions
private

The GAL options to read/write

Definition at line 70 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_gridStyle

wxRadioBox* GAL_OPTIONS_PANEL::m_gridStyle
private

◆ m_mainSizer

wxBoxSizer* GAL_OPTIONS_PANEL::m_mainSizer
private

Definition at line 54 of file gal_options_panel.h.

Referenced by GAL_OPTIONS_PANEL().


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