KiCad PCB EDA Suite
PANEL_SELECTION_FILTER Class Reference

#include <panel_selection_filter.h>

Inheritance diagram for PANEL_SELECTION_FILTER:
PANEL_SELECTION_FILTER_BASE

Public Member Functions

 PANEL_SELECTION_FILTER (wxWindow *aParent)
 
 ~PANEL_SELECTION_FILTER ()=default
 
void SetCheckboxesFromFilter (SELECTION_FILTER_OPTIONS &aOptions)
 

Protected Member Functions

void OnFilterChanged (wxCommandEvent &aEvent) override
 
virtual void OnUpdateUI (wxUpdateUIEvent &event)
 

Protected Attributes

wxCheckBox * m_cbAllItems
 
wxCheckBox * m_cbLockedItems
 
wxCheckBox * m_cbFootprints
 
wxCheckBox * m_cbText
 
wxCheckBox * m_cbTracks
 
wxCheckBox * m_cbVias
 
wxCheckBox * m_cbPads
 
wxCheckBox * m_cbGraphics
 
wxCheckBox * m_cbZones
 
wxCheckBox * m_cbKeepouts
 
wxCheckBox * m_cbDimensions
 
wxCheckBox * m_cbOtherItems
 

Private Member Functions

bool setFilterFromCheckboxes (SELECTION_FILTER_OPTIONS &aOptions)
 
void onRightClick (wxMouseEvent &aEvent)
 
void onPopupSelection (wxCommandEvent &aEvent)
 

Private Attributes

PCB_BASE_EDIT_FRAMEm_frame
 
PCB_SELECTION_TOOLm_tool
 
wxCheckBox * m_onlyCheckbox
 

Detailed Description

Definition at line 31 of file panel_selection_filter.h.

Constructor & Destructor Documentation

◆ PANEL_SELECTION_FILTER()

PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER ( wxWindow *  aParent)

Definition at line 27 of file panel_selection_filter.cpp.

27  :
28  PANEL_SELECTION_FILTER_BASE( aParent ),
29  m_frame( dynamic_cast<PCB_BASE_EDIT_FRAME*>( aParent ) ),
30  m_onlyCheckbox( nullptr )
31 {
32  wxFont font = KIUI::GetInfoFont( this );
33  m_cbLockedItems->SetFont( font );
34  m_cbFootprints->SetFont( font );
35  m_cbText->SetFont( font );
36  m_cbTracks->SetFont( font );
37  m_cbVias->SetFont( font );
38  m_cbPads->SetFont( font );
39  m_cbGraphics->SetFont( font );
40  m_cbZones->SetFont( font );
41  m_cbKeepouts->SetFont( font );
42  m_cbDimensions->SetFont( font );
43  m_cbOtherItems->SetFont( font );
44  m_cbAllItems->SetFont( font );
45 
46  wxASSERT( m_frame );
48  wxASSERT( m_tool );
49 
52 
53  m_cbFootprints->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
54  m_cbText->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
55  m_cbTracks->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
56  m_cbVias->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
57  m_cbPads->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
58  m_cbGraphics->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
59  m_cbZones->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
60  m_cbKeepouts->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
61  m_cbDimensions->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
62  m_cbOtherItems->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
63 }
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
void SetCheckboxesFromFilter(SELECTION_FILTER_OPTIONS &aOptions)
This file contains data structures that are saved in the project file or project local settings file ...
PANEL_SELECTION_FILTER_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(249, 146), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void onRightClick(wxMouseEvent &aEvent)
The selection tool: currently supports:
PCB_BASE_EDIT_FRAME * m_frame
SELECTION_FILTER_OPTIONS & GetFilter()
Set up handlers for various events.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
PCB_SELECTION_TOOL * m_tool

References PCB_SELECTION_TOOL::GetFilter(), KIUI::GetInfoFont(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), PANEL_SELECTION_FILTER_BASE::m_cbAllItems, PANEL_SELECTION_FILTER_BASE::m_cbDimensions, PANEL_SELECTION_FILTER_BASE::m_cbFootprints, PANEL_SELECTION_FILTER_BASE::m_cbGraphics, PANEL_SELECTION_FILTER_BASE::m_cbKeepouts, PANEL_SELECTION_FILTER_BASE::m_cbLockedItems, PANEL_SELECTION_FILTER_BASE::m_cbOtherItems, PANEL_SELECTION_FILTER_BASE::m_cbPads, PANEL_SELECTION_FILTER_BASE::m_cbText, PANEL_SELECTION_FILTER_BASE::m_cbTracks, PANEL_SELECTION_FILTER_BASE::m_cbVias, PANEL_SELECTION_FILTER_BASE::m_cbZones, m_frame, m_tool, onRightClick(), and SetCheckboxesFromFilter().

◆ ~PANEL_SELECTION_FILTER()

PANEL_SELECTION_FILTER::~PANEL_SELECTION_FILTER ( )
default

Member Function Documentation

◆ OnFilterChanged()

void PANEL_SELECTION_FILTER::OnFilterChanged ( wxCommandEvent &  aEvent)
overrideprotectedvirtual

Reimplemented from PANEL_SELECTION_FILTER_BASE.

Definition at line 88 of file panel_selection_filter.cpp.

89 {
90  if( aEvent.GetEventObject() == m_cbAllItems )
91  {
92  bool newState = m_cbAllItems->GetValue();
93 
94  m_cbFootprints->SetValue( newState );
95  m_cbText->SetValue( newState );
96  m_cbTracks->SetValue( newState );
97  m_cbVias->SetValue( newState );
98  m_cbPads->SetValue( newState );
99  m_cbGraphics->SetValue( newState );
100  m_cbZones->SetValue( newState );
101  m_cbKeepouts->SetValue( newState );
102  m_cbDimensions->SetValue( newState );
103  m_cbOtherItems->SetValue( newState );
104  }
105 
107 
108  // If any of the other checkboxes turned off, turn off the All Items checkbox
109  bool allChecked = setFilterFromCheckboxes( opts );
110  m_cbAllItems->SetValue( allChecked );
111 }
This file contains data structures that are saved in the project file or project local settings file ...
SELECTION_FILTER_OPTIONS & GetFilter()
Set up handlers for various events.
bool setFilterFromCheckboxes(SELECTION_FILTER_OPTIONS &aOptions)
PCB_SELECTION_TOOL * m_tool

References PCB_SELECTION_TOOL::GetFilter(), PANEL_SELECTION_FILTER_BASE::m_cbAllItems, PANEL_SELECTION_FILTER_BASE::m_cbDimensions, PANEL_SELECTION_FILTER_BASE::m_cbFootprints, PANEL_SELECTION_FILTER_BASE::m_cbGraphics, PANEL_SELECTION_FILTER_BASE::m_cbKeepouts, PANEL_SELECTION_FILTER_BASE::m_cbOtherItems, PANEL_SELECTION_FILTER_BASE::m_cbPads, PANEL_SELECTION_FILTER_BASE::m_cbText, PANEL_SELECTION_FILTER_BASE::m_cbTracks, PANEL_SELECTION_FILTER_BASE::m_cbVias, PANEL_SELECTION_FILTER_BASE::m_cbZones, m_tool, and setFilterFromCheckboxes().

Referenced by onPopupSelection().

◆ onPopupSelection()

void PANEL_SELECTION_FILTER::onPopupSelection ( wxCommandEvent &  aEvent)
private

Definition at line 154 of file panel_selection_filter.cpp.

155 {
156  if( !m_onlyCheckbox )
157  return;
158 
159  m_cbAllItems->SetValue( false );
160  m_cbFootprints->SetValue( false );
161  m_cbText->SetValue( false );
162  m_cbTracks->SetValue( false );
163  m_cbVias->SetValue( false );
164  m_cbPads->SetValue( false );
165  m_cbGraphics->SetValue( false );
166  m_cbZones->SetValue( false );
167  m_cbKeepouts->SetValue( false );
168  m_cbDimensions->SetValue( false );
169  m_cbOtherItems->SetValue( false );
170 
171  m_onlyCheckbox->SetValue( true );
172  m_onlyCheckbox = nullptr;
173 
174  wxCommandEvent dummy;
176 }
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
void OnFilterChanged(wxCommandEvent &aEvent) override

References dummy(), PANEL_SELECTION_FILTER_BASE::m_cbAllItems, PANEL_SELECTION_FILTER_BASE::m_cbDimensions, PANEL_SELECTION_FILTER_BASE::m_cbFootprints, PANEL_SELECTION_FILTER_BASE::m_cbGraphics, PANEL_SELECTION_FILTER_BASE::m_cbKeepouts, PANEL_SELECTION_FILTER_BASE::m_cbOtherItems, PANEL_SELECTION_FILTER_BASE::m_cbPads, PANEL_SELECTION_FILTER_BASE::m_cbText, PANEL_SELECTION_FILTER_BASE::m_cbTracks, PANEL_SELECTION_FILTER_BASE::m_cbVias, PANEL_SELECTION_FILTER_BASE::m_cbZones, m_onlyCheckbox, and OnFilterChanged().

Referenced by onRightClick().

◆ onRightClick()

void PANEL_SELECTION_FILTER::onRightClick ( wxMouseEvent &  aEvent)
private

Definition at line 132 of file panel_selection_filter.cpp.

133 {
134  wxMenu menu;
135 
136  wxCheckBox* cb = dynamic_cast<wxCheckBox*>( aEvent.GetEventObject() );
137 
138  if( !cb )
139  return;
140 
141  m_onlyCheckbox = cb;
142 
143  wxString label;
144  label.Printf( _( "Only %s" ), cb->GetLabel().Lower() );
145 
146  menu.Append( new wxMenuItem( &menu, wxID_ANY, label, wxEmptyString, wxITEM_NORMAL ) );
147 
148  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SELECTION_FILTER::onPopupSelection, this );
149 
150  PopupMenu( &menu );
151 }
void onPopupSelection(wxCommandEvent &aEvent)
#define _(s)

References _, m_onlyCheckbox, and onPopupSelection().

Referenced by PANEL_SELECTION_FILTER().

◆ OnUpdateUI()

virtual void PANEL_SELECTION_FILTER_BASE::OnUpdateUI ( wxUpdateUIEvent &  event)
inlineprotectedvirtualinherited

◆ SetCheckboxesFromFilter()

void PANEL_SELECTION_FILTER::SetCheckboxesFromFilter ( SELECTION_FILTER_OPTIONS aOptions)

Definition at line 66 of file panel_selection_filter.cpp.

67 {
68  Freeze();
69 
70  m_cbLockedItems->SetValue( aOptions.lockedItems );
71  m_cbFootprints->SetValue( aOptions.footprints );
72  m_cbText->SetValue( aOptions.text );
73  m_cbTracks->SetValue( aOptions.tracks );
74  m_cbVias->SetValue( aOptions.vias );
75  m_cbPads->SetValue( aOptions.pads );
76  m_cbGraphics->SetValue( aOptions.graphics );
77  m_cbZones->SetValue( aOptions.zones );
78  m_cbKeepouts->SetValue( aOptions.keepouts );
79  m_cbDimensions->SetValue( aOptions.dimensions );
80  m_cbOtherItems->SetValue( aOptions.otherItems );
81 
82  m_cbAllItems->SetValue( aOptions.All() );
83 
84  Thaw();
85 }
bool otherItems
Anything not fitting one of the above categories.
bool text
Text (free or attached to a footprint)
bool dimensions
Dimension items.
bool graphics
Graphic lines, shapes, polygons.
bool footprints
Allow selecting entire footprints.
bool lockedItems
Allow selecting locked items.

References SELECTION_FILTER_OPTIONS::All(), SELECTION_FILTER_OPTIONS::dimensions, SELECTION_FILTER_OPTIONS::footprints, SELECTION_FILTER_OPTIONS::graphics, SELECTION_FILTER_OPTIONS::keepouts, SELECTION_FILTER_OPTIONS::lockedItems, PANEL_SELECTION_FILTER_BASE::m_cbAllItems, PANEL_SELECTION_FILTER_BASE::m_cbDimensions, PANEL_SELECTION_FILTER_BASE::m_cbFootprints, PANEL_SELECTION_FILTER_BASE::m_cbGraphics, PANEL_SELECTION_FILTER_BASE::m_cbKeepouts, PANEL_SELECTION_FILTER_BASE::m_cbLockedItems, PANEL_SELECTION_FILTER_BASE::m_cbOtherItems, PANEL_SELECTION_FILTER_BASE::m_cbPads, PANEL_SELECTION_FILTER_BASE::m_cbText, PANEL_SELECTION_FILTER_BASE::m_cbTracks, PANEL_SELECTION_FILTER_BASE::m_cbVias, PANEL_SELECTION_FILTER_BASE::m_cbZones, SELECTION_FILTER_OPTIONS::otherItems, SELECTION_FILTER_OPTIONS::pads, SELECTION_FILTER_OPTIONS::text, SELECTION_FILTER_OPTIONS::tracks, SELECTION_FILTER_OPTIONS::vias, and SELECTION_FILTER_OPTIONS::zones.

Referenced by PCB_EDIT_FRAME::LoadProjectSettings(), FOOTPRINT_EDIT_FRAME::LoadSettings(), and PANEL_SELECTION_FILTER().

◆ setFilterFromCheckboxes()

bool PANEL_SELECTION_FILTER::setFilterFromCheckboxes ( SELECTION_FILTER_OPTIONS aOptions)
private

Definition at line 114 of file panel_selection_filter.cpp.

115 {
116  aOptions.lockedItems = m_cbLockedItems->GetValue();
117  aOptions.footprints = m_cbFootprints->GetValue();
118  aOptions.text = m_cbText->GetValue();
119  aOptions.tracks = m_cbTracks->GetValue();
120  aOptions.vias = m_cbVias->GetValue();
121  aOptions.pads = m_cbPads->GetValue();
122  aOptions.graphics = m_cbGraphics->GetValue();
123  aOptions.zones = m_cbZones->GetValue();
124  aOptions.keepouts = m_cbKeepouts->GetValue();
125  aOptions.dimensions = m_cbDimensions->GetValue();
126  aOptions.otherItems = m_cbOtherItems->GetValue();
127 
128  return aOptions.All();
129 }
bool otherItems
Anything not fitting one of the above categories.
bool text
Text (free or attached to a footprint)
bool dimensions
Dimension items.
bool graphics
Graphic lines, shapes, polygons.
bool footprints
Allow selecting entire footprints.
bool lockedItems
Allow selecting locked items.

References SELECTION_FILTER_OPTIONS::All(), SELECTION_FILTER_OPTIONS::dimensions, SELECTION_FILTER_OPTIONS::footprints, SELECTION_FILTER_OPTIONS::graphics, SELECTION_FILTER_OPTIONS::keepouts, SELECTION_FILTER_OPTIONS::lockedItems, PANEL_SELECTION_FILTER_BASE::m_cbDimensions, PANEL_SELECTION_FILTER_BASE::m_cbFootprints, PANEL_SELECTION_FILTER_BASE::m_cbGraphics, PANEL_SELECTION_FILTER_BASE::m_cbKeepouts, PANEL_SELECTION_FILTER_BASE::m_cbLockedItems, PANEL_SELECTION_FILTER_BASE::m_cbOtherItems, PANEL_SELECTION_FILTER_BASE::m_cbPads, PANEL_SELECTION_FILTER_BASE::m_cbText, PANEL_SELECTION_FILTER_BASE::m_cbTracks, PANEL_SELECTION_FILTER_BASE::m_cbVias, PANEL_SELECTION_FILTER_BASE::m_cbZones, SELECTION_FILTER_OPTIONS::otherItems, SELECTION_FILTER_OPTIONS::pads, SELECTION_FILTER_OPTIONS::text, SELECTION_FILTER_OPTIONS::tracks, SELECTION_FILTER_OPTIONS::vias, and SELECTION_FILTER_OPTIONS::zones.

Referenced by OnFilterChanged().

Member Data Documentation

◆ m_cbAllItems

◆ m_cbDimensions

◆ m_cbFootprints

◆ m_cbGraphics

◆ m_cbKeepouts

◆ m_cbLockedItems

◆ m_cbOtherItems

◆ m_cbPads

◆ m_cbText

◆ m_cbTracks

◆ m_cbVias

◆ m_cbZones

◆ m_frame

PCB_BASE_EDIT_FRAME* PANEL_SELECTION_FILTER::m_frame
private

Definition at line 51 of file panel_selection_filter.h.

Referenced by PANEL_SELECTION_FILTER().

◆ m_onlyCheckbox

wxCheckBox* PANEL_SELECTION_FILTER::m_onlyCheckbox
private

Definition at line 53 of file panel_selection_filter.h.

Referenced by onPopupSelection(), and onRightClick().

◆ m_tool

PCB_SELECTION_TOOL* PANEL_SELECTION_FILTER::m_tool
private

Definition at line 52 of file panel_selection_filter.h.

Referenced by OnFilterChanged(), and PANEL_SELECTION_FILTER().


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