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 <[email protected]>
6 * Copyright (C) 1992-2022 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 <pgm_base.h>
27#include <bitmaps.h>
28#include <confirm.h>
29#include <eda_dde.h>
30#include <fp_lib_table.h>
31#include <kiface_base.h>
32#include <kiplatform/app.h>
33#include <kiway_express.h>
34#include <string_utils.h>
36#include <macros.h>
39#include <numeric>
40#include <tool/action_manager.h>
41#include <tool/action_toolbar.h>
42#include <tool/common_control.h>
45#include <tool/tool_manager.h>
47#include <wx/statline.h>
48#include <wx/stattext.h>
49
50#include <cvpcb_association.h>
51#include <cvpcb_id.h>
52#include <cvpcb_mainframe.h>
55#include <kiplatform/ui.h>
56#include <listboxes.h>
57#include <tools/cvpcb_actions.h>
59#include <tools/cvpcb_control.h>
60#include <wx/button.h>
61#include <wx/settings.h>
62
63
64#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
65
66CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
67 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
69 unityScale ),
70 m_viewerPendingUpdate( false )
71{
72 m_symbolsListBox = nullptr;
73 m_footprintListBox = nullptr;
74 m_librariesListBox = nullptr;
75 m_mainToolBar = nullptr;
76 m_modified = false;
77 m_cannotClose = false;
80 m_tcFilterString = nullptr;
82 m_initialized = false;
83 m_aboutTitle = "CvPcb";
84
85 // Give an icon
86 wxIcon icon;
87 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
88 SetIcon( icon );
89
90 SetAutoLayout( true );
91
93
94 setupTools();
98
99 // Create list of available footprints and symbols of the schematic
102
105
106 m_auimgr.SetManagedWindow( this );
107
108 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
109
110 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
111 .Caption( _( "Footprint Libraries" ) )
112 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
113
114 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
115 .Caption( _( "Symbol : Footprint Assignments" ) ) );
116
117 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
118 .Caption( _( "Filtered Footprints" ) )
119 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
120
121 // Build the bottom panel, to display 2 status texts and the buttons:
122 auto bottomPanel = new wxPanel( this );
123 auto panelSizer = new wxBoxSizer( wxVERTICAL );
124
125 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
126 fgSizerStatus->SetFlexibleDirection( wxBOTH );
127 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
128
129 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
130 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
131
132 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
133 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
134
135 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
136 fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
137
138 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
139
140 wxStaticLine* staticline1 = new wxStaticLine( bottomPanel );
141 panelSizer->Add( staticline1, 0, wxEXPAND, 5 );
142
143 m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
144 m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
145 m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
146
147 // Add buttons:
148 auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
149 auto sdbSizer = new wxStdDialogButtonSizer();
150
151 m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY,
152 _( "Apply, Save Schematic && Continue" ) );
153 buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
154
155 auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
156 sdbSizer->AddButton( sdbSizerOK );
157 auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
158 sdbSizer->AddButton( sdbSizerCancel );
159 sdbSizer->Realize();
160
161 buttonsSizer->Add( sdbSizer, 0, 0, 5 );
162 panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
163
164 bottomPanel->SetSizer( panelSizer );
165 bottomPanel->Fit();
166
167 sdbSizerOK->SetDefault();
169
170 m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
171
172 m_auimgr.Update();
173 m_initialized = true;
174
175 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
176 {
177 m_tcFilterString->ChangeValue( cfg->m_FilterString );
178
179 if( cfg->m_LibrariesWidth > 0 )
180 {
181 wxAuiPaneInfo& librariesPane = m_auimgr.GetPane( "Libraries" );
182
183 // wxAUI hack: force width by setting MinSize() and then Fixed()
184 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
185 librariesPane.MinSize( cfg->m_LibrariesWidth, -1 );
186 librariesPane.BestSize( cfg->m_LibrariesWidth, -1 );
187 librariesPane.MaxSize( cfg->m_LibrariesWidth, -1 );
188 librariesPane.Fixed();
189 m_auimgr.Update();
190
191 // now make it resizable again
192 librariesPane.MinSize( 20, -1 );
193 librariesPane.Resizable();
194 m_auimgr.Update();
195 }
196
197 if( cfg->m_FootprintsWidth > 0 )
198 {
199 wxAuiPaneInfo& footprintsPane = m_auimgr.GetPane( "Footprints" );
200
201 // wxAUI hack: force width by setting MinSize() and then Fixed()
202 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
203 footprintsPane.MinSize( cfg->m_FootprintsWidth, -1 );
204 footprintsPane.BestSize( cfg->m_FootprintsWidth, -1 );
205 footprintsPane.MaxSize( cfg->m_FootprintsWidth, -1 );
206 footprintsPane.Fixed();
207 m_auimgr.Update();
208
209 // now make it resizable again
210 footprintsPane.MinSize( 20, -1 );
211 footprintsPane.Resizable();
212 m_auimgr.Update();
213 }
214 }
215
216 // Connect Events
218
219 // Start the main processing loop
220 m_toolManager->InvokeTool( "cvpcb.Control" );
221
222 m_filterTimer->StartOnce( 100 );
223
224 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
225}
226
227
229{
230 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
231 m_filterTimer->Stop();
232
233 // Shutdown all running tools
234 if( m_toolManager )
236
237 // Clean up the tool infrastructure
238 delete m_actions;
239 delete m_toolManager;
240 delete m_toolDispatcher;
241
242 m_auimgr.UnInit();
243}
244
245
247{
248 // Create the manager
249 m_actions = new CVPCB_ACTIONS();
251 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
253
254 // Register tools
259
261
262 // Even though these menus will open with the right-click, we treat them as a normal
263 // menu instead of a context menu because we don't care about their position and want
264 // to be able to tell the difference between a menu click and a hotkey activation.
265
266 // Create the context menu for the symbols list box
267 m_symbolsContextMenu = new ACTION_MENU( false, tool );
269 m_symbolsContextMenu->AppendSeparator();
273 m_symbolsContextMenu->AppendSeparator();
275
276 // Create the context menu for the footprint list box
277 m_footprintContextMenu = new ACTION_MENU( false, tool );
279}
280
281
283{
285
287 EDITOR_CONDITIONS cond( this );
288
289 wxASSERT( mgr );
290
291#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
292#define CHECK( x ) ACTION_CONDITIONS().Check( x )
293
298
299 auto compFilter =
300 [this] ( const SELECTION& )
301 {
303 };
304
305 auto libFilter =
306 [this] ( const SELECTION& )
307 {
309 };
310
311 auto pinFilter =
312 [this] ( const SELECTION& )
313 {
315 };
316
320
321#undef CHECK
322#undef ENABLE
323}
324
325
327{
328 // Connect the handlers to launch the context menus in the listboxes
329 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
330 [this]( wxMouseEvent& )
331 {
332 PopupMenu( m_footprintContextMenu );
333 } );
334
335 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
336 [this]( wxMouseEvent& )
337 {
338 PopupMenu( m_symbolsContextMenu );
339 } );
340
341 // Connect the handler for the save button
342 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
343 [this]( wxCommandEvent& )
344 {
345 // saveAssociations must be run immediately
347 } );
348
349 // Connect the handlers for the ok/cancel buttons
350 Bind( wxEVT_BUTTON,
351 [this]( wxCommandEvent& )
352 {
353 // saveAssociations must be run immediately, before running Close( true )
355 Close( true );
356 }, wxID_OK );
357 Bind( wxEVT_BUTTON,
358 [this]( wxCommandEvent& )
359 {
360 Close( false );
361 }, wxID_CANCEL );
362
363 // Connect the handlers for the close events
364 Bind( wxEVT_MENU,
365 [this]( wxCommandEvent& )
366 {
367 Close( false );
368 }, wxID_CLOSE );
369 Bind( wxEVT_MENU,
370 [this]( wxCommandEvent& )
371 {
372 Close( false );
373 }, wxID_EXIT );
374
375 // Toolbar events
376 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
377
378 // Just skip the resize events
379 Bind( wxEVT_SIZE,
380 []( wxSizeEvent& aEvent )
381 {
382 aEvent.Skip();
383 } );
384
385 // Attach the events to the tool dispatcher
387 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
388
389 m_filterTimer = new wxTimer( this );
390 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
391}
392
393
394bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
395{
396 if( m_modified )
397 {
398 // Shutdown blocks must be determined and vetoed as early as possible
400 && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
401 {
402 return false;
403 }
404
405 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
406 "Save changes?" ),
407 [&]() -> bool
408 {
409 return SaveFootprintAssociation( false );
410 } ) )
411 {
412 return false;
413 }
414 }
415
416 if( m_cannotClose )
417 return false;
418
419 return true;
420}
421
422
424{
426 GetFootprintViewerFrame()->Close( true );
427
428 m_modified = false;
429
430 // clear symbol selection in schematic:
432}
433
434
435void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
436{
437 // Called when changing the filter string in main toolbar.
438 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
439 // of available footprints which match the filter
440
441 m_filterTimer->StartOnce( 200 );
442}
443
444
446{
447 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
448 // insertion point here and then restore them at the end.
449 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
450 long pos = m_tcFilterString->GetInsertionPoint();
451
453 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
454
455 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
457
458 if( symbol && symbol->GetFPID().IsValid() )
460 else if( m_footprintListBox->GetSelection() >= 0 )
462
464
466
467 if( searchCtrlHasFocus )
468 {
469 m_tcFilterString->SetFocus();
470 m_tcFilterString->SetInsertionPoint( pos );
471 }
472}
473
474
475void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
476{
478 return;
479
481 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
482
483 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
485
486 if( symbol && symbol->GetFPID().IsValid() )
488 else if( m_footprintListBox->GetSelection() >= 0 )
490
492
493 refreshAfterSymbolSearch( symbol );
494}
495
496
498{
500 {
501 Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
503 }
504}
505
506
508{
509 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
510 m_viewerPendingUpdate = false;
511
512 // On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
513 // are opened and refreshed when a new footprint is selected.
514 // If the listbox has the focus before selecting a new footprint, it will be forced
515 // after selection.
516 bool footprintListHasFocus = m_footprintListBox->HasFocus();
517 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
518
519 // If the footprint view window is displayed, update the footprint.
522
524
525 if( footprintListHasFocus )
526 m_footprintListBox->SetFocus();
527 else if( symbolListHasFocus )
528 m_symbolsListBox->SetFocus();
529}
530
531
533{
535
536 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
537
539}
540
541
543{
545
546 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
548 cfg->m_FilterString = m_tcFilterString->GetValue();
549
550 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
551 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
552}
553
554
556{
557 if( m_undoList.size() == 0 )
558 return;
559
560 CVPCB_UNDO_REDO_ENTRIES redoEntries;
561 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
562 m_undoList.pop_back();
563
564 // Iterate over the entries to undo
565 for( const auto& assoc : curEntry )
566 {
567 AssociateFootprint( assoc, true, false );
568 redoEntries.emplace_back( assoc.Reverse() );
569 }
570
571 // Add the redo entries to the redo stack
572 m_redoList.emplace_back( redoEntries );
573}
574
575
577{
578 if( m_redoList.size() == 0 )
579 return;
580
581 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
582 m_redoList.pop_back();
583
584 // Iterate over the entries to undo
585 bool firstAssoc = true;
586
587 for( const auto& assoc : curEntry )
588 {
589 AssociateFootprint( assoc, firstAssoc );
590 firstAssoc = false;
591 }
592}
593
594
595wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
596 const wxString& aValue, const wxString& aFootprint )
597{
598 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
599 // reason).
600 wxString desc = wxString::Format( wxT( "%3d " ), idx );
601
602 for( int ii = aReference.Length(); ii < 8; ++ii )
603 desc += wxS( " " );
604
605 desc += aReference + wxT( " - " );
606
607 for( int ii = aValue.Length(); ii < 16; ++ii )
608 desc += wxS( " " );
609
610 desc += aValue + wxT( " : " ) + aFootprint;
611
612 return desc;
613}
614
615
617 bool aNewEntry, bool aAddUndoItem )
618{
619 if( m_netlist.IsEmpty() )
620 return;
621
622 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
623
624 if( symbol == nullptr )
625 return;
626
627 LIB_ID fpid = aAssociation.GetNewFootprint();
628 LIB_ID oldFpid = symbol->GetFPID();
629
630 // Test for validity of the requested footprint
631 if( !fpid.empty() && !fpid.IsValid() )
632 {
633 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
634 fpid.Format().wx_str() );
635 DisplayErrorMessage( this, msg );
636 return;
637 }
638
639 const KIID& id = symbol->GetKIIDs().front();
640
641 // Set new footprint to all instances of the selected symbol
642 for( unsigned int idx : GetComponentIndices() )
643 {
644 COMPONENT* candidate = m_netlist.GetComponent( idx );
645 const std::vector<KIID>& kiids = candidate->GetKIIDs();
646
647 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
648 {
649 // Set the new footprint
650 candidate->SetFPID( fpid );
651
652 // create the new symbol description and set it
653 wxString description = formatSymbolDesc( idx + 1,
654 candidate->GetReference(),
655 candidate->GetValue(),
656 candidate->GetFPID().Format().wx_str() );
657 m_symbolsListBox->SetString( idx, description );
658
659 FOOTPRINT_INFO* fp =
661
662 if( !fp )
663 {
665 }
666 else
667 {
669 }
670 }
671 }
672
673 // Mark the data as being modified
674 m_modified = true;
675
676 // Update the statusbar and refresh the list
678 m_symbolsListBox->Refresh();
679
680 if( !aAddUndoItem )
681 return;
682
683 // Update the undo list
684 if ( aNewEntry )
685 {
686 // Create a new entry for this association
688 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
689 aAssociation.GetNewFootprint() ) );
690 m_undoList.emplace_back( newEntry );
691
692 // Clear the redo list
693 m_redoList.clear();
694 }
695 else
696 {
697 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
698 oldFpid,
699 aAssociation.GetNewFootprint() ) );
700 }
701
702}
703
704
705bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
706{
707 return true;
708}
709
710
712{
713 // Tell AuiMgr that objects are changed !
714 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
715 m_auimgr.Update(); // (could be not the case when starting CvPcb)
716
717 if( aSymbol == nullptr )
718 {
720 return;
721 }
722
723 // Preview of the already assigned footprint.
724 // Find the footprint that was already chosen for this aSymbol and select it,
725 // but only if the selection is made from the aSymbol list or the library list.
726 // If the selection is made from the footprint list, do not change the current
727 // selected footprint.
728 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
729 {
730 wxString footprintName = FROM_UTF8( aSymbol->GetFPID().Format().c_str() );
731
733
734 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
735 {
736 wxString candidateName;
737 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
738 msg.Trim( true );
739 msg.Trim( false );
740 candidateName = msg.AfterFirst( wxChar( ' ' ) );
741
742 if( footprintName.Cmp( candidateName ) == 0 )
743 {
744 m_footprintListBox->SetSelection( ii, true );
745 break;
746 }
747 }
748 }
749
752}
753
754
757{
758 int option = aFilter;
759
760 // Apply the filter accordingly
761 switch( aAction )
762 {
766 }
767
768 wxListEvent l_event;
769 OnSelectComponent( l_event );
770}
771
772
774{
775 if( !m_initialized )
776 return;
777
778 wxString filters, msg;
780
782 {
783 msg.Empty();
784
785 if( symbol )
786 {
787 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
788 {
789 if( msg.IsEmpty() )
790 msg += symbol->GetFootprintFilters()[ii];
791 else
792 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
793 }
794 }
795
796 filters += _( "Keywords" );
797
798 if( !msg.IsEmpty() )
799 filters += wxString::Format( wxT( " (%s)" ), msg );
800 }
801
803 {
804 msg.Empty();
805
806 if( symbol )
807 msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
808
809 if( !filters.IsEmpty() )
810 filters += wxT( ", " );
811
812 filters += _( "Pin Count" );
813
814 if( !msg.IsEmpty() )
815 filters += wxString::Format( wxT( " (%s)" ), msg );
816 }
817
819 {
821
822 if( !filters.IsEmpty() )
823 filters += wxT( ", " );
824
825 filters += _( "Library" );
826
827 if( !msg.IsEmpty() )
828 filters += wxString::Format( wxT( " (%s)" ), msg );
829 }
830
831 wxString textFilter = m_tcFilterString->GetValue();
832
833 if( !textFilter.IsEmpty() )
834 {
835 if( !filters.IsEmpty() )
836 filters += wxT( ", " );
837
838 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
839 }
840
841 if( filters.IsEmpty() )
842 msg = _( "No Filtering" );
843 else
844 msg.Printf( _( "Filtered by %s" ), filters );
845
846 msg << wxT( ": " ) << m_footprintListBox->GetCount();
847
848 SetStatusText( msg );
849
850
851 msg.Empty();
852 wxString footprintName = GetSelectedFootprint();
853
854 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
855
856 if( fp ) // can be NULL if no netlist loaded
857 {
858 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
859 fp->GetDescription(),
860 fp->GetKeywords() );
861 }
862
863 SetStatusText( msg, 1 );
864
865 msg.Empty();
866 wxString lib;
867
868 // Choose the footprint to get the information on
869 if( fp )
870 {
871 // Use the footprint in the footprint viewer
872 lib = fp->GetLibNickname();
873 }
875 {
876 // Use the footprint of the selected symbol
877 if( symbol )
878 lib = symbol->GetFPID().GetLibNickname();
879 }
881 {
882 // Use the library that is selected
884 }
885
886 // Extract the library information
887 FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
888
889 if( fptbl->HasLibrary( lib ) )
890 msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
891 else
892 msg = wxString::Format( _( "Library location: unknown" ) );
893
894 SetStatusText( msg, 2 );
895}
896
897
899{
900 FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
901
902 // Check if there are footprint libraries in the footprint library table.
903 if( !fptbl || !fptbl->GetLogicalLibs().size() )
904 {
905 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
906 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
907 return false;
908 }
909
910 WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
911
912 m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
913
915 {
917 }
918
919 return true;
920}
921
922
923void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
924{
925 if( m_netlist.IsEmpty() )
926 return;
927
928 std::string command = "$SELECT: ";
929
930 if( aClearSelectionOnly )
931 {
932 // Sending an empty list means clearing the selection.
933 if( Kiface().IsSingle() )
934 SendCommand( MSG_TO_SCH, command );
935 else
936 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
937
938 return;
939 }
940
941 int selection = m_symbolsListBox->GetSelection();
942
943 if( selection < 0 ) // Nothing selected
944 return;
945
946 if( m_netlist.GetComponent( selection ) == nullptr )
947 return;
948
949 // Now select the corresponding symbol on the schematic:
950 wxString ref = m_netlist.GetComponent( selection )->GetReference();
951
952 // The prefix 0,F before the reference is for selecting the symbol
953 // (one can select a pin with a different prefix)
954 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
955
956 if( Kiface().IsSingle() )
957 SendCommand( MSG_TO_SCH, command );
958 else
959 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
960}
961
962
963int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
964{
965 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
966 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
967
969
970 try
971 {
972 netlistReader.LoadNetlist();
973 }
974 catch( const IO_ERROR& ioe )
975 {
976 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
977 ioe.What().GetData() );
978 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
979 return 1;
980 }
981
982 // We also remove footprint name if it is "$noname" because this is a dummy name,
983 // not the actual name of the footprint.
984 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
985 {
986 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
988 }
989
990 // Sort symbols by reference:
992
993 return 0;
994}
995
996
998{
999 wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
1000
1001 if( m_footprintListBox == nullptr )
1002 {
1005 }
1006
1007 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
1009 DisplayStatus();
1010}
1011
1012
1014{
1015 wxString msg;
1016 COMPONENT* symbol;
1017 wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
1018
1019 if( m_symbolsListBox == nullptr )
1020 {
1023 }
1024
1026
1027 for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
1028 {
1029 symbol = m_netlist.GetComponent( i );
1030
1032 symbol->GetReference(),
1033 symbol->GetValue(),
1034 symbol->GetFPID().Format().wx_str() );
1035 m_symbolsListBox->m_SymbolList.Add( msg );
1036
1037 FOOTPRINT_INFO* fp =
1039
1040 if( !fp )
1041 {
1043 }
1044 }
1045
1046 if( m_symbolsListBox->m_SymbolList.Count() )
1047 {
1048 m_symbolsListBox->SetItemCount( m_symbolsListBox->m_SymbolList.Count() );
1049 m_symbolsListBox->SetSelection( 0, true );
1050 m_symbolsListBox->RefreshItems( 0L, m_symbolsListBox->m_SymbolList.Count() - 1 );
1052 }
1053}
1054
1055
1057{
1058 COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
1061 std::set<wxString> pinnedMatches;
1062 std::set<wxString> otherMatches;
1064
1065 auto process =
1066 [&]( const wxString& aNickname )
1067 {
1068 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1069 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1070 {
1071 pinnedMatches.insert( aNickname );
1072 }
1073 else
1074 {
1075 otherMatches.insert( aNickname );
1076 }
1077 };
1078
1079
1080 if( tbl )
1081 {
1082 wxArrayString libNames;
1083
1084 std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
1085
1086 for( const wxString& libNickName : libNickNames )
1087 process( libNickName );
1088 }
1089
1090 for( const wxString& nickname : pinnedMatches )
1092
1093 for( const wxString& nickname : otherMatches )
1094 m_librariesListBox->AppendLine( nickname );
1095
1097}
1098
1099
1101{
1102 int selection = m_symbolsListBox->GetSelection();
1103
1104 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1105 return m_netlist.GetComponent( selection );
1106
1107 return nullptr;
1108}
1109
1110
1111void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1112{
1113 m_skipComponentSelect = aSkipUpdate;
1114
1115 if( aIndex < 0 )
1116 {
1118 }
1119 else if( aIndex < m_symbolsListBox->GetCount() )
1120 {
1122 m_symbolsListBox->SetSelection( aIndex );
1124 }
1125
1126 m_skipComponentSelect = false;
1127}
1128
1129
1131 CVPCB_MAINFRAME::CRITERIA aCriteria )
1132{
1133 std::vector<unsigned int> idx;
1134 int lastIdx;
1135
1136 // Make sure a netlist has been loaded and the box has contents
1137 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1138 return idx;
1139
1140 switch( aCriteria )
1141 {
1143 idx.resize( m_netlist.GetCount() );
1144 std::iota( idx.begin(), idx.end(), 0 );
1145 break;
1146
1148 // Check to see if anything is selected
1149 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1150 break;
1151
1152 // Get the symbols
1153 lastIdx = m_symbolsListBox->GetFirstSelected();
1154 idx.emplace_back( lastIdx );
1155
1156 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1157 while( lastIdx > 0 )
1158 {
1159 idx.emplace_back( lastIdx );
1160 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1161 }
1162 break;
1163
1165 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1166 {
1167 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1168 idx.emplace_back( i );
1169 }
1170 break;
1171
1173 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1174 {
1175 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1176 idx.emplace_back( i );
1177 }
1178 break;
1179
1180 default:
1181 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1182 }
1183
1184 return idx;
1185}
1186
1187
1189{
1190 // returns the Footprint Viewer frame, if exists, or NULL
1191 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1192 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1193}
1194
1195
1197{
1198 return GetFootprintViewerFrame();
1199}
1200
1201
1203{
1204 if( m_librariesListBox->HasFocus() )
1206 else if( m_symbolsListBox->HasFocus() )
1208 else if( m_footprintListBox->HasFocus() )
1210
1212}
1213
1214
1216{
1217 switch( aLB )
1218 {
1222 default: break;
1223 }
1224}
1225
1226
1228{
1229 // returns the LIB_ID of the selected footprint in footprint listview
1230 // or a empty string
1232}
1233
1234
1235void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1236{
1237 switch( aNumber )
1238 {
1239 case 0: m_statusLine1->SetLabel( aText ); break;
1240 case 1: m_statusLine2->SetLabel( aText ); break;
1241 case 2: m_statusLine3->SetLabel( aText ); break;
1242 default: wxFAIL_MSG( "Invalid status row number" ); break;
1243 }
1244}
1245
1246
1248{
1251 DisplayStatus();
1252}
1253
1254
1256{
1257 const std::string& payload = mail.GetPayload();
1258
1259 switch( mail.Command() )
1260 {
1262 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1263 // widgets:
1264 m_cannotClose = true;
1265 readNetListAndFpFiles( payload );
1266 m_cannotClose = false;
1267 /* @todo
1268 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1269 */
1270 break;
1271 case MAIL_RELOAD_LIB:
1272 m_cannotClose = true;
1276 m_cannotClose = false;
1277 break;
1278 default:
1279 ; // ignore most
1280 }
1281}
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
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
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION cut
Definition: actions.h:67
Manage TOOL_ACTION objects.
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...
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:101
Handle actions that are shared between different applications.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
const wxString & GetReference() const
Definition: pcb_netlist.h:126
const wxString & GetValue() const
Definition: pcb_netlist.h:129
int GetPinCount() const
Definition: pcb_netlist.h:151
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:137
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:148
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:145
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:138
Gather all the actions that are shared by tools.
Definition: cvpcb_actions.h:38
static TOOL_ACTION saveAssociationsToFile
Definition: cvpcb_actions.h:57
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:69
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:68
static TOOL_ACTION deleteAssoc
Definition: cvpcb_actions.h:64
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:67
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
Definition: cvpcb_actions.h:56
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:49
A class to define a footprint association to be made in cvpcb.
unsigned int GetComponentIndex() const
Get the index of the component to modify the association of.
LIB_ID GetNewFootprint() const
Get the new footprint to associate to the component.
CVPCB_CONTROL.
Definition: cvpcb_control.h:36
bool readNetListAndFpFiles(const std::string &aNetlist)
Load the netlist file built on the fly by Eeschema and loads footprint libraries from fp lib tables.
wxTimer * m_filterTimer
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void ShowChangedLanguage() override
void SendComponentSelectionToSch(bool aClearSelectionOnly=false)
Send a remote command to Eeschema via a socket,.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void doCloseWindow() override
CVPCB_UNDO_REDO_LIST m_redoList
ACTION_MENU * m_symbolsContextMenu
wxStaticText * m_statusLine3
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const
Find out which control currently has focus.
CVPCB_FILTER_ACTION
The action to apply to a footprint filter when it is modified.
@ FILTER_DISABLE
Turn off the filter.
@ FILTER_ENABLE
Turn on the filter.
@ FILTER_TOGGLE
Toggle the filter state.
void onTextFilterChangedTimer(wxTimerEvent &aEvent)
void onTextFilterChanged(wxCommandEvent &event)
LIBRARY_LISTBOX * m_librariesListBox
void setupTools()
Setup the tool system for the CVPCB main frame.
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame() const
wxButton * m_saveAndContinue
void RedoAssociation()
Redo the most recently undone association.
bool LoadFootprintFiles()
Read the list of footprint (*.mod files) and generate the list of footprints.
void SetStatusText(const wxString &aText, int aNumber=0) override
void ReCreateMenuBar() override
Recreates the menu bar.
wxString GetSelectedFootprint()
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
CVPCB_MAINFRAME(KIWAY *aKiway, wxWindow *aParent)
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.
wxStaticText * m_statusLine1
void setupEventHandlers()
Setup event handlers.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void SetSelectedComponent(int aIndex, bool aSkipUpdate=false)
Set the currently selected component in the components listbox.
ACTION_MENU * m_footprintContextMenu
CONTROL_TYPE
The type of the controls present in the application.
@ CONTROL_NONE
No controls have focus.
@ CONTROL_LIBRARY
Library listbox.
@ CONTROL_FOOTPRINT
Footprint listbox.
@ CONTROL_COMPONENT
Component listbox.
wxString formatSymbolDesc(int idx, const wxString &aReference, const wxString &aValue, const wxString &aFootprint)
void SetFocusedControl(CVPCB_MAINFRAME::CONTROL_TYPE aControl)
Set the focus to a specific control.
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
void OnSelectComponent(wxListEvent &event)
Called when clicking on a component in component list window:
void UndoAssociation()
Undo the most recent associations that were performed.
void DisplayStatus()
Update the information displayed on the status bar at bottom of the main frame.
ACTION_TOOLBAR * m_mainToolBar
CVPCB_UNDO_REDO_LIST m_undoList
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
FOOTPRINT_LIST * m_FootprintsList
wxWindow * GetToolCanvas() const override
Canvas access.
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.
void AssociateFootprint(const CVPCB_ASSOCIATION &aAssociation, bool aNewEntry=true, bool aAddUndoItem=true)
Associate a footprint with a specific component in the list.
void updateFootprintViewerOnIdle(wxIdleEvent &aEvent)
void refreshAfterSymbolSearch(COMPONENT *aSymbol)
wxStaticText * m_statusLine2
FOOTPRINTS_LISTBOX * m_footprintListBox
CRITERIA
Criteria to use to identify sets of components.
@ ALL_COMPONENTS
All components.
@ NA_COMPONENTS
Not associated components.
@ SEL_COMPONENTS
Selected components.
@ ASSOC_COMPONENTS
Associated components.
SYMBOLS_LISTBOX * m_symbolsListBox
TOOL_DISPATCHER * m_toolDispatcher
int readSchematicNetlist(const std::string &aNetlist)
Read the netlist (.net) file built on the fly by Eeschema.
bool SaveFootprintAssociation(bool doSaveSchematic)
Save the edits that the user has done by sending them back to Eeschema via the kiway.
wxTextCtrl * m_tcFilterString
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
wxString m_FilterString
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
wxString m_aboutTitle
Specialization of the wxAuiPaneInfo class for KiCad panels.
Class that groups generic conditions for editor states.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION ContentModified()
Create a functor that tests if the content of the frame is modified.
void SetSelectedFootprint(const LIB_ID &aFPID)
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...
FP_FILTER_T
Filter setting constants.
Definition: listboxes.h:93
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition: listboxes.h:95
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 ...
void SetSelection(int aIndex, bool aState=true)
wxString GetLibNickname() const override
wxString GetDescription() override
wxString GetKeywords()
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
unsigned GetErrorCount() const
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.
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
void UpdateWidth(int aLine=-1)
Update the width of the column based on its contents.
void DeselectAll()
Remove all selection in lists which can have more than one item selected.
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
Definition: kiid.h:47
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:57
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:49
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:488
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:192
void AppendLine(const wxString &text)
wxString GetSelectedLibrary()
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:165
bool empty() const
Definition: lib_id.h:186
UTF8 Format() const
Definition: lib_id.cpp:117
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
static const wxString GetPinningSymbol()
unsigned GetCount() const
Definition: pcb_netlist.h:234
bool IsEmpty() const
Definition: pcb_netlist.h:224
void Clear()
Remove all components from the netlist.
Definition: pcb_netlist.h:229
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
Definition: pcb_netlist.h:242
void SortByReference()
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:65
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:318
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:148
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:241
wxArrayString m_SymbolList
Definition: listboxes.h:227
void SetString(unsigned linecount, const wxString &text)
void SetSelection(int index, bool State=true)
void AppendWarning(int index)
void RemoveWarning(int index)
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTIONS * m_actions
Definition: tools_holder.h:171
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h:55
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:196
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
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 InitTools()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
const char * c_str() const
Definition: utf8.h:102
wxString wx_str() const
Definition: utf8.cpp:46
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
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:240
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
This file is part of the common library.
@ ID_CVPCB_LIBRARY_LIST
Definition: cvpcb_id.h:33
@ ID_CVPCB_FOOTPRINT_LIST
Definition: cvpcb_id.h:32
@ ID_CVPCB_COMPONENT_LIST
Definition: cvpcb_id.h:31
#define CVPCB_MAINFRAME_NAME
#define CHECK(x)
#define ENABLE(x)
std::vector< CVPCB_ASSOCIATION > CVPCB_UNDO_REDO_ENTRIES
#define FOOTPRINTVIEWER_FRAME_NAME
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
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:310
DDE server & client.
#define MSG_TO_SCH
Definition: eda_dde.h:50
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_CVPCB
Definition: frame_type.h:48
This file contains miscellaneous commonly used macros and functions.
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
@ MAIL_SELECTION
Definition: mail_type.h:40
@ MAIL_RELOAD_LIB
Definition: mail_type.h:55
@ MAIL_EESCHEMA_NETLIST
Definition: mail_type.h:44
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:71
wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:85
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:132
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
see class PGM_BASE
void process(const BOARD_CONNECTED_ITEM *item, int net)
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
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_IPC
Definition: string_utils.h:56
std::vector< wxString > pinned_fp_libs