KiCad PCB EDA Suite
PANEL_SELECTION_FILTER Class Reference

#include <panel_selection_filter.h>

Inheritance diagram for PANEL_SELECTION_FILTER:
PANEL_SELECTION_FILTER_BASE WX_PANEL

Public Member Functions

 PANEL_SELECTION_FILTER (wxWindow *aParent)
 
 ~PANEL_SELECTION_FILTER ()=default
 
void SetCheckboxesFromFilter (SELECTION_FILTER_OPTIONS &aOptions)
 
void OnLanguageChanged ()
 
void SetBorders (bool aLeft, bool aRight, bool aTop, bool aBottom)
 

Protected Member Functions

void OnFilterChanged (wxCommandEvent &aEvent) override
 

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  SetBorders( true, false, false, false );
47 
48  wxASSERT( m_frame );
50  wxASSERT( m_tool );
51 
54 
55  m_cbFootprints->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
56  m_cbText->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
57  m_cbTracks->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
58  m_cbVias->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
59  m_cbPads->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
60  m_cbGraphics->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
61  m_cbZones->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
62  m_cbKeepouts->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
63  m_cbDimensions->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
64  m_cbOtherItems->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
65 }
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
void SetCheckboxesFromFilter(SELECTION_FILTER_OPTIONS &aOptions)
void SetBorders(bool aLeft, bool aRight, bool aTop, bool aBottom)
Definition: wx_panel.h:38
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(), WX_PANEL::SetBorders(), 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 90 of file panel_selection_filter.cpp.

91 {
92  if( aEvent.GetEventObject() == m_cbAllItems )
93  {
94  bool newState = m_cbAllItems->GetValue();
95 
96  m_cbFootprints->SetValue( newState );
97  m_cbText->SetValue( newState );
98  m_cbTracks->SetValue( newState );
99  m_cbVias->SetValue( newState );
100  m_cbPads->SetValue( newState );
101  m_cbGraphics->SetValue( newState );
102  m_cbZones->SetValue( newState );
103  m_cbKeepouts->SetValue( newState );
104  m_cbDimensions->SetValue( newState );
105  m_cbOtherItems->SetValue( newState );
106  }
107 
109 
110  // If any of the other checkboxes turned off, turn off the All Items checkbox
111  bool allChecked = setFilterFromCheckboxes( opts );
112  m_cbAllItems->SetValue( allChecked );
113 }
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().

◆ OnLanguageChanged()

void PANEL_SELECTION_FILTER::OnLanguageChanged ( )

Definition at line 181 of file panel_selection_filter.cpp.

182 {
183  m_cbAllItems->SetLabel( _("All items") );
184  m_cbLockedItems->SetLabel( _("Locked items") );
185  m_cbLockedItems->SetToolTip( _("Allow selection of locked items") );
186  m_cbFootprints->SetLabel( _("Footprints") );
187  m_cbText->SetLabel( _("Text") );
188  m_cbTracks->SetLabel( _("Tracks") );
189  m_cbVias->SetLabel( _("Vias") );
190  m_cbPads->SetLabel( _("Pads") );
191  m_cbGraphics->SetLabel( _("Graphics") );
192  m_cbZones->SetLabel( _("Zones") );
193  m_cbKeepouts->SetLabel( _("Rule Areas") );
194  m_cbDimensions->SetLabel( _("Dimensions") );
195  m_cbOtherItems->SetLabel( _("Other items") );
196 
197  m_cbAllItems->GetParent()->Layout();
198 }
#define _(s)

References _, 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, and PANEL_SELECTION_FILTER_BASE::m_cbZones.

Referenced by FOOTPRINT_EDIT_FRAME::ShowChangedLanguage().

◆ onPopupSelection()

void PANEL_SELECTION_FILTER::onPopupSelection ( wxCommandEvent &  aEvent)
private

Definition at line 156 of file panel_selection_filter.cpp.

157 {
158  if( !m_onlyCheckbox )
159  return;
160 
161  m_cbAllItems->SetValue( false );
162  m_cbFootprints->SetValue( false );
163  m_cbText->SetValue( false );
164  m_cbTracks->SetValue( false );
165  m_cbVias->SetValue( false );
166  m_cbPads->SetValue( false );
167  m_cbGraphics->SetValue( false );
168  m_cbZones->SetValue( false );
169  m_cbKeepouts->SetValue( false );
170  m_cbDimensions->SetValue( false );
171  m_cbOtherItems->SetValue( false );
172 
173  m_onlyCheckbox->SetValue( true );
174  m_onlyCheckbox = nullptr;
175 
176  wxCommandEvent dummy;
178 }
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 134 of file panel_selection_filter.cpp.

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

References _, m_onlyCheckbox, and onPopupSelection().

Referenced by PANEL_SELECTION_FILTER().

◆ SetBorders()

void WX_PANEL::SetBorders ( bool  aLeft,
bool  aRight,
bool  aTop,
bool  aBottom 
)
inlineinherited

Definition at line 38 of file wx_panel.h.

39  {
40  m_leftBorder = aLeft;
41  m_rightBorder = aRight;
42  m_topBorder = aTop;
43  m_bottomBorder = aBottom;
44  }
bool m_rightBorder
Definition: wx_panel.h:51
bool m_leftBorder
Definition: wx_panel.h:50
bool m_bottomBorder
Definition: wx_panel.h:53
bool m_topBorder
Definition: wx_panel.h:52

References WX_PANEL::m_bottomBorder, WX_PANEL::m_leftBorder, WX_PANEL::m_rightBorder, and WX_PANEL::m_topBorder.

Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), PANEL_PACKAGES_VIEW::PANEL_PACKAGES_VIEW(), and PANEL_SELECTION_FILTER().

◆ SetCheckboxesFromFilter()

void PANEL_SELECTION_FILTER::SetCheckboxesFromFilter ( SELECTION_FILTER_OPTIONS aOptions)

Definition at line 68 of file panel_selection_filter.cpp.

69 {
70  Freeze();
71 
72  m_cbLockedItems->SetValue( aOptions.lockedItems );
73  m_cbFootprints->SetValue( aOptions.footprints );
74  m_cbText->SetValue( aOptions.text );
75  m_cbTracks->SetValue( aOptions.tracks );
76  m_cbVias->SetValue( aOptions.vias );
77  m_cbPads->SetValue( aOptions.pads );
78  m_cbGraphics->SetValue( aOptions.graphics );
79  m_cbZones->SetValue( aOptions.zones );
80  m_cbKeepouts->SetValue( aOptions.keepouts );
81  m_cbDimensions->SetValue( aOptions.dimensions );
82  m_cbOtherItems->SetValue( aOptions.otherItems );
83 
84  m_cbAllItems->SetValue( aOptions.All() );
85 
86  Thaw();
87 }
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 116 of file panel_selection_filter.cpp.

117 {
118  aOptions.lockedItems = m_cbLockedItems->GetValue();
119  aOptions.footprints = m_cbFootprints->GetValue();
120  aOptions.text = m_cbText->GetValue();
121  aOptions.tracks = m_cbTracks->GetValue();
122  aOptions.vias = m_cbVias->GetValue();
123  aOptions.pads = m_cbPads->GetValue();
124  aOptions.graphics = m_cbGraphics->GetValue();
125  aOptions.zones = m_cbZones->GetValue();
126  aOptions.keepouts = m_cbKeepouts->GetValue();
127  aOptions.dimensions = m_cbDimensions->GetValue();
128  aOptions.otherItems = m_cbOtherItems->GetValue();
129 
130  return aOptions.All();
131 }
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 53 of file panel_selection_filter.h.

Referenced by PANEL_SELECTION_FILTER().

◆ m_onlyCheckbox

wxCheckBox* PANEL_SELECTION_FILTER::m_onlyCheckbox
private

Definition at line 55 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 54 of file panel_selection_filter.h.

Referenced by OnFilterChanged(), and PANEL_SELECTION_FILTER().


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