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-2020 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  #define filterActive( filter ) ( m_filteringOptions & filter )
284 
285  auto compFilter =
286  [this] ( const SELECTION& )
287  {
289  };
290 
291  auto libFilter =
292  [this] ( const SELECTION& )
293  {
295  };
296 
297  auto pinFilter =
298  [this] ( const SELECTION& )
299  {
301  };
302 
305  mgr->SetConditions( CVPCB_ACTIONS::filterFPbyPin, CHECK( pinFilter ) );
306 
307 #undef CHECK
308 #undef ENABLE
309 }
310 
311 
313 {
314  // Connect the handlers to launch the context menus in the listboxes
315  m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
316  [this]( wxMouseEvent& )
317  {
318  PopupMenu( m_footprintContextMenu );
319  } );
320 
321  m_compListBox->Bind( wxEVT_RIGHT_DOWN,
322  [this]( wxMouseEvent& )
323  {
324  PopupMenu( m_componentContextMenu );
325  } );
326 
327  // Connect the handler for the save button
328  m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
329  [this]( wxCommandEvent& )
330  {
331  // saveAssociations must be run immediately
333  } );
334 
335  // Connect the handlers for the ok/cancel buttons
336  Bind( wxEVT_BUTTON,
337  [this]( wxCommandEvent& )
338  {
339  // saveAssociations must be run immediately, before running Close( true )
341  Close( true );
342  }, wxID_OK );
343  Bind( wxEVT_BUTTON,
344  [this]( wxCommandEvent& )
345  {
346  Close( false );
347  }, wxID_CANCEL );
348 
349  // Connect the handlers for the close events
350  Bind( wxEVT_MENU,
351  [this]( wxCommandEvent& )
352  {
353  Close( false );
354  }, wxID_CLOSE );
355  Bind( wxEVT_MENU,
356  [this]( wxCommandEvent& )
357  {
358  Close( false );
359  }, wxID_EXIT );
360 
361  // Toolbar events
363 
364  // Just skip the resize events
365  Bind( wxEVT_SIZE,
366  []( wxSizeEvent& aEvent )
367  {
368  aEvent.Skip();
369  } );
370 
371  // Attach the events to the tool dispatcher
374  Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
375 }
376 
377 
378 bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
379 {
380  if( m_modified )
381  {
382  // Shutdown blocks must be determined and vetoed as early as possible
384  && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
385  {
386  return false;
387  }
388 
389  if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
390  "Save changes?" ),
391  [&]()->bool { return SaveFootprintAssociation( false ); } ) )
392  {
393  return false;
394  }
395  }
396 
397  return true;
398 }
399 
400 
402 {
403  // Close module display frame
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  auto cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
451 
452  m_filteringOptions = cfg->m_FilterFootprint;
453 }
454 
455 
457 {
459 
460  auto cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
461  cfg->m_FilterFootprint = m_filteringOptions;
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  for( const auto& assoc : curEntry )
500  {
501  AssociateFootprint( assoc, firstAssoc );
502  firstAssoc = false;
503  }
504 }
505 
506 
508  bool aNewEntry, bool aAddUndoItem )
509 {
510  if( m_netlist.IsEmpty() )
511  return;
512 
513  COMPONENT* component = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
514 
515  if( component == NULL )
516  return;
517 
518  LIB_ID fpid = aAssociation.GetNewFootprint();
519  LIB_ID oldFpid = component->GetFPID();
520 
521  // Test for validity of the requested footprint
522  if( !fpid.empty() && !fpid.IsValid() )
523  {
524  wxString msg = wxString::Format( _( "\"%s\" is not a valid footprint." ),
525  fpid.Format().wx_str() );
526  DisplayErrorMessage( this, msg );
527  return;
528  }
529 
530  const KIID& id = component->GetPath().back();
531 
532  // Set new footprint to all instances of the selected component
533  for( unsigned int idx : GetComponentIndices() )
534  {
535  COMPONENT* candidate = m_netlist.GetComponent( idx );
536 
537  if( candidate->GetPath().back() == id )
538  {
539  // Set the new footprint
540  candidate->SetFPID( fpid );
541 
542  // create the new component description and set it
543  wxString description = wxString::Format( CMP_FORMAT,
544  idx + 1,
545  candidate->GetReference(),
546  candidate->GetValue(),
547  candidate->GetFPID().Format().wx_str() );
548  m_compListBox->SetString( idx, description );
549  }
550  }
551 
552  // Mark the data as being modified
553  m_modified = true;
554 
555  // Update the statusbar and refresh the list
556  DisplayStatus();
557  m_compListBox->Refresh();
558 
559  if( !aAddUndoItem )
560  return;
561 
562  // Update the undo list
563  if ( aNewEntry )
564  {
565  // Create a new entry for this association
566  CVPCB_UNDO_REDO_ENTRIES newEntry;
567  newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
568  aAssociation.GetNewFootprint() ) );
569  m_undoList.emplace_back( newEntry );
570 
571  // Clear the redo list
572  m_redoList.clear();
573  }
574  else
575  m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
576  oldFpid, aAssociation.GetNewFootprint() ) );
577 
578 }
579 
580 
581 bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
582 {
583  return true;
584 }
585 
586 
588 {
589  // Tell AuiMgr that objects are changed !
590  if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
591  // (could be not the case when starting CvPcb
592  m_auimgr.Update();
593 
594  if( component == NULL )
595  {
596  DisplayStatus();
597  return;
598  }
599 
600  // Preview of the already assigned footprint.
601  // Find the footprint that was already chosen for this component and select it,
602  // but only if the selection is made from the component list or the library list.
603  // If the selection is made from the footprint list, do not change the current
604  // selected footprint.
605  if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
606  {
607  wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
608 
610 
611  for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
612  {
613  wxString footprintName;
614  wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
615  msg.Trim( true );
616  msg.Trim( false );
617  footprintName = msg.AfterFirst( wxChar( ' ' ) );
618 
619  if( module.Cmp( footprintName ) == 0 )
620  {
621  m_footprintListBox->SetSelection( ii, true );
622  break;
623  }
624  }
625 
628  }
629 
631  DisplayStatus();
632 }
633 
634 
637 {
638  int option = aFilter;
639 
640  // Apply the filter accordingly
641  switch( aAction )
642  {
643  case CVPCB_MAINFRAME::FILTER_DISABLE: m_filteringOptions &= ~option; break;
644  case CVPCB_MAINFRAME::FILTER_ENABLE: m_filteringOptions |= option; break;
645  case CVPCB_MAINFRAME::FILTER_TOGGLE: m_filteringOptions ^= option; break;
646  }
647 
648  wxListEvent l_event;
649  OnSelectComponent( l_event );
650 }
651 
652 
654 {
655  if( !m_initialized )
656  return;
657 
658  wxString filters, msg;
659  COMPONENT* component = GetSelectedComponent();
660 
662  {
663  msg.Empty();
664 
665  if( component )
666  {
667  for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
668  {
669  if( msg.IsEmpty() )
670  msg += component->GetFootprintFilters()[ii];
671  else
672  msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
673  }
674  }
675 
676  filters += _( "Keywords" );
677 
678  if( !msg.IsEmpty() )
679  filters += wxString::Format( wxT( " (%s)" ), msg );
680  }
681 
683  {
684  msg.Empty();
685 
686  if( component )
687  msg = wxString::Format( wxT( "%i" ), component->GetPinCount() );
688 
689  if( !filters.IsEmpty() )
690  filters += wxT( ", " );
691 
692  filters += _( "Pin Count" );
693 
694  if( !msg.IsEmpty() )
695  filters += wxString::Format( wxT( " (%s)" ), msg );
696  }
697 
699  {
701 
702  if( !filters.IsEmpty() )
703  filters += wxT( ", " );
704 
705  filters += _( "Library" );
706 
707  if( !msg.IsEmpty() )
708  filters += wxString::Format( wxT( " (%s)" ), msg );
709  }
710 
711  wxString textFilter = m_tcFilterString->GetValue();
712 
713  if( !textFilter.IsEmpty() )
714  {
715  if( !filters.IsEmpty() )
716  filters += wxT( ", " );
717 
718  filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
719  }
720 
721  if( filters.IsEmpty() )
722  msg = _( "No Filtering" );
723  else
724  msg.Printf( _( "Filtered by %s" ), filters );
725 
726  msg << wxT( ": " ) << m_footprintListBox->GetCount();
727 
728  SetStatusText( msg );
729 
730 
731  msg.Empty();
732  wxString footprintName = GetSelectedFootprint();
733 
734  FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
735 
736  if( module ) // can be NULL if no netlist loaded
737  {
738  msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
739  module->GetDescription(),
740  module->GetKeywords() );
741  }
742 
743  SetStatusText( msg, 1 );
744 
745  msg.Empty();
746  wxString lib;
747 
748  // Choose the footprint to get the information on
749  if( module )
750  {
751  // Use the footprint in the footprint viewer
752  lib = module->GetLibNickname();
753  }
755  {
756  // Use the footprint of the selected component
757  if( component )
758  lib = component->GetFPID().GetLibNickname();
759  }
761  {
762  // Use the library that is selected
764  }
765 
766  // Extract the library information
767  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
768 
769  if( fptbl->HasLibrary( lib ) )
770  msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
771  else
772  msg = wxString::Format( _( "Library location: unknown" ) );
773 
774  SetStatusText( msg, 2 );
775 }
776 
777 
779 {
780  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
781 
782  // Check if there are footprint libraries in the footprint library table.
783  if( !fptbl || !fptbl->GetLogicalLibs().size() )
784  {
785  wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
786  "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
787  return false;
788  }
789 
790  WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
791 
792  m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
793 
795  {
797  }
798 
799  return true;
800 }
801 
802 
803 void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
804 {
805  if( m_netlist.IsEmpty() )
806  return;
807 
808  // clear highlight of previously selected components (if any):
809  // Selecting a non existing symbol clears any previously highlighted symbols
810  std::string packet = "$CLEAR: \"HIGHLIGHTED\"";
811 
812  if( Kiface().IsSingle() )
813  SendCommand( MSG_TO_SCH, packet.c_str() );
814  else
815  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
816 
817  if( aClearHighligntOnly )
818  return;
819 
820  int selection = m_compListBox->GetSelection();
821 
822  if ( selection < 0 ) // Nothing selected
823  return;
824 
825  if( m_netlist.GetComponent( selection ) == NULL )
826  return;
827 
828  // Now highlight the selected component:
829  COMPONENT* component = m_netlist.GetComponent( selection );
830 
831  packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
832 
833  if( Kiface().IsSingle() )
834  SendCommand( MSG_TO_SCH, packet.c_str() );
835  else
836  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
837 }
838 
839 
840 int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
841 {
842  STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
843  KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
844 
845  m_netlist.Clear();
846 
847  try
848  {
849  netrdr.LoadNetlist();
850  }
851  catch( const IO_ERROR& ioe )
852  {
853  wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
854  ioe.What().GetData() );
855  wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
856  return 1;
857  }
858 
859  // We also remove footprint name if it is "$noname" because this is a dummy name,
860  // not the actual name of the footprint.
861  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
862  {
863  if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
864  m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
865  }
866 
867  // Sort components by reference:
869 
870  return 0;
871 }
872 
873 
875 {
876  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
877 
878  if( m_footprintListBox == NULL )
879  {
881  m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
882  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
883  }
884 
887  DisplayStatus();
888 }
889 
890 
892 {
893  wxString msg;
894  COMPONENT* component;
895  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
896 
897  if( m_compListBox == NULL )
898  {
900  m_compListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
901  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
902  }
903 
905 
906  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
907  {
908  component = m_netlist.GetComponent( i );
909 
910  msg.Printf( CMP_FORMAT,
911  m_compListBox->GetCount() + 1,
912  component->GetReference(),
913  component->GetValue(),
914  component->GetFPID().Format().wx_str() );
915  m_compListBox->m_ComponentList.Add( msg );
916  }
917 
918  if( m_compListBox->m_ComponentList.Count() )
919  {
920  m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
921  m_compListBox->SetSelection( 0, true );
922  m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
924  }
925 }
926 
927 
929 {
930  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
931 
932  if( m_libListBox == NULL )
933  {
935  m_libListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
936  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
937  }
938 
939  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
940 
941  if( tbl )
942  {
943  wxArrayString libNames;
944 
945  std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
946 
947  for( const wxString& libNickName : libNickNames )
948  libNames.Add( libNickName );
949 
950  m_libListBox->SetLibraryList( libNames );
951  }
952 }
953 
954 
956 {
957  int selection = m_compListBox->GetSelection();
958 
959  if( selection >= 0 && selection < (int) m_netlist.GetCount() )
960  return m_netlist.GetComponent( selection );
961 
962  return NULL;
963 }
964 
965 
966 void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
967 {
968  m_skipComponentSelect = aSkipUpdate;
969 
970  if( aIndex < 0 )
971  {
973  }
974  else if( aIndex < m_compListBox->GetCount() )
975  {
977  m_compListBox->SetSelection( aIndex );
979  }
980 
981  m_skipComponentSelect = false;
982 }
983 
984 
985 std::vector<unsigned int> CVPCB_MAINFRAME::GetComponentIndices(
986  CVPCB_MAINFRAME::CRITERIA aCriteria )
987 {
988  std::vector<unsigned int> idx;
989 
990  // Make sure a netlist has been loaded and the box has contents
991  if( m_netlist.IsEmpty() || m_compListBox->GetCount() == 0 )
992  return idx;
993 
994  switch( aCriteria )
995  {
997  idx.resize( m_netlist.GetCount() );
998  std::iota( idx.begin(), idx.end(), 0 );
999  break;
1000 
1002  {
1003  // Check to see if anything is selected
1004  if( m_compListBox->GetSelectedItemCount() < 1 )
1005  break;
1006 
1007  // Get the components
1008  int lastIdx = m_compListBox->GetFirstSelected();
1009  idx.emplace_back( lastIdx );
1010 
1011  lastIdx = m_compListBox->GetNextSelected( lastIdx );
1012  while( lastIdx > 0 )
1013  {
1014  idx.emplace_back( lastIdx );
1015  lastIdx = m_compListBox->GetNextSelected( lastIdx );
1016  }
1017  break;
1018  }
1020  for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1021  {
1022  if( m_netlist.GetComponent( i )->GetFPID().empty() )
1023  idx.emplace_back( i );
1024  }
1025  break;
1026 
1028  for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1029  {
1030  if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1031  idx.emplace_back( i );
1032  }
1033  break;
1034 
1035  default:
1036  wxASSERT_MSG( false, "Invalid component selection criteria" );
1037  }
1038 
1039  return idx;
1040 }
1041 
1042 
1044 {
1045  // returns the Footprint Viewer frame, if exists, or NULL
1046  return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>
1047  ( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
1048 }
1049 
1050 
1052 {
1053  return GetFootprintViewerFrame();
1054 }
1055 
1056 
1058 {
1059  if( m_libListBox->HasFocus() )
1061  else if( m_compListBox->HasFocus() )
1063  else if( m_footprintListBox->HasFocus() )
1065 
1067 }
1068 
1069 
1071 {
1072  if( m_libListBox->HasFocus() )
1073  return m_libListBox;
1074  else if( m_compListBox->HasFocus() )
1075  return m_compListBox;
1076  else if( m_footprintListBox->HasFocus() )
1077  return m_footprintListBox;
1078 
1079  return nullptr;
1080 }
1081 
1082 
1084 {
1085  switch( aLB )
1086  {
1087  case CVPCB_MAINFRAME::CONTROL_LIBRARY: m_libListBox->SetFocus(); break;
1088  case CVPCB_MAINFRAME::CONTROL_COMPONENT: m_compListBox->SetFocus(); break;
1089  case CVPCB_MAINFRAME::CONTROL_FOOTPRINT: m_footprintListBox->SetFocus(); break;
1090  default: break;
1091  }
1092 }
1093 
1094 
1096 {
1097  // returns the LIB_ID of the selected footprint in footprint listview
1098  // or a empty string
1100 }
1101 
1102 
1103 void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1104 {
1105  switch( aNumber )
1106  {
1107  case 0: m_statusLine1->SetLabel( aText ); break;
1108  case 1: m_statusLine2->SetLabel( aText ); break;
1109  case 2: m_statusLine3->SetLabel( aText ); break;
1110  default: wxFAIL_MSG( "Invalid status row number" ); break;
1111  }
1112 }
1113 
1114 
1116 {
1118  ReCreateHToolbar();
1119  DisplayStatus();
1120 }
1121 
1122 
1124 {
1125  const std::string& payload = mail.GetPayload();
1126 
1127  switch( mail.Command() )
1128  {
1129  case MAIL_EESCHEMA_NETLIST:
1130  ReadNetListAndFpFiles( payload );
1131  /* @todo
1132  Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1133  */
1134  break;
1135 
1136  default:
1137  ; // ignore most
1138  }
1139 }
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)
Adds 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:202
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:61
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
const BITMAP_OPAQUE icon_cvpcb_xpm[1]
Definition: icon_cvpcb.cpp:170
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:69
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
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)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:109
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:253
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
FOOTPRINT_INFO * GetModuleInfo(const wxString &aFootprintId)
Get info for a module by id.
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)
Saves common frame parameters to a configuration data file.
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:156
void SetSelectedFootprint(const LIB_ID &aFPID)
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:43
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)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:141
wxString GetDescription() override
wxString m_AboutTitle
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:224
void SetFocusedControl(CVPCB_MAINFRAME::CONTROL_TYPE aControl)
Set the focus to a specific control.
SELECTION_CONDITION RedoAvailable()
Creates 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
Saves common frame parameters to a configuration data file.
#define FOOTPRINTVIEWER_FRAME_NAME
ACTION_MANAGER.
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
Definition: lib_id.h:171
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:186
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.
DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
This file contains miscellaneous commonly used macros and functions.
void SetTool(TOOL_INTERACTIVE *aTool)
Sets a tool that is the creator of the menu.
const char * c_str() const
Definition: utf8.h:107
void SortByReference()
int StrPrintf(std::string *result, const char *format,...)
Function StrPrintf is like sprintf() but the output is appended to a std::string instead of to a char...
Definition: richio.cpp:78
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:157
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)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:95
TOOL_MANAGER.
Definition: tool_manager.h:51
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
Function IsSingle is this KIFACE_I running under single_top?
Definition: kiface_i.h:117
void UpdateWidth(int aLine=-1)
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Function OpenProjectFiles is abstract, and opens 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
Function Prj returns 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)
Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs, and makes tools handle those.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const wxString & GetReference() const
Definition: pcb_netlist.h:147
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
wxString GetSelectedLibrary()
ACTIONS * m_actions
Definition: tools_holder.h:49
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
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
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:97
CRITERIA
Criteria to use to identify sets of components.
static TOOL_ACTION deleteAssoc
Definition: cvpcb_actions.h:66
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
CVPCB_ACTIONS.
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
COMMON_CONTROL.
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:237
COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:80
void SetSelection(int index, bool State=true)
SELECTION_CONDITION ContentModified()
Creates a functor that tests if the content of the frame is modified.
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:283
wxStaticText * m_statusLine2
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:233
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:437
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:218
void doCloseWindow() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
bool ReadNetListAndFpFiles(const std::string &aNetlist)
Function ReadNetListAndFpFiles loads the netlist file built on the fly by Eeschema and loads footprin...
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 ENABLE(x)
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:200
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Sets the work environment (model, view, view controls and the parent window).
virtual void DispatchWxCommand(wxCommandEvent &aEvent)
Processes 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()
Creates 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:168
A class to define a footprint association to be made in cvpcb.
wxString GetKeywords()
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:212
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:148
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:165
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:76
void OnEnterFilteringText(wxCommandEvent &event)
Function OnEnterFilteringText Is called each time the text of m_tcFilterString is changed.
void InitTools()
Function InitTools() Initializes all registered tools.
Not associated components.
MAIL_T Command()
Function Command returns the MAIL_T associated with this mail.
Definition: kiway_express.h:52
STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:255
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame() const
const KIID_PATH & GetPath() const
Definition: pcb_netlist.h:162
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
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
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
std::string & GetPayload()
Function Payload returns the payload, which can be any text but it typicall self identifying s-expres...
Definition: kiway_express.h:62
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.
wxStaticText * m_statusLine1
void RegisterTool(TOOL_BASE *aTool)
Function RegisterTool() Adds 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...