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