KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_base_frame.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) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <algorithm>
22#include <advanced_config.h>
23#include <base_units.h>
25#include <kiplatform/io.h>
28#include <kiway.h>
30#include <pgm_base.h>
31#include <eda_list_dialog.h>
34#include <eeschema_settings.h>
38#include <sch_draw_panel.h>
40#include <sch_group.h>
41#include <sch_view.h>
42#include <sch_painter.h>
43#include <sch_shape.h>
46#include <widgets/wx_infobar.h>
47#include <string_utils.h>
48#include <confirm.h>
50#include <project_sch.h>
53#include <sch_base_frame.h>
54#include <tools/sch_actions.h>
56#include <design_block.h>
57#include <thread_pool.h>
58#include <tool/actions.h>
59#include <tool/action_toolbar.h>
60#include <tool/tool_manager.h>
64#include <trace_helpers.h>
65#include <view/view_controls.h>
66#include <widgets/kistatusbar.h>
67#include <wx/choicdlg.h>
68#include <wx/evtloop.h>
69#include <wx/fswatcher.h>
70#include <wx/log.h>
71#include <wx/msgdlg.h>
72#include <trace_helpers.h>
73
74#if defined(__linux__) || defined(__FreeBSD__)
76#else
78#include <wx/fdrepdlg.h>
79#endif
80
81
83 wxWindow* aParent, bool aShowErrorMsg )
84{
85 wxCHECK_MSG( aLibMgr, nullptr, wxS( "Invalid symbol library manager adapter." ) );
86
87 LIB_SYMBOL* symbol = nullptr;
88
89 try
90 {
91 symbol = aLibMgr->LoadSymbol( aLibId );
92
93 if( !symbol && aCacheLib )
94 {
95 wxCHECK_MSG( aCacheLib->IsCache(), nullptr, wxS( "Invalid cache library." ) );
96
97 wxString cacheName = aLibId.GetLibNickname().wx_str();
98 cacheName << "_" << aLibId.GetLibItemName();
99 symbol = aCacheLib->FindSymbol( cacheName );
100 }
101 }
102 catch( const IO_ERROR& ioe )
103 {
104 if( aShowErrorMsg )
105 {
106 wxString msg = wxString::Format( _( "Error loading symbol %s from library '%s'." ),
107 aLibId.GetLibItemName().wx_str(),
108 aLibId.GetLibNickname().wx_str() );
109 DisplayErrorMessage( aParent, msg, ioe.What() );
110 }
111 }
112
113 return symbol;
114}
115
116
117SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindowType, const wxString& aTitle,
118 const wxPoint& aPosition, const wxSize& aSize, long aStyle,
119 const wxString& aFrameName ) :
120 EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName, schIUScale ),
121 m_selectionFilterPanel( nullptr ),
122 m_findReplaceDialog( nullptr ),
123 m_base_frame_defaults( nullptr, "base_Frame_defaults" ),
125 m_watcherIsDir( false ),
127{
128 m_findReplaceData = std::make_unique<SCH_SEARCH_DATA>();
129
130 if( ( aStyle & wxFRAME_NO_TASKBAR ) == 0 )
131 createCanvas();
132
133 Bind( wxEVT_IDLE,
134 [this]( wxIdleEvent& aEvent )
135 {
136 // Handle cursor adjustments. While we can get motion and key events through
137 // wxWidgets, we can't get modifier-key-up events.
138 if( m_toolManager )
139 {
141
142 if( selTool )
143 selTool->OnIdle( aEvent );
144 }
145 } );
146
147 Pgm().GetBackgroundJobMonitor().RegisterStatusBar( static_cast<KISTATUSBAR*>( GetStatusBar() ) );
148
150}
151
152
155{
156 Pgm().GetBackgroundJobMonitor().UnregisterStatusBar( static_cast<KISTATUSBAR*>( GetStatusBar() ) );
157}
158
159
161{
162 GetCanvas()->SetEvtHandlerEnabled( false );
164
165 // Shutdown all running tools
166 if( m_toolManager )
167 m_toolManager->ShutdownAllTools();
168
169 // Close the find dialog and preserve its setting if it is displayed.
171 {
173 m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
174
175 m_findReplaceDialog->Destroy();
176 m_findReplaceDialog = nullptr;
177 }
178
179 // This class is pure virtual. Derived class will finish shutdown and Destroy().
180}
181
182
187
188
190{
191 return dynamic_cast<EESCHEMA_SETTINGS*>( config() );
192}
193
194
199
200
202{
203 switch( GetFrameType() )
204 {
205 case FRAME_SCH:
206 default:
207 return GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
208
210 case FRAME_SCH_VIEWER:
212 return GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
213 }
214}
215
216
217void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
218{
219 GetScreen()->SetPageSettings( aPageSettings );
220}
221
222
224{
225 return GetScreen()->GetPageSettings();
226}
227
228
230{
231 // GetSizeIU is compile time dependent:
232 return GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
233}
234
235
237{
238 wxASSERT( GetScreen() );
239 return GetScreen()->GetTitleBlock();
240}
241
242
244{
245 wxASSERT( GetScreen() );
246 GetScreen()->SetTitleBlock( aTitleBlock );
247}
248
249
251{
252 wxString line;
253 BASE_SCREEN* screen = GetScreen();
254
255 if( !screen )
256 return;
257
259
260 // Display absolute and relative coordinates
262 VECTOR2D d = cursorPos - screen->m_LocalOrigin;
263
264 line.Printf( wxS( "X %s Y %s" ),
265 MessageTextFromValue( cursorPos.x, false ),
266 MessageTextFromValue( cursorPos.y, false ) );
267 SetStatusText( line, 2 );
268
269 line.Printf( wxS( "dx %s dy %s dist %s" ),
270 MessageTextFromValue( d.x, false ),
271 MessageTextFromValue( d.y, false ),
272 MessageTextFromValue( hypot( d.x, d.y ), false ) );
273 SetStatusText( line, 3 );
274
277}
278
279
280LIB_SYMBOL* SCH_BASE_FRAME::GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg )
281{
282 LEGACY_SYMBOL_LIB* cache = aUseCacheLib ? PROJECT_SCH::LegacySchLibs( &Prj() )->GetCacheLibrary()
283 : nullptr;
284
285 return SchGetLibSymbol( aLibId, PROJECT_SCH::SymbolLibAdapter( &Prj() ), cache, this, aShowErrorMsg );
286}
287
288
289void SCH_BASE_FRAME::RedrawScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer )
290{
291 GetCanvas()->GetView()->SetCenter( aCenterPoint );
292
293 if( aWarpPointer )
295
296 GetCanvas()->Refresh();
297}
298
299
301{
302 if( GetCanvas() && GetCanvas()->GetView() )
303 {
306 }
307}
308
309
314
315
317{
318 if( GetCanvas() && GetCanvas()->GetView() )
319 {
320 if( KIGFX::PAINTER* painter = GetCanvas()->GetView()->GetPainter() )
321 return static_cast<SCH_RENDER_SETTINGS*>( painter->GetSettings() );
322 }
323
324 return nullptr;
325}
326
327
329{
331
332 SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize, GetGalDisplayOptions(),
333 m_canvasType ) );
335}
336
337
339{
341
342 try
343 {
344 if( !m_spaceMouse )
345 {
346#if defined(__linux__) || defined(__FreeBSD__)
347 m_spaceMouse = std::make_unique<SPNAV_2D_PLUGIN>( GetCanvas() );
348 m_spaceMouse->SetScale( schIUScale.IU_PER_MILS / pcbIUScale.IU_PER_MILS );
349#else
350 m_spaceMouse = std::make_unique<NL_SCHEMATIC_PLUGIN>();
351#endif
352 }
353
354 m_spaceMouse->SetCanvas( GetCanvas() );
355 }
356 catch( const std::exception& e )
357 {
358 wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), wxS( "%s" ), e.what() );
359 }
360 catch( ... )
361 {
362 wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), wxT( "Unknown exception during SpaceMouse initialization" ) );
363 }
364}
365
366
367void SCH_BASE_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
368{
369 EDA_ITEM* parent = aItem->GetParent();
370
371 if( aItem->Type() == SCH_SHEET_PIN_T )
372 {
373 // Sheet pins aren't in the view. Refresh their parent.
374 if( parent )
375 GetCanvas()->GetView()->Update( parent );
376 }
377 else
378 {
379 if( aItem->Type() == SCH_SHAPE_T )
380 static_cast<SCH_SHAPE*>( aItem )->UpdateHatching();
381
382 if( !isAddOrDelete )
383 GetCanvas()->GetView()->Update( aItem );
384
385 // Some children are drawn from their parents. Mark them for re-paint.
386 if( parent && ( parent->Type() == SCH_SYMBOL_T
387 || parent->Type() == SCH_SHEET_T
388 || parent->Type() == SCH_LABEL_LOCATE_ANY_T
389 || parent->Type() == SCH_TABLE_T ) )
390 {
391 GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
392 }
393 }
394
395 /*
396 * Be careful when calling this. Update will invalidate RTree iterators, so you cannot
397 * call this while doing things like `for( SCH_ITEM* item : screen->Items() )`
398 */
399 if( aUpdateRtree && dynamic_cast<SCH_ITEM*>( aItem ) )
400 {
401 GetScreen()->Update( static_cast<SCH_ITEM*>( aItem ) );
402
403 /*
404 * If we are updating the group, we also need to update all the children otherwise
405 * their positions will remain stale in the RTree
406 */
407 if( SCH_GROUP* group = dynamic_cast<SCH_GROUP*>( aItem ) )
408 {
409 group->RunOnChildren(
410 [&]( SCH_ITEM* item )
411 {
412 GetScreen()->Update( item );
413 },
415 }
416 }
417
418 // Calling Refresh() here introduces a bi-stable state: when doing operations on a
419 // large number of items if at some point the refresh timer times out and does a
420 // refresh it will take long enough that the next item will also time out, and the
421 // next, and the next, etc.
422 // GetCanvas()->Refresh();
423}
424
425
427{
428 // We currently have two zoom-dependent renderings: text, which is rendered as bitmap text
429 // when too small to see the difference, and selection shadows.
430 //
431 // Because non-selected text is cached by OpenGL, we only apply the bitmap performance hack
432 // to selected text items.
433 //
434 // Thus, as it currently stands, all zoom-dependent items can be found in the list of selected
435 // items.
436 if( m_toolManager )
437 {
438 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
439 SELECTION& selection = selectionTool->GetSelection();
440 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
441
442 for( EDA_ITEM* item : selection )
443 {
444 // A canvas that pads shadow strokes itself only needs updating when bitmap text toggles
445 const bool scaled = !view->GetGAL()->SupportsStrokePixelPad()
447
448 if( item->RenderAsBitmap( view->GetGAL()->GetWorldScale() ) != item->IsShownAsBitmap() || scaled )
449 {
450 view->Update( item, KIGFX::REPAINT );
451
452 EDA_ITEM* parent = item->GetParent();
453
454 // Symbol children are drawn from their parents. Mark them for re-paint.
455 if( parent && parent->Type() == SCH_SYMBOL_T )
456 GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
457 }
458 }
459 }
460}
461
462
464{
465 // Null pointers will cause boost::ptr_vector to raise a boost::bad_pointer exception which
466 // will be unhandled. There is no valid reason to pass an invalid EDA_ITEM pointer to the
467 // screen append function.
468 wxCHECK( aItem, /* void */ );
469
470 SCH_SCREEN* screen = aScreen;
471
472 if( aScreen == nullptr )
473 screen = GetScreen();
474
475 if( aItem->Type() != SCH_TABLECELL_T )
476 screen->Append( (SCH_ITEM*) aItem );
477
478 if( screen == GetScreen() )
479 {
480 GetCanvas()->GetView()->Add( aItem );
481 UpdateItem( aItem, true ); // handle any additional parent semantics
482 }
483}
484
485
487{
488 auto screen = aScreen;
489
490 if( aScreen == nullptr )
491 screen = GetScreen();
492
493 if( screen == GetScreen() )
494 GetCanvas()->GetView()->Remove( aItem );
495
496 if( aItem->Type() != SCH_TABLECELL_T )
497 screen->Remove( (SCH_ITEM*) aItem );
498
499 if( screen == GetScreen() )
500 UpdateItem( aItem, true ); // handle any additional parent semantics
501}
502
503
505{
506 // Let tools add things to the view if necessary
507 if( m_toolManager )
509
510 // Callers change text such as references without updating the items, so every cache is stale
512}
513
514
519
520
522{
523 wxString findString;
524
525 SCH_SELECTION& selection = m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
527
528 if( selection.Size() == 1 && selection.Front() != findTool->GetLastFoundItem() )
529 {
530 EDA_ITEM* front = selection.Front();
531
532 switch( front->Type() )
533 {
534 case SCH_SYMBOL_T:
535 {
536 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( front );
537 findString = UnescapeString( symbol->GetField( FIELD_T::VALUE )->GetText() );
538 break;
539 }
540
541 case SCH_FIELD_T:
542 findString = UnescapeString( static_cast<SCH_FIELD*>( front )->GetText() );
543 break;
544
545 case SCH_LABEL_T:
547 case SCH_HIER_LABEL_T:
548 case SCH_SHEET_PIN_T:
549 findString = UnescapeString( static_cast<SCH_LABEL_BASE*>( front )->GetText() );
550 break;
551
552 case SCH_TEXT_T:
553 findString = UnescapeString( static_cast<SCH_TEXT*>( front )->GetText() );
554
555 if( findString.Contains( wxT( "\n" ) ) )
556 findString = findString.Before( '\n' );
557
558 break;
559
560 default:
561 break;
562 }
563 }
564
566 m_findReplaceDialog->Destroy();
567
568 m_findReplaceDialog = new DIALOG_SCH_FIND( this, static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ),
569 wxDefaultPosition, wxDefaultSize, aReplace ? wxFR_REPLACEDIALOG : 0 );
570
571 m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString );
573 m_findReplaceDialog->Show( true );
574}
575
576
577void SCH_BASE_FRAME::ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime )
578{
579 // Prepare the infobar, since we don't know its state
580 m_infoBar->RemoveAllButtons();
581 m_infoBar->AddCloseButton();
582
583 m_infoBar->ShowMessageFor( aMsg, aStatusTime, wxICON_INFORMATION );
584}
585
586
588{
589 m_infoBar->Dismiss();
590}
591
592
594{
596 m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
597
598 m_findReplaceDialog->Destroy();
599 m_findReplaceDialog = nullptr;
600
602}
603
604
618
619
621{
622 if( !m_colorSettings || aForceRefresh )
623 {
625 wxString colorTheme = cfg ? cfg->m_ColorTheme : wxString( "" );
626
628 {
629 if( SYMBOL_EDITOR_SETTINGS* sym_edit_cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
630 {
631 if( !sym_edit_cfg->m_UseEeschemaColorSettings )
632 colorTheme = sym_edit_cfg->m_ColorTheme;
633 }
634 }
635
636 const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = ::GetColorSettings( colorTheme );
637 }
638
639 return m_colorSettings;
640}
641
642
647
648
649void SCH_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
650{
652
653 if( m_spaceMouse )
654 m_spaceMouse->SetFocus( aEvent.GetActive() );
655}
656
657
658void SCH_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
659{
661
662 if( m_spaceMouse )
663 m_spaceMouse->SetFocus( false );
664}
665
666
668 std::vector<wxArrayString>& aItemsToDisplay )
669{
670 aHeaders.Add( _( "Library" ) );
671 aHeaders.Add( _( "Description" ) );
672
676 std::vector<wxString> libNicknames = adapter->GetLibraryNames();
677 std::vector<wxArrayString> unpinned;
678
679 for( const wxString& nickname : libNicknames )
680 {
681 wxArrayString item;
682 wxString description = adapter->GetLibraryDescription( nickname ).value_or( wxEmptyString );
683
684 if( alg::contains( project.m_PinnedSymbolLibs, nickname )
685 || alg::contains( cfg->m_Session.pinned_symbol_libs, nickname ) )
686 {
687 item.Add( LIB_TREE_MODEL_ADAPTER::GetPinningSymbol() + nickname );
688 item.Add( description );
689 aItemsToDisplay.push_back( item );
690 }
691 else
692 {
693 item.Add( nickname );
694 item.Add( description );
695 unpinned.push_back( item );
696 }
697 }
698
699 std::sort( aItemsToDisplay.begin(), aItemsToDisplay.end(),
700 []( const wxArrayString& a, const wxArrayString& b )
701 {
702 return StrNumCmp( a[0], b[0], true ) < 0;
703 } );
704
705 std::sort( unpinned.begin(), unpinned.end(),
706 []( const wxArrayString& a, const wxArrayString& b )
707 {
708 return StrNumCmp( a[0], b[0], true ) < 0;
709 } );
710
711 std::ranges::copy( unpinned, std::back_inserter( aItemsToDisplay ) );
712}
713
714
715wxString SCH_BASE_FRAME::SelectLibrary( const wxString& aDialogTitle, const wxString& aListLabel,
716 const std::vector<std::pair<wxString, bool*>>& aExtraCheckboxes )
717{
718 static const int ID_MAKE_NEW_LIBRARY = wxID_HIGHEST;
719
720 // Keep asking the user for a new name until they give a valid one or cancel the operation
721 while( true )
722 {
723 wxArrayString headers;
724 std::vector<wxArrayString> itemsToDisplay;
725
726 GetLibraryItemsForListDialog( headers, itemsToDisplay );
727
728 wxString libraryName = Prj().GetRString( PROJECT::SCH_LIB_SELECT );
729
730 EDA_LIST_DIALOG dlg( this, aDialogTitle, headers, itemsToDisplay, libraryName, false );
731 dlg.SetListLabel( aListLabel );
732
733 for( const auto& [label, val] : aExtraCheckboxes )
734 dlg.AddExtraCheckbox( label, val );
735
736 wxButton* newLibraryButton = new wxButton( &dlg, ID_MAKE_NEW_LIBRARY, _( "New Library..." ) );
737 dlg.m_ButtonsSizer->Prepend( 80, 20 );
738 dlg.m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
739
740 newLibraryButton->Bind( wxEVT_BUTTON,
741 [&dlg]( wxCommandEvent& )
742 {
743 dlg.EndModal( ID_MAKE_NEW_LIBRARY );
745
746 dlg.Layout();
747 dlg.GetSizer()->Fit( &dlg );
748
749 int ret = dlg.ShowModal();
750
751 switch( ret )
752 {
753 case wxID_CANCEL:
754 return wxEmptyString;
755
756 case wxID_OK:
757 libraryName = dlg.GetTextSelection();
758 Prj().SetRString( PROJECT::SCH_LIB_SELECT, libraryName );
760 return libraryName;
761
763 {
764 SYMBOL_LIBRARY_MANAGER mgr( *this );
765 wxFileName fn( Prj().GetRString( PROJECT::SCH_LIB_PATH ) );
766 bool useGlobalTable = false;
767 FILEDLG_HOOK_NEW_LIBRARY tableChooser( useGlobalTable );
768
769 if( !LibraryFileBrowser( _( "Create New Library" ), false, fn, FILEEXT::KiCadSymbolLibFileWildcard(),
770 FILEEXT::KiCadSymbolLibFileExtension, false, &tableChooser ) )
771 {
772 break;
773 }
774
775 libraryName = fn.GetName();
776 Prj().SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
777
781
782 if( adapter->HasLibrary( libraryName, false ) )
783 {
784 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libraryName ) );
785 break;
786 }
787
788 if( !mgr.CreateLibrary( fn.GetFullPath(), scope ) )
789 DisplayError( this, wxString::Format( _( "Could not add library '%s'." ), libraryName ) );
790
791 break;
792 }
793
794 default:
795 break;
796 }
797 }
798}
799
800
802{
803 return &SCH_ACTIONS::DrawArcForMode( aMode );
804}
805
806
808{
809 Unbind( wxEVT_FSWATCHER, &SCH_BASE_FRAME::OnSymChange, this );
810
811 if( m_watcher )
812 {
813 wxLogTrace( traceLibWatch, "Remove watch" );
814 m_watcher->RemoveAll();
815 m_watcher->SetOwner( nullptr );
816 m_watcher.reset();
817 }
818
819 if( !aID )
820 return;
821
823 std::optional<wxString> uri = manager.GetFullURI( LIBRARY_TABLE_TYPE::SYMBOL, aID->GetLibNickname() );
824
825 if( !uri )
826 {
827 wxLogTrace( traceLibWatch, "Could not get URI for library %s", wxString( aID->GetLibNickname().c_str() ) );
828 return;
829 }
830
831 wxString tmp = ExpandEnvVarSubstitutions( *uri, &Prj() );
832
833 wxLogTrace( traceLibWatch, "Setting up watcher for %s", tmp );
834
835 if( wxFileName::DirExists( tmp ) )
836 {
837 m_watcherFileName.AssignDir( tmp );
838 m_watcherIsDir = true;
840 std::string( "*." ) + FILEEXT::KiCadSymbolLibFileExtension );
841 }
842 else
843 {
844 m_watcherFileName.Assign( tmp );
845 m_watcherIsDir = false;
846
847 if( !m_watcherFileName.FileExists() )
848 return;
849
850 wxLogNull silence;
851 m_watcherTimestamp = m_watcherFileName.GetModificationTime().GetValue().GetValue();
852 }
853
854 // File system watcher requires an active event loop. If we're being called during
855 // library enumeration before the main event loop is running, skip watcher creation.
856 if( !wxEventLoopBase::GetActive() )
857 return;
858
859 wxFileName fn;
860 fn.AssignDir( m_watcherFileName.GetPath() );
861 fn.DontFollowLink();
862
863 // wxMSW frees a watch before SMB completes its pending read, which then corrupts the heap
864 if( KIPLATFORM::ENV::IsNetworkPath( fn.GetPath() ) )
865 {
866 wxLogTrace( traceLibWatch, "Network path, not watching: %s", fn.GetPath() );
867 return;
868 }
869
870 Bind( wxEVT_FSWATCHER, &SCH_BASE_FRAME::OnSymChange, this );
871 m_watcher = std::make_unique<wxFileSystemWatcher>();
872 m_watcher->SetOwner( this );
873
874 {
875 // Silence OS errors that come from the watcher
876 wxLogNull silence;
877 m_watcher->Add( fn );
878 }
879}
880
881
882void SCH_BASE_FRAME::OnSymChange( wxFileSystemWatcherEvent& aEvent )
883{
884 wxLogTrace( traceLibWatch, "OnSymChange: %s, watcher file: %s",
885 aEvent.GetPath().GetFullPath(), m_watcherFileName.GetFullPath() );
886
887 if( !m_watcher || !m_watcher.get() || m_watcherFileName.GetPath().IsEmpty() )
888 return;
889
890 if( m_watcherIsDir )
891 {
892 // For directory-based libraries, accept events for any file within the directory
893 wxString eventPath = aEvent.GetPath().GetFullPath();
894 wxString dirPath = m_watcherFileName.GetPath();
895
896 if( !eventPath.StartsWith( dirPath ) )
897 return;
898 }
899 else
900 {
901 if( aEvent.GetPath() != m_watcherFileName )
902 return;
903 }
904
905 // Start the debounce timer (set to 1 second)
906 if( !m_watcherDebounceTimer.StartOnce( 1000 ) )
907 {
908 wxLogTrace( traceLibWatch, "Failed to start the debounce timer" );
909 return;
910 }
911}
912
913
915{
916 if( aEvent.GetId() != m_watcherDebounceTimer.GetId() )
917 {
918 aEvent.Skip();
919 return;
920 }
921
923 {
924 wxLogTrace( traceLibWatch, "Restarting debounce timer" );
925 m_watcherDebounceTimer.StartOnce( 3000 );
926 return;
927 }
928
929 // A modal dialog may be registered before wxGTK disables the frame. Reloading the
930 // library while either state is active would delete the LIB_SYMBOL being edited.
931 if( !IsEnabled() || Kiway().HasBlockingDialog() )
932 {
933 wxLogTrace( traceLibWatch, "Dialog open; restarting debounce timer" );
934 m_watcherDebounceTimer.StartOnce( 1000 );
935 return;
936 }
937
938 // An interactive tool (move, draw, place pin/text) holds references into the current symbol
939 // while its event loop runs. Reloading now would free those out from under the running tool
940 // and crash. Restart the timer before touching the watcher timestamp so the reload is retried
941 // once the tool finishes rather than silently dropped.
942 if( !ToolStackIsEmpty() )
943 {
944 wxLogTrace( traceLibWatch, "Interactive tool active; restarting debounce timer" );
945 m_watcherDebounceTimer.StartOnce( 1000 );
946 return;
947 }
948
949 wxLogTrace( traceLibWatch, "OnSymChangeDebounceTimer" );
950
951 long long currentTimestamp = 0;
952
953 if( m_watcherIsDir )
954 {
955 currentTimestamp = KIPLATFORM::IO::TimestampDir( m_watcherFileName.GetPath(),
956 std::string( "*." ) + FILEEXT::KiCadSymbolLibFileExtension );
957 }
958 else
959 {
960 wxLogNull silence;
961 wxDateTime lastModified = m_watcherFileName.GetModificationTime();
962
963 if( !lastModified.IsValid() )
964 return;
965
966 currentTimestamp = lastModified.GetValue().GetValue();
967 }
968
969 if( currentTimestamp == m_watcherTimestamp )
970 return;
971
972 m_watcherTimestamp = currentTimestamp;
973
975
977 || IsOK( this, _( "The library containing the current symbol has changed.\n"
978 "Do you want to reload the library?" ) ) )
979 {
980 wxLogTrace( traceLibWatch, "Sending refresh symbol mail" );
981
982 // For directory libraries, GetFullPath() appends a trailing separator which
983 // won't match the library table URI. Use GetPath() for directories instead.
984 std::string libName = m_watcherIsDir ? m_watcherFileName.GetPath().ToStdString()
985 : m_watcherFileName.GetFullPath().ToStdString();
986
989 }
990
992}
993
994
996{
997 if( m_toolManager )
998 return m_toolManager->GetTool<SCH_SELECTION_TOOL>();
999
1000 return nullptr;
1001}
1002
1003
1005{
1006 SCH_SELECTION_FILTER_EVENT evt( aOptions );
1007 wxPostEvent( this, evt );
1008}
ARC_DRAW_MODE
Construction sequence used when interactively drawing a circular arc.
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
static TOOL_ACTION updateFind
Definition actions.h:120
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
wxString m_ColorTheme
Active color theme name.
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Removes status bar from handling.
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition base_screen.h:86
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
int ShowModal() override
FRAME_T GetFrameType() const
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void handleIconizeEvent(wxIconizeEvent &aEvent)
Handle a window iconize event.
WX_INFOBAR * m_infoBar
virtual bool IsContentModified() const
Get if the contents of the frame have been modified since the last save.
bool IsType(FRAME_T aType) const
wxArrayString m_replaceStringHistoryList
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
COLOR_SETTINGS * m_colorSettings
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
void DisplayUnitsMsg()
Display current unit pane in the status bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
EDA_DRAW_FRAME(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)
bool LibraryFileBrowser(const wxString &aTitle, bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY *aFileDlgHook=nullptr)
virtual void handleActivateEvent(wxActivateEvent &aEvent)
Handle a window activation event.
void UpdateStatusBar() override
Update the status bar information.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void DisplayGridMsg()
Display current grid size in the status bar.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Return the canvas type stored in the application settings.
wxArrayString m_findStringHistoryList
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the KIGFX::VIEW_CONTROLS instance used in the panel.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM * GetParent() const
Definition eda_item.h:112
A dialog which shows:
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
void AddExtraCheckbox(const wxString &aLabel, bool *aValuePtr)
Add a checkbox value to the dialog.
void GetExtraCheckboxValues()
Fills in the value pointers from the checkboxes after the dialog has run.
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()
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
virtual bool SupportsStrokePixelPad() const
Tell whether strokes can carry part of their width in pixels, see SetStrokePixelPad().
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
double GetWorldScale() const
Get the world scale.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition painter.h:55
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
static std::vector< KICAD_T > g_ScaledSelectionTypes
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition sch_view.cpp:73
virtual void CenterOnCursor()=0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:365
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:488
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
Definition view.h:224
void RecacheAllItems()
Rebuild GAL display lists.
Definition view.cpp:2222
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition view.cpp:2475
PAINTER * GetPainter() const
Return the painter object used by the view for drawing VIEW_ITEM objects.
Definition view.h:242
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition view.cpp:971
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition view.h:729
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
Definition kistatusbar.h:50
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
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:499
LEGACY_SYMBOL_LIB * GetCacheLibrary()
Object used to load, save, search, and otherwise manipulate symbol library files.
LIB_SYMBOL * FindSymbol(const wxString &aName) const
Find LIB_SYMBOL by aName.
std::optional< wxString > GetLibraryDescription(const wxString &aNickname) const
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library tables.
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)
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:45
const UTF8 & GetLibItemName() const
Definition lib_id.h:98
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition lib_id.h:83
Define a library symbol object.
Definition lib_symbol.h:114
static const wxString GetPinningSymbol()
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition page_info.h:172
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:562
virtual BACKGROUND_JOBS_MONITOR & GetBackgroundJobMonitor() const
Definition pgm_base.h:129
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:125
The backing store for a PROJECT, in JSON format.
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
static LEGACY_SYMBOL_LIBS * LegacySchLibs(PROJECT *aProject)
Returns the list of symbol libraries from a legacy (pre-5.x) design This is only used from the remapp...
@ SCH_LIB_SELECT
Definition project.h:236
@ SCH_LIB_PATH
Definition project.h:235
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:201
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition project.cpp:448
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition project.cpp:459
static const TOOL_ACTION & DrawArcForMode(ARC_DRAW_MODE aMode)
Tool action that starts the arc tool in the given mode.
virtual void RedrawScreen(const VECTOR2I &aCenterPoint, bool aWarpPointer)
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void UpdateStatusBar() override
Update the status bar information.
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen) override
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
SCH_RENDER_SETTINGS * GetRenderSettings()
void doCloseWindow() override
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
const VECTOR2I GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
void SetPageSettings(const PAGE_INFO &aPageSettings) override
void handleIconizeEvent(wxIconizeEvent &aEvent) override
Handle a window iconize event.
void OnSymChange(wxFileSystemWatcherEvent &aEvent)
Handler for Symbol change events.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SYMBOL_EDITOR_SETTINGS * libeditconfig() const
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
APP_SETTINGS_BASE * GetViewerSettingsBase() const
void HighlightSelectionFilter(const SCH_SELECTION_FILTER_OPTIONS &aOptions)
void HardRedraw() override
Rebuild the GAL and redraws the screen.
DIALOG_SCH_FIND * m_findReplaceDialog
SCHEMATIC_SETTINGS m_base_frame_defaults
Only used by symbol_editor. Eeschema should be using the one inside the SCHEMATIC.
wxTimer m_watcherDebounceTimer
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void ShowFindReplaceDialog(bool aReplace)
Run the Find or Find & Replace dialog.
const TOOL_ACTION * drawArcAction(ARC_DRAW_MODE aMode) const override
The action that starts the arc tool in aMode, or nullptr in a frame without an arc tool.
SCH_SELECTION_TOOL * GetSelectionTool() override
void SyncView()
Mark all items for refresh.
std::unique_ptr< NL_SCHEMATIC_PLUGIN > m_spaceMouse
void GetLibraryItemsForListDialog(wxArrayString &aHeaders, std::vector< wxArrayString > &aItemsToDisplay)
std::unique_ptr< wxFileSystemWatcher > m_watcher
These are file watchers for the symbol library tables.
wxString SelectLibrary(const wxString &aDialogTitle, const wxString &aListLabel, const std::vector< std::pair< wxString, bool * > > &aExtraCheckboxes={})
Display a list of loaded libraries and allows the user to select a library.
virtual ~SCH_BASE_FRAME()
Needs to be in the cpp file to encode the sizeof() for std::unique_ptr.
const TITLE_BLOCK & GetTitleBlock() const override
void RefreshZoomDependentItems()
Mark selected items for refresh.
EESCHEMA_SETTINGS * eeconfig() const
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
PANEL_SCH_SELECTION_FILTER * m_selectionFilterPanel
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
void handleActivateEvent(wxActivateEvent &aEvent) override
Handle a window activation event.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
void OnFindDialogClose()
Notification that the Find dialog has closed.
wxFileName m_watcherFileName
void setSymWatcher(const LIB_ID *aSymbol)
Creates (or removes) a watcher on the specified symbol library.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr) override
Add an item to the screen (and view) aScreen is the screen the item is located on,...
const PAGE_INFO & GetPageSettings() const override
void ShowFindReplaceStatus(const wxString &aMsg, int aStatusTime)
COLOR4D GetDrawBgColor() const override
void OnSymChangeDebounceTimer(wxTimerEvent &aEvent)
Handler for the filesystem watcher debounce timer.
long long m_watcherTimestamp
void ClearFindReplaceStatus()
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper to retrieve a layer color from the global color settings.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the KIGFX::VIEW instance used in the panel.
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition sch_field.h:139
Handle actions specific to the schematic editor.
SCH_ITEM * GetLastFoundItem() const
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:48
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
const PAGE_INFO & GetPageSettings() const
Definition sch_screen.h:144
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition sch_screen.h:171
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition sch_screen.h:145
TITLE_BLOCK & GetTitleBlock()
Definition sch_screen.h:168
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Refresh a changed item in the tree and invalidate connectivity.
SCH_SELECTION & GetSelection()
void OnIdle(wxIdleEvent &aEvent)
Schematic symbol object.
Definition sch_symbol.h:75
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
EDA_ITEM * Front() const
Definition selection.h:176
int Size() const
Returns the number of selected parts.
Definition selection.h:120
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
Class to handle modifications to the symbol libraries.
bool CreateLibrary(const wxString &aFilePath, LIBRARY_TABLE_SCOPE aScope)
Create an empty library and adds it to the library table.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:38
TOOL_MANAGER * m_toolManager
bool ToolStackIsEmpty()
Represent a single user action.
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:76
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
const char * c_str() const
Definition utf8.h:104
wxString wx_str() const
Definition utf8.cpp:41
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject, bool aAllowEscapes)
Replace any environment variable & text variable references with their values.
Definition common.cpp:777
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:274
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
This file is part of the common library.
#define _(s)
@ RECURSE
Definition eda_item.h:51
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:29
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:31
@ FRAME_SCH_VIEWER
Definition frame_type.h:32
@ FRAME_SCH
Definition frame_type.h:30
@ FRAME_SYMBOL_CHOOSER
Definition frame_type.h:33
static const std::string KiCadSymbolLibFileExtension
static wxString KiCadSymbolLibFileWildcard()
const wxChar *const traceLibWatch
Flag to enable debug output for library file watch refreshes.
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:477
@ LAYER_SCHEMATIC_GRID_AXES
Definition layer_ids.h:515
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:516
Definition for symbol library class.
LIBRARY_TABLE_SCOPE
@ MAIL_REFRESH_SYMBOL
Definition mail_type.h:57
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:54
@ ALL
All except INITIAL_ADD.
Definition view_item.h:55
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition definitions.h:34
bool IsNetworkPath(const wxString &aPath)
Determines if a given path is a network shared file apth On Windows for example, any form of path is ...
long long TimestampDir(const wxString &aDirPath, const wxString &aFilespec)
Computes a hash of modification times and sizes for files matching a pattern.
Definition unix/io.cpp:123
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition kicad_algo.h:96
Declaration of the NL_SCHEMATIC_PLUGIN class.
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
LIB_SYMBOL * SchGetLibSymbol(const LIB_ID &aLibId, SYMBOL_LIBRARY_ADAPTER *aLibMgr, LEGACY_SYMBOL_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
LIB_SYMBOL * SchGetLibSymbol(const LIB_ID &aLibId, SYMBOL_LIBRARY_ADAPTER *aLibMgr, LEGACY_SYMBOL_LIB *aCacheLib=nullptr, wxWindow *aParent=nullptr, bool aShowErrorMsg=false)
Load symbol from symbol library table.
Class to handle a set of SCH_ITEMs.
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
std::vector< wxString > pinned_symbol_libs
@ ID_MAKE_NEW_LIBRARY
@ VALUE
Field Value of part, i.e. "3.3K".
wxLogTrace helper definitions.
@ SCH_TABLE_T
Definition typeinfo.h:161
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ SCH_TABLECELL_T
Definition typeinfo.h:162
@ SCH_FIELD_T
Definition typeinfo.h:146
@ SCH_LABEL_T
Definition typeinfo.h:163
@ SCH_SHEET_T
Definition typeinfo.h:171
@ SCH_SHAPE_T
Definition typeinfo.h:145
@ SCH_HIER_LABEL_T
Definition typeinfo.h:165
@ SCH_LABEL_LOCATE_ANY_T
Definition typeinfo.h:187
@ SCH_SHEET_PIN_T
Definition typeinfo.h:170
@ SCH_TEXT_T
Definition typeinfo.h:147
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
VECTOR2< double > VECTOR2D
Definition vector2d.h:707
Definition of file extensions used in Kicad.