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 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>
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>
51#include <tool/action_manager.h>
52#include <tool/action_toolbar.h>
53#include <tool/common_control.h>
54#include <tool/common_tools.h>
56#include <tool/embed_tool.h>
58#include <tool/picker_tool.h>
60#include <tool/selection.h>
62#include <tool/tool_manager.h>
63#include <tool/zoom_tool.h>
64#include <tools/sch_actions.h>
75#include <view/view_controls.h>
77#include <widgets/wx_infobar.h>
85#include <panel_sym_lib_table.h>
86#include <string_utils.h>
87#include <wx/msgdlg.h>
88#include <wx/log.h>
89
90
92
93
94BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, SCH_BASE_FRAME )
96
97 // menubar commands
98 EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad )
99 EVT_MENU( wxID_CLOSE, SYMBOL_EDIT_FRAME::CloseWindow )
100
101 // Update user interface elements.
103
104 // Drop files event
105 EVT_DROP_FILES( SYMBOL_EDIT_FRAME::OnDropFiles )
106
107END_EVENT_TABLE()
108
109
110SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
111 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_SYMBOL_EDITOR, _( "Library Editor" ),
112 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
114 m_unitSelectBox( nullptr ),
115 m_isSymbolFromSchematic( false )
116{
117 SetShowDeMorgan( false );
118 m_SyncPinEdit = false;
119
120 m_symbol = nullptr;
121 m_treePane = nullptr;
122 m_libMgr = nullptr;
123 m_unit = 1;
124 m_bodyStyle = 1;
125 m_aboutTitle = _HKI( "KiCad Symbol Editor" );
126
127 wxIcon icon;
128 wxIconBundle icon_bundle;
129
130 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 48 ) );
131 icon_bundle.AddIcon( icon );
132 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 256 ) );
133 icon_bundle.AddIcon( icon );
134 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 128 ) );
135 icon_bundle.AddIcon( icon );
136 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit_32 ) );
137 icon_bundle.AddIcon( icon );
138 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit_16 ) );
139 icon_bundle.AddIcon( icon );
140
141 SetIcons( icon_bundle );
142
143 m_settings = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
144 LoadSettings( m_settings );
145
146 m_libMgr = new LIB_SYMBOL_LIBRARY_MANAGER( *this );
147 bool loadingCancelled = false;
148
149 {
150 // Preload libraries before using SyncLibraries the first time, as the preload is
151 // multi-threaded
152 WX_PROGRESS_REPORTER reporter( this, _( "Load Symbol Libraries" ), m_libMgr->GetLibraryCount(),
153 PR_CAN_ABORT );
154 m_libMgr->Preload( reporter );
155
156 loadingCancelled = reporter.IsCancelled();
157 wxSafeYield();
158 }
159
160 SyncLibraries( false, loadingCancelled );
161 m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
162 m_treePane->GetLibTree()->SetSortMode( (LIB_TREE_MODEL_ADAPTER::SORT_MODE) m_settings->m_LibrarySortMode );
163
164 resolveCanvasType();
165 SwitchCanvas( m_canvasType );
166
167 // Ensure axis are always drawn
168 KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
169 gal_opts.m_axesEnabled = true;
170
171 m_dummyScreen = new SCH_SCREEN();
172 SetScreen( m_dummyScreen );
173 GetScreen()->m_Center = true;
174
175 GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
176
177 GetRenderSettings()->LoadColors( GetColorSettings() );
178 GetRenderSettings()->m_IsSymbolEditor = true;
179 GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
180
181 setupTools();
182 setupUIConditions();
183
184 ReCreateMenuBar();
185
186 m_toolbarSettings = GetToolbarSettings<SYMBOL_EDIT_TOOLBAR_SETTINGS>( "symbol_editor-toolbars" );
187 configureToolbars();
188 RecreateToolbars();
189
190 UpdateTitle();
191 UpdateSymbolMsgPanelInfo();
192 RebuildSymbolUnitsList();
193
194 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
195 m_propertiesPanel->SetSplitterProportion( m_settings->m_AuiPanels.properties_splitter );
196
197 m_selectionFilterPanel = new PANEL_SCH_SELECTION_FILTER( this );
198
199 m_auimgr.SetManagedWindow( this );
200
201 CreateInfoBar();
202
203 // Rows; layers 4 - 6
204 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" )
205 .Top().Layer( 6 ) );
206
207 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
208 .Bottom().Layer( 6 ) );
209
210 // Columns; layers 1 - 3
211 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "LibraryTree" )
212 .Left().Layer( 3 )
213 .TopDockable( false ).BottomDockable( false )
214 .Caption( _( "Libraries" ) )
215 .MinSize( FromDIP( 250 ), -1 ).BestSize( FromDIP( 250 ), -1 ) );
216
217 m_auimgr.AddPane( m_propertiesPanel, defaultPropertiesPaneInfo( this ) );
218 // Show or hide m_propertiesPanel depending on current settings:
219 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
220
221 m_auimgr.AddPane( m_selectionFilterPanel, defaultSchSelectionFilterPaneInfo( this ) );
222
223 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
224 // The selection filter doesn't need to grow in the vertical direction when docked
225 selectionFilterPane.dock_proportion = 0;
226
227 propertiesPaneInfo.Show( m_settings->m_AuiPanels.show_properties );
228 updateSelectionFilterVisbility();
229
230 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
231 .Left().Layer( 2 ) );
232
233 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
234 .Right().Layer( 2 ) );
235
236 // Center
237 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
238 .CentrePane() );
239
240 FinishAUIInitialization();
241
242 // Can't put this in LoadSettings, because it has to be called before setupTools :/
243 SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
244 selTool->GetFilter() = GetSettings()->m_SelectionFilter;
245 m_selectionFilterPanel->SetCheckboxesFromFilter( selTool->GetFilter() );
246
247 if( m_settings->m_LibWidth > 0 )
248 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "LibraryTree" ), m_settings->m_LibWidth, -1 );
249
250 Raise();
251 Show( true );
252
253 SyncView();
254 GetCanvas()->GetView()->UseDrawPriority( true );
255 GetCanvas()->GetGAL()->SetAxesEnabled( true );
256
257 setupUnits( m_settings );
258
259 // Set the working/draw area size to display a symbol to a reasonable value:
260 // A 600mm x 600mm with a origin at the area center looks like a large working area
261 double max_size_x = schIUScale.mmToIU( 600 );
262 double max_size_y = schIUScale.mmToIU( 600 );
263 BOX2D bbox;
264 bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
265 bbox.SetSize( max_size_x, max_size_y );
266 GetCanvas()->GetView()->SetBoundary( bbox );
267
268 m_toolManager->RunAction( ACTIONS::zoomFitScreen );
269
271 DragAcceptFiles( true );
272
273 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Library changes are unsaved" ) );
274
275 // Catch unhandled accelerator command characters that were no handled by the library tree
276 // panel.
277 Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
278 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
279
280 // Ensure the window is on top
281 Raise();
282
283 if( loadingCancelled )
284 ShowInfoBarWarning( _( "Symbol library loading canceled by user." ) );
285}
286
287
289{
290 // Shutdown all running tools
291 if( m_toolManager )
293
294 setSymWatcher( nullptr );
295
297 {
298 delete m_symbol;
299 m_symbol = nullptr;
300
301 SCH_SCREEN* screen = GetScreen();
302 delete screen;
304 }
305
306 // current screen is destroyed in EDA_DRAW_FRAME
308
309 if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
310 Pgm().GetSettingsManager().Save( cfg );
311
312 delete m_libMgr;
313}
314
315
317{
318 wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_boardAdapter" );
319
321
326 GetRenderSettings()->SetDefaultFont( wxEmptyString );
327}
328
329
331{
332 wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_boardAdapter" );
333
335
337
342
343 m_settings->m_LibWidth = m_treePane->GetSize().x;
344
346
348 bool prop_shown = m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
350
353}
354
355
357{
358 return static_cast<APP_SETTINGS_BASE*>( GetSettings() );
359}
360
361
363{
365
366 if( cfg && static_cast<SYMBOL_EDITOR_SETTINGS*>( cfg )->m_UseEeschemaColorSettings )
367 cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
368
369 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
370}
371
372
374{
375 // Create the manager and dispatcher & route draw panel events to the dispatcher
378 GetCanvas()->GetViewControls(), GetSettings(), this );
379 m_actions = new SCH_ACTIONS();
381
382 // Register tools
400
401 // Run the selection tool, it is supposed to be always active
402 m_toolManager->InvokeTool( "common.InteractiveSelection" );
403
405}
406
407
409{
411
413 EDITOR_CONDITIONS cond( this );
414
415 wxASSERT( mgr );
416
417#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
418#define CHECK( x ) ACTION_CONDITIONS().Check( x )
419
420 auto haveSymbolCond =
421 [this]( const SELECTION& )
422 {
423 return m_symbol;
424 };
425
426 auto isEditableCond =
427 [this]( const SELECTION& )
428 {
429 // Only root symbols from the new s-expression libraries or the schematic
430 // are editable.
431 return IsSymbolEditable() && !IsSymbolAlias();
432 };
433
434 auto isEditableInAliasCond =
435 [this]( const SELECTION& )
436 {
437 // Less restrictive than isEditableCond
438 // Symbols fields (root symbols and aliases) from the new s-expression libraries
439 // or in the schematic are editable.
440 return IsSymbolEditable();
441 };
442
443 auto symbolModifiedCondition =
444 [this]( const SELECTION& sel )
445 {
448 };
449
450 auto libSelectedCondition =
451 [this]( const SELECTION& sel )
452 {
453 return !GetTargetLibId().GetLibNickname().empty();
454 };
455
456 auto canEditProperties =
457 [this]( const SELECTION& sel )
458 {
460 };
461
462 auto saveSymbolAsCondition =
463 [this]( const SELECTION& aSel )
464 {
465 return getTargetSymbol() != nullptr;
466 };
467
468 const auto isSymbolFromSchematicCond =
469 [this]( const SELECTION& )
470 {
471 return IsSymbolFromSchematic();
472 };
473
474 // clang-format off
477 mgr->SetConditions( SCH_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
478 mgr->SetConditions( SCH_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) );
479 mgr->SetConditions( SCH_ACTIONS::saveSymbolCopyAs, ENABLE( saveSymbolAsCondition ) );
482 mgr->SetConditions( SCH_ACTIONS::editLibSymbolWithLibEdit, ENABLE( isSymbolFromSchematicCond ) );
483
484 mgr->SetConditions( ACTIONS::undo, ENABLE( haveSymbolCond && cond.UndoAvailable() ) );
485 mgr->SetConditions( ACTIONS::redo, ENABLE( haveSymbolCond && cond.RedoAvailable() ) );
486 mgr->SetConditions( ACTIONS::revert, ENABLE( symbolModifiedCondition ) );
487
491 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
492 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
493 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
494
495 mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );
496 mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) );
497 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( haveSymbolCond ) );
498 mgr->SetConditions( ACTIONS::paste, ENABLE( isEditableCond &&
500 mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
501 mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
502 mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
503 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( haveSymbolCond ) );
504
505 // These actions in symbol editor when editing alias field rotations are allowed.
506 mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( isEditableInAliasCond ) );
507 mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( isEditableInAliasCond ) );
508
509 mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( isEditableCond ) );
510 mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( isEditableCond ) );
511
514 // clang-format on
515
516 auto pinTypeCond =
517 [this]( const SELECTION& )
518 {
520 };
521
522 auto hiddenPinCond =
523 [this]( const SELECTION& )
524 {
526 };
527
528 auto hiddenFieldCond =
529 [this]( const SELECTION& )
530 {
532 };
533
534 auto showPinAltIconsCond =
535 [this]( const SELECTION& )
536 {
538 };
539
540 auto showLibraryTreeCond =
541 [this]( const SELECTION& )
542 {
543 return IsLibraryTreeShown();
544 };
545
546 auto propertiesCond =
547 [this] ( const SELECTION& )
548 {
549 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
550 };
551
554 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( showLibraryTreeCond ) );
555 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
556 mgr->SetConditions( SCH_ACTIONS::showHiddenPins, CHECK( hiddenPinCond ) );
557 mgr->SetConditions( SCH_ACTIONS::showHiddenFields, CHECK( hiddenFieldCond ) );
558 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltIconsCond ) );
559
560 auto demorganCond =
561 [this]( const SELECTION& )
562 {
563 return GetShowDeMorgan();
564 };
565
566 auto demorganStandardCond =
567 [this]( const SELECTION& )
568 {
569 return m_bodyStyle == BODY_STYLE::BASE;
570 };
571
572 auto demorganAlternateCond =
573 [this]( const SELECTION& )
574 {
575 return m_bodyStyle == BODY_STYLE::DEMORGAN;
576 };
577
578 auto multiUnitModeCond =
579 [this]( const SELECTION& )
580 {
581 return m_symbol && m_symbol->IsMulti() && !m_symbol->UnitsLocked();
582 };
583
584 auto hasMultipleUnitsCond =
585 [this]( const SELECTION& )
586 {
587 return m_symbol && m_symbol->IsMulti();
588 };
589
590 auto syncedPinsModeCond =
591 [this]( const SELECTION& )
592 {
593 return m_SyncPinEdit;
594 };
595
596 auto haveDatasheetCond =
597 [this]( const SELECTION& )
598 {
599 return m_symbol && !m_symbol->GetDatasheetField().GetText().IsEmpty();
600 };
601
602 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
603 mgr->SetConditions( SCH_ACTIONS::symbolProperties, ENABLE( canEditProperties && haveSymbolCond ) );
604 mgr->SetConditions( SCH_ACTIONS::runERC, ENABLE( haveSymbolCond ) );
605 mgr->SetConditions( SCH_ACTIONS::pinTable, ENABLE( isEditableCond && haveSymbolCond ) );
606
607 mgr->SetConditions( SCH_ACTIONS::showDeMorganStandard, ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
608 mgr->SetConditions( SCH_ACTIONS::showDeMorganAlternate, ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
609 mgr->SetConditions( SCH_ACTIONS::toggleSyncedPinsMode, ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
610 mgr->SetConditions( SCH_ACTIONS::setUnitDisplayName, ACTION_CONDITIONS().Enable( isEditableCond && hasMultipleUnitsCond ) );
611
612// Only enable a tool if the symbol is edtable
613#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
614
627
628#undef CHECK
629#undef ENABLE
630#undef EDIT_TOOL
631}
632
633
635{
636 if( IsContentModified() )
637 {
638 SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
639 wxString msg = _( "Save changes to '%s' before closing?" );
640
641 switch( UnsavedChangesDialog( this, wxString::Format( msg, m_reference ), nullptr ) )
642 {
643 case wxID_YES:
644 if( schframe && GetCurSymbol() ) // Should be always the case
646
647 break;
648
649 case wxID_NO:
650 break;
651
652 default:
653 case wxID_CANCEL:
654 return false;
655 }
656 }
657
658 if( doClose )
659 {
660 SetCurSymbol( nullptr, false );
661 UpdateTitle();
662 }
663
664 return true;
665}
666
667
668bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
669{
670 // Shutdown blocks must be determined and vetoed as early as possible
672 && aEvent.GetId() == wxEVT_QUERY_END_SESSION
673 && IsContentModified() )
674 {
675 return false;
676 }
677
679 return false;
680
681 if( !saveAllLibraries( true ) )
682 return false;
683
684 // Save symbol tree column widths
685 m_libMgr->GetAdapter()->SaveSettings();
686
687 return true;
688}
689
690
692{
694
695 if( GetLibTree() )
697
698 delete m_toolManager;
699 m_toolManager = nullptr;
700
701 Destroy();
702}
703
704
706{
707 if( !m_unitSelectBox )
708 return;
709
710 if( m_unitSelectBox->GetCount() != 0 )
711 m_unitSelectBox->Clear();
712
713 if( !m_symbol || m_symbol->GetUnitCount() <= 1 )
714 {
715 m_unit = 1;
716 m_unitSelectBox->Append( wxEmptyString );
717 }
718 else
719 {
720 for( int i = 0; i < m_symbol->GetUnitCount(); i++ )
721 {
722 wxString unitDisplayName = m_symbol->GetUnitDisplayName( i + 1, true );
723 m_unitSelectBox->Append( unitDisplayName );
724 }
725 }
726
727 // Ensure the selected unit is compatible with the number of units of the current symbol:
729 m_unit = 1;
730
731 m_unitSelectBox->SetSelection(( m_unit > 0 ) ? m_unit - 1 : 0 );
732}
733
734
736{
737 if( !m_propertiesPanel )
738 return;
739
740 bool show = !m_propertiesPanel->IsShownOnScreen();
741
742 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
743 propertiesPaneInfo.Show( show );
745
746 if( show )
747 {
748 SetAuiPaneSize( m_auimgr, propertiesPaneInfo,
750 }
751 else
752 {
754 }
755
756 m_auimgr.Update();
757 Refresh();
758}
759
760
762{
763 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
764 treePane.Show( !IsLibraryTreeShown() );
766 m_auimgr.Update();
767 Refresh();
768}
769
770
772{
773 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
774}
775
776
778{
780}
781
782
784{
785 m_treePane->Freeze();
786 m_libMgr->GetAdapter()->Freeze();
787}
788
789
791{
792 m_libMgr->GetAdapter()->Thaw();
793 m_treePane->Thaw();
794}
795
796
797void SYMBOL_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
798{
799 Kiway().OnKiCadExit();
800}
801
802
803void SYMBOL_EDIT_FRAME::OnUpdateUnitNumber( wxUpdateUIEvent& event )
804{
805 event.Enable( m_symbol && m_symbol->GetUnitCount() > 1 );
806}
807
808
809void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
810{
811 int i = event.GetSelection();
812
813 if( i == wxNOT_FOUND )
814 return;
815
816 SetUnit( i + 1 );
817}
818
819
821{
822 if( m_symbol )
823 {
825
826 if( row && row->GetType() == SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) )
827 return true;
828 }
829
830 return false;
831}
832
833
835{
836 wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
837
838 if( !libNickname.empty() )
839 {
840 if( !PROJECT_SCH::SchSymbolLibTable( &Prj() )->HasLibrary( libNickname ) )
841 {
842 Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
843 libNickname = wxEmptyString;
844 }
845 }
846
847 return libNickname;
848}
849
850
851wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
852{
853 wxString old = GetCurLib();
854
855 if( aLibNickname.empty() || !PROJECT_SCH::SchSymbolLibTable( &Prj() )->HasLibrary( aLibNickname ) )
856 Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
857 else
859
860 return old;
861}
862
863
864void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
865{
866 wxCHECK( m_toolManager, /* void */ );
867
869 GetCanvas()->GetView()->Clear();
870 delete m_symbol;
871
872 m_symbol = aSymbol;
873
874 // select the current symbol in the tree widget
877 else
878 GetLibTree()->Unselect();
879
880 wxString symbolName;
881 wxString libName;
882
883 if( m_symbol )
884 {
885 symbolName = m_symbol->GetName();
887 }
888
889 // retain in case this wxFrame is re-opened later on the same PROJECT
891
892 // Ensure synchronized pin edit can be enabled only symbols with interchangeable units
893 m_SyncPinEdit = aSymbol && aSymbol->IsRoot() && aSymbol->IsMulti() && !aSymbol->UnitsLocked();
894
896
904
905 if( aUpdateZoom )
907
908 GetCanvas()->Refresh();
909
910 WX_INFOBAR& infobar = *GetInfoBar();
911 infobar.RemoveAllButtons();
912
913 wxArrayString msgs;
914 int infobarFlags = wxICON_INFORMATION;
915
917 {
918 msgs.push_back( wxString::Format( _( "Editing symbol %s from schematic. Saving will "
919 "update the schematic only." ),
920 m_reference ) );
921
922 wxString link = wxString::Format( _( "Open symbol from library %s" ), libName );
923 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
924
925 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
926 [this, symbolName, libName]( wxHyperlinkEvent& aEvent )
927 {
929 } ) );
930
931 infobar.AddButton( button );
932 }
933 else if( IsSymbolFromLegacyLibrary() )
934 {
935 msgs.push_back( _( "Symbols in legacy libraries are not editable. Use Manage Symbol "
936 "Libraries to migrate to current format." ) );
937
938 wxString link = _( "Manage symbol libraries" );
939 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
940
941 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
942 [this]( wxHyperlinkEvent& aEvent )
943 {
945 } ) );
946
947 infobar.AddButton( button );
948 }
949 else if( IsSymbolAlias() )
950 {
951 msgs.push_back( wxString::Format( _( "Symbol %s is a derived symbol. Symbol graphics will "
952 "not be editable." ),
953 UnescapeString( symbolName ) ) );
954
955 // Don't assume the parent symbol shared pointer is still valid.
956 if( std::shared_ptr<LIB_SYMBOL> rootSymbol = m_symbol->GetRootSymbol() )
957 {
958 int unit = GetUnit();
959 int bodyStyle = GetBodyStyle();
960 wxString rootSymbolName = rootSymbol->GetName();
961 wxString link = wxString::Format( _( "Open %s" ), UnescapeString( rootSymbolName ) );
962
963 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link,
964 wxEmptyString );
965
966 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
967 [this, rootSymbolName, unit, bodyStyle]( wxHyperlinkEvent& aEvent )
968 {
969 LoadSymbolFromCurrentLib( rootSymbolName, unit, bodyStyle );
970 } ) );
971
972 infobar.AddButton( button );
973 }
974 }
975
976 if( m_symbol
979 {
980 msgs.push_back( _( "Library is read-only. Changes cannot be saved to this library." ) );
981
982 wxString link = wxString::Format( _( "Create an editable copy" ) );
983 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
984
985 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
986 [this, symbolName, libName]( wxHyperlinkEvent& aEvent )
987 {
988 wxString msg = wxString::Format( _( "Create an editable copy of the symbol or "
989 "the entire library (%s)?" ),
990 libName );
991
992 KIDIALOG errorDlg( this, msg, _( "Select type of item to save" ),
993 wxYES_NO | wxCANCEL | wxICON_QUESTION );
994 // These buttons are in a weird order(?)
995 errorDlg.SetYesNoCancelLabels( _( "Copy symbol" ), _( "Cancel" ),
996 _( "Copy library" ) );
997
998 int choice = errorDlg.ShowModal();
999
1000 switch( choice )
1001 {
1002 case wxID_YES:
1003 SaveSymbolCopyAs( true );
1004 break;
1005 case wxID_CANCEL:
1006 SaveLibraryAs();
1007 break;
1008 default:
1009 // Do nothing
1010 break;
1011 }
1012 } ) );
1013
1014 infobar.AddButton( button );
1015 }
1016
1017 if( msgs.empty() )
1018 {
1019 infobar.Dismiss();
1020 }
1021 else
1022 {
1023 wxString msg = wxJoin( msgs, '\n', '\0' );
1024 infobar.ShowMessage( msg, infobarFlags );
1025 }
1026}
1027
1028
1030{
1031 wxASSERT( m_libMgr );
1032 return *m_libMgr;
1033}
1034
1035
1037{
1039
1041
1042 if( !IsSymbolFromSchematic() )
1044
1045 if( m_isClosing )
1046 return;
1047
1049
1050 if( !GetTitle().StartsWith( "*" ) )
1051 UpdateTitle();
1052}
1053
1054
1056{
1057 wxCHECK( aUnit > 0 && aUnit <= GetCurSymbol()->GetUnitCount(), /* void*/ );
1058
1059 if( m_unit == aUnit )
1060 return;
1061
1064
1065 m_unit = aUnit;
1066
1067 if( m_unitSelectBox->GetSelection() != ( m_unit - 1 ) )
1068 m_unitSelectBox->SetSelection( m_unit - 1 );
1069
1071 RebuildView();
1073}
1074
1075
1077{
1079}
1080
1081
1082wxString SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
1083{
1084 wxFileName fn = m_libMgr->GetUniqueLibraryName();
1085 bool useGlobalTable = false;
1086 FILEDLG_HOOK_NEW_LIBRARY tableChooser( useGlobalTable );
1087
1088 if( !LibraryFileBrowser( aCreateNew ? _( "New Symbol Library" ) : _( "Add Symbol Library" ),
1089 !aCreateNew, fn, FILEEXT::KiCadSymbolLibFileWildcard(),
1090 FILEEXT::KiCadSymbolLibFileExtension, false, &tableChooser ) )
1091 {
1092 return wxEmptyString;
1093 }
1094
1095 wxString libName = fn.GetName();
1096
1097 if( libName.IsEmpty() )
1098 return wxEmptyString;
1099
1100 useGlobalTable = tableChooser.GetUseGlobalTable();
1101
1102 if( m_libMgr->LibraryExists( libName ) )
1103 {
1104 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libName ) );
1105 return wxEmptyString;
1106 }
1107
1108 SYMBOL_LIB_TABLE* libTable = useGlobalTable ? &SYMBOL_LIB_TABLE::GetGlobalLibTable()
1110
1111 if( aCreateNew )
1112 {
1113 if( !m_libMgr->CreateLibrary( fn.GetFullPath(), *libTable ) )
1114 {
1115 DisplayError( this, wxString::Format( _( "Could not create the library file '%s'.\n"
1116 "Make sure you have write permissions and "
1117 "try again." ),
1118 fn.GetFullPath() ) );
1119 return wxEmptyString;
1120 }
1121 }
1122 else
1123 {
1124 if( !m_libMgr->AddLibrary( fn.GetFullPath(), *libTable ) )
1125 {
1126 DisplayError( this, _( "Could not open the library file." ) );
1127 return wxEmptyString;
1128 }
1129 }
1130
1131 bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
1132 saveSymbolLibTables( globalTable, !globalTable );
1133
1134 std::string packet = fn.GetFullPath().ToStdString();
1136
1137 return fn.GetFullPath();
1138}
1139
1140
1141void SYMBOL_EDIT_FRAME::DdAddLibrary( wxString aLibFile )
1142{
1143 wxFileName fn = wxFileName( aLibFile );
1144 wxString libName = fn.GetName();
1145
1146 if( libName.IsEmpty() )
1147 return;
1148
1149 if( m_libMgr->LibraryExists( libName ) )
1150 {
1151 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libName ) );
1152 return;
1153 }
1154
1155 if( !m_libMgr->AddLibrary( fn.GetFullPath(), *PROJECT_SCH::SchSymbolLibTable( &Prj() ) ) )
1156 {
1157 DisplayError( this, _( "Could not open the library file." ) );
1158 return;
1159 }
1160
1161 saveSymbolLibTables( false, true );
1162
1163 std::string packet = fn.GetFullPath().ToStdString();
1165}
1166
1167
1169{
1170 return GetLibTree()->GetSelectedLibId( aUnit );
1171}
1172
1173
1175{
1176 return GetLibTree()->GetSelectionCount();
1177}
1178
1179int SYMBOL_EDIT_FRAME::GetTreeLIBIDs( std::vector<LIB_ID>& aSelection ) const
1180{
1181 return GetLibTree()->GetSelectedLibIds( aSelection );
1182}
1183
1184
1186{
1187 if( IsLibraryTreeShown() )
1188 {
1189 LIB_ID libId = GetTreeLIBID();
1190
1191 if( libId.IsValid() )
1192 return m_libMgr->GetSymbol( libId.GetLibItemName(), libId.GetLibNickname() );
1193 }
1194
1195 return m_symbol;
1196}
1197
1198
1200{
1201 LIB_ID id;
1202
1203 if( IsLibraryTreeShown() )
1204 id = GetTreeLIBID();
1205
1206 if( id.GetLibNickname().empty() && m_symbol )
1207 id = m_symbol->GetLibId();
1208
1209 return id;
1210}
1211
1212
1213std::vector<LIB_ID> SYMBOL_EDIT_FRAME::GetSelectedLibIds() const
1214{
1215 std::vector<LIB_ID> ids;
1216 GetTreeLIBIDs( ids );
1217 return ids;
1218}
1219
1220
1222{
1223 return GetTargetLibId().GetLibNickname();
1224}
1225
1226
1227void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress, bool aPreloadCancelled,
1228 const wxString& aForceRefresh )
1229{
1230 LIB_ID selected;
1231
1232 if( m_treePane )
1233 selected = GetLibTree()->GetSelectedLibId();
1234
1235 if( aShowProgress )
1236 {
1237 APP_PROGRESS_DIALOG progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
1238 m_libMgr->GetAdapter()->GetLibrariesCount(), this );
1239
1240 m_libMgr->Sync( aForceRefresh,
1241 [&]( int progress, int max, const wxString& libName )
1242 {
1243 progressDlg.Update( progress, wxString::Format( _( "Loading library '%s'..." ),
1244 libName ) );
1245 } );
1246 }
1247 else if( !aPreloadCancelled )
1248 {
1249 m_libMgr->Sync( aForceRefresh,
1250 [&]( int progress, int max, const wxString& libName )
1251 {
1252 } );
1253 }
1254
1255 if( m_treePane )
1256 {
1257 wxDataViewItem found;
1258
1259 if( selected.IsValid() )
1260 {
1261 // Check if the previously selected item is still valid,
1262 // if not - it has to be unselected to prevent crash
1263 found = m_libMgr->GetAdapter()->FindItem( selected );
1264
1265 if( !found )
1266 GetLibTree()->Unselect();
1267 }
1268
1269 GetLibTree()->Regenerate( true );
1270
1271 // Try to select the parent library, in case the symbol is not found
1272 if( !found && selected.IsValid() )
1273 {
1274 selected.SetLibItemName( "" );
1275 found = m_libMgr->GetAdapter()->FindItem( selected );
1276
1277 if( found )
1278 GetLibTree()->SelectLibId( selected );
1279 }
1280
1281 // If no selection, see if there's a current symbol to centre
1282 if( !selected.IsValid() && m_symbol )
1283 {
1284 LIB_ID current( GetCurLib(), m_symbol->GetName() );
1285 GetLibTree()->CenterLibId( current );
1286 }
1287 }
1288}
1289
1290
1292{
1294}
1295
1296
1298{
1299 GetLibTree()->SelectLibId( aLibID );
1300}
1301
1302
1303void SYMBOL_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem, LIB_SYMBOL* aSymbol )
1304{
1305 if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
1306 // from file therefore not yet in tree.
1307 {
1308 static_cast<LIB_TREE_NODE_ITEM*>( aTreeItem.GetID() )->Update( aSymbol );
1310 }
1311}
1312
1313
1314bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt )
1315{
1316 if( aOriginalFile.FileExists() )
1317 {
1318 wxFileName backupFileName( aOriginalFile );
1319 backupFileName.SetExt( aBackupExt );
1320
1321 if( backupFileName.FileExists() )
1322 wxRemoveFile( backupFileName.GetFullPath() );
1323
1324 if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1325 {
1326 DisplayError( this, wxString::Format( _( "Failed to save backup to '%s'." ),
1327 backupFileName.GetFullPath() ) );
1328 return false;
1329 }
1330 }
1331
1332 return true;
1333}
1334
1335
1337{
1338 if( m_symbol && !GetCurLib().IsEmpty() && GetScreen()->IsContentModified() )
1339 m_libMgr->UpdateSymbol( m_symbol, GetCurLib() ); // UpdateSymbol() makes a copy
1340}
1341
1342
1344{
1345 // This will return the root symbol of any alias
1347 aLibId.GetLibNickname() );
1348
1349 // Now we can compare the libId of the current symbol and the root symbol
1350 return ( symbol && m_symbol && symbol->GetLibId() == m_symbol->GetLibId() );
1351}
1352
1353
1355{
1356 GetLibTree()->Unselect();
1357 SetCurLib( wxEmptyString );
1358 SetCurSymbol( nullptr, false );
1362 Refresh();
1363}
1364
1365
1367{
1369
1370 if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
1371 {
1372 GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_ShowPinElectricalType;
1373 GetRenderSettings()->m_ShowHiddenPins = cfg->m_ShowHiddenPins;
1374 GetRenderSettings()->m_ShowHiddenFields = cfg->m_ShowHiddenFields;
1375 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_ShowPinAltIcons;
1376
1377 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1378 }
1379
1380 if( m_symbol )
1382
1384
1386 GetCanvas()->Refresh();
1387
1389
1390 if( aFlags & ENVVARS_CHANGED )
1391 SyncLibraries( true );
1392
1393 Layout();
1394 SendSizeEvent();
1395}
1396
1397
1399{
1400 // call my base class
1402
1403 // tooltips in toolbars
1405
1406 // For some obscure reason, the AUI manager hides the first modified pane.
1407 // So force show panes
1408 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
1409 bool tree_shown = tree_pane_info.IsShown();
1410 tree_pane_info.Caption( _( "Libraries" ) );
1411 tree_pane_info.Show( tree_shown );
1412 m_auimgr.Update();
1413
1415
1416 // status bar
1418
1419 if( GetRenderSettings()->m_ShowPinsElectricalType )
1420 {
1422 GetCanvas()->Refresh();
1423 }
1424
1425 UpdateTitle();
1426}
1427
1428
1430{
1431 SCH_BASE_FRAME::SetScreen( aScreen );
1432
1433 // Let tools add things to the view if necessary
1434 if( m_toolManager )
1436}
1437
1438
1440{
1448
1449 // Let tools add things to the view if necessary
1450 if( m_toolManager )
1452
1454 GetCanvas()->Refresh();
1455}
1456
1457
1459{
1460 SyncLibraries( true );
1461
1462 if( m_symbol )
1463 {
1465 SCH_SELECTION& selection = selectionTool->GetSelection();
1466
1467 for( SCH_ITEM& item : m_symbol->GetDrawItems() )
1468 {
1469 if( !alg::contains( selection, &item ) )
1470 item.ClearSelected();
1471 else
1472 item.SetSelected();
1473 }
1474
1476 }
1477
1478 RebuildView();
1479}
1480
1481
1482const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1483{
1484 if( !m_symbol )
1485 {
1486 // Gives a reasonable drawing area size
1487 int width = schIUScale.mmToIU( 50 );
1488 int height = schIUScale.mmToIU( 30 );
1489
1490 return BOX2I( VECTOR2I( -width/2, -height/2 ), VECTOR2I( width, height ) );
1491 }
1492 else
1493 {
1494 return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_bodyStyle );
1495 }
1496}
1497
1498
1500{
1501 static KIID lastBrightenedItemID( niluuid );
1502
1503 SCH_ITEM* lastItem = nullptr;
1504
1505 // nullptr will clear the current focus
1506 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
1507 return;
1508
1509 if( m_symbol )
1510 {
1511 for( SCH_PIN* pin : m_symbol->GetPins() )
1512 {
1513 if( pin->m_Uuid == lastBrightenedItemID )
1514 lastItem = pin;
1515 }
1516
1517 std::vector<SCH_FIELD*> fields;
1518 m_symbol->GetFields( fields );
1519
1520 for( SCH_FIELD* field : fields )
1521 {
1522 if( field->m_Uuid == lastBrightenedItemID )
1523 lastItem = field;
1524 }
1525 }
1526
1527 if( lastItem && lastItem != aItem )
1528 {
1529 lastItem->ClearBrightened();
1530
1531 UpdateItem( lastItem );
1532 lastBrightenedItemID = niluuid;
1533 }
1534
1535 if( aItem )
1536 {
1537 if( !aItem->IsBrightened() )
1538 {
1539 aItem->SetBrightened();
1540
1541 UpdateItem( aItem );
1542 lastBrightenedItemID = aItem->m_Uuid;
1543 }
1544
1545 FocusOnLocation( VECTOR2I( aItem->GetFocusPosition().x, -aItem->GetFocusPosition().y ) );
1546 }
1547}
1548
1549
1551{
1552 const std::string& payload = mail.GetPayload();
1553
1554 switch( mail.Command() )
1555 {
1556 case MAIL_LIB_EDIT:
1557 if( !payload.empty() )
1558 {
1559 wxString libFileName( payload );
1560 wxString libNickname;
1561 wxString msg;
1562
1564 const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( libFileName );
1565
1566 if( !libTableRow )
1567 {
1568 msg.Printf( _( "The current configuration does not include the symbol library '%s'." ),
1569 libFileName );
1570 msg += wxS( "\n" ) + _( "Use Manage Symbol Libraries to edit the configuration." );
1571 DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
1572 break;
1573 }
1574
1575 libNickname = libTableRow->GetNickName();
1576
1577 if( !libTable->HasLibrary( libNickname, true ) )
1578 {
1579 msg.Printf( _( "The symbol library '%s' is not enabled in the current configuration." ),
1580 UnescapeString( libNickname ) );
1581 msg += wxS( "\n" ) + _( "Use Manage Symbol Libraries to edit the configuration." );
1582 DisplayErrorMessage( this, _( "Symbol library not enabled." ), msg );
1583 break;
1584 }
1585
1586 SetCurLib( libNickname );
1587
1588 if( m_treePane )
1589 {
1590 LIB_ID id( libNickname, wxEmptyString );
1591 GetLibTree()->SelectLibId( id );
1592 GetLibTree()->ExpandLibId( id );
1593 GetLibTree()->CenterLibId( id );
1594 }
1595 }
1596
1597 break;
1598
1599 case MAIL_RELOAD_LIB:
1600 {
1601 wxString currentLib = GetCurLib();
1603
1605
1606 // Check if the currently selected symbol library been removed or disabled.
1607 if( !currentLib.empty() && libTable && !libTable->HasLibrary( currentLib, true ) )
1608 {
1609 SetCurLib( wxEmptyString );
1610 emptyScreen();
1611 }
1612
1613 SyncLibraries( true );
1616
1617 break;
1618 }
1619
1621 {
1623 LIB_SYMBOL* symbol = GetCurSymbol();
1624
1625 wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s", payload );
1626
1627 if( !tbl || !symbol )
1628 break;
1629
1630 wxString libName = symbol->GetLibId().GetLibNickname();
1631 const SYMBOL_LIB_TABLE_ROW* row = tbl->FindRow( libName );
1632
1633 if( !row )
1634 return;
1635
1636 wxFileName libfullname( row->GetFullURI( true ) );
1637
1638 wxFileName changedLib( mail.GetPayload() );
1639 wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s, current symbols is %s",
1640 changedLib.GetFullPath(), libfullname.GetFullPath() );
1641
1642 if( changedLib == libfullname )
1643 {
1644 wxLogTrace( "KICAD_LIB_WATCH", "Refreshing symbol %s", symbol->GetName() );
1645
1646 SetScreen( m_dummyScreen ); // UpdateLibraryBuffer will destroy the old screen
1647 m_libMgr->UpdateLibraryBuffer( libName );
1648
1649 if( LIB_SYMBOL* lib_symbol = m_libMgr->GetBufferedSymbol( symbol->GetName(), libName ) )
1650 {
1651 // The buffered screen for the symbol
1652 SCH_SCREEN* symbol_screen = m_libMgr->GetScreen( lib_symbol->GetName(), libName );
1653
1654 SetScreen( symbol_screen );
1655 SetCurSymbol( new LIB_SYMBOL( *lib_symbol ), false );
1657 SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
1658
1659 if( m_toolManager )
1661 }
1662 }
1663
1664 break;
1665 }
1666
1667 default:
1668 ;
1669 }
1670}
1671
1672
1673std::unique_ptr<GRID_HELPER> SYMBOL_EDIT_FRAME::MakeGridHelper()
1674{
1675 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1676}
1677
1678
1680{
1681 // switches currently used canvas ( Cairo / OpenGL):
1682 SCH_BASE_FRAME::SwitchCanvas( aCanvasType );
1683
1684 // Set options specific to symbol editor (axies are always enabled):
1685 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1687}
1688
1689
1691{
1692 wxCHECK( m_libMgr, false );
1693
1694 return m_libMgr->HasModifications();
1695}
1696
1697
1699{
1700 wxCHECK( m_libMgr, false );
1701
1702 // Test if the currently edited symbol is modified
1704 return true;
1705
1706 // Test if any library has been modified
1707 for( const wxString& libName : m_libMgr->GetLibraryNames() )
1708 {
1709 if( m_libMgr->IsLibraryModified( libName ) && !m_libMgr->IsLibraryReadOnly( libName ) )
1710 return true;
1711 }
1712
1713 return false;
1714}
1715
1716
1718{
1719 if( aItemCount == 0 )
1720 return;
1721
1722 UNDO_REDO_CONTAINER& list = ( whichList == UNDO_LIST ) ? m_undoList : m_redoList;
1723
1724 if( aItemCount < 0 )
1725 {
1726 list.ClearCommandList();
1727 }
1728 else
1729 {
1730 for( int ii = 0; ii < aItemCount; ii++ )
1731 {
1732 if( list.m_CommandsList.size() == 0 )
1733 break;
1734
1735 PICKED_ITEMS_LIST* curr_cmd = list.m_CommandsList[0];
1736 list.m_CommandsList.erase( list.m_CommandsList.begin() );
1737
1738 curr_cmd->ClearListAndDeleteItems( []( EDA_ITEM* aItem )
1739 {
1740 delete aItem;
1741 } );
1742 delete curr_cmd; // Delete command
1743 }
1744 }
1745}
1746
1747
1749{
1750 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
1751}
1752
1753
1755{
1756 std::unique_ptr<LIB_SYMBOL> symbol = aSymbol->GetLibSymbolRef()->Flatten();
1757 wxCHECK( symbol, /* void */ );
1758
1759 symbol->SetLibId( aSymbol->GetLibId() );
1760
1761 // Take in account the symbol orientation and mirroring. to calculate the field
1762 // positions in symbol editor (i.e. no rotation, no mirroring)
1763 int orientation = aSymbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
1764 int mirror = aSymbol->GetOrientation() & ( SYM_MIRROR_X | SYM_MIRROR_Y );
1765
1766 std::vector<SCH_FIELD> fullSetOfFields;
1767
1768 for( const SCH_FIELD& field : aSymbol->GetFields() )
1769 {
1770 VECTOR2I pos = field.GetPosition() - aSymbol->GetPosition();
1771 SCH_FIELD libField( symbol.get(), field.GetId() );
1772
1773 libField = field;
1774
1775 // The inverse transform is mirroring before, rotate after
1776 switch( mirror )
1777 {
1778 case SYM_MIRROR_X: pos.y = -pos.y; break;
1779 case SYM_MIRROR_Y: pos.x = -pos.x; break;
1780 default: break;
1781 }
1782
1783 switch( orientation )
1784 {
1785 case SYM_ORIENT_90:
1786 std::swap( pos.x, pos.y );
1787 pos.x = - pos.x;
1788 break;
1789 case SYM_ORIENT_270:
1790 std::swap( pos.x, pos.y );
1791 pos.y = - pos.y;
1792 break;
1793 case SYM_ORIENT_180:
1794 pos.x = - pos.x;
1795 pos.y = - pos.y;
1796 break;
1797 default:
1798 break;
1799 }
1800
1801 libField.SetPosition( pos );
1802
1803 fullSetOfFields.emplace_back( std::move( libField ) );
1804 }
1805
1806 symbol->SetFields( fullSetOfFields );
1807
1808 if( m_symbol )
1809 SetCurSymbol( nullptr, false );
1810
1812 m_schematicSymbolUUID = aSymbol->m_Uuid;
1813 m_reference = symbol->GetReferenceField().GetText();
1814 m_unit = std::max( 1, aSymbol->GetUnit() );
1815 m_bodyStyle = std::max( 1, aSymbol->GetBodyStyle() );
1816
1817 // Optimize default edit options for this symbol
1818 // Usually if units are locked, graphic items are specific to each unit
1819 // and if units are interchangeable, graphic items are common to units
1821 tools->SetDrawSpecificUnit( symbol->UnitsLocked() );
1822
1823 // The buffered screen for the symbol
1824 SCH_SCREEN* tmpScreen = new SCH_SCREEN();
1825
1826 SetScreen( tmpScreen );
1827 SetCurSymbol( symbol.release(), true );
1828 setSymWatcher( nullptr );
1829
1832
1833 if( IsLibraryTreeShown() )
1835
1836 UpdateTitle();
1838 SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
1840
1841 // Let tools add things to the view if necessary
1842 if( m_toolManager )
1844
1846 GetCanvas()->Refresh();
1847}
1848
1849
1850bool SYMBOL_EDIT_FRAME::addLibTableEntry( const wxString& aLibFile, TABLE_SCOPE aScope )
1851{
1852 wxFileName fn = aLibFile;
1853 wxFileName libTableFileName( Prj().GetProjectPath(),
1855 wxString libNickname = fn.GetName();
1857 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1858
1859 if( libTable->HasLibrary( libNickname ) )
1860 {
1861 wxString tmp;
1862 int suffix = 1;
1863
1864 while( libTable->HasLibrary( libNickname ) )
1865 {
1866 tmp.Printf( "%s%d", fn.GetName(), suffix );
1867 libNickname = tmp;
1868 suffix += 1;
1869 }
1870 }
1871
1873 row->SetNickName( libNickname );
1874
1875 wxString normalizedPath = NormalizePath( aLibFile, &envVars, Prj().GetProjectPath() );
1876
1877 if( aScope == GLOBAL_LIB_TABLE )
1878 {
1880 libTableFileName = SYMBOL_LIB_TABLE::GetGlobalTableFileName();
1881
1882 // We cannot normalize against the current project path when saving to global table.
1883 normalizedPath = NormalizePath( aLibFile, &envVars, wxEmptyString );
1884 }
1885
1886 row->SetFullURI( normalizedPath );
1887
1888 wxCHECK( libTable->InsertRow( row ), false );
1889
1890 try
1891 {
1892 libTable->Save( libTableFileName.GetFullPath() );
1893 }
1894 catch( const IO_ERROR& ioe )
1895 {
1896 wxString msg = aScope == GLOBAL_LIB_TABLE ? _( "Error saving global library table." )
1897 : _( "Error saving project library table." );
1898
1899 wxMessageDialog dlg( this, msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1900 dlg.SetExtendedMessage( ioe.What() );
1901 dlg.ShowModal();
1902
1903 return false;
1904 }
1905
1906 return true;
1907}
1908
1909
1910bool SYMBOL_EDIT_FRAME::replaceLibTableEntry( const wxString& aLibNickname,
1911 const wxString& aLibFile )
1912{
1913 // Check the global library table first because checking the project library table
1914 // checks the global library table as well due to library chaining.
1915 bool isGlobalTable = true;
1916 wxFileName libTableFileName = SYMBOL_LIB_TABLE::GetGlobalTableFileName();;
1917 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1919 SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLibNickname );
1920
1921 if( !row )
1922 {
1923 libTableFileName.SetPath( Prj().GetProjectPath() );
1924 libTableFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
1925 libTable = PROJECT_SCH::SchSymbolLibTable( &Prj() );
1926 isGlobalTable = false;
1927 row = libTable->FindRow( aLibNickname );
1928 }
1929
1930 wxCHECK( row, false );
1931
1932 wxString projectPath;
1933
1934 if( !isGlobalTable )
1935 projectPath = Prj().GetProjectPath();
1936
1937 wxString normalizedPath = NormalizePath( aLibFile, &envVars, projectPath );
1938
1939 row->SetFullURI( normalizedPath );
1940 row->SetType( "KiCad" );
1941
1942 try
1943 {
1944 libTable->Save( libTableFileName.GetFullPath() );
1945 }
1946 catch( const IO_ERROR& ioe )
1947 {
1948 wxString msg = isGlobalTable ? _( "Error saving global library table." )
1949 : _( "Error saving project library table." );
1950
1951 wxMessageDialog dlg( this, msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1952 dlg.SetExtendedMessage( ioe.What() );
1953 dlg.ShowModal();
1954
1955 return false;
1956 }
1957
1958 return true;
1959}
1960
1961
1963{
1964 return m_symbol && !m_symbol->IsRoot();
1965}
1966
1967
1969{
1971}
1972
1973
1974void SYMBOL_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
1975{
1976 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
1977
1978 if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem ) )
1979 {
1980 eda_text->ClearBoundingBoxCache();
1981 eda_text->ClearRenderCache();
1982 }
1983}
1984
1985
1987{
1988 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
1989 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
1990 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
1991
1992 // Don't give the selection filter its own visibility controls; instead show it if
1993 // anything else is visible
1994 bool showFilter = ( treePane.IsShown() && treePane.IsDocked() )
1995 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
1996
1997 selectionFilterPane.Show( showFilter );
1998}
1999
2000
2002{
2003 // Returns the current render option for invisible fields
2005}
2006
2007
2009{
2010 // Returns the current render option for invisible pins
2012}
BASE_SCREEN class implementation.
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:114
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:195
static TOOL_ACTION paste
Definition: actions.h:80
static TOOL_ACTION cancelInteractive
Definition: actions.h:72
static TOOL_ACTION millimetersUnits
Definition: actions.h:203
static TOOL_ACTION unselectAll
Definition: actions.h:83
static TOOL_ACTION revert
Definition: actions.h:62
static TOOL_ACTION showLibraryTree
Definition: actions.h:161
static TOOL_ACTION copy
Definition: actions.h:78
static TOOL_ACTION showDatasheet
Definition: actions.h:264
static TOOL_ACTION milsUnits
Definition: actions.h:202
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:154
static TOOL_ACTION saveAll
Definition: actions.h:61
static TOOL_ACTION undo
Definition: actions.h:75
static TOOL_ACTION duplicate
Definition: actions.h:84
static TOOL_ACTION inchesUnits
Definition: actions.h:201
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION doDelete
Definition: actions.h:85
static TOOL_ACTION selectionTool
Definition: actions.h:248
static TOOL_ACTION save
Definition: actions.h:58
static TOOL_ACTION zoomFitScreen
Definition: actions.h:141
static TOOL_ACTION redo
Definition: actions.h:76
static TOOL_ACTION deleteTool
Definition: actions.h:86
static TOOL_ACTION zoomTool
Definition: actions.h:145
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: actions.h:221
static TOOL_ACTION showProperties
Definition: actions.h:263
static TOOL_ACTION cut
Definition: actions.h:77
static TOOL_ACTION ddAddLibrary
Definition: actions.h:67
static TOOL_ACTION copyAsText
Definition: actions.h:79
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:196
static TOOL_ACTION selectAll
Definition: actions.h:82
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:108
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:236
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()
UNDO_REDO_LIST
Specify 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
virtual void RecreateToolbars()
UNDO_REDO_CONTAINER m_redoList
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
WX_INFOBAR * GetInfoBar()
COLOR_SETTINGS * m_colorSettings
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change 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)
bool LibraryFileBrowser(const wxString &aTitle, bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY *aFileDlgHook=nullptr)
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:98
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: eda_item.h:279
const KIID m_Uuid
Definition: eda_item.h:516
void ClearBrightened()
Definition: eda_item.h:138
void SetBrightened()
Definition: eda_item.h:135
bool IsBrightened() const
Definition: eda_item.h:129
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:79
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:97
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.
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:50
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:206
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
Definition: sch_view.cpp:194
bool IsSCH_ITEM() const
Definition: view_item.h:101
void Clear()
Remove all items from the view.
Definition: view.cpp:1143
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1561
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:286
void OnKiCadExit()
Definition: kiway.cpp:694
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:395
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:499
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:111
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:275
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:85
const LIB_ID & GetLibId() const override
Definition: lib_symbol.h:155
bool IsMulti() const override
Definition: lib_symbol.h:589
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:799
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:289
SCH_FIELD & GetDatasheetField()
Return reference to the datasheet field.
Definition: lib_symbol.h:346
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition: lib_symbol.h:206
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:519
wxString GetName() const override
Definition: lib_symbol.h:149
wxString GetLibNickname() const override
Sets the Description field text value.
Definition: lib_symbol.h:161
int GetUnitCount() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:344
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
Definition: lib_symbol.cpp:269
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:287
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()
Refresh the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:472
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:381
int GetSelectionCount() const
Definition: lib_tree.h:91
void ShutdownPreviews()
Definition: lib_tree.cpp:287
void ShowChangedLanguage()
Definition: lib_tree.cpp:304
void FocusSearchFieldIfExists()
Focus the search widget if it exists.
Definition: lib_tree.cpp:487
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:375
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
Definition: lib_tree.h:155
int GetSelectedLibIds(std::vector< LIB_ID > &aSelection, std::vector< int > *aUnit=nullptr) const
Retrieve a list of selections for trees that allow multi-selection.
Definition: lib_tree.cpp:334
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:387
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:314
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
Definition: lib_tree.cpp:395
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition: lib_tree.cpp:454
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.cpp:811
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
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:222
@ SCH_LIBEDIT_CUR_SYMBOL
Definition: project.h:223
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:149
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:321
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:332
float SplitterProportion() const
Action handler for the Properties panel.
Gather all the actions that are shared by tools.
Definition: sch_actions.h:40
static TOOL_ACTION rotateCCW
Definition: sch_actions.h:121
static TOOL_ACTION importSymbol
Definition: sch_actions.h:211
static TOOL_ACTION newSymbol
Definition: sch_actions.h:202
static TOOL_ACTION saveLibraryAs
Definition: sch_actions.h:199
static TOOL_ACTION mirrorV
Definition: sch_actions.h:122
static TOOL_ACTION editLibSymbolWithLibEdit
Definition: sch_actions.h:173
static TOOL_ACTION showDeMorganAlternate
Definition: sch_actions.h:132
static TOOL_ACTION drawArc
Definition: sch_actions.h:97
static TOOL_ACTION pinTable
Definition: sch_actions.h:152
static TOOL_ACTION drawSymbolLines
Definition: sch_actions.h:111
static TOOL_ACTION placeSymbolPin
Definition: sch_actions.h:108
static TOOL_ACTION drawSymbolTextBox
Definition: sch_actions.h:110
static TOOL_ACTION drawRectangle
Definition: sch_actions.h:95
static TOOL_ACTION drawCircle
Definition: sch_actions.h:96
static TOOL_ACTION importGraphics
Definition: sch_actions.h:255
static TOOL_ACTION drawBezier
Definition: sch_actions.h:98
static TOOL_ACTION saveSymbolCopyAs
Definition: sch_actions.h:201
static TOOL_ACTION rotateCW
Definition: sch_actions.h:120
static TOOL_ACTION showElectricalTypes
Definition: sch_actions.h:251
static TOOL_ACTION drawSymbolPolygon
Definition: sch_actions.h:112
static TOOL_ACTION showHiddenFields
Definition: sch_actions.h:236
static TOOL_ACTION placeSymbolAnchor
Definition: sch_actions.h:113
static TOOL_ACTION showHiddenPins
Definition: sch_actions.h:235
static TOOL_ACTION setUnitDisplayName
Definition: sch_actions.h:214
static TOOL_ACTION mirrorH
Definition: sch_actions.h:123
static TOOL_ACTION runERC
Inspection and Editing.
Definition: sch_actions.h:146
static TOOL_ACTION symbolProperties
Definition: sch_actions.h:151
static TOOL_ACTION placeSymbolText
Definition: sch_actions.h:109
static TOOL_ACTION toggleSyncedPinsMode
Definition: sch_actions.h:245
static TOOL_ACTION togglePinAltIcons
Definition: sch_actions.h:244
static TOOL_ACTION showDeMorganStandard
Definition: sch_actions.h:131
static TOOL_ACTION saveSymbolAs
Definition: sch_actions.h:200
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_RENDER_SETTINGS * GetRenderSettings()
void doCloseWindow() override
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.
void CommonSettingsChanged(int aFlags) 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.
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_field.cpp:1317
Handle actions specific to the schematic editor.
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:248
int GetUnit() const
Definition: sch_item.h:239
virtual void ClearCaches()
Definition: sch_item.cpp:521
Tool that displays edit points allowing to modify items by dragging the points.
SCH_SELECTION & GetSelection()
SCH_SELECTION_FILTER_OPTIONS & GetFilter()
Schematic symbol object.
Definition: sch_symbol.h:75
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
Definition: sch_symbol.cpp:788
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:767
const LIB_ID & GetLibId() const override
Definition: sch_symbol.h:164
int GetOrientation() const override
Get the display symbol orientation.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:183
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).
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
Return 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
Return bounding box 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 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 CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
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.
void ToggleProperties() override
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.
bool LoadSymbolFromCurrentLib(const wxString &aSymbolName, int aUnit=0, int aBodyStyle=0)
Load a symbol from the current active library, optionally setting the selected unit and convert.
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.
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
void FocusOnItem(EDA_ITEM *aItem) override
Focus on a particular canvas item.
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)
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 * GetBufferedSymbol(const wxString &aSymbolName, const wxString &aLibrary)
Return the symbol copy from the buffer.
SCH_SCREEN * GetScreen(const wxString &aSymbolName, const wxString &aLibrary)
Return the screen used to edit a specific symbol.
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE &aTable)
Add an existing library.
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
LIB_SYMBOL * GetSymbol(const wxString &aSymbolName, 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...
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 &aSymbolName, 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:171
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:173
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:172
@ 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:306
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()
Initialize 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:110
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:371
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: wx_infobar.cpp:327
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:192
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:156
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:194
int UnsavedChangesDialog(wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition: confirm.cpp:64
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:169
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:73
Helper functions to substitute paths with environmental variables.
@ 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:608
This file is part of the common library.
KIID niluuid(0)
@ LAYER_SCHEMATIC_GRID_AXES
Definition: layer_ids.h:477
@ MAIL_LIB_EDIT
Definition: mail_type.h:55
@ MAIL_REFRESH_SYMBOL
Definition: mail_type.h:59
@ MAIL_RELOAD_LIB
Definition: mail_type.h:57
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:59
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:902
see class PGM_BASE
#define DEFAULT_THEME
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
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:92
@ 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.
#define ENVVARS_CHANGED
Definition: tools_holder.h:152
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695
VECTOR2< double > VECTOR2D
Definition: vector2d.h:694
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.
#define PR_CAN_ABORT