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_express.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>
55#include <footprint_info_impl.h>
56#include <kiplatform/ui.h>
57#include <listboxes.h>
58#include <tools/cvpcb_actions.h>
60#include <tools/cvpcb_control.h>
61#include <project_pcb.h>
62#include <toolbars_cvpcb.h>
63
64#include <wx/statline.h>
65#include <wx/stattext.h>
66#include <wx/button.h>
67#include <wx/msgdlg.h>
68#include <wx/ffile.h>
69
70
71CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
72 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
73 wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "CvpcbFrame" ),
74 unityScale ),
75 m_footprintListBox( nullptr ),
76 m_librariesListBox( nullptr ),
77 m_symbolsListBox( nullptr ),
78 m_tcFilterString( nullptr ),
80{
81 m_modified = false;
82 m_cannotClose = false;
86 m_initialized = false;
87 m_aboutTitle = _( "Assign Footprints" );
88
89 // Give an icon
90 wxIcon icon;
91 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
92 SetIcon( icon );
93
94 SetAutoLayout( true );
95
97
98 setupTools();
100
105
108
111
114
116
117 m_auimgr.SetManagedWindow( this );
118
119 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" ).Top().Layer(6) );
120
121 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
122 .Caption( _( "Footprint Libraries" ) )
123 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
124
125 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
126 .Caption( _( "Symbol : Footprint Assignments" ) ) );
127
128 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
129 .Caption( _( "Filtered Footprints" ) )
130 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
131
132 // Build the bottom panel, to display 2 status texts and the buttons:
133 auto bottomPanel = new wxPanel( this );
134 auto panelSizer = new wxBoxSizer( wxVERTICAL );
135
136 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
137 fgSizerStatus->SetFlexibleDirection( wxBOTH );
138 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
139
140 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
141 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
142
143 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
144 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
145
146 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
147 fgSizerStatus->Add( m_statusLine3, 0, 0, 5 );
148
149 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
150
151 m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
152 m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
153 m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
154
155 // Add buttons:
156 auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
157 auto sdbSizer = new wxStdDialogButtonSizer();
158
159 m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY, _( "Apply, Save Schematic && Continue" ) );
160 buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
161
162 auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
163 sdbSizer->AddButton( sdbSizerOK );
164 auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
165 sdbSizer->AddButton( sdbSizerCancel );
166 sdbSizer->Realize();
167
168 buttonsSizer->Add( sdbSizer, 0, 0, 5 );
169 panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
170
171 bottomPanel->SetSizer( panelSizer );
172 bottomPanel->Fit();
173
174 sdbSizerOK->SetDefault();
176
177 m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
178
179 m_auimgr.Update();
180 m_initialized = true;
181
182 auto setPaneWidth =
183 [this]( wxAuiPaneInfo& pane, int width )
184 {
185 // wxAUI hack: force width by setting MinSize() and then Fixed()
186 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
187 pane.MinSize( width, -1 );
188 pane.BestSize( width, -1 );
189 pane.MaxSize( width, -1 );
190 pane.Fixed();
191 m_auimgr.Update();
192
193 // now make it resizable again
194 pane.MinSize( 20, -1 );
195 pane.Resizable();
196 m_auimgr.Update();
197 };
198
199 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
200 {
201 m_tcFilterString->ChangeValue( cfg->m_FilterString );
202
203 if( cfg->m_LibrariesWidth > 0 )
204 setPaneWidth( m_auimgr.GetPane( "Libraries" ), cfg->m_LibrariesWidth );
205
206 if( cfg->m_FootprintsWidth > 0 )
207 setPaneWidth( m_auimgr.GetPane( "Footprints" ), cfg->m_FootprintsWidth );
208 }
209
210 // Connect Events
212
213 // Toolbar events
214 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
215
216 // Attach the events to the tool dispatcher
218 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
219
220 m_filterTimer = new wxTimer( this );
221 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
222
223 // Start the main processing loop
224 m_toolManager->InvokeTool( "cvpcb.Control" );
225
226 m_filterTimer->StartOnce( 100 );
227
228 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
229}
230
231
233{
234 Unbind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
236 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
237
238 Unbind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
239 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
240
241 // Clean up the tool infrastructure
242 delete m_actions;
243 delete m_toolManager;
244 delete m_toolDispatcher;
245 delete m_FootprintsList;
246
247 m_auimgr.UnInit();
248}
249
250
252{
253 // Create the manager
254 m_actions = new CVPCB_ACTIONS();
256 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
258
259 // Register tools
260 m_toolManager->RegisterTool( new COMMON_CONTROL );
261 m_toolManager->RegisterTool( new CVPCB_CONTROL );
262 m_toolManager->RegisterTool( new CVPCB_ASSOCIATION_TOOL );
263 m_toolManager->InitTools();
264
265 CVPCB_CONTROL* tool = m_toolManager->GetTool<CVPCB_CONTROL>();
266
267 // Even though these menus will open with the right-click, we treat them as a normal
268 // menu instead of a context menu because we don't care about their position and want
269 // to be able to tell the difference between a menu click and a hotkey activation.
270
271 // Create the context menu for the symbols list box
272 m_symbolsContextMenu = new ACTION_MENU( false, tool );
274 m_symbolsContextMenu->AppendSeparator();
278 m_symbolsContextMenu->AppendSeparator();
280
281 // Create the context menu for the footprint list box
282 m_footprintContextMenu = new ACTION_MENU( false, tool );
284}
285
286
288{
290
291 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
292 EDITOR_CONDITIONS cond( this );
293
294 wxASSERT( mgr );
295
296#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
297#define CHECK( x ) ACTION_CONDITIONS().Check( x )
298
303
304 auto compFilter =
305 [this] ( const SELECTION& )
306 {
308 };
309
310 auto libFilter =
311 [this] ( const SELECTION& )
312 {
314 };
315
316 auto pinFilter =
317 [this] ( const SELECTION& )
318 {
320 };
321
325
326#undef CHECK
327#undef ENABLE
328}
329
330
332{
333 // Connect the handlers to launch the context menus in the listboxes
334 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
335 [this]( wxMouseEvent& )
336 {
337 PopupMenu( m_footprintContextMenu );
338 } );
339
340 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
341 [this]( wxMouseEvent& )
342 {
343 PopupMenu( m_symbolsContextMenu );
344 } );
345
346 // Connect the handler for the save button
347 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
348 [this]( wxCommandEvent& )
349 {
350 // saveAssociations must be run immediately
352 } );
353
354 // Connect the handlers for the ok/cancel buttons
355 Bind( wxEVT_BUTTON,
356 [this]( wxCommandEvent& )
357 {
358 // saveAssociations must be run immediately, before running Close( true )
360 Close( true );
361 }, wxID_OK );
362
363 Bind( wxEVT_BUTTON,
364 [this]( wxCommandEvent& )
365 {
366 Close( false );
367 }, wxID_CANCEL );
368
369 // Connect the handlers for the close events
370 Bind( wxEVT_MENU,
371 [this]( wxCommandEvent& )
372 {
373 Close( false );
374 }, wxID_CLOSE );
375 Bind( wxEVT_MENU,
376 [this]( wxCommandEvent& )
377 {
378 Close( false );
379 }, wxID_EXIT );
380
381 // Just skip the resize events
382 Bind( wxEVT_SIZE,
383 []( wxSizeEvent& aEvent )
384 {
385 aEvent.Skip();
386 } );
387}
388
389
390bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
391{
392 if( m_modified )
393 {
394 // Shutdown blocks must be determined and vetoed as early as possible
395 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
396 return false;
397
398 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. Save changes?" ),
399 [&]() -> bool
400 {
401 return SaveFootprintAssociation( false );
402 } ) )
403 {
404 return false;
405 }
406 }
407
408 if( m_cannotClose )
409 return false;
410
411 return true;
412}
413
414
416{
417 m_symbolsListBox->Shutdown();
418 m_footprintListBox->Shutdown();
419
421 GetFootprintViewerFrame()->Close( true );
422
423 m_modified = false;
424
425 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
426 m_filterTimer->Stop();
427
428 // Shutdown all running tools
429 if( m_toolManager )
430 m_toolManager->ShutdownAllTools();
431
432 // clear symbol selection in schematic:
434}
435
436
437void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
438{
439 // Called when changing the filter string in main toolbar.
440 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
441 // of available footprints which match the filter
442
443 m_filterTimer->StartOnce( 200 );
444}
445
446
448{
449 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
450 // insertion point here and then restore them at the end.
451 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
452 long pos = m_tcFilterString->GetInsertionPoint();
453
455 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
456
457 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
459
460 if( symbol && symbol->GetFPID().IsValid() )
461 m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
462 else if( m_footprintListBox->GetSelection() >= 0 )
463 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
464
466
468
469 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
470 {
471 m_tcFilterString->SetFocus();
472 m_tcFilterString->SetInsertionPoint( pos );
473 }
474}
475
476
477void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
478{
480 return;
481
483 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
484
485 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
487
488 if( symbol && symbol->GetFPID().IsValid() )
489 m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
490 else if( m_footprintListBox->GetSelection() >= 0 )
491 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
492
494
495 refreshAfterSymbolSearch( symbol );
496}
497
498
507
508
510{
511 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
512 m_viewerPendingUpdate = false;
513
514 // On some platforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
515 // are opened and refreshed when a new footprint is selected.
516 // If the listbox has the focus before selecting a new footprint, it will be forced
517 // after selection.
518 bool footprintListHasFocus = m_footprintListBox->HasFocus();
519 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
520
521 // If the footprint view window is displayed, update the footprint.
524
526
527 if( footprintListHasFocus )
528 m_footprintListBox->SetFocus();
529 else if( symbolListHasFocus )
530 m_symbolsListBox->SetFocus();
531}
532
533
535{
537
538 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
539 m_filteringOptions = cfg->m_FilterFlags;
540}
541
542
544{
546
547 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
548 {
549 cfg->m_FilterFlags = m_filteringOptions;
550 cfg->m_FilterString = m_tcFilterString->GetValue();
551
552 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
553 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
554 }
555}
556
557
559{
560 if( m_undoList.size() == 0 )
561 return;
562
563 CVPCB_UNDO_REDO_ENTRIES redoEntries;
564 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
565 m_undoList.pop_back();
566
567 // Iterate over the entries to undo
568 for( const auto& assoc : curEntry )
569 {
570 AssociateFootprint( assoc, true, false );
571 redoEntries.emplace_back( assoc.Reverse() );
572 }
573
574 // Add the redo entries to the redo stack
575 m_redoList.emplace_back( redoEntries );
576}
577
578
580{
581 if( m_redoList.size() == 0 )
582 return;
583
584 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
585 m_redoList.pop_back();
586
587 // Iterate over the entries to undo
588 bool firstAssoc = true;
589
590 for( const auto& assoc : curEntry )
591 {
592 AssociateFootprint( assoc, firstAssoc );
593 firstAssoc = false;
594 }
595}
596
597
598wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
599 const wxString& aValue, const wxString& aFootprint )
600{
601 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
602 // reason).
603 wxString desc = wxString::Format( wxT( "%3d " ), idx );
604
605 for( int ii = aReference.Length(); ii < 8; ++ii )
606 desc += wxS( " " );
607
608 desc += aReference + wxT( " - " );
609
610 for( int ii = aValue.Length(); ii < 16; ++ii )
611 desc += wxS( " " );
612
613 desc += aValue + wxT( " : " ) + aFootprint;
614
615 return desc;
616}
617
618
620 bool aNewEntry, bool aAddUndoItem )
621{
622 if( m_netlist.IsEmpty() )
623 return;
624
625 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
626
627 if( symbol == nullptr )
628 return;
629
630 LIB_ID fpid = aAssociation.GetNewFootprint();
631 LIB_ID oldFpid = symbol->GetFPID();
632
633 // Test for validity of the requested footprint
634 if( !fpid.empty() && !fpid.IsValid() )
635 {
636 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
637 fpid.Format().wx_str() );
638 DisplayErrorMessage( this, msg );
639 return;
640 }
641
642 const KIID& id = symbol->GetKIIDs().front();
643
644 // Set new footprint to all instances of the selected symbol
645 for( unsigned int idx : GetComponentIndices() )
646 {
647 COMPONENT* candidate = m_netlist.GetComponent( idx );
648 const std::vector<KIID>& kiids = candidate->GetKIIDs();
649
650 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
651 {
652 // Set the new footprint
653 candidate->SetFPID( fpid );
654
655 // create the new symbol description and set it
656 wxString description = formatSymbolDesc( idx + 1,
657 candidate->GetReference(),
658 candidate->GetValue(),
659 candidate->GetFPID().Format().wx_str() );
660 m_symbolsListBox->SetString( idx, description );
661
662 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
663 m_symbolsListBox->AppendWarning( idx );
664 else
665 m_symbolsListBox->RemoveWarning( idx );
666 }
667 }
668
669 // Mark the data as being modified
670 m_modified = true;
671
672 // Update the statusbar and refresh the list
674 m_symbolsListBox->Refresh();
675
676 if( !aAddUndoItem )
677 return;
678
679 // Update the undo list
680 if ( aNewEntry )
681 {
682 // Create a new entry for this association
684 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
685 aAssociation.GetNewFootprint() ) );
686 m_undoList.emplace_back( newEntry );
687
688 // Clear the redo list
689 m_redoList.clear();
690 }
691 else
692 {
693 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
694 oldFpid,
695 aAssociation.GetNewFootprint() ) );
696 }
697
698}
699
700
701bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
702{
703 return true;
704}
705
706
708{
709 // Tell AuiMgr that objects are changed !
710 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
711 m_auimgr.Update(); // (could be not the case when starting CvPcb)
712
713 if( aSymbol == nullptr )
714 {
716 return;
717 }
718
719 // Preview of the already assigned footprint.
720 // Find the footprint that was already chosen for this aSymbol and select it,
721 // but only if the selection is made from the aSymbol list or the library list.
722 // If the selection is made from the footprint list, do not change the current
723 // selected footprint.
724 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
725 {
726 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
727
728 m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
729
730 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
731 {
732 wxString candidateName;
733 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
734 msg.Trim( true );
735 msg.Trim( false );
736 candidateName = msg.AfterFirst( wxChar( ' ' ) );
737
738 if( footprintName.Cmp( candidateName ) == 0 )
739 {
740 m_footprintListBox->SetSelection( ii, true );
741 break;
742 }
743 }
744 }
745
748}
749
750
753{
754 int option = aFilter;
755
756 // Apply the filter accordingly
757 switch( aAction )
758 {
762 }
763
764 wxListEvent l_event;
765 OnSelectComponent( l_event );
766}
767
768
770{
771 if( !m_initialized )
772 return;
773
774 wxString filters, msg;
776
778 {
779 msg.Empty();
780
781 if( symbol )
782 {
783 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
784 {
785 if( msg.IsEmpty() )
786 msg += symbol->GetFootprintFilters()[ii];
787 else
788 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
789 }
790 }
791
792 filters += _( "Keywords" );
793
794 if( !msg.IsEmpty() )
795 filters += wxString::Format( wxT( " (%s)" ), msg );
796 }
797
799 {
800 msg.Empty();
801
802 if( symbol )
803 {
804 int pc = symbol->GetPinCount();
805 wxLogTrace( "CVPCB_PINCOUNT", wxT( "DisplayStatus: selected '%s' pinCount=%d" ),
806 symbol->GetReference(), pc );
807 msg = wxString::Format( wxT( "%i" ), pc );
808 }
809
810 if( !filters.IsEmpty() )
811 filters += wxT( ", " );
812
813 filters += _( "Pin Count" );
814
815 if( !msg.IsEmpty() )
816 filters += wxString::Format( wxT( " (%s)" ), msg );
817 }
818
820 {
821 msg = m_librariesListBox->GetSelectedLibrary();
822
823 if( !filters.IsEmpty() )
824 filters += wxT( ", " );
825
826 filters += _( "Library" );
827
828 if( !msg.IsEmpty() )
829 filters += wxString::Format( wxT( " (%s)" ), msg );
830 }
831
832 wxString textFilter = m_tcFilterString->GetValue();
833
834 if( !textFilter.IsEmpty() )
835 {
836 if( !filters.IsEmpty() )
837 filters += wxT( ", " );
838
839 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
840 }
841
842 if( filters.IsEmpty() )
843 msg = _( "No Filtering" );
844 else
845 msg.Printf( _( "Filtered by %s" ), filters );
846
847 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
848
849 SetStatusText( msg );
850
851
852 msg.Empty();
853 wxString footprintName = GetSelectedFootprint();
854
855 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
856
857 if( fp ) // can be NULL if no netlist loaded
858 {
859 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
860 fp->GetDesc(),
861 fp->GetKeywords() );
862 }
863
864 SetStatusText( msg, 1 );
865
866 msg.Empty();
867 wxString lib;
868
869 // Choose the footprint to get the information on
870 if( fp )
871 {
872 // Use the footprint in the footprint viewer
873 lib = fp->GetLibNickname();
874 }
876 {
877 // Use the footprint of the selected symbol
878 if( symbol )
879 lib = symbol->GetFPID().GetUniStringLibNickname();
880 }
882 {
883 // Use the library that is selected
884 lib = m_librariesListBox->GetSelectedLibrary();
885 }
886
887 // Extract the library information
889
890 if( std::optional<LIBRARY_TABLE_ROW*> optRow = adapter->GetRow( lib ); optRow )
891 msg = wxString::Format( _( "Library location: %s" ), LIBRARY_MANAGER::GetFullURI( *optRow ) );
892
893 SetStatusText( msg, 2 );
894}
895
896
898{
900
901 // Check if there are footprint libraries in the footprint library table.
902 if( !adapter || !adapter->Rows().size() )
903 {
904 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
905 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
906 return false;
907 }
908
909 WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
910
911 m_FootprintsList->ReadFootprintFiles( adapter, nullptr, &progressReporter );
912
913 if( m_FootprintsList->GetErrorCount() )
914 {
915 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
916 statusBar->SetLoadWarningMessages( m_FootprintsList->GetErrorMessages() );
917 }
918
919 return true;
920}
921
922
923void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
924{
925 if( m_netlist.IsEmpty() )
926 return;
927
928 std::string command = "$SELECT: ";
929
930 if( aClearSelectionOnly )
931 {
932 // Sending an empty list means clearing the selection.
933 if( Kiface().IsSingle() )
934 SendCommand( MSG_TO_SCH, command );
935 else
936 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
937
938 return;
939 }
940
941 int selection = m_symbolsListBox->GetSelection();
942
943 if( selection < 0 ) // Nothing selected
944 return;
945
946 if( m_netlist.GetComponent( selection ) == nullptr )
947 return;
948
949 // Now select the corresponding symbol on the schematic:
950 wxString ref = m_netlist.GetComponent( selection )->GetReference();
951
952 // The prefix 0,F before the reference is for selecting the symbol
953 // (one can select a pin with a different prefix)
954 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
955
956 if( Kiface().IsSingle() )
957 SendCommand( MSG_TO_SCH, command );
958 else
959 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
960}
961
962
963int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
964{
965 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
966 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
967
968 m_netlist.Clear();
969
970 // Trace basic payload characteristics to verify libparts are present and visible here
971 wxLogTrace( "CVPCB_PINCOUNT",
972 wxT( "readSchematicNetlist: payload size=%zu has_libparts=%d has_libpart=%d" ),
973 aNetlist.size(), aNetlist.find( "(libparts" ) != std::string::npos,
974 aNetlist.find( "(libpart" ) != std::string::npos );
975
976 try
977 {
978 netlistReader.LoadNetlist();
979 }
980 catch( const IO_ERROR& ioe )
981 {
982 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
983 ioe.What().GetData() );
984 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
985 return 1;
986 }
987
988 // We also remove footprint name if it is "$noname" because this is a dummy name,
989 // not the actual name of the footprint.
990 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
991 {
992 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
993 m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
994 }
995
996 // Sort symbols by reference:
997 m_netlist.SortByReference();
998
999 return 0;
1000}
1001
1002
1004{
1005 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
1007 DisplayStatus();
1008}
1009
1010
1012{
1016
1017 // Use same sorting algorithm as LIB_TREE_NODE::AssignIntrinsicRanks
1018 struct library_sort
1019 {
1020 bool operator()( const wxString& lhs, const wxString& rhs ) const
1021 {
1022 return StrNumCmp( lhs, rhs, true ) < 0;
1023 }
1024 };
1025
1026 std::set<wxString, library_sort> pinnedMatches;
1027 std::set<wxString, library_sort> otherMatches;
1028
1029 m_librariesListBox->ClearList();
1030
1031 auto process =
1032 [&]( const wxString& aNickname )
1033 {
1034 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1035 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1036 {
1037 pinnedMatches.insert( aNickname );
1038 }
1039 else
1040 {
1041 otherMatches.insert( aNickname );
1042 }
1043 };
1044
1045
1046 if( adapter )
1047 {
1048 std::vector<wxString> libNickNames = adapter->GetLibraryNames();
1049
1050 for( const wxString& libNickName : libNickNames )
1051 process( libNickName );
1052 }
1053
1054 for( const wxString& nickname : pinnedMatches )
1056
1057 for( const wxString& nickname : otherMatches )
1058 m_librariesListBox->AppendLine( nickname );
1059
1060 m_librariesListBox->Finish();
1061}
1062
1063
1065{
1066 int selection = m_symbolsListBox->GetSelection();
1067
1068 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1069 return m_netlist.GetComponent( selection );
1070
1071 return nullptr;
1072}
1073
1074
1075void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1076{
1077 m_skipComponentSelect = aSkipUpdate;
1078
1079 if( aIndex < 0 )
1080 {
1081 m_symbolsListBox->DeselectAll();
1082 }
1083 else if( aIndex < m_symbolsListBox->GetCount() )
1084 {
1085 m_symbolsListBox->DeselectAll();
1086 m_symbolsListBox->SetSelection( aIndex );
1088 }
1089
1090 m_skipComponentSelect = false;
1091}
1092
1093
1094std::vector<unsigned int>
1096{
1097 std::vector<unsigned int> idx;
1098 int lastIdx;
1099
1100 // Make sure a netlist has been loaded and the box has contents
1101 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1102 return idx;
1103
1104 switch( aCriteria )
1105 {
1107 idx.resize( m_netlist.GetCount() );
1108 std::iota( idx.begin(), idx.end(), 0 );
1109 break;
1110
1112 // Check to see if anything is selected
1113 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1114 break;
1115
1116 // Get the symbols
1117 lastIdx = m_symbolsListBox->GetFirstSelected();
1118 idx.emplace_back( lastIdx );
1119
1120 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1121 while( lastIdx > 0 )
1122 {
1123 idx.emplace_back( lastIdx );
1124 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1125 }
1126 break;
1127
1129 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1130 {
1131 if( m_netlist.GetComponent( i )->GetFPID().empty() )
1132 idx.emplace_back( i );
1133 }
1134 break;
1135
1137 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1138 {
1139 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1140 idx.emplace_back( i );
1141 }
1142 break;
1143
1144 default:
1145 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1146 }
1147
1148 return idx;
1149}
1150
1151
1153{
1154 // returns the Footprint Viewer frame, if exists, or NULL
1155 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1156 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1157}
1158
1159
1161{
1162 return GetFootprintViewerFrame();
1163}
1164
1165
1173
1174
1176{
1177 switch( aLB )
1178 {
1182 default: break;
1183 }
1184}
1185
1186
1188{
1189 // returns the LIB_ID of the selected footprint in footprint listview
1190 // or a empty string
1191 return m_footprintListBox->GetSelectedFootprint();
1192}
1193
1194
1195void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1196{
1197 switch( aNumber )
1198 {
1199 case 0: m_statusLine1->SetLabel( aText ); break;
1200 case 1: m_statusLine2->SetLabel( aText ); break;
1201 case 2: m_statusLine3->SetLabel( aText ); break;
1202 default: wxFAIL_MSG( wxT( "Invalid status row number" ) ); break;
1203 }
1204}
1205
1206
1213
1214
1216{
1217 const std::string& payload = mail.GetPayload();
1218
1219 switch( mail.Command() )
1220 {
1222 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1223 // widgets:
1224 m_cannotClose = true;
1225 readNetListAndFpFiles( payload );
1226 m_cannotClose = false;
1227
1228 /* @todo
1229 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1230 */
1231 break;
1232
1233 case MAIL_RELOAD_LIB:
1234 m_cannotClose = true;
1238 m_cannotClose = false;
1239 break;
1240
1241 default:
1242 ; // ignore most
1243 }
1244}
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 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.
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
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
MAIL_T Command()
Returns the MAIL_T associated with this mail.
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.
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:294
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:507
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:200
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:535
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:132
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: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: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