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
 
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  wxASSERT( m_frame );
34  wxASSERT( m_tool );
35 
38 
39  m_cbFootprints->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
40  m_cbText->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
41  m_cbTracks->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
42  m_cbVias->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
43  m_cbPads->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
44  m_cbGraphics->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
45  m_cbZones->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
46  m_cbKeepouts->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
47  m_cbDimensions->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
48  m_cbOtherItems->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
49 }
SELECTION_TOOL.
SELECTION_FILTER_OPTIONS & GetFilter()
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)
PCB_BASE_EDIT_FRAME * m_frame
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74

References SELECTION_TOOL::GetFilter(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), 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_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 74 of file panel_selection_filter.cpp.

75 {
76  if( aEvent.GetEventObject() == m_cbAllItems )
77  {
78  bool newState = m_cbAllItems->GetValue();
79 
80  m_cbLockedItems->SetValue( newState );
81  m_cbFootprints->SetValue( newState );
82  m_cbText->SetValue( newState );
83  m_cbTracks->SetValue( newState );
84  m_cbVias->SetValue( newState );
85  m_cbPads->SetValue( newState );
86  m_cbGraphics->SetValue( newState );
87  m_cbZones->SetValue( newState );
88  m_cbKeepouts->SetValue( newState );
89  m_cbDimensions->SetValue( newState );
90  m_cbOtherItems->SetValue( newState );
91  }
92 
94 
95  // If any of the other checkboxes turned off, turn off the All Items checkbox
96  bool allChecked = setFilterFromCheckboxes( opts );
97  m_cbAllItems->SetValue( allChecked );
98 }
SELECTION_FILTER_OPTIONS & GetFilter()
This file contains data structures that are saved in the project file or project local settings file ...
bool setFilterFromCheckboxes(SELECTION_FILTER_OPTIONS &aOptions)

References 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_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_tool, and setFilterFromCheckboxes().

Referenced by onPopupSelection().

◆ onPopupSelection()

void PANEL_SELECTION_FILTER::onPopupSelection ( wxCommandEvent &  aEvent)
private

Definition at line 141 of file panel_selection_filter.cpp.

142 {
143  if( !m_onlyCheckbox )
144  return;
145 
146  m_cbAllItems->SetValue( false );
147  m_cbFootprints->SetValue( false );
148  m_cbText->SetValue( false );
149  m_cbTracks->SetValue( false );
150  m_cbVias->SetValue( false );
151  m_cbPads->SetValue( false );
152  m_cbGraphics->SetValue( false );
153  m_cbZones->SetValue( false );
154  m_cbKeepouts->SetValue( false );
155  m_cbDimensions->SetValue( false );
156  m_cbOtherItems->SetValue( false );
157 
158  m_onlyCheckbox->SetValue( true );
159  m_onlyCheckbox = nullptr;
160 
161  wxCommandEvent dummy;
163 }
void OnFilterChanged(wxCommandEvent &aEvent) override
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

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 119 of file panel_selection_filter.cpp.

120 {
121  wxMenu menu;
122 
123  wxCheckBox* cb = dynamic_cast<wxCheckBox*>( aEvent.GetEventObject() );
124 
125  if( !cb )
126  return;
127 
128  m_onlyCheckbox = cb;
129 
130  wxString label;
131  label.Printf( _( "Only %s" ), cb->GetLabel().Lower() );
132 
133  menu.Append( new wxMenuItem( &menu, wxID_ANY, label, wxEmptyString, wxITEM_NORMAL ) );
134 
135  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SELECTION_FILTER::onPopupSelection, this );
136 
137  PopupMenu( &menu );
138 }
void onPopupSelection(wxCommandEvent &aEvent)
#define _(s)
Definition: 3d_actions.cpp:33

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 52 of file panel_selection_filter.cpp.

53 {
54  Freeze();
55 
56  m_cbLockedItems->SetValue( aOptions.lockedItems );
57  m_cbFootprints->SetValue( aOptions.footprints );
58  m_cbText->SetValue( aOptions.text );
59  m_cbTracks->SetValue( aOptions.tracks );
60  m_cbVias->SetValue( aOptions.vias );
61  m_cbPads->SetValue( aOptions.pads );
62  m_cbGraphics->SetValue( aOptions.graphics );
63  m_cbZones->SetValue( aOptions.zones );
64  m_cbKeepouts->SetValue( aOptions.keepouts );
65  m_cbDimensions->SetValue( aOptions.dimensions );
66  m_cbOtherItems->SetValue( aOptions.otherItems );
67 
68  m_cbAllItems->SetValue( aOptions.All() );
69 
70  Thaw();
71 }
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(), and PANEL_SELECTION_FILTER().

◆ setFilterFromCheckboxes()

bool PANEL_SELECTION_FILTER::setFilterFromCheckboxes ( SELECTION_FILTER_OPTIONS aOptions)
private

Definition at line 101 of file panel_selection_filter.cpp.

102 {
103  aOptions.lockedItems = m_cbLockedItems->GetValue();
104  aOptions.footprints = m_cbFootprints->GetValue();
105  aOptions.text = m_cbText->GetValue();
106  aOptions.tracks = m_cbTracks->GetValue();
107  aOptions.vias = m_cbVias->GetValue();
108  aOptions.pads = m_cbPads->GetValue();
109  aOptions.graphics = m_cbGraphics->GetValue();
110  aOptions.zones = m_cbZones->GetValue();
111  aOptions.keepouts = m_cbKeepouts->GetValue();
112  aOptions.dimensions = m_cbDimensions->GetValue();
113  aOptions.otherItems = m_cbOtherItems->GetValue();
114 
115  return aOptions.All();
116 }
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 50 of file panel_selection_filter.h.

Referenced by PANEL_SELECTION_FILTER().

◆ m_onlyCheckbox

wxCheckBox* PANEL_SELECTION_FILTER::m_onlyCheckbox
private

Definition at line 54 of file panel_selection_filter.h.

Referenced by onPopupSelection(), and onRightClick().

◆ m_tool

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: