KiCad PCB EDA Suite
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-2022 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>
32#include <kiface_base.h>
33#include <kiway.h>
34#include <symbol_viewer_frame.h>
35#include <widgets/msgpanel.h>
36#include <widgets/wx_listbox.h>
37#include <sch_view.h>
38#include <sch_painter.h>
39#include <symbol_lib_table.h>
41#include <pgm_base.h>
44#include <tool/action_toolbar.h>
45#include <tool/common_control.h>
46#include <tool/common_tools.h>
48#include <tool/selection.h>
50#include <tool/tool_manager.h>
51#include <tool/zoom_tool.h>
52#include <tools/ee_actions.h>
55#include <view/view_controls.h>
56#include <wx/srchctrl.h>
57
58#include <default_values.h>
59#include <string_utils.h>
60#include "eda_pattern_match.h"
61
62// Save previous symbol library viewer state.
65
68
69
70BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, EDA_DRAW_FRAME )
71 // Window events
74
75 // Toolbar events
80
81 // listbox events
87
88 // Menu (and/or hotkey) events
89 EVT_MENU( wxID_CLOSE, SYMBOL_VIEWER_FRAME::CloseLibraryViewer )
91
93
94END_EVENT_TABLE()
95
96
97#define LIB_VIEW_NAME "ViewlibFrame"
98#define LIB_VIEW_NAME_MODAL "ViewlibFrameModal"
99
100#define LIB_VIEW_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE )
101#define LIB_VIEW_STYLE_MODAL ( KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT )
102
103
104SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
105 const wxString& aLibraryName ) :
106 SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Symbol Library Browser" ),
107 wxDefaultPosition, wxDefaultSize,
110 m_unitChoice( nullptr ),
111 m_libList( nullptr ),
112 m_symbolList( nullptr ),
113 m_previewItem( nullptr )
114{
115 wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL );
116
117 if( aFrameType == FRAME_SCH_VIEWER_MODAL )
118 SetModal( true );
119
120 m_aboutTitle = _( "KiCad Symbol Library Viewer" );
121
122 // Force the frame name used in config. the lib viewer frame has a name
123 // depending on aFrameType (needed to identify the frame by wxWidgets),
124 // but only one configuration is preferable.
126
127 // Give an icon
128 wxIcon icon;
129 icon.CopyFromBitmap( KiBitmap( BITMAPS::library_browser ) );
130 SetIcon( icon );
131
132 m_libListWidth = 200;
133 m_symbolListWidth = 300;
134 m_listPowerOnly = false;
135
136 SetScreen( new SCH_SCREEN );
137 GetScreen()->m_Center = true; // Axis origin centered on screen.
138 LoadSettings( config() );
139
140 // Ensure axis are always drawn (initial default display was not drawn)
142 gal_opts.m_axesEnabled = true;
143 gal_opts.m_gridMinSpacing = 10.0;
144 gal_opts.NotifyChanged();
145
148
150
151 setupTools();
153
157
158 wxPanel* libPanel = new wxPanel( this );
159 wxSizer* libSizer = new wxBoxSizer( wxVERTICAL );
160
161 m_libFilter = new wxSearchCtrl( libPanel, ID_LIBVIEW_LIB_FILTER, wxEmptyString,
162 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
163 m_libFilter->SetDescriptiveText( _( "Filter" ) );
164 libSizer->Add( m_libFilter, 0, wxEXPAND, 5 );
165
166 m_libList = new WX_LISTBOX( libPanel, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
167 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
168 libSizer->Add( m_libList, 1, wxEXPAND, 5 );
169
170 libPanel->SetSizer( libSizer );
171 libPanel->Fit();
172
173 wxPanel* symbolPanel = new wxPanel( this );
174 wxSizer* symbolSizer = new wxBoxSizer( wxVERTICAL );
175
176 m_symbolFilter = new wxSearchCtrl( symbolPanel, ID_LIBVIEW_SYM_FILTER, wxEmptyString,
177 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
178 m_symbolFilter->SetDescriptiveText( _( "Filter" ) );
179 m_symbolFilter->SetToolTip(
180 _( "Filter on symbol name, keywords, description and pin count.\n"
181 "Search terms are separated by spaces. All search terms must match.\n"
182 "A term which is a number will also match against the pin count." ) );
183 symbolSizer->Add( m_symbolFilter, 0, wxEXPAND, 5 );
184
185#ifdef __WXGTK__
186 // wxSearchCtrl vertical height is not calculated correctly on some GTK setups
187 // See https://gitlab.com/kicad/code/kicad/-/issues/9019
188 m_libFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
189 m_symbolFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
190#endif
191
192 m_symbolList = new WX_LISTBOX( symbolPanel, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
193 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
194 symbolSizer->Add( m_symbolList, 1, wxEXPAND, 5 );
195
196 symbolPanel->SetSizer( symbolSizer );
197 symbolPanel->Fit();
198
199 if( aLibraryName.empty() )
200 {
202 }
203 else
204 {
205 m_libraryName = aLibraryName;
206 m_entryName.Clear();
207 m_unit = 1;
208 m_convert = 1;
209 }
210
211 m_selection_changed = false;
212
214
215 m_auimgr.SetManagedWindow( this );
216
217 // Manage main toolbar
218 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
219 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) .Bottom().Layer(6) );
220
221 m_auimgr.AddPane( libPanel, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
222 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
223 m_auimgr.AddPane( symbolPanel, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1)
224 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
225
226 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
227
228 m_auimgr.GetPane( libPanel ).Show( aLibraryName.empty() );
229
230 m_auimgr.Update();
231
232 if( m_libListWidth > 0 )
233 {
234 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Libraries" );
235
236 // wxAUI hack: force width by setting MinSize() and then Fixed()
237 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
238 treePane.MinSize( m_libListWidth, -1 );
239 treePane.Fixed();
240 m_auimgr.Update();
241
242 // now make it resizable again
243 treePane.Resizable();
244 m_auimgr.Update();
245
246 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
247 // back to minimum.
248 treePane.MinSize( 100, -1 );
249 }
250
251 if( m_symbolListWidth > 0 )
252 {
253 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Symbols" );
254
255 // wxAUI hack: force width by setting MinSize() and then Fixed()
256 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
257 treePane.MinSize( m_symbolListWidth, -1 );
258 treePane.Fixed();
259 m_auimgr.Update();
260
261 // now make it resizable again
262 treePane.Resizable();
263 m_auimgr.Update();
264
265 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
266 // back to minimum.
267 treePane.MinSize( 100, -1 );
268 }
269
270 if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
271 {
272 Raise();
273 Show( true );
274 }
275
276 SyncView();
277 GetCanvas()->SetCanFocus( false );
278
279 setupUnits( config() );
280
281 // Set the working/draw area size to display a symbol to a reasonable value:
282 // A 450mm x 450mm with a origin at the area center looks like a large working area
283 double max_size_x = schIUScale.mmToIU( 450 );
284 double max_size_y = schIUScale.mmToIU( 450 );
285 BOX2D bbox;
286 bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
287 bbox.SetSize( max_size_x, max_size_y );
288 GetCanvas()->GetView()->SetBoundary( bbox );
290}
291
292
294{
295 // Shutdown all running tools
296 if( m_toolManager )
298
299 if( m_previewItem )
301}
302
303
305{
306 // Create the manager and dispatcher & route draw panel events to the dispatcher
309 GetCanvas()->GetViewControls(), config(), this );
310 m_actions = new EE_ACTIONS();
312
313 // Register tools
317 m_toolManager->RegisterTool( new EE_INSPECTION_TOOL ); // manage show datasheet
318 m_toolManager->RegisterTool( new EE_SELECTION_TOOL ); // manage context menu
319 m_toolManager->RegisterTool( new SYMBOL_EDITOR_CONTROL ); // manage render settings
320
322
323 // Run the selection tool, it is supposed to be always active
324 // It also manages the mouse right click to show the context menu
325 m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
326
328}
329
330
332{
334
336 EDITOR_CONDITIONS cond( this );
337
338 wxASSERT( mgr );
339
340#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
341#define CHECK( x ) ACTION_CONDITIONS().Check( x )
342
344
345 auto electricalTypesShownCondition =
346 [this]( const SELECTION& aSel )
347 {
349 };
350
351 auto pinNumbersShownCondition =
352 [this]( const SELECTION& )
353 {
355 };
356
357 auto demorganCond =
358 [this]( const SELECTION& )
359 {
360 LIB_SYMBOL* symbol = GetSelectedSymbol();
361
362 return symbol && symbol->HasConversion();
363 };
364
365 auto demorganStandardCond =
366 []( const SELECTION& )
367 {
368 return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
369 };
370
371 auto demorganAlternateCond =
372 []( const SELECTION& )
373 {
374 return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
375 };
376
377 auto haveDatasheetCond =
378 [this]( const SELECTION& )
379 {
380 LIB_SYMBOL* symbol = GetSelectedSymbol();
381
382 return symbol && !symbol->GetDatasheetField().GetText().IsEmpty();
383 };
384
385 mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
386 mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( electricalTypesShownCondition ) );
387 mgr->SetConditions( EE_ACTIONS::showPinNumbers, CHECK( pinNumbersShownCondition ) );
388
390 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
392 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
393
394#undef CHECK
395#undef ENABLE
396}
397
398
399void SYMBOL_VIEWER_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
400{
401 m_unit = aUnit > 0 ? aUnit : 1;
402 m_convert = aConvert > 0 ? aConvert : LIB_ITEM::LIB_CONVERT::BASE;
403 m_selection_changed = false;
404
406}
407
408
410{
411 LIB_SYMBOL* symbol = nullptr;
412
413 if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
414 symbol = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
415
416 return symbol;
417}
418
419
421{
422 LIB_SYMBOL* symbol = GetSelectedSymbol();
423 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
424
425 if( m_previewItem )
426 {
427 view->Remove( m_previewItem );
428 m_previewItem = nullptr;
429 }
430
432
433 if( symbol )
434 {
437
438 m_previewItem = symbol;
439 view->Add( m_previewItem );
440
441 wxString parentName;
442 std::shared_ptr<LIB_SYMBOL> parent = m_previewItem->GetParent().lock();
443
444 if( parent )
445 parentName = parent->GetName();
446
448 AppendMsgPanel( _( "Parent" ), UnescapeString( parentName ) );
449 AppendMsgPanel( _( "Description" ), m_previewItem->GetDescription() );
450 AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords() );
451 }
452
454 GetCanvas()->Refresh();
455}
456
457
458bool SYMBOL_VIEWER_FRAME::ShowModal( wxString* aSymbol, wxWindow* aParent )
459{
460 if( aSymbol && !aSymbol->IsEmpty() )
461 {
462 wxString msg;
463 LIB_TABLE* libTable = Prj().SchSymbolLibTable();
464 LIB_ID libid;
465
466 libid.Parse( *aSymbol, true );
467
468 if( libid.IsValid() )
469 {
470 wxString libName = libid.GetLibNickname();
471
472 if( !libTable->HasLibrary( libid.GetLibNickname(), false ) )
473 {
474 msg.Printf( _( "The current configuration does not include the library '%s'.\n"
475 "Use Manage Symbol Libraries to edit the configuration." ),
476 UnescapeString( libName ) );
477 DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
478 }
479 else if ( !libTable->HasLibrary( libid.GetLibNickname(), true ) )
480 {
481 msg.Printf( _( "The library '%s' is not enabled in the current configuration.\n"
482 "Use Manage Symbol Libraries to edit the configuration." ),
483 UnescapeString( libName ) );
484 DisplayErrorMessage( aParent, _( "Symbol library not enabled." ), msg );
485 }
486 else
487 {
490 }
491 }
492 }
493
494 m_libFilter->SetFocus();
495 return KIWAY_PLAYER::ShowModal( aSymbol, aParent );
496}
497
498
500{
502
503 if( !IsModal() )
504 {
505 Destroy();
506 }
507 else if( !IsDismissed() )
508 {
509 // only dismiss modal frame if not already dismissed.
510 DismissModal( false );
511
512 // Modal frame will be destroyed by the calling function.
513 }
514}
515
516
517void SYMBOL_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
518{
519 if( m_auimgr.GetManagedWindow() )
520 m_auimgr.Update();
521
522 SizeEv.Skip();
523}
524
525
526void SYMBOL_VIEWER_FRAME::onUpdateUnitChoice( wxUpdateUIEvent& aEvent )
527{
528 LIB_SYMBOL* symbol = GetSelectedSymbol();
529
530 int unit_count = 1;
531
532 if( symbol )
533 unit_count = std::max( symbol->GetUnitCount(), 1 );
534
535 m_unitChoice->Enable( unit_count > 1 );
536
537 if( unit_count > 1 )
538 {
539 // rebuild the unit list if it is not suitable (after a new selection for instance)
540 if( unit_count != (int)m_unitChoice->GetCount() )
541 {
542 m_unitChoice->Clear();
543
544 for( int ii = 0; ii < unit_count; ii++ )
545 {
546 wxString unit = symbol->GetUnitDisplayName( ii + 1 );
547 m_unitChoice->Append( unit );
548 }
549
550 }
551
552 if( m_unitChoice->GetSelection() != std::max( 0, m_unit - 1 ) )
553 m_unitChoice->SetSelection( std::max( 0, m_unit - 1 ) );
554 }
555 else if( m_unitChoice->GetCount() )
556 {
557 m_unitChoice->Clear();
558 }
559}
560
561
563{
564 if( !m_libList )
565 return false;
566
567 m_libList->Clear();
568
569 COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
571 std::vector<wxString> libs = Prj().SchSymbolLibTable()->GetLogicalLibs();
572 std::set<wxString> pinnedMatches;
573 std::set<wxString> otherMatches;
574
575 auto process =
576 [&]( const wxString& aLib )
577 {
578 // Remove not allowed libs, if the allowed lib list is not empty
579 if( m_allowedLibs.GetCount() )
580 {
581 if( m_allowedLibs.Index( aLib ) == wxNOT_FOUND )
582 return;
583 }
584
585 // Remove libs which have no power symbols, if this filter is activated
586 if( m_listPowerOnly )
587 {
588 wxArrayString aliasNames;
589
590 Prj().SchSymbolLibTable()->EnumerateSymbolLib( aLib, aliasNames, true );
591
592 if( aliasNames.IsEmpty() )
593 return;
594 }
595
596 if( alg::contains( project.m_PinnedSymbolLibs, aLib )
598 {
599 pinnedMatches.insert( aLib );
600 }
601 else
602 {
603 otherMatches.insert( aLib );
604 }
605 };
606
607 if( m_libFilter->GetValue().IsEmpty() )
608 {
609 for( const wxString& lib : libs )
610 process( lib );
611 }
612 else
613 {
614 wxStringTokenizer tokenizer( m_libFilter->GetValue() );
615
616 while( tokenizer.HasMoreTokens() )
617 {
618 const wxString term = tokenizer.GetNextToken().Lower();
619 EDA_COMBINED_MATCHER matcher( term, CTX_LIBITEM );
620 int matches, position;
621
622 for( const wxString& lib : libs )
623 {
624 if( matcher.Find( lib.Lower(), matches, position ) )
625 process( lib );
626 }
627 }
628 }
629
630 if( libs.empty() )
631 return true;
632
633 for( const wxString& name : pinnedMatches )
635
636 for( const wxString& name : otherMatches )
637 m_libList->Append( UnescapeString( name ) );
638
639 // Search for a previous selection:
641
642 if( index != wxNOT_FOUND )
643 {
644 m_libList->SetSelection( index, true );
645 }
646 else
647 {
648 // If not found, clear current library selection because it can be deleted after a
649 // config change.
650 m_libraryName = m_libList->GetCount() > 0 ? m_libList->GetBaseString( 0 ) : wxT( "" );
651 m_entryName = wxEmptyString;
652 m_unit = 1;
653 m_convert = LIB_ITEM::LIB_CONVERT::BASE;
654 }
655
656 bool cmp_changed = ReCreateSymbolList();
658 GetCanvas()->Refresh();
659
660 return cmp_changed;
661}
662
663
665{
666 if( m_symbolList == nullptr )
667 return false;
668
669 m_symbolList->Clear();
670
671 if( m_libraryName.IsEmpty() )
672 return false;
673
674 std::vector<LIB_SYMBOL*> symbols;
675
676 try
677 {
678 if( Prj().SchSymbolLibTable()->FindRow( m_libraryName ) )
679 Prj().SchSymbolLibTable()->LoadSymbolLib( symbols, m_libraryName, m_listPowerOnly );
680 }
681 catch( const IO_ERROR& ) {} // ignore, it is handled below
682
683 std::set<wxString> excludes;
684
685 if( !m_symbolFilter->GetValue().IsEmpty() )
686 {
687 wxStringTokenizer tokenizer( m_symbolFilter->GetValue() );
688
689 while( tokenizer.HasMoreTokens() )
690 {
691 const wxString term = tokenizer.GetNextToken().Lower();
692 EDA_COMBINED_MATCHER matcher( term, CTX_LIBITEM );
693 int matches, position;
694
695 for( LIB_SYMBOL* symbol : symbols )
696 {
697 wxString search = symbol->GetName() + wxS( " " ) + symbol->GetSearchText();
698 bool matched = matcher.Find( search.Lower(), matches, position );
699
700 if( !matched && term.IsNumber() )
701 matched = ( wxAtoi( term ) == (int)symbol->GetPinCount() );
702
703 if( !matched )
704 excludes.insert( symbol->GetName() );
705 }
706 }
707 }
708
709 for( const LIB_SYMBOL* symbol : symbols )
710 {
711 if( !excludes.count( symbol->GetName() ) )
712 m_symbolList->Append( UnescapeString( symbol->GetName() ) );
713 }
714
715 if( m_symbolList->IsEmpty() )
716 {
717 m_libraryName = wxEmptyString;
718 m_entryName = wxEmptyString;
719 m_convert = LIB_ITEM::LIB_CONVERT::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_convert = LIB_ITEM::LIB_CONVERT::BASE;
732 m_unit = 1;
733 index = 0;
734 changed = true;
735 m_entryName = 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
754}
755
756
757void SYMBOL_VIEWER_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
758{
759 if( m_libraryName == aLibraryName )
760 return;
761
762 m_libraryName = aLibraryName;
764 GetCanvas()->Refresh();
766
767 // Ensure the corresponding line in m_libList is selected
768 // (which is not necessary the case if SetSelectedLibrary is called
769 // by another caller than ClickOnLibList.
771
772 // The m_libList has now the focus, in order to be able to use arrow keys
773 // to navigate inside the list.
774 // the gal canvas must not steal the focus to allow navigation
775 GetCanvas()->SetStealsFocus( false );
776 m_libList->SetFocus();
777}
778
779
780void SYMBOL_VIEWER_FRAME::ClickOnSymbolList( wxCommandEvent& event )
781{
782 int ii = m_symbolList->GetSelection();
783
784 if( ii < 0 )
785 return;
786
787 m_selection_changed = true;
788
790
791 // The m_symbolList has now the focus, in order to be able to use arrow keys
792 // to navigate inside the list.
793 // the gal canvas must not steal the focus to allow navigation
794 GetCanvas()->SetStealsFocus( false );
795 m_symbolList->SetFocus();
796}
797
798
799void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
800{
801 if( m_entryName != aSymbolName )
802 {
803 m_entryName = aSymbolName;
804
805 // Ensure the corresponding line in m_symbolList is selected
806 // (which is not necessarily the case if SetSelectedSymbol is called
807 // by another caller than ClickOnSymbolList.
808 m_symbolList->SetStringSelection( UnescapeString( aSymbolName ), true );
810
812 {
813 m_unit = 1;
814 m_convert = LIB_ITEM::LIB_CONVERT::BASE;
815 m_selection_changed = false;
816 }
817
819 }
820}
821
822
823void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event )
824{
826}
827
828
830{
831 auto cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
832
834
835 // Grid shape, etc.
836 GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
837
838 m_libListWidth = cfg->m_LibViewPanel.lib_list_width;
839 m_symbolListWidth = cfg->m_LibViewPanel.cmp_list_width;
840
841 GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
842 GetRenderSettings()->m_ShowPinNumbers = cfg->m_LibViewPanel.show_pin_numbers;
843
844 // Set parameters to a reasonable value.
845 int maxWidth = cfg->m_LibViewPanel.window.state.size_x - 80;
846
847 if( m_libListWidth + m_symbolListWidth > maxWidth )
848 {
851 }
852}
853
854
856{
857 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
858
860
862 m_libListWidth = m_libList->GetSize().x;
863
864 m_symbolListWidth = m_symbolList->GetSize().x;
865
868
869 if( KIGFX::SCH_RENDER_SETTINGS* renderSettings = GetRenderSettings() )
870 {
871 cfg->m_LibViewPanel.show_pin_electrical_type = renderSettings->m_ShowPinsElectricalType;
872 cfg->m_LibViewPanel.show_pin_numbers = renderSettings->m_ShowPinNumbers;
873 }
874}
875
876
878{
879 auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
880 wxASSERT( cfg );
881 return &cfg->m_LibViewPanel.window;
882}
883
884
885void SYMBOL_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
886{
887 SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
888
889 auto cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
890 GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
891
893 GetCanvas()->GetGAL()->DrawGrid();
895
896 if( aEnvVarsChanged )
898}
899
900
901void SYMBOL_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
902{
903 if( event.GetActive() )
904 {
905 bool changed = m_libList ? ReCreateLibList() : false;
906
907 if (changed)
908 m_selection_changed = true;
909
911
913 }
914
915 event.Skip(); // required under wxMAC
916}
917
918
919void SYMBOL_VIEWER_FRAME::CloseLibraryViewer( wxCommandEvent& event )
920{
921 Close();
922}
923
924
926{
927 m_listPowerOnly = false;
928 m_allowedLibs.Clear();
929
930 if( aFilter )
931 {
932 m_allowedLibs = aFilter->GetAllowedLibList();
934 }
935
937}
938
939
940const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
941{
942 LIB_SYMBOL* symbol = GetSelectedSymbol();
943
944 if( !symbol )
945 {
946 return BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) );
947 }
948 else
949 {
950 std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsAlias() ? symbol->GetParent().lock()
951 : symbol->SharedPtr();
952
953 wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
954
955 return tmp->GetUnitBoundingBox( m_unit, m_convert );
956 }
957}
958
959
961{
962 if( m_symbolList->GetSelection() >= 0 )
963 {
964 DismissModal( true, m_libraryName + ':'
966 }
967 else
968 {
969 DismissModal( false );
970 }
971
972 Close( true );
973}
974
975
976void SYMBOL_VIEWER_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
977{
978 std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_SYMBOL::g_Mutex, std::defer_lock );
979
980 // One CHOOSE_SYMBOL dialog at a time. User probably can't handle more anyway.
981 if( !dialogLock.try_lock() )
982 return;
983
984 // Container doing search-as-you-type.
985 SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
986 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> dataPtr
987 = SYMBOL_TREE_MODEL_ADAPTER::Create( this, libs );
988 SYMBOL_TREE_MODEL_ADAPTER* modelAdapter
989 = static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( dataPtr.get() );
990
991 if( !modelAdapter->AddLibraries( libs->GetLogicalLibs(), this ) )
992 {
993 // loading cancelled by user
994 return;
995 }
996
997 LIB_SYMBOL* current = GetSelectedSymbol();
998 LIB_ID id;
999 int unit = 0;
1000
1001 if( current )
1002 {
1003 id = current->GetLibId();
1004 modelAdapter->SetPreselectNode( id, unit );
1005 }
1006
1007 wxString dialogTitle;
1008 dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), modelAdapter->GetItemCount() );
1009
1010 DIALOG_CHOOSE_SYMBOL dlg( this, dialogTitle, dataPtr, m_convert, false, false, false );
1011
1012 if( dlg.ShowQuasiModal() == wxID_CANCEL )
1013 return;
1014
1015 id = dlg.GetSelectedLibId( &unit );
1016
1017 if( !id.IsValid() )
1018 return;
1019
1020 SetSelectedLibrary( id.GetLibNickname() );
1021 SetSelectedSymbol( id.GetLibItemName() );
1022 SetUnitAndConvert( unit, 1 );
1023}
1024
1025
1026void SYMBOL_VIEWER_FRAME::OnLibFilter( wxCommandEvent& aEvent )
1027{
1029
1030 // Required to avoid interaction with SetHint()
1031 // See documentation for wxTextEntry::SetHint
1032 aEvent.Skip();
1033}
1034
1035
1036void SYMBOL_VIEWER_FRAME::OnSymFilter( wxCommandEvent& aEvent )
1037{
1039
1040 // Required to avoid interaction with SetHint()
1041 // See documentation for wxTextEntry::SetHint
1042 aEvent.Skip();
1043}
1044
1045
1046void SYMBOL_VIEWER_FRAME::OnCharHook( wxKeyEvent& aEvent )
1047{
1048 if( aEvent.GetKeyCode() == WXK_UP )
1049 {
1050 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
1051 {
1052 int prev = m_libList->GetSelection() - 1;
1053
1054 if( prev >= 0 )
1055 {
1056 m_libList->SetSelection( prev );
1057 m_libList->EnsureVisible( prev );
1058
1059 wxCommandEvent dummy;
1061 }
1062 }
1063 else
1064 {
1065 wxCommandEvent dummy;
1067 }
1068 }
1069 else if( aEvent.GetKeyCode() == WXK_DOWN )
1070 {
1071 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
1072 {
1073 int next = m_libList->GetSelection() + 1;
1074
1075 if( next < (int)m_libList->GetCount() )
1076 {
1077 m_libList->SetSelection( next );
1078 m_libList->EnsureVisible( next );
1079
1080 wxCommandEvent dummy;
1082 }
1083 }
1084 else
1085 {
1086 wxCommandEvent dummy;
1088 }
1089 }
1090 else if( aEvent.GetKeyCode() == WXK_TAB && m_libFilter->HasFocus() )
1091 {
1092 if( !aEvent.ShiftDown() )
1093 m_symbolFilter->SetFocus();
1094 else
1095 aEvent.Skip();
1096 }
1097 else if( aEvent.GetKeyCode() == WXK_TAB && m_symbolFilter->HasFocus() )
1098 {
1099 if( aEvent.ShiftDown() )
1100 m_libFilter->SetFocus();
1101 else
1102 aEvent.Skip();
1103 }
1104 else if( aEvent.GetKeyCode() == WXK_RETURN && m_symbolList->GetSelection() >= 0 )
1105 {
1106 wxCommandEvent dummy;
1108 }
1109 else
1110 {
1111 aEvent.Skip();
1112 }
1113}
1114
1115
1116void SYMBOL_VIEWER_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
1117{
1118 wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
1119 int ii = m_symbolList->GetSelection();
1120
1121 // Select the next symbol or stop at the end of the list.
1122 if( ii != wxNOT_FOUND || ii != (int) m_symbolList->GetCount() - 1 )
1123 ii += 1;
1124
1125 m_symbolList->SetSelection( ii );
1126 ProcessEvent( evt );
1127}
1128
1129
1131{
1132 wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
1133 int ii = m_symbolList->GetSelection();
1134
1135 // Select the previous symbol or stop at the beginning of list.
1136 if( ii != wxNOT_FOUND && ii != 0 )
1137 ii -= 1;
1138
1139 m_symbolList->SetSelection( ii );
1140 ProcessEvent( evt );
1141}
1142
1143
1144void SYMBOL_VIEWER_FRAME::onSelectSymbolUnit( wxCommandEvent& aEvent )
1145{
1146 int ii = m_unitChoice->GetSelection();
1147
1148 if( ii < 0 )
1149 return;
1150
1151 m_unit = ii + 1;
1152
1154}
1155
1156
1158{
1159 if( m_libList && !m_libList->IsEmpty() && !m_libraryName.IsEmpty() )
1160 {
1161 const SYMBOL_LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRow( m_libraryName, true );
1162
1163 wxString title = row ? row->GetFullURI( true ) : _( "[no library selected]" );
1164
1165 title += wxT( " \u2014 " ) + _( "Symbol Library Browser" );
1166 SetTitle( title );
1167 }
1168}
1169
1170
1172{
1173 return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1174}
const char * name
Definition: DXF_plotter.cpp:56
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
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:105
@ library_browser
BOX2< VECTOR2I > BOX2I
Definition: box2.h:847
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
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:101
bool m_Center
Center on screen.
Definition: base_screen.h:96
void SetOrigin(const Vec &pos)
Definition: box2.h:202
void SetSize(const Vec &size)
Definition: box2.h:213
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
Dialog class to select a symbol from the libraries.
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
To be called after this dialog returns from ShowModal().
static std::mutex g_Mutex
int ShowQuasiModal()
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.
wxString m_configName
wxAuiManager m_auimgr
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
wxString m_aboutTitle
bool Find(const wxString &aTerm, int &aMatchersTriggered, int &aPosition)
The base class for create windows for drawing purpose.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
COLOR_SETTINGS * m_colorSettings
void setupUnits(APP_SETTINGS_BASE *aCfg)
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
EDA_MSG_PANEL * m_messagePanel
virtual void SetScreen(BASE_SCREEN *aScreen)
ACTION_TOOLBAR * m_mainToolBar
void OnGridSettings(wxCommandEvent &event)
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
Update the board display after modifying it by a python script (note: it is automatically called by a...
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:87
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:138
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:137
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:179
static TOOL_ACTION showPinNumbers
Definition: ee_actions.h:228
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:152
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:227
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
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.
void SetDefaultPenWidth(int aWidth)
Store schematic specific render settings.
Definition: sch_painter.h:71
void LoadColors(const COLOR_SETTINGS *aSettings) override
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:316
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:346
void SetBoundary(const BOX2D &aBoundary)
Set limits for view area.
Definition: view.h:279
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
bool IsDismissed()
void SetModal(bool aIsModal)
Definition: kiway_player.h:174
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
bool IsModal() const override
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
Definition: kiway_player.h:173
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:192
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:50
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:165
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
Define a library symbol object.
Definition: lib_symbol.h:98
wxString GetKeyWords() const
Definition: lib_symbol.h:159
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:403
bool IsAlias() const
Definition: lib_symbol.h:183
LIB_ID GetLibId() const override
Definition: lib_symbol.h:139
wxString GetName() const override
Definition: lib_symbol.h:136
LIB_SYMBOL_SPTR SharedPtr() const
Definition: lib_symbol.h:108
wxString GetDescription() override
Definition: lib_symbol.h:146
int GetUnitCount() const override
For items with units, return the number of units.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
LIB_SYMBOL_REF & GetParent()
Definition: lib_symbol.h:125
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...
Manage LIB_TABLE_ROW records (rows), and can be searched based on library nickname.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
void SetPreselectNode(const LIB_ID &aLibId, int aUnit)
Set the symbol name to be selected if there are no search results.
static const wxString GetPinningSymbol()
int GetItemCount() const
Return the number of symbols loaded in the tree.
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:65
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:148
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
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 SyncView()
Mark all items for refresh.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Handle actions for the various symbol editor and viewers.
Helper object to filter a list of libraries.
const wxArrayString & GetAllowedLibList() const
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
bool AddLibraries(const std::vector< wxString > &aNicknames, SCH_BASE_FRAME *aFrame)
Add all the libraries in a SYMBOL_LIB_TABLE to the model.
Symbol library viewer main window.
void ReCreateMenuBar() override
Recreates the menu bar.
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
void OnLibFilter(wxCommandEvent &aEvent)
void CloseLibraryViewer(wxCommandEvent &event)
void onSelectNextSymbol(wxCommandEvent &aEvent)
wxSearchCtrl * m_libFilter
void ClickOnLibList(wxCommandEvent &event)
void onUpdateUnitChoice(wxUpdateUIEvent &aEvent)
void DClickOnSymbolList(wxCommandEvent &event)
bool ShowModal(wxString *aSymbol, wxWindow *aParent) override
Runs the symbol viewer as a modal dialog.
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 FinishModal()
Send the selected symbol back to the caller.
void SetSelectedSymbol(const wxString &aSymbolName)
Set the selected symbol.
void SetFilter(const SYMBOL_LIBRARY_FILTER *aFilter)
Set a filter to display only libraries and/or symbols which match the filter.
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 OnSelectSymbol(wxCommandEvent &aEvent)
void ReCreateVToolbar() override
static wxString m_libraryName
wxSearchCtrl * m_symbolFilter
void ReCreateHToolbar() override
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 wxString m_entryName
void SetSelectedLibrary(const wxString &aLibName)
Set the selected library in the library window.
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.
SYMBOL_VIEWER_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aLibraryName=wxEmptyString)
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:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTIONS * m_actions
Definition: tools_holder.h:171
Master controller class:
Definition: tool_manager.h:55
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
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:196
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 GetBaseString(int n) const
Definition: wx_listbox.cpp:61
int FindString(const wxString &s, bool bCase=false) const override
Definition: wx_listbox.cpp:72
wxString GetStringSelection() const override
Definition: wx_listbox.cpp:32
bool SetStringSelection(const wxString &s) override
Definition: wx_listbox.cpp:43
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
This file is part of the common library.
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _(s)
Abstract pattern-matching tool and implementations.
@ CTX_LIBITEM
@ ID_LIBVIEW_SELECT_UNIT_NUMBER
Definition: eeschema_id.h:72
@ ID_LIBVIEW_SYM_LIST
Definition: eeschema_id.h:76
@ ID_LIBVIEW_NEXT
Definition: eeschema_id.h:70
@ ID_LIBVIEW_SELECT_PART
Definition: eeschema_id.h:69
@ ID_LIBVIEW_LIB_FILTER
Definition: eeschema_id.h:73
@ ID_LIBVIEW_LIB_LIST
Definition: eeschema_id.h:74
@ ID_LIBVIEW_SYM_FILTER
Definition: eeschema_id.h:75
@ ID_LIBVIEW_PREVIOUS
Definition: eeschema_id.h:71
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_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ FRAME_SCH_VIEWER_MODAL
Definition: frame_type.h:37
@ ID_GRID_SETTINGS
Definition: id.h:146
@ LAYER_SCHEMATIC_GRID_AXES
Definition: layer_ids.h:375
Message panel definition file.
bool IsValid(const std::string &aString, SIM_VALUE::TYPE aValueType=SIM_VALUE::TYPE_FLOAT, NOTATION aNotation=NOTATION::SI)
Definition: sim_value.cpp:127
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
see class PGM_BASE
void process(const BOARD_CONNECTED_ITEM *item, int net)
CITER next(CITER it)
Definition: ptree.cpp:126
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
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:55
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:78
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:83
#define LIB_VIEW_STYLE
#define LIB_VIEW_STYLE_MODAL
#define CHECK(x)
#define ENABLE(x)
#define LIB_VIEW_NAME_MODAL
#define LIB_VIEW_NAME
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618