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 (C) 1992-2023 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
292
293 auto compFilter =
294 [this] ( const SELECTION& )
295 {
297 };
298
299 auto libFilter =
300 [this] ( const SELECTION& )
301 {
303 };
304
305 auto pinFilter =
306 [this] ( const SELECTION& )
307 {
309 };
310
314
315#undef CHECK
316#undef ENABLE
317}
318
319
321{
322 // Connect the handlers to launch the context menus in the listboxes
323 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
324 [this]( wxMouseEvent& )
325 {
326 PopupMenu( m_footprintContextMenu );
327 } );
328
329 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
330 [this]( wxMouseEvent& )
331 {
332 PopupMenu( m_symbolsContextMenu );
333 } );
334
335 // Connect the handler for the save button
336 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
337 [this]( wxCommandEvent& )
338 {
339 // saveAssociations must be run immediately
341 } );
342
343 // Connect the handlers for the ok/cancel buttons
344 Bind( wxEVT_BUTTON,
345 [this]( wxCommandEvent& )
346 {
347 // saveAssociations must be run immediately, before running Close( true )
349 Close( true );
350 }, wxID_OK );
351 Bind( wxEVT_BUTTON,
352 [this]( wxCommandEvent& )
353 {
354 Close( false );
355 }, wxID_CANCEL );
356
357 // Connect the handlers for the close events
358 Bind( wxEVT_MENU,
359 [this]( wxCommandEvent& )
360 {
361 Close( false );
362 }, wxID_CLOSE );
363 Bind( wxEVT_MENU,
364 [this]( wxCommandEvent& )
365 {
366 Close( false );
367 }, wxID_EXIT );
368
369 // Toolbar events
370 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
371
372 // Just skip the resize events
373 Bind( wxEVT_SIZE,
374 []( wxSizeEvent& aEvent )
375 {
376 aEvent.Skip();
377 } );
378
379 // Attach the events to the tool dispatcher
381 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
382
383 m_filterTimer = new wxTimer( this );
384 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
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
394 && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
395 {
396 return false;
397 }
398
399 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
400 "Save changes?" ),
401 [&]() -> bool
402 {
403 return SaveFootprintAssociation( false );
404 } ) )
405 {
406 return false;
407 }
408 }
409
410 if( m_cannotClose )
411 return false;
412
413 return true;
414}
415
416
418{
420 GetFootprintViewerFrame()->Close( true );
421
422 m_modified = false;
423
424 // clear symbol selection in schematic:
426}
427
428
429void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
430{
431 // Called when changing the filter string in main toolbar.
432 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
433 // of available footprints which match the filter
434
435 m_filterTimer->StartOnce( 200 );
436}
437
438
440{
441 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
442 // insertion point here and then restore them at the end.
443 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
444 long pos = m_tcFilterString->GetInsertionPoint();
445
447 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
448
449 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
451
452 if( symbol && symbol->GetFPID().IsValid() )
454 else if( m_footprintListBox->GetSelection() >= 0 )
456
458
460
461 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
462 {
463 m_tcFilterString->SetFocus();
464 m_tcFilterString->SetInsertionPoint( pos );
465 }
466}
467
468
469void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
470{
472 return;
473
475 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
476
477 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
479
480 if( symbol && symbol->GetFPID().IsValid() )
482 else if( m_footprintListBox->GetSelection() >= 0 )
484
486
487 refreshAfterSymbolSearch( symbol );
488}
489
490
492{
494 {
495 Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
497 }
498}
499
500
502{
503 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
504 m_viewerPendingUpdate = false;
505
506 // On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
507 // are opened and refreshed when a new footprint is selected.
508 // If the listbox has the focus before selecting a new footprint, it will be forced
509 // after selection.
510 bool footprintListHasFocus = m_footprintListBox->HasFocus();
511 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
512
513 // If the footprint view window is displayed, update the footprint.
516
518
519 if( footprintListHasFocus )
520 m_footprintListBox->SetFocus();
521 else if( symbolListHasFocus )
522 m_symbolsListBox->SetFocus();
523}
524
525
527{
529
530 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
531
533}
534
535
537{
539
540 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
542 cfg->m_FilterString = m_tcFilterString->GetValue();
543
544 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
545 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
546}
547
548
550{
551 if( m_undoList.size() == 0 )
552 return;
553
554 CVPCB_UNDO_REDO_ENTRIES redoEntries;
555 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
556 m_undoList.pop_back();
557
558 // Iterate over the entries to undo
559 for( const auto& assoc : curEntry )
560 {
561 AssociateFootprint( assoc, true, false );
562 redoEntries.emplace_back( assoc.Reverse() );
563 }
564
565 // Add the redo entries to the redo stack
566 m_redoList.emplace_back( redoEntries );
567}
568
569
571{
572 if( m_redoList.size() == 0 )
573 return;
574
575 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
576 m_redoList.pop_back();
577
578 // Iterate over the entries to undo
579 bool firstAssoc = true;
580
581 for( const auto& assoc : curEntry )
582 {
583 AssociateFootprint( assoc, firstAssoc );
584 firstAssoc = false;
585 }
586}
587
588
589wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
590 const wxString& aValue, const wxString& aFootprint )
591{
592 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
593 // reason).
594 wxString desc = wxString::Format( wxT( "%3d " ), idx );
595
596 for( int ii = aReference.Length(); ii < 8; ++ii )
597 desc += wxS( " " );
598
599 desc += aReference + wxT( " - " );
600
601 for( int ii = aValue.Length(); ii < 16; ++ii )
602 desc += wxS( " " );
603
604 desc += aValue + wxT( " : " ) + aFootprint;
605
606 return desc;
607}
608
609
611 bool aNewEntry, bool aAddUndoItem )
612{
613 if( m_netlist.IsEmpty() )
614 return;
615
616 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
617
618 if( symbol == nullptr )
619 return;
620
621 LIB_ID fpid = aAssociation.GetNewFootprint();
622 LIB_ID oldFpid = symbol->GetFPID();
623
624 // Test for validity of the requested footprint
625 if( !fpid.empty() && !fpid.IsValid() )
626 {
627 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
628 fpid.Format().wx_str() );
629 DisplayErrorMessage( this, msg );
630 return;
631 }
632
633 const KIID& id = symbol->GetKIIDs().front();
634
635 // Set new footprint to all instances of the selected symbol
636 for( unsigned int idx : GetComponentIndices() )
637 {
638 COMPONENT* candidate = m_netlist.GetComponent( idx );
639 const std::vector<KIID>& kiids = candidate->GetKIIDs();
640
641 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
642 {
643 // Set the new footprint
644 candidate->SetFPID( fpid );
645
646 // create the new symbol description and set it
647 wxString description = formatSymbolDesc( idx + 1,
648 candidate->GetReference(),
649 candidate->GetValue(),
650 candidate->GetFPID().Format().wx_str() );
651 m_symbolsListBox->SetString( idx, description );
652
653 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
655 else
657 }
658 }
659
660 // Mark the data as being modified
661 m_modified = true;
662
663 // Update the statusbar and refresh the list
665 m_symbolsListBox->Refresh();
666
667 if( !aAddUndoItem )
668 return;
669
670 // Update the undo list
671 if ( aNewEntry )
672 {
673 // Create a new entry for this association
675 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
676 aAssociation.GetNewFootprint() ) );
677 m_undoList.emplace_back( newEntry );
678
679 // Clear the redo list
680 m_redoList.clear();
681 }
682 else
683 {
684 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
685 oldFpid,
686 aAssociation.GetNewFootprint() ) );
687 }
688
689}
690
691
692bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
693{
694 return true;
695}
696
697
699{
700 // Tell AuiMgr that objects are changed !
701 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
702 m_auimgr.Update(); // (could be not the case when starting CvPcb)
703
704 if( aSymbol == nullptr )
705 {
707 return;
708 }
709
710 // Preview of the already assigned footprint.
711 // Find the footprint that was already chosen for this aSymbol and select it,
712 // but only if the selection is made from the aSymbol list or the library list.
713 // If the selection is made from the footprint list, do not change the current
714 // selected footprint.
715 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
716 {
717 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
718
720
721 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
722 {
723 wxString candidateName;
724 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
725 msg.Trim( true );
726 msg.Trim( false );
727 candidateName = msg.AfterFirst( wxChar( ' ' ) );
728
729 if( footprintName.Cmp( candidateName ) == 0 )
730 {
731 m_footprintListBox->SetSelection( ii, true );
732 break;
733 }
734 }
735 }
736
739}
740
741
744{
745 int option = aFilter;
746
747 // Apply the filter accordingly
748 switch( aAction )
749 {
753 }
754
755 wxListEvent l_event;
756 OnSelectComponent( l_event );
757}
758
759
761{
762 if( !m_initialized )
763 return;
764
765 wxString filters, msg;
767
769 {
770 msg.Empty();
771
772 if( symbol )
773 {
774 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
775 {
776 if( msg.IsEmpty() )
777 msg += symbol->GetFootprintFilters()[ii];
778 else
779 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
780 }
781 }
782
783 filters += _( "Keywords" );
784
785 if( !msg.IsEmpty() )
786 filters += wxString::Format( wxT( " (%s)" ), msg );
787 }
788
790 {
791 msg.Empty();
792
793 if( symbol )
794 msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
795
796 if( !filters.IsEmpty() )
797 filters += wxT( ", " );
798
799 filters += _( "Pin Count" );
800
801 if( !msg.IsEmpty() )
802 filters += wxString::Format( wxT( " (%s)" ), msg );
803 }
804
806 {
808
809 if( !filters.IsEmpty() )
810 filters += wxT( ", " );
811
812 filters += _( "Library" );
813
814 if( !msg.IsEmpty() )
815 filters += wxString::Format( wxT( " (%s)" ), msg );
816 }
817
818 wxString textFilter = m_tcFilterString->GetValue();
819
820 if( !textFilter.IsEmpty() )
821 {
822 if( !filters.IsEmpty() )
823 filters += wxT( ", " );
824
825 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
826 }
827
828 if( filters.IsEmpty() )
829 msg = _( "No Filtering" );
830 else
831 msg.Printf( _( "Filtered by %s" ), filters );
832
833 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
834
835 SetStatusText( msg );
836
837
838 msg.Empty();
839 wxString footprintName = GetSelectedFootprint();
840
841 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
842
843 if( fp ) // can be NULL if no netlist loaded
844 {
845 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
846 fp->GetDesc(),
847 fp->GetKeywords() );
848 }
849
850 SetStatusText( msg, 1 );
851
852 msg.Empty();
853 wxString lib;
854
855 // Choose the footprint to get the information on
856 if( fp )
857 {
858 // Use the footprint in the footprint viewer
859 lib = fp->GetLibNickname();
860 }
862 {
863 // Use the footprint of the selected symbol
864 if( symbol )
865 lib = symbol->GetFPID().GetUniStringLibNickname();
866 }
868 {
869 // Use the library that is selected
871 }
872
873 // Extract the library information
875
876 if( fptbl->HasLibrary( lib ) )
877 msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
878 else
879 msg = wxString::Format( _( "Library location: unknown" ) );
880
881 SetStatusText( msg, 2 );
882}
883
884
886{
888
889 // Check if there are footprint libraries in the footprint library table.
890 if( !fptbl || !fptbl->GetLogicalLibs().size() )
891 {
892 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
893 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
894 return false;
895 }
896
897 WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
898
899 m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
900
903
904 return true;
905}
906
907
908void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
909{
910 if( m_netlist.IsEmpty() )
911 return;
912
913 std::string command = "$SELECT: ";
914
915 if( aClearSelectionOnly )
916 {
917 // Sending an empty list means clearing the selection.
918 if( Kiface().IsSingle() )
919 SendCommand( MSG_TO_SCH, command );
920 else
921 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
922
923 return;
924 }
925
926 int selection = m_symbolsListBox->GetSelection();
927
928 if( selection < 0 ) // Nothing selected
929 return;
930
931 if( m_netlist.GetComponent( selection ) == nullptr )
932 return;
933
934 // Now select the corresponding symbol on the schematic:
935 wxString ref = m_netlist.GetComponent( selection )->GetReference();
936
937 // The prefix 0,F before the reference is for selecting the symbol
938 // (one can select a pin with a different prefix)
939 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
940
941 if( Kiface().IsSingle() )
942 SendCommand( MSG_TO_SCH, command );
943 else
944 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
945}
946
947
948int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
949{
950 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
951 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
952
954
955 try
956 {
957 netlistReader.LoadNetlist();
958 }
959 catch( const IO_ERROR& ioe )
960 {
961 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
962 ioe.What().GetData() );
963 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
964 return 1;
965 }
966
967 // We also remove footprint name if it is "$noname" because this is a dummy name,
968 // not the actual name of the footprint.
969 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
970 {
971 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
973 }
974
975 // Sort symbols by reference:
977
978 return 0;
979}
980
981
983{
984 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
987}
988
989
991{
995
996 // Use same sorting algorithm as LIB_TREE_NODE::AssignIntrinsicRanks
997 struct library_sort
998 {
999 bool operator()( const wxString& lhs, const wxString& rhs ) const
1000 {
1001 return StrNumCmp( lhs, rhs, true ) < 0;
1002 }
1003 };
1004
1005 std::set<wxString, library_sort> pinnedMatches;
1006 std::set<wxString, library_sort> otherMatches;
1007
1009
1010 auto process =
1011 [&]( const wxString& aNickname )
1012 {
1013 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1014 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1015 {
1016 pinnedMatches.insert( aNickname );
1017 }
1018 else
1019 {
1020 otherMatches.insert( aNickname );
1021 }
1022 };
1023
1024
1025 if( tbl )
1026 {
1027 wxArrayString libNames;
1028
1029 std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
1030
1031 for( const wxString& libNickName : libNickNames )
1032 process( libNickName );
1033 }
1034
1035 for( const wxString& nickname : pinnedMatches )
1037
1038 for( const wxString& nickname : otherMatches )
1039 m_librariesListBox->AppendLine( nickname );
1040
1042}
1043
1044
1046{
1047 int selection = m_symbolsListBox->GetSelection();
1048
1049 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1050 return m_netlist.GetComponent( selection );
1051
1052 return nullptr;
1053}
1054
1055
1056void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1057{
1058 m_skipComponentSelect = aSkipUpdate;
1059
1060 if( aIndex < 0 )
1061 {
1063 }
1064 else if( aIndex < m_symbolsListBox->GetCount() )
1065 {
1067 m_symbolsListBox->SetSelection( aIndex );
1069 }
1070
1071 m_skipComponentSelect = false;
1072}
1073
1074
1075std::vector<unsigned int>
1077{
1078 std::vector<unsigned int> idx;
1079 int lastIdx;
1080
1081 // Make sure a netlist has been loaded and the box has contents
1082 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1083 return idx;
1084
1085 switch( aCriteria )
1086 {
1088 idx.resize( m_netlist.GetCount() );
1089 std::iota( idx.begin(), idx.end(), 0 );
1090 break;
1091
1093 // Check to see if anything is selected
1094 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1095 break;
1096
1097 // Get the symbols
1098 lastIdx = m_symbolsListBox->GetFirstSelected();
1099 idx.emplace_back( lastIdx );
1100
1101 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1102 while( lastIdx > 0 )
1103 {
1104 idx.emplace_back( lastIdx );
1105 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1106 }
1107 break;
1108
1110 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1111 {
1112 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1113 idx.emplace_back( i );
1114 }
1115 break;
1116
1118 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1119 {
1120 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1121 idx.emplace_back( i );
1122 }
1123 break;
1124
1125 default:
1126 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1127 }
1128
1129 return idx;
1130}
1131
1132
1134{
1135 // returns the Footprint Viewer frame, if exists, or NULL
1136 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1137 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1138}
1139
1140
1142{
1143 return GetFootprintViewerFrame();
1144}
1145
1146
1148{
1150 else if( m_symbolsListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_COMPONENT;
1151 else if( m_footprintListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_FOOTPRINT;
1153}
1154
1155
1157{
1158 switch( aLB )
1159 {
1163 default: break;
1164 }
1165}
1166
1167
1169{
1170 // returns the LIB_ID of the selected footprint in footprint listview
1171 // or a empty string
1173}
1174
1175
1176void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1177{
1178 switch( aNumber )
1179 {
1180 case 0: m_statusLine1->SetLabel( aText ); break;
1181 case 1: m_statusLine2->SetLabel( aText ); break;
1182 case 2: m_statusLine3->SetLabel( aText ); break;
1183 default: wxFAIL_MSG( "Invalid status row number" ); break;
1184 }
1185}
1186
1187
1189{
1192 DisplayStatus();
1193}
1194
1195
1197{
1198 const std::string& payload = mail.GetPayload();
1199
1200 switch( mail.Command() )
1201 {
1203 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1204 // widgets:
1205 m_cannotClose = true;
1206 readNetListAndFpFiles( payload );
1207 m_cannotClose = false;
1208 /* @todo
1209 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1210 */
1211 break;
1212 case MAIL_RELOAD_LIB:
1213 m_cannotClose = true;
1217 m_cannotClose = false;
1218 break;
1219 default:
1220 ; // ignore most
1221 }
1222}
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:70
static TOOL_ACTION copy
Definition: actions.h:69
static TOOL_ACTION undo
Definition: actions.h:66
static TOOL_ACTION redo
Definition: actions.h:67
static TOOL_ACTION cut
Definition: actions.h:68
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:92
Handle actions that are shared between different applications.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:86
const wxString & GetReference() const
Definition: pcb_netlist.h:127
const wxString & GetValue() const
Definition: pcb_netlist.h:130
int GetPinCount() const
Definition: pcb_netlist.h:158
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:144
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:155
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:152
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:145
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
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
void ReCreateMenuBar()
Recreates 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:279
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:196
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:244
bool IsEmpty() const
Definition: pcb_netlist.h:234
void Clear()
Remove all components from the netlist.
Definition: pcb_netlist.h:239
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
Definition: pcb_netlist.h:252
void SortByReference()
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:70
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:166
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()
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: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:121
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:186
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: gtk/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:79
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:94
KICOMMON_API wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:92
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:130
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:1057
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
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