KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_viewer_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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2004-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 <bitmaps.h>
28#include <confirm.h>
30#include <eeschema_id.h>
31#include <eeschema_settings.h>
33#include <kiface_base.h>
34#include <kiway.h>
35#include <kiway_express.h>
36#include <locale_io.h>
37#include <symbol_viewer_frame.h>
38#include <widgets/msgpanel.h>
39#include <widgets/wx_listbox.h>
42#include <sch_view.h>
43#include <sch_painter.h>
44#include <symbol_lib_table.h>
46#include <pgm_base.h>
48#include <project_sch.h>
50#include <symbol_async_loader.h>
51#include <tool/action_toolbar.h>
52#include <tool/common_control.h>
53#include <tool/common_tools.h>
55#include <tool/selection.h>
57#include <tool/tool_manager.h>
58#include <tool/zoom_tool.h>
59#include <tools/ee_actions.h>
62#include <view/view_controls.h>
63#include <wx/srchctrl.h>
64#include <wx/log.h>
65
66#include <default_values.h>
67#include <string_utils.h>
68#include "eda_pattern_match.h"
69
70// Save previous symbol library viewer state.
72
76
77
78BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, SCH_BASE_FRAME )
79 // Window events
82
83 // Toolbar events
87
88 // listbox events
94
95 // Menu (and/or hotkey) events
96 EVT_MENU( wxID_CLOSE, SYMBOL_VIEWER_FRAME::CloseLibraryViewer )
97
99
100END_EVENT_TABLE()
101
102
103SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
104 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_VIEWER, _( "Symbol Library Browser" ),
105 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
107 m_unitChoice( nullptr ),
108 m_libList( nullptr ),
109 m_symbolList( nullptr )
110{
111 m_aboutTitle = _HKI( "KiCad Symbol Library Browser" );
112
113 // Force the frame name used in config. the lib viewer frame has a name
114 // depending on aFrameType (needed to identify the frame by wxWidgets),
115 // but only one configuration is preferable.
116 m_configName = LIB_VIEW_FRAME_NAME;
117
118 // Give an icon
119 wxIcon icon;
120 icon.CopyFromBitmap( KiBitmap( BITMAPS::library_browser ) );
121 SetIcon( icon );
122
123 m_libListWidth = 200;
124 m_symbolListWidth = 300;
125 m_listPowerOnly = false;
126
127 SetScreen( new SCH_SCREEN );
128 GetScreen()->m_Center = true; // Axis origin centered on screen.
129 LoadSettings( config() );
130
131 // Ensure axis are always drawn (initial default display was not drawn)
132 KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
133 gal_opts.m_axesEnabled = true;
134 gal_opts.m_gridMinSpacing = 10.0;
135 gal_opts.NotifyChanged();
136
137 GetRenderSettings()->LoadColors( GetColorSettings() );
138 GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
139
140 GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
141
142 setupTools();
143 setupUIConditions();
144
145 ReCreateHToolbar();
146 ReCreateVToolbar();
147 ReCreateMenuBar();
148
149 wxPanel* libPanel = new wxPanel( this );
150 wxSizer* libSizer = new wxBoxSizer( wxVERTICAL );
151
152 m_libFilter = new wxSearchCtrl( libPanel, ID_LIBVIEW_LIB_FILTER, wxEmptyString,
153 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
154 m_libFilter->SetDescriptiveText( _( "Filter" ) );
155 libSizer->Add( m_libFilter, 0, wxEXPAND, 5 );
156
157 m_libList = new WX_LISTBOX( libPanel, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
158 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
159 libSizer->Add( m_libList, 1, wxEXPAND, 5 );
160
161 libPanel->SetSizer( libSizer );
162 libPanel->Fit();
163
164 wxPanel* symbolPanel = new wxPanel( this );
165 wxSizer* symbolSizer = new wxBoxSizer( wxVERTICAL );
166
167 m_symbolFilter = new wxSearchCtrl( symbolPanel, ID_LIBVIEW_SYM_FILTER, wxEmptyString,
168 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
169 m_symbolFilter->SetDescriptiveText( _( "Filter" ) );
170 m_symbolFilter->SetToolTip(
171 _( "Filter on symbol name, keywords, description and pin count.\n"
172 "Search terms are separated by spaces. All search terms must match.\n"
173 "A term which is a number will also match against the pin count." ) );
174 symbolSizer->Add( m_symbolFilter, 0, wxEXPAND, 5 );
175
176#ifdef __WXGTK__
177 // wxSearchCtrl vertical height is not calculated correctly on some GTK setups
178 // See https://gitlab.com/kicad/code/kicad/-/issues/9019
179 m_libFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
180 m_symbolFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
181#endif
182
183 m_symbolList = new WX_LISTBOX( symbolPanel, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
184 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
185 symbolSizer->Add( m_symbolList, 1, wxEXPAND, 5 );
186
187 symbolPanel->SetSizer( symbolSizer );
188 symbolPanel->Fit();
189
190 // Preload libraries
191 loadAllLibraries();
192 ReCreateLibList();
193
194 m_selection_changed = false;
195
196 DisplayLibInfos();
197
198 m_auimgr.SetManagedWindow( this );
199
200 CreateInfoBar();
201
202 // Manage main toolbar
203 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
204 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) .Bottom().Layer(6) );
205
206 m_auimgr.AddPane( libPanel, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
207 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
208 m_auimgr.AddPane( symbolPanel, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1)
209 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
210
211 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
212
213 m_auimgr.Update();
214
215 if( m_libListWidth > 0 )
216 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Libraries" ), m_libListWidth, -1 );
217
218 if( m_symbolListWidth > 0 )
219 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Symbols" ), m_symbolListWidth, -1 );
220
221 FinishAUIInitialization();
222
223 Raise();
224 Show( true );
225
226 SyncView();
227 GetCanvas()->SetCanFocus( false );
228
229 setupUnits( config() );
230
231 // Set the working/draw area size to display a symbol to a reasonable value:
232 // A 450mm x 450mm with a origin at the area center looks like a large working area
233 double max_size_x = schIUScale.mmToIU( 450 );
234 double max_size_y = schIUScale.mmToIU( 450 );
235 BOX2D bbox;
236 bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
237 bbox.SetSize( max_size_x, max_size_y );
238 GetCanvas()->GetView()->SetBoundary( bbox );
239 GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
240
241 // If a symbol was previously selected in m_symbolList from a previous run, show it
242 wxString symbName = m_symbolList->GetStringSelection();
243
244 if( !symbName.IsEmpty() )
245 {
246 SetSelectedSymbol( symbName );
247 updatePreviewSymbol();
248 }
249}
250
251
253{
254 // Shutdown all running tools
255 if( m_toolManager )
257
258 if( m_previewItem )
259 {
260 GetCanvas()->GetView()->Remove( m_previewItem.get() );
261 m_previewItem = nullptr;
262 }
263}
264
265
267{
268 // TODO: deduplicate with SYMBOL_TREE_MODEL_ADAPTER::AddLibraries
269 std::vector<wxString> libraryNames = PROJECT_SCH::SchSymbolLibTable( &Prj() )->GetLogicalLibs();
270 std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter = nullptr;
271
272 if( m_show_progress )
273 {
274 progressReporter = std::make_unique<WX_PROGRESS_REPORTER>( this,
275 _( "Loading Symbol Libraries" ),
276 libraryNames.size(), true );
277 }
278
279 // Disable KIID generation: not needed for library parts; sometimes very slow
280 KIID::CreateNilUuids( true );
281
282 std::unordered_map<wxString, std::vector<LIB_SYMBOL*>> loadedSymbols;
283
284 SYMBOL_ASYNC_LOADER loader( libraryNames, PROJECT_SCH::SchSymbolLibTable( &Prj() ), false, nullptr,
285 progressReporter.get() );
286
287 LOCALE_IO toggle;
288
289 loader.Start();
290
291 while( !loader.Done() )
292 {
293 if( progressReporter && !progressReporter->KeepRefreshing() )
294 break;
295
296 wxMilliSleep( 33 );
297 }
298
299 loader.Join();
300
301 KIID::CreateNilUuids( false );
302
303 if( !loader.GetErrors().IsEmpty() )
304 {
305 HTML_MESSAGE_BOX dlg( this, _( "Load Error" ) );
306
307 dlg.MessageSet( _( "Errors loading symbols:" ) );
308
309 wxString msg = loader.GetErrors();
310 msg.Replace( "\n", "<BR>" );
311
312 dlg.AddHTML_Text( msg );
313 dlg.ShowModal();
314 }
315}
316
317
319{
320 // Create the manager and dispatcher & route draw panel events to the dispatcher
323 GetCanvas()->GetViewControls(), config(), this );
324 m_actions = new EE_ACTIONS();
326
327 // Register tools
331 m_toolManager->RegisterTool( new EE_INSPECTION_TOOL ); // manage show datasheet
332 m_toolManager->RegisterTool( new EE_SELECTION_TOOL ); // manage context menu
333 m_toolManager->RegisterTool( new SYMBOL_EDITOR_CONTROL ); // manage render settings
334
336
337 // Run the selection tool, it is supposed to be always active
338 // It also manages the mouse right click to show the context menu
339 m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
340
342}
343
344
346{
348
350 EDITOR_CONDITIONS cond( this );
351
352 wxASSERT( mgr );
353
354#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
355#define CHECK( x ) ACTION_CONDITIONS().Check( x )
356
358
359 auto electricalTypesShownCondition =
360 [this]( const SELECTION& aSel )
361 {
363 };
364
365 auto pinNumbersShownCondition =
366 [this]( const SELECTION& )
367 {
369 };
370
371 auto demorganCond =
372 [this]( const SELECTION& )
373 {
374 LIB_SYMBOL* symbol = GetSelectedSymbol();
375 return symbol && symbol->HasAlternateBodyStyle();
376 };
377
378 auto demorganStandardCond =
379 []( const SELECTION& )
380 {
381 return m_bodyStyle == BODY_STYLE::BASE;
382 };
383
384 auto demorganAlternateCond =
385 []( const SELECTION& )
386 {
387 return m_bodyStyle == BODY_STYLE::DEMORGAN;
388 };
389
390 auto haveDatasheetCond =
391 [this]( const SELECTION& )
392 {
393 LIB_SYMBOL* symbol = GetSelectedSymbol();
394 return symbol && !symbol->GetDatasheetField().GetText().IsEmpty();
395 };
396
397 mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
398 mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( electricalTypesShownCondition ) );
399 mgr->SetConditions( EE_ACTIONS::showPinNumbers, CHECK( pinNumbersShownCondition ) );
400
402 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
404 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
405
406#undef CHECK
407#undef ENABLE
408}
409
410
411void SYMBOL_VIEWER_FRAME::SetUnitAndBodyStyle( int aUnit, int aBodyStyle )
412{
413 m_unit = aUnit > 0 ? aUnit : 1;
414 m_bodyStyle = aBodyStyle > 0 ? aBodyStyle : BODY_STYLE::BASE;
415 m_selection_changed = false;
416
418}
419
420
422{
423 LIB_SYMBOL* symbol = nullptr;
424
427
428 return symbol;
429}
430
431
433{
434 LIB_SYMBOL* symbol = GetSelectedSymbol();
435 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
436
437 if( m_previewItem )
438 {
439 view->Remove( m_previewItem.get() );
440 m_previewItem = nullptr;
441 }
442
444
445 if( symbol )
446 {
449
450 m_previewItem = symbol->Flatten();
451 view->Add( m_previewItem.get() );
452
453 wxString parentName;
454 std::shared_ptr<LIB_SYMBOL> parent = symbol->GetParent().lock();
455
456 if( parent )
457 parentName = parent->GetName();
458
459 AppendMsgPanel( _( "Name" ), UnescapeString( m_previewItem->GetName() ) );
460 AppendMsgPanel( _( "Parent" ), UnescapeString( parentName ) );
461 AppendMsgPanel( _( "Description" ), m_previewItem->GetDescription() );
462 AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords() );
463 }
464
466 GetCanvas()->Refresh();
467}
468
469
471{
473 Destroy();
474}
475
476
477void SYMBOL_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
478{
479 if( m_auimgr.GetManagedWindow() )
480 m_auimgr.Update();
481
482 SizeEv.Skip();
483}
484
485
486void SYMBOL_VIEWER_FRAME::onUpdateUnitChoice( wxUpdateUIEvent& aEvent )
487{
488 LIB_SYMBOL* symbol = GetSelectedSymbol();
489
490 int unit_count = 1;
491
492 if( symbol )
493 unit_count = std::max( symbol->GetUnitCount(), 1 );
494
495 m_unitChoice->Enable( unit_count > 1 );
496
497 if( unit_count > 1 )
498 {
499 // rebuild the unit list if it is not suitable (after a new selection for instance)
500 if( unit_count != (int)m_unitChoice->GetCount() )
501 {
502 m_unitChoice->Clear();
503
504 for( int ii = 0; ii < unit_count; ii++ )
505 {
506 wxString unit = symbol->GetUnitDisplayName( ii + 1 );
507 m_unitChoice->Append( unit );
508 }
509
510 }
511
512 if( m_unitChoice->GetSelection() != std::max( 0, m_unit - 1 ) )
513 m_unitChoice->SetSelection( std::max( 0, m_unit - 1 ) );
514 }
515 else if( m_unitChoice->GetCount() )
516 {
517 m_unitChoice->Clear();
518 }
519}
520
521
523{
524 if( !m_libList )
525 return false;
526
527 m_libList->Clear();
528
532 std::vector<wxString> libs = libTable->GetLogicalLibs();
533 std::vector<wxString> pinnedMatches;
534 std::vector<wxString> otherMatches;
535
536 auto doAddLib =
537 [&]( const wxString& aLib )
538 {
539 if( alg::contains( project.m_PinnedSymbolLibs, aLib )
541 {
542 pinnedMatches.push_back( aLib );
543 }
544 else
545 {
546 otherMatches.push_back( aLib );
547 }
548 };
549
550 auto process =
551 [&]( const wxString& aLib )
552 {
553 // Remove not allowed libs, if the allowed lib list is not empty
554 if( m_allowedLibs.GetCount() )
555 {
556 if( m_allowedLibs.Index( aLib ) == wxNOT_FOUND )
557 return;
558 }
559
560 // Remove libs which have no power symbols, if this filter is activated
561 if( m_listPowerOnly )
562 {
563 wxArrayString aliasNames;
564
565 PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( aLib, aliasNames, true );
566
567 if( aliasNames.IsEmpty() )
568 return;
569 }
570
571 SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLib );
572
573 wxCHECK( row, /* void */ );
574
575 if( !row->GetIsVisible() )
576 return;
577
578 if( row->SupportsSubLibraries() )
579 {
580 std::vector<wxString> subLibraries;
581 row->GetSubLibraryNames( subLibraries );
582
583 for( const wxString& lib : subLibraries )
584 {
585 wxString suffix = lib.IsEmpty() ? wxString( wxT( "" ) )
586 : wxString::Format( wxT( " - %s" ), lib );
587 wxString name = wxString::Format( wxT( "%s%s" ), aLib, suffix );
588
589 doAddLib( name );
590 }
591 }
592 else
593 {
594 doAddLib( aLib );
595 }
596 };
597
598 if( m_libFilter->GetValue().IsEmpty() )
599 {
600 for( const wxString& lib : libs )
601 process( lib );
602 }
603 else
604 {
605 wxStringTokenizer tokenizer( m_libFilter->GetValue() );
606
607 while( tokenizer.HasMoreTokens() )
608 {
609 const wxString term = tokenizer.GetNextToken().Lower();
610 EDA_COMBINED_MATCHER matcher( term, CTX_LIBITEM );
611
612 for( const wxString& lib : libs )
613 {
614 if( matcher.Find( lib.Lower() ) )
615 process( lib );
616 }
617 }
618 }
619
620 if( libs.empty() )
621 return true;
622
623 for( const wxString& name : pinnedMatches )
625
626 for( const wxString& name : otherMatches )
627 m_libList->Append( UnescapeString( name ) );
628
629 // Search for a previous selection:
631
632 if( index != wxNOT_FOUND )
633 {
634 m_libList->SetSelection( index, true );
635 }
636 else
637 {
638 // If not found, clear current library selection because it can be deleted after a
639 // config change.
641 ? m_libList->GetBaseString( 0 ) : wxString( wxT( "" ) ) );
642 m_currentSymbol.SetLibItemName( wxEmptyString );
643 m_unit = 1;
644 m_bodyStyle = BODY_STYLE::BASE;
645 }
646
647 bool cmp_changed = ReCreateSymbolList();
649 GetCanvas()->Refresh();
650
651 return cmp_changed;
652}
653
654
656{
657 if( m_symbolList == nullptr )
658 return false;
659
660 m_symbolList->Clear();
661
662 wxString libName = m_currentSymbol.GetUniStringLibNickname();
663
664 if( libName.IsEmpty() )
665 return false;
666
667 std::vector<LIB_SYMBOL*> symbols;
669
670 try
671 {
672 if( row )
674 }
675 catch( const IO_ERROR& ) {} // ignore, it is handled below
676
677 std::set<wxString> excludes;
678
679 if( !m_symbolFilter->GetValue().IsEmpty() )
680 {
681 wxStringTokenizer tokenizer( m_symbolFilter->GetValue() );
682
683 while( tokenizer.HasMoreTokens() )
684 {
685 const wxString filterTerm = tokenizer.GetNextToken().Lower();
686 EDA_COMBINED_MATCHER matcher( filterTerm, CTX_LIBITEM );
687
688 for( LIB_SYMBOL* symbol : symbols )
689 {
690 std::vector<SEARCH_TERM> searchTerms = symbol->GetSearchTerms();
691 int matched = matcher.ScoreTerms( searchTerms );
692
693 if( filterTerm.IsNumber() && wxAtoi( filterTerm ) == (int)symbol->GetPinCount() )
694 matched++;
695
696 if( !matched )
697 excludes.insert( symbol->GetName() );
698 }
699 }
700 }
701
702 wxString subLib = m_currentSymbol.GetSubLibraryName();
703
704 for( const LIB_SYMBOL* symbol : symbols )
705 {
706 if( row && row->SupportsSubLibraries()
707 && !subLib.IsSameAs( symbol->GetLibId().GetSubLibraryName() ) )
708 {
709 continue;
710 }
711
712 if( !excludes.count( symbol->GetName() ) )
713 m_symbolList->Append( UnescapeString( symbol->GetName() ) );
714 }
715
716 if( m_symbolList->IsEmpty() )
717 {
718 SetSelectedSymbol( wxEmptyString );
719 m_bodyStyle = BODY_STYLE::BASE;
720 m_unit = 1;
721 return true;
722 }
723
725 bool changed = false;
726
727 if( index == wxNOT_FOUND )
728 {
729 // Select the first library entry when the previous entry name does not exist in
730 // the current library.
731 m_bodyStyle = BODY_STYLE::BASE;
732 m_unit = 1;
733 index = -1;
734 changed = true;
735 SetSelectedSymbol( wxEmptyString );
736 }
737
738 m_symbolList->SetSelection( index, true );
739
740 return changed;
741}
742
743
744void SYMBOL_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
745{
746 int ii = m_libList->GetSelection();
747
748 if( ii < 0 )
749 return;
750
751 m_selection_changed = true;
752
753 wxString selection = EscapeString( m_libList->GetBaseString( ii ), CTX_LIBID );
754
755 if( !PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRow( selection )
756 && selection.Find( '-' ) != wxNOT_FOUND )
757 {
758 // Probably a sub-library
759 wxString sublib;
760 selection = selection.BeforeLast( '-', &sublib ).Trim();
761 sublib.Trim( false );
762 SetSelectedLibrary( selection, sublib );
763 }
764 else
765 {
766 SetSelectedLibrary( selection );
767 }
768}
769
770
771void SYMBOL_VIEWER_FRAME::SetSelectedLibrary( const wxString& aLibraryName,
772 const wxString& aSubLibName )
773{
774 if( m_currentSymbol.GetUniStringLibNickname() == aLibraryName
775 && wxString( m_currentSymbol.GetSubLibraryName().wx_str() ) == aSubLibName )
776 return;
777
778 m_currentSymbol.SetLibNickname( aLibraryName );
779 m_currentSymbol.SetSubLibraryName( aSubLibName );
781 GetCanvas()->Refresh();
783
784 // Ensure the corresponding line in m_libList is selected
785 // (which is not necessary the case if SetSelectedLibrary is called
786 // by another caller than ClickOnLibList.
788
789 // The m_libList has now the focus, in order to be able to use arrow keys
790 // to navigate inside the list.
791 // the gal canvas must not steal the focus to allow navigation
792 GetCanvas()->SetStealsFocus( false );
793 m_libList->SetFocus();
794}
795
796
797void SYMBOL_VIEWER_FRAME::ClickOnSymbolList( wxCommandEvent& event )
798{
799 int ii = m_symbolList->GetSelection();
800
801 if( ii < 0 )
802 return;
803
804 m_selection_changed = true;
805
807
808 // The m_symbolList has now the focus, in order to be able to use arrow keys
809 // to navigate inside the list.
810 // the gal canvas must not steal the focus to allow navigation
811 GetCanvas()->SetStealsFocus( false );
812 m_symbolList->SetFocus();
813}
814
815
816void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
817{
818 if( m_currentSymbol.GetUniStringLibItemName() != aSymbolName )
819 {
820 m_currentSymbol.SetLibItemName( aSymbolName );
821
822 // Ensure the corresponding line in m_symbolList is selected
823 // (which is not necessarily the case if SetSelectedSymbol is called
824 // by another caller than ClickOnSymbolList.
825 m_symbolList->SetStringSelection( UnescapeString( aSymbolName ), true );
827
829 {
830 m_unit = 1;
831 m_bodyStyle = BODY_STYLE::BASE;
832 m_selection_changed = false;
833 }
834
836 }
837}
838
839
840void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event )
841{
843}
844
845
847{
849
851
852 // Grid shape, etc.
853 GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
854
855 m_libListWidth = cfg->m_LibViewPanel.lib_list_width;
856 m_symbolListWidth = cfg->m_LibViewPanel.cmp_list_width;
857
858 GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
859 GetRenderSettings()->m_ShowPinNumbers = cfg->m_LibViewPanel.show_pin_numbers;
860
861 // Set parameters to a reasonable value.
862 int maxWidth = cfg->m_LibViewPanel.window.state.size_x - 80;
863
864 if( m_libListWidth + m_symbolListWidth > maxWidth )
865 {
868 }
869}
870
871
873{
875
877
879 m_libListWidth = m_libList->GetSize().x;
880
881 m_symbolListWidth = m_symbolList->GetSize().x;
882
885
886 if( SCH_RENDER_SETTINGS* renderSettings = GetRenderSettings() )
887 {
888 cfg->m_LibViewPanel.show_pin_electrical_type = renderSettings->m_ShowPinsElectricalType;
889 cfg->m_LibViewPanel.show_pin_numbers = renderSettings->m_ShowPinNumbers;
890 }
891}
892
893
895{
896 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
897 wxASSERT( cfg );
898 return &cfg->m_LibViewPanel.window;
899}
900
901
902void SYMBOL_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
903{
904 SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
905
908
910 GetCanvas()->GetGAL()->DrawGrid();
912
913 if( aEnvVarsChanged )
915}
916
917
918void SYMBOL_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
919{
920 if( event.GetActive() )
921 {
922 bool changed = m_libList ? ReCreateLibList() : false;
923
924 if (changed)
925 m_selection_changed = true;
926
928
930 }
931
932 event.Skip(); // required under wxMAC
933}
934
935
936void SYMBOL_VIEWER_FRAME::CloseLibraryViewer( wxCommandEvent& event )
937{
938 Close();
939}
940
941
942const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
943{
944 LIB_SYMBOL* symbol = GetSelectedSymbol();
945
946 if( !symbol )
947 {
948 return BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) );
949 }
950 else
951 {
952 std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsAlias() ? symbol->GetParent().lock()
953 : symbol->SharedPtr();
954
955 wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
956
957 return tmp->GetUnitBoundingBox( m_unit, m_bodyStyle );
958 }
959}
960
961
962void SYMBOL_VIEWER_FRAME::OnLibFilter( wxCommandEvent& aEvent )
963{
965
966 // Required to avoid interaction with SetHint()
967 // See documentation for wxTextEntry::SetHint
968 aEvent.Skip();
969}
970
971
972void SYMBOL_VIEWER_FRAME::OnSymFilter( wxCommandEvent& aEvent )
973{
975
976 // Required to avoid interaction with SetHint()
977 // See documentation for wxTextEntry::SetHint
978 aEvent.Skip();
979}
980
981
982void SYMBOL_VIEWER_FRAME::OnCharHook( wxKeyEvent& aEvent )
983{
984 if( aEvent.GetKeyCode() == WXK_UP )
985 {
986 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
987 {
988 int prev = m_libList->GetSelection() - 1;
989
990 if( prev >= 0 )
991 {
992 m_libList->SetSelection( prev );
993 m_libList->EnsureVisible( prev );
994
995 wxCommandEvent dummy;
997 }
998 }
999 else
1000 {
1001 wxCommandEvent dummy;
1003 }
1004 }
1005 else if( aEvent.GetKeyCode() == WXK_DOWN )
1006 {
1007 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
1008 {
1009 int next = m_libList->GetSelection() + 1;
1010
1011 if( next < (int)m_libList->GetCount() )
1012 {
1013 m_libList->SetSelection( next );
1014 m_libList->EnsureVisible( next );
1015
1016 wxCommandEvent dummy;
1018 }
1019 }
1020 else
1021 {
1022 wxCommandEvent dummy;
1024 }
1025 }
1026 else if( aEvent.GetKeyCode() == WXK_TAB && m_libFilter->HasFocus() )
1027 {
1028 if( !aEvent.ShiftDown() )
1029 m_symbolFilter->SetFocus();
1030 else
1031 aEvent.Skip();
1032 }
1033 else if( aEvent.GetKeyCode() == WXK_TAB && m_symbolFilter->HasFocus() )
1034 {
1035 if( aEvent.ShiftDown() )
1036 m_libFilter->SetFocus();
1037 else
1038 aEvent.Skip();
1039 }
1040 else if( ( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
1041 && m_symbolList->GetSelection() >= 0 )
1042 {
1043 wxCommandEvent dummy;
1045 }
1046 else
1047 {
1048 aEvent.Skip();
1049 }
1050}
1051
1052
1053void SYMBOL_VIEWER_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
1054{
1055 wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
1056 int ii = m_symbolList->GetSelection();
1057
1058 // Select the next symbol or stop at the end of the list.
1059 if( ii != wxNOT_FOUND && ii < (int)(m_symbolList->GetCount() - 1) )
1060 ii += 1;
1061
1062 m_symbolList->SetSelection( ii );
1063 ProcessEvent( evt );
1064}
1065
1066
1068{
1069 wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
1070 int ii = m_symbolList->GetSelection();
1071
1072 // Select the previous symbol or stop at the beginning of list.
1073 if( ii != wxNOT_FOUND && ii != 0 )
1074 ii -= 1;
1075
1076 m_symbolList->SetSelection( ii );
1077 ProcessEvent( evt );
1078}
1079
1080
1081void SYMBOL_VIEWER_FRAME::onSelectSymbolUnit( wxCommandEvent& aEvent )
1082{
1083 int ii = m_unitChoice->GetSelection();
1084
1085 if( ii < 0 )
1086 return;
1087
1088 m_unit = ii + 1;
1089
1091}
1092
1093
1095{
1096 wxString libName = m_currentSymbol.GetUniStringLibNickname();
1097
1098 if( m_libList && !m_libList->IsEmpty() && !libName.IsEmpty() )
1099 {
1100 const SYMBOL_LIB_TABLE_ROW* row =
1101 PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRow( libName, true );
1102
1103 wxString title = row ? row->GetFullURI( true ) : _( "[no library selected]" );
1104
1105 title += wxT( " \u2014 " ) + _( "Symbol Library Browser" );
1106 SetTitle( title );
1107 }
1108}
1109
1110
1112{
1113 return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1114}
1115
1116
1118{
1119
1120 switch( mail.Command() )
1121 {
1122 case MAIL_RELOAD_LIB:
1123 {
1125 break;
1126 }
1128 {
1130 LIB_SYMBOL* symbol = GetSelectedSymbol();
1131
1132 wxCHECK2( tbl && symbol, break );
1133
1134 const SYMBOL_LIB_TABLE_ROW* row = tbl->FindRow( symbol->GetLibId().GetLibNickname() );
1135
1136 if( !row )
1137 return;
1138
1139 wxString libfullname = row->GetFullURI( true );
1140
1141 wxString lib( mail.GetPayload() );
1142 wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s, current symbols "
1143 "is %s", lib, libfullname );
1144
1145 if( lib == libfullname )
1146 {
1147 wxLogTrace( "KICAD_LIB_WATCH", "Refreshing symbol %s", symbol->GetName() );
1150 }
1151
1152 break;
1153 }
1154 default:;
1155 }
1156}
const char * name
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
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
@ library_browser
BOX2< VECTOR2I > BOX2I
Definition: box2.h:877
static TOOL_ACTION toggleGrid
Definition: actions.h:172
static TOOL_ACTION zoomFitScreen
Definition: actions.h:124
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...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
void SetOrigin(const Vec &pos)
Definition: box2.h:227
void SetSize(const SizeVec &size)
Definition: box2.h:238
COLOR4D GetColor(int aLayer) const
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
int ScoreTerms(std::vector< SEARCH_TERM > &aWeightedTerms)
bool Find(const wxString &aTerm, int &aMatchersTriggered, int &aPosition)
virtual void ClearMsgPanel()
Clear all messages from the message panel.
COLOR_SETTINGS * m_colorSettings
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void AppendMsgPanel(const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
Append a message to the message panel.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
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.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
Specialization of the wxAuiPaneInfo class for KiCad panels.
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
Class that groups generic conditions for editor states.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
PANEL_LIB_VIEW m_LibViewPanel
Gather all the actions that are shared by tools.
Definition: ee_actions.h:39
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:136
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:135
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:181
static TOOL_ACTION showPinNumbers
Definition: ee_actions.h:251
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:150
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:250
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
void MessageSet(const wxString &message)
Add a message (in bold) to message list.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
bool m_axesEnabled
Fullscreen crosshair or small cross.
virtual void DrawGrid()
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:315
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:354
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1513
static void CreateNilUuids(bool aNil=true)
A performance optimization which disables/enables the generation of pseudo-random UUIDs.
Definition: kiid.cpp:300
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
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:196
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:110
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition: lib_id.cpp:99
void SetSubLibraryName(const UTF8 &aName)
Definition: lib_id.h:131
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Definition: lib_id.h:112
const wxString GetUniStringLibNickname() const
Definition: lib_id.h:88
UTF8 GetSubLibraryName() const
Some LIB_IDs can have a sub-library identifier in addition to a library nickname.
Definition: lib_id.h:130
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
const wxString GetFullLibraryName() const
Definition: lib_id.cpp:277
Define a library symbol object.
Definition: lib_symbol.h:77
const LIB_ID & GetLibId() const override
Definition: lib_symbol.h:142
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:535
bool IsAlias() const
Definition: lib_symbol.h:194
bool HasAlternateBodyStyle() const override
Test if symbol has more than one body conversion type (DeMorgan).
SCH_FIELD & GetDatasheetField() const
Return reference to the datasheet field.
wxString GetName() const override
Definition: lib_symbol.h:136
LIB_SYMBOL_SPTR SharedPtr() const
Definition: lib_symbol.h:88
int GetUnitCount() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:579
LIB_SYMBOL_REF & GetParent()
Definition: lib_symbol.h:105
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
bool GetIsVisible() const
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
static const wxString GetPinningSymbol()
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:49
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:70
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:166
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_RENDER_SETTINGS * GetRenderSettings()
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
bool Done()
Returns a string containing any errors generated during the load.
const wxString & GetErrors() const
Represents a pair of <nickname, loaded parts list>
void Start()
Spins up threads to load all the libraries in m_nicknames.
bool Join()
Finalizes the threads and combines the output into the target output map.
Handle actions for the various symbol editor and viewers.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_IO object i...
void GetSubLibraryNames(std::vector< wxString > &aNames) const
bool SupportsSubLibraries() const
void LoadSymbolLib(std::vector< LIB_SYMBOL * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)
void EnumerateSymbolLib(const wxString &aNickname, wxArrayString &aAliasNames, bool aPowerSymbolsOnly=false)
Return a list of symbol alias names contained within the library given by aNickname.
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
Symbol library viewer main window.
void OnLibFilter(wxCommandEvent &aEvent)
std::unique_ptr< LIB_SYMBOL > m_previewItem
void CloseLibraryViewer(wxCommandEvent &event)
void onSelectNextSymbol(wxCommandEvent &aEvent)
wxSearchCtrl * m_libFilter
void SetSelectedLibrary(const wxString &aLibName, const wxString &aSubLibName=wxEmptyString)
Set the selected library in the library window.
void ClickOnLibList(wxCommandEvent &event)
void onUpdateUnitChoice(wxUpdateUIEvent &aEvent)
void DClickOnSymbolList(wxCommandEvent &event)
void OnActivate(wxActivateEvent &event)
Called when the frame is activated to reload the libraries and symbol lists that can be changed by th...
void OnSymFilter(wxCommandEvent &aEvent)
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void doCloseWindow() override
void SetSelectedSymbol(const wxString &aSymbolName)
Set the selected symbol.
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
bool ReCreateLibList()
Create o recreates a sorted list of currently loaded libraries.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void ClickOnSymbolList(wxCommandEvent &event)
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
void SetUnitAndBodyStyle(int aUnit, int aBodyStyle)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
wxSearchCtrl * m_symbolFilter
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
static LIB_ID m_currentSymbol
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void OnCharHook(wxKeyEvent &aEvent) override
Capture the key event before it is sent to the GUI.
LIB_SYMBOL * GetSelectedSymbol() const
void onSelectSymbolUnit(wxCommandEvent &aEvent)
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
void onSelectPreviousSymbol(wxCommandEvent &aEvent)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the symbol selection changing,...
bool ReCreateSymbolList()
Create or recreate the list of symbols in the currently selected library.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
ACTIONS * m_actions
Definition: tools_holder.h:168
Master controller class:
Definition: tool_manager.h:62
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:150
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:302
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...
wxString wx_str() const
Definition: utf8.cpp:45
wxString GetBaseString(int n) const
Definition: wx_listbox.cpp:61
int FindString(const wxString &s, bool bCase=false) const override
Definition: wx_listbox.cpp:72
bool SetStringSelection(const wxString &s) override
Definition: wx_listbox.cpp:43
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _HKI(x)
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define LIB_VIEW_FRAME_NAME
Abstract pattern-matching tool and implementations.
@ CTX_LIBITEM
@ ID_LIBVIEW_SELECT_UNIT_NUMBER
Definition: eeschema_id.h:65
@ ID_LIBVIEW_SYM_LIST
Definition: eeschema_id.h:69
@ ID_LIBVIEW_NEXT
Definition: eeschema_id.h:63
@ ID_LIBVIEW_LIB_FILTER
Definition: eeschema_id.h:66
@ ID_LIBVIEW_LIB_LIST
Definition: eeschema_id.h:67
@ ID_LIBVIEW_SYM_FILTER
Definition: eeschema_id.h:68
@ ID_LIBVIEW_PREVIOUS
Definition: eeschema_id.h:64
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectHighlightChoice EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox) void GERBVIEW_FRAME
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
PROJECT & Prj()
Definition: kicad.cpp:595
@ LAYER_SCHEMATIC_GRID_AXES
Definition: layer_ids.h:389
@ MAIL_REFRESH_SYMBOL
Definition: mail_type.h:58
@ MAIL_RELOAD_LIB
Definition: mail_type.h:56
Message panel definition file.
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:58
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
CITER next(CITER it)
Definition: ptree.cpp:126
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LIBID
Definition: string_utils.h:54
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
std::vector< wxString > pinned_symbol_libs
const double IU_PER_MILS
Definition: base_units.h:77
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
VECTOR2< int > VECTOR2I
Definition: vector2d.h:602
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.