KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_choose_symbol.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014 Henner Zeller <[email protected]>
5 * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <symbol_library.h>
27#include <eeschema_settings.h>
28#include <kiface_base.h>
29#include <sch_base_frame.h>
30#include <core/kicad_algo.h>
31#include <template_fieldnames.h>
34#include <widgets/lib_tree.h>
36#include <wx/button.h>
37#include <wx/checkbox.h>
38#include <wx/clipbrd.h>
39#include <wx/dataview.h>
40#include <wx/log.h>
41#include <wx/panel.h>
42#include <wx/sizer.h>
43#include <wx/splitter.h>
44#include <wx/timer.h>
45#include <wx/utils.h>
46#include <wx/wxhtml.h>
47
49
52
53
55 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
56 int aDeMorganConvert, bool aAllowFieldEdits,
57 bool aShowFootprints, bool aAllowBrowser )
58 : DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
59 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
60 m_symbol_preview( nullptr ),
61 m_browser_button( nullptr ),
62 m_hsplitter( nullptr ),
63 m_vsplitter( nullptr ),
64 m_fp_sel_ctrl( nullptr ),
65 m_fp_preview( nullptr ),
66 m_keepSymbol( nullptr ),
67 m_useUnits( nullptr ),
68 m_tree( nullptr ),
69 m_details( nullptr ),
70 m_parent( aParent ),
71 m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
72 m_allow_field_edits( aAllowFieldEdits ),
73 m_show_footprints( aShowFootprints ),
74 m_external_browser_requested( false )
75{
77
78 // Never show footprints in power symbol mode
79 if( m_showPower )
80 m_show_footprints = false;
81
82 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
83
84 // Use a slightly different layout, with a details pane spanning the entire window,
85 // if we're not showing footprints.
87 {
88 m_hsplitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
89 wxSP_LIVE_UPDATE | wxSP_NOBORDER | wxSP_3DSASH );
90
91 //Avoid the splitter window being assigned as the Parent to additional windows
92 m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
93
94 sizer->Add( m_hsplitter, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
95 }
96 else
97 {
98 m_vsplitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
99 wxSP_LIVE_UPDATE | wxSP_NOBORDER | wxSP_3DSASH );
100
101 m_hsplitter = new wxSplitterWindow( m_vsplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize,
102 wxSP_LIVE_UPDATE | wxSP_NOBORDER | wxSP_3DSASH );
103
104 // Avoid the splitter window being assigned as the parent to additional windows.
105 m_vsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
106 m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
107
108 wxPanel* detailsPanel = new wxPanel( m_vsplitter );
109 wxBoxSizer* detailsSizer = new wxBoxSizer( wxVERTICAL );
110 detailsPanel->SetSizer( detailsSizer );
111
112 m_details = new HTML_WINDOW( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
113 wxHW_SCROLLBAR_AUTO );
114 detailsSizer->Add( m_details, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
115 detailsPanel->Layout();
116 detailsSizer->Fit( detailsPanel );
117
118 m_vsplitter->SetSashGravity( 0.5 );
119 m_vsplitter->SetMinimumPaneSize( 20 );
120 m_vsplitter->SplitHorizontally( m_hsplitter, detailsPanel );
121
122 sizer->Add( m_vsplitter, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
123 }
124
125 wxPanel* treePanel = new wxPanel( m_hsplitter );
126 wxBoxSizer* treeSizer = new wxBoxSizer( wxVERTICAL );
127 treePanel->SetSizer( treeSizer );
128
129 m_tree = new LIB_TREE( treePanel, m_showPower ? wxT( "power" ) : wxT( "symbols" ),
130 Prj().SchSymbolLibTable(), aAdapter, LIB_TREE::FLAGS::ALL_WIDGETS,
131 m_details );
132
133 treeSizer->Add( m_tree, 1, wxEXPAND | wxALL, 5 );
134 treePanel->Layout();
135 treeSizer->Fit( treePanel );
136
137 aAdapter->FinishTreeInitialization();
138
139 if( m_showPower )
141 else
143
144 m_hsplitter->SetSashGravity( 0.8 );
145 m_hsplitter->SetMinimumPaneSize( 20 );
146 m_hsplitter->SplitVertically( treePanel, ConstructRightPanel( m_hsplitter ) );
147
148 m_dbl_click_timer = new wxTimer( this );
149
150 wxBoxSizer* buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
151
152 if( aAllowBrowser )
153 {
154 m_browser_button = new wxButton( this, wxID_ANY, _( "Select with Browser" ) );
155 buttonsSizer->Add( m_browser_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
156 }
157
158 m_keepSymbol = new wxCheckBox( this, wxID_ANY, _( "Place repeated copies" ) );
159 m_keepSymbol->SetToolTip( _( "Keep the symbol selected for subsequent clicks." ) );
160
161 m_useUnits = new wxCheckBox( this, wxID_ANY, _( "Place all units" ) );
162 m_useUnits->SetToolTip( _( "Sequentially place all units of the symbol." ) );
163
164 if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
165 {
166 m_keepSymbol->SetValue( cfg->m_SymChooserPanel.keep_symbol );
167 m_useUnits->SetValue( cfg->m_SymChooserPanel.place_all_units );
168 }
169
170 buttonsSizer->Add( m_keepSymbol, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 30 );
171 buttonsSizer->Add( m_useUnits, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 30 );
172
173 wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer();
174 wxButton* okButton = new wxButton( this, wxID_OK );
175 wxButton* cancelButton = new wxButton( this, wxID_CANCEL );
176
177 sdbSizer->AddButton( okButton );
178 sdbSizer->AddButton( cancelButton );
179 sdbSizer->Realize();
180
181 buttonsSizer->Add( sdbSizer, 1, wxALL, 5 );
182
183 sizer->Add( buttonsSizer, 0, wxEXPAND | wxLEFT, 5 );
184 SetSizer( sizer );
185
186 Layout();
187
188 if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
189 {
190 EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER& panelCfg = cfg->m_SymChooserPanel;
191
192 // We specify the width of the right window (m_symbol_view_panel), because specify
193 // the width of the left window does not work as expected when SetSashGravity() is called
194 m_hsplitter->SetSashPosition( panelCfg.sash_pos_h > 0 ? panelCfg.sash_pos_h
195 : horizPixelsFromDU( 220 ) );
196
197 if( m_vsplitter )
198 {
199 m_vsplitter->SetSashPosition( panelCfg.sash_pos_v > 0 ? panelCfg.sash_pos_v
200 : vertPixelsFromDU( 230 ) );
201 }
202
203 wxSize dlgSize( panelCfg.width > 0 ? panelCfg.width : horizPixelsFromDU( 390 ),
204 panelCfg.height > 0 ? panelCfg.height : vertPixelsFromDU( 300 ) );
205 SetSize( dlgSize );
206
207 aAdapter->SetSortMode( (LIB_TREE_MODEL_ADAPTER::SORT_MODE) cfg->m_SymChooserPanel.sort_mode );
208 }
209
212
213 Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
214 Bind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this, m_dbl_click_timer->GetId() );
215 Bind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
216 Bind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
217
218 if( m_browser_button )
219 {
220 m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_CHOOSE_SYMBOL::OnUseBrowser,
221 this );
222 }
223
224 if( m_fp_sel_ctrl )
225 {
226 m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
227 this );
228 }
229
230 if( m_details )
231 {
232 m_details->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ),
233 nullptr, this );
234 }
235}
236
237
239{
240 Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
241 Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this );
242 Unbind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
243 Unbind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
244
245 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
246 m_dbl_click_timer->Stop();
247 delete m_dbl_click_timer;
248
249 if( m_showPower )
251 else
253
254 if( m_browser_button )
255 {
256 m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED,
258 }
259
260 if( m_fp_sel_ctrl )
261 {
262 m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
263 this );
264 }
265
266 if( m_details )
267 {
268 m_details->Disconnect( wxEVT_CHAR_HOOK,
269 wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), nullptr,
270 this );
271 }
272
273 if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
274 {
275 cfg->m_SymChooserPanel.width = GetSize().x;
276 cfg->m_SymChooserPanel.height = GetSize().y;
277
278 cfg->m_SymChooserPanel.keep_symbol = m_keepSymbol->GetValue();
279 cfg->m_SymChooserPanel.place_all_units = m_useUnits->GetValue();
280
281 cfg->m_SymChooserPanel.sash_pos_h = m_hsplitter->GetSashPosition();
282
283 if( m_vsplitter )
284 cfg->m_SymChooserPanel.sash_pos_v = m_vsplitter->GetSashPosition();
285
286 cfg->m_SymChooserPanel.sort_mode = m_tree->GetSortMode();
287 }
288}
289
290
291wxPanel* DIALOG_CHOOSE_SYMBOL::ConstructRightPanel( wxWindow* aParent )
292{
293 wxPanel* panel = new wxPanel( aParent );
294 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
296
297 m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, &Kiway(), true, backend );
298 m_symbol_preview->SetLayoutDirection( wxLayout_LeftToRight );
299
301 {
303
304 sizer->Add( m_symbol_preview, 11, wxEXPAND | wxALL, 5 );
305
306 if ( fp_list )
307 {
309 m_fp_sel_ctrl = new FOOTPRINT_SELECT_WIDGET( m_parent, panel, fp_list, true );
310
313 }
314
315 if( m_fp_sel_ctrl )
316 sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxALL, 4 );
317
318 if( m_fp_preview )
319 sizer->Add( m_fp_preview, 10, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
320 }
321 else
322 {
323 sizer->Add( m_symbol_preview, 1, wxEXPAND | wxALL, 5 );
324 }
325
326 panel->SetSizer( sizer );
327 panel->Layout();
328 sizer->Fit( panel );
329
330 return panel;
331}
332
333
334void DIALOG_CHOOSE_SYMBOL::OnInitDialog( wxInitDialogEvent& aEvent )
335{
337 {
338 // This hides the GAL panel and shows the status label
339 m_fp_preview->SetStatusText( wxEmptyString );
340 }
341
342 if( m_fp_sel_ctrl )
343 m_fp_sel_ctrl->Load( Kiway(), Prj() );
344}
345
346
348{
349 if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() &&
350 !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
351 {
352 wxString txt = m_details->SelectionToText();
353 wxLogNull doNotLog; // disable logging of failed clipboard actions
354
355 if( wxTheClipboard->Open() )
356 {
357 wxTheClipboard->SetData( new wxTextDataObject( txt ) );
358 wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
359 wxTheClipboard->Close();
360 }
361 }
362 else
363 {
364 e.Skip();
365 }
366}
367
368
370{
371 return m_tree->GetSelectedLibId( aUnit );
372}
373
374
375void DIALOG_CHOOSE_SYMBOL::OnUseBrowser( wxCommandEvent& aEvent )
376{
378
379 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
380}
381
382
383void DIALOG_CHOOSE_SYMBOL::OnCloseTimer( wxTimerEvent& aEvent )
384{
385 // Hack handler because of eaten MouseUp event. See
386 // DIALOG_CHOOSE_SYMBOL::OnComponentSelected for the beginning
387 // of this spaghetti noodle.
388
389 auto state = wxGetMouseState();
390
391 if( state.LeftIsDown() )
392 {
393 // Mouse hasn't been raised yet, so fire the timer again. Otherwise the
394 // purpose of this timer is defeated.
396 }
397 else
398 {
399 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
400 }
401}
402
403
405{
407 return;
408
409 LIB_SYMBOL* symbol = nullptr;
410
411 try
412 {
413 symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
414 }
415 catch( const IO_ERROR& ioe )
416 {
417 wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ),
418 aLibId.GetLibItemName().wx_str(),
419 aLibId.GetLibNickname().wx_str(),
420 ioe.What() );
421 }
422
423 if( !symbol )
424 return;
425
426 LIB_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
427 wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
428
429 ShowFootprint( fp_name );
430}
431
432
433void DIALOG_CHOOSE_SYMBOL::ShowFootprint( wxString const& aName )
434{
436 return;
437
438 if( aName == wxEmptyString )
439 {
440 m_fp_preview->SetStatusText( _( "No footprint specified" ) );
441 }
442 else
443 {
444 LIB_ID lib_id;
445
446 if( lib_id.Parse( aName ) == -1 && lib_id.IsValid() )
447 {
450 }
451 else
452 {
453 m_fp_preview->SetStatusText( _( "Invalid footprint specified" ) );
454 }
455 }
456}
457
458
460{
461 if( !m_fp_sel_ctrl )
462 return;
463
465
466 LIB_SYMBOL* symbol = nullptr;
467
468 if( aLibId.IsValid() )
469 {
470 try
471 {
472 symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
473 }
474 catch( const IO_ERROR& ioe )
475 {
476 wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ),
477 aLibId.GetLibItemName().wx_str(),
478 aLibId.GetLibNickname().wx_str(),
479 ioe.What() );
480 }
481 }
482
483 if( symbol != nullptr )
484 {
485 LIB_PINS temp_pins;
486 LIB_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
487 wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
488
489 // All units, but only a single De Morgan variant.
490 if( symbol->HasConversion() )
491 symbol->GetPins( temp_pins, 0, 1 );
492 else
493 symbol->GetPins( temp_pins );
494
495 m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
500 }
501 else
502 {
504 m_fp_sel_ctrl->Disable();
505 }
506}
507
508
509void DIALOG_CHOOSE_SYMBOL::OnFootprintSelected( wxCommandEvent& aEvent )
510{
511 m_fp_override = aEvent.GetString();
512
513 alg::delete_if( m_field_edits, []( std::pair<int, wxString> const& i )
514 {
515 return i.first == FOOTPRINT_FIELD;
516 } );
517
518 m_field_edits.emplace_back( std::make_pair( FOOTPRINT_FIELD, m_fp_override ) );
519
521}
522
523
525{
527
528 if( node && node->m_LibId.IsValid() )
529 {
531
532 if( !node->m_Footprint.IsEmpty() )
533 ShowFootprint( node->m_Footprint );
534 else
535 ShowFootprintFor( node->m_LibId );
536
538 }
539 else
540 {
541 m_symbol_preview->SetStatusText( _( "No symbol selected" ) );
542
544 m_fp_preview->SetStatusText( wxEmptyString );
545
547 }
548}
549
550
551void DIALOG_CHOOSE_SYMBOL::OnComponentSelected( wxCommandEvent& aEvent )
552{
554 {
555 // Got a selection. We can't just end the modal dialog here, because
556 // wx leaks some events back to the parent window (in particular, the
557 // MouseUp following a double click).
558 //
559 // NOW, here's where it gets really fun. wxTreeListCtrl eats MouseUp.
560 // This isn't really feasible to bypass without a fully custom
561 // wxDataViewCtrl implementation, and even then might not be fully
562 // possible (docs are vague). To get around this, we use a one-shot
563 // timer to schedule the dialog close.
564 //
565 // See DIALOG_CHOOSE_SYMBOL::OnCloseTimer for the other end of this
566 // spaghetti noodle.
568 }
569}
570
571
573{
574 return m_useUnits->GetValue();
575}
576
577
579{
580 return m_keepSymbol->GetValue();
581}
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
void OnFootprintSelected(wxCommandEvent &aEvent)
static constexpr int DblClickDelay
wxPanel * ConstructRightPanel(wxWindow *aParent)
void ShowFootprintFor(const LIB_ID &aLibId)
Look up the footprint for a given symbol specified in the LIB_ID and display it.
void OnCharHook(wxKeyEvent &aEvt) override
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
To be called after this dialog returns from ShowModal().
static std::mutex g_Mutex
void ShowFootprint(const wxString &aFootprint)
Display the given footprint by name.
bool GetUseAllUnits() const
To be called after this dialog returns from ShowModal()
void OnInitDialog(wxInitDialogEvent &aEvent)
static wxString g_powerSearchString
void OnUseBrowser(wxCommandEvent &aEvent)
static wxString g_symbolSearchString
bool GetKeepSymbol() const
To be called after this dialog returns from ShowModal()
void OnComponentSelected(wxCommandEvent &aEvent)
Handle the selection of an item.
wxSplitterWindow * m_vsplitter
std::vector< std::pair< int, wxString > > m_field_edits
wxSplitterWindow * m_hsplitter
void PopulateFootprintSelector(const LIB_ID &aLibId)
Populate the footprint selector for a given alias.
SYMBOL_PREVIEW_WIDGET * m_symbol_preview
void OnCloseTimer(wxTimerEvent &aEvent)
void OnComponentPreselected(wxCommandEvent &aEvent)
FOOTPRINT_SELECT_WIDGET * m_fp_sel_ctrl
FOOTPRINT_PREVIEW_WIDGET * m_fp_preview
DIALOG_CHOOSE_SYMBOL(SCH_BASE_FRAME *aParent, const wxString &aTitle, wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > &aAdapter, int aDeMorganConvert, bool aAllowFieldEdits, bool aShowFootprints, bool aAllowBrowser)
Create dialog to choose symbol.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
int vertPixelsFromDU(int y) const
Convert an integer number of dialog units to pixels, vertically.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
void SetupStandardButtons(std::map< int, wxString > aLabels={})
int horizPixelsFromDU(int x) const
Convert an integer number of dialog units to pixels, horizontally.
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:121
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
void DisplayFootprint(const LIB_ID &aFPID)
Set the currently displayed footprint.
void SetUserUnits(EDA_UNITS aUnits)
Set the units for the preview.
bool IsInitialized() const
Return whether the widget initialized properly.
void SetStatusText(const wxString &aText)
Set the contents of the status label and display it.
void ClearStatus()
Clear the contents of the status label and hide it.
virtual bool Enable(bool aEnable=true) override
Enable or disable the control for input.
void FilterByFootprintFilters(const wxArrayString &aFilters, bool aZeroFilters)
Filter by footprint filter list.
void SetDefaultFootprint(const wxString &aFp)
Set the default footprint for a part.
void FilterByPinCount(int aPinCount)
Filter by pin count.
bool UpdateList()
Update the contents of the list to match the filters.
void ClearFilters()
Clear all filters.
void Load(KIWAY &aKiway, PROJECT &aProject)
Start loading.
Add dark theme support to wxHtmlWindow.
Definition: html_window.h:34
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
Field object used in symbol libraries.
Definition: lib_field.h:62
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:410
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:51
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
Define a library symbol object.
Definition: lib_symbol.h:99
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:226
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
@ SYM_FILTER_POWER
list symbols flagged PWR
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
wxString m_Footprint
Widget displaying a tree of symbols with optional search text control and description panel....
Definition: lib_tree.h:49
LIB_TREE_NODE * GetCurrentTreeNode() const
Definition: lib_tree.cpp:275
wxWindow * GetFocusTarget()
Definition: lib_tree.cpp:375
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
Definition: lib_tree.h:137
wxString GetSearchString() const
Definition: lib_tree.cpp:316
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit,...
Definition: lib_tree.cpp:244
@ ALL_WIDGETS
Definition: lib_tree.h:57
void SetSearchString(const wxString &aSearchString)
Save/restore search string.
Definition: lib_tree.cpp:310
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetStatusText(const wxString &aText)
Set the contents of the status label and display it.
void DisplaySymbol(const LIB_ID &aSymbolID, int aUnit, int aConvert=0)
Set the currently displayed symbol.
wxString wx_str() const
Definition: utf8.cpp:45
#define _(s)
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:61
void delete_if(_Container &__c, _Function &&__f)
Deletes all values from __c for which __f returns true.
Definition: kicad_algo.h:173
Definition for symbol library class.
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".