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" ) );
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
210
211 Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
212 Bind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this, m_dbl_click_timer->GetId() );
213 Bind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
214 Bind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
215
216 if( m_browser_button )
217 {
218 m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_CHOOSE_SYMBOL::OnUseBrowser,
219 this );
220 }
221
222 if( m_fp_sel_ctrl )
223 {
224 m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
225 this );
226 }
227
228 if( m_details )
229 {
230 m_details->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ),
231 nullptr, this );
232 }
233}
234
235
237{
238 Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
239 Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this );
240 Unbind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
241 Unbind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
242
243 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
244 m_dbl_click_timer->Stop();
245 delete m_dbl_click_timer;
246
247 if( m_showPower )
249 else
251
252 if( m_browser_button )
253 {
254 m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED,
256 }
257
258 if( m_fp_sel_ctrl )
259 {
260 m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
261 this );
262 }
263
264 if( m_details )
265 {
266 m_details->Disconnect( wxEVT_CHAR_HOOK,
267 wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), nullptr,
268 this );
269 }
270
271 if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
272 {
273 cfg->m_SymChooserPanel.width = GetSize().x;
274 cfg->m_SymChooserPanel.height = GetSize().y;
275
276 cfg->m_SymChooserPanel.keep_symbol = m_keepSymbol->GetValue();
277 cfg->m_SymChooserPanel.place_all_units = m_useUnits->GetValue();
278
279 cfg->m_SymChooserPanel.sash_pos_h = m_hsplitter->GetSashPosition();
280
281 if( m_vsplitter )
282 cfg->m_SymChooserPanel.sash_pos_v = m_vsplitter->GetSashPosition();
283 }
284}
285
286
287wxPanel* DIALOG_CHOOSE_SYMBOL::ConstructRightPanel( wxWindow* aParent )
288{
289 wxPanel* panel = new wxPanel( aParent );
290 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
292
293 m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway(), backend );
294 m_symbol_preview->SetLayoutDirection( wxLayout_LeftToRight );
295
297 {
299
300 sizer->Add( m_symbol_preview, 11, wxEXPAND | wxALL, 5 );
301
302 if ( fp_list )
303 {
305 m_fp_sel_ctrl = new FOOTPRINT_SELECT_WIDGET( m_parent, panel, fp_list, true );
306
309 }
310
311 if( m_fp_sel_ctrl )
312 sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxALL, 4 );
313
314 if( m_fp_preview )
315 sizer->Add( m_fp_preview, 10, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
316 }
317 else
318 {
319 sizer->Add( m_symbol_preview, 1, wxEXPAND | wxALL, 5 );
320 }
321
322 panel->SetSizer( sizer );
323 panel->Layout();
324 sizer->Fit( panel );
325
326 return panel;
327}
328
329
330void DIALOG_CHOOSE_SYMBOL::OnInitDialog( wxInitDialogEvent& aEvent )
331{
333 {
334 // This hides the GAL panel and shows the status label
335 m_fp_preview->SetStatusText( wxEmptyString );
336 }
337
338 if( m_fp_sel_ctrl )
339 m_fp_sel_ctrl->Load( Kiway(), Prj() );
340}
341
342
344{
345 if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() &&
346 !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
347 {
348 wxString txt = m_details->SelectionToText();
349 wxLogNull doNotLog; // disable logging of failed clipboard actions
350
351 if( wxTheClipboard->Open() )
352 {
353 wxTheClipboard->SetData( new wxTextDataObject( txt ) );
354 wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
355 wxTheClipboard->Close();
356 }
357 }
358 else
359 {
360 e.Skip();
361 }
362}
363
364
366{
367 return m_tree->GetSelectedLibId( aUnit );
368}
369
370
371void DIALOG_CHOOSE_SYMBOL::OnUseBrowser( wxCommandEvent& aEvent )
372{
374
375 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
376}
377
378
379void DIALOG_CHOOSE_SYMBOL::OnCloseTimer( wxTimerEvent& aEvent )
380{
381 // Hack handler because of eaten MouseUp event. See
382 // DIALOG_CHOOSE_SYMBOL::OnComponentSelected for the beginning
383 // of this spaghetti noodle.
384
385 auto state = wxGetMouseState();
386
387 if( state.LeftIsDown() )
388 {
389 // Mouse hasn't been raised yet, so fire the timer again. Otherwise the
390 // purpose of this timer is defeated.
392 }
393 else
394 {
395 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
396 }
397}
398
399
401{
403 return;
404
405 LIB_SYMBOL* symbol = nullptr;
406
407 try
408 {
409 symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
410 }
411 catch( const IO_ERROR& ioe )
412 {
413 wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ),
414 aLibId.GetLibItemName().wx_str(),
415 aLibId.GetLibNickname().wx_str(),
416 ioe.What() );
417 }
418
419 if( !symbol )
420 return;
421
422 LIB_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
423 wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
424
425 ShowFootprint( fp_name );
426}
427
428
429void DIALOG_CHOOSE_SYMBOL::ShowFootprint( wxString const& aName )
430{
432 return;
433
434 if( aName == wxEmptyString )
435 {
436 m_fp_preview->SetStatusText( _( "No footprint specified" ) );
437 }
438 else
439 {
440 LIB_ID lib_id;
441
442 if( lib_id.Parse( aName ) == -1 && lib_id.IsValid() )
443 {
446 }
447 else
448 {
449 m_fp_preview->SetStatusText( _( "Invalid footprint specified" ) );
450 }
451 }
452}
453
454
456{
457 if( !m_fp_sel_ctrl )
458 return;
459
461
462 LIB_SYMBOL* symbol = nullptr;
463
464 if( aLibId.IsValid() )
465 {
466 try
467 {
468 symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
469 }
470 catch( const IO_ERROR& ioe )
471 {
472 wxLogError( _( "Error loading symbol %s from library '%s'." ) + wxS( "\n%s" ),
473 aLibId.GetLibItemName().wx_str(),
474 aLibId.GetLibNickname().wx_str(),
475 ioe.What() );
476 }
477 }
478
479 if( symbol != nullptr )
480 {
481 LIB_PINS temp_pins;
482 LIB_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
483 wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
484
485 symbol->GetPins( temp_pins );
486
487 m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
492 }
493 else
494 {
496 m_fp_sel_ctrl->Disable();
497 }
498}
499
500
501void DIALOG_CHOOSE_SYMBOL::OnFootprintSelected( wxCommandEvent& aEvent )
502{
503 m_fp_override = aEvent.GetString();
504
505 alg::delete_if( m_field_edits, []( std::pair<int, wxString> const& i )
506 {
507 return i.first == FOOTPRINT_FIELD;
508 } );
509
510 m_field_edits.emplace_back( std::make_pair( FOOTPRINT_FIELD, m_fp_override ) );
511
513}
514
515
517{
519
520 if( node && node->m_LibId.IsValid() )
521 {
523
524 if( !node->m_Footprint.IsEmpty() )
525 ShowFootprint( node->m_Footprint );
526 else
527 ShowFootprintFor( node->m_LibId );
528
530 }
531 else
532 {
533 m_symbol_preview->SetStatusText( _( "No symbol selected" ) );
534
536 m_fp_preview->SetStatusText( wxEmptyString );
537
539 }
540}
541
542
543void DIALOG_CHOOSE_SYMBOL::OnComponentSelected( wxCommandEvent& aEvent )
544{
546 {
547 // Got a selection. We can't just end the modal dialog here, because
548 // wx leaks some events back to the parent window (in particular, the
549 // MouseUp following a double click).
550 //
551 // NOW, here's where it gets really fun. wxTreeListCtrl eats MouseUp.
552 // This isn't really feasible to bypass without a fully custom
553 // wxDataViewCtrl implementation, and even then might not be fully
554 // possible (docs are vague). To get around this, we use a one-shot
555 // timer to schedule the dialog close.
556 //
557 // See DIALOG_CHOOSE_SYMBOL::OnCloseTimer for the other end of this
558 // spaghetti noodle.
560 }
561}
562
563
565{
566 return m_useUnits->GetValue();
567}
568
569
571{
572 return m_keepSymbol->GetValue();
573}
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:61
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:391
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: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:199
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:834
@ 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:219
wxWindow * GetFocusTarget()
Definition: lib_tree.cpp:319
wxString GetSearchString() const
Definition: lib_tree.cpp:260
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:188
void SetSearchString(const wxString &aSearchString)
Save/restore search string.
Definition: lib_tree.cpp:254
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".