KiCad PCB EDA Suite
PANEL_DISPLAY_OPTIONS Class Reference

#include <panel_display_options.h>

Inheritance diagram for PANEL_DISPLAY_OPTIONS:
PANEL_DISPLAY_OPTIONS_BASE

Public Member Functions

 PANEL_DISPLAY_OPTIONS (PCB_BASE_FRAME *aFrame, PAGED_DIALOG *aWindow)
 
bool TransferDataFromWindow () override
 
bool TransferDataToWindow () override
 

Protected Types

enum  { ID_SHOW_CLEARANCE = 1000 }
 

Protected Attributes

wxBoxSizer * m_galOptionsSizer
 
wxSimplebook * m_optionsBook
 
wxRadioBox * m_ShowNetNamesOption
 
wxCheckBox * m_OptDisplayPadNumber
 
wxCheckBox * m_OptDisplayPadNoConn
 
wxRadioBox * m_OptDisplayTracksClearance
 
wxCheckBox * m_OptDisplayPadClearence
 
wxCheckBox * m_checkCrossProbeCenter
 
wxCheckBox * m_checkCrossProbeZoom
 
wxCheckBox * m_checkCrossProbeAutoHighlight
 
wxCheckBox * m_live3Drefresh
 

Private Attributes

PCB_BASE_FRAMEm_frame
 
GAL_OPTIONS_PANELm_galOptsPanel
 

Detailed Description

Definition at line 25 of file panel_display_options.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
ID_SHOW_CLEARANCE 

Definition at line 35 of file panel_display_options_base.h.

Constructor & Destructor Documentation

◆ PANEL_DISPLAY_OPTIONS()

PANEL_DISPLAY_OPTIONS::PANEL_DISPLAY_OPTIONS ( PCB_BASE_FRAME aFrame,
PAGED_DIALOG aWindow 
)

Definition at line 43 of file panel_display_options.cpp.

43  :
44  PANEL_DISPLAY_OPTIONS_BASE( aParent->GetTreebook() ),
45  m_frame( aFrame )
46 {
48  m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
49 
50  m_optionsBook->SetSelection( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) ? 1 : 0 );
51 }
PANEL_DISPLAY_OPTIONS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
GAL_OPTIONS_PANEL * m_galOptsPanel

References m_frame, PANEL_DISPLAY_OPTIONS_BASE::m_galOptionsSizer, m_galOptsPanel, and PANEL_DISPLAY_OPTIONS_BASE::m_optionsBook.

Member Function Documentation

◆ TransferDataFromWindow()

bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow ( )
override

Definition at line 88 of file panel_display_options.cpp.

89 {
91 
92  // Apply changes to the GAL
93  KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
94  KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
95  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
96 
97  PCB_EDIT_FRAME* pcbEdit = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
98 
99  if( pcbEdit )
100  {
101  PCB_DISPLAY_OPTIONS displ_opts = pcbEdit->GetDisplayOptions();
102 
105 
106  displ_opts.m_DisplayPadClearance = m_OptDisplayPadClearence->GetValue();
107  displ_opts.m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
108 
110  displ_opts.m_DisplayPadNoConnects = m_OptDisplayPadNoConn->GetValue();
111 
112  displ_opts.m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
113  displ_opts.m_Live3DRefresh = m_live3Drefresh->GetValue();
114 
115  pcbEdit->SetDisplayOptions( displ_opts );
116  settings->LoadDisplayOptions( displ_opts, pcbEdit->ShowPageLimits() );
118 
119  CROSS_PROBING_SETTINGS& crossProbing = pcbEdit->GetPcbNewSettings()->m_CrossProbing;
120 
121  crossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
122  crossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
123  crossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
124 
125  // Mark items with clearance display for repaint
127  []( KIGFX::VIEW_ITEM* aItem ) -> bool
128  {
129  if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( aItem ) )
130  {
131  return( item->Type() == PCB_TRACE_T ||
132  item->Type() == PCB_ARC_T ||
133  item->Type() == PCB_VIA_T ||
134  item->Type() == PCB_PAD_T );
135  }
136 
137  return false;
138  } );
139  }
140 
142 
143  return true;
144 }
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Change the visibility of an element category.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1478
static const UTIL::CFG_MAP< PCB_DISPLAY_OPTIONS::TRACE_CLEARANCE_DISPLAY_MODE_T > traceClearanceSelectMap
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class PAD, a pad in a footprint
Definition: typeinfo.h:89
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:76
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:241
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
bool ShowPageLimits() const
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
GAL_OPTIONS_PANEL * m_galOptsPanel
PCB specific render settings.
Definition: pcb_painter.h:64
Cross-probing behavior.
Definition: app_settings.h:30
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
Item needs to be redrawn.
Definition: view_item.h:52
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:247
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
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
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
show a marker on pads with no nets
Definition: layer_ids.h:203
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
bool m_Live3DRefresh
If true, 3D viewer will redraw on every modification operation.
The main frame for Pcbnew.
PCBNEW_SETTINGS * GetPcbNewSettings() const
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:167
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.

References CROSS_PROBING_SETTINGS::auto_highlight, CROSS_PROBING_SETTINGS::center_on_items, PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), KIGFX::VIEW::GetPainter(), PCB_BASE_FRAME::GetPcbNewSettings(), KIGFX::PCB_PAINTER::GetSettings(), UTIL::GetValFromConfig(), PCB_DRAW_PANEL_GAL::GetView(), LAYER_NO_CONNECTS, LAYER_RATSNEST, PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeAutoHighlight, PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeCenter, PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeZoom, APP_SETTINGS_BASE::m_CrossProbing, PCB_DISPLAY_OPTIONS::m_DisplayNetNamesMode, PCB_DISPLAY_OPTIONS::m_DisplayPadClearance, PCB_DISPLAY_OPTIONS::m_DisplayPadNoConnects, PCB_DISPLAY_OPTIONS::m_DisplayPadNum, m_frame, m_galOptsPanel, PANEL_DISPLAY_OPTIONS_BASE::m_live3Drefresh, PCB_DISPLAY_OPTIONS::m_Live3DRefresh, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadClearence, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadNoConn, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadNumber, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayTracksClearance, PCB_DISPLAY_OPTIONS::m_ShowGlobalRatsnest, PANEL_DISPLAY_OPTIONS_BASE::m_ShowNetNamesOption, PCB_DISPLAY_OPTIONS::m_ShowTrackClearanceMode, KIGFX::VIEW::MarkTargetDirty(), PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, KIGFX::REPAINT, PCB_BASE_FRAME::SetDisplayOptions(), PCB_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_FRAME::ShowPageLimits(), KIGFX::TARGET_NONCACHED, traceClearanceSelectMap, GAL_OPTIONS_PANEL::TransferDataFromWindow(), KIGFX::VIEW::UpdateAllItemsConditionally(), and CROSS_PROBING_SETTINGS::zoom_to_fit.

◆ TransferDataToWindow()

bool PANEL_DISPLAY_OPTIONS::TransferDataToWindow ( )
override

Definition at line 54 of file panel_display_options.cpp.

55 {
56  PCB_EDIT_FRAME* pcbEdit = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
57 
58  if( pcbEdit )
59  {
60  const PCB_DISPLAY_OPTIONS& displ_opts = pcbEdit->GetDisplayOptions();
61 
64 
65  m_OptDisplayPadClearence->SetValue( displ_opts.m_DisplayPadClearance );
66  m_OptDisplayPadNumber->SetValue( displ_opts.m_DisplayPadNum );
68  m_ShowNetNamesOption->SetSelection( displ_opts.m_DisplayNetNamesMode );
69 
70  m_live3Drefresh->SetValue( displ_opts.m_Live3DRefresh );
71 
72  CROSS_PROBING_SETTINGS& crossProbing = pcbEdit->GetPcbNewSettings()->m_CrossProbing;
73 
74  m_checkCrossProbeCenter->SetValue( crossProbing.center_on_items );
75  m_checkCrossProbeZoom->SetValue( crossProbing.zoom_to_fit );
76  m_checkCrossProbeAutoHighlight->SetValue( crossProbing.auto_highlight );
77  }
78 
80 
81  return true;
82 }
static const UTIL::CFG_MAP< PCB_DISPLAY_OPTIONS::TRACE_CLEARANCE_DISPLAY_MODE_T > traceClearanceSelectMap
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
GAL_OPTIONS_PANEL * m_galOptsPanel
Cross-probing behavior.
Definition: app_settings.h:30
Container for display options like enable/disable some optional drawings.
bool TransferDataToWindow() override
Load the panel controls from the given opt.
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
show a marker on pads with no nets
Definition: layer_ids.h:203
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
bool m_Live3DRefresh
If true, 3D viewer will redraw on every modification operation.
The main frame for Pcbnew.
PCBNEW_SETTINGS * GetPcbNewSettings() const
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:167
bool IsElementVisible(GAL_LAYER_ID aElement) const
Test whether a given element category is visible.
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
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 CROSS_PROBING_SETTINGS::auto_highlight, CROSS_PROBING_SETTINGS::center_on_items, UTIL::GetConfigForVal(), PCB_BASE_FRAME::GetDisplayOptions(), PCB_BASE_FRAME::GetPcbNewSettings(), PCB_EDIT_FRAME::IsElementVisible(), LAYER_NO_CONNECTS, PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeAutoHighlight, PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeCenter, PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeZoom, APP_SETTINGS_BASE::m_CrossProbing, PCB_DISPLAY_OPTIONS::m_DisplayNetNamesMode, PCB_DISPLAY_OPTIONS::m_DisplayPadClearance, PCB_DISPLAY_OPTIONS::m_DisplayPadNum, m_frame, m_galOptsPanel, PANEL_DISPLAY_OPTIONS_BASE::m_live3Drefresh, PCB_DISPLAY_OPTIONS::m_Live3DRefresh, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadClearence, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadNoConn, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadNumber, PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayTracksClearance, PANEL_DISPLAY_OPTIONS_BASE::m_ShowNetNamesOption, PCB_DISPLAY_OPTIONS::m_ShowTrackClearanceMode, traceClearanceSelectMap, GAL_OPTIONS_PANEL::TransferDataToWindow(), and CROSS_PROBING_SETTINGS::zoom_to_fit.

Member Data Documentation

◆ m_checkCrossProbeAutoHighlight

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeAutoHighlight
protectedinherited

◆ m_checkCrossProbeCenter

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeCenter
protectedinherited

◆ m_checkCrossProbeZoom

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_checkCrossProbeZoom
protectedinherited

◆ m_frame

PCB_BASE_FRAME* PANEL_DISPLAY_OPTIONS::m_frame
private

◆ m_galOptionsSizer

wxBoxSizer* PANEL_DISPLAY_OPTIONS_BASE::m_galOptionsSizer
protectedinherited

◆ m_galOptsPanel

GAL_OPTIONS_PANEL* PANEL_DISPLAY_OPTIONS::m_galOptsPanel
private

◆ m_live3Drefresh

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_live3Drefresh
protectedinherited

◆ m_OptDisplayPadClearence

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadClearence
protectedinherited

◆ m_OptDisplayPadNoConn

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadNoConn
protectedinherited

◆ m_OptDisplayPadNumber

wxCheckBox* PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayPadNumber
protectedinherited

◆ m_OptDisplayTracksClearance

wxRadioBox* PANEL_DISPLAY_OPTIONS_BASE::m_OptDisplayTracksClearance
protectedinherited

◆ m_optionsBook

wxSimplebook* PANEL_DISPLAY_OPTIONS_BASE::m_optionsBook
protectedinherited

◆ m_ShowNetNamesOption

wxRadioBox* PANEL_DISPLAY_OPTIONS_BASE::m_ShowNetNamesOption
protectedinherited

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