KiCad PCB EDA Suite
dialog_choose_component.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 <h.zeller@acm.org>
5  * Copyright (C) 2016-2019 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 <algorithm>
26 #include <class_libentry.h>
27 #include <class_library.h>
29 #include <eeschema_settings.h>
30 #include <kiface_i.h>
31 #include <sch_base_frame.h>
32 #include <symbol_lib_table.h>
33 #include <template_fieldnames.h>
36 #include <widgets/lib_tree.h>
38 #include <wx/button.h>
39 #include <wx/clipbrd.h>
40 #include <wx/dataview.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 
48 
49 
52  int aDeMorganConvert, bool aAllowFieldEdits,
53  bool aShowFootprints, bool aAllowBrowser )
54  : DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
55  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
56  m_symbol_preview( nullptr ),
57  m_browser_button( nullptr ),
58  m_hsplitter( nullptr ),
59  m_vsplitter( nullptr ),
60  m_fp_sel_ctrl( nullptr ),
61  m_fp_preview( nullptr ),
62  m_keepSymbol( nullptr ),
63  m_useUnits( nullptr ),
64  m_tree( nullptr ),
65  m_details( nullptr ),
66  m_parent( aParent ),
67  m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
68  m_allow_field_edits( aAllowFieldEdits ),
69  m_show_footprints( aShowFootprints ),
70  m_external_browser_requested( false )
71 {
72  // Never show footprints in power symbol mode
73  if( aAdapter->GetFilter() == SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER )
74  m_show_footprints = false;
75 
76  auto sizer = new wxBoxSizer( wxVERTICAL );
77 
78  // Use a slightly different layout, with a details pane spanning the entire window,
79  // if we're not showing footprints.
80  if( m_show_footprints )
81  {
82  m_hsplitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
83  wxSP_LIVE_UPDATE );
84 
85  //Avoid the splitter window being assigned as the Parent to additional windows
86  m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
87 
88  sizer->Add( m_hsplitter, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
89  }
90  else
91  {
92  m_vsplitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
93  wxSP_LIVE_UPDATE );
94 
95  m_hsplitter = new wxSplitterWindow( m_vsplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize,
96  wxSP_LIVE_UPDATE );
97 
98  //Avoid the splitter window being assigned as the Parent to additional windows
99  m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
100 
101  auto detailsPanel = new wxPanel( m_vsplitter );
102  auto detailsSizer = new wxBoxSizer( wxVERTICAL );
103  detailsPanel->SetSizer( detailsSizer );
104 
105  m_details = new wxHtmlWindow( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
106  wxHW_SCROLLBAR_AUTO );
107  detailsSizer->Add( m_details, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
108  detailsPanel->Layout();
109  detailsSizer->Fit( detailsPanel );
110 
111  m_vsplitter->SetSashGravity( 0.5 );
112  m_vsplitter->SetMinimumPaneSize( 20 );
113  m_vsplitter->SplitHorizontally( m_hsplitter, detailsPanel );
114 
115  sizer->Add( m_vsplitter, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
116  }
117 
118  m_tree = new LIB_TREE( m_hsplitter, Prj().SchSymbolLibTable(), aAdapter,
120 
121  m_hsplitter->SetSashGravity( 0.8 );
122  m_hsplitter->SetMinimumPaneSize( 20 );
123  m_hsplitter->SplitVertically( m_tree, ConstructRightPanel( m_hsplitter ) );
124 
125  m_dbl_click_timer = new wxTimer( this );
126 
127  auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
128 
129  if( aAllowBrowser )
130  {
131  m_browser_button = new wxButton( this, wxID_ANY, _( "Select with Browser" ) );
132  buttonsSizer->Add( m_browser_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
133  }
134 
135  auto sdbSizer = new wxStdDialogButtonSizer();
136  auto okButton = new wxButton( this, wxID_OK );
137  auto cancelButton = new wxButton( this, wxID_CANCEL );
138  sdbSizer->AddButton( okButton );
139  sdbSizer->AddButton( cancelButton );
140  sdbSizer->Realize();
141 
142  buttonsSizer->Add( sdbSizer, 1, wxALL, 5 );
143 
144  sizer->Add( buttonsSizer, 0, wxEXPAND | wxLEFT, 5 );
145  SetSizer( sizer );
146 
147  Layout();
148 
149  EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
150 
151  if( cfg )
152  {
154 
155  // We specify the width of the right window (m_symbol_view_panel), because specify
156  // the width of the left window does not work as expected when SetSashGravity() is called
157  m_hsplitter->SetSashPosition( panelCfg.sash_pos_h > 0 ? panelCfg.sash_pos_h :
158  HorizPixelsFromDU( 220 ) );
159 
160  if( m_vsplitter )
161  m_vsplitter->SetSashPosition( panelCfg.sash_pos_v > 0 ? panelCfg.sash_pos_v :
162  VertPixelsFromDU( 230 ) );
163 
164  wxSize dlgSize( panelCfg.width > 0 ? panelCfg.width : HorizPixelsFromDU( 390 ),
165  panelCfg.height > 0 ? panelCfg.height : VertPixelsFromDU( 300 ) );
166  SetSize( dlgSize );
167  }
168 
170  okButton->SetDefault();
171 
172  Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this );
173  Bind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this, m_dbl_click_timer->GetId() );
174  Bind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentPreselected, this );
175  Bind( COMPONENT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentSelected, this );
176 
177  if( m_browser_button )
178  m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
180 
181  if( m_fp_sel_ctrl )
182  m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED,
184 
185  if( m_details )
186  m_details->Connect( wxEVT_CHAR_HOOK,
187  wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
188  NULL, this );
189 }
190 
191 
193 {
194  Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this );
195  Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this );
196  Unbind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentPreselected, this );
197  Unbind( COMPONENT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentSelected, this );
198 
199  if( m_browser_button )
200  m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED,
202 
203  if( m_fp_sel_ctrl )
204  m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED,
206 
207  if( m_details )
208  m_details->Disconnect( wxEVT_CHAR_HOOK,
209  wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
210  NULL, this );
211 
212  // I am not sure the following two lines are necessary, but they will not hurt anyone
213  m_dbl_click_timer->Stop();
214  delete m_dbl_click_timer;
215 
216  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
217 
218  wxCHECK( cfg, /*void*/ );
219 
220  cfg->m_SymChooserPanel.width = GetSize().x;
221  cfg->m_SymChooserPanel.height = GetSize().y;
222 
223  cfg->m_SymChooserPanel.keep_symbol = m_keepSymbol->GetValue();
224  cfg->m_SymChooserPanel.place_all_units = m_useUnits->GetValue();
225 
226  cfg->m_SymChooserPanel.sash_pos_h = m_hsplitter->GetSashPosition();
227 
228  if( m_vsplitter )
229  cfg->m_SymChooserPanel.sash_pos_v = m_vsplitter->GetSashPosition();
230 }
231 
232 
233 wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
234 {
235  wxPanel* panel = new wxPanel( aParent );
236  wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
238 
239  m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway(), backend );
240  m_symbol_preview->SetLayoutDirection( wxLayout_LeftToRight );
241 
242  if( m_show_footprints )
243  {
245 
246  sizer->Add( m_symbol_preview, 1, wxEXPAND | wxTOP | wxBOTTOM | wxRIGHT, 5 );
247 
248  if ( fp_list )
249  {
250  if( m_allow_field_edits )
251  m_fp_sel_ctrl = new FOOTPRINT_SELECT_WIDGET( m_parent, panel, fp_list, true );
252 
253  m_fp_preview = new FOOTPRINT_PREVIEW_WIDGET( panel, Kiway() );
254  }
255 
256  if( m_fp_sel_ctrl )
257  sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxBOTTOM | wxTOP | wxRIGHT, 5 );
258 
259  if( m_fp_preview )
260  sizer->Add( m_fp_preview, 1, wxEXPAND | wxBOTTOM | wxRIGHT, 5 );
261  }
262  else
263  {
264  sizer->Add( m_symbol_preview, 1, wxEXPAND | wxTOP | wxRIGHT, 5 );
265  }
266 
267  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
268 
269  m_keepSymbol = new wxCheckBox( panel, 1000, _("Multi-Symbol Placement"), wxDefaultPosition,
270  wxDefaultSize, wxALIGN_RIGHT );
271  m_keepSymbol->SetValue( cfg ? cfg->m_SymChooserPanel.keep_symbol : true );
272  m_keepSymbol->SetToolTip( _( "Place multiple copies of the symbol." ) );
273 
274  m_useUnits = new wxCheckBox( panel, 1000, _("Place all units"), wxDefaultPosition,
275  wxDefaultSize, wxALIGN_RIGHT );
276  m_useUnits->SetValue( cfg ? cfg->m_SymChooserPanel.place_all_units : true );
277  m_useUnits->SetToolTip( _( "Sequentially place all units of the symbol." ) );
278 
279  auto fgSizer = new wxFlexGridSizer( 0, 2, 0, 1 );
280  fgSizer->AddGrowableCol( 0 );
281  fgSizer->SetFlexibleDirection( wxBOTH );
282  fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
283 
284  fgSizer->Add( 0, 0, 1, wxEXPAND );
285  fgSizer->Add( m_keepSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
286  fgSizer->Add( 0, 0, 1, wxEXPAND );
287  fgSizer->Add( m_useUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
288 
289  sizer->Add( fgSizer, 0, wxALL | wxEXPAND, 5 );
290  panel->SetSizer( sizer );
291  panel->Layout();
292  sizer->Fit( panel );
293 
294  return panel;
295 }
296 
297 
298 void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent )
299 {
301  {
302  // This hides the GAL panel and shows the status label
303  m_fp_preview->SetStatusText( wxEmptyString );
304  }
305 
306  if( m_fp_sel_ctrl )
307  m_fp_sel_ctrl->Load( Kiway(), Prj() );
308 }
309 
310 
312 {
313  if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() &&
314  !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
315  {
316  wxString txt = m_details->SelectionToText();
317 
318  if( wxTheClipboard->Open() )
319  {
320  wxTheClipboard->SetData( new wxTextDataObject( txt ) );
321  wxTheClipboard->Close();
322  }
323  }
324  else
325  {
326  e.Skip();
327  }
328 }
329 
330 
332 {
333  return m_tree->GetSelectedLibId( aUnit );
334 }
335 
336 
337 void DIALOG_CHOOSE_COMPONENT::OnUseBrowser( wxCommandEvent& aEvent )
338 {
340 
341  if( IsQuasiModal() )
342  EndQuasiModal( wxID_OK );
343  else if( IsModal() )
344  EndModal( wxID_OK );
345  else
346  wxFAIL_MSG( "Dialog called with neither Modal nor QuasiModal" );
347 }
348 
349 
350 void DIALOG_CHOOSE_COMPONENT::OnCloseTimer( wxTimerEvent& aEvent )
351 {
352  // Hack handler because of eaten MouseUp event. See
353  // DIALOG_CHOOSE_COMPONENT::OnComponentSelected for the beginning
354  // of this spaghetti noodle.
355 
356  auto state = wxGetMouseState();
357 
358  if( state.LeftIsDown() )
359  {
360  // Mouse hasn't been raised yet, so fire the timer again. Otherwise the
361  // purpose of this timer is defeated.
363  }
364  else
365  {
366  if( IsQuasiModal() )
367  EndQuasiModal( wxID_OK );
368  else if( IsModal() )
369  EndModal( wxID_OK );
370  else
371  wxFAIL_MSG( "Dialog called with neither Modal nor QuasiModal" );
372  }
373 }
374 
375 
377 {
379  return;
380 
381  LIB_PART* symbol = nullptr;
382 
383  try
384  {
385  symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
386  }
387  catch( const IO_ERROR& ioe )
388  {
389  wxLogError( wxString::Format( _( "Error loading symbol %s from library %s.\n\n%s" ),
390  aLibId.GetLibItemName().wx_str(),
391  aLibId.GetLibNickname().wx_str(),
392  ioe.What() ) );
393  }
394 
395  if( !symbol )
396  return;
397 
398  LIB_FIELD* fp_field = symbol->GetField( FOOTPRINT );
399  wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
400 
401  ShowFootprint( fp_name );
402 }
403 
404 
405 void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName )
406 {
408  return;
409 
410  if( aName == wxEmptyString )
411  {
412  m_fp_preview->SetStatusText( _( "No footprint specified" ) );
413  }
414  else
415  {
416  LIB_ID lib_id;
417 
418  if( lib_id.Parse( aName, LIB_ID::ID_PCB ) == -1 && lib_id.IsValid() )
419  {
421  m_fp_preview->CacheFootprint( lib_id );
422  m_fp_preview->DisplayFootprint( lib_id );
423  }
424  else
425  {
426  m_fp_preview->SetStatusText( _( "Invalid footprint specified" ) );
427  }
428  }
429 }
430 
431 
433 {
434  if( !m_fp_sel_ctrl )
435  return;
436 
438 
439  LIB_PART* symbol = nullptr;
440 
441  if( aLibId.IsValid() )
442  {
443  try
444  {
445  symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
446  }
447  catch( const IO_ERROR& ioe )
448  {
449  wxLogError( wxString::Format( _( "Error occurred loading symbol %s from library %s."
450  "\n\n%s" ),
451  aLibId.GetLibItemName().wx_str(),
452  aLibId.GetLibNickname().wx_str(),
453  ioe.What() ) );
454  }
455  }
456 
457  if( symbol != nullptr )
458  {
459  LIB_PINS temp_pins;
460  LIB_FIELD* fp_field = symbol->GetField( FOOTPRINT );
461  wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
462 
463  symbol->GetPins( temp_pins );
464 
465  m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
470  }
471  else
472  {
474  m_fp_sel_ctrl->Disable();
475  }
476 }
477 
478 
479 void DIALOG_CHOOSE_COMPONENT::OnFootprintSelected( wxCommandEvent& aEvent )
480 {
481  m_fp_override = aEvent.GetString();
482 
483  m_field_edits.erase( std::remove_if( m_field_edits.begin(), m_field_edits.end(),
484  []( std::pair<int, wxString> const& i )
485  {
486  return i.first == FOOTPRINT;
487  } ),
488  m_field_edits.end() );
489 
490  m_field_edits.emplace_back( std::make_pair( FOOTPRINT, m_fp_override ) );
491 
493 }
494 
495 
497 {
498  int unit = 0;
499 
500  LIB_ID id = m_tree->GetSelectedLibId( &unit );
501 
502  if( id.IsValid() )
503  {
504  m_symbol_preview->DisplaySymbol( id, unit );
505 
506  ShowFootprintFor( id );
508  }
509  else
510  {
511  m_symbol_preview->SetStatusText( _( "No symbol selected" ) );
512 
514  m_fp_preview->SetStatusText( wxEmptyString );
515 
517  }
518 }
519 
520 
521 void DIALOG_CHOOSE_COMPONENT::OnComponentSelected( wxCommandEvent& aEvent )
522 {
523  if( m_tree->GetSelectedLibId().IsValid() )
524  {
525  // Got a selection. We can't just end the modal dialog here, because
526  // wx leaks some events back to the parent window (in particular, the
527  // MouseUp following a double click).
528  //
529  // NOW, here's where it gets really fun. wxTreeListCtrl eats MouseUp.
530  // This isn't really feasible to bypass without a fully custom
531  // wxDataViewCtrl implementation, and even then might not be fully
532  // possible (docs are vague). To get around this, we use a one-shot
533  // timer to schedule the dialog close.
534  //
535  // See DIALOG_CHOOSE_COMPONENT::OnCloseTimer for the other end of this
536  // spaghetti noodle.
538  }
539 }
540 
541 
FOOTPRINT_SELECT_WIDGET * m_fp_sel_ctrl
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
void FilterByFootprintFilters(wxArrayString const &aFilters, bool aZeroFilters)
Filter by footprint filter list.
std::vector< std::pair< int, wxString > > m_field_edits
void PopulateFootprintSelector(LIB_ID const &aLibId)
Populate the footprint selector for a given alias.
void OnFootprintSelected(wxCommandEvent &aEvent)
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:56
Field object used in symbol libraries.
Definition: lib_field.h:59
SYMBOL_PREVIEW_WIDGET * m_symbol_preview
void SetDefaultFootprint(wxString const &aFp)
Set the default footprint for a part.
void ShowFootprint(wxString const &aFootprint)
Display the given footprint by name.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Item needs to be redrawn.
Definition: view_item.h:63
bool IsValid() const
Definition: lib_id.h:171
PANEL_SYM_CHOOSER m_SymChooserPanel
void SetStatusText(wxString const &aText)
Set the contents of the status label and display it.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:115
Field Name Module PCB, i.e. "16DIP300".
void OnComponentPreselected(wxCommandEvent &aEvent)
void ClearFilters()
Clear all filters.
bool UpdateList()
Update the contents of the list to match the filters.
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
DIALOG_CHOOSE_COMPONENT(SCH_BASE_FRAME *aParent, const wxString &aTitle, SYMBOL_TREE_MODEL_ADAPTER::PTR &aAdapter, int aDeMorganConvert, bool aAllowFieldEdits, bool aShowFootprints, bool aAllowBrowser)
Create dialog to choose component.
void OnInitDialog(wxInitDialogEvent &aEvent)
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void ClearStatus()
Clear the contents of the status label and hide it.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit components, if the user selects the component itself rather than picking an individual...
Definition: lib_tree.cpp:150
Define a library symbol object.
bool IsQuasiModal()
Definition: dialog_shim.h:124
void OnCloseTimer(wxTimerEvent &aEvent)
virtual bool Enable(bool aEnable=true) override
Enable or disable the control for input.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
wxPanel * ConstructRightPanel(wxWindow *aParent)
void SetStatusText(wxString const &aText)
Set the contents of the status label and display it.
void OnUseBrowser(wxCommandEvent &aEvent)
wxArrayString GetFootprints() const
int VertPixelsFromDU(int y)
Convert an integer number of dialog units to pixels, vertically.
void OnCharHook(wxKeyEvent &aEvt) override
void EndQuasiModal(int retCode)
void DisplaySymbol(const LIB_ID &aSymbolID, int aUnit, int aConvert=0)
Set the currently displayed symbol.
void CacheFootprint(const LIB_ID &aFPID)
Preload a footprint into the cache.
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define _(s)
Definition: 3d_actions.cpp:33
void DisplayFootprint(const LIB_ID &aFPID)
Set the currently displayed footprint.
static constexpr int DblClickDelay
wxString wx_str() const
Definition: utf8.cpp:51
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:297
FOOTPRINT_PREVIEW_WIDGET * m_fp_preview
void Load(KIWAY &aKiway, PROJECT &aProject)
Start loading.
int HorizPixelsFromDU(int x)
Convert an integer number of dialog units to pixels, horizontally.
void ShowFootprintFor(LIB_ID const &aLibId)
Look up the footprint for a given symbol specified in the LIB_ID and display it.
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > PTR
Reference-counting container for a pointer to CMP_TREE_MODEL_ADAPTER_BASE.
Definition for part library class.
int Parse(const UTF8 &aId, LIB_ID_TYPE aType, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.
bool IsInitialized() const
Return whether the widget initialized properly.
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME,...
void OnComponentSelected(wxCommandEvent &aEvent)
Handle the selection of an item.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
To be called after this dialog returns from ShowModal().
void FilterByPinCount(int aPinCount)
Filter by pin count.
Widget displaying a tree of components with optional search text control and description panel.
Definition: lib_tree.h:42