KiCad PCB EDA Suite
cvpcb_mainframe.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-2021 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 
26 #include <bitmaps.h>
27 #include <confirm.h>
28 #include <eda_dde.h>
29 #include <fp_lib_table.h>
30 #include <kiface_i.h>
31 #include <kiplatform/app.h>
32 #include <kiway_express.h>
33 #include <macros.h>
35 #include <numeric>
36 #include <tool/action_manager.h>
37 #include <tool/action_toolbar.h>
38 #include <tool/common_control.h>
39 #include <tool/editor_conditions.h>
40 #include <tool/tool_dispatcher.h>
41 #include <tool/tool_manager.h>
43 #include <wx/statline.h>
44 
45 #include <cvpcb_association.h>
46 #include <cvpcb_id.h>
47 #include <cvpcb_mainframe.h>
48 #include <cvpcb_settings.h>
50 #include <kiplatform/ui.h>
51 #include <listboxes.h>
52 #include <tools/cvpcb_actions.h>
54 #include <tools/cvpcb_control.h>
55 
56 #define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
57 
58 
59 CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
60  KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
62 {
67  m_modified = false;
68  m_skipComponentSelect = false;
72  m_initialized = false;
73  m_aboutTitle = "CvPcb";
74 
75  // Give an icon
76  wxIcon icon;
77  icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
78  SetIcon( icon );
79 
80  SetAutoLayout( true );
81 
82  LoadSettings( config() );
83 
84  setupTools();
88 
89  // Create list of available footprints and components of the schematic
93 
94  m_auimgr.SetManagedWindow( this );
95 
96  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
97 
98  m_auimgr.AddPane( m_libListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
99  .Caption( _( "Footprint Libraries" ) )
100  .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
101 
102  m_auimgr.AddPane( m_compListBox, EDA_PANE().Palette().Name( "Components" ).Center().Layer(0)
103  .Caption( _( "Symbol : Footprint Assignments" ) ) );
104 
105  m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
106  .Caption( _( "Filtered Footprints" ) )
107  .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
108 
109  // Build the bottom panel, to display 2 status texts and the buttons:
110  auto bottomPanel = new wxPanel( this );
111  auto panelSizer = new wxBoxSizer( wxVERTICAL );
112 
113  wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
114  fgSizerStatus->SetFlexibleDirection( wxBOTH );
115  fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
116 
117  m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
118  fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
119 
120  m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
121  fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
122 
123  m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
124  fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
125 
126  panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
127 
128  wxStaticLine* staticline1 = new wxStaticLine( bottomPanel );
129  panelSizer->Add( staticline1, 0, wxEXPAND, 5 );
130 
131  wxFont statusFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
132  statusFont.SetSymbolicSize( wxFONTSIZE_SMALL );
133  m_statusLine1->SetFont( statusFont );
134  m_statusLine2->SetFont( statusFont );
135  m_statusLine3->SetFont( statusFont );
136 
137  // Add buttons:
138  auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
139  auto sdbSizer = new wxStdDialogButtonSizer();
140 
141  m_saveAndContinue = new wxButton( bottomPanel, ID_SAVE_PROJECT,
142  _( "Apply, Save Schematic && Continue" ) );
143  buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
144 
145  auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
146  sdbSizer->AddButton( sdbSizerOK );
147  auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
148  sdbSizer->AddButton( sdbSizerCancel );
149  sdbSizer->Realize();
150 
151  buttonsSizer->Add( sdbSizer, 0, 0, 5 );
152  panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
153 
154  bottomPanel->SetSizer( panelSizer );
155  bottomPanel->Fit();
156 
157  sdbSizerOK->SetDefault();
159 
160  m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
161 
162  m_auimgr.Update();
163  m_initialized = true;
164 
165  if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
166  {
167  if( cfg->m_LibrariesWidth > 0 )
168  {
169  wxAuiPaneInfo& librariesPane = m_auimgr.GetPane( "Libraries" );
170 
171  // wxAUI hack: force width by setting MinSize() and then Fixed()
172  // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
173  librariesPane.MinSize( cfg->m_LibrariesWidth, -1 );
174  librariesPane.BestSize( cfg->m_LibrariesWidth, -1 );
175  librariesPane.MaxSize( cfg->m_LibrariesWidth, -1 );
176  librariesPane.Fixed();
177  m_auimgr.Update();
178 
179  // now make it resizable again
180  librariesPane.MinSize( 20, -1 );
181  librariesPane.Resizable();
182  m_auimgr.Update();
183  }
184 
185  if( cfg->m_FootprintsWidth > 0 )
186  {
187  wxAuiPaneInfo& footprintsPane = m_auimgr.GetPane( "Footprints" );
188 
189  // wxAUI hack: force width by setting MinSize() and then Fixed()
190  // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
191  footprintsPane.MinSize( cfg->m_FootprintsWidth, -1 );
192  footprintsPane.BestSize( cfg->m_FootprintsWidth, -1 );
193  footprintsPane.MaxSize( cfg->m_FootprintsWidth, -1 );
194  footprintsPane.Fixed();
195  m_auimgr.Update();
196 
197  // now make it resizable again
198  footprintsPane.MinSize( 20, -1 );
199  footprintsPane.Resizable();
200  m_auimgr.Update();
201  }
202  }
203 
204  // Connect Events
206 
207  // Start the main processing loop
208  m_toolManager->InvokeTool( "cvpcb.Control" );
209 
210  KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
211 }
212 
213 
215 {
216  // Shutdown all running tools
217  if( m_toolManager )
219 
220  // Clean up the tool infrastructure
221  delete m_actions;
222  delete m_toolManager;
223  delete m_toolDispatcher;
224 
225  m_auimgr.UnInit();
226 }
227 
228 
230 {
231  // Create the manager
232  m_actions = new CVPCB_ACTIONS();
234  m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
236 
237  // Register tools
242 
244 
245  // Even though these menus will open with the right-click, we treat them as a normal
246  // menu instead of a context menu because we don't care about their position and want
247  // to be able to tell the difference between a menu click and a hotkey activation.
248 
249  // Create the context menu for the component list box
250  m_componentContextMenu = new ACTION_MENU( false );
253  m_componentContextMenu->AppendSeparator();
257  m_componentContextMenu->AppendSeparator();
259 
260  // Create the context menu for the footprint list box
261  m_footprintContextMenu = new ACTION_MENU( false );
264 }
265 
266 
268 {
270 
272  EDITOR_CONDITIONS cond( this );
273 
274  wxASSERT( mgr );
275 
276 #define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
277 #define CHECK( x ) ACTION_CONDITIONS().Check( x )
278 
280  mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
281  mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
282 
283  auto compFilter =
284  [this] ( const SELECTION& )
285  {
287  };
288 
289  auto libFilter =
290  [this] ( const SELECTION& )
291  {
293  };
294 
295  auto pinFilter =
296  [this] ( const SELECTION& )
297  {
299  };
300 
303  mgr->SetConditions( CVPCB_ACTIONS::filterFPbyPin, CHECK( pinFilter ) );
304 
305 #undef CHECK
306 #undef ENABLE
307 }
308 
309 
311 {
312  // Connect the handlers to launch the context menus in the listboxes
313  m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
314  [this]( wxMouseEvent& )
315  {
316  PopupMenu( m_footprintContextMenu );
317  } );
318 
319  m_compListBox->Bind( wxEVT_RIGHT_DOWN,
320  [this]( wxMouseEvent& )
321  {
322  PopupMenu( m_componentContextMenu );
323  } );
324 
325  // Connect the handler for the save button
326  m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
327  [this]( wxCommandEvent& )
328  {
329  // saveAssociations must be run immediately
331  } );
332 
333  // Connect the handlers for the ok/cancel buttons
334  Bind( wxEVT_BUTTON,
335  [this]( wxCommandEvent& )
336  {
337  // saveAssociations must be run immediately, before running Close( true )
339  Close( true );
340  }, wxID_OK );
341  Bind( wxEVT_BUTTON,
342  [this]( wxCommandEvent& )
343  {
344  Close( false );
345  }, wxID_CANCEL );
346 
347  // Connect the handlers for the close events
348  Bind( wxEVT_MENU,
349  [this]( wxCommandEvent& )
350  {
351  Close( false );
352  }, wxID_CLOSE );
353  Bind( wxEVT_MENU,
354  [this]( wxCommandEvent& )
355  {
356  Close( false );
357  }, wxID_EXIT );
358 
359  // Toolbar events
361 
362  // Just skip the resize events
363  Bind( wxEVT_SIZE,
364  []( wxSizeEvent& aEvent )
365  {
366  aEvent.Skip();
367  } );
368 
369  // Attach the events to the tool dispatcher
372  Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
373 }
374 
375 
376 bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
377 {
378  if( m_modified )
379  {
380  // Shutdown blocks must be determined and vetoed as early as possible
382  && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
383  {
384  return false;
385  }
386 
387  if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
388  "Save changes?" ),
389  [&]() -> bool
390  {
391  return SaveFootprintAssociation( false );
392  } ) )
393  {
394  return false;
395  }
396  }
397 
398  return true;
399 }
400 
401 
403 {
405  GetFootprintViewerFrame()->Close( true );
406 
407  m_modified = false;
408 
409  // clear highlight symbol in schematic:
410  SendMessageToEESCHEMA( true );
411 }
412 
413 
414 void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
415 {
416  // Called when changing the filter string in main toolbar.
417  // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
418  // of available footprints which match the filter
419 
420  wxListEvent l_event;
421  OnSelectComponent( l_event );
422 }
423 
424 
425 void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
426 {
428  return;
429 
430  wxString libraryName;
431  COMPONENT* component = GetSelectedComponent();
432  libraryName = m_libListBox->GetSelectedLibrary();
433 
434  m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
435  m_tcFilterString->GetValue(), m_filteringOptions );
436 
437  if( component && component->GetFPID().IsValid() )
439  else
441 
442  refreshAfterComponentSearch( component );
443 }
444 
445 
447 {
449 
450  CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
451 
453 }
454 
455 
457 {
459 
460  CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
462 
463  cfg->m_LibrariesWidth = m_libListBox->GetSize().x;
464  cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
465 }
466 
467 
469 {
470  if( m_undoList.size() == 0 )
471  return;
472 
473  CVPCB_UNDO_REDO_ENTRIES redoEntries;
474  CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
475  m_undoList.pop_back();
476 
477  // Iterate over the entries to undo
478  for( const auto& assoc : curEntry )
479  {
480  AssociateFootprint( assoc, true, false );
481  redoEntries.emplace_back( assoc.Reverse() );
482  }
483 
484  // Add the redo entries to the redo stack
485  m_redoList.emplace_back( redoEntries );
486 }
487 
488 
490 {
491  if( m_redoList.size() == 0 )
492  return;
493 
494  CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
495  m_redoList.pop_back();
496 
497  // Iterate over the entries to undo
498  bool firstAssoc = true;
499 
500  for( const auto& assoc : curEntry )
501  {
502  AssociateFootprint( assoc, firstAssoc );
503  firstAssoc = false;
504  }
505 }
506 
507 
509  bool aNewEntry, bool aAddUndoItem )
510 {
511  if( m_netlist.IsEmpty() )
512  return;
513 
514  COMPONENT* component = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
515 
516  if( component == NULL )
517  return;
518 
519  LIB_ID fpid = aAssociation.GetNewFootprint();
520  LIB_ID oldFpid = component->GetFPID();
521 
522  // Test for validity of the requested footprint
523  if( !fpid.empty() && !fpid.IsValid() )
524  {
525  wxString msg = wxString::Format( _( "\"%s\" is not a valid footprint." ),
526  fpid.Format().wx_str() );
527  DisplayErrorMessage( this, msg );
528  return;
529  }
530 
531  const KIID& id = component->GetKIIDs().front();
532 
533  // Set new footprint to all instances of the selected component
534  for( unsigned int idx : GetComponentIndices() )
535  {
536  COMPONENT* candidate = m_netlist.GetComponent( idx );
537  const std::vector<KIID>& kiids = candidate->GetKIIDs();
538 
539  if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
540  {
541  // Set the new footprint
542  candidate->SetFPID( fpid );
543 
544  // create the new component description and set it
545  wxString description = wxString::Format( CMP_FORMAT,
546  idx + 1,
547  candidate->GetReference(),
548  candidate->GetValue(),
549  candidate->GetFPID().Format().wx_str() );
550  m_compListBox->SetString( idx, description );
551  }
552  }
553 
554  // Mark the data as being modified
555  m_modified = true;
556 
557  // Update the statusbar and refresh the list
558  DisplayStatus();
559  m_compListBox->Refresh();
560 
561  if( !aAddUndoItem )
562  return;
563 
564  // Update the undo list
565  if ( aNewEntry )
566  {
567  // Create a new entry for this association
568  CVPCB_UNDO_REDO_ENTRIES newEntry;
569  newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
570  aAssociation.GetNewFootprint() ) );
571  m_undoList.emplace_back( newEntry );
572 
573  // Clear the redo list
574  m_redoList.clear();
575  }
576  else
577  {
578  m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
579  oldFpid,
580  aAssociation.GetNewFootprint() ) );
581  }
582 
583 }
584 
585 
586 bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
587 {
588  return true;
589 }
590 
591 
593 {
594  // Tell AuiMgr that objects are changed !
595  if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
596  m_auimgr.Update(); // (could be not the case when starting CvPcb)
597 
598  if( component == NULL )
599  {
600  DisplayStatus();
601  return;
602  }
603 
604  // Preview of the already assigned footprint.
605  // Find the footprint that was already chosen for this component and select it,
606  // but only if the selection is made from the component list or the library list.
607  // If the selection is made from the footprint list, do not change the current
608  // selected footprint.
609  if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
610  {
611  wxString footprintName = FROM_UTF8( component->GetFPID().Format().c_str() );
612 
614 
615  for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
616  {
617  wxString candidateName;
618  wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
619  msg.Trim( true );
620  msg.Trim( false );
621  candidateName = msg.AfterFirst( wxChar( ' ' ) );
622 
623  if( footprintName.Cmp( candidateName ) == 0 )
624  {
625  m_footprintListBox->SetSelection( ii, true );
626  break;
627  }
628  }
629 
632  }
633 
635  DisplayStatus();
636 }
637 
638 
641 {
642  int option = aFilter;
643 
644  // Apply the filter accordingly
645  switch( aAction )
646  {
647  case CVPCB_MAINFRAME::FILTER_DISABLE: m_filteringOptions &= ~option; break;
648  case CVPCB_MAINFRAME::FILTER_ENABLE: m_filteringOptions |= option; break;
649  case CVPCB_MAINFRAME::FILTER_TOGGLE: m_filteringOptions ^= option; break;
650  }
651 
652  wxListEvent l_event;
653  OnSelectComponent( l_event );
654 }
655 
656 
658 {
659  if( !m_initialized )
660  return;
661 
662  wxString filters, msg;
663  COMPONENT* component = GetSelectedComponent();
664 
666  {
667  msg.Empty();
668 
669  if( component )
670  {
671  for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
672  {
673  if( msg.IsEmpty() )
674  msg += component->GetFootprintFilters()[ii];
675  else
676  msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
677  }
678  }
679 
680  filters += _( "Keywords" );
681 
682  if( !msg.IsEmpty() )
683  filters += wxString::Format( wxT( " (%s)" ), msg );
684  }
685 
687  {
688  msg.Empty();
689 
690  if( component )
691  msg = wxString::Format( wxT( "%i" ), component->GetPinCount() );
692 
693  if( !filters.IsEmpty() )
694  filters += wxT( ", " );
695 
696  filters += _( "Pin Count" );
697 
698  if( !msg.IsEmpty() )
699  filters += wxString::Format( wxT( " (%s)" ), msg );
700  }
701 
703  {
705 
706  if( !filters.IsEmpty() )
707  filters += wxT( ", " );
708 
709  filters += _( "Library" );
710 
711  if( !msg.IsEmpty() )
712  filters += wxString::Format( wxT( " (%s)" ), msg );
713  }
714 
715  wxString textFilter = m_tcFilterString->GetValue();
716 
717  if( !textFilter.IsEmpty() )
718  {
719  if( !filters.IsEmpty() )
720  filters += wxT( ", " );
721 
722  filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
723  }
724 
725  if( filters.IsEmpty() )
726  msg = _( "No Filtering" );
727  else
728  msg.Printf( _( "Filtered by %s" ), filters );
729 
730  msg << wxT( ": " ) << m_footprintListBox->GetCount();
731 
732  SetStatusText( msg );
733 
734 
735  msg.Empty();
736  wxString footprintName = GetSelectedFootprint();
737 
738  FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
739 
740  if( fp ) // can be NULL if no netlist loaded
741  {
742  msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
743  fp->GetDescription(),
744  fp->GetKeywords() );
745  }
746 
747  SetStatusText( msg, 1 );
748 
749  msg.Empty();
750  wxString lib;
751 
752  // Choose the footprint to get the information on
753  if( fp )
754  {
755  // Use the footprint in the footprint viewer
756  lib = fp->GetLibNickname();
757  }
759  {
760  // Use the footprint of the selected component
761  if( component )
762  lib = component->GetFPID().GetLibNickname();
763  }
765  {
766  // Use the library that is selected
768  }
769 
770  // Extract the library information
771  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
772 
773  if( fptbl->HasLibrary( lib ) )
774  msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
775  else
776  msg = wxString::Format( _( "Library location: unknown" ) );
777 
778  SetStatusText( msg, 2 );
779 }
780 
781 
783 {
784  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
785 
786  // Check if there are footprint libraries in the footprint library table.
787  if( !fptbl || !fptbl->GetLogicalLibs().size() )
788  {
789  wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
790  "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
791  return false;
792  }
793 
794  WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
795 
796  m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
797 
799  {
801  }
802 
803  return true;
804 }
805 
806 
807 void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
808 {
809  if( m_netlist.IsEmpty() )
810  return;
811 
812  // clear highlight of previously selected components (if any):
813  // Selecting a non existing symbol clears any previously highlighted symbols
814  std::string packet = "$CLEAR: \"HIGHLIGHTED\"";
815 
816  if( Kiface().IsSingle() )
817  SendCommand( MSG_TO_SCH, packet.c_str() );
818  else
819  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
820 
821  if( aClearHighligntOnly )
822  return;
823 
824  int selection = m_compListBox->GetSelection();
825 
826  if ( selection < 0 ) // Nothing selected
827  return;
828 
829  if( m_netlist.GetComponent( selection ) == NULL )
830  return;
831 
832  // Now highlight the selected component:
833  COMPONENT* component = m_netlist.GetComponent( selection );
834 
835  packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
836 
837  if( Kiface().IsSingle() )
838  SendCommand( MSG_TO_SCH, packet.c_str() );
839  else
840  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
841 }
842 
843 
844 int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
845 {
846  STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
847  KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
848 
849  m_netlist.Clear();
850 
851  try
852  {
853  netrdr.LoadNetlist();
854  }
855  catch( const IO_ERROR& ioe )
856  {
857  wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
858  ioe.What().GetData() );
859  wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
860  return 1;
861  }
862 
863  // We also remove footprint name if it is "$noname" because this is a dummy name,
864  // not the actual name of the footprint.
865  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
866  {
867  if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
868  m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
869  }
870 
871  // Sort components by reference:
873 
874  return 0;
875 }
876 
877 
879 {
880  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
881 
882  if( m_footprintListBox == NULL )
883  {
885  m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
886  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
887  }
888 
889  m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL, wxEmptyString,
891  DisplayStatus();
892 }
893 
894 
896 {
897  wxString msg;
898  COMPONENT* component;
899  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
900 
901  if( m_compListBox == NULL )
902  {
904  m_compListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
905  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
906  }
907 
909 
910  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
911  {
912  component = m_netlist.GetComponent( i );
913 
914  msg.Printf( CMP_FORMAT,
915  m_compListBox->GetCount() + 1,
916  component->GetReference(),
917  component->GetValue(),
918  component->GetFPID().Format().wx_str() );
919  m_compListBox->m_ComponentList.Add( msg );
920  }
921 
922  if( m_compListBox->m_ComponentList.Count() )
923  {
924  m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
925  m_compListBox->SetSelection( 0, true );
926  m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
928  }
929 }
930 
931 
933 {
934  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
935 
936  if( m_libListBox == NULL )
937  {
939  m_libListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
940  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
941  }
942 
943  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
944 
945  if( tbl )
946  {
947  wxArrayString libNames;
948 
949  std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
950 
951  for( const wxString& libNickName : libNickNames )
952  libNames.Add( libNickName );
953 
954  m_libListBox->SetLibraryList( libNames );
955  }
956 }
957 
958 
960 {
961  int selection = m_compListBox->GetSelection();
962 
963  if( selection >= 0 && selection < (int) m_netlist.GetCount() )
964  return m_netlist.GetComponent( selection );
965 
966  return NULL;
967 }
968 
969 
970 void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
971 {
972  m_skipComponentSelect = aSkipUpdate;
973 
974  if( aIndex < 0 )
975  {
977  }
978  else if( aIndex < m_compListBox->GetCount() )
979  {
981  m_compListBox->SetSelection( aIndex );
983  }
984 
985  m_skipComponentSelect = false;
986 }
987 
988 
989 std::vector<unsigned int> CVPCB_MAINFRAME::GetComponentIndices(
990  CVPCB_MAINFRAME::CRITERIA aCriteria )
991 {
992  std::vector<unsigned int> idx;
993  int lastIdx;
994 
995  // Make sure a netlist has been loaded and the box has contents
996  if( m_netlist.IsEmpty() || m_compListBox->GetCount() == 0 )
997  return idx;
998 
999  switch( aCriteria )
1000  {
1002  idx.resize( m_netlist.GetCount() );
1003  std::iota( idx.begin(), idx.end(), 0 );
1004  break;
1005 
1007  // Check to see if anything is selected
1008  if( m_compListBox->GetSelectedItemCount() < 1 )
1009  break;
1010 
1011  // Get the components
1012  lastIdx = m_compListBox->GetFirstSelected();
1013  idx.emplace_back( lastIdx );
1014 
1015  lastIdx = m_compListBox->GetNextSelected( lastIdx );
1016  while( lastIdx > 0 )
1017  {
1018  idx.emplace_back( lastIdx );
1019  lastIdx = m_compListBox->GetNextSelected( lastIdx );
1020  }
1021  break;
1022 
1024  for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1025  {
1026  if( m_netlist.GetComponent( i )->GetFPID().empty() )
1027  idx.emplace_back( i );
1028  }
1029  break;
1030 
1032  for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1033  {
1034  if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1035  idx.emplace_back( i );
1036  }
1037  break;
1038 
1039  default:
1040  wxASSERT_MSG( false, "Invalid component selection criteria" );
1041  }
1042 
1043  return idx;
1044 }
1045 
1046 
1048 {
1049  // returns the Footprint Viewer frame, if exists, or NULL
1050  wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1051  return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1052 }
1053 
1054 
1056 {
1057  return GetFootprintViewerFrame();
1058 }
1059 
1060 
1062 {
1063  if( m_libListBox->HasFocus() )
1065  else if( m_compListBox->HasFocus() )
1067  else if( m_footprintListBox->HasFocus() )
1069 
1071 }
1072 
1073 
1075 {
1076  if( m_libListBox->HasFocus() )
1077  return m_libListBox;
1078  else if( m_compListBox->HasFocus() )
1079  return m_compListBox;
1080  else if( m_footprintListBox->HasFocus() )
1081  return m_footprintListBox;
1082 
1083  return nullptr;
1084 }
1085 
1086 
1088 {
1089  switch( aLB )
1090  {
1091  case CVPCB_MAINFRAME::CONTROL_LIBRARY: m_libListBox->SetFocus(); break;
1092  case CVPCB_MAINFRAME::CONTROL_COMPONENT: m_compListBox->SetFocus(); break;
1093  case CVPCB_MAINFRAME::CONTROL_FOOTPRINT: m_footprintListBox->SetFocus(); break;
1094  default: break;
1095  }
1096 }
1097 
1098 
1100 {
1101  // returns the LIB_ID of the selected footprint in footprint listview
1102  // or a empty string
1104 }
1105 
1106 
1107 void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1108 {
1109  switch( aNumber )
1110  {
1111  case 0: m_statusLine1->SetLabel( aText ); break;
1112  case 1: m_statusLine2->SetLabel( aText ); break;
1113  case 2: m_statusLine3->SetLabel( aText ); break;
1114  default: wxFAIL_MSG( "Invalid status row number" ); break;
1115  }
1116 }
1117 
1118 
1120 {
1122  ReCreateHToolbar();
1123  DisplayStatus();
1124 }
1125 
1126 
1128 {
1129  const std::string& payload = mail.GetPayload();
1130 
1131  switch( mail.Command() )
1132  {
1133  case MAIL_EESCHEMA_NETLIST:
1134  ReadNetListAndFpFiles( payload );
1135  /* @todo
1136  Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1137  */
1138  break;
1139 
1140  default:
1141  ; // ignore most
1142  }
1143 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:52
void SetLibraryList(const wxArrayString &aList)
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon)
Add a wxWidgets-style entry to the menu.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:208
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:61
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:38
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
const BITMAP_OPAQUE icon_cvpcb_xpm[1]
Definition: icon_cvpcb.cpp:112
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:69
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
CONTROL_TYPE
The type of the controls present in the application.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
DDE server & client.
FOOTPRINT_LIST * m_FootprintsList
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
KICAD_NETLIST_READER read the new s-expression based KiCad netlist format.
CVPCB_FILTER_ACTION
The action to apply to a footprint filter when it is modified.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:266
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
ACTION_MENU * m_footprintContextMenu
#define CMP_FORMAT
The print format to display a schematic component line.
wxControl * GetFocusedControlObject()
Get a pointer to the currently focused control.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:167
void SetSelectedFootprint(const LIB_ID &aFPID)
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:45
This file is part of the common library.
wxString GetLibNickname() const override
COMPONENTS_LISTBOX * m_compListBox
void SendMessageToEESCHEMA(bool aClearHighligntOnly=false)
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
#define CVPCB_MAINFRAME_NAME
void UndoAssociation()
Undo the most recent associations that were performed.
void DeselectAll()
Removes all selection in lists which can have more than one item selected.
#define MSG_TO_SCH
Definition: eda_dde.h:46
void AssociateFootprint(const CVPCB_ASSOCIATION &aAssociation, bool aNewEntry=true, bool aAddUndoItem=true)
Associate a footprint with a specific component in the list.
void setupEventHandlers()
Setup event handlers.
void SetSelection(int index, bool State=true)
void DisplayErrors(wxTopLevelWindow *aCaller=NULL)
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
wxString GetDescription() override
LIB_ID GetNewFootprint() const
Get the new footprint to associate to the component.
void RedoAssociation()
Redo the most recently undone association.
int ReadSchematicNetlist(const std::string &aNetlist)
Function ReadSchematicNetlist read the netlist (.net) file built on the fly by Eeschema.
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:237
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:439
void SetFocusedControl(CVPCB_MAINFRAME::CONTROL_TYPE aControl)
Set the focus to a specific control.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
bool SendCommand(int service, const char *cmdline)
Definition: eda_dde.cpp:131
wxAuiManager m_auimgr
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
#define FOOTPRINTVIEWER_FRAME_NAME
Manage TOOL_ACTION objects.
wxStaticText * m_statusLine3
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:168
bool LoadFootprintFiles()
Function LoadFootprintFiles reads the list of footprint (*.mod files) and generate the list of footpr...
Class that groups generic conditions for editor states.
bool empty() const
Definition: lib_id.h:189
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
This file contains miscellaneous commonly used macros and functions.
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
const char * c_str() const
Definition: utf8.h:102
void SortByReference()
int StrPrintf(std::string *result, const char *format,...)
This is like sprintf() but the output is appended to a std::string instead of to a character array.
Definition: richio.cpp:78
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:168
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:71
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:51
unsigned int GetComponentIndex() const
Get the index of the component to modify the association of.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
Master controller class:
Definition: tool_manager.h:52
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
Definition: kiid.h:44
static TOOL_ACTION copy
Definition: actions.h:70
wxTextCtrl * m_tcFilterString
void OnSelectComponent(wxListEvent &event)
Function OnSelectComponent Called when clicking on a component in component list window.
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
virtual void LoadNetlist() override
Function LoadNetlist loads the contents of the netlist file into aNetlist.
void refreshAfterComponentSearch(COMPONENT *component)
FP_FILTER_T
Filter setting constants.
Definition: listboxes.h:94
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back ...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
#define NULL
bool IsSingle() const
Is this KIFACE_I running under single_top?
Definition: kiface_i.h:104
void UpdateWidth(int aLine=-1)
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void SetSelectedComponent(int aIndex, bool aSkipUpdate=false)
Set the currently selected component in the components listbox.
virtual bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)=0
Read all the footprints provided by the combination of aTable and aNickname.
ACTION_TOOLBAR * m_mainToolBar
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const wxString & GetReference() const
Definition: pcb_netlist.h:158
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
wxString GetSelectedLibrary()
ACTIONS * m_actions
Definition: tools_holder.h:158
static TOOL_ACTION cut
Definition: actions.h:69
No controls have focus.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
ACTION_MENU * m_componentContextMenu
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
void SetStatusText(const wxString &aText, int aNumber=0) override
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:92
CRITERIA
Criteria to use to identify sets of components.
static TOOL_ACTION deleteAssoc
Definition: cvpcb_actions.h:66
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:40
#define KICAD_DEFAULT_DRAWFRAME_STYLE
void ReCreateMenuBar() override
Recreates the menu bar.
void BuildFOOTPRINTS_LISTBOX()
CVPCB_UNDO_REDO_LIST m_undoList
Gather all the actions that are shared by tools.
Definition: cvpcb_actions.h:40
wxString OnGetItemText(long item, long column) const override
Function OnGetItemText this overloaded function MUST be provided for the wxLC_VIRTUAL mode because re...
static TOOL_ACTION saveAssociations
Management actions.
Definition: cvpcb_actions.h:59
Handle actions that are shared between different applications.
TOOL_DISPATCHER * m_toolDispatcher
Specialization of the wxAuiPaneInfo class for KiCad panels.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
LIBRARY_LISTBOX * m_libListBox
UTF8 Format() const
Definition: lib_id.cpp:233
COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:85
void SetSelection(int index, bool State=true)
SELECTION_CONDITION ContentModified()
Create a functor that tests if the content of the frame is modified.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
wxStaticText * m_statusLine2
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:246
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
wxArrayString m_ComponentList
Definition: listboxes.h:193
wxString GetSelectedFootprint()
static TOOL_ACTION redo
Definition: actions.h:68
void Clear()
Function Clear removes all components from the netlist.
Definition: pcb_netlist.h:231
void doCloseWindow() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
bool ReadNetListAndFpFiles(const std::string &aNetlist)
Function ReadNetListAndFpFiles loads the netlist file built on the fly by Eeschema and loads footprin...
#define ENABLE(x)
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:197
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
virtual void DispatchWxCommand(wxCommandEvent &aEvent)
Process wxCommands (mostly menu related events) and runs appropriate actions (eg.
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:56
#define _(s)
Definition: 3d_actions.cpp:33
CVPCB_MAINFRAME(KIWAY *aKiway, wxWindow *aParent)
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:70
SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
CVPCB_UNDO_REDO_LIST m_redoList
void SetString(unsigned linecount, const wxString &text)
Toggle the filter state.
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
wxString wx_str() const
Definition: utf8.cpp:51
FOOTPRINTS_LISTBOX * m_footprintListBox
unsigned GetErrorCount() const
int GetPinCount() const
Definition: pcb_netlist.h:181
A class to define a footprint association to be made in cvpcb.
wxString GetKeywords()
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:225
void SetFootprints(FOOTPRINT_LIST &aList, const wxString &aLibName, COMPONENT *aComponent, const wxString &aFootPrintFilterPattern, int aFilterType)
Function SetFootprints populates the wxListCtrl with the footprints from aList that meet the filter c...
const wxString & GetValue() const
Definition: pcb_netlist.h:159
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:178
wxWindow * GetToolCanvas() const override
Canvas access.
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl()
Find out which control currently has focus.
void SetFootprintFilter(FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter, CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction)
Function SetFootprintFilter Set a filter criteria to either on/off or toggle the criteria.
static TOOL_ACTION undo
Definition: actions.h:67
#define CHECK(x)
std::vector< unsigned int > GetComponentIndices(CVPCB_MAINFRAME::CRITERIA aCriteria=CVPCB_MAINFRAME::ALL_COMPONENTS)
Get the indices for all the components meeting the specified criteria in the components listbox.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
void OnEnterFilteringText(wxCommandEvent &event)
Function OnEnterFilteringText Is called each time the text of m_tcFilterString is changed.
void InitTools()
Initializes all registered tools.
Not associated components.
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:49
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:237
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame() const
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:57
CVPCB_CONTROL.
Definition: cvpcb_control.h:35
static TOOL_ACTION paste
Definition: actions.h:71
wxButton * m_saveAndContinue
void setupTools()
Setup the tool system for the CVPCB main frame.
wxString m_aboutTitle
wxStaticText * m_statusLine1
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
std::vector< CVPCB_ASSOCIATION > CVPCB_UNDO_REDO_ENTRIES
bool SaveFootprintAssociation(bool doSaveSchematic)
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:175