KiCad PCB EDA Suite
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-2022 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" ), wxDefaultPosition,
159 wxDefaultSize, wxALIGN_RIGHT );
160 m_keepSymbol->SetToolTip( _( "Keep the symbol selected for subsequent clicks." ) );
161
162 m_useUnits = new wxCheckBox( this, wxID_ANY, _( "Place all units" ), wxDefaultPosition,
163 wxDefaultSize, wxALIGN_RIGHT );
164 m_useUnits->SetToolTip( _( "Sequentially place all units of the symbol." ) );
165
166 if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
167 {
168 m_keepSymbol->SetValue( cfg->m_SymChooserPanel.keep_symbol );
169 m_useUnits->SetValue( cfg->m_SymChooserPanel.place_all_units );
170 }
171
172 buttonsSizer->Add( m_keepSymbol, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
173 buttonsSizer->Add( m_useUnits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
174
175 wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer();
176 wxButton* okButton = new wxButton( this, wxID_OK );
177 wxButton* cancelButton = new wxButton( this, wxID_CANCEL );
178
179 sdbSizer->AddButton( okButton );
180 sdbSizer->AddButton( cancelButton );
181 sdbSizer->Realize();
182
183 buttonsSizer->Add( sdbSizer, 1, wxALL, 5 );
184
185 sizer->Add( buttonsSizer, 0, wxEXPAND | wxLEFT, 5 );
186 SetSizer( sizer );
187
188 Layout();
189
190 if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
191 {
192 EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER& panelCfg = cfg->m_SymChooserPanel;
193
194 // We specify the width of the right window (m_symbol_view_panel), because specify
195 // the width of the left window does not work as expected when SetSashGravity() is called
196 m_hsplitter->SetSashPosition( panelCfg.sash_pos_h > 0 ? panelCfg.sash_pos_h
197 : horizPixelsFromDU( 220 ) );
198
199 if( m_vsplitter )
200 {
201 m_vsplitter->SetSashPosition( panelCfg.sash_pos_v > 0 ? panelCfg.sash_pos_v
202 : vertPixelsFromDU( 230 ) );
203 }
204
205 wxSize dlgSize( panelCfg.width > 0 ? panelCfg.width : horizPixelsFromDU( 390 ),
206 panelCfg.height > 0 ? panelCfg.height : vertPixelsFromDU( 300 ) );
207 SetSize( dlgSize );
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}
287
288
289wxPanel* DIALOG_CHOOSE_SYMBOL::ConstructRightPanel( wxWindow* aParent )
290{
291 wxPanel* panel = new wxPanel( aParent );
292 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
294
295 m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway(), backend );
296 m_symbol_preview->SetLayoutDirection( wxLayout_LeftToRight );
297
299 {
301
302 sizer->Add( m_symbol_preview, 1, wxEXPAND | wxALL, 5 );
303
304 if ( fp_list )
305 {
307 m_fp_sel_ctrl = new FOOTPRINT_SELECT_WIDGET( m_parent, panel, fp_list, true );
308
310 }
311
312 if( m_fp_sel_ctrl )
313 sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 3 );
314
315 if( m_fp_preview )
316 sizer->Add( m_fp_preview, 1, wxEXPAND | wxALL, 5 );
317 }
318 else
319 {
320 sizer->Add( m_symbol_preview, 1, wxEXPAND | wxALL, 5 );
321 }
322
323 panel->SetSizer( sizer );
324 panel->Layout();
325 sizer->Fit( panel );
326
327 return panel;
328}
329
330
331void DIALOG_CHOOSE_SYMBOL::OnInitDialog( wxInitDialogEvent& aEvent )
332{
334 {
335 // This hides the GAL panel and shows the status label
336 m_fp_preview->SetStatusText( wxEmptyString );
337 }
338
339 if( m_fp_sel_ctrl )
340 m_fp_sel_ctrl->Load( Kiway(), Prj() );
341}
342
343
345{
346 if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() &&
347 !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
348 {
349 wxString txt = m_details->SelectionToText();
350 wxLogNull doNotLog; // disable logging of failed clipboard actions
351
352 if( wxTheClipboard->Open() )
353 {
354 wxTheClipboard->SetData( new wxTextDataObject( txt ) );
355 wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
356 wxTheClipboard->Close();
357 }
358 }
359 else
360 {
361 e.Skip();
362 }
363}
364
365
367{
368 return m_tree->GetSelectedLibId( aUnit );
369}
370
371
372void DIALOG_CHOOSE_SYMBOL::OnUseBrowser( wxCommandEvent& aEvent )
373{
375
376 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
377}
378
379
380void DIALOG_CHOOSE_SYMBOL::OnCloseTimer( wxTimerEvent& aEvent )
381{
382 // Hack handler because of eaten MouseUp event. See
383 // DIALOG_CHOOSE_SYMBOL::OnComponentSelected for the beginning
384 // of this spaghetti noodle.
385
386 auto state = wxGetMouseState();
387
388 if( state.LeftIsDown() )
389 {
390 // Mouse hasn't been raised yet, so fire the timer again. Otherwise the
391 // purpose of this timer is defeated.
393 }
394 else
395 {
396 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
397 }
398}
399
400
402{
404 return;
405
406 LIB_SYMBOL* symbol = nullptr;
407
408 try
409 {
410 symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
411 }
412 catch( const IO_ERROR& ioe )
413 {
414 wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ),
415 aLibId.GetLibItemName().wx_str(),
416 aLibId.GetLibNickname().wx_str(),
417 ioe.What() );
418 }
419
420 if( !symbol )
421 return;
422
423 LIB_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
424 wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
425
426 ShowFootprint( fp_name );
427}
428
429
430void DIALOG_CHOOSE_SYMBOL::ShowFootprint( wxString const& aName )
431{
433 return;
434
435 if( aName == wxEmptyString )
436 {
437 m_fp_preview->SetStatusText( _( "No footprint specified" ) );
438 }
439 else
440 {
441 LIB_ID lib_id;
442
443 if( lib_id.Parse( aName ) == -1 && lib_id.IsValid() )
444 {
447 }
448 else
449 {
450 m_fp_preview->SetStatusText( _( "Invalid footprint specified" ) );
451 }
452 }
453}
454
455
457{
458 if( !m_fp_sel_ctrl )
459 return;
460
462
463 LIB_SYMBOL* symbol = nullptr;
464
465 if( aLibId.IsValid() )
466 {
467 try
468 {
469 symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
470 }
471 catch( const IO_ERROR& ioe )
472 {
473 wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ),
474 aLibId.GetLibItemName().wx_str(),
475 aLibId.GetLibNickname().wx_str(),
476 ioe.What() );
477 }
478 }
479
480 if( symbol != nullptr )
481 {
482 LIB_PINS temp_pins;
483 LIB_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
484 wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
485
486 symbol->GetPins( temp_pins );
487
488 m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
493 }
494 else
495 {
497 m_fp_sel_ctrl->Disable();
498 }
499}
500
501
502void DIALOG_CHOOSE_SYMBOL::OnFootprintSelected( wxCommandEvent& aEvent )
503{
504 m_fp_override = aEvent.GetString();
505
506 alg::delete_if( m_field_edits, []( std::pair<int, wxString> const& i )
507 {
508 return i.first == FOOTPRINT_FIELD;
509 } );
510
511 m_field_edits.emplace_back( std::make_pair( FOOTPRINT_FIELD, m_fp_override ) );
512
514}
515
516
518{
520
521 if( node && node->m_LibId.IsValid() )
522 {
524
525 if( !node->m_Footprint.IsEmpty() )
526 ShowFootprint( node->m_Footprint );
527 else
528 ShowFootprintFor( node->m_LibId );
529
531 }
532 else
533 {
534 m_symbol_preview->SetStatusText( _( "No symbol selected" ) );
535
537 m_fp_preview->SetStatusText( wxEmptyString );
538
540 }
541}
542
543
544void DIALOG_CHOOSE_SYMBOL::OnComponentSelected( wxCommandEvent& aEvent )
545{
547 {
548 // Got a selection. We can't just end the modal dialog here, because
549 // wx leaks some events back to the parent window (in particular, the
550 // MouseUp following a double click).
551 //
552 // NOW, here's where it gets really fun. wxTreeListCtrl eats MouseUp.
553 // This isn't really feasible to bypass without a fully custom
554 // wxDataViewCtrl implementation, and even then might not be fully
555 // possible (docs are vague). To get around this, we use a one-shot
556 // timer to schedule the dialog close.
557 //
558 // See DIALOG_CHOOSE_SYMBOL::OnCloseTimer for the other end of this
559 // spaghetti noodle.
561 }
562}
563
564
566{
567 return m_useUnits->GetValue();
568}
569
570
572{
573 return m_keepSymbol->GetValue();
574}
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.
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.
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:60
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:380
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:50
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:165
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
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:98
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:194
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:850
@ 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:46
LIB_TREE_NODE * GetCurrentTreeNode() const
Definition: lib_tree.cpp:215
wxWindow * GetFocusTarget()
Definition: lib_tree.cpp:315
wxString GetSearchString() const
Definition: lib_tree.cpp:256
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:184
void SetSearchString(const wxString &aSearchString)
Save/restore search string.
Definition: lib_tree.cpp:250
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:46
#define _(s)
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:54
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".