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
65#include <default_values.h>
66#include <string_utils.h>
67#include "eda_pattern_match.h"
68
69// Save previous symbol library viewer state.
71
75
76
77BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, SCH_BASE_FRAME )
78 // Window events
81
82 // Toolbar events
86
87 // listbox events
93
94 // Menu (and/or hotkey) events
95 EVT_MENU( wxID_CLOSE, SYMBOL_VIEWER_FRAME::CloseLibraryViewer )
96
98
99END_EVENT_TABLE()
100
101
102SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
103 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_VIEWER, _( "Symbol Library Browser" ),
104 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
106 m_unitChoice( nullptr ),
107 m_libList( nullptr ),
108 m_symbolList( nullptr )
109{
110 m_aboutTitle = _HKI( "KiCad Symbol Library Browser" );
111
112 // Force the frame name used in config. the lib viewer frame has a name
113 // depending on aFrameType (needed to identify the frame by wxWidgets),
114 // but only one configuration is preferable.
115 m_configName = LIB_VIEW_FRAME_NAME;
116
117 // Give an icon
118 wxIcon icon;
119 icon.CopyFromBitmap( KiBitmap( BITMAPS::library_browser ) );
120 SetIcon( icon );
121
122 m_libListWidth = 200;
123 m_symbolListWidth = 300;
124 m_listPowerOnly = false;
125
126 SetScreen( new SCH_SCREEN );
127 GetScreen()->m_Center = true; // Axis origin centered on screen.
128 LoadSettings( config() );
129
130 // Ensure axis are always drawn (initial default display was not drawn)
131 KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
132 gal_opts.m_axesEnabled = true;
133 gal_opts.m_gridMinSpacing = 10.0;
134 gal_opts.NotifyChanged();
135
136 GetRenderSettings()->LoadColors( GetColorSettings() );
137 GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
138
139 GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
140
141 setupTools();
142 setupUIConditions();
143
144 ReCreateHToolbar();
145 ReCreateVToolbar();
146 ReCreateMenuBar();
147
148 wxPanel* libPanel = new wxPanel( this );
149 wxSizer* libSizer = new wxBoxSizer( wxVERTICAL );
150
151 m_libFilter = new wxSearchCtrl( libPanel, ID_LIBVIEW_LIB_FILTER, wxEmptyString,
152 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
153 m_libFilter->SetDescriptiveText( _( "Filter" ) );
154 libSizer->Add( m_libFilter, 0, wxEXPAND, 5 );
155
156 m_libList = new WX_LISTBOX( libPanel, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
157 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
158 libSizer->Add( m_libList, 1, wxEXPAND, 5 );
159
160 libPanel->SetSizer( libSizer );
161 libPanel->Fit();
162
163 wxPanel* symbolPanel = new wxPanel( this );
164 wxSizer* symbolSizer = new wxBoxSizer( wxVERTICAL );
165
166 m_symbolFilter = new wxSearchCtrl( symbolPanel, ID_LIBVIEW_SYM_FILTER, wxEmptyString,
167 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
168 m_symbolFilter->SetDescriptiveText( _( "Filter" ) );
169 m_symbolFilter->SetToolTip(
170 _( "Filter on symbol name, keywords, description and pin count.\n"
171 "Search terms are separated by spaces. All search terms must match.\n"
172 "A term which is a number will also match against the pin count." ) );
173 symbolSizer->Add( m_symbolFilter, 0, wxEXPAND, 5 );
174
175#ifdef __WXGTK__
176 // wxSearchCtrl vertical height is not calculated correctly on some GTK setups
177 // See https://gitlab.com/kicad/code/kicad/-/issues/9019
178 m_libFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
179 m_symbolFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
180#endif
181
182 m_symbolList = new WX_LISTBOX( symbolPanel, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
183 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
184 symbolSizer->Add( m_symbolList, 1, wxEXPAND, 5 );
185
186 symbolPanel->SetSizer( symbolSizer );
187 symbolPanel->Fit();
188
189 // Preload libraries
190 loadAllLibraries();
191 ReCreateLibList();
192
193 m_selection_changed = false;
194
195 DisplayLibInfos();
196
197 m_auimgr.SetManagedWindow( this );
198
199 CreateInfoBar();
200
201 // Manage main toolbar
202 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
203 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) .Bottom().Layer(6) );
204
205 m_auimgr.AddPane( libPanel, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
206 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
207 m_auimgr.AddPane( symbolPanel, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1)
208 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
209
210 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
211
212 m_auimgr.Update();
213
214 if( m_libListWidth > 0 )
215 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Libraries" ), m_libListWidth, -1 );
216
217 if( m_symbolListWidth > 0 )
218 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Symbols" ), m_symbolListWidth, -1 );
219
220 FinishAUIInitialization();
221
222 Raise();
223 Show( true );
224
225 SyncView();
226 GetCanvas()->SetCanFocus( false );
227
228 setupUnits( config() );
229
230 // Set the working/draw area size to display a symbol to a reasonable value:
231 // A 450mm x 450mm with a origin at the area center looks like a large working area
232 double max_size_x = schIUScale.mmToIU( 450 );
233 double max_size_y = schIUScale.mmToIU( 450 );
234 BOX2D bbox;
235 bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
236 bbox.SetSize( max_size_x, max_size_y );
237 GetCanvas()->GetView()->SetBoundary( bbox );
238 GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
239
240 // If a symbol was previously selected in m_symbolList from a previous run, show it
241 wxString symbName = m_symbolList->GetStringSelection();
242
243 if( !symbName.IsEmpty() )
244 {
245 SetSelectedSymbol( symbName );
246 updatePreviewSymbol();
247 }
248}
249
250
252{
253 // Shutdown all running tools
254 if( m_toolManager )
256
257 if( m_previewItem )
258 {
259 GetCanvas()->GetView()->Remove( m_previewItem.get() );
260 m_previewItem = nullptr;
261 }
262}
263
264
266{
267 // TODO: deduplicate with SYMBOL_TREE_MODEL_ADAPTER::AddLibraries
268 std::vector<wxString> libraryNames = PROJECT_SCH::SchSymbolLibTable( &Prj() )->GetLogicalLibs();
269 std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter = nullptr;
270
271 if( m_show_progress )
272 {
273 progressReporter = std::make_unique<WX_PROGRESS_REPORTER>( this,
274 _( "Loading Symbol Libraries" ),
275 libraryNames.size(), true );
276 }
277
278 // Disable KIID generation: not needed for library parts; sometimes very slow
279 KIID::CreateNilUuids( true );
280
281 std::unordered_map<wxString, std::vector<LIB_SYMBOL*>> loadedSymbols;
282
283 SYMBOL_ASYNC_LOADER loader( libraryNames, PROJECT_SCH::SchSymbolLibTable( &Prj() ), false, nullptr,
284 progressReporter.get() );
285
286 LOCALE_IO toggle;
287
288 loader.Start();
289
290 while( !loader.Done() )
291 {
292 if( progressReporter && !progressReporter->KeepRefreshing() )
293 break;
294
295 wxMilliSleep( 33 );
296 }
297
298 loader.Join();
299
300 KIID::CreateNilUuids( false );
301
302 if( !loader.GetErrors().IsEmpty() )
303 {
304 HTML_MESSAGE_BOX dlg( this, _( "Load Error" ) );
305
306 dlg.MessageSet( _( "Errors loading symbols:" ) );
307
308 wxString msg = loader.GetErrors();
309 msg.Replace( "\n", "<BR>" );
310
311 dlg.AddHTML_Text( msg );
312 dlg.ShowModal();
313 }
314}
315
316
318{
319 // Create the manager and dispatcher & route draw panel events to the dispatcher
322 GetCanvas()->GetViewControls(), config(), this );
323 m_actions = new EE_ACTIONS();
325
326 // Register tools
330 m_toolManager->RegisterTool( new EE_INSPECTION_TOOL ); // manage show datasheet
331 m_toolManager->RegisterTool( new EE_SELECTION_TOOL ); // manage context menu
332 m_toolManager->RegisterTool( new SYMBOL_EDITOR_CONTROL ); // manage render settings
333
335
336 // Run the selection tool, it is supposed to be always active
337 // It also manages the mouse right click to show the context menu
338 m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
339
341}
342
343
345{
347
349 EDITOR_CONDITIONS cond( this );
350
351 wxASSERT( mgr );
352
353#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
354#define CHECK( x ) ACTION_CONDITIONS().Check( x )
355
357
358 auto electricalTypesShownCondition =
359 [this]( const SELECTION& aSel )
360 {
362 };
363
364 auto pinNumbersShownCondition =
365 [this]( const SELECTION& )
366 {
368 };
369
370 auto demorganCond =
371 [this]( const SELECTION& )
372 {
373 LIB_SYMBOL* symbol = GetSelectedSymbol();
374 return symbol && symbol->HasAlternateBodyStyle();
375 };
376
377 auto demorganStandardCond =
378 []( const SELECTION& )
379 {
380 return m_bodyStyle == BODY_STYLE::BASE;
381 };
382
383 auto demorganAlternateCond =
384 []( const SELECTION& )
385 {
386 return m_bodyStyle == BODY_STYLE::DEMORGAN;
387 };
388
389 auto haveDatasheetCond =
390 [this]( const SELECTION& )
391 {
392 LIB_SYMBOL* symbol = GetSelectedSymbol();
393 return symbol && !symbol->GetDatasheetField().GetText().IsEmpty();
394 };
395
396 mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
397 mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( electricalTypesShownCondition ) );
398 mgr->SetConditions( EE_ACTIONS::showPinNumbers, CHECK( pinNumbersShownCondition ) );
399
401 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
403 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
404
405#undef CHECK
406#undef ENABLE
407}
408
409
410void SYMBOL_VIEWER_FRAME::SetUnitAndBodyStyle( int aUnit, int aBodyStyle )
411{
412 m_unit = aUnit > 0 ? aUnit : 1;
413 m_bodyStyle = aBodyStyle > 0 ? aBodyStyle : BODY_STYLE::BASE;
414 m_selection_changed = false;
415
417}
418
419
421{
422 LIB_SYMBOL* symbol = nullptr;
423
426
427 return symbol;
428}
429
430
432{
433 LIB_SYMBOL* symbol = GetSelectedSymbol();
434 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
435
436 if( m_previewItem )
437 {
438 view->Remove( m_previewItem.get() );
439 m_previewItem = nullptr;
440 }
441
443
444 if( symbol )
445 {
448
449 m_previewItem = symbol->Flatten();
450 view->Add( m_previewItem.get() );
451
452 wxString parentName;
453 std::shared_ptr<LIB_SYMBOL> parent = symbol->GetParent().lock();
454
455 if( parent )
456 parentName = parent->GetName();
457
458 AppendMsgPanel( _( "Name" ), UnescapeString( m_previewItem->GetName() ) );
459 AppendMsgPanel( _( "Parent" ), UnescapeString( parentName ) );
460 AppendMsgPanel( _( "Description" ), m_previewItem->GetDescription() );
461 AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords() );
462 }
463
465 GetCanvas()->Refresh();
466}
467
468
470{
472 Destroy();
473}
474
475
476void SYMBOL_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
477{
478 if( m_auimgr.GetManagedWindow() )
479 m_auimgr.Update();
480
481 SizeEv.Skip();
482}
483
484
485void SYMBOL_VIEWER_FRAME::onUpdateUnitChoice( wxUpdateUIEvent& aEvent )
486{
487 LIB_SYMBOL* symbol = GetSelectedSymbol();
488
489 int unit_count = 1;
490
491 if( symbol )
492 unit_count = std::max( symbol->GetUnitCount(), 1 );
493
494 m_unitChoice->Enable( unit_count > 1 );
495
496 if( unit_count > 1 )
497 {
498 // rebuild the unit list if it is not suitable (after a new selection for instance)
499 if( unit_count != (int)m_unitChoice->GetCount() )
500 {
501 m_unitChoice->Clear();
502
503 for( int ii = 0; ii < unit_count; ii++ )
504 {
505 wxString unit = symbol->GetUnitDisplayName( ii + 1 );
506 m_unitChoice->Append( unit );
507 }
508
509 }
510
511 if( m_unitChoice->GetSelection() != std::max( 0, m_unit - 1 ) )
512 m_unitChoice->SetSelection( std::max( 0, m_unit - 1 ) );
513 }
514 else if( m_unitChoice->GetCount() )
515 {
516 m_unitChoice->Clear();
517 }
518}
519
520
522{
523 if( !m_libList )
524 return false;
525
526 m_libList->Clear();
527
531 std::vector<wxString> libs = libTable->GetLogicalLibs();
532 std::vector<wxString> pinnedMatches;
533 std::vector<wxString> otherMatches;
534
535 auto doAddLib =
536 [&]( const wxString& aLib )
537 {
538 if( alg::contains( project.m_PinnedSymbolLibs, aLib )
540 {
541 pinnedMatches.push_back( aLib );
542 }
543 else
544 {
545 otherMatches.push_back( aLib );
546 }
547 };
548
549 auto process =
550 [&]( const wxString& aLib )
551 {
552 // Remove not allowed libs, if the allowed lib list is not empty
553 if( m_allowedLibs.GetCount() )
554 {
555 if( m_allowedLibs.Index( aLib ) == wxNOT_FOUND )
556 return;
557 }
558
559 // Remove libs which have no power symbols, if this filter is activated
560 if( m_listPowerOnly )
561 {
562 wxArrayString aliasNames;
563
564 PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( aLib, aliasNames, true );
565
566 if( aliasNames.IsEmpty() )
567 return;
568 }
569
570 SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLib );
571
572 wxCHECK( row, /* void */ );
573
574 if( !row->GetIsVisible() )
575 return;
576
577 if( row->SupportsSubLibraries() )
578 {
579 std::vector<wxString> subLibraries;
580 row->GetSubLibraryNames( subLibraries );
581
582 for( const wxString& lib : subLibraries )
583 {
584 wxString suffix = lib.IsEmpty() ? wxString( wxT( "" ) )
585 : wxString::Format( wxT( " - %s" ), lib );
586 wxString name = wxString::Format( wxT( "%s%s" ), aLib, suffix );
587
588 doAddLib( name );
589 }
590 }
591 else
592 {
593 doAddLib( aLib );
594 }
595 };
596
597 if( m_libFilter->GetValue().IsEmpty() )
598 {
599 for( const wxString& lib : libs )
600 process( lib );
601 }
602 else
603 {
604 wxStringTokenizer tokenizer( m_libFilter->GetValue() );
605
606 while( tokenizer.HasMoreTokens() )
607 {
608 const wxString term = tokenizer.GetNextToken().Lower();
609 EDA_COMBINED_MATCHER matcher( term, CTX_LIBITEM );
610
611 for( const wxString& lib : libs )
612 {
613 if( matcher.Find( lib.Lower() ) )
614 process( lib );
615 }
616 }
617 }
618
619 if( libs.empty() )
620 return true;
621
622 for( const wxString& name : pinnedMatches )
624
625 for( const wxString& name : otherMatches )
626 m_libList->Append( UnescapeString( name ) );
627
628 // Search for a previous selection:
630
631 if( index != wxNOT_FOUND )
632 {
633 m_libList->SetSelection( index, true );
634 }
635 else
636 {
637 // If not found, clear current library selection because it can be deleted after a
638 // config change.
640 ? m_libList->GetBaseString( 0 ) : wxString( wxT( "" ) ) );
641 m_currentSymbol.SetLibItemName( wxEmptyString );
642 m_unit = 1;
643 m_bodyStyle = BODY_STYLE::BASE;
644 }
645
646 bool cmp_changed = ReCreateSymbolList();
648 GetCanvas()->Refresh();
649
650 return cmp_changed;
651}
652
653
655{
656 if( m_symbolList == nullptr )
657 return false;
658
659 m_symbolList->Clear();
660
661 wxString libName = m_currentSymbol.GetUniStringLibNickname();
662
663 if( libName.IsEmpty() )
664 return false;
665
666 std::vector<LIB_SYMBOL*> symbols;
668
669 try
670 {
671 if( row )
673 }
674 catch( const IO_ERROR& ) {} // ignore, it is handled below
675
676 std::set<wxString> excludes;
677
678 if( !m_symbolFilter->GetValue().IsEmpty() )
679 {
680 wxStringTokenizer tokenizer( m_symbolFilter->GetValue() );
681
682 while( tokenizer.HasMoreTokens() )
683 {
684 const wxString filterTerm = tokenizer.GetNextToken().Lower();
685 EDA_COMBINED_MATCHER matcher( filterTerm, CTX_LIBITEM );
686
687 for( LIB_SYMBOL* symbol : symbols )
688 {
689 std::vector<SEARCH_TERM> searchTerms = symbol->GetSearchTerms();
690 int matched = matcher.ScoreTerms( searchTerms );
691
692 if( filterTerm.IsNumber() && wxAtoi( filterTerm ) == (int)symbol->GetPinCount() )
693 matched++;
694
695 if( !matched )
696 excludes.insert( symbol->GetName() );
697 }
698 }
699 }
700
701 wxString subLib = m_currentSymbol.GetSubLibraryName();
702
703 for( const LIB_SYMBOL* symbol : symbols )
704 {
705 if( row && row->SupportsSubLibraries()
706 && !subLib.IsSameAs( symbol->GetLibId().GetSubLibraryName() ) )
707 {
708 continue;
709 }
710
711 if( !excludes.count( symbol->GetName() ) )
712 m_symbolList->Append( UnescapeString( symbol->GetName() ) );
713 }
714
715 if( m_symbolList->IsEmpty() )
716 {
717 SetSelectedSymbol( wxEmptyString );
718 m_bodyStyle = BODY_STYLE::BASE;
719 m_unit = 1;
720 return true;
721 }
722
724 bool changed = false;
725
726 if( index == wxNOT_FOUND )
727 {
728 // Select the first library entry when the previous entry name does not exist in
729 // the current library.
730 m_bodyStyle = BODY_STYLE::BASE;
731 m_unit = 1;
732 index = -1;
733 changed = true;
734 SetSelectedSymbol( wxEmptyString );
735 }
736
737 m_symbolList->SetSelection( index, true );
738
739 return changed;
740}
741
742
743void SYMBOL_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
744{
745 int ii = m_libList->GetSelection();
746
747 if( ii < 0 )
748 return;
749
750 m_selection_changed = true;
751
752 wxString selection = EscapeString( m_libList->GetBaseString( ii ), CTX_LIBID );
753
754 if( !PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRow( selection )
755 && selection.Find( '-' ) != wxNOT_FOUND )
756 {
757 // Probably a sub-library
758 wxString sublib;
759 selection = selection.BeforeLast( '-', &sublib ).Trim();
760 sublib.Trim( false );
761 SetSelectedLibrary( selection, sublib );
762 }
763 else
764 {
765 SetSelectedLibrary( selection );
766 }
767}
768
769
770void SYMBOL_VIEWER_FRAME::SetSelectedLibrary( const wxString& aLibraryName,
771 const wxString& aSubLibName )
772{
773 if( m_currentSymbol.GetUniStringLibNickname() == aLibraryName
774 && wxString( m_currentSymbol.GetSubLibraryName().wx_str() ) == aSubLibName )
775 return;
776
777 m_currentSymbol.SetLibNickname( aLibraryName );
778 m_currentSymbol.SetSubLibraryName( aSubLibName );
780 GetCanvas()->Refresh();
782
783 // Ensure the corresponding line in m_libList is selected
784 // (which is not necessary the case if SetSelectedLibrary is called
785 // by another caller than ClickOnLibList.
787
788 // The m_libList has now the focus, in order to be able to use arrow keys
789 // to navigate inside the list.
790 // the gal canvas must not steal the focus to allow navigation
791 GetCanvas()->SetStealsFocus( false );
792 m_libList->SetFocus();
793}
794
795
796void SYMBOL_VIEWER_FRAME::ClickOnSymbolList( wxCommandEvent& event )
797{
798 int ii = m_symbolList->GetSelection();
799
800 if( ii < 0 )
801 return;
802
803 m_selection_changed = true;
804
806
807 // The m_symbolList has now the focus, in order to be able to use arrow keys
808 // to navigate inside the list.
809 // the gal canvas must not steal the focus to allow navigation
810 GetCanvas()->SetStealsFocus( false );
811 m_symbolList->SetFocus();
812}
813
814
815void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
816{
817 if( m_currentSymbol.GetUniStringLibItemName() != aSymbolName )
818 {
819 m_currentSymbol.SetLibItemName( aSymbolName );
820
821 // Ensure the corresponding line in m_symbolList is selected
822 // (which is not necessarily the case if SetSelectedSymbol is called
823 // by another caller than ClickOnSymbolList.
824 m_symbolList->SetStringSelection( UnescapeString( aSymbolName ), true );
826
828 {
829 m_unit = 1;
830 m_bodyStyle = BODY_STYLE::BASE;
831 m_selection_changed = false;
832 }
833
835 }
836}
837
838
839void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event )
840{
842}
843
844
846{
848
850
851 // Grid shape, etc.
852 GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
853
854 m_libListWidth = cfg->m_LibViewPanel.lib_list_width;
855 m_symbolListWidth = cfg->m_LibViewPanel.cmp_list_width;
856
857 GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
858 GetRenderSettings()->m_ShowPinNumbers = cfg->m_LibViewPanel.show_pin_numbers;
859
860 // Set parameters to a reasonable value.
861 int maxWidth = cfg->m_LibViewPanel.window.state.size_x - 80;
862
863 if( m_libListWidth + m_symbolListWidth > maxWidth )
864 {
867 }
868}
869
870
872{
874
876
878 m_libListWidth = m_libList->GetSize().x;
879
880 m_symbolListWidth = m_symbolList->GetSize().x;
881
884
885 if( SCH_RENDER_SETTINGS* renderSettings = GetRenderSettings() )
886 {
887 cfg->m_LibViewPanel.show_pin_electrical_type = renderSettings->m_ShowPinsElectricalType;
888 cfg->m_LibViewPanel.show_pin_numbers = renderSettings->m_ShowPinNumbers;
889 }
890}
891
892
894{
895 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
896 wxASSERT( cfg );
897 return &cfg->m_LibViewPanel.window;
898}
899
900
901void SYMBOL_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
902{
903 SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
904
907
909 GetCanvas()->GetGAL()->DrawGrid();
911
912 if( aEnvVarsChanged )
914}
915
916
917void SYMBOL_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
918{
919 if( event.GetActive() )
920 {
921 bool changed = m_libList ? ReCreateLibList() : false;
922
923 if (changed)
924 m_selection_changed = true;
925
927
929 }
930
931 event.Skip(); // required under wxMAC
932}
933
934
935void SYMBOL_VIEWER_FRAME::CloseLibraryViewer( wxCommandEvent& event )
936{
937 Close();
938}
939
940
941const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
942{
943 LIB_SYMBOL* symbol = GetSelectedSymbol();
944
945 if( !symbol )
946 {
947 return BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) );
948 }
949 else
950 {
951 std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsAlias() ? symbol->GetParent().lock()
952 : symbol->SharedPtr();
953
954 wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
955
956 return tmp->GetUnitBoundingBox( m_unit, m_bodyStyle );
957 }
958}
959
960
961void SYMBOL_VIEWER_FRAME::OnLibFilter( wxCommandEvent& aEvent )
962{
964
965 // Required to avoid interaction with SetHint()
966 // See documentation for wxTextEntry::SetHint
967 aEvent.Skip();
968}
969
970
971void SYMBOL_VIEWER_FRAME::OnSymFilter( wxCommandEvent& aEvent )
972{
974
975 // Required to avoid interaction with SetHint()
976 // See documentation for wxTextEntry::SetHint
977 aEvent.Skip();
978}
979
980
981void SYMBOL_VIEWER_FRAME::OnCharHook( wxKeyEvent& aEvent )
982{
983 if( aEvent.GetKeyCode() == WXK_UP )
984 {
985 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
986 {
987 int prev = m_libList->GetSelection() - 1;
988
989 if( prev >= 0 )
990 {
991 m_libList->SetSelection( prev );
992 m_libList->EnsureVisible( prev );
993
994 wxCommandEvent dummy;
996 }
997 }
998 else
999 {
1000 wxCommandEvent dummy;
1002 }
1003 }
1004 else if( aEvent.GetKeyCode() == WXK_DOWN )
1005 {
1006 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
1007 {
1008 int next = m_libList->GetSelection() + 1;
1009
1010 if( next < (int)m_libList->GetCount() )
1011 {
1012 m_libList->SetSelection( next );
1013 m_libList->EnsureVisible( next );
1014
1015 wxCommandEvent dummy;
1017 }
1018 }
1019 else
1020 {
1021 wxCommandEvent dummy;
1023 }
1024 }
1025 else if( aEvent.GetKeyCode() == WXK_TAB && m_libFilter->HasFocus() )
1026 {
1027 if( !aEvent.ShiftDown() )
1028 m_symbolFilter->SetFocus();
1029 else
1030 aEvent.Skip();
1031 }
1032 else if( aEvent.GetKeyCode() == WXK_TAB && m_symbolFilter->HasFocus() )
1033 {
1034 if( aEvent.ShiftDown() )
1035 m_libFilter->SetFocus();
1036 else
1037 aEvent.Skip();
1038 }
1039 else if( ( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
1040 && m_symbolList->GetSelection() >= 0 )
1041 {
1042 wxCommandEvent dummy;
1044 }
1045 else
1046 {
1047 aEvent.Skip();
1048 }
1049}
1050
1051
1052void SYMBOL_VIEWER_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
1053{
1054 wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
1055 int ii = m_symbolList->GetSelection();
1056
1057 // Select the next symbol or stop at the end of the list.
1058 if( ii != wxNOT_FOUND && ii < (int)(m_symbolList->GetCount() - 1) )
1059 ii += 1;
1060
1061 m_symbolList->SetSelection( ii );
1062 ProcessEvent( evt );
1063}
1064
1065
1067{
1068 wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
1069 int ii = m_symbolList->GetSelection();
1070
1071 // Select the previous symbol or stop at the beginning of list.
1072 if( ii != wxNOT_FOUND && ii != 0 )
1073 ii -= 1;
1074
1075 m_symbolList->SetSelection( ii );
1076 ProcessEvent( evt );
1077}
1078
1079
1080void SYMBOL_VIEWER_FRAME::onSelectSymbolUnit( wxCommandEvent& aEvent )
1081{
1082 int ii = m_unitChoice->GetSelection();
1083
1084 if( ii < 0 )
1085 return;
1086
1087 m_unit = ii + 1;
1088
1090}
1091
1092
1094{
1095 wxString libName = m_currentSymbol.GetUniStringLibNickname();
1096
1097 if( m_libList && !m_libList->IsEmpty() && !libName.IsEmpty() )
1098 {
1099 const SYMBOL_LIB_TABLE_ROW* row =
1100 PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRow( libName, true );
1101
1102 wxString title = row ? row->GetFullURI( true ) : _( "[no library selected]" );
1103
1104 title += wxT( " \u2014 " ) + _( "Symbol Library Browser" );
1105 SetTitle( title );
1106 }
1107}
1108
1109
1111{
1112 return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1113}
1114
1115
1117{
1118
1119 switch( mail.Command() )
1120 {
1121 case MAIL_RELOAD_LIB:
1122 {
1124 break;
1125 }
1127 {
1129 LIB_SYMBOL* symbol = GetSelectedSymbol();
1130
1131 wxCHECK2( tbl && symbol, break );
1132
1133 const SYMBOL_LIB_TABLE_ROW* row = tbl->FindRow( symbol->GetLibId().GetLibNickname() );
1134
1135 if( !row )
1136 return;
1137
1138 wxString libfullname = row->GetFullURI( true );
1139
1140 wxString lib( mail.GetPayload() );
1141 wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s, current symbols "
1142 "is %s", lib, libfullname );
1143
1144 if( lib == libfullname )
1145 {
1146 wxLogTrace( "KICAD_LIB_WATCH", "Refreshing symbol %s", symbol->GetName() );
1149 }
1150
1151 break;
1152 }
1153 default:;
1154 }
1155}
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:887
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:133
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:132
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:178
static TOOL_ACTION showPinNumbers
Definition: ee_actions.h:248
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:147
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:247
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: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...
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::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
PROJECT & Prj()
Definition: kicad.cpp:595
@ LAYER_SCHEMATIC_GRID_AXES
Definition: layer_ids.h:388
@ 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:588
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.