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 #include <wx/stattext.h>
45 
46 #include <cvpcb_association.h>
47 #include <cvpcb_id.h>
48 #include <cvpcb_mainframe.h>
49 #include <cvpcb_settings.h>
51 #include <kiplatform/ui.h>
52 #include <listboxes.h>
53 #include <tools/cvpcb_actions.h>
55 #include <tools/cvpcb_control.h>
56 #include <wx/button.h>
57 #include <wx/settings.h>
58 
59 
60 #define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
61 
62 
63 CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
64  KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
66 {
67  m_symbolsListBox = nullptr;
68  m_footprintListBox = nullptr;
69  m_librariesListBox = nullptr;
70  m_mainToolBar = nullptr;
71  m_modified = false;
72  m_skipComponentSelect = false;
74  m_tcFilterString = nullptr;
76  m_initialized = false;
77  m_aboutTitle = "CvPcb";
78 
79  // Give an icon
80  wxIcon icon;
81  icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
82  SetIcon( icon );
83 
84  SetAutoLayout( true );
85 
86  LoadSettings( config() );
87 
88  setupTools();
92 
93  // Create list of available footprints and symbols of the schematic
97 
98  m_auimgr.SetManagedWindow( this );
99 
100  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
101 
102  m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
103  .Caption( _( "Footprint Libraries" ) )
104  .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
105 
106  m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
107  .Caption( _( "Symbol : Footprint Assignments" ) ) );
108 
109  m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
110  .Caption( _( "Filtered Footprints" ) )
111  .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
112 
113  // Build the bottom panel, to display 2 status texts and the buttons:
114  auto bottomPanel = new wxPanel( this );
115  auto panelSizer = new wxBoxSizer( wxVERTICAL );
116 
117  wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
118  fgSizerStatus->SetFlexibleDirection( wxBOTH );
119  fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
120 
121  m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
122  fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
123 
124  m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
125  fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
126 
127  m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
128  fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
129 
130  panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
131 
132  wxStaticLine* staticline1 = new wxStaticLine( bottomPanel );
133  panelSizer->Add( staticline1, 0, wxEXPAND, 5 );
134 
135  m_statusLine1->SetFont( KIUI::GetInfoFont() );
136  m_statusLine2->SetFont( KIUI::GetInfoFont() );
137  m_statusLine3->SetFont( KIUI::GetInfoFont() );
138 
139  // Add buttons:
140  auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
141  auto sdbSizer = new wxStdDialogButtonSizer();
142 
143  m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY,
144  _( "Apply, Save Schematic && Continue" ) );
145  buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
146 
147  auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
148  sdbSizer->AddButton( sdbSizerOK );
149  auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
150  sdbSizer->AddButton( sdbSizerCancel );
151  sdbSizer->Realize();
152 
153  buttonsSizer->Add( sdbSizer, 0, 0, 5 );
154  panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
155 
156  bottomPanel->SetSizer( panelSizer );
157  bottomPanel->Fit();
158 
159  sdbSizerOK->SetDefault();
161 
162  m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
163 
164  m_auimgr.Update();
165  m_initialized = true;
166 
167  if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
168  {
169  if( cfg->m_LibrariesWidth > 0 )
170  {
171  wxAuiPaneInfo& librariesPane = m_auimgr.GetPane( "Libraries" );
172 
173  // wxAUI hack: force width by setting MinSize() and then Fixed()
174  // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
175  librariesPane.MinSize( cfg->m_LibrariesWidth, -1 );
176  librariesPane.BestSize( cfg->m_LibrariesWidth, -1 );
177  librariesPane.MaxSize( cfg->m_LibrariesWidth, -1 );
178  librariesPane.Fixed();
179  m_auimgr.Update();
180 
181  // now make it resizable again
182  librariesPane.MinSize( 20, -1 );
183  librariesPane.Resizable();
184  m_auimgr.Update();
185  }
186 
187  if( cfg->m_FootprintsWidth > 0 )
188  {
189  wxAuiPaneInfo& footprintsPane = m_auimgr.GetPane( "Footprints" );
190 
191  // wxAUI hack: force width by setting MinSize() and then Fixed()
192  // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
193  footprintsPane.MinSize( cfg->m_FootprintsWidth, -1 );
194  footprintsPane.BestSize( cfg->m_FootprintsWidth, -1 );
195  footprintsPane.MaxSize( cfg->m_FootprintsWidth, -1 );
196  footprintsPane.Fixed();
197  m_auimgr.Update();
198 
199  // now make it resizable again
200  footprintsPane.MinSize( 20, -1 );
201  footprintsPane.Resizable();
202  m_auimgr.Update();
203  }
204  }
205 
206  // Connect Events
208 
209  // Start the main processing loop
210  m_toolManager->InvokeTool( "cvpcb.Control" );
211 
212  KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
213 }
214 
215 
217 {
218  // Shutdown all running tools
219  if( m_toolManager )
221 
222  // Clean up the tool infrastructure
223  delete m_actions;
224  delete m_toolManager;
225  delete m_toolDispatcher;
226 
227  m_auimgr.UnInit();
228 }
229 
230 
232 {
233  // Create the manager
234  m_actions = new CVPCB_ACTIONS();
236  m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
238 
239  // Register tools
244 
246 
247  // Even though these menus will open with the right-click, we treat them as a normal
248  // menu instead of a context menu because we don't care about their position and want
249  // to be able to tell the difference between a menu click and a hotkey activation.
250 
251  // Create the context menu for the symbols list box
252  m_symbolsContextMenu = new ACTION_MENU( false, tool );
254  m_symbolsContextMenu->AppendSeparator();
258  m_symbolsContextMenu->AppendSeparator();
260 
261  // Create the context menu for the footprint list box
262  m_footprintContextMenu = new ACTION_MENU( false, tool );
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_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
320  [this]( wxMouseEvent& )
321  {
322  PopupMenu( m_symbolsContextMenu );
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
371  Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
372 }
373 
374 
375 bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
376 {
377  if( m_modified )
378  {
379  // Shutdown blocks must be determined and vetoed as early as possible
381  && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
382  {
383  return false;
384  }
385 
386  if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
387  "Save changes?" ),
388  [&]() -> bool
389  {
390  return SaveFootprintAssociation( false );
391  } ) )
392  {
393  return false;
394  }
395  }
396 
397  return true;
398 }
399 
400 
402 {
404  GetFootprintViewerFrame()->Close( true );
405 
406  m_modified = false;
407 
408  // clear highlight symbol in schematic:
409  SendMessageToEESCHEMA( true );
410 }
411 
412 
413 void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
414 {
415  // Called when changing the filter string in main toolbar.
416  // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
417  // of available footprints which match the filter
418 
419  wxListEvent l_event;
420  OnSelectComponent( l_event );
421 }
422 
423 
424 void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
425 {
427  return;
428 
429  wxString libraryName;
430  COMPONENT* symbol = GetSelectedComponent();
431  libraryName = m_librariesListBox->GetSelectedLibrary();
432 
433  m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
434  m_tcFilterString->GetValue(), m_filteringOptions );
435 
436  if( symbol && symbol->GetFPID().IsValid() )
438  else
440 
441  refreshAfterSymbolSearch( symbol );
442 }
443 
444 
446 {
448 
449  CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
450 
452 }
453 
454 
456 {
458 
459  CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
461 
462  cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
463  cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
464 }
465 
466 
468 {
469  if( m_undoList.size() == 0 )
470  return;
471 
472  CVPCB_UNDO_REDO_ENTRIES redoEntries;
473  CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
474  m_undoList.pop_back();
475 
476  // Iterate over the entries to undo
477  for( const auto& assoc : curEntry )
478  {
479  AssociateFootprint( assoc, true, false );
480  redoEntries.emplace_back( assoc.Reverse() );
481  }
482 
483  // Add the redo entries to the redo stack
484  m_redoList.emplace_back( redoEntries );
485 }
486 
487 
489 {
490  if( m_redoList.size() == 0 )
491  return;
492 
493  CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
494  m_redoList.pop_back();
495 
496  // Iterate over the entries to undo
497  bool firstAssoc = true;
498 
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* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
514 
515  if( symbol == nullptr )
516  return;
517 
518  LIB_ID fpid = aAssociation.GetNewFootprint();
519  LIB_ID oldFpid = symbol->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 = symbol->GetKIIDs().front();
531 
532  // Set new footprint to all instances of the selected symbol
533  for( unsigned int idx : GetComponentIndices() )
534  {
535  COMPONENT* candidate = m_netlist.GetComponent( idx );
536  const std::vector<KIID>& kiids = candidate->GetKIIDs();
537 
538  if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
539  {
540  // Set the new footprint
541  candidate->SetFPID( fpid );
542 
543  // create the new symbol description and set it
544  wxString description = wxString::Format( CMP_FORMAT,
545  idx + 1,
546  candidate->GetReference(),
547  candidate->GetValue(),
548  candidate->GetFPID().Format().wx_str() );
549  m_symbolsListBox->SetString( idx, description );
550  }
551  }
552 
553  // Mark the data as being modified
554  m_modified = true;
555 
556  // Update the statusbar and refresh the list
557  DisplayStatus();
558  m_symbolsListBox->Refresh();
559 
560  if( !aAddUndoItem )
561  return;
562 
563  // Update the undo list
564  if ( aNewEntry )
565  {
566  // Create a new entry for this association
567  CVPCB_UNDO_REDO_ENTRIES newEntry;
568  newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
569  aAssociation.GetNewFootprint() ) );
570  m_undoList.emplace_back( newEntry );
571 
572  // Clear the redo list
573  m_redoList.clear();
574  }
575  else
576  {
577  m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
578  oldFpid,
579  aAssociation.GetNewFootprint() ) );
580  }
581 
582 }
583 
584 
585 bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
586 {
587  return true;
588 }
589 
590 
592 {
593  // Tell AuiMgr that objects are changed !
594  if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
595  m_auimgr.Update(); // (could be not the case when starting CvPcb)
596 
597  if( aSymbol == nullptr )
598  {
599  DisplayStatus();
600  return;
601  }
602 
603  // Preview of the already assigned footprint.
604  // Find the footprint that was already chosen for this aSymbol and select it,
605  // but only if the selection is made from the aSymbol list or the library list.
606  // If the selection is made from the footprint list, do not change the current
607  // selected footprint.
608  if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
609  {
610  wxString footprintName = FROM_UTF8( aSymbol->GetFPID().Format().c_str() );
611 
613 
614  for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
615  {
616  wxString candidateName;
617  wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
618  msg.Trim( true );
619  msg.Trim( false );
620  candidateName = msg.AfterFirst( wxChar( ' ' ) );
621 
622  if( footprintName.Cmp( candidateName ) == 0 )
623  {
624  m_footprintListBox->SetSelection( ii, true );
625  break;
626  }
627  }
628 
631  }
632 
634  DisplayStatus();
635 }
636 
637 
640 {
641  int option = aFilter;
642 
643  // Apply the filter accordingly
644  switch( aAction )
645  {
646  case CVPCB_MAINFRAME::FILTER_DISABLE: m_filteringOptions &= ~option; break;
647  case CVPCB_MAINFRAME::FILTER_ENABLE: m_filteringOptions |= option; break;
648  case CVPCB_MAINFRAME::FILTER_TOGGLE: m_filteringOptions ^= option; break;
649  }
650 
651  wxListEvent l_event;
652  OnSelectComponent( l_event );
653 }
654 
655 
657 {
658  if( !m_initialized )
659  return;
660 
661  wxString filters, msg;
662  COMPONENT* symbol = GetSelectedComponent();
663 
665  {
666  msg.Empty();
667 
668  if( symbol )
669  {
670  for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
671  {
672  if( msg.IsEmpty() )
673  msg += symbol->GetFootprintFilters()[ii];
674  else
675  msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
676  }
677  }
678 
679  filters += _( "Keywords" );
680 
681  if( !msg.IsEmpty() )
682  filters += wxString::Format( wxT( " (%s)" ), msg );
683  }
684 
686  {
687  msg.Empty();
688 
689  if( symbol )
690  msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
691 
692  if( !filters.IsEmpty() )
693  filters += wxT( ", " );
694 
695  filters += _( "Pin Count" );
696 
697  if( !msg.IsEmpty() )
698  filters += wxString::Format( wxT( " (%s)" ), msg );
699  }
700 
702  {
704 
705  if( !filters.IsEmpty() )
706  filters += wxT( ", " );
707 
708  filters += _( "Library" );
709 
710  if( !msg.IsEmpty() )
711  filters += wxString::Format( wxT( " (%s)" ), msg );
712  }
713 
714  wxString textFilter = m_tcFilterString->GetValue();
715 
716  if( !textFilter.IsEmpty() )
717  {
718  if( !filters.IsEmpty() )
719  filters += wxT( ", " );
720 
721  filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
722  }
723 
724  if( filters.IsEmpty() )
725  msg = _( "No Filtering" );
726  else
727  msg.Printf( _( "Filtered by %s" ), filters );
728 
729  msg << wxT( ": " ) << m_footprintListBox->GetCount();
730 
731  SetStatusText( msg );
732 
733 
734  msg.Empty();
735  wxString footprintName = GetSelectedFootprint();
736 
737  FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
738 
739  if( fp ) // can be NULL if no netlist loaded
740  {
741  msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
742  fp->GetDescription(),
743  fp->GetKeywords() );
744  }
745 
746  SetStatusText( msg, 1 );
747 
748  msg.Empty();
749  wxString lib;
750 
751  // Choose the footprint to get the information on
752  if( fp )
753  {
754  // Use the footprint in the footprint viewer
755  lib = fp->GetLibNickname();
756  }
758  {
759  // Use the footprint of the selected symbol
760  if( symbol )
761  lib = symbol->GetFPID().GetLibNickname();
762  }
764  {
765  // Use the library that is selected
767  }
768 
769  // Extract the library information
770  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
771 
772  if( fptbl->HasLibrary( lib ) )
773  msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
774  else
775  msg = wxString::Format( _( "Library location: unknown" ) );
776 
777  SetStatusText( msg, 2 );
778 }
779 
780 
782 {
783  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
784 
785  // Check if there are footprint libraries in the footprint library table.
786  if( !fptbl || !fptbl->GetLogicalLibs().size() )
787  {
788  wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
789  "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
790  return false;
791  }
792 
793  WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
794 
795  m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
796 
798  {
800  }
801 
802  return true;
803 }
804 
805 
806 void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
807 {
808  if( m_netlist.IsEmpty() )
809  return;
810 
811  // clear highlight of previously selected symbols (if any):
812  // Selecting a non existing symbol clears any previously highlighted symbols
813  std::string packet = "$CLEAR: \"HIGHLIGHTED\"";
814 
815  if( Kiface().IsSingle() )
816  SendCommand( MSG_TO_SCH, packet );
817  else
818  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
819 
820  if( aClearHighligntOnly )
821  return;
822 
823  int selection = m_symbolsListBox->GetSelection();
824 
825  if ( selection < 0 ) // Nothing selected
826  return;
827 
828  if( m_netlist.GetComponent( selection ) == nullptr )
829  return;
830 
831  // Now highlight the selected symbol:
832  COMPONENT* symbol = m_netlist.GetComponent( selection );
833 
834  packet = std::string( "$PART: \"" ) + TO_UTF8( symbol->GetReference() ) + "\"";
835 
836  if( Kiface().IsSingle() )
837  SendCommand( MSG_TO_SCH, packet );
838  else
839  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
840 }
841 
842 
843 int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
844 {
845  STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
846  KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
847 
848  m_netlist.Clear();
849 
850  try
851  {
852  netrdr.LoadNetlist();
853  }
854  catch( const IO_ERROR& ioe )
855  {
856  wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
857  ioe.What().GetData() );
858  wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
859  return 1;
860  }
861 
862  // We also remove footprint name if it is "$noname" because this is a dummy name,
863  // not the actual name of the footprint.
864  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
865  {
866  if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
867  m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
868  }
869 
870  // Sort symbols by reference:
872 
873  return 0;
874 }
875 
876 
878 {
879  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
880 
881  if( m_footprintListBox == nullptr )
882  {
885  }
886 
887  m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
889  DisplayStatus();
890 }
891 
892 
894 {
895  wxString msg;
896  COMPONENT* symbol;
897  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
898 
899  if( m_symbolsListBox == nullptr )
900  {
903  }
904 
906 
907  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
908  {
909  symbol = m_netlist.GetComponent( i );
910 
911  msg.Printf( CMP_FORMAT,
912  m_symbolsListBox->GetCount() + 1,
913  symbol->GetReference(),
914  symbol->GetValue(),
915  symbol->GetFPID().Format().wx_str() );
916  m_symbolsListBox->m_ComponentList.Add( msg );
917  }
918 
919  if( m_symbolsListBox->m_ComponentList.Count() )
920  {
921  m_symbolsListBox->SetItemCount( m_symbolsListBox->m_ComponentList.Count() );
922  m_symbolsListBox->SetSelection( 0, true );
923  m_symbolsListBox->RefreshItems( 0L, m_symbolsListBox->m_ComponentList.Count() - 1 );
925  }
926 }
927 
928 
930 {
931  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
932 
933  if( m_librariesListBox == nullptr )
934  {
937  }
938 
939  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
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_librariesListBox->SetLibraryList( libNames );
951  }
952 }
953 
954 
956 {
957  int selection = m_symbolsListBox->GetSelection();
958 
959  if( selection >= 0 && selection < (int) m_netlist.GetCount() )
960  return m_netlist.GetComponent( selection );
961 
962  return nullptr;
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_symbolsListBox->GetCount() )
975  {
977  m_symbolsListBox->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  int lastIdx;
990 
991  // Make sure a netlist has been loaded and the box has contents
992  if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
993  return idx;
994 
995  switch( aCriteria )
996  {
998  idx.resize( m_netlist.GetCount() );
999  std::iota( idx.begin(), idx.end(), 0 );
1000  break;
1001 
1003  // Check to see if anything is selected
1004  if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1005  break;
1006 
1007  // Get the symbols
1008  lastIdx = m_symbolsListBox->GetFirstSelected();
1009  idx.emplace_back( lastIdx );
1010 
1011  lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1012  while( lastIdx > 0 )
1013  {
1014  idx.emplace_back( lastIdx );
1015  lastIdx = m_symbolsListBox->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 symbol selection criteria" );
1037  }
1038 
1039  return idx;
1040 }
1041 
1042 
1044 {
1045  // returns the Footprint Viewer frame, if exists, or NULL
1046  wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1047  return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1048 }
1049 
1050 
1052 {
1053  return GetFootprintViewerFrame();
1054 }
1055 
1056 
1058 {
1059  if( m_librariesListBox->HasFocus() )
1061  else if( m_symbolsListBox->HasFocus() )
1063  else if( m_footprintListBox->HasFocus() )
1065 
1067 }
1068 
1069 
1071 {
1072  if( m_librariesListBox->HasFocus() )
1073  return m_librariesListBox;
1074  else if( m_symbolsListBox->HasFocus() )
1075  return m_symbolsListBox;
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_librariesListBox->SetFocus(); break;
1088  case CVPCB_MAINFRAME::CONTROL_COMPONENT: m_symbolsListBox->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:49
void SetLibraryList(const wxArrayString &aList)
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:207
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
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:104
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:66
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
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
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:265
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
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.
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:132
void SetSelectedFootprint(const LIB_ID &aFPID)
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
This file is part of the common library.
wxString GetLibNickname() const override
void SendMessageToEESCHEMA(bool aClearHighligntOnly=false)
Send a remote command to Eeschema via a socket,.
#define CVPCB_MAINFRAME_NAME
void UndoAssociation()
Undo the most recent associations that were performed.
void DeselectAll()
Remove all selection in lists which can have more than one item selected.
#define MSG_TO_SCH
Definition: eda_dde.h:50
wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:81
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)
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
bool SendCommand(int aService, const std::string &aMessage)
Used by a client to sent (by a socket connection) a data to a server.
Definition: eda_dde.cpp:304
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
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)
Read the netlist (.net) file built on the fly by Eeschema.
unsigned GetCount() const
Definition: pcb_netlist.h:228
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:476
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.
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
COMPONENTS_LISTBOX * m_symbolsListBox
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:159
bool LoadFootprintFiles()
Read the list of footprint (*.mod files) and generate the list of footprints.
Class that groups generic conditions for editor states.
bool empty() const
Definition: lib_id.h:180
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.
const char * c_str() const
Definition: utf8.h:102
void SortByReference()
ACTION_MENU * m_symbolsContextMenu
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:133
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:68
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
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:54
void ShowChangedLanguage() override
Definition: kiid.h:44
static TOOL_ACTION copy
Definition: actions.h:67
void refreshAfterSymbolSearch(COMPONENT *aSymbol)
wxTextCtrl * m_tcFilterString
void OnSelectComponent(wxListEvent &event)
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
Load the contents of the netlist file into aNetlist.
FP_FILTER_T
Filter setting constants.
Definition: listboxes.h:91
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const
Find out which control currently has focus.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
bool IsSingle() const
Is this KIFACE_I running under single_top?
Definition: kiface_i.h:104
void UpdateWidth(int aLine=-1)
Update the width of the column based on its contents.
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:30
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:123
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
wxString GetSelectedLibrary()
ACTIONS * m_actions
Definition: tools_holder.h:159
static TOOL_ACTION cut
Definition: actions.h:66
No controls have focus.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
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
#define _(s)
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
CRITERIA
Criteria to use to identify sets of components.
static TOOL_ACTION deleteAssoc
Definition: cvpcb_actions.h:63
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:72
#define KICAD_DEFAULT_DRAWFRAME_STYLE
void ReCreateMenuBar() override
Recreates the menu bar.
CVPCB_UNDO_REDO_LIST m_undoList
Gather all the actions that are shared by tools.
Definition: cvpcb_actions.h:37
wxString OnGetItemText(long item, long column) const override
This overloaded function MUST be provided for the wxLC_VIRTUAL mode because real data is not handled ...
wxControl * GetFocusedControlObject() const
Get a pointer to the currently focused control.
static TOOL_ACTION saveAssociations
Management actions.
Definition: cvpcb_actions.h:56
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
Handle actions that are shared between different applications.
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
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...
UTF8 Format() const
Definition: lib_id.cpp:116
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:84
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.
Definition: project.cpp:283
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)
Return the COMPONENT at aIndex.
Definition: pcb_netlist.h:236
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
wxArrayString m_ComponentList
Definition: listboxes.h:225
wxString GetSelectedFootprint()
static TOOL_ACTION redo
Definition: actions.h:65
void Clear()
Remove all components from the netlist.
Definition: pcb_netlist.h:223
void doCloseWindow() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
wxFont GetInfoFont()
Definition: ui_common.cpp:97
bool ReadNetListAndFpFiles(const std::string &aNetlist)
Load the netlist file built on the fly by Eeschema and loads footprint libraries from fp lib tables.
#define ENABLE(x)
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).
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:71
CVPCB_MAINFRAME(KIWAY *aKiway, wxWindow *aParent)
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:67
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:46
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
FOOTPRINTS_LISTBOX * m_footprintListBox
unsigned GetErrorCount() const
int GetPinCount() const
Definition: pcb_netlist.h:146
A class to define a footprint association to be made in cvpcb.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:199
wxString GetKeywords()
bool IsEmpty() const
Definition: pcb_netlist.h:218
void SetFootprints(FOOTPRINT_LIST &aList, const wxString &aLibName, COMPONENT *aComponent, const wxString &aFootPrintFilterPattern, int aFilterType)
Populate the wxListCtrl with the footprints from aList that meet the filter criteria defined by aFilt...
const wxString & GetValue() const
Definition: pcb_netlist.h:124
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:143
wxWindow * GetToolCanvas() const override
Canvas access.
void SetFootprintFilter(FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter, CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction)
Set a filter criteria to either on/off or toggle the criteria.
static TOOL_ACTION undo
Definition: actions.h:64
#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:54
void OnEnterFilteringText(wxCommandEvent &event)
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
LIBRARY_LISTBOX * m_librariesListBox
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:240
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame() const
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
void DisplayStatus()
Update the information displayed on the status bar at bottom of the main frame.
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:68
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)
Save the edits that the user has done by sending them back to Eeschema via the kiway.
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:140