KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cvpcb_mainframe.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <pgm_base.h>
27#include <bitmaps.h>
28#include <confirm.h>
29#include <eda_dde.h>
30#include <fp_lib_table.h>
31#include <kiface_base.h>
32#include <kiplatform/app.h>
33#include <kiway_express.h>
34#include <string_utils.h>
38#include <numeric>
39#include <tool/action_manager.h>
40#include <tool/action_toolbar.h>
41#include <tool/common_control.h>
44#include <tool/tool_manager.h>
46
47#include <cvpcb_association.h>
48#include <cvpcb_id.h>
49#include <cvpcb_mainframe.h>
52#include <kiplatform/ui.h>
53#include <listboxes.h>
54#include <tools/cvpcb_actions.h>
56#include <tools/cvpcb_control.h>
57#include <project_pcb.h>
58
59#include <wx/statline.h>
60#include <wx/stattext.h>
61#include <wx/button.h>
62
63
64CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
65 KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
66 wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "CvpcbFrame" ),
67 unityScale ),
68 m_mainToolBar( nullptr ),
69 m_footprintListBox( nullptr ),
70 m_librariesListBox( nullptr ),
71 m_symbolsListBox( nullptr ),
72 m_tcFilterString( nullptr ),
73 m_viewerPendingUpdate( false )
74{
75 m_modified = false;
76 m_cannotClose = false;
80 m_initialized = false;
81 m_aboutTitle = _( "Assign Footprints" );
82
83 // Give an icon
84 wxIcon icon;
85 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
86 SetIcon( icon );
87
88 SetAutoLayout( true );
89
91
92 setupTools();
96
99
102
105
107
108 m_auimgr.SetManagedWindow( this );
109
110 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
111
112 m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
113 .Caption( _( "Footprint Libraries" ) )
114 .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
115
116 m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
117 .Caption( _( "Symbol : Footprint Assignments" ) ) );
118
119 m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
120 .Caption( _( "Filtered Footprints" ) )
121 .BestSize((int) ( m_frameSize.x * 0.30 ), m_frameSize.y ) );
122
123 // Build the bottom panel, to display 2 status texts and the buttons:
124 auto bottomPanel = new wxPanel( this );
125 auto panelSizer = new wxBoxSizer( wxVERTICAL );
126
127 wxFlexGridSizer* fgSizerStatus = new wxFlexGridSizer( 3, 1, 0, 0 );
128 fgSizerStatus->SetFlexibleDirection( wxBOTH );
129 fgSizerStatus->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
130
131 m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
132 fgSizerStatus->Add( m_statusLine1, 0, 0, 5 );
133
134 m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
135 fgSizerStatus->Add( m_statusLine2, 0, 0, 5 );
136
137 m_statusLine3 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
138 fgSizerStatus->Add( m_statusLine3, 0, wxBOTTOM, 3 );
139
140 panelSizer->Add( fgSizerStatus, 1, wxEXPAND|wxLEFT, 2 );
141
142 m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
143 m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
144 m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
145
146 // Add buttons:
147 auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
148 auto sdbSizer = new wxStdDialogButtonSizer();
149
150 m_saveAndContinue = new wxButton( bottomPanel, wxID_ANY,
151 _( "Apply, Save Schematic && Continue" ) );
152 buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
153
154 auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
155 sdbSizer->AddButton( sdbSizerOK );
156 auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
157 sdbSizer->AddButton( sdbSizerCancel );
158 sdbSizer->Realize();
159
160 buttonsSizer->Add( sdbSizer, 0, 0, 5 );
161 panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
162
163 bottomPanel->SetSizer( panelSizer );
164 bottomPanel->Fit();
165
166 sdbSizerOK->SetDefault();
168
169 m_auimgr.AddPane( bottomPanel, EDA_PANE().HToolbar().Name( "Buttons" ).Bottom().Layer(6) );
170
171 m_auimgr.Update();
172 m_initialized = true;
173
174 auto setPaneWidth =
175 [this]( wxAuiPaneInfo& pane, int width )
176 {
177 // wxAUI hack: force width by setting MinSize() and then Fixed()
178 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
179 pane.MinSize( width, -1 );
180 pane.BestSize( width, -1 );
181 pane.MaxSize( width, -1 );
182 pane.Fixed();
183 m_auimgr.Update();
184
185 // now make it resizable again
186 pane.MinSize( 20, -1 );
187 pane.Resizable();
188 m_auimgr.Update();
189 };
190
191 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() ) )
192 {
193 m_tcFilterString->ChangeValue( cfg->m_FilterString );
194
195 if( cfg->m_LibrariesWidth > 0 )
196 setPaneWidth( m_auimgr.GetPane( "Libraries" ), cfg->m_LibrariesWidth );
197
198 if( cfg->m_FootprintsWidth > 0 )
199 setPaneWidth( m_auimgr.GetPane( "Footprints" ), cfg->m_FootprintsWidth );
200 }
201
202 // Connect Events
204
205 // Start the main processing loop
206 m_toolManager->InvokeTool( "cvpcb.Control" );
207
208 m_filterTimer->StartOnce( 100 );
209
210 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
211}
212
213
215{
216 Unbind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
218 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
219
220 Unbind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
221 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
222
223 // Stop the timer during destruction early to avoid potential race conditions (that do happen)
224 m_filterTimer->Stop();
225
226 // Shutdown all running tools
227 if( m_toolManager )
229
230 // Clean up the tool infrastructure
231 delete m_actions;
232 delete m_toolManager;
233 delete m_toolDispatcher;
234
235 m_auimgr.UnInit();
236}
237
238
240{
241 // Create the manager
242 m_actions = new CVPCB_ACTIONS();
244 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
246
247 // Register tools
252
254
255 // Even though these menus will open with the right-click, we treat them as a normal
256 // menu instead of a context menu because we don't care about their position and want
257 // to be able to tell the difference between a menu click and a hotkey activation.
258
259 // Create the context menu for the symbols list box
260 m_symbolsContextMenu = new ACTION_MENU( false, tool );
262 m_symbolsContextMenu->AppendSeparator();
266 m_symbolsContextMenu->AppendSeparator();
268
269 // Create the context menu for the footprint list box
270 m_footprintContextMenu = new ACTION_MENU( false, tool );
272}
273
274
276{
278
280 EDITOR_CONDITIONS cond( this );
281
282 wxASSERT( mgr );
283
284#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
285#define CHECK( x ) ACTION_CONDITIONS().Check( x )
286
291
292 auto compFilter =
293 [this] ( const SELECTION& )
294 {
296 };
297
298 auto libFilter =
299 [this] ( const SELECTION& )
300 {
302 };
303
304 auto pinFilter =
305 [this] ( const SELECTION& )
306 {
308 };
309
313
314#undef CHECK
315#undef ENABLE
316}
317
318
320{
321 // Connect the handlers to launch the context menus in the listboxes
322 m_footprintListBox->Bind( wxEVT_RIGHT_DOWN,
323 [this]( wxMouseEvent& )
324 {
325 PopupMenu( m_footprintContextMenu );
326 } );
327
328 m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
329 [this]( wxMouseEvent& )
330 {
331 PopupMenu( m_symbolsContextMenu );
332 } );
333
334 // Connect the handler for the save button
335 m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
336 [this]( wxCommandEvent& )
337 {
338 // saveAssociations must be run immediately
340 } );
341
342 // Connect the handlers for the ok/cancel buttons
343 Bind( wxEVT_BUTTON,
344 [this]( wxCommandEvent& )
345 {
346 // saveAssociations must be run immediately, before running Close( true )
348 Close( true );
349 }, wxID_OK );
350 Bind( wxEVT_BUTTON,
351 [this]( wxCommandEvent& )
352 {
353 Close( false );
354 }, wxID_CANCEL );
355
356 // Connect the handlers for the close events
357 Bind( wxEVT_MENU,
358 [this]( wxCommandEvent& )
359 {
360 Close( false );
361 }, wxID_CLOSE );
362 Bind( wxEVT_MENU,
363 [this]( wxCommandEvent& )
364 {
365 Close( false );
366 }, wxID_EXIT );
367
368 // Toolbar events
369 Bind( wxEVT_TEXT, &CVPCB_MAINFRAME::onTextFilterChanged, this );
370
371 // Just skip the resize events
372 Bind( wxEVT_SIZE,
373 []( wxSizeEvent& aEvent )
374 {
375 aEvent.Skip();
376 } );
377
378 // Attach the events to the tool dispatcher
380 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
381
382 m_filterTimer = new wxTimer( this );
383 Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
384}
385
386
387bool CVPCB_MAINFRAME::canCloseWindow( wxCloseEvent& aEvent )
388{
389 if( m_modified )
390 {
391 // Shutdown blocks must be determined and vetoed as early as possible
393 && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
394 {
395 return false;
396 }
397
398 if( !HandleUnsavedChanges( this, _( "Symbol to Footprint links have been modified. "
399 "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{
419 GetFootprintViewerFrame()->Close( true );
420
421 m_modified = false;
422
423 // clear symbol selection in schematic:
425}
426
427
428void CVPCB_MAINFRAME::onTextFilterChanged( wxCommandEvent& event )
429{
430 // Called when changing the filter string in main toolbar.
431 // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
432 // of available footprints which match the filter
433
434 m_filterTimer->StartOnce( 200 );
435}
436
437
439{
440 // GTK loses the search-control's focus on a Refresh event, so we record the focus and
441 // insertion point here and then restore them at the end.
442 bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
443 long pos = m_tcFilterString->GetInsertionPoint();
444
446 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
447
448 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
450
451 if( symbol && symbol->GetFPID().IsValid() )
453 else if( m_footprintListBox->GetSelection() >= 0 )
455
457
459
460 if( searchCtrlHasFocus && !m_tcFilterString->HasFocus() )
461 {
462 m_tcFilterString->SetFocus();
463 m_tcFilterString->SetInsertionPoint( pos );
464 }
465}
466
467
468void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
469{
471 return;
472
474 wxString libraryName = m_librariesListBox->GetSelectedLibrary();
475
476 m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
478
479 if( symbol && symbol->GetFPID().IsValid() )
481 else if( m_footprintListBox->GetSelection() >= 0 )
483
485
486 refreshAfterSymbolSearch( symbol );
487}
488
489
491{
493 {
494 Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
496 }
497}
498
499
501{
502 Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
503 m_viewerPendingUpdate = false;
504
505 // On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
506 // are opened and refreshed when a new footprint is selected.
507 // If the listbox has the focus before selecting a new footprint, it will be forced
508 // after selection.
509 bool footprintListHasFocus = m_footprintListBox->HasFocus();
510 bool symbolListHasFocus = m_symbolsListBox->HasFocus();
511
512 // If the footprint view window is displayed, update the footprint.
515
517
518 if( footprintListHasFocus )
519 m_footprintListBox->SetFocus();
520 else if( symbolListHasFocus )
521 m_symbolsListBox->SetFocus();
522}
523
524
526{
528
529 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
530
532}
533
534
536{
538
539 CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
541 cfg->m_FilterString = m_tcFilterString->GetValue();
542
543 cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
544 cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
545}
546
547
549{
550 if( m_undoList.size() == 0 )
551 return;
552
553 CVPCB_UNDO_REDO_ENTRIES redoEntries;
554 CVPCB_UNDO_REDO_ENTRIES curEntry = m_undoList.back();
555 m_undoList.pop_back();
556
557 // Iterate over the entries to undo
558 for( const auto& assoc : curEntry )
559 {
560 AssociateFootprint( assoc, true, false );
561 redoEntries.emplace_back( assoc.Reverse() );
562 }
563
564 // Add the redo entries to the redo stack
565 m_redoList.emplace_back( redoEntries );
566}
567
568
570{
571 if( m_redoList.size() == 0 )
572 return;
573
574 CVPCB_UNDO_REDO_ENTRIES curEntry = m_redoList.back();
575 m_redoList.pop_back();
576
577 // Iterate over the entries to undo
578 bool firstAssoc = true;
579
580 for( const auto& assoc : curEntry )
581 {
582 AssociateFootprint( assoc, firstAssoc );
583 firstAssoc = false;
584 }
585}
586
587
588wxString CVPCB_MAINFRAME::formatSymbolDesc( int idx, const wxString& aReference,
589 const wxString& aValue, const wxString& aFootprint )
590{
591 // Work around a bug in wxString::Format with double-byte chars (and double-quote, for some
592 // reason).
593 wxString desc = wxString::Format( wxT( "%3d " ), idx );
594
595 for( int ii = aReference.Length(); ii < 8; ++ii )
596 desc += wxS( " " );
597
598 desc += aReference + wxT( " - " );
599
600 for( int ii = aValue.Length(); ii < 16; ++ii )
601 desc += wxS( " " );
602
603 desc += aValue + wxT( " : " ) + aFootprint;
604
605 return desc;
606}
607
608
610 bool aNewEntry, bool aAddUndoItem )
611{
612 if( m_netlist.IsEmpty() )
613 return;
614
615 COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
616
617 if( symbol == nullptr )
618 return;
619
620 LIB_ID fpid = aAssociation.GetNewFootprint();
621 LIB_ID oldFpid = symbol->GetFPID();
622
623 // Test for validity of the requested footprint
624 if( !fpid.empty() && !fpid.IsValid() )
625 {
626 wxString msg = wxString::Format( _( "'%s' is not a valid footprint." ),
627 fpid.Format().wx_str() );
628 DisplayErrorMessage( this, msg );
629 return;
630 }
631
632 const KIID& id = symbol->GetKIIDs().front();
633
634 // Set new footprint to all instances of the selected symbol
635 for( unsigned int idx : GetComponentIndices() )
636 {
637 COMPONENT* candidate = m_netlist.GetComponent( idx );
638 const std::vector<KIID>& kiids = candidate->GetKIIDs();
639
640 if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
641 {
642 // Set the new footprint
643 candidate->SetFPID( fpid );
644
645 // create the new symbol description and set it
646 wxString description = formatSymbolDesc( idx + 1,
647 candidate->GetReference(),
648 candidate->GetValue(),
649 candidate->GetFPID().Format().wx_str() );
650 m_symbolsListBox->SetString( idx, description );
651
652 if( !m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() ) )
654 else
656 }
657 }
658
659 // Mark the data as being modified
660 m_modified = true;
661
662 // Update the statusbar and refresh the list
664 m_symbolsListBox->Refresh();
665
666 if( !aAddUndoItem )
667 return;
668
669 // Update the undo list
670 if ( aNewEntry )
671 {
672 // Create a new entry for this association
674 newEntry.emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(), oldFpid,
675 aAssociation.GetNewFootprint() ) );
676 m_undoList.emplace_back( newEntry );
677
678 // Clear the redo list
679 m_redoList.clear();
680 }
681 else
682 {
683 m_undoList.back().emplace_back( CVPCB_ASSOCIATION( aAssociation.GetComponentIndex(),
684 oldFpid,
685 aAssociation.GetNewFootprint() ) );
686 }
687
688}
689
690
691bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
692{
693 return true;
694}
695
696
698{
699 // Tell AuiMgr that objects are changed !
700 if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
701 m_auimgr.Update(); // (could be not the case when starting CvPcb)
702
703 if( aSymbol == nullptr )
704 {
706 return;
707 }
708
709 // Preview of the already assigned footprint.
710 // Find the footprint that was already chosen for this aSymbol and select it,
711 // but only if the selection is made from the aSymbol list or the library list.
712 // If the selection is made from the footprint list, do not change the current
713 // selected footprint.
714 if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
715 {
716 wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
717
719
720 for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
721 {
722 wxString candidateName;
723 wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
724 msg.Trim( true );
725 msg.Trim( false );
726 candidateName = msg.AfterFirst( wxChar( ' ' ) );
727
728 if( footprintName.Cmp( candidateName ) == 0 )
729 {
730 m_footprintListBox->SetSelection( ii, true );
731 break;
732 }
733 }
734 }
735
738}
739
740
743{
744 int option = aFilter;
745
746 // Apply the filter accordingly
747 switch( aAction )
748 {
752 }
753
754 wxListEvent l_event;
755 OnSelectComponent( l_event );
756}
757
758
760{
761 if( !m_initialized )
762 return;
763
764 wxString filters, msg;
766
768 {
769 msg.Empty();
770
771 if( symbol )
772 {
773 for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
774 {
775 if( msg.IsEmpty() )
776 msg += symbol->GetFootprintFilters()[ii];
777 else
778 msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
779 }
780 }
781
782 filters += _( "Keywords" );
783
784 if( !msg.IsEmpty() )
785 filters += wxString::Format( wxT( " (%s)" ), msg );
786 }
787
789 {
790 msg.Empty();
791
792 if( symbol )
793 msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
794
795 if( !filters.IsEmpty() )
796 filters += wxT( ", " );
797
798 filters += _( "Pin Count" );
799
800 if( !msg.IsEmpty() )
801 filters += wxString::Format( wxT( " (%s)" ), msg );
802 }
803
805 {
807
808 if( !filters.IsEmpty() )
809 filters += wxT( ", " );
810
811 filters += _( "Library" );
812
813 if( !msg.IsEmpty() )
814 filters += wxString::Format( wxT( " (%s)" ), msg );
815 }
816
817 wxString textFilter = m_tcFilterString->GetValue();
818
819 if( !textFilter.IsEmpty() )
820 {
821 if( !filters.IsEmpty() )
822 filters += wxT( ", " );
823
824 filters += _( "Search Text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
825 }
826
827 if( filters.IsEmpty() )
828 msg = _( "No Filtering" );
829 else
830 msg.Printf( _( "Filtered by %s" ), filters );
831
832 msg += wxString::Format( _( ": %i matching footprints" ), m_footprintListBox->GetCount() );
833
834 SetStatusText( msg );
835
836
837 msg.Empty();
838 wxString footprintName = GetSelectedFootprint();
839
840 FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( footprintName );
841
842 if( fp ) // can be NULL if no netlist loaded
843 {
844 msg = wxString::Format( _( "Description: %s; Keywords: %s" ),
845 fp->GetDesc(),
846 fp->GetKeywords() );
847 }
848
849 SetStatusText( msg, 1 );
850
851 msg.Empty();
852 wxString lib;
853
854 // Choose the footprint to get the information on
855 if( fp )
856 {
857 // Use the footprint in the footprint viewer
858 lib = fp->GetLibNickname();
859 }
861 {
862 // Use the footprint of the selected symbol
863 if( symbol )
864 lib = symbol->GetFPID().GetUniStringLibNickname();
865 }
867 {
868 // Use the library that is selected
870 }
871
872 // Extract the library information
874
875 if( fptbl->HasLibrary( lib ) )
876 msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
877 else
878 msg = wxString::Format( _( "Library location: unknown" ) );
879
880 SetStatusText( msg, 2 );
881}
882
883
885{
887
888 // Check if there are footprint libraries in the footprint library table.
889 if( !fptbl || !fptbl->GetLogicalLibs().size() )
890 {
891 wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
892 "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
893 return false;
894 }
895
896 WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
897
898 m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
899
902
903 return true;
904}
905
906
907void CVPCB_MAINFRAME::SendComponentSelectionToSch( bool aClearSelectionOnly )
908{
909 if( m_netlist.IsEmpty() )
910 return;
911
912 std::string command = "$SELECT: ";
913
914 if( aClearSelectionOnly )
915 {
916 // Sending an empty list means clearing the selection.
917 if( Kiface().IsSingle() )
918 SendCommand( MSG_TO_SCH, command );
919 else
920 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
921
922 return;
923 }
924
925 int selection = m_symbolsListBox->GetSelection();
926
927 if( selection < 0 ) // Nothing selected
928 return;
929
930 if( m_netlist.GetComponent( selection ) == nullptr )
931 return;
932
933 // Now select the corresponding symbol on the schematic:
934 wxString ref = m_netlist.GetComponent( selection )->GetReference();
935
936 // The prefix 0,F before the reference is for selecting the symbol
937 // (one can select a pin with a different prefix)
938 command += wxT( "0,F" ) + EscapeString( ref, CTX_IPC );
939
940 if( Kiface().IsSingle() )
941 SendCommand( MSG_TO_SCH, command );
942 else
943 Kiway().ExpressMail( FRAME_SCH, MAIL_SELECTION, command, this );
944}
945
946
947int CVPCB_MAINFRAME::readSchematicNetlist( const std::string& aNetlist )
948{
949 STRING_LINE_READER* stringReader = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
950 KICAD_NETLIST_READER netlistReader( stringReader, &m_netlist );
951
953
954 try
955 {
956 netlistReader.LoadNetlist();
957 }
958 catch( const IO_ERROR& ioe )
959 {
960 wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ),
961 ioe.What().GetData() );
962 wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
963 return 1;
964 }
965
966 // We also remove footprint name if it is "$noname" because this is a dummy name,
967 // not the actual name of the footprint.
968 for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
969 {
970 if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
972 }
973
974 // Sort symbols by reference:
976
977 return 0;
978}
979
980
982{
983 m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
986}
987
988
990{
994 std::set<wxString> pinnedMatches;
995 std::set<wxString> otherMatches;
997
998 auto process =
999 [&]( const wxString& aNickname )
1000 {
1001 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
1002 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
1003 {
1004 pinnedMatches.insert( aNickname );
1005 }
1006 else
1007 {
1008 otherMatches.insert( aNickname );
1009 }
1010 };
1011
1012
1013 if( tbl )
1014 {
1015 wxArrayString libNames;
1016
1017 std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
1018
1019 for( const wxString& libNickName : libNickNames )
1020 process( libNickName );
1021 }
1022
1023 for( const wxString& nickname : pinnedMatches )
1025
1026 for( const wxString& nickname : otherMatches )
1027 m_librariesListBox->AppendLine( nickname );
1028
1030}
1031
1032
1034{
1035 int selection = m_symbolsListBox->GetSelection();
1036
1037 if( selection >= 0 && selection < (int) m_netlist.GetCount() )
1038 return m_netlist.GetComponent( selection );
1039
1040 return nullptr;
1041}
1042
1043
1044void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
1045{
1046 m_skipComponentSelect = aSkipUpdate;
1047
1048 if( aIndex < 0 )
1049 {
1051 }
1052 else if( aIndex < m_symbolsListBox->GetCount() )
1053 {
1055 m_symbolsListBox->SetSelection( aIndex );
1057 }
1058
1059 m_skipComponentSelect = false;
1060}
1061
1062
1063std::vector<unsigned int>
1065{
1066 std::vector<unsigned int> idx;
1067 int lastIdx;
1068
1069 // Make sure a netlist has been loaded and the box has contents
1070 if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
1071 return idx;
1072
1073 switch( aCriteria )
1074 {
1076 idx.resize( m_netlist.GetCount() );
1077 std::iota( idx.begin(), idx.end(), 0 );
1078 break;
1079
1081 // Check to see if anything is selected
1082 if( m_symbolsListBox->GetSelectedItemCount() < 1 )
1083 break;
1084
1085 // Get the symbols
1086 lastIdx = m_symbolsListBox->GetFirstSelected();
1087 idx.emplace_back( lastIdx );
1088
1089 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
1090 while( lastIdx > 0 )
1091 {
1092 idx.emplace_back( lastIdx );
1093 lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
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
1106 for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
1107 {
1108 if( !m_netlist.GetComponent( i )->GetFPID().empty() )
1109 idx.emplace_back( i );
1110 }
1111 break;
1112
1113 default:
1114 wxASSERT_MSG( false, "Invalid symbol selection criteria" );
1115 }
1116
1117 return idx;
1118}
1119
1120
1122{
1123 // returns the Footprint Viewer frame, if exists, or NULL
1124 wxWindow* window = wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME );
1125 return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>( window );
1126}
1127
1128
1130{
1131 return GetFootprintViewerFrame();
1132}
1133
1134
1136{
1138 else if( m_symbolsListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_COMPONENT;
1139 else if( m_footprintListBox->HasFocus() ) return CVPCB_MAINFRAME::CONTROL_FOOTPRINT;
1141}
1142
1143
1145{
1146 switch( aLB )
1147 {
1151 default: break;
1152 }
1153}
1154
1155
1157{
1158 // returns the LIB_ID of the selected footprint in footprint listview
1159 // or a empty string
1161}
1162
1163
1164void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
1165{
1166 switch( aNumber )
1167 {
1168 case 0: m_statusLine1->SetLabel( aText ); break;
1169 case 1: m_statusLine2->SetLabel( aText ); break;
1170 case 2: m_statusLine3->SetLabel( aText ); break;
1171 default: wxFAIL_MSG( "Invalid status row number" ); break;
1172 }
1173}
1174
1175
1177{
1180 DisplayStatus();
1181}
1182
1183
1185{
1186 const std::string& payload = mail.GetPayload();
1187
1188 switch( mail.Command() )
1189 {
1191 // Disable Close events during readNetListAndFpFiles() to avoid crash when updating
1192 // widgets:
1193 m_cannotClose = true;
1194 readNetListAndFpFiles( payload );
1195 m_cannotClose = false;
1196 /* @todo
1197 Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
1198 */
1199 break;
1200 case MAIL_RELOAD_LIB:
1201 m_cannotClose = true;
1205 m_cannotClose = false;
1206 break;
1207 default:
1208 ; // ignore most
1209 }
1210}
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:111
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
static TOOL_ACTION paste
Definition: actions.h:70
static TOOL_ACTION copy
Definition: actions.h:69
static TOOL_ACTION undo
Definition: actions.h:66
static TOOL_ACTION redo
Definition: actions.h:67
static TOOL_ACTION cut
Definition: actions.h:68
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
Handle actions that are shared between different applications.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:86
const wxString & GetReference() const
Definition: pcb_netlist.h:127
const wxString & GetValue() const
Definition: pcb_netlist.h:130
int GetPinCount() const
Definition: pcb_netlist.h:158
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:144
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:155
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:152
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:145
Gather all the actions that are shared by tools.
Definition: cvpcb_actions.h:38
static TOOL_ACTION saveAssociationsToFile
Definition: cvpcb_actions.h:57
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:69
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:68
static TOOL_ACTION deleteAssoc
Definition: cvpcb_actions.h:64
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:67
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
Definition: cvpcb_actions.h:56
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:49
A class to define a footprint association to be made in cvpcb.
unsigned int GetComponentIndex() const
Get the index of the component to modify the association of.
LIB_ID GetNewFootprint() const
Get the new footprint to associate to the component.
CVPCB_CONTROL.
Definition: cvpcb_control.h:36
bool readNetListAndFpFiles(const std::string &aNetlist)
Load the netlist file built on the fly by Eeschema and loads footprint libraries from fp lib tables.
wxTimer * m_filterTimer
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void ShowChangedLanguage() override
void SendComponentSelectionToSch(bool aClearSelectionOnly=false)
Send a remote command to Eeschema via a socket,.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void doCloseWindow() override
CVPCB_UNDO_REDO_LIST m_redoList
ACTION_MENU * m_symbolsContextMenu
wxStaticText * m_statusLine3
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const
Find out which control currently has focus.
CVPCB_FILTER_ACTION
The action to apply to a footprint filter when it is modified.
@ FILTER_DISABLE
Turn off the filter.
@ FILTER_ENABLE
Turn on the filter.
@ FILTER_TOGGLE
Toggle the filter state.
void onTextFilterChangedTimer(wxTimerEvent &aEvent)
void onTextFilterChanged(wxCommandEvent &event)
LIBRARY_LISTBOX * m_librariesListBox
void setupTools()
Setup the tool system for the CVPCB main frame.
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame() const
wxButton * m_saveAndContinue
void RedoAssociation()
Redo the most recently undone association.
bool LoadFootprintFiles()
Read the list of footprint (*.mod files) and generate the list of footprints.
void SetStatusText(const wxString &aText, int aNumber=0) override
wxString GetSelectedFootprint()
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
CVPCB_MAINFRAME(KIWAY *aKiway, wxWindow *aParent)
void SetFootprintFilter(FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter, CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction)
Set a filter criteria to either on/off or toggle the criteria.
wxStaticText * m_statusLine1
void setupEventHandlers()
Setup event handlers.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void SetSelectedComponent(int aIndex, bool aSkipUpdate=false)
Set the currently selected component in the components listbox.
ACTION_MENU * m_footprintContextMenu
CONTROL_TYPE
The type of the controls present in the application.
@ CONTROL_NONE
No controls have focus.
@ CONTROL_LIBRARY
Library listbox.
@ CONTROL_FOOTPRINT
Footprint listbox.
@ CONTROL_COMPONENT
Component listbox.
wxString formatSymbolDesc(int idx, const wxString &aReference, const wxString &aValue, const wxString &aFootprint)
void SetFocusedControl(CVPCB_MAINFRAME::CONTROL_TYPE aControl)
Set the focus to a specific control.
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
void OnSelectComponent(wxListEvent &event)
Called when clicking on a component in component list window:
void UndoAssociation()
Undo the most recent associations that were performed.
void DisplayStatus()
Update the information displayed on the status bar at bottom of the main frame.
ACTION_TOOLBAR * m_mainToolBar
CVPCB_UNDO_REDO_LIST m_undoList
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
FOOTPRINT_LIST * m_FootprintsList
wxWindow * GetToolCanvas() const override
Canvas access.
std::vector< unsigned int > GetComponentIndices(CVPCB_MAINFRAME::CRITERIA aCriteria=CVPCB_MAINFRAME::ALL_COMPONENTS)
Get the indices for all the components meeting the specified criteria in the components listbox.
void AssociateFootprint(const CVPCB_ASSOCIATION &aAssociation, bool aNewEntry=true, bool aAddUndoItem=true)
Associate a footprint with a specific component in the list.
void updateFootprintViewerOnIdle(wxIdleEvent &aEvent)
void refreshAfterSymbolSearch(COMPONENT *aSymbol)
wxStaticText * m_statusLine2
FOOTPRINTS_LISTBOX * m_footprintListBox
CRITERIA
Criteria to use to identify sets of components.
@ ALL_COMPONENTS
All components.
@ NA_COMPONENTS
Not associated components.
@ SEL_COMPONENTS
Selected components.
@ ASSOC_COMPONENTS
Associated components.
SYMBOLS_LISTBOX * m_symbolsListBox
TOOL_DISPATCHER * m_toolDispatcher
int readSchematicNetlist(const std::string &aNetlist)
Read the netlist (.net) file built on the fly by Eeschema.
bool SaveFootprintAssociation(bool doSaveSchematic)
Save the edits that the user has done by sending them back to Eeschema via the kiway.
wxTextCtrl * m_tcFilterString
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
wxString m_FilterString
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
wxString m_aboutTitle
void ReCreateMenuBar()
Recreates the menu bar.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Class that groups generic conditions for editor states.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
virtual SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION ContentModified()
Create a functor that tests if the content of the frame is modified.
void SetSelectedFootprint(const LIB_ID &aFPID)
void SetFootprints(FOOTPRINT_LIST &aList, const wxString &aLibName, COMPONENT *aComponent, const wxString &aFootPrintFilterPattern, int aFilterType)
Populate the wxListCtrl with the footprints from aList that meet the filter criteria defined by aFilt...
FP_FILTER_T
Filter setting constants.
Definition: listboxes.h:93
@ FILTERING_BY_COMPONENT_FP_FILTERS
Definition: listboxes.h:95
wxString OnGetItemText(long item, long column) const override
This overloaded function MUST be provided for the wxLC_VIRTUAL mode because real data is not handled ...
void SetSelection(int aIndex, bool aState=true)
wxString GetLibNickname() const override
wxString GetKeywords()
wxString GetDesc() override
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
unsigned GetErrorCount() const
virtual bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)=0
Read all the footprints provided by the combination of aTable and aNickname.
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
void DeselectAll()
Remove all selection in lists which can have more than one item selected.
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
Definition: kiid.h:49
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:58
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:50
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:55
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:67
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:196
void AppendLine(const wxString &text)
wxString GetSelectedLibrary()
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
bool empty() const
Definition: lib_id.h:193
UTF8 Format() const
Definition: lib_id.cpp:118
const wxString GetUniStringLibNickname() const
Definition: lib_id.h:88
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
static const wxString GetPinningSymbol()
unsigned GetCount() const
Definition: pcb_netlist.h:244
bool IsEmpty() const
Definition: pcb_netlist.h:234
void Clear()
Remove all components from the netlist.
Definition: pcb_netlist.h:239
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
Definition: pcb_netlist.h:252
void SortByReference()
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:70
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Definition: project_pcb.cpp:37
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:166
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:253
void SetString(unsigned linecount, const wxString &text)
void SetSelection(int index, bool State=true)
void AppendWarning(int index)
void RemoveWarning(int index)
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:168
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h: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:297
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
const char * c_str() const
Definition: utf8.h:103
wxString wx_str() const
Definition: utf8.cpp:45
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:240
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:305
This file is part of the common library.
@ ID_CVPCB_LIBRARY_LIST
Definition: cvpcb_id.h:33
@ ID_CVPCB_FOOTPRINT_LIST
Definition: cvpcb_id.h:32
@ ID_CVPCB_COMPONENT_LIST
Definition: cvpcb_id.h:31
#define CHECK(x)
#define ENABLE(x)
std::vector< CVPCB_ASSOCIATION > CVPCB_UNDO_REDO_ENTRIES
#define FOOTPRINTVIEWER_FRAME_NAME
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
bool SendCommand(int aService, const std::string &aMessage)
Used by a client to sent (by a socket connection) a data to a server.
Definition: eda_dde.cpp:310
DDE server & client.
#define MSG_TO_SCH
Definition: eda_dde.h:50
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_CVPCB
Definition: frame_type.h:52
@ MAIL_SELECTION
Definition: mail_type.h:40
@ MAIL_RELOAD_LIB
Definition: mail_type.h:56
@ MAIL_EESCHEMA_NETLIST
Definition: mail_type.h:44
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:79
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:94
KICOMMON_API wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:89
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:127
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:100
static PGM_BASE * process
Definition: pgm_base.cpp:1057
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
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