KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_edit_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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2004-2024 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>
27#include <wx/hyperlink.h>
28#include <base_screen.h>
29#include <symbol_library.h>
30#include <confirm.h>
31#include <core/kicad_algo.h>
32#include <eeschema_id.h>
33#include <eeschema_settings.h>
34#include <env_paths.h>
36#include <kidialog.h>
37#include <kiface_base.h>
38#include <kiplatform/app.h>
39#include <kiway_express.h>
40#include <symbol_edit_frame.h>
43#include <paths.h>
44#include <pgm_base.h>
45#include <project_sch.h>
46#include <sch_painter.h>
47#include <sch_view.h>
49#include <symbol_lib_table.h>
50#include <tool/action_manager.h>
51#include <tool/action_toolbar.h>
52#include <tool/common_control.h>
53#include <tool/common_tools.h>
55#include <tool/embed_tool.h>
57#include <tool/picker_tool.h>
59#include <tool/selection.h>
61#include <tool/tool_manager.h>
62#include <tool/zoom_tool.h>
63#include <tools/ee_actions.h>
73#include <view/view_controls.h>
75#include <widgets/wx_infobar.h>
82#include <panel_sym_lib_table.h>
83#include <string_utils.h>
84#include <wx/msgdlg.h>
85#include <wx/log.h>
86
87
89
90
91BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, SCH_BASE_FRAME )
93
94 // menubar commands
95 EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad )
96 EVT_MENU( wxID_CLOSE, SYMBOL_EDIT_FRAME::CloseWindow )
97
98 // Update user interface elements.
100
101 // Drop files event
102 EVT_DROP_FILES( SYMBOL_EDIT_FRAME::OnDropFiles )
103
104END_EVENT_TABLE()
105
106
107SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
108 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_SYMBOL_EDITOR, _( "Library Editor" ),
109 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
111 m_unitSelectBox( nullptr ),
112 m_isSymbolFromSchematic( false )
113{
114 SetShowDeMorgan( false );
115 m_SyncPinEdit = false;
116
117 m_symbol = nullptr;
118 m_treePane = nullptr;
119 m_libMgr = nullptr;
120 m_unit = 1;
121 m_bodyStyle = 1;
122 m_aboutTitle = _HKI( "KiCad Symbol Editor" );
123
124 wxIcon icon;
125 wxIconBundle icon_bundle;
126
127 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 48 ) );
128 icon_bundle.AddIcon( icon );
129 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 256 ) );
130 icon_bundle.AddIcon( icon );
131 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 128 ) );
132 icon_bundle.AddIcon( icon );
133 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit_32 ) );
134 icon_bundle.AddIcon( icon );
135 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit_16 ) );
136 icon_bundle.AddIcon( icon );
137
138 SetIcons( icon_bundle );
139
140 m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
141 LoadSettings( m_settings );
142
143 m_libMgr = new LIB_SYMBOL_LIBRARY_MANAGER( *this );
144 bool loadingCancelled = false;
145
146 {
147 // Preload libraries before using SyncLibraries the first time, as the preload is
148 // multi-threaded
149 WX_PROGRESS_REPORTER reporter( this, _( "Loading Symbol Libraries" ),
150 m_libMgr->GetLibraryCount(), true );
151 m_libMgr->Preload( reporter );
152
153 loadingCancelled = reporter.IsCancelled();
154 wxSafeYield();
155 }
156
157 SyncLibraries( false, loadingCancelled );
158 m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
159 m_treePane->GetLibTree()->SetSortMode( (LIB_TREE_MODEL_ADAPTER::SORT_MODE) m_settings->m_LibrarySortMode );
160
161 resolveCanvasType();
162 SwitchCanvas( m_canvasType );
163
164 // Ensure axis are always drawn
165 KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
166 gal_opts.m_axesEnabled = true;
167
168 m_dummyScreen = new SCH_SCREEN();
169 SetScreen( m_dummyScreen );
170 GetScreen()->m_Center = true;
171
172 GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
173
174 GetRenderSettings()->LoadColors( GetColorSettings() );
175 GetRenderSettings()->m_IsSymbolEditor = true;
176 GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
177
178 setupTools();
179 setupUIConditions();
180
181 ReCreateMenuBar();
182 ReCreateHToolbar();
183 ReCreateVToolbar();
184 ReCreateOptToolbar();
185
186 UpdateTitle();
187 UpdateSymbolMsgPanelInfo();
188 RebuildSymbolUnitsList();
189
190 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
191 m_propertiesPanel->SetSplitterProportion( m_settings->m_AuiPanels.properties_splitter );
192
193 m_selectionFilterPanel = new PANEL_SCH_SELECTION_FILTER( this );
194
195 m_auimgr.SetManagedWindow( this );
196
197 CreateInfoBar();
198
199 // Rows; layers 4 - 6
200 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
201 .Top().Layer( 6 ) );
202
203 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
204 .Bottom().Layer( 6 ) );
205
206 // Columns; layers 1 - 3
207 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "LibraryTree" )
208 .Left().Layer( 3 )
209 .TopDockable( false ).BottomDockable( false )
210 .Caption( _( "Libraries" ) )
211 .MinSize( FromDIP( 250 ), -1 ).BestSize( FromDIP( 250 ), -1 ) );
212
213 m_auimgr.AddPane( m_propertiesPanel, defaultPropertiesPaneInfo( this ) );
214 // Show or hide m_propertiesPanel depending on current settings:
215 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
216
217 m_auimgr.AddPane( m_selectionFilterPanel, defaultSchSelectionFilterPaneInfo( this ) );
218
219 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
220 // The selection filter doesn't need to grow in the vertical direction when docked
221 selectionFilterPane.dock_proportion = 0;
222
223 propertiesPaneInfo.Show( m_settings->m_AuiPanels.show_properties );
224 updateSelectionFilterVisbility();
225
226 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
227 .Left().Layer( 2 ) );
228
229 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
230 .Right().Layer( 2 ) );
231
232 // Center
233 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
234 .CentrePane() );
235
236 FinishAUIInitialization();
237
238 // Can't put this in LoadSettings, because it has to be called before setupTools :/
239 EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
240 selTool->GetFilter() = GetSettings()->m_SelectionFilter;
241
242 if( m_settings->m_LibWidth > 0 )
243 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "LibraryTree" ), m_settings->m_LibWidth, -1 );
244
245 Raise();
246 Show( true );
247
248 SyncView();
249 GetCanvas()->GetView()->UseDrawPriority( true );
250 GetCanvas()->GetGAL()->SetAxesEnabled( true );
251
252 setupUnits( m_settings );
253
254 // Set the working/draw area size to display a symbol to a reasonable value:
255 // A 600mm x 600mm with a origin at the area center looks like a large working area
256 double max_size_x = schIUScale.mmToIU( 600 );
257 double max_size_y = schIUScale.mmToIU( 600 );
258 BOX2D bbox;
259 bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
260 bbox.SetSize( max_size_x, max_size_y );
261 GetCanvas()->GetView()->SetBoundary( bbox );
262
263 m_toolManager->RunAction( ACTIONS::zoomFitScreen );
264
266 DragAcceptFiles( true );
267
268 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Library changes are unsaved" ) );
269
270 // Catch unhandled accelerator command characters that were no handled by the library tree
271 // panel.
272 Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
273 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
274
275 // Ensure the window is on top
276 Raise();
277
278 if( loadingCancelled )
279 ShowInfoBarWarning( _( "Symbol library loading was cancelled by user." ) );
280}
281
282
284{
285 // Shutdown all running tools
286 if( m_toolManager )
288
289 setSymWatcher( nullptr );
290
292 {
293 delete m_symbol;
294 m_symbol = nullptr;
295
296 SCH_SCREEN* screen = GetScreen();
297 delete screen;
299 }
300
301 // current screen is destroyed in EDA_DRAW_FRAME
303
305 SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
306
307 if( cfg )
308 mgr.Save( cfg );
309
310 delete m_libMgr;
311}
312
313
315{
316 wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_boardAdapter" );
317
319
324 GetRenderSettings()->SetDefaultFont( wxEmptyString );
325}
326
327
329{
330 wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_boardAdapter" );
331
333
335
340
341 m_settings->m_LibWidth = m_treePane->GetSize().x;
342
344
346 bool prop_shown = m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
348
351}
352
353
355{
356 return static_cast<APP_SETTINGS_BASE*>( GetSettings() );
357}
358
359
361{
363
364 if( GetSettings()->m_UseEeschemaColorSettings )
365 return mgr.GetColorSettings( mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" )->m_ColorTheme );
366 else
367 return mgr.GetColorSettings( GetSettings()->m_ColorTheme );
368}
369
370
372{
373 // Create the manager and dispatcher & route draw panel events to the dispatcher
376 GetCanvas()->GetViewControls(), GetSettings(), this );
377 m_actions = new EE_ACTIONS();
379
380 // Register tools
397
398 // Run the selection tool, it is supposed to be always active
399 m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
400
402}
403
404
406{
408
410 EDITOR_CONDITIONS cond( this );
411
412 wxASSERT( mgr );
413
414#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
415#define CHECK( x ) ACTION_CONDITIONS().Check( x )
416
417 auto haveSymbolCond =
418 [this]( const SELECTION& )
419 {
420 return m_symbol;
421 };
422
423 auto isEditableCond =
424 [this]( const SELECTION& )
425 {
426 // Only root symbols from the new s-expression libraries or the schematic
427 // are editable.
428 return IsSymbolEditable() && !IsSymbolAlias();
429 };
430
431 auto isEditableInAliasCond =
432 [this]( const SELECTION& )
433 {
434 // Less restrictive than isEditableCond
435 // Symbols fields (root symbols and aliases) from the new s-expression libraries
436 // or in the schematic are editable.
437 return IsSymbolEditable();
438 };
439
440 auto symbolModifiedCondition =
441 [this]( const SELECTION& sel )
442 {
445 };
446
447 auto libSelectedCondition =
448 [this]( const SELECTION& sel )
449 {
450 return !GetTargetLibId().GetLibNickname().empty();
451 };
452
453 auto canEditProperties =
454 [this]( const SELECTION& sel )
455 {
457 };
458
459 auto saveSymbolAsCondition =
460 [this]( const SELECTION& aSel )
461 {
462 return getTargetSymbol() != nullptr;
463 };
464
465 const auto isSymbolFromSchematicCond =
466 [this]( const SELECTION& )
467 {
468 return IsSymbolFromSchematic();
469 };
470
471 // clang-format off
474 mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
475 mgr->SetConditions( EE_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) );
476 mgr->SetConditions( EE_ACTIONS::saveSymbolCopyAs, ENABLE( saveSymbolAsCondition ) );
479 mgr->SetConditions( EE_ACTIONS::editLibSymbolWithLibEdit, ENABLE( isSymbolFromSchematicCond ) );
480
481 mgr->SetConditions( ACTIONS::undo, ENABLE( haveSymbolCond && cond.UndoAvailable() ) );
482 mgr->SetConditions( ACTIONS::redo, ENABLE( haveSymbolCond && cond.RedoAvailable() ) );
483 mgr->SetConditions( ACTIONS::revert, ENABLE( symbolModifiedCondition ) );
484
488 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
489 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
490 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
491
492 mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );
493 mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) );
494 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( haveSymbolCond ) );
495 mgr->SetConditions( ACTIONS::paste, ENABLE( isEditableCond &&
497 mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
498 mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
499 mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
500 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( haveSymbolCond ) );
501
502 // These actions in symbol editor when editing alias field rotations are allowed.
503 mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( isEditableInAliasCond ) );
504 mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( isEditableInAliasCond ) );
505
506 mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( isEditableCond ) );
507 mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( isEditableCond ) );
508
511 // clang-format on
512
513 auto pinTypeCond =
514 [this]( const SELECTION& )
515 {
517 };
518
519 auto hiddenPinCond =
520 [this]( const SELECTION& )
521 {
523 };
524
525 auto hiddenFieldCond =
526 [this]( const SELECTION& )
527 {
529 };
530
531 auto showPinAltIconsCond =
532 [this]( const SELECTION& )
533 {
535 };
536
537 auto showLibraryTreeCond =
538 [this]( const SELECTION& )
539 {
540 return IsLibraryTreeShown();
541 };
542
543 auto propertiesCond =
544 [this] ( const SELECTION& )
545 {
546 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
547 };
548
551 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( showLibraryTreeCond ) );
552 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
553 mgr->SetConditions( EE_ACTIONS::showHiddenPins, CHECK( hiddenPinCond ) );
554 mgr->SetConditions( EE_ACTIONS::showHiddenFields, CHECK( hiddenFieldCond ) );
555 mgr->SetConditions( EE_ACTIONS::togglePinAltIcons, CHECK( showPinAltIconsCond ) );
556
557 auto demorganCond =
558 [this]( const SELECTION& )
559 {
560 return GetShowDeMorgan();
561 };
562
563 auto demorganStandardCond =
564 [this]( const SELECTION& )
565 {
566 return m_bodyStyle == BODY_STYLE::BASE;
567 };
568
569 auto demorganAlternateCond =
570 [this]( const SELECTION& )
571 {
572 return m_bodyStyle == BODY_STYLE::DEMORGAN;
573 };
574
575 auto multiUnitModeCond =
576 [this]( const SELECTION& )
577 {
578 return m_symbol && m_symbol->IsMulti() && !m_symbol->UnitsLocked();
579 };
580
581 auto hasMultipleUnitsCond =
582 [this]( const SELECTION& )
583 {
584 return m_symbol && m_symbol->IsMulti();
585 };
586
587 auto syncedPinsModeCond =
588 [this]( const SELECTION& )
589 {
590 return m_SyncPinEdit;
591 };
592
593 auto haveDatasheetCond =
594 [this]( const SELECTION& )
595 {
596 return m_symbol && !m_symbol->GetDatasheetField().GetText().IsEmpty();
597 };
598
599 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
600 mgr->SetConditions( EE_ACTIONS::symbolProperties, ENABLE( canEditProperties && haveSymbolCond ) );
601 mgr->SetConditions( EE_ACTIONS::runERC, ENABLE( haveSymbolCond ) );
602 mgr->SetConditions( EE_ACTIONS::pinTable, ENABLE( isEditableCond && haveSymbolCond ) );
603
605 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
607 ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
609 ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
611 ACTION_CONDITIONS().Enable( isEditableCond && hasMultipleUnitsCond ) );
612
613// Only enable a tool if the symbol is edtable
614#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
615
628
629#undef CHECK
630#undef ENABLE
631#undef EDIT_TOOL
632}
633
634
636{
637 if( IsContentModified() )
638 {
639 SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
640 wxString msg = _( "Save changes to '%s' before closing?" );
641
642 switch( UnsavedChangesDialog( this, wxString::Format( msg, m_reference ), nullptr ) )
643 {
644 case wxID_YES:
645 if( schframe && GetCurSymbol() ) // Should be always the case
647
648 break;
649
650 case wxID_NO:
651 break;
652
653 default:
654 case wxID_CANCEL:
655 return false;
656 }
657 }
658
659 if( doClose )
660 {
661 SetCurSymbol( nullptr, false );
662 UpdateTitle();
663 }
664
665 return true;
666}
667
668
669bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
670{
671 // Shutdown blocks must be determined and vetoed as early as possible
673 && aEvent.GetId() == wxEVT_QUERY_END_SESSION
674 && IsContentModified() )
675 {
676 return false;
677 }
678
680 return false;
681
682 if( !saveAllLibraries( true ) )
683 return false;
684
685 // Save symbol tree column widths
686 m_libMgr->GetAdapter()->SaveSettings();
687
688 return true;
689}
690
691
693{
694 Destroy();
695}
696
697
699{
700 if( !m_unitSelectBox )
701 return;
702
703 if( m_unitSelectBox->GetCount() != 0 )
704 m_unitSelectBox->Clear();
705
706 if( !m_symbol || m_symbol->GetUnitCount() <= 1 )
707 {
708 m_unit = 1;
709 m_unitSelectBox->Append( wxEmptyString );
710 }
711 else
712 {
713 for( int i = 0; i < m_symbol->GetUnitCount(); i++ )
714 {
715 wxString unitDisplayName = m_symbol->GetUnitDisplayName( i + 1 );
716 m_unitSelectBox->Append( unitDisplayName );
717 }
718 }
719
720 // Ensure the selected unit is compatible with the number of units of the current symbol:
722 m_unit = 1;
723
724 m_unitSelectBox->SetSelection(( m_unit > 0 ) ? m_unit - 1 : 0 );
725}
726
727
729{
730 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
731 treePane.Show( !IsLibraryTreeShown() );
733 m_auimgr.Update();
734 Refresh();
735}
736
737
739{
740 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
741}
742
743
745{
747}
748
749
751{
752 m_treePane->Freeze();
753 m_libMgr->GetAdapter()->Freeze();
754}
755
756
758{
759 m_libMgr->GetAdapter()->Thaw();
760 m_treePane->Thaw();
761}
762
763
764void SYMBOL_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
765{
766 Kiway().OnKiCadExit();
767}
768
769
770void SYMBOL_EDIT_FRAME::OnUpdateUnitNumber( wxUpdateUIEvent& event )
771{
772 event.Enable( m_symbol && m_symbol->GetUnitCount() > 1 );
773}
774
775
776void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
777{
778 int i = event.GetSelection();
779
780 if( i == wxNOT_FOUND )
781 return;
782
783 SetUnit( i + 1 );
784}
785
786
788{
789 if( m_symbol )
790 {
792
793 if( row && row->GetType() == SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) )
794 return true;
795 }
796
797 return false;
798}
799
800
802{
803 wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
804
805 if( !libNickname.empty() )
806 {
807 if( !PROJECT_SCH::SchSymbolLibTable( &Prj() )->HasLibrary( libNickname ) )
808 {
809 Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
810 libNickname = wxEmptyString;
811 }
812 }
813
814 return libNickname;
815}
816
817
818wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
819{
820 wxString old = GetCurLib();
821
822 if( aLibNickname.empty() || !PROJECT_SCH::SchSymbolLibTable( &Prj() )->HasLibrary( aLibNickname ) )
823 Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
824 else
826
827 return old;
828}
829
830
831void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
832{
833 wxCHECK( m_toolManager, /* void */ );
834
836 GetCanvas()->GetView()->Clear();
837 delete m_symbol;
838
839 m_symbol = aSymbol;
840
841 // select the current symbol in the tree widget
844 else
845 GetLibTree()->Unselect();
846
847 wxString symbolName;
848 wxString libName;
849
850 if( m_symbol )
851 {
852 symbolName = m_symbol->GetName();
854 }
855
856 // retain in case this wxFrame is re-opened later on the same PROJECT
858
859 // Ensure synchronized pin edit can be enabled only symbols with interchangeable units
860 m_SyncPinEdit = aSymbol && aSymbol->IsRoot() && aSymbol->IsMulti() && !aSymbol->UnitsLocked();
861
863
871
872 if( aUpdateZoom )
874
875 GetCanvas()->Refresh();
876
877 WX_INFOBAR& infobar = *GetInfoBar();
878 infobar.RemoveAllButtons();
879
880 wxArrayString msgs;
881 int infobarFlags = wxICON_INFORMATION;
882
884 {
885 msgs.push_back( wxString::Format( _( "Editing symbol %s from schematic. Saving will "
886 "update the schematic only." ),
887 m_reference ) );
888
889 wxString link = wxString::Format( _( "Open symbol from library %s" ), libName );
890 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
891
892 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
893 [this, symbolName, libName]( wxHyperlinkEvent& aEvent )
894 {
896 } ) );
897
898 infobar.AddButton( button );
899 }
900 else if( IsSymbolFromLegacyLibrary() )
901 {
902 msgs.push_back( _( "Symbols in legacy libraries are not editable. Use Manage Symbol "
903 "Libraries to migrate to current format." ) );
904
905 wxString link = _( "Manage symbol libraries" );
906 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
907
908 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
909 [this]( wxHyperlinkEvent& aEvent )
910 {
912 } ) );
913
914 infobar.AddButton( button );
915 }
916 else if( IsSymbolAlias() )
917 {
918 msgs.push_back( wxString::Format( _( "Symbol %s is a derived symbol. Symbol graphics will "
919 "not be editable." ),
920 UnescapeString( symbolName ) ) );
921
922 // Don't assume the parent symbol shared pointer is still valid.
923 if( std::shared_ptr<LIB_SYMBOL> rootSymbol = m_symbol->GetRootSymbol() )
924 {
925 int unit = GetUnit();
926 int bodyStyle = GetBodyStyle();
927 wxString rootSymbolName = rootSymbol->GetName();
928 wxString link = wxString::Format( _( "Open %s" ), UnescapeString( rootSymbolName ) );
929
930 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link,
931 wxEmptyString );
932
933 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
934 [this, rootSymbolName, unit, bodyStyle]( wxHyperlinkEvent& aEvent )
935 {
936 LoadSymbolFromCurrentLib( rootSymbolName, unit, bodyStyle );
937 } ) );
938
939 infobar.AddButton( button );
940 }
941 }
942
943 if( m_symbol
946 {
947 msgs.push_back( _( "Library is read-only. Changes cannot be saved to this library." ) );
948
949 wxString link = wxString::Format( _( "Create an editable copy" ) );
950 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
951
952 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
953 [this, symbolName, libName]( wxHyperlinkEvent& aEvent )
954 {
955 wxString msg = wxString::Format( _( "Create an editable copy of the symbol or "
956 "the entire library (%s)?" ),
957 libName );
958
959 KIDIALOG errorDlg( this, msg, _( "Select type of item to save" ),
960 wxYES_NO | wxCANCEL | wxICON_QUESTION );
961 // These buttons are in a weird order(?)
962 errorDlg.SetYesNoCancelLabels( _( "Copy symbol" ), _( "Cancel" ),
963 _( "Copy library" ) );
964
965 int choice = errorDlg.ShowModal();
966
967 switch( choice )
968 {
969 case wxID_YES:
970 SaveSymbolCopyAs( true );
971 break;
972 case wxID_CANCEL:
974 break;
975 default:
976 // Do nothing
977 break;
978 }
979 } ) );
980
981 infobar.AddButton( button );
982 }
983
984 if( msgs.empty() )
985 {
986 infobar.Dismiss();
987 }
988 else
989 {
990 wxString msg = wxJoin( msgs, '\n', '\0' );
991 infobar.ShowMessage( msg, infobarFlags );
992 }
993}
994
995
997{
998 wxASSERT( m_libMgr );
999 return *m_libMgr;
1000}
1001
1002
1004{
1006
1008 m_autoSaveRequired = true;
1009
1010 if( !IsSymbolFromSchematic() )
1012
1014
1015 if( !GetTitle().StartsWith( "*" ) )
1016 UpdateTitle();
1017}
1018
1019
1021{
1022 wxCHECK( aUnit > 0 && aUnit <= GetCurSymbol()->GetUnitCount(), /* void*/ );
1023
1024 if( m_unit == aUnit )
1025 return;
1026
1029
1030 m_unit = aUnit;
1031
1032 if( m_unitSelectBox->GetSelection() != ( m_unit - 1 ) )
1033 m_unitSelectBox->SetSelection( m_unit - 1 );
1034
1036 RebuildView();
1038}
1039
1040
1042{
1044}
1045
1046
1047wxString SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
1048{
1049 // Select the target library table (global/project)
1050 SYMBOL_LIB_TABLE* libTable = SelectSymLibTable();
1051
1052 if( !libTable )
1053 return wxEmptyString;
1054
1055 wxFileName fn = m_libMgr->GetUniqueLibraryName();
1056
1059 ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ),
1061 {
1062 return wxEmptyString;
1063 }
1064
1065 wxString libName = fn.GetName();
1066
1067 if( libName.IsEmpty() )
1068 return wxEmptyString;
1069
1070 if( m_libMgr->LibraryExists( libName ) )
1071 {
1072 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libName ) );
1073 return wxEmptyString;
1074 }
1075
1076 if( aCreateNew )
1077 {
1078 if( !m_libMgr->CreateLibrary( fn.GetFullPath(), *libTable ) )
1079 {
1080 DisplayError( this, wxString::Format( _( "Could not create the library file '%s'.\n"
1081 "Make sure you have write permissions and "
1082 "try again." ),
1083 fn.GetFullPath() ) );
1084 return wxEmptyString;
1085 }
1086 }
1087 else
1088 {
1089 if( !m_libMgr->AddLibrary( fn.GetFullPath(), *libTable ) )
1090 {
1091 DisplayError( this, _( "Could not open the library file." ) );
1092 return wxEmptyString;
1093 }
1094 }
1095
1096 bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
1097 saveSymbolLibTables( globalTable, !globalTable );
1098
1099 std::string packet = fn.GetFullPath().ToStdString();
1101
1102 return fn.GetFullPath();
1103}
1104
1105
1106void SYMBOL_EDIT_FRAME::DdAddLibrary( wxString aLibFile )
1107{
1108 // Select the target library table (global/project)
1109 SYMBOL_LIB_TABLE* libTable = SelectSymLibTable();
1110
1111 if( !libTable )
1112 return;
1113
1114 wxFileName fn = wxFileName( aLibFile );
1115
1116 wxString libName = fn.GetName();
1117
1118 if( libName.IsEmpty() )
1119 return;
1120
1121 if( m_libMgr->LibraryExists( libName ) )
1122 {
1123 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libName ) );
1124 return;
1125 }
1126
1127 if( !m_libMgr->AddLibrary( fn.GetFullPath(), *libTable ) )
1128 {
1129 DisplayError( this, _( "Could not open the library file." ) );
1130 return;
1131 }
1132
1133 bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
1134 saveSymbolLibTables( globalTable, !globalTable );
1135
1136 std::string packet = fn.GetFullPath().ToStdString();
1138}
1139
1140
1142{
1143 return GetLibTree()->GetSelectedLibId( aUnit );
1144}
1145
1146
1148{
1149 return GetLibTree()->GetSelectionCount();
1150}
1151
1152int SYMBOL_EDIT_FRAME::GetTreeLIBIDs( std::vector<LIB_ID>& aSelection ) const
1153{
1154 return GetLibTree()->GetSelectedLibIds( aSelection );
1155}
1156
1157
1159{
1160 if( IsLibraryTreeShown() )
1161 {
1162 LIB_ID libId = GetTreeLIBID();
1163
1164 if( libId.IsValid() )
1165 return m_libMgr->GetAlias( libId.GetLibItemName(), libId.GetLibNickname() );
1166 }
1167
1168 return m_symbol;
1169}
1170
1171
1173{
1174 LIB_ID id;
1175
1176 if( IsLibraryTreeShown() )
1177 id = GetTreeLIBID();
1178
1179 if( id.GetLibNickname().empty() && m_symbol )
1180 id = m_symbol->GetLibId();
1181
1182 return id;
1183}
1184
1185
1186std::vector<LIB_ID> SYMBOL_EDIT_FRAME::GetSelectedLibIds() const
1187{
1188 std::vector<LIB_ID> ids;
1189 GetTreeLIBIDs( ids );
1190 return ids;
1191}
1192
1193
1195{
1196 return GetTargetLibId().GetLibNickname();
1197}
1198
1199
1200void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress, bool aPreloadCancelled,
1201 const wxString& aForceRefresh )
1202{
1203 LIB_ID selected;
1204
1205 if( m_treePane )
1206 selected = GetLibTree()->GetSelectedLibId();
1207
1208 if( aShowProgress )
1209 {
1210 APP_PROGRESS_DIALOG progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
1211 m_libMgr->GetAdapter()->GetLibrariesCount(), this );
1212
1213 m_libMgr->Sync( aForceRefresh,
1214 [&]( int progress, int max, const wxString& libName )
1215 {
1216 progressDlg.Update( progress, wxString::Format( _( "Loading library '%s'..." ),
1217 libName ) );
1218 } );
1219 }
1220 else if( !aPreloadCancelled )
1221 {
1222 m_libMgr->Sync( aForceRefresh,
1223 [&]( int progress, int max, const wxString& libName )
1224 {
1225 } );
1226 }
1227
1228 if( m_treePane )
1229 {
1230 wxDataViewItem found;
1231
1232 if( selected.IsValid() )
1233 {
1234 // Check if the previously selected item is still valid,
1235 // if not - it has to be unselected to prevent crash
1236 found = m_libMgr->GetAdapter()->FindItem( selected );
1237
1238 if( !found )
1239 GetLibTree()->Unselect();
1240 }
1241
1242 GetLibTree()->Regenerate( true );
1243
1244 // Try to select the parent library, in case the symbol is not found
1245 if( !found && selected.IsValid() )
1246 {
1247 selected.SetLibItemName( "" );
1248 found = m_libMgr->GetAdapter()->FindItem( selected );
1249
1250 if( found )
1251 GetLibTree()->SelectLibId( selected );
1252 }
1253
1254 // If no selection, see if there's a current symbol to centre
1255 if( !selected.IsValid() && m_symbol )
1256 {
1257 LIB_ID current( GetCurLib(), m_symbol->GetName() );
1258 GetLibTree()->CenterLibId( current );
1259 }
1260 }
1261}
1262
1263
1265{
1267}
1268
1269
1271{
1272 GetLibTree()->SelectLibId( aLibID );
1273}
1274
1275
1276void SYMBOL_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem, LIB_SYMBOL* aSymbol )
1277{
1278 if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
1279 // from file therefore not yet in tree.
1280 {
1281 static_cast<LIB_TREE_NODE_ITEM*>( aTreeItem.GetID() )->Update( aSymbol );
1283 }
1284}
1285
1286
1287bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt )
1288{
1289 if( aOriginalFile.FileExists() )
1290 {
1291 wxFileName backupFileName( aOriginalFile );
1292 backupFileName.SetExt( aBackupExt );
1293
1294 if( backupFileName.FileExists() )
1295 wxRemoveFile( backupFileName.GetFullPath() );
1296
1297 if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1298 {
1299 DisplayError( this, wxString::Format( _( "Failed to save backup to '%s'." ),
1300 backupFileName.GetFullPath() ) );
1301 return false;
1302 }
1303 }
1304
1305 return true;
1306}
1307
1308
1310{
1311 if( m_symbol && !GetCurLib().IsEmpty() && GetScreen()->IsContentModified() )
1312 m_libMgr->UpdateSymbol( m_symbol, GetCurLib() ); // UpdateSymbol() makes a copy
1313}
1314
1315
1317{
1318 // This will return the root symbol of any alias
1320 aLibId.GetLibNickname() );
1321
1322 // Now we can compare the libId of the current symbol and the root symbol
1323 return ( symbol && m_symbol && symbol->GetLibId() == m_symbol->GetLibId() );
1324}
1325
1326
1328{
1329 GetLibTree()->Unselect();
1330 SetCurLib( wxEmptyString );
1331 SetCurSymbol( nullptr, false );
1335 Refresh();
1336}
1337
1338
1339void SYMBOL_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1340{
1341 SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1342
1344 SYMBOL_EDITOR_SETTINGS* cfg = mgr->GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
1345
1350
1352
1353 if( m_symbol )
1355
1357
1359 GetCanvas()->Refresh();
1360
1362
1363 if( aEnvVarsChanged )
1364 SyncLibraries( true );
1365
1366 Layout();
1367 SendSizeEvent();
1368}
1369
1370
1372{
1373 // call my base class
1375
1376 // tooltips in toolbars
1378
1379 // For some obscure reason, the AUI manager hides the first modified pane.
1380 // So force show panes
1381 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
1382 bool tree_shown = tree_pane_info.IsShown();
1383 tree_pane_info.Caption( _( "Libraries" ) );
1384 tree_pane_info.Show( tree_shown );
1385 m_auimgr.Update();
1386
1388
1389 // status bar
1391
1392 if( GetRenderSettings()->m_ShowPinsElectricalType )
1393 {
1395 GetCanvas()->Refresh();
1396 }
1397
1398 UpdateTitle();
1399}
1400
1401
1403{
1404 SCH_BASE_FRAME::SetScreen( aScreen );
1405
1406 // Let tools add things to the view if necessary
1407 if( m_toolManager )
1409}
1410
1411
1413{
1421
1422 // Let tools add things to the view if necessary
1423 if( m_toolManager )
1425
1427 GetCanvas()->Refresh();
1428}
1429
1430
1432{
1433 SyncLibraries( true );
1434
1435 if( m_symbol )
1436 {
1438 EE_SELECTION& selection = selectionTool->GetSelection();
1439
1440 for( SCH_ITEM& item : m_symbol->GetDrawItems() )
1441 {
1442 if( !alg::contains( selection, &item ) )
1443 item.ClearSelected();
1444 else
1445 item.SetSelected();
1446 }
1447
1449 }
1450
1451 RebuildView();
1452}
1453
1454
1455const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1456{
1457 if( !m_symbol )
1458 {
1459 // Gives a reasonable drawing area size
1460 int width = schIUScale.mmToIU( 50 );
1461 int height = schIUScale.mmToIU( 30 );
1462
1463 return BOX2I( VECTOR2I( -width/2, -height/2 ), VECTOR2I( width, height ) );
1464 }
1465 else
1466 {
1467 return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_bodyStyle );
1468 }
1469}
1470
1471
1473{
1474 static KIID lastBrightenedItemID( niluuid );
1475
1476 SCH_ITEM* lastItem = nullptr;
1477
1478 if( m_symbol )
1479 {
1480 for( SCH_PIN* pin : m_symbol->GetPins() )
1481 {
1482 if( pin->m_Uuid == lastBrightenedItemID )
1483 lastItem = pin;
1484 }
1485
1486 std::vector<SCH_FIELD*> fields;
1487 m_symbol->GetFields( fields );
1488
1489 for( SCH_FIELD* field : fields )
1490 {
1491 if( field->m_Uuid == lastBrightenedItemID )
1492 lastItem = field;
1493 }
1494 }
1495
1496 if( lastItem && lastItem != aItem )
1497 {
1498 lastItem->ClearBrightened();
1499
1500 UpdateItem( lastItem );
1501 lastBrightenedItemID = niluuid;
1502 }
1503
1504 if( aItem )
1505 {
1506 if( !aItem->IsBrightened() )
1507 {
1508 aItem->SetBrightened();
1509
1510 UpdateItem( aItem );
1511 lastBrightenedItemID = aItem->m_Uuid;
1512 }
1513
1514 FocusOnLocation( VECTOR2I( aItem->GetFocusPosition().x, -aItem->GetFocusPosition().y ) );
1515 }
1516}
1517
1518
1520{
1521 const std::string& payload = mail.GetPayload();
1522
1523 switch( mail.Command() )
1524 {
1525 case MAIL_LIB_EDIT:
1526 if( !payload.empty() )
1527 {
1528 wxString libFileName( payload );
1529 wxString libNickname;
1530 wxString msg;
1531
1533 const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( libFileName );
1534
1535 if( !libTableRow )
1536 {
1537 msg.Printf( _( "The current configuration does not include the symbol library '%s'." ),
1538 libFileName );
1539 msg += wxS( "\n" ) + _( "Use Manage Symbol Libraries to edit the configuration." );
1540 DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
1541 break;
1542 }
1543
1544 libNickname = libTableRow->GetNickName();
1545
1546 if( !libTable->HasLibrary( libNickname, true ) )
1547 {
1548 msg.Printf( _( "The symbol library '%s' is not enabled in the current configuration." ),
1549 UnescapeString( libNickname ) );
1550 msg += wxS( "\n" ) + _( "Use Manage Symbol Libraries to edit the configuration." );
1551 DisplayErrorMessage( this, _( "Symbol library not enabled." ), msg );
1552 break;
1553 }
1554
1555 SetCurLib( libNickname );
1556
1557 if( m_treePane )
1558 {
1559 LIB_ID id( libNickname, wxEmptyString );
1560 GetLibTree()->SelectLibId( id );
1561 GetLibTree()->ExpandLibId( id );
1562 GetLibTree()->CenterLibId( id );
1563 }
1564 }
1565
1566 break;
1567
1568 case MAIL_RELOAD_LIB:
1569 {
1570 wxString currentLib = GetCurLib();
1572
1574
1575 // Check if the currently selected symbol library been removed or disabled.
1576 if( !currentLib.empty() && libTable && !libTable->HasLibrary( currentLib, true ) )
1577 {
1578 SetCurLib( wxEmptyString );
1579 emptyScreen();
1580 }
1581
1582 SyncLibraries( true );
1585
1586 break;
1587 }
1588
1590 {
1592 LIB_SYMBOL* symbol = GetCurSymbol();
1593
1594 wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s",
1595 payload );
1596
1597 if( !tbl || !symbol )
1598 break;
1599
1600 wxString libName = symbol->GetLibId().GetLibNickname();
1601 const SYMBOL_LIB_TABLE_ROW* row = tbl->FindRow( libName );
1602
1603 if( !row )
1604 return;
1605
1606 wxFileName libfullname( row->GetFullURI( true ) );
1607
1608 wxFileName changedLib( mail.GetPayload() );
1609 wxLogTrace( "KICAD_LIB_WATCH",
1610 "Received refresh symbol request for %s, current symbols is %s",
1611 changedLib.GetFullPath(), libfullname.GetFullPath() );
1612
1613 if( changedLib == libfullname )
1614 {
1615 wxLogTrace( "KICAD_LIB_WATCH", "Refreshing symbol %s", symbol->GetName() );
1616
1617 SetScreen( m_dummyScreen ); // UpdateLibraryBuffer will destroy the old screen
1618 m_libMgr->UpdateLibraryBuffer( libName );
1619
1620 LIB_SYMBOL* lib_symbol = m_libMgr->GetBufferedSymbol( symbol->GetName(), libName );
1621 wxCHECK2_MSG( lib_symbol, break, wxString::Format( "Symbol %s not found in library %s",
1622 symbol->GetName(), libName ) );
1623
1624 // The buffered screen for the symbol
1625 SCH_SCREEN* symbol_screen = m_libMgr->GetScreen( lib_symbol->GetName(), libName );
1626
1627 SetScreen( symbol_screen );
1628 SetCurSymbol( new LIB_SYMBOL( *lib_symbol ), false );
1630 SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
1631
1632 if( m_toolManager )
1634 }
1635
1636 break;
1637 }
1638
1639 default:
1640 ;
1641 }
1642}
1643
1644
1645std::unique_ptr<GRID_HELPER> SYMBOL_EDIT_FRAME::MakeGridHelper()
1646{
1647 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1648}
1649
1650
1652{
1653 // switches currently used canvas ( Cairo / OpenGL):
1654 SCH_BASE_FRAME::SwitchCanvas( aCanvasType );
1655
1656 // Set options specific to symbol editor (axies are always enabled):
1657 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1659}
1660
1661
1663{
1664 wxCHECK( m_libMgr, false );
1665
1666 return m_libMgr->HasModifications();
1667}
1668
1669
1671{
1672 wxCHECK( m_libMgr, false );
1673
1674 // Test if the currently edited symbol is modified
1676 return true;
1677
1678 // Test if any library has been modified
1679 for( const wxString& libName : m_libMgr->GetLibraryNames() )
1680 {
1681 if( m_libMgr->IsLibraryModified( libName ) && !m_libMgr->IsLibraryReadOnly( libName ) )
1682 return true;
1683 }
1684
1685 return false;
1686}
1687
1688
1690{
1691 if( aItemCount == 0 )
1692 return;
1693
1694 UNDO_REDO_CONTAINER& list = ( whichList == UNDO_LIST ) ? m_undoList : m_redoList;
1695
1696 if( aItemCount < 0 )
1697 {
1698 list.ClearCommandList();
1699 }
1700 else
1701 {
1702 for( int ii = 0; ii < aItemCount; ii++ )
1703 {
1704 if( list.m_CommandsList.size() == 0 )
1705 break;
1706
1707 PICKED_ITEMS_LIST* curr_cmd = list.m_CommandsList[0];
1708 list.m_CommandsList.erase( list.m_CommandsList.begin() );
1709
1710 curr_cmd->ClearListAndDeleteItems( []( EDA_ITEM* aItem )
1711 {
1712 delete aItem;
1713 } );
1714 delete curr_cmd; // Delete command
1715 }
1716 }
1717}
1718
1719
1721{
1722 return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1723}
1724
1725
1727{
1728 std::unique_ptr<LIB_SYMBOL> symbol = aSymbol->GetLibSymbolRef()->Flatten();
1729 wxCHECK( symbol, /* void */ );
1730
1731 symbol->SetLibId( aSymbol->GetLibId() );
1732
1733 // Take in account the symbol orientation and mirroring. to calculate the field
1734 // positions in symbol editor (i.e. no rotation, no mirroring)
1735 int orientation = aSymbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
1736 int mirror = aSymbol->GetOrientation() & ( SYM_MIRROR_X | SYM_MIRROR_Y );
1737
1738 std::vector<SCH_FIELD> fullSetOfFields;
1739
1740 for( int i = 0; i < (int) aSymbol->GetFields().size(); ++i )
1741 {
1742 const SCH_FIELD& field = aSymbol->GetFields()[i];
1743 VECTOR2I pos = field.GetPosition() - aSymbol->GetPosition();
1744 SCH_FIELD libField( symbol.get(), field.GetId() );
1745
1746 if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() )
1747 libField.SetName( field.GetName( false ) );
1748
1749 libField.SetText( field.GetText() );
1750 libField.SetAttributes( field );
1751
1752 // The inverse transform is mirroring before, rotate after
1753 switch( mirror )
1754 {
1755 case SYM_MIRROR_X: pos.y = -pos.y; break;
1756 case SYM_MIRROR_Y: pos.x = -pos.x; break;
1757 default: break;
1758 }
1759
1760 switch( orientation )
1761 {
1762 case SYM_ORIENT_90:
1763 std::swap( pos.x, pos.y );
1764 pos.x = - pos.x;
1765 break;
1766 case SYM_ORIENT_270:
1767 std::swap( pos.x, pos.y );
1768 pos.y = - pos.y;
1769 break;
1770 case SYM_ORIENT_180:
1771 pos.x = - pos.x;
1772 pos.y = - pos.y;
1773 break;
1774 default:
1775 break;
1776 }
1777
1778 libField.SetPosition( pos );
1779
1780 fullSetOfFields.emplace_back( std::move( libField ) );
1781 }
1782
1783 symbol->SetFields( fullSetOfFields );
1784
1785 if( m_symbol )
1786 SetCurSymbol( nullptr, false );
1787
1789 m_schematicSymbolUUID = aSymbol->m_Uuid;
1790 m_reference = symbol->GetFieldById( REFERENCE_FIELD )->GetText();
1791 m_unit = std::max( 1, aSymbol->GetUnit() );
1792 m_bodyStyle = std::max( 1, aSymbol->GetBodyStyle() );
1793
1794 // Optimize default edit options for this symbol
1795 // Usually if units are locked, graphic items are specific to each unit
1796 // and if units are interchangeable, graphic items are common to units
1798 tools->SetDrawSpecificUnit( symbol->UnitsLocked() );
1799
1800 // The buffered screen for the symbol
1801 SCH_SCREEN* tmpScreen = new SCH_SCREEN();
1802
1803 SetScreen( tmpScreen );
1804 SetCurSymbol( symbol.release(), true );
1805 setSymWatcher( nullptr );
1806
1809
1810 if( IsLibraryTreeShown() )
1812
1813 UpdateTitle();
1815 SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
1817
1818 // Let tools add things to the view if necessary
1819 if( m_toolManager )
1821
1823 GetCanvas()->Refresh();
1824}
1825
1826
1827bool SYMBOL_EDIT_FRAME::addLibTableEntry( const wxString& aLibFile, TABLE_SCOPE aScope )
1828{
1829 wxFileName fn = aLibFile;
1830 wxFileName libTableFileName( Prj().GetProjectPath(),
1832 wxString libNickname = fn.GetName();
1834 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1835
1836 if( libTable->HasLibrary( libNickname ) )
1837 {
1838 wxString tmp;
1839 int suffix = 1;
1840
1841 while( libTable->HasLibrary( libNickname ) )
1842 {
1843 tmp.Printf( "%s%d", fn.GetName(), suffix );
1844 libNickname = tmp;
1845 suffix += 1;
1846 }
1847 }
1848
1850 row->SetNickName( libNickname );
1851
1852 wxString normalizedPath = NormalizePath( aLibFile, &envVars, Prj().GetProjectPath() );
1853
1854 if( aScope == GLOBAL_LIB_TABLE )
1855 {
1857 libTableFileName = SYMBOL_LIB_TABLE::GetGlobalTableFileName();
1858
1859 // We cannot normalize against the current project path when saving to global table.
1860 normalizedPath = NormalizePath( aLibFile, &envVars, wxEmptyString );
1861 }
1862
1863 row->SetFullURI( normalizedPath );
1864
1865 wxCHECK( libTable->InsertRow( row ), false );
1866
1867 try
1868 {
1869 libTable->Save( libTableFileName.GetFullPath() );
1870 }
1871 catch( const IO_ERROR& ioe )
1872 {
1873 wxString msg = aScope == GLOBAL_LIB_TABLE ? _( "Error saving global library table." )
1874 : _( "Error saving project library table." );
1875
1876 wxMessageDialog dlg( this, msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1877 dlg.SetExtendedMessage( ioe.What() );
1878 dlg.ShowModal();
1879
1880 return false;
1881 }
1882
1883 return true;
1884}
1885
1886
1887bool SYMBOL_EDIT_FRAME::replaceLibTableEntry( const wxString& aLibNickname,
1888 const wxString& aLibFile )
1889{
1890 // Check the global library table first because checking the project library table
1891 // checks the global library table as well due to library chaining.
1892 bool isGlobalTable = true;
1893 wxFileName libTableFileName = SYMBOL_LIB_TABLE::GetGlobalTableFileName();;
1894 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1896 SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLibNickname );
1897
1898 if( !row )
1899 {
1900 libTableFileName.SetPath( Prj().GetProjectPath() );
1901 libTableFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
1902 libTable = PROJECT_SCH::SchSymbolLibTable( &Prj() );
1903 isGlobalTable = false;
1904 row = libTable->FindRow( aLibNickname );
1905 }
1906
1907 wxCHECK( row, false );
1908
1909 wxString projectPath;
1910
1911 if( !isGlobalTable )
1912 projectPath = Prj().GetProjectPath();
1913
1914 wxString normalizedPath = NormalizePath( aLibFile, &envVars, projectPath );
1915
1916 row->SetFullURI( normalizedPath );
1917 row->SetType( "KiCad" );
1918
1919 try
1920 {
1921 libTable->Save( libTableFileName.GetFullPath() );
1922 }
1923 catch( const IO_ERROR& ioe )
1924 {
1925 wxString msg = isGlobalTable ? _( "Error saving global library table." )
1926 : _( "Error saving project library table." );
1927
1928 wxMessageDialog dlg( this, msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1929 dlg.SetExtendedMessage( ioe.What() );
1930 dlg.ShowModal();
1931
1932 return false;
1933 }
1934
1935 return true;
1936}
1937
1938
1940{
1941 return m_symbol && !m_symbol->IsRoot();
1942}
1943
1944
1946{
1948}
1949
1950
1951void SYMBOL_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
1952{
1953 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
1954
1955 if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem ) )
1956 {
1957 eda_text->ClearBoundingBoxCache();
1958 eda_text->ClearRenderCache();
1959 }
1960}
1961
1962
1964{
1965 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
1966 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
1967 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
1968
1969 // Don't give the selection filter its own visibility controls; instead show it if
1970 // anything else is visible
1971 bool showFilter = ( treePane.IsShown() && treePane.IsDocked() )
1972 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
1973
1974 selectionFilterPane.Show( showFilter );
1975}
1976
1977
1979{
1980 // Returns the current render option for invisible fields
1982}
1983
1984
1986{
1987 // Returns the current render option for invisible pins
1989}
BASE_SCREEN class implementation.
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
@ icon_libedit_32
@ icon_libedit
@ icon_libedit_16
BOX2< VECTOR2I > BOX2I
Definition: box2.h:922
static TOOL_ACTION toggleGrid
Definition: actions.h:187
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
static TOOL_ACTION millimetersUnits
Definition: actions.h:195
static TOOL_ACTION unselectAll
Definition: actions.h:76
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION showLibraryTree
Definition: actions.h:154
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION showDatasheet
Definition: actions.h:217
static TOOL_ACTION milsUnits
Definition: actions.h:194
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:147
static TOOL_ACTION saveAll
Definition: actions.h:54
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION duplicate
Definition: actions.h:77
static TOOL_ACTION inchesUnits
Definition: actions.h:193
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:144
static TOOL_ACTION doDelete
Definition: actions.h:78
static TOOL_ACTION selectionTool
Definition: actions.h:202
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION redo
Definition: actions.h:69
static TOOL_ACTION deleteTool
Definition: actions.h:79
static TOOL_ACTION zoomTool
Definition: actions.h:138
static TOOL_ACTION showProperties
Definition: actions.h:216
static TOOL_ACTION cut
Definition: actions.h:70
static TOOL_ACTION ddAddLibrary
Definition: actions.h:60
static TOOL_ACTION copyAsText
Definition: actions.h:72
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:188
static TOOL_ACTION selectAll
Definition: actions.h:75
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...
wxProgressDialog with the option to also update the application progress on the taskbar
virtual bool Update(int aValue, const wxString &aNewMsg=wxEmptyString, bool *aSkip=nullptr) override
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
WINDOW_SETTINGS m_Window
Definition: app_settings.h:194
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:197
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
constexpr void SetOrigin(const Vec &pos)
Definition: box2.h:237
constexpr void SetSize(const SizeVec &size)
Definition: box2.h:248
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
SETTINGS_MANAGER * GetSettingsManager() const
UNDO_REDO_LIST
Specifies whether we are interacting with the undo or redo stacks.
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
wxAuiManager m_auimgr
UNDO_REDO_CONTAINER m_redoList
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handles event fired when a file is dropped to the window.
void ReCreateMenuBar()
Recreates the menu bar.
WX_INFOBAR * GetInfoBar()
COLOR_SETTINGS * m_colorSettings
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static const wxString PropertiesPaneName()
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
virtual void SetScreen(BASE_SCREEN *aScreen)
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
PROPERTIES_PANEL * m_propertiesPanel
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.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: eda_item.h:250
const KIID m_Uuid
Definition: eda_item.h:489
void ClearBrightened()
Definition: eda_item.h:123
void SetBrightened()
Definition: eda_item.h:120
bool IsBrightened() const
Definition: eda_item.h:112
Specialization of the wxAuiPaneInfo class for KiCad panels.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition: eda_text.cpp:424
Class that groups generic conditions for editor states.
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
virtual SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
Gather all the actions that are shared by tools.
Definition: ee_actions.h:39
static TOOL_ACTION mirrorV
Definition: ee_actions.h:132
static TOOL_ACTION runERC
Inspection and Editing.
Definition: ee_actions.h:156
static TOOL_ACTION pinTable
Definition: ee_actions.h:162
static TOOL_ACTION saveSymbolAs
Definition: ee_actions.h:214
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION placeSymbolAnchor
Definition: ee_actions.h:123
static TOOL_ACTION showHiddenFields
Definition: ee_actions.h:250
static TOOL_ACTION drawSymbolPolygon
Definition: ee_actions.h:122
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:142
static TOOL_ACTION newSymbol
Definition: ee_actions.h:216
static TOOL_ACTION drawCircle
Definition: ee_actions.h:106
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:141
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:131
static TOOL_ACTION editLibSymbolWithLibEdit
Definition: ee_actions.h:180
static TOOL_ACTION saveLibraryAs
Definition: ee_actions.h:213
static TOOL_ACTION placeSymbolText
Definition: ee_actions.h:119
static TOOL_ACTION mirrorH
Definition: ee_actions.h:133
static TOOL_ACTION rotateCW
Definition: ee_actions.h:130
static TOOL_ACTION togglePinAltIcons
Definition: ee_actions.h:258
static TOOL_ACTION importGraphics
Definition: ee_actions.h:269
static TOOL_ACTION importSymbol
Definition: ee_actions.h:225
static TOOL_ACTION saveSymbolCopyAs
Definition: ee_actions.h:215
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:161
static TOOL_ACTION drawRectangle
Definition: ee_actions.h:105
static TOOL_ACTION setUnitDisplayName
Definition: ee_actions.h:228
static TOOL_ACTION drawSymbolTextBox
Definition: ee_actions.h:120
static TOOL_ACTION drawSymbolLines
Definition: ee_actions.h:121
static TOOL_ACTION drawArc
Definition: ee_actions.h:107
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:259
static TOOL_ACTION drawBezier
Definition: ee_actions.h:108
static TOOL_ACTION showHiddenPins
Definition: ee_actions.h:249
static TOOL_ACTION placeSymbolPin
Definition: ee_actions.h:118
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:265
Tool that displays edit points allowing to modify items by dragging the points.
SCH_SELECTION_FILTER_OPTIONS & GetFilter()
EE_SELECTION & GetSelection()
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:43
int ShowModal() override
Definition: kidialog.cpp:95
bool m_axesEnabled
Fullscreen crosshair or small cross.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
void SetDefaultFont(const wxString &aFont)
void HideDrawingSheet()
Definition: sch_view.cpp:191
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
Definition: sch_view.cpp:179
void Clear()
Remove all items from the view.
Definition: view.cpp:1127
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1545
Definition: kiid.h:49
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
void OnKiCadExit()
Definition: kiway.cpp:725
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
Module editor specific tools.
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
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
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
Symbol library management helper that is specific to the symbol library editor frame.
void Sync(const wxString &aForceRefresh, std::function< void(int, int, const wxString &)> aProgressCallback)
Updates the SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetAdapter()
Return the adapter object that provides the stored data.
Define a library symbol object.
Definition: lib_symbol.h:78
const LIB_ID & GetLibId() const override
Definition: lib_symbol.h:143
bool IsMulti() const override
Definition: lib_symbol.h:565
std::vector< SCH_PIN * > GetPins(int aUnit, int aBodyStyle) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:822
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:274
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition: lib_symbol.h:194
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:260
SCH_FIELD & GetDatasheetField() const
Return reference to the datasheet field.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:510
wxString GetName() const override
Definition: lib_symbol.h:137
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) override
Return a list of fields within this symbol.
wxString GetLibNickname() const override
Sets the Description field text value.
Definition: lib_symbol.h:149
int GetUnitCount() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:304
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
Definition: lib_symbol.cpp:236
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
void SetFullURI(const wxString &aFullURI)
Change the full URI for the library.
void SetNickName(const wxString &aNickName)
Change the logical name of this library, useful for an editor.
const wxString & GetNickName() const
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 HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
Node type: LIB_ID.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:440
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:349
int GetSelectionCount() const
Definition: lib_tree.h:91
void ShowChangedLanguage()
Definition: lib_tree.cpp:291
void FocusSearchFieldIfExists()
Focus the search widget if it exists.
Definition: lib_tree.cpp:455
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:343
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
Definition: lib_tree.h:141
int GetSelectedLibIds(std::vector< LIB_ID > &aSelection, std::vector< int > *aUnit=nullptr) const
Retrieves a list of selections for trees that allow multi-selection.
Definition: lib_tree.cpp:315
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:355
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit,...
Definition: lib_tree.cpp:301
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
Definition: lib_tree.cpp:363
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition: lib_tree.cpp:422
static wxString GetDefaultUserSymbolsPath()
Gets the default path we point users to create projects.
Definition: paths.cpp:87
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.cpp:924
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
A holder to handle information on schematic or board items.
void ClearListAndDeleteItems(std::function< void(EDA_ITEM *)> aItemDeleter)
Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to th...
bool IsCancelled() const override
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
@ SCH_LIBEDIT_CUR_LIB
Definition: project.h:218
@ SCH_LIBEDIT_CUR_SYMBOL
Definition: project.h:219
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:135
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition: project.cpp:307
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition: project.cpp:318
float SplitterProportion() const
Action handler for the Properties panel.
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.
SYMBOL_EDITOR_SETTINGS * libeditconfig() const
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SYMBOL_LIB_TABLE * SelectSymLibTable(bool aOptional=false)
Display a dialog asking the user to select a symbol library table.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Save Symbol Library Tables to disk.
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
void setSymWatcher(const LIB_ID *aSymbol)
Creates (or removes) a watcher on the specified symbol library.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplaySymbol(LIB_SYMBOL *aSymbol)
Schematic editor (Eeschema) main window.
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
VECTOR2I GetPosition() const override
Definition: sch_field.cpp:1486
int GetId() const
Definition: sch_field.h:133
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:1228
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_field.cpp:1466
void SetName(const wxString &aName)
Definition: sch_field.cpp:1203
void SetText(const wxString &aText) override
Definition: sch_field.cpp:1213
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
Definition: sch_io_mgr.cpp:83
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
int GetBodyStyle() const
Definition: sch_item.h:234
int GetUnit() const
Definition: sch_item.h:231
virtual void ClearCaches()
Definition: sch_item.cpp:372
Schematic symbol object.
Definition: sch_symbol.h:77
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) override
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:981
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:774
const LIB_ID & GetLibId() const override
Definition: sch_symbol.h:166
int GetOrientation() const override
Get the display symbol orientation.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:185
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
Handle actions for the various symbol editor and viewers.
SYMBOL_EDITOR_DRAWING_TOOLS.
SCH_SELECTION_FILTER_OPTIONS m_SelectionFilter
bool m_ShowPinAltIcons
When true, dragging an outline edge will drag pins rooted on it.
The symbol library editor main window.
void OnExitKiCad(wxCommandEvent &event)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
APP_SETTINGS_BASE * config() const override
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
bool addLibTableEntry(const wxString &aLibFile, TABLE_SCOPE aScope=GLOBAL_LIB_TABLE)
Add aLibFile to the symbol library table defined by aScope.
void storeCurrentSymbol()
Rename LIB_SYMBOL aliases to avoid conflicts before adding a symbol to a library.
bool IsLibraryTreeShown() const override
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
wxString getTargetLib() const
bool IsCurrentSymbol(const LIB_ID &aLibId) const
Restore the empty editor screen, without any symbol or library selected.
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Return currently edited symbol.
void FocusOnItem(SCH_ITEM *aItem)
void RefreshLibraryTree()
Redisplay the library tree.
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
void FocusLibraryTreeInput() override
wxComboBox * m_unitSelectBox
int GetTreeLIBIDs(std::vector< LIB_ID > &aSelection) const
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
LIB_SYMBOL_LIBRARY_MANAGER * m_libMgr
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
void FocusOnLibId(const LIB_ID &aLibID)
bool IsSymbolAlias() const
Return true if aLibId is an alias for the editor screen symbol.
SYMBOL_EDITOR_SETTINGS * m_settings
int GetBodyStyle() const
void HardRedraw() override
Rebuild the GAL and redraw the screen.
bool GetShowDeMorgan() const
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
int GetTreeSelectionCount() const
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
bool CanCloseSymbolFromSchematic(bool doClose)
bool IsSymbolFromLegacyLibrary() const
bool replaceLibTableEntry(const wxString &aLibNickname, const wxString &aLibFile)
Replace the file path of the symbol library table entry aLibNickname with aLibFile.
bool IsSymbolFromSchematic() const
static bool m_showDeMorgan
void SetScreen(BASE_SCREEN *aScreen) override
SYMBOL_EDITOR_SETTINGS * GetSettings() const
SCH_SCREEN * m_dummyScreen
< Helper screen used when no symbol is loaded
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
void SetCurSymbol(LIB_SYMBOL *aSymbol, bool aUpdateZoom)
Take ownership of aSymbol and notes that it is the one currently being edited.
KIID m_schematicSymbolUUID
RefDes of the symbol (only valid if symbol was loaded from schematic)
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
std::vector< LIB_ID > GetSelectedLibIds() const
void SyncLibraries(bool aShowProgress, bool aPreloadCancelled=false, const wxString &aForceRefresh=wxEmptyString)
Synchronize the library manager to the symbol library table, and then the symbol tree to the library ...
void OnSelectUnit(wxCommandEvent &event)
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void UpdateSymbolMsgPanelInfo()
Display the documentation of the selected symbol.
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
LIB_ID GetTargetLibId() const override
Return either the symbol selected in the symbol tree (if context menu is active) or the symbol on the...
int m_bodyStyle
Flag if the symbol being edited was loaded directly from a schematic.
bool saveAllLibraries(bool aRequireConfirmation)
Save the current symbol.
void SetUnit(int aUnit)
void UpdateMsgPanel() override
Redraw the message panel.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from aList element.
LIB_TREE * GetLibTree() const override
wxString SetCurLib(const wxString &aLibNickname)
Set the current library nickname and returns the old library nickname.
void UpdateTitle()
Update the main window title bar with the current library name and read only status of the library.
void ReCreateHToolbar() override
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
bool HasLibModifications() const
Check if any pending libraries have been modified.
SYMBOL_TREE_PANE * m_treePane
void LoadSymbolFromSchematic(SCH_SYMBOL *aSymbol)
Load a symbol from the schematic to edit in place.
bool LoadSymbolFromCurrentLib(const wxString &aAliasName, int aUnit=0, int aBodyStyle=0)
Load a symbol from the current active library, optionally setting the selected unit and convert.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
LIB_SYMBOL_LIBRARY_MANAGER & GetLibManager()
void SaveSymbolCopyAs(bool aOpenCopy)
Save the currently selected symbol to a new name and/or location.
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas ( Cairo / OpenGL).
void doCloseWindow() override
void DdAddLibrary(wxString aLibFile)
Add a library dropped file to the symbol library table.
wxString AddLibraryFile(bool aCreateNew)
Create or add an existing library to the symbol library table.
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
void UpdateLibraryTree(const wxDataViewItem &aTreeItem, LIB_SYMBOL *aSymbol)
Update a symbol node in the library tree.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void SetShowDeMorgan(bool show)
void ShowChangedLanguage() override
void SaveLibraryAs()
Save the currently selected library to a new file.
bool IsContentModified() const override
Get if any symbols or libraries have been modified but not saved.
void ToggleLibraryTree() override
LIB_SYMBOL * getTargetSymbol() const
Return either the library selected in the symbol tree, if context menu is active or the library that ...
void OnUpdateUnitNumber(wxUpdateUIEvent &event)
LIB_SYMBOL * GetBufferedSymbol(const wxString &aAlias, const wxString &aLibrary)
Return the symbol copy from the buffer.
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
LIB_SYMBOL * GetAlias(const wxString &aAlias, const wxString &aLibrary) const
Return either an alias of a working LIB_SYMBOL copy, or alias of the original symbol if there is no w...
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE &aTable)
Add an existing library.
SCH_SCREEN * GetScreen(const wxString &aAlias, const wxString &aLibrary)
Return the screen used to edit a specific symbol.
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
wxArrayString GetLibraryNames() const
Return the array of library names.
wxString GetUniqueLibraryName() const
Return a library name that is not currently in use.
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE &aTable)
Create an empty library and adds it to the library table.
bool IsSymbolModified(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol has unsaved modifications.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
bool UpdateSymbol(LIB_SYMBOL *aSymbol, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol.
bool UpdateLibraryBuffer(const wxString &aLibrary)
Update the library buffer with a new version of the library.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_IO object i...
void SetType(const wxString &aType) override
Change the schematic plugin type represented by this row.
const wxString GetType() const override
Return the type of symbol library table represented by this row.
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
static const wxString & GetSymbolLibTableFileName()
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
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...
Library Editor pane with symbol tree and symbol library table selector.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:168
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h:62
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:302
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
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...
A holder to handle a list of undo (or redo) commands.
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
bool empty() const
Definition: utf8.h:104
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:76
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:304
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: wx_infobar.cpp:263
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:190
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:154
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
int UnsavedChangesDialog(wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition: confirm.cpp:66
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define _HKI(x)
static bool empty(const wxTextEntryBase *aCtrl)
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define LIB_EDIT_FRAME_NAME
@ ID_LIBEDIT_SELECT_UNIT_NUMBER
Definition: eeschema_id.h:60
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition: env_paths.cpp:71
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectHighlightChoice EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox) void GERBVIEW_FRAME
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ FRAME_SCH
Definition: frame_type.h:34
static const std::string KiCadSymbolLibFileExtension
static wxString KiCadSymbolLibFileWildcard()
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition: kicad.cpp:597
This file is part of the common library.
KIID niluuid(0)
@ LAYER_SCHEMATIC_GRID_AXES
Definition: layer_ids.h:390
@ MAIL_LIB_EDIT
Definition: mail_type.h:54
@ MAIL_REFRESH_SYMBOL
Definition: mail_type.h:58
@ MAIL_RELOAD_LIB
Definition: mail_type.h:56
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:58
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: unix/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: unix/app.cpp:79
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:100
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)
ACTION_CONDITIONS & Check(const SELECTION_CONDITION &aCondition)
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
@ SYM_ORIENT_270
Definition: symbol.h:42
@ SYM_MIRROR_Y
Definition: symbol.h:44
@ SYM_ORIENT_180
Definition: symbol.h:41
@ SYM_MIRROR_X
Definition: symbol.h:43
@ SYM_ORIENT_90
Definition: symbol.h:40
#define EDIT_TOOL(tool)
Definition for symbol library class.
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691
VECTOR2< double > VECTOR2D
Definition: vector2d.h:690
Definition of file extensions used in Kicad.
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.