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>
31#include <kiface_base.h>
32#include <kiplatform/app.h>
33#include <kiway_mail.h>
34#include <string_utils.h>
36#include <netlist_reader/netlist_reader.h>
38#include <numeric>
39#include <richio.h>
40#include <tool/action_manager.h>
41#include <tool/action_toolbar.h>
42#include <tool/common_control.h>
45#include <tool/tool_manager.h>
46#include <widgets/kistatusbar.h>
48
49#include <cvpcb_association.h>
50#include <cvpcb_id.h>
51#include <cvpcb_mainframe.h>
56#include <footprint_info_impl.h>
57#include <kiplatform/ui.h>
58#include <listboxes.h>
59#include <tools/cvpcb_actions.h>
61#include <tools/cvpcb_control.h>
62#include <project_pcb.h>
63#include <toolbars_cvpcb.h>
64
65#include <wx/statline.h>
66#include <wx/stattext.h>
67#include <wx/button.h>
68#include <wx/msgdlg.h>
69#include <wx/ffile.h>
70
71
72CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
73 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
74 wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "CvpcbFrame" ),
75 unityScale ),
76 m_footprintListBox( nullptr ),
77 m_librariesListBox( nullptr ),
78 m_symbolsListBox( nullptr ),
79 m_tcFilterString( nullptr ),
81{
82 m_modified = false;
83 m_cannotClose = false;
87 m_initialized = false;
88 m_aboutTitle = _( "Assign Footprints" );
89
90 // Give an icon
91 wxIcon icon;
92 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
93 SetIcon( icon );
94
95 SetAutoLayout( true );
96
98
99 setupTools();
101
106
109
112
115
117
118 m_auimgr.SetManagedWindow( this );
119
120 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" ).Top().Layer(6) );
121
122 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
123 .Caption( _( "Footprint Libraries" ) )
124 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
125
126 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
127 .Caption( _( "Symbol : Footprint Assignments" ) ) );
128
129 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
130 .Caption( _( "Filtered Footprints" ) )
131 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
132
133 // Build the bottom panel, to display 2 status texts and the buttons:
134 auto bottomPanel = new wxPanel( this );
135 auto panelSizer = new wxBoxSizer( wxVERTICAL );
136
137 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
138 fgSizerStatus->SetFlexibleDirection( wxBOTH );
139 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
140
141 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
142 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
143
144 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
145 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
146
147 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
148 fgSizerStatus->Add( m_statusLine3, 0, 0, 5 );
149
150 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
151
152 m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
153 m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
154 m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
155
156 // Add buttons:
157 auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
158 auto sdbSizer = new wxStdDialogButtonSizer();
159
160 m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY, _( "Apply, Save Schematic && Continue" ) );
161 buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
162
163 auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
164 sdbSizer->AddButton( sdbSizerOK );
165 auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
166 sdbSizer->AddButton( sdbSizerCancel );
167 sdbSizer->Realize();
168
169 buttonsSizer->Add( sdbSizer, 0, 0, 5 );
170 panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
171
172 bottomPanel->SetSizer( panelSizer );
173 bottomPanel->Fit();
174
175 sdbSizerOK->SetDefault();
177
178 m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
179
180 m_auimgr.Update();
181 m_initialized = true;
182
183 auto setPaneWidth =
184 [this]( wxAuiPaneInfo& pane, int width )
185 {
186 // wxAUI hack: force width by setting MinSize() and then Fixed()
187 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
188 pane.MinSize( width, -1 );
189 pane.BestSize( width, -1 );
190 pane.MaxSize( width, -1 );
191 pane.Fixed();
192 m_auimgr.Update();
193
194 // now make it resizable again
195 pane.MinSize( 20, -1 );
196 pane.Resizable();
197 m_auimgr.Update();
198 };
199
200 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
201 {
202 m_tcFilterString->ChangeValue( cfg->m_FilterString );
203
204 if( cfg->m_LibrariesWidth > 0 )
205 setPaneWidth( m_auimgr.GetPane( "Libraries" ), cfg->m_LibrariesWidth );
206
207 if( cfg->m_FootprintsWidth > 0 )
208 setPaneWidth( m_auimgr.GetPane( "Footprints" ), cfg->m_FootprintsWidth );
209 }
210
211 // Connect Events
213
214 // Toolbar events
215 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
216
217 // Attach the events to the tool dispatcher
219 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
220
221 m_filterTimer = new wxTimer( this );
222 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
223
224 // Start the main processing loop
225 m_toolManager->InvokeTool( "cvpcb.Control" );
226
227 m_filterTimer->StartOnce( 100 );
228
229 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
230}
231
232
234{
235 Unbind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
237 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
238
239 Unbind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
240 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
241
242 // Clean up the tool infrastructure
243 delete m_actions;
244 delete m_toolManager;
245 delete m_toolDispatcher;
246 delete m_FootprintsList;
247
248 m_auimgr.UnInit();
249}
250
251
253{
254 // Create the manager
255 m_actions = new CVPCB_ACTIONS();
257 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
259
260 // Register tools
261 m_toolManager->RegisterTool( new COMMON_CONTROL );
262 m_toolManager->RegisterTool( new CVPCB_CONTROL );
263 m_toolManager->RegisterTool( new CVPCB_ASSOCIATION_TOOL );
264 m_toolManager->InitTools();
265
266 CVPCB_CONTROL* tool = m_toolManager->GetTool<CVPCB_CONTROL>();
267
268 // Even though these menus will open with the right-click, we treat them as a normal
269 // menu instead of a context menu because we don't care about their position and want
270 // to be able to tell the difference between a menu click and a hotkey activation.
271
272 // Create the context menu for the symbols list box
273 m_symbolsContextMenu = new ACTION_MENU( false, tool );
275 m_symbolsContextMenu->AppendSeparator();
279 m_symbolsContextMenu->AppendSeparator();
281
282 // Create the context menu for the footprint list box
283 m_footprintContextMenu = new ACTION_MENU( false, tool );
285}
286
287
289{
291
292 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
293 EDITOR_CONDITIONS cond( this );
294
295 wxASSERT( mgr );
296
297#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
298#define CHECK( x ) ACTION_CONDITIONS().Check( x )
299
304
305 auto compFilter =
306 [this] ( const SELECTION& )
307 {
309 };
310
311 auto libFilter =
312 [this] ( const SELECTION& )
313 {
315 };
316
317 auto pinFilter =
318 [this] ( const SELECTION& )
319 {
321 };
322
326
327#undef CHECK
328#undef ENABLE
329}
330
331
333{
334 // Connect the handlers to launch the context menus in the listboxes
335 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
336 [this]( wxMouseEvent& )
337 {
338 PopupMenu( m_footprintContextMenu );
339 } );
340
341 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
342 [this]( wxMouseEvent& )
343 {
344 PopupMenu( m_symbolsContextMenu );
345 } );
346
347 // Connect the handler for the save button
348 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
349 [this]( wxCommandEvent& )
350 {
351 // saveAssociations must be run immediately
353 } );
354
355 // Connect the handlers for the ok/cancel buttons
356 Bind( wxEVT_BUTTON,
357 [this]( wxCommandEvent& )
358 {
359 // saveAssociations must be run immediately, before running Close( true )
361 Close( true );
362 }, wxID_OK );
363
364 Bind( wxEVT_BUTTON,
365 [this]( wxCommandEvent& )
366 {
367 Close( false );
368 }, wxID_CANCEL );
369
370 // Connect the handlers for the close events
371 Bind( wxEVT_MENU,
372 [this]( wxCommandEvent& )
373 {
374 Close( false );
375 }, wxID_CLOSE );
376 Bind( wxEVT_MENU,
377 [this]( wxCommandEvent& )
378 {
379 Close( false );
380 }, wxID_EXIT );
381
382 // Just skip the resize events
383 Bind( wxEVT_SIZE,
384 []( wxSizeEvent& aEvent )
385 {
386 aEvent.Skip();
387 } );
388}
389
390
391bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
392{
393 if( m_modified )
394 {
395 // Shutdown blocks must be determined and vetoed as early as possible
396 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
397 return false;
398
399 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. Save changes?" ),
400 [&]() -> bool
401 {
402 return SaveFootprintAssociation( false );
403 } ) )
404 {
405 return false;
406 }
407 }
408
409 if( m_cannotClose )
410 return false;
411
412 return true;
413}
414
415
417{
418 m_symbolsListBox->Shutdown();
419 m_footprintListBox->Shutdown();
420
422 GetFootprintViewerFrame()->Close( true );
423
424 m_modified = false;
425
426 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
427 m_filterTimer->Stop();
428
429 // Shutdown all running tools
430 if( m_toolManager )
431 m_toolManager->ShutdownAllTools();
432
433 // clear symbol selection in schematic:
435}
436
437
438void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
439{
440 // Called when changing the filter string in main toolbar.
441 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
442 // of available footprints which match the filter
443
444 m_filterTimer->StartOnce( 200 );
445}
446
447
449{
450 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
451 // insertion point here and then restore them at the end.
452 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
453 long pos = m_tcFilterString->GetInsertionPoint();
454
456 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
457
458 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
460
461 if( symbol && symbol->GetFPID().IsValid() )
462 m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
463 else if( m_footprintListBox->GetSelection() >= 0 )
464 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
465
467
469
470 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
471 {
472 m_tcFilterString->SetFocus();
473 m_tcFilterString->SetInsertionPoint( pos );
474 }
475}
476
477
478void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
479{
481 return;
482
484 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
485
486 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
488
489 if( symbol && symbol->GetFPID().IsValid() )
490 m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
491 else if( m_footprintListBox->GetSelection() >= 0 )
492 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
493
495
496 refreshAfterSymbolSearch( symbol );
497}
498
499
508
509
511{
512 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
513 m_viewerPendingUpdate = false;
514
515 // On some platforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
516 // are opened and refreshed when a new footprint is selected.
517 // If the listbox has the focus before selecting a new footprint, it will be forced
518 // after selection.
519 bool footprintListHasFocus = m_footprintListBox->HasFocus();
520 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
521
522 // If the footprint view window is displayed, update the footprint.
525
527
528 if( footprintListHasFocus )
529 m_footprintListBox->SetFocus();
530 else if( symbolListHasFocus )
531 m_symbolsListBox->SetFocus();
532}
533
534
536{
538
539 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
540 m_filteringOptions = cfg->m_FilterFlags;
541}
542
543
545{
547
548 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
549 {
550 cfg->m_FilterFlags = m_filteringOptions;
551 cfg->m_FilterString = m_tcFilterString->GetValue();
552
553 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
554 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
555 }
556}
557
558
560{
561 if( m_undoList.size() == 0 )
562 return;
563
564 CVPCB_UNDO_REDO_ENTRIES redoEntries;
565 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
566 m_undoList.pop_back();
567
568 // Iterate over the entries to undo
569 for( const auto& assoc : curEntry )
570 {
571 AssociateFootprint( assoc, true, false );
572 redoEntries.emplace_back( assoc.Reverse() );
573 }
574
575 // Add the redo entries to the redo stack
576 m_redoList.emplace_back( redoEntries );
577}
578
579
581{
582 if( m_redoList.size() == 0 )
583 return;
584
585 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
586 m_redoList.pop_back();
587
588 // Iterate over the entries to undo
589 bool firstAssoc = true;
590
591 for( const auto& assoc : curEntry )
592 {
593 AssociateFootprint( assoc, firstAssoc );
594 firstAssoc = false;
595 }
596}
597
598
599wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
600 const wxString& aValue, const wxString& aFootprint )
601{
602 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
603 // reason).
604 wxString desc = wxString::Format( wxT( "%3d " ), idx );
605
606 for( int ii = aReference.Length(); ii < 8; ++ii )
607 desc += wxS( " " );
608
609 desc += aReference + wxT( " - " );
610
611 for( int ii = aValue.Length(); ii < 16; ++ii )
612 desc += wxS( " " );
613
614 desc += aValue + wxT( " : " ) + aFootprint;
615
616 return desc;
617}
618
619
621 bool aNewEntry, bool aAddUndoItem )
622{
623 if( m_netlist.IsEmpty() )
624 return;
625
626 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
627
628 if( symbol == nullptr )
629 return;
630
631 LIB_ID fpid = aAssociation.GetNewFootprint();
632 LIB_ID oldFpid = symbol->GetFPID();
633
634 // Test for validity of the requested footprint
635 if( !fpid.empty() && !fpid.IsValid() )
636 {
637 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
638 fpid.Format().wx_str() );
639 DisplayErrorMessage( this, msg );
640 return;
641 }
642
643 const KIID& id = symbol->GetKIIDs().front();
644
645 // Set new footprint to all instances of the selected symbol
646 for( unsigned int idx : GetComponentIndices() )
647 {
648 COMPONENT* candidate = m_netlist.GetComponent( idx );
649 const std::vector<KIID>& kiids = candidate->GetKIIDs();
650
651 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
652 {
653 // Set the new footprint
654 candidate->SetFPID( fpid );
655
656 // create the new symbol description and set it
657 wxString description = formatSymbolDesc( idx + 1,
658 candidate->GetReference(),
659 candidate->GetValue(),
660 candidate->GetFPID().Format().wx_str() );
661 m_symbolsListBox->SetString( idx, description );
662
663 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
664 m_symbolsListBox->AppendWarning( idx );
665 else
666 m_symbolsListBox->RemoveWarning( idx );
667 }
668 }
669
670 // Mark the data as being modified
671 m_modified = true;
672
673 // Update the statusbar and refresh the list
675 m_symbolsListBox->Refresh();
676
677 if( !aAddUndoItem )
678 return;
679
680 // Update the undo list
681 if ( aNewEntry )
682 {
683 // Create a new entry for this association
685 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
686 aAssociation.GetNewFootprint() ) );
687 m_undoList.emplace_back( newEntry );
688
689 // Clear the redo list
690 m_redoList.clear();
691 }
692 else
693 {
694 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
695 oldFpid,
696 aAssociation.GetNewFootprint() ) );
697 }
698
699}
700
701
702bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
703{
704 return true;
705}
706
707
709{
710 // Tell AuiMgr that objects are changed !
711 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
712 m_auimgr.Update(); // (could be not the case when starting CvPcb)
713
714 if( aSymbol == nullptr )
715 {
717 return;
718 }
719
720 // Preview of the already assigned footprint.
721 // Find the footprint that was already chosen for this aSymbol and select it,
722 // but only if the selection is made from the aSymbol list or the library list.
723 // If the selection is made from the footprint list, do not change the current
724 // selected footprint.
725 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
726 {
727 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
728
729 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
730
731 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
732 {
733 wxString candidateName;
734 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
735 msg.Trim( true );
736 msg.Trim( false );
737 candidateName = msg.AfterFirst( wxChar( ' ' ) );
738
739 if( footprintName.Cmp( candidateName ) == 0 )
740 {
741 m_footprintListBox->SetSelection( ii, true );
742 break;
743 }
744 }
745 }
746
749}
750
751
754{
755 int option = aFilter;
756
757 // Apply the filter accordingly
758 switch( aAction )
759 {
763 }
764
765 wxListEvent l_event;
766 OnSelectComponent( l_event );
767}
768
769
771{
772 if( !m_initialized )
773 return;
774
775 wxString filters, msg;
777
779 {
780 msg.Empty();
781
782 if( symbol )
783 {
784 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
785 {
786 if( msg.IsEmpty() )
787 msg += symbol->GetFootprintFilters()[ii];
788 else
789 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
790 }
791 }
792
793 filters += _( "Keywords" );
794
795 if( !msg.IsEmpty() )
796 filters += wxString::Format( wxT( " (%s)" ), msg );
797 }
798
800 {
801 msg.Empty();
802
803 if( symbol )
804 {
805 int pc = symbol->GetPinCount();
806 wxLogTrace( "CVPCB_PINCOUNT", wxT( "DisplayStatus: selected '%s' pinCount=%d" ),
807 symbol->GetReference(), pc );
808 msg = wxString::Format( wxT( "%i" ), pc );
809 }
810
811 if( !filters.IsEmpty() )
812 filters += wxT( ", " );
813
814 filters += _( "Pin Count" );
815
816 if( !msg.IsEmpty() )
817 filters += wxString::Format( wxT( " (%s)" ), msg );
818 }
819
821 {
822 msg = m_librariesListBox->GetSelectedLibrary();
823
824 if( !filters.IsEmpty() )
825 filters += wxT( ", " );
826
827 filters += _( "Library" );
828
829 if( !msg.IsEmpty() )
830 filters += wxString::Format( wxT( " (%s)" ), msg );
831 }
832
833 wxString textFilter = m_tcFilterString->GetValue();
834
835 if( !textFilter.IsEmpty() )
836 {
837 if( !filters.IsEmpty() )
838 filters += wxT( ", " );
839
840 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
841 }
842
843 if( filters.IsEmpty() )
844 msg = _( "No Filtering" );
845 else
846 msg.Printf( _( "Filtered by %s" ), filters );
847
848 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
849
850 SetStatusText( msg );
851
852
853 msg.Empty();
854 wxString footprintName = GetSelectedFootprint();
855
856 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
857
858 if( fp ) // can be NULL if no netlist loaded
859 {
860 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
861 fp->GetDesc(),
862 fp->GetKeywords() );
863 }
864
865 SetStatusText( msg, 1 );
866
867 msg.Empty();
868 wxString lib;
869
870 // Choose the footprint to get the information on
871 if( fp )
872 {
873 // Use the footprint in the footprint viewer
874 lib = fp->GetLibNickname();
875 }
877 {
878 // Use the footprint of the selected symbol
879 if( symbol )
880 lib = symbol->GetFPID().GetUniStringLibNickname();
881 }
883 {
884 // Use the library that is selected
885 lib = m_librariesListBox->GetSelectedLibrary();
886 }
887
888 // Extract the library information
890
891 if( std::optional<LIBRARY_TABLE_ROW*> optRow = adapter->GetRow( lib ); optRow )
892 msg = wxString::Format( _( "Library location: %s" ), LIBRARY_MANAGER::GetFullURI( *optRow ) );
893
894 SetStatusText( msg, 2 );
895}
896
897
899{
901
902 // Check if there are footprint libraries in the footprint library table.
903 if( !adapter || !adapter->Rows().size() )
904 {
905 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
906 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
907 return false;
908 }
909
910 WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
911
912 m_FootprintsList->ReadFootprintFiles( adapter, nullptr, &progressReporter );
913
914 if( m_FootprintsList->GetErrorCount() )
915 {
916 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
917 statusBar->SetLoadWarningMessages( m_FootprintsList->GetErrorMessages() );
918 }
919
920 return true;
921}
922
923
924void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
925{
926 if( m_netlist.IsEmpty() )
927 return;
928
929 std::string command = "$SELECT: ";
930
931 if( aClearSelectionOnly )
932 {
933 // Sending an empty list means clearing the selection.
934 if( Kiface().IsSingle() )
935 SendCommand( MSG_TO_SCH, command );
936 else
937 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
938
939 return;
940 }
941
942 int selection = m_symbolsListBox->GetSelection();
943
944 if( selection < 0 ) // Nothing selected
945 return;
946
947 if( m_netlist.GetComponent( selection ) == nullptr )
948 return;
949
950 // Now select the corresponding symbol on the schematic:
951 wxString ref = m_netlist.GetComponent( selection )->GetReference();
952
953 // The prefix 0,F before the reference is for selecting the symbol
954 // (one can select a pin with a different prefix)
955 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
956
957 if( Kiface().IsSingle() )
958 SendCommand( MSG_TO_SCH, command );
959 else
960 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
961}
962
963
964int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
965{
966 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
967 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
968
969 m_netlist.Clear();
970
971 // Trace basic payload characteristics to verify libparts are present and visible here
972 wxLogTrace( "CVPCB_PINCOUNT",
973 wxT( "readSchematicNetlist: payload size=%zu has_libparts=%d has_libpart=%d" ),
974 aNetlist.size(), aNetlist.find( "(libparts" ) != std::string::npos,
975 aNetlist.find( "(libpart" ) != std::string::npos );
976
977 try
978 {
979 netlistReader.LoadNetlist();
980 }
981 catch( const IO_ERROR& ioe )
982 {
983 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
984 ioe.What().GetData() );
985 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
986 return 1;
987 }
988
989 // We also remove footprint name if it is "$noname" because this is a dummy name,
990 // not the actual name of the footprint.
991 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
992 {
993 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
994 m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
995 }
996
997 // Sort symbols by reference:
998 m_netlist.SortByReference();
999
1000 return 0;
1001}
1002
1003
1005{
1006 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
1008 DisplayStatus();
1009}
1010
1011
1013{
1017
1018 // Use same sorting algorithm as LIB_TREE_NODE::AssignIntrinsicRanks
1019 struct library_sort
1020 {
1021 bool operator()( const wxString& lhs, const wxString& rhs ) const
1022 {
1023 return StrNumCmp( lhs, rhs, true ) < 0;
1024 }
1025 };
1026
1027 std::set<wxString, library_sort> pinnedMatches;
1028 std::set<wxString, library_sort> otherMatches;
1029
1030 m_librariesListBox->ClearList();
1031
1032 auto process =
1033 [&]( const wxString& aNickname )
1034 {
1035 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1036 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1037 {
1038 pinnedMatches.insert( aNickname );
1039 }
1040 else
1041 {
1042 otherMatches.insert( aNickname );
1043 }
1044 };
1045
1046
1047 if( adapter )
1048 {
1049 std::vector<wxString> libNickNames = adapter->GetLibraryNames();
1050
1051 for( const wxString& libNickName : libNickNames )
1052 process( libNickName );
1053 }
1054
1055 for( const wxString& nickname : pinnedMatches )
1057
1058 for( const wxString& nickname : otherMatches )
1059 m_librariesListBox->AppendLine( nickname );
1060
1061 m_librariesListBox->Finish();
1062}
1063
1064
1066{
1067 int selection = m_symbolsListBox->GetSelection();
1068
1069 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1070 return m_netlist.GetComponent( selection );
1071
1072 return nullptr;
1073}
1074
1075
1076void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1077{
1078 m_skipComponentSelect = aSkipUpdate;
1079
1080 if( aIndex < 0 )
1081 {
1082 m_symbolsListBox->DeselectAll();
1083 }
1084 else if( aIndex < m_symbolsListBox->GetCount() )
1085 {
1086 m_symbolsListBox->DeselectAll();
1087 m_symbolsListBox->SetSelection( aIndex );
1089 }
1090
1091 m_skipComponentSelect = false;
1092}
1093
1094
1095std::vector<unsigned int>
1097{
1098 std::vector<unsigned int> idx;
1099 int lastIdx;
1100
1101 // Make sure a netlist has been loaded and the box has contents
1102 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1103 return idx;
1104
1105 switch( aCriteria )
1106 {
1108 idx.resize( m_netlist.GetCount() );
1109 std::iota( idx.begin(), idx.end(), 0 );
1110 break;
1111
1113 // Check to see if anything is selected
1114 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1115 break;
1116
1117 // Get the symbols
1118 lastIdx = m_symbolsListBox->GetFirstSelected();
1119 idx.emplace_back( lastIdx );
1120
1121 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1122 while( lastIdx > 0 )
1123 {
1124 idx.emplace_back( lastIdx );
1125 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1126 }
1127 break;
1128
1130 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1131 {
1132 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1133 idx.emplace_back( i );
1134 }
1135 break;
1136
1138 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1139 {
1140 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1141 idx.emplace_back( i );
1142 }
1143 break;
1144
1145 default:
1146 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1147 }
1148
1149 return idx;
1150}
1151
1152
1154{
1155 // returns the Footprint Viewer frame, if exists, or NULL
1156 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1157 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1158}
1159
1160
1162{
1163 return GetFootprintViewerFrame();
1164}
1165
1166
1174
1175
1177{
1178 switch( aLB )
1179 {
1183 default: break;
1184 }
1185}
1186
1187
1189{
1190 // returns the LIB_ID of the selected footprint in footprint listview
1191 // or a empty string
1192 return m_footprintListBox->GetSelectedFootprint();
1193}
1194
1195
1196void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1197{
1198 switch( aNumber )
1199 {
1200 case 0: m_statusLine1->SetLabel( aText ); break;
1201 case 1: m_statusLine2->SetLabel( aText ); break;
1202 case 2: m_statusLine3->SetLabel( aText ); break;
1203 default: wxFAIL_MSG( wxT( "Invalid status row number" ) ); break;
1204 }
1205}
1206
1207
1214
1215
1217{
1218 const std::string& payload = mail.GetPayload();
1219
1220 switch( mail.Command() )
1221 {
1223 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1224 // widgets:
1225 m_cannotClose = true;
1226 readNetListAndFpFiles( payload );
1227 m_cannotClose = false;
1228
1229 /* @todo
1230 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1231 */
1232 break;
1233
1234 case MAIL_RELOAD_LIB:
1235 m_cannotClose = true;
1239 m_cannotClose = false;
1240 break;
1241
1242 default:
1243 ; // ignore most
1244 }
1245}
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:115
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:80
static TOOL_ACTION copy
Definition actions.h:78
static TOOL_ACTION undo
Definition actions.h:75
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION cut
Definition actions.h:77
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:47
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Handle actions that are shared between different applications.
Store all of the related component information found in a netlist.
const wxString & GetReference() const
const wxString & GetValue() const
void SetFPID(const LIB_ID &aFPID)
const wxArrayString & GetFootprintFilters() const
const std::vector< KIID > & GetKIIDs() const
const LIB_ID & GetFPID() const
Gather all the actions that are shared by tools.
static TOOL_ACTION saveAssociationsToFile
static TOOL_ACTION FilterFPbyLibrary
static TOOL_ACTION filterFPbyPin
static TOOL_ACTION deleteAssoc
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Handles action in main CvPcb window.
A class to define a footprint association to be made in cvpcb.
unsigned int GetComponentIndex() const
Get the index of the component to modify the association of.
LIB_ID GetNewFootprint() const
Get the new footprint to associate to the component.
Handles actions in main CvPcb window.
bool readNetListAndFpFiles(const std::string &aNetlist)
Load the netlist file built on the fly by Eeschema and loads footprint libraries from fp lib tables.
wxTimer * m_filterTimer
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void ShowChangedLanguage() override
void SendComponentSelectionToSch(bool aClearSelectionOnly=false)
Send a remote command to Eeschema via a socket,.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void doCloseWindow() override
CVPCB_UNDO_REDO_LIST m_redoList
ACTION_MENU * m_symbolsContextMenu
wxStaticText * m_statusLine3
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const
Find out which control currently has focus.
CVPCB_FILTER_ACTION
The action to apply to a footprint filter when it is modified.
@ FILTER_DISABLE
Turn off the filter.
@ FILTER_ENABLE
Turn on the filter.
@ FILTER_TOGGLE
Toggle the filter state.
void onTextFilterChangedTimer(wxTimerEvent &aEvent)
void onTextFilterChanged(wxCommandEvent &event)
LIBRARY_LISTBOX * m_librariesListBox
void setupTools()
Setup the tool system for the CVPCB main frame.
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame() const
wxButton * m_saveAndContinue
void RedoAssociation()
Redo the most recently undone association.
bool LoadFootprintFiles()
Read the list of footprint (*.mod files) and generate the list of footprints.
void SetStatusText(const wxString &aText, int aNumber=0) override
wxString GetSelectedFootprint()
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
CVPCB_MAINFRAME(KIWAY *aKiway, wxWindow *aParent)
void SetFootprintFilter(FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter, CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction)
Set a filter criteria to either on/off or toggle the criteria.
wxStaticText * m_statusLine1
void setupEventHandlers()
Setup event handlers.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void SetSelectedComponent(int aIndex, bool aSkipUpdate=false)
Set the currently selected component in the components listbox.
ACTION_MENU * m_footprintContextMenu
CONTROL_TYPE
The type of the controls present in the application.
@ CONTROL_NONE
No controls have focus.
@ CONTROL_LIBRARY
Library listbox.
@ CONTROL_FOOTPRINT
Footprint listbox.
@ CONTROL_COMPONENT
Component listbox.
wxString formatSymbolDesc(int idx, const wxString &aReference, const wxString &aValue, const wxString &aFootprint)
void SetFocusedControl(CVPCB_MAINFRAME::CONTROL_TYPE aControl)
Set the focus to a specific control.
void OnSelectComponent(wxListEvent &event)
Called when clicking on a component in component list window:
void UndoAssociation()
Undo the most recent associations that were performed.
void DisplayStatus()
Update the information displayed on the status bar at bottom of the main frame.
void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
CVPCB_UNDO_REDO_LIST m_undoList
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
FOOTPRINT_LIST * m_FootprintsList
wxWindow * GetToolCanvas() const override
Canvas access.
std::vector< unsigned int > GetComponentIndices(CVPCB_MAINFRAME::CRITERIA aCriteria=CVPCB_MAINFRAME::ALL_COMPONENTS)
Get the indices for all the components meeting the specified criteria in the components listbox.
void AssociateFootprint(const CVPCB_ASSOCIATION &aAssociation, bool aNewEntry=true, bool aAddUndoItem=true)
Associate a footprint with a specific component in the list.
void configureToolbars() override
void updateFootprintViewerOnIdle(wxIdleEvent &aEvent)
void refreshAfterSymbolSearch(COMPONENT *aSymbol)
wxStaticText * m_statusLine2
FOOTPRINTS_LISTBOX * m_footprintListBox
CRITERIA
Criteria to use to identify sets of components.
@ ALL_COMPONENTS
All components.
@ NA_COMPONENTS
Not associated components.
@ SEL_COMPONENTS
Selected components.
@ ASSOC_COMPONENTS
Associated components.
SYMBOLS_LISTBOX * m_symbolsListBox
TOOL_DISPATCHER * m_toolDispatcher
int readSchematicNetlist(const std::string &aNetlist)
Read the netlist (.net) file built on the fly by Eeschema.
bool SaveFootprintAssociation(bool doSaveSchematic)
Save the edits that the user has done by sending them back to Eeschema via the kiway.
wxTextCtrl * m_tcFilterString
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
Toolbar configuration for cvpcb.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
TOOLBAR_SETTINGS * m_toolbarSettings
wxAuiManager m_auimgr
virtual void RecreateToolbars()
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
ACTION_TOOLBAR * m_tbTopMain
wxString m_aboutTitle
void ReCreateMenuBar()
Recreate the menu bar.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Class that groups generic conditions for editor states.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
virtual SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION ContentModified()
Create a functor that tests if the content of the frame is modified.
FP_FILTER_T
Filter setting constants.
Definition listboxes.h:99
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition listboxes.h:101
wxString GetLibNickname() const override
wxString GetKeywords()
wxString GetDesc() override
An interface to the global shared library manager that is schematic-specific and linked to one projec...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
Definition kiid.h: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.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:38
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition kiway_mail.h:56
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition kiway_mail.h:48
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:295
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:505
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:207
std::vector< LIBRARY_TABLE_ROW * > Rows(LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH, bool aIncludeInvalid=false) const
Like LIBRARY_MANAGER::Rows but filtered to the LIBRARY_TABLE_TYPE of this adapter.
std::optional< LIBRARY_TABLE_ROW * > GetRow(const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
std::vector< wxString > GetLibraryNames() const
Returns a list of library nicknames that are available (skips any that failed to load)
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h: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:119
const wxString GetUniStringLibNickname() const
Definition lib_id.h:88
static const wxString GetPinningSymbol()
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:541
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:131
The backing store for a PROJECT, in JSON format.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:203
T * GetToolbarSettings(const wxString &aFilename)
Return a handle to the given toolbar settings.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition richio.h:226
TOOL_MANAGER * m_toolManager
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
const char * c_str() const
Definition utf8.h:108
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:131
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
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:230
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:57
@ 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:180
KICOMMON_API wxFont GetMonospacedUIFont()
Definition ui_common.cpp:93
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
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
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString From_UTF8(const char *cstring)
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
std::vector< wxString > pinned_fp_libs
#define PR_CAN_ABORT