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, 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>
38#include <numeric>
39#include <tool/action_manager.h>
40#include <tool/action_toolbar.h>
41#include <tool/common_control.h>
44#include <tool/tool_manager.h>
46
47#include <cvpcb_association.h>
48#include <cvpcb_id.h>
49#include <cvpcb_mainframe.h>
52#include <kiplatform/ui.h>
53#include <listboxes.h>
54#include <tools/cvpcb_actions.h>
56#include <tools/cvpcb_control.h>
57#include <project_pcb.h>
58
59#include <wx/statline.h>
60#include <wx/stattext.h>
61#include <wx/button.h>
62#include <wx/msgdlg.h>
63
64
65CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
66 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
67 wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "CvpcbFrame" ),
68 unityScale ),
69 m_mainToolBar( nullptr ),
70 m_footprintListBox( nullptr ),
71 m_librariesListBox( nullptr ),
72 m_symbolsListBox( nullptr ),
73 m_tcFilterString( nullptr ),
74 m_viewerPendingUpdate( false )
75{
76 m_modified = false;
77 m_cannotClose = false;
81 m_initialized = false;
82 m_aboutTitle = _( "Assign Footprints" );
83
84 // Give an icon
85 wxIcon icon;
86 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
87 SetIcon( icon );
88
89 SetAutoLayout( true );
90
92
93 setupTools();
97
100
103
106
108
109 m_auimgr.SetManagedWindow( this );
110
111 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
112
113 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
114 .Caption( _( "Footprint Libraries" ) )
115 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
116
117 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
118 .Caption( _( "Symbol : Footprint Assignments" ) ) );
119
120 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
121 .Caption( _( "Filtered Footprints" ) )
122 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
123
124 // Build the bottom panel, to display 2 status texts and the buttons:
125 auto bottomPanel = new wxPanel( this );
126 auto panelSizer = new wxBoxSizer( wxVERTICAL );
127
128 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
129 fgSizerStatus->SetFlexibleDirection( wxBOTH );
130 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
131
132 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
133 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
134
135 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
136 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
137
138 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
139 fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
140
141 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
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 auto setPaneWidth =
176 [this]( wxAuiPaneInfo& pane, int width )
177 {
178 // wxAUI hack: force width by setting MinSize() and then Fixed()
179 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
180 pane.MinSize( width, -1 );
181 pane.BestSize( width, -1 );
182 pane.MaxSize( width, -1 );
183 pane.Fixed();
184 m_auimgr.Update();
185
186 // now make it resizable again
187 pane.MinSize( 20, -1 );
188 pane.Resizable();
189 m_auimgr.Update();
190 };
191
192 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
193 {
194 m_tcFilterString->ChangeValue( cfg->m_FilterString );
195
196 if( cfg->m_LibrariesWidth > 0 )
197 setPaneWidth( m_auimgr.GetPane( "Libraries" ), cfg->m_LibrariesWidth );
198
199 if( cfg->m_FootprintsWidth > 0 )
200 setPaneWidth( m_auimgr.GetPane( "Footprints" ), cfg->m_FootprintsWidth );
201 }
202
203 // Connect Events
205
206 // Start the main processing loop
207 m_toolManager->InvokeTool( "cvpcb.Control" );
208
209 m_filterTimer->StartOnce( 100 );
210
211 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
212}
213
214
216{
217 Unbind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
219 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
220
221 Unbind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
222 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
223
224 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
225 m_filterTimer->Stop();
226
227 // Shutdown all running tools
228 if( m_toolManager )
230
231 // Clean up the tool infrastructure
232 delete m_actions;
233 delete m_toolManager;
234 delete m_toolDispatcher;
235
236 m_auimgr.UnInit();
237}
238
239
241{
242 // Create the manager
243 m_actions = new CVPCB_ACTIONS();
245 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
247
248 // Register tools
253
255
256 // Even though these menus will open with the right-click, we treat them as a normal
257 // menu instead of a context menu because we don't care about their position and want
258 // to be able to tell the difference between a menu click and a hotkey activation.
259
260 // Create the context menu for the symbols list box
261 m_symbolsContextMenu = new ACTION_MENU( false, tool );
263 m_symbolsContextMenu->AppendSeparator();
267 m_symbolsContextMenu->AppendSeparator();
269
270 // Create the context menu for the footprint list box
271 m_footprintContextMenu = new ACTION_MENU( false, tool );
273}
274
275
277{
279
281 EDITOR_CONDITIONS cond( this );
282
283 wxASSERT( mgr );
284
285#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
286#define CHECK( x ) ACTION_CONDITIONS().Check( x )
287
289 ENABLE( cond.ContentModified() ) );
293
294 auto compFilter =
295 [this] ( const SELECTION& )
296 {
298 };
299
300 auto libFilter =
301 [this] ( const SELECTION& )
302 {
304 };
305
306 auto pinFilter =
307 [this] ( const SELECTION& )
308 {
310 };
311
315
316#undef CHECK
317#undef ENABLE
318}
319
320
322{
323 // Connect the handlers to launch the context menus in the listboxes
324 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
325 [this]( wxMouseEvent& )
326 {
327 PopupMenu( m_footprintContextMenu );
328 } );
329
330 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
331 [this]( wxMouseEvent& )
332 {
333 PopupMenu( m_symbolsContextMenu );
334 } );
335
336 // Connect the handler for the save button
337 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
338 [this]( wxCommandEvent& )
339 {
340 // saveAssociations must be run immediately
342 } );
343
344 // Connect the handlers for the ok/cancel buttons
345 Bind( wxEVT_BUTTON,
346 [this]( wxCommandEvent& )
347 {
348 // saveAssociations must be run immediately, before running Close( true )
350 Close( true );
351 }, wxID_OK );
352
353 Bind( wxEVT_BUTTON,
354 [this]( wxCommandEvent& )
355 {
356 Close( false );
357 }, wxID_CANCEL );
358
359 // Connect the handlers for the close events
360 Bind( wxEVT_MENU,
361 [this]( wxCommandEvent& )
362 {
363 Close( false );
364 }, wxID_CLOSE );
365 Bind( wxEVT_MENU,
366 [this]( wxCommandEvent& )
367 {
368 Close( false );
369 }, wxID_EXIT );
370
371 // Toolbar events
372 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
373
374 // Just skip the resize events
375 Bind( wxEVT_SIZE,
376 []( wxSizeEvent& aEvent )
377 {
378 aEvent.Skip();
379 } );
380
381 // Attach the events to the tool dispatcher
383 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
384
385 m_filterTimer = new wxTimer( this );
386 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
387}
388
389
390bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
391{
392 if( m_modified )
393 {
394 // Shutdown blocks must be determined and vetoed as early as possible
396 && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
397 {
398 return false;
399 }
400
401 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
402 "Save changes?" ),
403 [&]() -> bool
404 {
405 return SaveFootprintAssociation( false );
406 } ) )
407 {
408 return false;
409 }
410 }
411
412 if( m_cannotClose )
413 return false;
414
415 return true;
416}
417
418
420{
422 GetFootprintViewerFrame()->Close( true );
423
424 m_modified = false;
425
426 // clear symbol selection in schematic:
428}
429
430
431void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
432{
433 // Called when changing the filter string in main toolbar.
434 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
435 // of available footprints which match the filter
436
437 m_filterTimer->StartOnce( 200 );
438}
439
440
442{
443 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
444 // insertion point here and then restore them at the end.
445 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
446 long pos = m_tcFilterString->GetInsertionPoint();
447
449 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
450
451 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
453
454 if( symbol && symbol->GetFPID().IsValid() )
456 else if( m_footprintListBox->GetSelection() >= 0 )
458
460
462
463 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
464 {
465 m_tcFilterString->SetFocus();
466 m_tcFilterString->SetInsertionPoint( pos );
467 }
468}
469
470
471void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
472{
474 return;
475
477 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
478
479 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
481
482 if( symbol && symbol->GetFPID().IsValid() )
484 else if( m_footprintListBox->GetSelection() >= 0 )
486
488
489 refreshAfterSymbolSearch( symbol );
490}
491
492
494{
496 {
497 Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
499 }
500}
501
502
504{
505 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
506 m_viewerPendingUpdate = false;
507
508 // On some platforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
509 // are opened and refreshed when a new footprint is selected.
510 // If the listbox has the focus before selecting a new footprint, it will be forced
511 // after selection.
512 bool footprintListHasFocus = m_footprintListBox->HasFocus();
513 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
514
515 // If the footprint view window is displayed, update the footprint.
518
520
521 if( footprintListHasFocus )
522 m_footprintListBox->SetFocus();
523 else if( symbolListHasFocus )
524 m_symbolsListBox->SetFocus();
525}
526
527
529{
531
532 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
533
535}
536
537
539{
541
542 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
544 cfg->m_FilterString = m_tcFilterString->GetValue();
545
546 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
547 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
548}
549
550
552{
553 if( m_undoList.size() == 0 )
554 return;
555
556 CVPCB_UNDO_REDO_ENTRIES redoEntries;
557 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
558 m_undoList.pop_back();
559
560 // Iterate over the entries to undo
561 for( const auto& assoc : curEntry )
562 {
563 AssociateFootprint( assoc, true, false );
564 redoEntries.emplace_back( assoc.Reverse() );
565 }
566
567 // Add the redo entries to the redo stack
568 m_redoList.emplace_back( redoEntries );
569}
570
571
573{
574 if( m_redoList.size() == 0 )
575 return;
576
577 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
578 m_redoList.pop_back();
579
580 // Iterate over the entries to undo
581 bool firstAssoc = true;
582
583 for( const auto& assoc : curEntry )
584 {
585 AssociateFootprint( assoc, firstAssoc );
586 firstAssoc = false;
587 }
588}
589
590
591wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
592 const wxString& aValue, const wxString& aFootprint )
593{
594 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
595 // reason).
596 wxString desc = wxString::Format( wxT( "%3d " ), idx );
597
598 for( int ii = aReference.Length(); ii < 8; ++ii )
599 desc += wxS( " " );
600
601 desc += aReference + wxT( " - " );
602
603 for( int ii = aValue.Length(); ii < 16; ++ii )
604 desc += wxS( " " );
605
606 desc += aValue + wxT( " : " ) + aFootprint;
607
608 return desc;
609}
610
611
613 bool aNewEntry, bool aAddUndoItem )
614{
615 if( m_netlist.IsEmpty() )
616 return;
617
618 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
619
620 if( symbol == nullptr )
621 return;
622
623 LIB_ID fpid = aAssociation.GetNewFootprint();
624 LIB_ID oldFpid = symbol->GetFPID();
625
626 // Test for validity of the requested footprint
627 if( !fpid.empty() && !fpid.IsValid() )
628 {
629 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
630 fpid.Format().wx_str() );
631 DisplayErrorMessage( this, msg );
632 return;
633 }
634
635 const KIID& id = symbol->GetKIIDs().front();
636
637 // Set new footprint to all instances of the selected symbol
638 for( unsigned int idx : GetComponentIndices() )
639 {
640 COMPONENT* candidate = m_netlist.GetComponent( idx );
641 const std::vector<KIID>& kiids = candidate->GetKIIDs();
642
643 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
644 {
645 // Set the new footprint
646 candidate->SetFPID( fpid );
647
648 // create the new symbol description and set it
649 wxString description = formatSymbolDesc( idx + 1,
650 candidate->GetReference(),
651 candidate->GetValue(),
652 candidate->GetFPID().Format().wx_str() );
653 m_symbolsListBox->SetString( idx, description );
654
655 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
657 else
659 }
660 }
661
662 // Mark the data as being modified
663 m_modified = true;
664
665 // Update the statusbar and refresh the list
667 m_symbolsListBox->Refresh();
668
669 if( !aAddUndoItem )
670 return;
671
672 // Update the undo list
673 if ( aNewEntry )
674 {
675 // Create a new entry for this association
677 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
678 aAssociation.GetNewFootprint() ) );
679 m_undoList.emplace_back( newEntry );
680
681 // Clear the redo list
682 m_redoList.clear();
683 }
684 else
685 {
686 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
687 oldFpid,
688 aAssociation.GetNewFootprint() ) );
689 }
690
691}
692
693
694bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
695{
696 return true;
697}
698
699
701{
702 // Tell AuiMgr that objects are changed !
703 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
704 m_auimgr.Update(); // (could be not the case when starting CvPcb)
705
706 if( aSymbol == nullptr )
707 {
709 return;
710 }
711
712 // Preview of the already assigned footprint.
713 // Find the footprint that was already chosen for this aSymbol and select it,
714 // but only if the selection is made from the aSymbol list or the library list.
715 // If the selection is made from the footprint list, do not change the current
716 // selected footprint.
717 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
718 {
719 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
720
722
723 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
724 {
725 wxString candidateName;
726 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
727 msg.Trim( true );
728 msg.Trim( false );
729 candidateName = msg.AfterFirst( wxChar( ' ' ) );
730
731 if( footprintName.Cmp( candidateName ) == 0 )
732 {
733 m_footprintListBox->SetSelection( ii, true );
734 break;
735 }
736 }
737 }
738
741}
742
743
746{
747 int option = aFilter;
748
749 // Apply the filter accordingly
750 switch( aAction )
751 {
755 }
756
757 wxListEvent l_event;
758 OnSelectComponent( l_event );
759}
760
761
763{
764 if( !m_initialized )
765 return;
766
767 wxString filters, msg;
769
771 {
772 msg.Empty();
773
774 if( symbol )
775 {
776 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
777 {
778 if( msg.IsEmpty() )
779 msg += symbol->GetFootprintFilters()[ii];
780 else
781 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
782 }
783 }
784
785 filters += _( "Keywords" );
786
787 if( !msg.IsEmpty() )
788 filters += wxString::Format( wxT( " (%s)" ), msg );
789 }
790
792 {
793 msg.Empty();
794
795 if( symbol )
796 msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
797
798 if( !filters.IsEmpty() )
799 filters += wxT( ", " );
800
801 filters += _( "Pin Count" );
802
803 if( !msg.IsEmpty() )
804 filters += wxString::Format( wxT( " (%s)" ), msg );
805 }
806
808 {
810
811 if( !filters.IsEmpty() )
812 filters += wxT( ", " );
813
814 filters += _( "Library" );
815
816 if( !msg.IsEmpty() )
817 filters += wxString::Format( wxT( " (%s)" ), msg );
818 }
819
820 wxString textFilter = m_tcFilterString->GetValue();
821
822 if( !textFilter.IsEmpty() )
823 {
824 if( !filters.IsEmpty() )
825 filters += wxT( ", " );
826
827 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
828 }
829
830 if( filters.IsEmpty() )
831 msg = _( "No Filtering" );
832 else
833 msg.Printf( _( "Filtered by %s" ), filters );
834
835 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
836
837 SetStatusText( msg );
838
839
840 msg.Empty();
841 wxString footprintName = GetSelectedFootprint();
842
843 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
844
845 if( fp ) // can be NULL if no netlist loaded
846 {
847 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
848 fp->GetDesc(),
849 fp->GetKeywords() );
850 }
851
852 SetStatusText( msg, 1 );
853
854 msg.Empty();
855 wxString lib;
856
857 // Choose the footprint to get the information on
858 if( fp )
859 {
860 // Use the footprint in the footprint viewer
861 lib = fp->GetLibNickname();
862 }
864 {
865 // Use the footprint of the selected symbol
866 if( symbol )
867 lib = symbol->GetFPID().GetUniStringLibNickname();
868 }
870 {
871 // Use the library that is selected
873 }
874
875 // Extract the library information
877
878 if( fptbl->HasLibrary( lib ) )
879 msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
880 else
881 msg = wxString::Format( _( "Library location: unknown" ) );
882
883 SetStatusText( msg, 2 );
884}
885
886
888{
890
891 // Check if there are footprint libraries in the footprint library table.
892 if( !fptbl || !fptbl->GetLogicalLibs().size() )
893 {
894 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
895 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
896 return false;
897 }
898
899 WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
900
901 m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
902
905
906 return true;
907}
908
909
910void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
911{
912 if( m_netlist.IsEmpty() )
913 return;
914
915 std::string command = "$SELECT: ";
916
917 if( aClearSelectionOnly )
918 {
919 // Sending an empty list means clearing the selection.
920 if( Kiface().IsSingle() )
921 SendCommand( MSG_TO_SCH, command );
922 else
923 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
924
925 return;
926 }
927
928 int selection = m_symbolsListBox->GetSelection();
929
930 if( selection < 0 ) // Nothing selected
931 return;
932
933 if( m_netlist.GetComponent( selection ) == nullptr )
934 return;
935
936 // Now select the corresponding symbol on the schematic:
937 wxString ref = m_netlist.GetComponent( selection )->GetReference();
938
939 // The prefix 0,F before the reference is for selecting the symbol
940 // (one can select a pin with a different prefix)
941 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
942
943 if( Kiface().IsSingle() )
944 SendCommand( MSG_TO_SCH, command );
945 else
946 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
947}
948
949
950int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
951{
952 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
953 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
954
956
957 try
958 {
959 netlistReader.LoadNetlist();
960 }
961 catch( const IO_ERROR& ioe )
962 {
963 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
964 ioe.What().GetData() );
965 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
966 return 1;
967 }
968
969 // We also remove footprint name if it is "$noname" because this is a dummy name,
970 // not the actual name of the footprint.
971 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
972 {
973 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
975 }
976
977 // Sort symbols by reference:
979
980 return 0;
981}
982
983
985{
986 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
989}
990
991
993{
997
998 // Use same sorting algorithm as LIB_TREE_NODE::AssignIntrinsicRanks
999 struct library_sort
1000 {
1001 bool operator()( const wxString& lhs, const wxString& rhs ) const
1002 {
1003 return StrNumCmp( lhs, rhs, true ) < 0;
1004 }
1005 };
1006
1007 std::set<wxString, library_sort> pinnedMatches;
1008 std::set<wxString, library_sort> otherMatches;
1009
1011
1012 auto process =
1013 [&]( const wxString& aNickname )
1014 {
1015 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1016 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1017 {
1018 pinnedMatches.insert( aNickname );
1019 }
1020 else
1021 {
1022 otherMatches.insert( aNickname );
1023 }
1024 };
1025
1026
1027 if( tbl )
1028 {
1029 wxArrayString libNames;
1030
1031 std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
1032
1033 for( const wxString& libNickName : libNickNames )
1034 process( libNickName );
1035 }
1036
1037 for( const wxString& nickname : pinnedMatches )
1039
1040 for( const wxString& nickname : otherMatches )
1041 m_librariesListBox->AppendLine( nickname );
1042
1044}
1045
1046
1048{
1049 int selection = m_symbolsListBox->GetSelection();
1050
1051 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1052 return m_netlist.GetComponent( selection );
1053
1054 return nullptr;
1055}
1056
1057
1058void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1059{
1060 m_skipComponentSelect = aSkipUpdate;
1061
1062 if( aIndex < 0 )
1063 {
1065 }
1066 else if( aIndex < m_symbolsListBox->GetCount() )
1067 {
1069 m_symbolsListBox->SetSelection( aIndex );
1071 }
1072
1073 m_skipComponentSelect = false;
1074}
1075
1076
1077std::vector<unsigned int>
1079{
1080 std::vector<unsigned int> idx;
1081 int lastIdx;
1082
1083 // Make sure a netlist has been loaded and the box has contents
1084 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1085 return idx;
1086
1087 switch( aCriteria )
1088 {
1090 idx.resize( m_netlist.GetCount() );
1091 std::iota( idx.begin(), idx.end(), 0 );
1092 break;
1093
1095 // Check to see if anything is selected
1096 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1097 break;
1098
1099 // Get the symbols
1100 lastIdx = m_symbolsListBox->GetFirstSelected();
1101 idx.emplace_back( lastIdx );
1102
1103 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1104 while( lastIdx > 0 )
1105 {
1106 idx.emplace_back( lastIdx );
1107 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1108 }
1109 break;
1110
1112 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1113 {
1114 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1115 idx.emplace_back( i );
1116 }
1117 break;
1118
1120 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1121 {
1122 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1123 idx.emplace_back( i );
1124 }
1125 break;
1126
1127 default:
1128 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1129 }
1130
1131 return idx;
1132}
1133
1134
1136{
1137 // returns the Footprint Viewer frame, if exists, or NULL
1138 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1139 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1140}
1141
1142
1144{
1145 return GetFootprintViewerFrame();
1146}
1147
1148
1150{
1152 else if( m_symbolsListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_COMPONENT;
1153 else if( m_footprintListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_FOOTPRINT;
1155}
1156
1157
1159{
1160 switch( aLB )
1161 {
1165 default: break;
1166 }
1167}
1168
1169
1171{
1172 // returns the LIB_ID of the selected footprint in footprint listview
1173 // or a empty string
1175}
1176
1177
1178void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1179{
1180 switch( aNumber )
1181 {
1182 case 0: m_statusLine1->SetLabel( aText ); break;
1183 case 1: m_statusLine2->SetLabel( aText ); break;
1184 case 2: m_statusLine3->SetLabel( aText ); break;
1185 default: wxFAIL_MSG( wxT( "Invalid status row number" ) ); break;
1186 }
1187}
1188
1189
1191{
1194 DisplayStatus();
1195}
1196
1197
1199{
1200 const std::string& payload = mail.GetPayload();
1201
1202 switch( mail.Command() )
1203 {
1205 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1206 // widgets:
1207 m_cannotClose = true;
1208 readNetListAndFpFiles( payload );
1209 m_cannotClose = false;
1210
1211 /* @todo
1212 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1213 */
1214 break;
1215
1216 case MAIL_RELOAD_LIB:
1217 m_cannotClose = true;
1221 m_cannotClose = false;
1222 break;
1223
1224 default:
1225 ; // ignore most
1226 }
1227}
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:111
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:104
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION redo
Definition: actions.h:69
static TOOL_ACTION cut
Definition: actions.h:70
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: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:92
Handle actions that are shared between different applications.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:88
const wxString & GetReference() const
Definition: pcb_netlist.h:129
const wxString & GetValue() const
Definition: pcb_netlist.h:132
int GetPinCount() const
Definition: pcb_netlist.h:160
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:146
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:157
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:154
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:147
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
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.
Definition: cvpcb_control.h:34
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 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
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.
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
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.
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 GetKeywords()
wxString GetDesc() override
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:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
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:49
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:58
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.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.
Definition: kiway_holder.h:55
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:65
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:285
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:195
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:172
bool empty() const
Definition: lib_id.h:193
UTF8 Format() const
Definition: lib_id.cpp:118
const wxString GetUniStringLibNickname() const
Definition: lib_id.h:88
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
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:262
bool IsEmpty() const
Definition: pcb_netlist.h:252
void Clear()
Remove all components from the netlist.
Definition: pcb_netlist.h:257
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
Definition: pcb_netlist.h:270
void SortByReference()
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:689
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:72
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Definition: project_pcb.cpp:37
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:200
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:253
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:167
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:168
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:62
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
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:302
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()
Initialize 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:103
wxString wx_str() const
Definition: utf8.cpp:45
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:130
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
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 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:52
@ MAIL_SELECTION
Definition: mail_type.h:40
@ MAIL_RELOAD_LIB
Definition: mail_type.h:56
@ 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: unix/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: unix/app.cpp:79
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: wxgtk/ui.cpp:151
KICOMMON_API wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:92
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:131
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:100
static PGM_BASE * process
Definition: pgm_base.cpp:1070
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1073
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)
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