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) 2017 Chris Pavlina <pavlina.chris@gmail.com>
6  * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
27 
28 #include <algorithm>
29 #include <set>
30 #include <wx/tokenzr.h>
31 #include <wx/utils.h>
32 
33 #include <wx/artprov.h>
34 #include <wx/bitmap.h>
35 #include <wx/button.h>
36 #include <wx/choice.h>
37 #include <wx/dataview.h>
38 #include <wx/html/htmlwin.h>
39 #include <wx/panel.h>
40 #include <wx/sizer.h>
41 #include <wx/splitter.h>
42 #include <wx/statbmp.h>
43 #include <wx/textctrl.h>
44 #include <wx/timer.h>
45 #include <wx/utils.h>
46 
47 #include <class_library.h>
48 #include <generate_alias_info.h>
49 #include <sch_base_frame.h>
50 #include <template_fieldnames.h>
53 #include <wxdataviewctrl_helpers.h>
54 
55 
57 std::unique_ptr<FOOTPRINT_LIST> DIALOG_CHOOSE_COMPONENT::m_fp_list;
58 
60  CMP_TREE_MODEL_ADAPTER::PTR& aAdapter, int aDeMorganConvert, bool aAllowFieldEdits )
61  : DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxSize( 800, 650 ),
62  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
63  m_parent( aParent ),
64  m_adapter( aAdapter ),
65  m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
66  m_allow_field_edits( aAllowFieldEdits ),
67  m_external_browser_requested( false )
68 {
69  wxBusyCursor busy_while_loading;
70 
71  auto sizer = new wxBoxSizer( wxVERTICAL );
72 
73  auto splitter = new wxSplitterWindow(
74  this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE );
75  auto left_panel = ConstructLeftPanel( splitter );
76  auto right_panel = ConstructRightPanel( splitter );
77  auto buttons = new wxStdDialogButtonSizer();
78  m_dbl_click_timer = new wxTimer( this );
79 
80  splitter->SetSashGravity( 0.9 );
81  splitter->SetMinimumPaneSize( 1 );
82  splitter->SplitVertically( left_panel, right_panel, -300 );
83 
84  buttons->AddButton( new wxButton( this, wxID_OK ) );
85  buttons->AddButton( new wxButton( this, wxID_CANCEL ) );
86  buttons->Realize();
87 
88  sizer->Add( splitter, 1, wxEXPAND | wxALL, 5 );
89  sizer->Add( buttons, 0, wxEXPAND | wxBOTTOM, 10 );
90  SetSizer( sizer );
91 
92  Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this );
93  Bind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this, m_dbl_click_timer->GetId() );
94 
95  m_query_ctrl->Bind( wxEVT_TEXT, &DIALOG_CHOOSE_COMPONENT::OnQueryText, this );
96  m_query_ctrl->Bind( wxEVT_TEXT_ENTER, &DIALOG_CHOOSE_COMPONENT::OnQueryEnter, this );
97  m_query_ctrl->Bind( wxEVT_CHAR_HOOK, &DIALOG_CHOOSE_COMPONENT::OnQueryCharHook, this );
98  m_tree_ctrl->Bind(
99  wxEVT_DATAVIEW_ITEM_ACTIVATED, &DIALOG_CHOOSE_COMPONENT::OnTreeActivate, this );
100  m_tree_ctrl->Bind(
101  wxEVT_DATAVIEW_SELECTION_CHANGED, &DIALOG_CHOOSE_COMPONENT::OnTreeSelect, this );
102  m_details_ctrl->Bind( wxEVT_HTML_LINK_CLICKED, &DIALOG_CHOOSE_COMPONENT::OnDetailsLink, this );
103  m_sch_view_ctrl->Bind( wxEVT_LEFT_DCLICK, &DIALOG_CHOOSE_COMPONENT::OnSchViewDClick, this );
104  m_sch_view_ctrl->Bind( wxEVT_PAINT, &DIALOG_CHOOSE_COMPONENT::OnSchViewPaint, this );
105 
106  if( m_fp_sel_ctrl )
107  m_fp_sel_ctrl->Bind(
108  EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
109 
110  Layout();
111 }
112 
113 
115 {
116  // I am not sure the following two lines are necessary,
117  // but they will not hurt anyone
118  m_dbl_click_timer->Stop();
119  Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this );
120 
121  delete m_dbl_click_timer;
122 }
123 
124 
125 wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructLeftPanel( wxWindow* aParent )
126 {
127  auto panel = new wxPanel( aParent );
128  auto sizer = new wxBoxSizer( wxVERTICAL );
129  auto search_sizer = new wxBoxSizer( wxHORIZONTAL );
130 
131  m_query_ctrl = new wxTextCtrl(
132  panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
133 
134  m_tree_ctrl =
135  new wxDataViewCtrl( panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_SINGLE );
136  m_adapter->AttachTo( m_tree_ctrl );
137 
138  m_details_ctrl = new wxHtmlWindow( panel, wxID_ANY, wxDefaultPosition, wxSize( 320, 240 ),
139  wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER );
140 
141 // Additional visual cue for GTK, which hides the placeholder text on focus
142 #ifdef __WXGTK__
143  search_sizer->Add( new wxStaticBitmap( panel, wxID_ANY,
144  wxArtProvider::GetBitmap( wxART_FIND, wxART_FRAME_ICON ) ),
145  0, wxALIGN_CENTER | wxALL, 5 );
146 #endif
147 
148  search_sizer->Add( m_query_ctrl, 1, wxALIGN_CENTER | wxALL | wxEXPAND, 5 );
149 
150  sizer->Add( search_sizer, 0, wxEXPAND, 5 );
151  sizer->Add( m_tree_ctrl, 1, wxALL | wxEXPAND, 5 );
152  sizer->Add( m_details_ctrl, 1, wxALL | wxEXPAND, 5 );
153 
154  panel->SetSizer( sizer );
155  panel->Layout();
156  sizer->Fit( panel );
157  return panel;
158 }
159 
160 
161 wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
162 {
163  auto panel = new wxPanel( aParent );
164  auto sizer = new wxBoxSizer( wxVERTICAL );
165 
166  m_sch_view_ctrl = new wxPanel( panel, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
167  wxFULL_REPAINT_ON_RESIZE | wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
168  m_sch_view_ctrl->SetLayoutDirection( wxLayout_LeftToRight );
169 
170  if( m_allow_field_edits )
172  else
173  m_fp_sel_ctrl = nullptr;
174 
176 
177 
178  sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxALL, 5 );
179 
180  if( m_fp_sel_ctrl )
181  sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxALL, 5 );
182 
183  sizer->Add( m_fp_view_ctrl, 1, wxEXPAND | wxALL, 5 );
184 
185 
186  panel->SetSizer( sizer );
187  panel->Layout();
188  sizer->Fit( panel );
189 
190  return panel;
191 }
192 
193 
194 void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent )
195 {
196  // If wxTextCtrl::SetHint() is called before binding wxEVT_TEXT, the event
197  // handler will intermittently fire.
198  m_query_ctrl->SetHint( _( "Search" ) );
199  m_query_ctrl->SetFocus();
200  m_query_ctrl->SetValue( wxEmptyString );
201 
203  {
204  // This hides the GAL panel and shows the status label
205  m_fp_view_ctrl->SetStatusText( wxEmptyString );
206  }
207 
208  if( m_fp_sel_ctrl )
209  m_fp_sel_ctrl->Load( Kiway(), Prj() );
210 
211  // There may be a part preselected in the model. Make sure it is displayed.
212  PostSelectEvent();
213 }
214 
215 
217 {
218  auto sel = m_tree_ctrl->GetSelection();
219 
220  if( aUnit )
221  *aUnit = m_adapter->GetUnitFor( sel );
222 
223  return m_adapter->GetAliasFor( sel );
224 }
225 
226 
227 std::vector<std::pair<int, wxString>> DIALOG_CHOOSE_COMPONENT::GetFields() const
228 {
229  return m_field_edits;
230 }
231 
232 
233 void DIALOG_CHOOSE_COMPONENT::OnQueryText( wxCommandEvent& aEvent )
234 {
235  m_adapter->UpdateSearchString( m_query_ctrl->GetLineText( 0 ) );
236  PostSelectEvent();
237 
238  // Required to avoid interaction with SetHint()
239  // See documentation for wxTextEntry::SetHint
240  aEvent.Skip();
241 }
242 
243 
244 void DIALOG_CHOOSE_COMPONENT::OnQueryEnter( wxCommandEvent& aEvent )
245 {
247 }
248 
249 
250 void DIALOG_CHOOSE_COMPONENT::SelectIfValid( const wxDataViewItem& aTreeId )
251 {
252  if( aTreeId.IsOk() )
253  {
254  m_tree_ctrl->EnsureVisible( aTreeId );
255  m_tree_ctrl->Select( aTreeId );
256  PostSelectEvent();
257  }
258 }
259 
260 
262 {
263  wxDataViewEvent evt( wxEVT_DATAVIEW_SELECTION_CHANGED );
264  m_tree_ctrl->GetEventHandler()->ProcessEvent( evt );
265 }
266 
267 
268 void DIALOG_CHOOSE_COMPONENT::OnQueryCharHook( wxKeyEvent& aKeyStroke )
269 {
270  auto const sel = m_tree_ctrl->GetSelection();
271 
272  switch( aKeyStroke.GetKeyCode() )
273  {
274  case WXK_UP: SelectIfValid( GetPrevItem( *m_tree_ctrl, sel ) ); break;
275 
276  case WXK_DOWN: SelectIfValid( GetNextItem( *m_tree_ctrl, sel ) ); break;
277 
278  default:
279  aKeyStroke.Skip(); // Any other key: pass on to search box directly.
280  break;
281  }
282 }
283 
284 
285 void DIALOG_CHOOSE_COMPONENT::OnTreeSelect( wxDataViewEvent& aEvent )
286 {
287  auto sel = m_tree_ctrl->GetSelection();
288  int unit = m_adapter->GetUnitFor( sel );
289  LIB_ALIAS* alias = m_adapter->GetAliasFor( sel );
290 
291  m_sch_view_ctrl->Refresh();
292 
293  if( alias )
294  {
295  m_details_ctrl->SetPage( GenerateAliasInfo( alias, unit ) );
296  ShowFootprintFor( alias );
297  PopulateFootprintSelector( alias );
298  }
299  else
300  {
301  m_details_ctrl->SetPage( wxEmptyString );
302 
304  m_fp_view_ctrl->SetStatusText( wxEmptyString );
305 
306  PopulateFootprintSelector( nullptr );
307  }
308 }
309 
310 
311 void DIALOG_CHOOSE_COMPONENT::OnTreeActivate( wxDataViewEvent& aEvent )
312 {
314 }
315 
316 
317 void DIALOG_CHOOSE_COMPONENT::OnCloseTimer( wxTimerEvent& aEvent )
318 {
319  // Hack handler because of eaten MouseUp event. See
320  // DIALOG_CHOOSE_COMPONENT::OnDoubleClickTreeActivation for the beginning
321  // of this spaghetti noodle.
322 
323  auto state = wxGetMouseState();
324 
325  if( state.LeftIsDown() )
326  {
327  // Mouse hasn't been raised yet, so fire the timer again. Otherwise the
328  // purpose of this timer is defeated.
330  }
331  else
332  {
333  EndQuasiModal( wxID_OK );
334  }
335 }
336 
337 
338 void DIALOG_CHOOSE_COMPONENT::OnSchViewDClick( wxMouseEvent& aEvent )
339 {
341  EndQuasiModal( wxID_OK );
342 }
343 
344 
346 {
347  if( !m_fp_view_ctrl->IsInitialized() )
348  return;
349 
350  LIB_FIELD* fp_field = aAlias->GetPart()->GetField( FOOTPRINT );
351  wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
352 
353  ShowFootprint( fp_name );
354 }
355 
356 
357 void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName )
358 {
359  if( aName == wxEmptyString )
360  {
361  m_fp_view_ctrl->SetStatusText( _( "No footprint specified" ) );
362  }
363  else
364  {
365  LIB_ID lib_id( aName );
366 
368  m_fp_view_ctrl->CacheFootprint( lib_id );
369  m_fp_view_ctrl->DisplayFootprint( lib_id );
370  }
371 }
372 
373 
375 {
376  if( !m_fp_sel_ctrl )
377  return;
378 
380 
381  if( aAlias )
382  {
383  LIB_PINS temp_pins;
384  LIB_FIELD* fp_field = aAlias->GetPart()->GetField( FOOTPRINT );
385  wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
386 
387  aAlias->GetPart()->GetPins( temp_pins );
388 
389  m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
394  }
395  else
396  {
398  m_fp_sel_ctrl->Disable();
399  }
400 }
401 
402 
403 void DIALOG_CHOOSE_COMPONENT::OnDetailsLink( wxHtmlLinkEvent& aEvent )
404 {
405  const wxHtmlLinkInfo& info = aEvent.GetLinkInfo();
406  ::wxLaunchDefaultBrowser( info.GetHref() );
407 }
408 
409 
410 void DIALOG_CHOOSE_COMPONENT::OnSchViewPaint( wxPaintEvent& aEvent )
411 {
412  auto sel = m_tree_ctrl->GetSelection();
413 
414  int unit = m_adapter->GetUnitFor( sel );
415  LIB_ALIAS* alias = m_adapter->GetAliasFor( sel );
416  LIB_PART* part = alias ? alias->GetPart() : nullptr;
417 
418  // Don't draw anything (not even the background) if we don't have
419  // a part to show
420  if( !part )
421  return;
422 
423  if( alias->IsRoot() )
424  {
425  // just show the part directly
426  RenderPreview( part, unit );
427  }
428  else
429  {
430  // switch out the name temporarily for the alias name
431  wxString tmp( part->GetName() );
432  part->SetName( alias->GetName() );
433 
434  RenderPreview( part, unit );
435 
436  part->SetName( tmp );
437  }
438 }
439 
440 
441 void DIALOG_CHOOSE_COMPONENT::OnFootprintSelected( wxCommandEvent& aEvent )
442 {
443  m_fp_override = aEvent.GetString();
444 
445  m_field_edits.erase(
446  std::remove_if( m_field_edits.begin(), m_field_edits.end(),
447  []( std::pair<int, wxString> const& i ) { return i.first == FOOTPRINT; } ),
448  m_field_edits.end() );
449 
450  m_field_edits.push_back( std::make_pair( FOOTPRINT, m_fp_override ) );
451 
453 }
454 
455 
456 void DIALOG_CHOOSE_COMPONENT::RenderPreview( LIB_PART* aComponent, int aUnit )
457 {
458  wxPaintDC dc( m_sch_view_ctrl );
459 
460  const wxSize dc_size = dc.GetSize();
461 
462  // Avoid rendering when either dimension is zero
463  if( dc_size.x == 0 || dc_size.y == 0 )
464  return;
465 
466  GRResetPenAndBrush( &dc );
467 
468  COLOR4D bgColor = m_parent->GetDrawBgColor();
469 
470  dc.SetBackground( wxBrush( bgColor.ToColour() ) );
471  dc.Clear();
472 
473  if( !aComponent )
474  return;
475 
476  if( aUnit <= 0 )
477  aUnit = 1;
478 
479  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
480 
481  // Find joint bounding box for everything we are about to draw.
482  EDA_RECT bBox = aComponent->GetUnitBoundingBox( aUnit, m_deMorganConvert );
483  const double xscale = (double) dc_size.x / bBox.GetWidth();
484  const double yscale = (double) dc_size.y / bBox.GetHeight();
485  const double scale = std::min( xscale, yscale ) * 0.85;
486 
487  dc.SetUserScale( scale, scale );
488 
489  wxPoint offset = -bBox.Centre();
490 
491  auto opts = PART_DRAW_OPTIONS::Default();
492  opts.draw_hidden_fields = false;
493  aComponent->Draw( nullptr, &dc, offset, aUnit, m_deMorganConvert, opts );
494 }
495 
496 
498 {
499  if( m_adapter->GetAliasFor( m_tree_ctrl->GetSelection() ) )
500  {
501  // Got a selection. We can't just end the modal dialog here, because
502  // wx leaks some events back to the parent window (in particular, the
503  // MouseUp following a double click).
504  //
505  // NOW, here's where it gets really fun. wxTreeListCtrl eats MouseUp.
506  // This isn't really feasible to bypass without a fully custom
507  // wxDataViewCtrl implementation, and even then might not be fully
508  // possible (docs are vague). To get around this, we use a one-shot
509  // timer to schedule the dialog close.
510  //
511  // See DIALOG_CHOOSE_COMPONENT::OnCloseTimer for the other end of this
512  // spaghetti noodle.
514  }
515  else
516  {
517  auto const sel = m_tree_ctrl->GetSelection();
518 
519  if( m_tree_ctrl->IsExpanded( sel ) )
520  m_tree_ctrl->Collapse( sel );
521  else
522  m_tree_ctrl->Expand( sel );
523  }
524 }
FOOTPRINT_SELECT_WIDGET * m_fp_sel_ctrl
void OnTreeSelect(wxDataViewEvent &aEvent)
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:196
LIB_FIELD * GetField(int aId)
Return pointer to the requested field.
void OnQueryText(wxCommandEvent &aEvent)
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDc, const wxPoint &aOffset, int aMulti, int aConvert, const PART_DRAW_OPTIONS &aOpts)
Draw part.
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Function GetBoundingBox.
Part library alias object definition.
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
void FilterByFootprintFilters(wxArrayString const &aFilters, bool aZeroFilters)
Filter by footprint filter list.
std::vector< std::pair< int, wxString > > m_field_edits
void OnTreeActivate(wxDataViewEvent &aEvent)
void OnFootprintSelected(wxCommandEvent &aEvent)
wxDataViewItem GetPrevItem(wxDataViewCtrl const &aView, wxDataViewItem const &aItem)
Get the previous item in list order.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
void SetDefaultFootprint(wxString const &aFp)
Set the default footprint for a part.
int GetHeight() const
void OnQueryCharHook(wxKeyEvent &aEvent)
std::vector< std::pair< int, wxString > > GetFields() const
Get a list of fields edited by the user.
This class can be used to populate a FOOTPRINT_LIST asynchronously.
wxObjectDataPtr< CMP_TREE_MODEL_ADAPTER > PTR
Reference-counting container for a pointer to CMP_TREE_MODEL_ADAPTER.
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:60
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:533
static FOOTPRINT_ASYNC_LOADER m_fp_loader
Class LIB_ID.
Definition: lib_id.h:56
Field Name Module PCB, i.e. "16DIP300".
void ClearFilters()
Clear all filters.
DIALOG_CHOOSE_COMPONENT(SCH_BASE_FRAME *aParent, const wxString &aTitle, CMP_TREE_MODEL_ADAPTER::PTR &aAdapter, int aDeMorganConvert, bool aAllowFieldEdits)
Create dialog to choose component.
void OnQueryEnter(wxCommandEvent &aEvent)
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.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool IsRoot() const
void PostSelectEvent()
Post a wxEVT_DATAVIEW_SELECTION_CHANGED to notify the selection handler that a new part has been sele...
void OnInitDialog(wxInitDialogEvent &aEvent)
void ShowFootprint(wxString const &aName)
Display the given footprint by name.
void ClearStatus()
Clear the contents of the status label and hide it.
const wxString & GetName() const
CMP_TREE_MODEL_ADAPTER::PTR m_adapter
wxString GenerateAliasInfo(LIB_ALIAS const *aAlias, int aUnit)
Return an HTML page describing a LIB_ALIAS.
void SelectIfValid(const wxDataViewItem &aTreeId)
If a wxDataViewitem is valid, select it and post a selection event.
Class LIB_PART defines a library part object.
static std::unique_ptr< FOOTPRINT_LIST > m_fp_list
void OnCloseTimer(wxTimerEvent &aEvent)
virtual bool Enable(bool aEnable=true) override
Enable or disable the control for input.
wxPanel * ConstructRightPanel(wxWindow *aParent)
LIB_ALIAS * GetSelectedAlias(int *aUnit) const
Function GetSelectedAlias To be called after this dialog returns from ShowModal().
wxPoint Centre() const
static PART_DRAW_OPTIONS Default()
void SetStatusText(wxString const &aText)
Set the contents of the status label and display it.
wxDataViewItem GetNextItem(wxDataViewCtrl const &aView, wxDataViewItem const &aItem)
Get the next item in list order.
COLOR4D GetDrawBgColor() const override
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
void EndQuasiModal(int retCode)
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:70
const int scale
void CacheFootprint(const LIB_ID &aFPID)
Preload a footprint into the cache.
void PopulateFootprintSelector(LIB_ALIAS *aAlias)
Populate the footprint selector for a given alias.
const wxString & GetName() const
bool IsInitialized() const
Return whether the widget initialized properly.
void DisplayFootprint(const LIB_ID &aFPID)
Set the currently displayed footprint.
static constexpr int DblClickDelay
Class EDA_RECT handles the component boundary box.
wxArrayString & GetFootPrints()
void HandleItemSelection()
Handle the selection of an item.
int GetWidth() const
void OnSchViewDClick(wxMouseEvent &aEvent)
virtual void SetName(const wxString &aName)
void Load(KIWAY &aKiway, PROJECT &aProject)
Start loading.
void OnDetailsLink(wxHtmlLinkEvent &aEvent)
FOOTPRINT_PREVIEW_WIDGET * m_fp_view_ctrl
Definition for part library class.
BITMAP_DEF GetBitmap(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:70
void OnSchViewPaint(wxPaintEvent &aEvent)
wxPanel * ConstructLeftPanel(wxWindow *aParent)
Class SCH_BASE_FRAME is a shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRA...
wxDataViewCtrl helper functions.
void FilterByPinCount(int aPinCount)
Filter by pin count.
void ShowFootprintFor(LIB_ALIAS *aAlias)
Look up the footprint for a given alias and display it.
#define min(a, b)
Definition: auxiliary.h:85
void RenderPreview(LIB_PART *aComponent, int aUnit)
Display a given component into the schematic symbol preview.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39