KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <pgm_base.h>
23#include <api/common/commands/cross_probe_commands.pb.h>
25#include <bitmaps.h>
26#include <confirm.h>
28#include <kiface_base.h>
29#include <kiplatform/app.h>
30#include <kiway_mail.h>
31#include <string_utils.h>
35#include <numeric>
36#include <richio.h>
37#include <tool/action_manager.h>
38#include <tool/action_toolbar.h>
39#include <tool/common_control.h>
42#include <tool/tool_manager.h>
43#include <widgets/kistatusbar.h>
45
46#include <cvpcb_association.h>
47#include <cvpcb_id.h>
48#include <cvpcb_mainframe.h>
53#include <footprint_info_impl.h>
54#include <kiplatform/ui.h>
55#include <listboxes.h>
56#include <tools/cvpcb_actions.h>
58#include <tools/cvpcb_control.h>
59#include <project_pcb.h>
60#include <toolbars_cvpcb.h>
61
62#include <wx/statline.h>
63#include <wx/stattext.h>
64#include <wx/button.h>
65#include <wx/msgdlg.h>
66#include <wx/ffile.h>
67
68
69CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
70 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
71 wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "CvpcbFrame" ),
72 unityScale ),
73 m_footprintListBox( nullptr ),
74 m_librariesListBox( nullptr ),
75 m_symbolsListBox( nullptr ),
76 m_tcFilterString( nullptr ),
78{
79 m_modified = false;
80 m_cannotClose = false;
84 m_initialized = false;
85 m_aboutTitle = _( "Assign Footprints" );
86
87 // Give an icon
88 wxIcon icon;
89 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
90 SetIcon( icon );
91
92 SetAutoLayout( true );
93
95
96 setupTools();
98
103
106
109
112
114
115 m_auimgr.SetManagedWindow( this );
116
117 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" ).Top().Layer(6) );
118
119 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
120 .Caption( _( "Footprint Libraries" ) )
121 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
122
123 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
124 .Caption( _( "Symbol : Footprint Assignments" ) ) );
125
126 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
127 .Caption( _( "Filtered Footprints" ) )
128 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
129
130 // Build the bottom panel, to display 2 status texts and the buttons:
131 auto bottomPanel = new wxPanel( this );
132 auto panelSizer = new wxBoxSizer( wxVERTICAL );
133
134 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
135 fgSizerStatus->SetFlexibleDirection( wxBOTH );
136 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
137
138 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
139 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
140
141 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
142 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
143
144 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
145 fgSizerStatus->Add( m_statusLine3, 0, 0, 5 );
146
147 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
148
149 m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
150 m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
151 m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
152
153 // Add buttons:
154 auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
155 auto sdbSizer = new wxStdDialogButtonSizer();
156
157 m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY, _( "Apply, Save Schematic && Continue" ) );
158 buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
159
160 auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
161 sdbSizer->AddButton( sdbSizerOK );
162 auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
163 sdbSizer->AddButton( sdbSizerCancel );
164 sdbSizer->Realize();
165
166 buttonsSizer->Add( sdbSizer, 0, 0, 5 );
167 panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
168
169 bottomPanel->SetSizer( panelSizer );
170 bottomPanel->Fit();
171
172 sdbSizerOK->SetDefault();
174
175 m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
176
177 m_auimgr.Update();
178 m_initialized = true;
179
180 auto setPaneWidth =
181 [this]( wxAuiPaneInfo& pane, int width )
182 {
183 // wxAUI hack: force width by setting MinSize() and then Fixed()
184 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
185 pane.MinSize( width, -1 );
186 pane.BestSize( width, -1 );
187 pane.MaxSize( width, -1 );
188 pane.Fixed();
189 m_auimgr.Update();
190
191 // now make it resizable again
192 pane.MinSize( 20, -1 );
193 pane.Resizable();
194 m_auimgr.Update();
195 };
196
197 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
198 {
199 m_tcFilterString->ChangeValue( cfg->m_FilterString );
200
201 if( cfg->m_LibrariesWidth > 0 )
202 setPaneWidth( m_auimgr.GetPane( "Libraries" ), cfg->m_LibrariesWidth );
203
204 if( cfg->m_FootprintsWidth > 0 )
205 setPaneWidth( m_auimgr.GetPane( "Footprints" ), cfg->m_FootprintsWidth );
206 }
207
208 // Connect Events
210
211 // Toolbar events
212 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
213
214 // Attach the events to the tool dispatcher
216 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
217
218 m_filterTimer = new wxTimer( this );
219 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
220
221 // Start the main processing loop
222 m_toolManager->InvokeTool( "cvpcb.Control" );
223
224 m_filterTimer->StartOnce( 100 );
225
226 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
227}
228
229
231{
232 Unbind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
234 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
235
236 Unbind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
237 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
238
239 // Clean up the tool infrastructure
240 delete m_actions;
241 delete m_toolManager;
242 delete m_toolDispatcher;
243 delete m_FootprintsList;
244
245 m_auimgr.UnInit();
246}
247
248
250{
251 // Create the manager
252 m_actions = new CVPCB_ACTIONS();
254 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
256
257 // Register tools
258 m_toolManager->RegisterTool( new COMMON_CONTROL );
259 m_toolManager->RegisterTool( new CVPCB_CONTROL );
260 m_toolManager->RegisterTool( new CVPCB_ASSOCIATION_TOOL );
261 m_toolManager->InitTools();
262
263 CVPCB_CONTROL* tool = m_toolManager->GetTool<CVPCB_CONTROL>();
264
265 // Even though these menus will open with the right-click, we treat them as a normal
266 // menu instead of a context menu because we don't care about their position and want
267 // to be able to tell the difference between a menu click and a hotkey activation.
268
269 // Create the context menu for the symbols list box
270 m_symbolsContextMenu = new ACTION_MENU( false, tool );
272 m_symbolsContextMenu->AppendSeparator();
276 m_symbolsContextMenu->AppendSeparator();
278
279 // Create the context menu for the footprint list box
280 m_footprintContextMenu = new ACTION_MENU( false, tool );
282}
283
284
286{
288
289 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
290 EDITOR_CONDITIONS cond( this );
291
292 wxASSERT( mgr );
293
294#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
295#define CHECK( x ) ACTION_CONDITIONS().Check( x )
296
301
302 auto compFilter =
303 [this] ( const SELECTION& )
304 {
306 };
307
308 auto libFilter =
309 [this] ( const SELECTION& )
310 {
312 };
313
314 auto pinFilter =
315 [this] ( const SELECTION& )
316 {
318 };
319
323
324#undef CHECK
325#undef ENABLE
326}
327
328
330{
331 // Connect the handlers to launch the context menus in the listboxes
332 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
333 [this]( wxMouseEvent& )
334 {
335 PopupMenu( m_footprintContextMenu );
336 } );
337
338 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
339 [this]( wxMouseEvent& )
340 {
341 PopupMenu( m_symbolsContextMenu );
342 } );
343
344 // Connect the handler for the save button
345 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
346 [this]( wxCommandEvent& )
347 {
348 // saveAssociations must be run immediately
350 } );
351
352 // Connect the handlers for the ok/cancel buttons
353 Bind( wxEVT_BUTTON,
354 [this]( wxCommandEvent& )
355 {
356 // saveAssociations must be run immediately, before running Close( true )
358 Close( true );
359 }, wxID_OK );
360
361 Bind( wxEVT_BUTTON,
362 [this]( wxCommandEvent& )
363 {
364 Close( false );
365 }, wxID_CANCEL );
366
367 // Connect the handlers for the close events
368 Bind( wxEVT_MENU,
369 [this]( wxCommandEvent& )
370 {
371 Close( false );
372 }, wxID_CLOSE );
373 Bind( wxEVT_MENU,
374 [this]( wxCommandEvent& )
375 {
376 Close( false );
377 }, wxID_EXIT );
378
379 // Just skip the resize events
380 Bind( wxEVT_SIZE,
381 []( wxSizeEvent& aEvent )
382 {
383 aEvent.Skip();
384 } );
385}
386
387
388bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
389{
390 if( m_modified )
391 {
392 // Shutdown blocks must be determined and vetoed as early as possible
393 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
394 return false;
395
396 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. Save changes?" ),
397 [&]() -> bool
398 {
399 return SaveFootprintAssociation( false );
400 } ) )
401 {
402 return false;
403 }
404 }
405
406 if( m_cannotClose )
407 return false;
408
409 return true;
410}
411
412
414{
415 m_symbolsListBox->Shutdown();
416 m_footprintListBox->Shutdown();
417
419 GetFootprintViewerFrame()->Close( true );
420
421 m_modified = false;
422
423 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
424 m_filterTimer->Stop();
425
426 // Shutdown all running tools
427 if( m_toolManager )
428 m_toolManager->ShutdownAllTools();
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() )
459 m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
460 else if( m_footprintListBox->GetSelection() >= 0 )
461 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
462
464
466
467 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
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() )
487 m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
488 else if( m_footprintListBox->GetSelection() >= 0 )
489 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
490
492
493 refreshAfterSymbolSearch( symbol );
494}
495
496
505
506
508{
509 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
510 m_viewerPendingUpdate = false;
511
512 // On some platforms (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 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
537 m_filteringOptions = cfg->m_FilterFlags;
538}
539
540
542{
544
545 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
546 {
547 cfg->m_FilterFlags = m_filteringOptions;
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
555
557{
558 if( m_undoList.size() == 0 )
559 return;
560
561 CVPCB_UNDO_REDO_ENTRIES redoEntries;
562 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
563 m_undoList.pop_back();
564
565 // Iterate over the entries to undo
566 for( const auto& assoc : curEntry )
567 {
568 AssociateFootprint( assoc, true, false );
569 redoEntries.emplace_back( assoc.Reverse() );
570 }
571
572 // Add the redo entries to the redo stack
573 m_redoList.emplace_back( redoEntries );
574}
575
576
578{
579 if( m_redoList.size() == 0 )
580 return;
581
582 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
583 m_redoList.pop_back();
584
585 // Iterate over the entries to undo
586 bool firstAssoc = true;
587
588 for( const auto& assoc : curEntry )
589 {
590 AssociateFootprint( assoc, firstAssoc );
591 firstAssoc = false;
592 }
593}
594
595
596wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
597 const wxString& aValue, const wxString& aFootprint )
598{
599 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
600 // reason).
601 wxString desc = wxString::Format( wxT( "%3d " ), idx );
602
603 for( int ii = aReference.Length(); ii < 8; ++ii )
604 desc += wxS( " " );
605
606 desc += aReference + wxT( " - " );
607
608 for( int ii = aValue.Length(); ii < 16; ++ii )
609 desc += wxS( " " );
610
611 desc += aValue + wxT( " : " ) + aFootprint;
612
613 return desc;
614}
615
616
618 bool aNewEntry, bool aAddUndoItem )
619{
620 if( m_netlist.IsEmpty() )
621 return;
622
623 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
624
625 if( symbol == nullptr )
626 return;
627
628 LIB_ID fpid = aAssociation.GetNewFootprint();
629 LIB_ID oldFpid = symbol->GetFPID();
630
631 // Test for validity of the requested footprint
632 if( !fpid.empty() && !fpid.IsValid() )
633 {
634 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
635 fpid.Format().wx_str() );
636 DisplayErrorMessage( this, msg );
637 return;
638 }
639
640 const KIID& id = symbol->GetKIIDs().front();
641
642 // Set new footprint to all instances of the selected symbol
643 for( unsigned int idx : GetComponentIndices() )
644 {
645 COMPONENT* candidate = m_netlist.GetComponent( idx );
646 const std::vector<KIID>& kiids = candidate->GetKIIDs();
647
648 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
649 {
650 // Set the new footprint
651 candidate->SetFPID( fpid );
652
653 // create the new symbol description and set it
654 wxString description = formatSymbolDesc( idx + 1,
655 candidate->GetReference(),
656 candidate->GetValue(),
657 candidate->GetFPID().Format().wx_str() );
658 m_symbolsListBox->SetString( idx, description );
659
660 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
661 m_symbolsListBox->AppendWarning( idx );
662 else
663 m_symbolsListBox->RemoveWarning( idx );
664 }
665 }
666
667 // Mark the data as being modified
668 m_modified = true;
669
670 // Update the statusbar and refresh the list
672 m_symbolsListBox->Refresh();
673
674 if( !aAddUndoItem )
675 return;
676
677 // Update the undo list
678 if ( aNewEntry )
679 {
680 // Create a new entry for this association
682 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
683 aAssociation.GetNewFootprint() ) );
684 m_undoList.emplace_back( newEntry );
685
686 // Clear the redo list
687 m_redoList.clear();
688 }
689 else
690 {
691 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
692 oldFpid,
693 aAssociation.GetNewFootprint() ) );
694 }
695
696}
697
698
699bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
700{
701 return true;
702}
703
704
706{
707 // Tell AuiMgr that objects are changed !
708 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
709 m_auimgr.Update(); // (could be not the case when starting CvPcb)
710
711 if( aSymbol == nullptr )
712 {
714 return;
715 }
716
717 // Preview of the already assigned footprint.
718 // Find the footprint that was already chosen for this aSymbol and select it,
719 // but only if the selection is made from the aSymbol list or the library list.
720 // If the selection is made from the footprint list, do not change the current
721 // selected footprint.
722 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
723 {
724 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
725
726 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
727
728 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
729 {
730 wxString candidateName;
731 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
732 msg.Trim( true );
733 msg.Trim( false );
734 candidateName = msg.AfterFirst( wxChar( ' ' ) );
735
736 if( footprintName.Cmp( candidateName ) == 0 )
737 {
738 m_footprintListBox->SetSelection( ii, true );
739 break;
740 }
741 }
742 }
743
746}
747
748
751{
752 int option = aFilter;
753
754 // Apply the filter accordingly
755 switch( aAction )
756 {
760 }
761
762 wxListEvent l_event;
763 OnSelectComponent( l_event );
764}
765
766
768{
769 if( !m_initialized )
770 return;
771
772 wxString filters, msg;
774
776 {
777 msg.Empty();
778
779 if( symbol )
780 {
781 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
782 {
783 if( msg.IsEmpty() )
784 msg += symbol->GetFootprintFilters()[ii];
785 else
786 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
787 }
788 }
789
790 filters += _( "Keywords" );
791
792 if( !msg.IsEmpty() )
793 filters += wxString::Format( wxT( " (%s)" ), msg );
794 }
795
797 {
798 msg.Empty();
799
800 if( symbol )
801 {
802 int pc = symbol->GetPinCount();
803 wxLogTrace( "CVPCB_PINCOUNT", wxT( "DisplayStatus: selected '%s' pinCount=%d" ),
804 symbol->GetReference(), pc );
805 msg = wxString::Format( wxT( "%i" ), pc );
806 }
807
808 if( !filters.IsEmpty() )
809 filters += wxT( ", " );
810
811 filters += _( "Pin Count" );
812
813 if( !msg.IsEmpty() )
814 filters += wxString::Format( wxT( " (%s)" ), msg );
815 }
816
818 {
819 msg = m_librariesListBox->GetSelectedLibrary();
820
821 if( !filters.IsEmpty() )
822 filters += wxT( ", " );
823
824 filters += _( "Library" );
825
826 if( !msg.IsEmpty() )
827 filters += wxString::Format( wxT( " (%s)" ), msg );
828 }
829
830 wxString textFilter = m_tcFilterString->GetValue();
831
832 if( !textFilter.IsEmpty() )
833 {
834 if( !filters.IsEmpty() )
835 filters += wxT( ", " );
836
837 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
838 }
839
840 if( filters.IsEmpty() )
841 msg = _( "No Filtering" );
842 else
843 msg.Printf( _( "Filtered by %s" ), filters );
844
845 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
846
847 SetStatusText( msg );
848
849
850 msg.Empty();
851 wxString footprintName = GetSelectedFootprint();
852
853 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
854
855 if( fp ) // can be NULL if no netlist loaded
856 {
857 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
858 fp->GetDesc(),
859 fp->GetKeywords() );
860 }
861
862 SetStatusText( msg, 1 );
863
864 msg.Empty();
865 wxString lib;
866
867 // Choose the footprint to get the information on
868 if( fp )
869 {
870 // Use the footprint in the footprint viewer
871 lib = fp->GetLibNickname();
872 }
874 {
875 // Use the footprint of the selected symbol
876 if( symbol )
877 lib = symbol->GetFPID().GetUniStringLibNickname();
878 }
880 {
881 // Use the library that is selected
882 lib = m_librariesListBox->GetSelectedLibrary();
883 }
884
885 // Extract the library information
887
888 if( std::optional<LIBRARY_TABLE_ROW*> optRow = adapter->GetRow( lib ); optRow )
889 msg = wxString::Format( _( "Library location: %s" ), LIBRARY_MANAGER::GetFullURI( *optRow ) );
890
891 SetStatusText( msg, 2 );
892}
893
894
896{
898
899 // Check if there are footprint libraries in the footprint library table.
900 if( !adapter || !adapter->Rows().size() )
901 {
902 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
903 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
904 return false;
905 }
906
907 WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
908
909 m_FootprintsList->ReadFootprintFiles( adapter, nullptr, &progressReporter );
910
911 if( m_FootprintsList->GetErrorCount() )
912 {
913 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
914 statusBar->AddWarningMessages( "load", m_FootprintsList->GetErrorMessages() );
915 }
916
917 return true;
918}
919
920
921void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
922{
923 if( m_netlist.IsEmpty() && !aClearSelectionOnly )
924 return;
925
926 kiapi::common::commands::SyncSelection sync;
927
928 if( !aClearSelectionOnly )
929 {
930 int selection = m_symbolsListBox->GetSelection();
931
932 if( selection < 0 ) // Nothing selected
933 return;
934
935 if( m_netlist.GetComponent( selection ) == nullptr )
936 return;
937
938 // Now select the corresponding symbol on the schematic:
939 wxString ref = m_netlist.GetComponent( selection )->GetReference();
940
941 sync.set_mode( kiapi::common::commands::SSM_ITEMS_ONLY );
942 sync.add_items()->mutable_footprint()->set_reference( ref.ToUTF8() );
943 }
944
945 if( Kiface().IsSingle() )
946 {
948 }
949 else
950 {
951 std::string payload = sync.SerializeAsString();
952 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, payload, this );
953 }
954}
955
956
957int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
958{
959 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
960 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
961
962 m_netlist.Clear();
963
964 // Trace basic payload characteristics to verify libparts are present and visible here
965 wxLogTrace( "CVPCB_PINCOUNT",
966 wxT( "readSchematicNetlist: payload size=%zu has_libparts=%d has_libpart=%d" ),
967 aNetlist.size(), aNetlist.find( "(libparts" ) != std::string::npos,
968 aNetlist.find( "(libpart" ) != std::string::npos );
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" ) )
987 m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
988 }
989
990 // Sort symbols by reference:
991 m_netlist.SortByReference();
992
993 return 0;
994}
995
996
998{
999 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
1001 DisplayStatus();
1002}
1003
1004
1006{
1010
1011 // Use same sorting algorithm as LIB_TREE_NODE::AssignIntrinsicRanks
1012 struct library_sort
1013 {
1014 bool operator()( const wxString& lhs, const wxString& rhs ) const
1015 {
1016 return StrNumCmp( lhs, rhs, true ) < 0;
1017 }
1018 };
1019
1020 std::set<wxString, library_sort> pinnedMatches;
1021 std::set<wxString, library_sort> otherMatches;
1022
1023 m_librariesListBox->ClearList();
1024
1025 auto process =
1026 [&]( const wxString& aNickname )
1027 {
1028 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1029 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1030 {
1031 pinnedMatches.insert( aNickname );
1032 }
1033 else
1034 {
1035 otherMatches.insert( aNickname );
1036 }
1037 };
1038
1039
1040 if( adapter )
1041 {
1042 std::vector<wxString> libNickNames = adapter->GetLibraryNames();
1043
1044 for( const wxString& libNickName : libNickNames )
1045 process( libNickName );
1046 }
1047
1048 for( const wxString& nickname : pinnedMatches )
1050
1051 for( const wxString& nickname : otherMatches )
1052 m_librariesListBox->AppendLine( nickname );
1053
1054 m_librariesListBox->Finish();
1055}
1056
1057
1059{
1060 int selection = m_symbolsListBox->GetSelection();
1061
1062 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1063 return m_netlist.GetComponent( selection );
1064
1065 return nullptr;
1066}
1067
1068
1069void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1070{
1071 m_skipComponentSelect = aSkipUpdate;
1072
1073 if( aIndex < 0 )
1074 {
1075 m_symbolsListBox->DeselectAll();
1076 }
1077 else if( aIndex < m_symbolsListBox->GetCount() )
1078 {
1079 m_symbolsListBox->DeselectAll();
1080 m_symbolsListBox->SetSelection( aIndex );
1082 }
1083
1084 m_skipComponentSelect = false;
1085}
1086
1087
1088std::vector<unsigned int>
1090{
1091 std::vector<unsigned int> idx;
1092 int lastIdx;
1093
1094 // Make sure a netlist has been loaded and the box has contents
1095 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1096 return idx;
1097
1098 switch( aCriteria )
1099 {
1101 idx.resize( m_netlist.GetCount() );
1102 std::iota( idx.begin(), idx.end(), 0 );
1103 break;
1104
1106 // Check to see if anything is selected
1107 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1108 break;
1109
1110 // Get the symbols
1111 lastIdx = m_symbolsListBox->GetFirstSelected();
1112 idx.emplace_back( lastIdx );
1113
1114 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1115 while( lastIdx > 0 )
1116 {
1117 idx.emplace_back( lastIdx );
1118 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1119 }
1120 break;
1121
1123 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1124 {
1125 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1126 idx.emplace_back( i );
1127 }
1128 break;
1129
1131 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1132 {
1133 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1134 idx.emplace_back( i );
1135 }
1136 break;
1137
1138 default:
1139 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1140 }
1141
1142 return idx;
1143}
1144
1145
1147{
1148 // returns the Footprint Viewer frame, if exists, or NULL
1149 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1150 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1151}
1152
1153
1155{
1156 return GetFootprintViewerFrame();
1157}
1158
1159
1167
1168
1170{
1171 switch( aLB )
1172 {
1176 default: break;
1177 }
1178}
1179
1180
1182{
1183 // returns the LIB_ID of the selected footprint in footprint listview
1184 // or a empty string
1185 return m_footprintListBox->GetSelectedFootprint();
1186}
1187
1188
1189void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1190{
1191 switch( aNumber )
1192 {
1193 case 0: m_statusLine1->SetLabel( aText ); break;
1194 case 1: m_statusLine2->SetLabel( aText ); break;
1195 case 2: m_statusLine3->SetLabel( aText ); break;
1196 default: wxFAIL_MSG( wxT( "Invalid status row number" ) ); break;
1197 }
1198}
1199
1200
1207
1208
1210{
1211 const std::string& payload = mail.GetPayload();
1212
1213 switch( mail.Command() )
1214 {
1216 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating widgets:
1217 m_cannotClose = true;
1218 readNetListAndFpFiles( payload );
1219 m_cannotClose = false;
1220 break;
1221
1222 case MAIL_RELOAD_LIB:
1223 if( m_cannotClose )
1224 break;
1225
1226 m_cannotClose = true;
1230 m_cannotClose = false;
1231 break;
1232
1233 default:
1234 ; // ignore most
1235 }
1236}
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:124
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:100
static TOOL_ACTION paste
Definition actions.h:76
static TOOL_ACTION copy
Definition actions.h:74
static TOOL_ACTION undo
Definition actions.h:71
static TOOL_ACTION redo
Definition actions.h:72
static TOOL_ACTION cut
Definition actions.h:73
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...
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:43
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Handle actions that are shared between different applications.
Store all of the related component information found in a netlist.
const wxString & GetReference() const
const wxString & GetValue() const
void SetFPID(const LIB_ID &aFPID)
const wxArrayString & GetFootprintFilters() const
const std::vector< KIID > & GetKIIDs() const
const LIB_ID & GetFPID() const
static bool SendToFrame(FRAME_T aTarget, const google::protobuf::Message &aRequest)
Gather all the actions that are shared by tools.
static TOOL_ACTION saveAssociationsToFile
static TOOL_ACTION FilterFPbyLibrary
static TOOL_ACTION filterFPbyPin
static TOOL_ACTION deleteAssoc
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Handles action in main CvPcb window.
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.
Handles actions in main CvPcb window.
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
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 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.
void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
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 configureToolbars() override
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.
Toolbar configuration for cvpcb.
virtual APP_SETTINGS_BASE * config() const
Return 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.
TOOLBAR_SETTINGS * m_toolbarSettings
wxAuiManager m_auimgr
virtual void RecreateToolbars()
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.
ACTION_TOOLBAR * m_tbTopMain
wxString m_aboutTitle
void ReCreateMenuBar()
Recreate the menu bar.
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.
virtual 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.
FP_FILTER_T
Filter setting constants.
Definition listboxes.h:95
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition listboxes.h:97
wxString GetLibNickname() const override
wxString GetKeywords()
wxString GetDesc() override
An interface to the global shared library manager that is schematic-specific and linked to one projec...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
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:46
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
Definition kistatusbar.h:50
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.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:34
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition kiway_mail.h:52
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition kiway_mail.h:44
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:340
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:486
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:201
std::vector< LIBRARY_TABLE_ROW * > Rows(LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH, bool aIncludeInvalid=false) const
Like LIBRARY_MANAGER::Rows but filtered to the LIBRARY_TABLE_TYPE of this adapter.
std::optional< LIBRARY_TABLE_ROW * > GetRow(const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
std::vector< wxString > GetLibraryNames() const
Returns a list of library nicknames that are available (skips any that failed to load)
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false)
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
bool IsValid() const
Check if this LID_ID is valid.
Definition lib_id.h:168
bool empty() const
Definition lib_id.h:189
UTF8 Format() const
Definition lib_id.cpp:132
const wxString GetUniStringLibNickname() const
Definition lib_id.h:84
static const wxString GetPinningSymbol()
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:546
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:123
The backing store for a PROJECT, in JSON format.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:201
T * GetToolbarSettings(const wxString &aFilename)
Return a handle to the given toolbar settings.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition richio.h:225
TOOL_MANAGER * m_toolManager
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
const char * c_str() const
Definition utf8.h:104
wxString wx_str() const
Definition utf8.cpp:41
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:146
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
This file is part of the common library.
@ ID_CVPCB_LIBRARY_LIST
Definition cvpcb_id.h:29
@ ID_CVPCB_FOOTPRINT_LIST
Definition cvpcb_id.h:28
@ ID_CVPCB_COMPONENT_LIST
Definition cvpcb_id.h:27
#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
@ FRAME_SCH
Definition frame_type.h:30
@ FRAME_CVPCB
Definition frame_type.h:48
@ MAIL_SELECTION
Definition mail_type.h:36
@ MAIL_RELOAD_LIB
Definition mail_type.h:53
@ MAIL_EESCHEMA_NETLIST
Definition mail_type.h:40
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition unix/app.cpp:102
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition unix/app.cpp:91
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition wxgtk/ui.cpp:266
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
KICOMMON_API wxFont GetMonospacedUIFont(int aRelativeSize=0)
Definition ui_common.cpp:93
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition kicad_algo.h:96
static PGM_BASE * process
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString From_UTF8(const char *cstring)
std::vector< wxString > pinned_fp_libs
#define PR_CAN_ABORT