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
58#include <wx/statline.h>
59#include <wx/stattext.h>
60#include <wx/button.h>
61
62
63CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
64 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
65 wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "CvpcbFrame" ),
66 unityScale ),
67 m_mainToolBar( nullptr ),
68 m_footprintListBox( nullptr ),
69 m_librariesListBox( nullptr ),
70 m_symbolsListBox( nullptr ),
71 m_tcFilterString( nullptr ),
72 m_viewerPendingUpdate( false )
73{
74 m_modified = false;
75 m_cannotClose = false;
79 m_initialized = false;
80 m_aboutTitle = _( "Assign Footprints" );
81
82 // Give an icon
83 wxIcon icon;
84 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
85 SetIcon( icon );
86
87 SetAutoLayout( true );
88
90
91 setupTools();
95
98
101
104
106
107 m_auimgr.SetManagedWindow( this );
108
109 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
110
111 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
112 .Caption( _( "Footprint Libraries" ) )
113 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
114
115 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
116 .Caption( _( "Symbol : Footprint Assignments" ) ) );
117
118 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
119 .Caption( _( "Filtered Footprints" ) )
120 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
121
122 // Build the bottom panel, to display 2 status texts and the buttons:
123 auto bottomPanel = new wxPanel( this );
124 auto panelSizer = new wxBoxSizer( wxVERTICAL );
125
126 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
127 fgSizerStatus->SetFlexibleDirection( wxBOTH );
128 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
129
130 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
131 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
132
133 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
134 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
135
136 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
137 fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
138
139 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
140
141 m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
142 m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
143 m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
144
145 // Add buttons:
146 auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
147 auto sdbSizer = new wxStdDialogButtonSizer();
148
149 m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY,
150 _( "Apply, Save Schematic && Continue" ) );
151 buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
152
153 auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
154 sdbSizer->AddButton( sdbSizerOK );
155 auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
156 sdbSizer->AddButton( sdbSizerCancel );
157 sdbSizer->Realize();
158
159 buttonsSizer->Add( sdbSizer, 0, 0, 5 );
160 panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
161
162 bottomPanel->SetSizer( panelSizer );
163 bottomPanel->Fit();
164
165 sdbSizerOK->SetDefault();
167
168 m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
169
170 m_auimgr.Update();
171 m_initialized = true;
172
173 auto setPaneWidth =
174 [this]( wxAuiPaneInfo& pane, int width )
175 {
176 // wxAUI hack: force width by setting MinSize() and then Fixed()
177 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
178 pane.MinSize( width, -1 );
179 pane.BestSize( width, -1 );
180 pane.MaxSize( width, -1 );
181 pane.Fixed();
182 m_auimgr.Update();
183
184 // now make it resizable again
185 pane.MinSize( 20, -1 );
186 pane.Resizable();
187 m_auimgr.Update();
188 };
189
190 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
191 {
192 m_tcFilterString->ChangeValue( cfg->m_FilterString );
193
194 if( cfg->m_LibrariesWidth > 0 )
195 setPaneWidth( m_auimgr.GetPane( "Libraries" ), cfg->m_LibrariesWidth );
196
197 if( cfg->m_FootprintsWidth > 0 )
198 setPaneWidth( m_auimgr.GetPane( "Footprints" ), cfg->m_FootprintsWidth );
199 }
200
201 // Connect Events
203
204 // Start the main processing loop
205 m_toolManager->InvokeTool( "cvpcb.Control" );
206
207 m_filterTimer->StartOnce( 100 );
208
209 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
210}
211
212
214{
215 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
216 m_filterTimer->Stop();
217
218 // Shutdown all running tools
219 if( m_toolManager )
221
222 // Clean up the tool infrastructure
223 delete m_actions;
224 delete m_toolManager;
225 delete m_toolDispatcher;
226
227 m_auimgr.UnInit();
228}
229
230
232{
233 // Create the manager
234 m_actions = new CVPCB_ACTIONS();
236 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
238
239 // Register tools
244
246
247 // Even though these menus will open with the right-click, we treat them as a normal
248 // menu instead of a context menu because we don't care about their position and want
249 // to be able to tell the difference between a menu click and a hotkey activation.
250
251 // Create the context menu for the symbols list box
252 m_symbolsContextMenu = new ACTION_MENU( false, tool );
254 m_symbolsContextMenu->AppendSeparator();
258 m_symbolsContextMenu->AppendSeparator();
260
261 // Create the context menu for the footprint list box
262 m_footprintContextMenu = new ACTION_MENU( false, tool );
264}
265
266
268{
270
272 EDITOR_CONDITIONS cond( this );
273
274 wxASSERT( mgr );
275
276#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
277#define CHECK( x ) ACTION_CONDITIONS().Check( x )
278
283
284 auto compFilter =
285 [this] ( const SELECTION& )
286 {
288 };
289
290 auto libFilter =
291 [this] ( const SELECTION& )
292 {
294 };
295
296 auto pinFilter =
297 [this] ( const SELECTION& )
298 {
300 };
301
305
306#undef CHECK
307#undef ENABLE
308}
309
310
312{
313 // Connect the handlers to launch the context menus in the listboxes
314 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
315 [this]( wxMouseEvent& )
316 {
317 PopupMenu( m_footprintContextMenu );
318 } );
319
320 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
321 [this]( wxMouseEvent& )
322 {
323 PopupMenu( m_symbolsContextMenu );
324 } );
325
326 // Connect the handler for the save button
327 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
328 [this]( wxCommandEvent& )
329 {
330 // saveAssociations must be run immediately
332 } );
333
334 // Connect the handlers for the ok/cancel buttons
335 Bind( wxEVT_BUTTON,
336 [this]( wxCommandEvent& )
337 {
338 // saveAssociations must be run immediately, before running Close( true )
340 Close( true );
341 }, wxID_OK );
342 Bind( wxEVT_BUTTON,
343 [this]( wxCommandEvent& )
344 {
345 Close( false );
346 }, wxID_CANCEL );
347
348 // Connect the handlers for the close events
349 Bind( wxEVT_MENU,
350 [this]( wxCommandEvent& )
351 {
352 Close( false );
353 }, wxID_CLOSE );
354 Bind( wxEVT_MENU,
355 [this]( wxCommandEvent& )
356 {
357 Close( false );
358 }, wxID_EXIT );
359
360 // Toolbar events
361 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
362
363 // Just skip the resize events
364 Bind( wxEVT_SIZE,
365 []( wxSizeEvent& aEvent )
366 {
367 aEvent.Skip();
368 } );
369
370 // Attach the events to the tool dispatcher
372 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
373
374 m_filterTimer = new wxTimer( this );
375 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
376}
377
378
379bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
380{
381 if( m_modified )
382 {
383 // Shutdown blocks must be determined and vetoed as early as possible
385 && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
386 {
387 return false;
388 }
389
390 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
391 "Save changes?" ),
392 [&]() -> bool
393 {
394 return SaveFootprintAssociation( false );
395 } ) )
396 {
397 return false;
398 }
399 }
400
401 if( m_cannotClose )
402 return false;
403
404 return true;
405}
406
407
409{
411 GetFootprintViewerFrame()->Close( true );
412
413 m_modified = false;
414
415 // clear symbol selection in schematic:
417}
418
419
420void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
421{
422 // Called when changing the filter string in main toolbar.
423 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
424 // of available footprints which match the filter
425
426 m_filterTimer->StartOnce( 200 );
427}
428
429
431{
432 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
433 // insertion point here and then restore them at the end.
434 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
435 long pos = m_tcFilterString->GetInsertionPoint();
436
438 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
439
440 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
442
443 if( symbol && symbol->GetFPID().IsValid() )
445 else if( m_footprintListBox->GetSelection() >= 0 )
447
449
451
452 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
453 {
454 m_tcFilterString->SetFocus();
455 m_tcFilterString->SetInsertionPoint( pos );
456 }
457}
458
459
460void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
461{
463 return;
464
466 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
467
468 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
470
471 if( symbol && symbol->GetFPID().IsValid() )
473 else if( m_footprintListBox->GetSelection() >= 0 )
475
477
478 refreshAfterSymbolSearch( symbol );
479}
480
481
483{
485 {
486 Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
488 }
489}
490
491
493{
494 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
495 m_viewerPendingUpdate = false;
496
497 // On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
498 // are opened and refreshed when a new footprint is selected.
499 // If the listbox has the focus before selecting a new footprint, it will be forced
500 // after selection.
501 bool footprintListHasFocus = m_footprintListBox->HasFocus();
502 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
503
504 // If the footprint view window is displayed, update the footprint.
507
509
510 if( footprintListHasFocus )
511 m_footprintListBox->SetFocus();
512 else if( symbolListHasFocus )
513 m_symbolsListBox->SetFocus();
514}
515
516
518{
520
521 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
522
524}
525
526
528{
530
531 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
533 cfg->m_FilterString = m_tcFilterString->GetValue();
534
535 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
536 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
537}
538
539
541{
542 if( m_undoList.size() == 0 )
543 return;
544
545 CVPCB_UNDO_REDO_ENTRIES redoEntries;
546 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
547 m_undoList.pop_back();
548
549 // Iterate over the entries to undo
550 for( const auto& assoc : curEntry )
551 {
552 AssociateFootprint( assoc, true, false );
553 redoEntries.emplace_back( assoc.Reverse() );
554 }
555
556 // Add the redo entries to the redo stack
557 m_redoList.emplace_back( redoEntries );
558}
559
560
562{
563 if( m_redoList.size() == 0 )
564 return;
565
566 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
567 m_redoList.pop_back();
568
569 // Iterate over the entries to undo
570 bool firstAssoc = true;
571
572 for( const auto& assoc : curEntry )
573 {
574 AssociateFootprint( assoc, firstAssoc );
575 firstAssoc = false;
576 }
577}
578
579
580wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
581 const wxString& aValue, const wxString& aFootprint )
582{
583 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
584 // reason).
585 wxString desc = wxString::Format( wxT( "%3d " ), idx );
586
587 for( int ii = aReference.Length(); ii < 8; ++ii )
588 desc += wxS( " " );
589
590 desc += aReference + wxT( " - " );
591
592 for( int ii = aValue.Length(); ii < 16; ++ii )
593 desc += wxS( " " );
594
595 desc += aValue + wxT( " : " ) + aFootprint;
596
597 return desc;
598}
599
600
602 bool aNewEntry, bool aAddUndoItem )
603{
604 if( m_netlist.IsEmpty() )
605 return;
606
607 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
608
609 if( symbol == nullptr )
610 return;
611
612 LIB_ID fpid = aAssociation.GetNewFootprint();
613 LIB_ID oldFpid = symbol->GetFPID();
614
615 // Test for validity of the requested footprint
616 if( !fpid.empty() && !fpid.IsValid() )
617 {
618 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
619 fpid.Format().wx_str() );
620 DisplayErrorMessage( this, msg );
621 return;
622 }
623
624 const KIID& id = symbol->GetKIIDs().front();
625
626 // Set new footprint to all instances of the selected symbol
627 for( unsigned int idx : GetComponentIndices() )
628 {
629 COMPONENT* candidate = m_netlist.GetComponent( idx );
630 const std::vector<KIID>& kiids = candidate->GetKIIDs();
631
632 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
633 {
634 // Set the new footprint
635 candidate->SetFPID( fpid );
636
637 // create the new symbol description and set it
638 wxString description = formatSymbolDesc( idx + 1,
639 candidate->GetReference(),
640 candidate->GetValue(),
641 candidate->GetFPID().Format().wx_str() );
642 m_symbolsListBox->SetString( idx, description );
643
644 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
646 else
648 }
649 }
650
651 // Mark the data as being modified
652 m_modified = true;
653
654 // Update the statusbar and refresh the list
656 m_symbolsListBox->Refresh();
657
658 if( !aAddUndoItem )
659 return;
660
661 // Update the undo list
662 if ( aNewEntry )
663 {
664 // Create a new entry for this association
666 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
667 aAssociation.GetNewFootprint() ) );
668 m_undoList.emplace_back( newEntry );
669
670 // Clear the redo list
671 m_redoList.clear();
672 }
673 else
674 {
675 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
676 oldFpid,
677 aAssociation.GetNewFootprint() ) );
678 }
679
680}
681
682
683bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
684{
685 return true;
686}
687
688
690{
691 // Tell AuiMgr that objects are changed !
692 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
693 m_auimgr.Update(); // (could be not the case when starting CvPcb)
694
695 if( aSymbol == nullptr )
696 {
698 return;
699 }
700
701 // Preview of the already assigned footprint.
702 // Find the footprint that was already chosen for this aSymbol and select it,
703 // but only if the selection is made from the aSymbol list or the library list.
704 // If the selection is made from the footprint list, do not change the current
705 // selected footprint.
706 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
707 {
708 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
709
711
712 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
713 {
714 wxString candidateName;
715 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
716 msg.Trim( true );
717 msg.Trim( false );
718 candidateName = msg.AfterFirst( wxChar( ' ' ) );
719
720 if( footprintName.Cmp( candidateName ) == 0 )
721 {
722 m_footprintListBox->SetSelection( ii, true );
723 break;
724 }
725 }
726 }
727
730}
731
732
735{
736 int option = aFilter;
737
738 // Apply the filter accordingly
739 switch( aAction )
740 {
744 }
745
746 wxListEvent l_event;
747 OnSelectComponent( l_event );
748}
749
750
752{
753 if( !m_initialized )
754 return;
755
756 wxString filters, msg;
758
760 {
761 msg.Empty();
762
763 if( symbol )
764 {
765 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
766 {
767 if( msg.IsEmpty() )
768 msg += symbol->GetFootprintFilters()[ii];
769 else
770 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
771 }
772 }
773
774 filters += _( "Keywords" );
775
776 if( !msg.IsEmpty() )
777 filters += wxString::Format( wxT( " (%s)" ), msg );
778 }
779
781 {
782 msg.Empty();
783
784 if( symbol )
785 msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
786
787 if( !filters.IsEmpty() )
788 filters += wxT( ", " );
789
790 filters += _( "Pin Count" );
791
792 if( !msg.IsEmpty() )
793 filters += wxString::Format( wxT( " (%s)" ), msg );
794 }
795
797 {
799
800 if( !filters.IsEmpty() )
801 filters += wxT( ", " );
802
803 filters += _( "Library" );
804
805 if( !msg.IsEmpty() )
806 filters += wxString::Format( wxT( " (%s)" ), msg );
807 }
808
809 wxString textFilter = m_tcFilterString->GetValue();
810
811 if( !textFilter.IsEmpty() )
812 {
813 if( !filters.IsEmpty() )
814 filters += wxT( ", " );
815
816 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
817 }
818
819 if( filters.IsEmpty() )
820 msg = _( "No Filtering" );
821 else
822 msg.Printf( _( "Filtered by %s" ), filters );
823
824 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
825
826 SetStatusText( msg );
827
828
829 msg.Empty();
830 wxString footprintName = GetSelectedFootprint();
831
832 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
833
834 if( fp ) // can be NULL if no netlist loaded
835 {
836 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
837 fp->GetDescription(),
838 fp->GetKeywords() );
839 }
840
841 SetStatusText( msg, 1 );
842
843 msg.Empty();
844 wxString lib;
845
846 // Choose the footprint to get the information on
847 if( fp )
848 {
849 // Use the footprint in the footprint viewer
850 lib = fp->GetLibNickname();
851 }
853 {
854 // Use the footprint of the selected symbol
855 if( symbol )
856 lib = symbol->GetFPID().GetUniStringLibNickname();
857 }
859 {
860 // Use the library that is selected
862 }
863
864 // Extract the library information
865 FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
866
867 if( fptbl->HasLibrary( lib ) )
868 msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
869 else
870 msg = wxString::Format( _( "Library location: unknown" ) );
871
872 SetStatusText( msg, 2 );
873}
874
875
877{
878 FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
879
880 // Check if there are footprint libraries in the footprint library table.
881 if( !fptbl || !fptbl->GetLogicalLibs().size() )
882 {
883 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
884 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
885 return false;
886 }
887
888 WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
889
890 m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
891
894
895 return true;
896}
897
898
899void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
900{
901 if( m_netlist.IsEmpty() )
902 return;
903
904 std::string command = "$SELECT: ";
905
906 if( aClearSelectionOnly )
907 {
908 // Sending an empty list means clearing the selection.
909 if( Kiface().IsSingle() )
910 SendCommand( MSG_TO_SCH, command );
911 else
912 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
913
914 return;
915 }
916
917 int selection = m_symbolsListBox->GetSelection();
918
919 if( selection < 0 ) // Nothing selected
920 return;
921
922 if( m_netlist.GetComponent( selection ) == nullptr )
923 return;
924
925 // Now select the corresponding symbol on the schematic:
926 wxString ref = m_netlist.GetComponent( selection )->GetReference();
927
928 // The prefix 0,F before the reference is for selecting the symbol
929 // (one can select a pin with a different prefix)
930 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
931
932 if( Kiface().IsSingle() )
933 SendCommand( MSG_TO_SCH, command );
934 else
935 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
936}
937
938
939int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
940{
941 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
942 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
943
945
946 try
947 {
948 netlistReader.LoadNetlist();
949 }
950 catch( const IO_ERROR& ioe )
951 {
952 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
953 ioe.What().GetData() );
954 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
955 return 1;
956 }
957
958 // We also remove footprint name if it is "$noname" because this is a dummy name,
959 // not the actual name of the footprint.
960 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
961 {
962 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
964 }
965
966 // Sort symbols by reference:
968
969 return 0;
970}
971
972
974{
975 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
978}
979
980
982{
983 COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
986 std::set<wxString> pinnedMatches;
987 std::set<wxString> otherMatches;
989
990 auto process =
991 [&]( const wxString& aNickname )
992 {
993 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
994 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
995 {
996 pinnedMatches.insert( aNickname );
997 }
998 else
999 {
1000 otherMatches.insert( aNickname );
1001 }
1002 };
1003
1004
1005 if( tbl )
1006 {
1007 wxArrayString libNames;
1008
1009 std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
1010
1011 for( const wxString& libNickName : libNickNames )
1012 process( libNickName );
1013 }
1014
1015 for( const wxString& nickname : pinnedMatches )
1017
1018 for( const wxString& nickname : otherMatches )
1019 m_librariesListBox->AppendLine( nickname );
1020
1022}
1023
1024
1026{
1027 int selection = m_symbolsListBox->GetSelection();
1028
1029 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1030 return m_netlist.GetComponent( selection );
1031
1032 return nullptr;
1033}
1034
1035
1036void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1037{
1038 m_skipComponentSelect = aSkipUpdate;
1039
1040 if( aIndex < 0 )
1041 {
1043 }
1044 else if( aIndex < m_symbolsListBox->GetCount() )
1045 {
1047 m_symbolsListBox->SetSelection( aIndex );
1049 }
1050
1051 m_skipComponentSelect = false;
1052}
1053
1054
1055std::vector<unsigned int>
1057{
1058 std::vector<unsigned int> idx;
1059 int lastIdx;
1060
1061 // Make sure a netlist has been loaded and the box has contents
1062 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1063 return idx;
1064
1065 switch( aCriteria )
1066 {
1068 idx.resize( m_netlist.GetCount() );
1069 std::iota( idx.begin(), idx.end(), 0 );
1070 break;
1071
1073 // Check to see if anything is selected
1074 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1075 break;
1076
1077 // Get the symbols
1078 lastIdx = m_symbolsListBox->GetFirstSelected();
1079 idx.emplace_back( lastIdx );
1080
1081 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1082 while( lastIdx > 0 )
1083 {
1084 idx.emplace_back( lastIdx );
1085 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1086 }
1087 break;
1088
1090 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1091 {
1092 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1093 idx.emplace_back( i );
1094 }
1095 break;
1096
1098 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1099 {
1100 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1101 idx.emplace_back( i );
1102 }
1103 break;
1104
1105 default:
1106 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1107 }
1108
1109 return idx;
1110}
1111
1112
1114{
1115 // returns the Footprint Viewer frame, if exists, or NULL
1116 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1117 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1118}
1119
1120
1122{
1123 return GetFootprintViewerFrame();
1124}
1125
1126
1128{
1130 else if( m_symbolsListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_COMPONENT;
1131 else if( m_footprintListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_FOOTPRINT;
1133}
1134
1135
1137{
1138 switch( aLB )
1139 {
1143 default: break;
1144 }
1145}
1146
1147
1149{
1150 // returns the LIB_ID of the selected footprint in footprint listview
1151 // or a empty string
1153}
1154
1155
1156void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1157{
1158 switch( aNumber )
1159 {
1160 case 0: m_statusLine1->SetLabel( aText ); break;
1161 case 1: m_statusLine2->SetLabel( aText ); break;
1162 case 2: m_statusLine3->SetLabel( aText ); break;
1163 default: wxFAIL_MSG( "Invalid status row number" ); break;
1164 }
1165}
1166
1167
1169{
1172 DisplayStatus();
1173}
1174
1175
1177{
1178 const std::string& payload = mail.GetPayload();
1179
1180 switch( mail.Command() )
1181 {
1183 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1184 // widgets:
1185 m_cannotClose = true;
1186 readNetListAndFpFiles( payload );
1187 m_cannotClose = false;
1188 /* @todo
1189 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1190 */
1191 break;
1192 case MAIL_RELOAD_LIB:
1193 m_cannotClose = true;
1197 m_cannotClose = false;
1198 break;
1199 default:
1200 ; // ignore most
1201 }
1202}
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
static PGM_BASE * process
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:106
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION cut
Definition: actions.h:67
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h: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 GetDescription() override
wxString GetKeywords()
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
unsigned GetErrorCount() const
virtual bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)=0
Read all the footprints provided by the combination of aTable and aNickname.
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
void 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:39
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:57
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:49
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h: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:553
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()
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:69
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:341
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:158
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:165
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:166
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:57
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:145
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:289
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
const char * c_str() const
Definition: utf8.h:102
wxString wx_str() const
Definition: utf8.cpp: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:242
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:307
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:48
@ 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
wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:89
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:136
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:115
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