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 <confirm.h>
30#include <core/kicad_algo.h>
31#include <eeschema_id.h>
32#include <eeschema_settings.h>
33#include <env_paths.h>
35#include <kidialog.h>
36#include <kiface_base.h>
37#include <kiplatform/app.h>
38#include <kiway_mail.h>
39#include <symbol_edit_frame.h>
42#include <paths.h>
43#include <pgm_base.h>
44#include <project_sch.h>
45#include <sch_painter.h>
46#include <sch_view.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/sch_actions.h>
74#include <view/view_controls.h>
76#include <widgets/wx_infobar.h>
80#include <widgets/lib_tree.h>
85#include <panel_sym_lib_table.h>
86#include <string_utils.h>
88#include <wx/msgdlg.h>
89#include <wx/combobox.h>
90#include <wx/log.h>
91#include <trace_helpers.h>
92
93
95
96
97BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, SCH_BASE_FRAME )
100
101 // menubar commands
102 EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad )
103 EVT_MENU( wxID_CLOSE, SYMBOL_EDIT_FRAME::CloseWindow )
104
105 // Update user interface elements.
108
111
112 // Drop files event
113 EVT_DROP_FILES( SYMBOL_EDIT_FRAME::OnDropFiles )
114
115END_EVENT_TABLE()
116
117
118SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
119 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_SYMBOL_EDITOR, _( "Library Editor" ),
120 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
122 m_unitSelectBox( nullptr ),
123 m_bodyStyleSelectBox( nullptr ),
125{
126 m_SyncPinEdit = false;
127
128 m_symbol = nullptr;
129 m_treePane = nullptr;
130 m_libMgr = nullptr;
131 m_unit = 1;
132 m_bodyStyle = 1;
133 m_aboutTitle = _HKI( "KiCad Symbol Editor" );
134
135 wxIcon icon;
136 wxIconBundle icon_bundle;
137
138 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 48 ) );
139 icon_bundle.AddIcon( icon );
140 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 256 ) );
141 icon_bundle.AddIcon( icon );
142 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit, 128 ) );
143 icon_bundle.AddIcon( icon );
144 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit_32 ) );
145 icon_bundle.AddIcon( icon );
146 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_libedit_16 ) );
147 icon_bundle.AddIcon( icon );
148
149 SetIcons( icon_bundle );
150
153
155
156 m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
157 m_treePane->GetLibTree()->SetSortMode( (LIB_TREE_MODEL_ADAPTER::SORT_MODE) m_settings->m_LibrarySortMode );
158
161
162 // Ensure axis are always drawn
164 gal_opts.m_axesEnabled = true;
165
168 GetScreen()->m_Center = true;
169
170 GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
171
172 GetRenderSettings()->LoadColors( GetColorSettings() );
173 GetRenderSettings()->m_IsSymbolEditor = true;
174 GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
175
176 setupTools();
178
180
184
185 UpdateTitle();
188
189 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
190 m_propertiesPanel->SetSplitterProportion( m_settings->m_AuiPanels.properties_splitter );
191
193
194 m_auimgr.SetManagedWindow( this );
195
197
198 // Rows; layers 4 - 6
199 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" )
200 .Top().Layer( 6 ) );
201
202 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
203 .Bottom().Layer( 6 ) );
204
205 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
206 .Left().Layer( 2 ) );
207
208 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
209 .Right().Layer( 2 ) );
210
211 // Center
212 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
213 .CentrePane() );
214
215 // Columns; layers 1 - 3
216 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "LibraryTree" )
217 .Left().Layer( 3 )
218 .TopDockable( false ).BottomDockable( false )
219 .Caption( _( "Libraries" ) )
220 // Don't use -1 for don't-change-height on a growable panel; it has side-effects.
221 .MinSize( FromDIP( 250 ), FromDIP( 80 ) )
222 .BestSize( FromDIP( 250 ), -1 ) );
223
226
227 // Can be called only when all panes are created, because (at least on Windows) when items
228 // managed by m_auimgr are not the same as those existing when saved by Perspective()
229 // in config, broken settings can happen.
231
232 // Protect against broken saved Perspective() due to bugs in previous version
233 // This is currently a workaround.
234 m_auimgr.GetPane( "TopMainToolbar" ).Top().Layer( 6 ).Position(0).Show( true );
235 m_auimgr.GetPane( "LeftToolbar" ).Position(0).Show( true );
236 m_auimgr.GetPane( "RightToolbar" ).Show( true );
237
238 // Show or hide m_propertiesPanel depending on current settings:
239 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
240 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
241 // The selection filter doesn't need to grow in the vertical direction when docked
242 selectionFilterPane.dock_proportion = 0;
243
244 propertiesPaneInfo.Show( m_settings->m_AuiPanels.show_properties );
246
248
249 // Can't put this in LoadSettings, because it has to be called before setupTools :/
251 selTool->GetFilter() = GetSettings()->m_SelectionFilter;
252 m_selectionFilterPanel->SetCheckboxesFromFilter( selTool->GetFilter() );
253
254 if( m_settings->m_LibWidth > 0 )
255 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "LibraryTree" ), m_settings->m_LibWidth, -1 );
256
257 Raise();
258 Show( true );
259
260 SyncView();
261 GetCanvas()->GetView()->UseDrawPriority( true );
262 GetCanvas()->GetGAL()->SetAxesEnabled( true );
263
265
266 // Set the working/draw area size to display a symbol to a reasonable value:
267 // A 600mm x 600mm with a origin at the area center looks like a large working area
268 double max_size_x = schIUScale.mmToIU( 600 );
269 double max_size_y = schIUScale.mmToIU( 600 );
270 BOX2D bbox;
271 bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
272 bbox.SetSize( max_size_x, max_size_y );
273 GetCanvas()->GetView()->SetBoundary( bbox );
274
276
278 DragAcceptFiles( true );
279
280 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Library changes are unsaved" ) );
281
282 // Catch unhandled accelerator command characters that were no handled by the library tree
283 // panel.
285 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
286
287 // Ensure the window is on top
288 Raise();
289
290 // run SyncLibraries with progress reporter enabled. The progress reporter is useful
291 // in debug mode because the loading time of ecah library can be really noticeable
292 SyncLibraries( true );
293}
294
295
297{
298 // Shutdown all running tools
299 if( m_toolManager )
300 m_toolManager->ShutdownAllTools();
301
302 setSymWatcher( nullptr );
303
305 {
306 delete m_symbol;
307 m_symbol = nullptr;
308
309 SCH_SCREEN* screen = GetScreen();
310 delete screen;
312 }
313
314 // current screen is destroyed in EDA_DRAW_FRAME
316
318 Pgm().GetSettingsManager().Save( cfg );
319
320 delete m_libMgr;
321}
322
323
325{
326 wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" );
327
329
330 GetRenderSettings()->m_ShowPinsElectricalType = m_settings->m_ShowPinElectricalType;
331 GetRenderSettings()->m_ShowHiddenPins = m_settings->m_ShowHiddenPins;
332 GetRenderSettings()->m_ShowHiddenFields = m_settings->m_ShowHiddenFields;
333 GetRenderSettings()->m_ShowPinAltIcons = m_settings->m_ShowPinAltIcons;
334 GetRenderSettings()->SetDefaultFont( wxEmptyString );
335}
336
337
339{
340 wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME:SaveSettings with null m_settings" );
341
343
345
346 m_settings->m_ShowPinElectricalType = GetRenderSettings()->m_ShowPinsElectricalType;
347 m_settings->m_ShowHiddenPins = GetRenderSettings()->m_ShowHiddenPins;
348 m_settings->m_ShowHiddenFields = GetRenderSettings()->m_ShowHiddenFields;
349 m_settings->m_ShowPinAltIcons = GetRenderSettings()->m_ShowPinAltIcons;
350
351 m_settings->m_LibWidth = m_treePane->GetSize().x;
352
353 m_settings->m_LibrarySortMode = GetLibTree()->GetSortMode();
354
355 m_settings->m_AuiPanels.properties_splitter = m_propertiesPanel->SplitterProportion();
356 bool prop_shown = m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
357 m_settings->m_AuiPanels.show_properties = prop_shown;
358
359 if( TOOL_MANAGER* toolMgr = GetToolManager() )
360 {
361 if( SCH_SELECTION_TOOL* selTool = toolMgr->GetTool<SCH_SELECTION_TOOL>() )
362 m_settings->m_SelectionFilter = selTool->GetFilter();
363 }
364}
365
366
368{
369 return static_cast<APP_SETTINGS_BASE*>( GetSettings() );
370}
371
372
374{
376
377 if( cfg && static_cast<SYMBOL_EDITOR_SETTINGS*>( cfg )->m_UseEeschemaColorSettings )
378 cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
379
380 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
381}
382
383
385{
386 // Create the manager and dispatcher & route draw panel events to the dispatcher
388 m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
389 GetCanvas()->GetViewControls(), GetSettings(), this );
390 m_actions = new SCH_ACTIONS();
392
393 // Register tools
394 m_toolManager->RegisterTool( new COMMON_CONTROL );
395 m_toolManager->RegisterTool( new COMMON_TOOLS );
396 m_toolManager->RegisterTool( new ZOOM_TOOL );
397 m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
398 m_toolManager->RegisterTool( new PICKER_TOOL );
399 m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
400 m_toolManager->RegisterTool( new SYMBOL_EDITOR_PIN_TOOL );
401 m_toolManager->RegisterTool( new SYMBOL_EDITOR_DRAWING_TOOLS );
402 m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
403 m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
404 m_toolManager->RegisterTool( new SYMBOL_EDITOR_MOVE_TOOL );
405 m_toolManager->RegisterTool( new SYMBOL_EDITOR_EDIT_TOOL );
406 m_toolManager->RegisterTool( new LIBRARY_EDITOR_CONTROL );
407 m_toolManager->RegisterTool( new SYMBOL_EDITOR_CONTROL );
408 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
409 m_toolManager->RegisterTool( new EMBED_TOOL );
410 m_toolManager->InitTools();
411
412 // Run the selection tool, it is supposed to be always active
413 m_toolManager->InvokeTool( "common.InteractiveSelection" );
414
416}
417
418
420{
422
423 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
424 EDITOR_CONDITIONS cond( this );
425
426 wxASSERT( mgr );
427
428#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
429#define CHECK( x ) ACTION_CONDITIONS().Check( x )
430
431 auto haveSymbolCond =
432 [this]( const SELECTION& )
433 {
434 return m_symbol;
435 };
436
437 auto isEditableCond =
438 [this]( const SELECTION& )
439 {
440 // Only root symbols from the new s-expression libraries or the schematic
441 // are editable.
442 return IsSymbolEditable() && !IsSymbolAlias();
443 };
444
445 auto isEditableInAliasCond =
446 [this]( const SELECTION& )
447 {
448 // Less restrictive than isEditableCond
449 // Symbols fields (root symbols and aliases) from the new s-expression libraries
450 // or in the schematic are editable.
451 return IsSymbolEditable();
452 };
453
454 auto symbolModifiedCondition =
455 [this]( const SELECTION& sel )
456 {
457 return m_libMgr && m_libMgr->IsSymbolModified( GetTargetLibId().GetLibItemName(),
458 GetTargetLibId().GetLibNickname() );
459 };
460
461 auto libSelectedCondition =
462 [this]( const SELECTION& sel )
463 {
464 return !GetTargetLibId().GetLibNickname().empty();
465 };
466
467 auto canEditProperties =
468 [this]( const SELECTION& sel )
469 {
471 };
472
473 auto symbolSelectedInTreeCondition =
474 [this]( const SELECTION& sel )
475 {
476 LIB_ID targetLibId = GetTargetLibId();
477 return !targetLibId.GetLibNickname().empty() && !targetLibId.GetLibItemName().empty();
478 };
479
480 auto saveSymbolAsCondition =
481 [this]( const SELECTION& aSel )
482 {
483 return getTargetSymbol() != nullptr;
484 };
485
486 const auto isSymbolFromSchematicCond =
487 [this]( const SELECTION& )
488 {
489 return IsSymbolFromSchematic();
490 };
491
492 // clang-format off
495 mgr->SetConditions( SCH_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
496 mgr->SetConditions( SCH_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) );
497 mgr->SetConditions( SCH_ACTIONS::saveSymbolCopyAs, ENABLE( saveSymbolAsCondition ) );
500 mgr->SetConditions( SCH_ACTIONS::editLibSymbolWithLibEdit, ENABLE( isSymbolFromSchematicCond ) );
501
502 mgr->SetConditions( ACTIONS::undo, ENABLE( haveSymbolCond && cond.UndoAvailable() ) );
503 mgr->SetConditions( ACTIONS::redo, ENABLE( haveSymbolCond && cond.RedoAvailable() ) );
504 mgr->SetConditions( ACTIONS::revert, ENABLE( symbolModifiedCondition ) );
505
508
509 mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );
510 mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) );
511 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( haveSymbolCond ) );
512 mgr->SetConditions( ACTIONS::paste, ENABLE( isEditableCond &&
514 mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
515 mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
516 mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
517 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( haveSymbolCond ) );
518
519 // These actions in symbol editor when editing alias field rotations are allowed.
520 mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( isEditableInAliasCond ) );
521 mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( isEditableInAliasCond ) );
522
523 mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( isEditableCond ) );
524 mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( isEditableCond ) );
525
528 // clang-format on
529
530 auto pinTypeCond =
531 [this]( const SELECTION& )
532 {
534 };
535
536 auto hiddenPinCond =
537 [this]( const SELECTION& )
538 {
540 };
541
542 auto hiddenFieldCond =
543 [this]( const SELECTION& )
544 {
546 };
547
548 auto showPinAltIconsCond =
549 [this]( const SELECTION& )
550 {
552 };
553
554 auto showLibraryTreeCond =
555 [this]( const SELECTION& )
556 {
557 return IsLibraryTreeShown();
558 };
559
560 auto propertiesCond =
561 [this] ( const SELECTION& )
562 {
563 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
564 };
565
568 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( showLibraryTreeCond ) );
569 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
570 mgr->SetConditions( SCH_ACTIONS::showHiddenPins, CHECK( hiddenPinCond ) );
571 mgr->SetConditions( SCH_ACTIONS::showHiddenFields, CHECK( hiddenFieldCond ) );
572 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltIconsCond ) );
573
574 auto multiUnitModeCond =
575 [this]( const SELECTION& )
576 {
577 return m_symbol && m_symbol->IsMultiUnit() && !m_symbol->UnitsLocked();
578 };
579
580 auto multiBodyStyleModeCond =
581 [this]( const SELECTION& )
582 {
583 return m_symbol && m_symbol->IsMultiBodyStyle();
584 };
585
586 auto syncedPinsModeCond =
587 [this]( const SELECTION& )
588 {
589 return m_SyncPinEdit;
590 };
591
592 auto haveDatasheetCond =
593 [this]( const SELECTION& )
594 {
595 return m_symbol && !m_symbol->GetDatasheetField().GetText().IsEmpty();
596 };
597
598 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
599 mgr->SetConditions( SCH_ACTIONS::symbolProperties, ENABLE( symbolSelectedInTreeCondition || ( canEditProperties && haveSymbolCond ) ) );
600 mgr->SetConditions( SCH_ACTIONS::runERC, ENABLE( haveSymbolCond ) );
601 mgr->SetConditions( SCH_ACTIONS::pinTable, ENABLE( isEditableCond && haveSymbolCond ) );
602 mgr->SetConditions( SCH_ACTIONS::updateSymbolFields, ENABLE( isEditableCond && haveSymbolCond ) );
603 mgr->SetConditions( SCH_ACTIONS::cycleBodyStyle, ENABLE( multiBodyStyleModeCond ) );
604
605 mgr->SetConditions( SCH_ACTIONS::toggleSyncedPinsMode, ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
606
607// Only enable a tool if the symbol is edtable
608#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
609
622
623#undef CHECK
624#undef ENABLE
625#undef EDIT_TOOL
626}
627
628
630{
631 if( IsContentModified() )
632 {
633 SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
634 wxString msg = _( "Save changes to '%s' before closing?" );
635
636 switch( UnsavedChangesDialog( this, wxString::Format( msg, m_reference ), nullptr ) )
637 {
638 case wxID_YES:
639 if( schframe && GetCurSymbol() ) // Should be always the case
641
642 break;
643
644 case wxID_NO:
645 break;
646
647 default:
648 case wxID_CANCEL:
649 return false;
650 }
651 }
652
653 if( doClose )
654 {
655 SetCurSymbol( nullptr, false );
656 UpdateTitle();
657 }
658
659 return true;
660}
661
662
663bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
664{
665 // Shutdown blocks must be determined and vetoed as early as possible
667 && aEvent.GetId() == wxEVT_QUERY_END_SESSION
668 && IsContentModified() )
669 {
670 return false;
671 }
672
674 return false;
675
676 if( !saveAllLibraries( true ) )
677 return false;
678
679 // Save symbol tree column widths
680 m_libMgr->GetAdapter()->SaveSettings();
681
682 return true;
683}
684
685
687{
689
690 if( GetLibTree() )
692
693 delete m_toolManager;
694 m_toolManager = nullptr;
695
696 Destroy();
697}
698
699
701{
702 if( m_unitSelectBox )
703 {
704 if( m_unitSelectBox->GetCount() != 0 )
705 m_unitSelectBox->Clear();
706
707 if( !m_symbol || m_symbol->GetUnitCount() <= 1 )
708 {
709 m_unit = 1;
710 m_unitSelectBox->Append( wxEmptyString );
711 }
712 else
713 {
714 for( int i = 0; i < m_symbol->GetUnitCount(); i++ )
715 m_unitSelectBox->Append( m_symbol->GetUnitDisplayName( i + 1, true ) );
716 }
717
718 // Ensure the selected unit is compatible with the number of units of the current symbol:
719 if( m_symbol && m_symbol->GetUnitCount() < m_unit )
720 m_unit = 1;
721
722 m_unitSelectBox->SetSelection( ( m_unit > 0 ) ? m_unit - 1 : 0 );
723 }
724
726 {
727 if( m_bodyStyleSelectBox->GetCount() != 0 )
728 m_bodyStyleSelectBox->Clear();
729
730 if( !m_symbol || !m_symbol->IsMultiBodyStyle() )
731 {
732 m_bodyStyle = 1;
733 m_bodyStyleSelectBox->Append( wxEmptyString );
734 }
735 else if( m_symbol && m_symbol->HasDeMorganBodyStyles() )
736 {
737 m_bodyStyleSelectBox->Append( wxGetTranslation( DEMORGAN_STD ) );
738 m_bodyStyleSelectBox->Append( wxGetTranslation( DEMORGAN_ALT ) );
739 }
740 else
741 {
742 for( int i = 0; i < m_symbol->GetBodyStyleCount(); i++ )
743 m_bodyStyleSelectBox->Append( m_symbol->GetBodyStyleNames()[i] );
744 }
745
746 // Ensure the selected body style is compatible with the number of body styles of the current symbol:
747 if( m_symbol && m_symbol->GetBodyStyleCount() < m_bodyStyle )
748 m_bodyStyle = 1;
749
750 m_bodyStyleSelectBox->SetSelection( ( m_bodyStyle > 0 ) ? m_bodyStyle - 1 : 0 );
751 }
752}
753
754
756{
757 if( !m_propertiesPanel )
758 return;
759
760 bool show = !m_propertiesPanel->IsShownOnScreen();
761
762 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
763 propertiesPaneInfo.Show( show );
765
766 if( show )
767 {
768 SetAuiPaneSize( m_auimgr, propertiesPaneInfo,
769 m_settings->m_AuiPanels.properties_panel_width, -1 );
770 }
771 else
772 {
773 m_settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
774 }
775
776 m_auimgr.Update();
777 Refresh();
778}
779
780
782{
783 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
784 treePane.Show( !IsLibraryTreeShown() );
786 m_auimgr.Update();
787 Refresh();
788}
789
790
792{
793 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
794}
795
796
801
802
804{
805 m_treePane->Freeze();
806 m_libMgr->GetAdapter()->Freeze();
807}
808
809
811{
812 m_libMgr->GetAdapter()->Thaw();
813 m_treePane->Thaw();
814}
815
816
817void SYMBOL_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
818{
819 Kiway().OnKiCadExit();
820}
821
822
823void SYMBOL_EDIT_FRAME::OnUpdateUnitNumber( wxUpdateUIEvent& event )
824{
825 event.Enable( m_symbol && m_symbol->GetUnitCount() > 1 );
826}
827
828
829void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
830{
831 if( event.GetSelection() == wxNOT_FOUND )
832 return;
833
834 SetUnit( event.GetSelection() + 1 );
835}
836
837
838void SYMBOL_EDIT_FRAME::OnUpdateBodyStyle( wxUpdateUIEvent& event )
839{
840 event.Enable( m_symbol && m_symbol->GetBodyStyleCount() > 1 );
841}
842
843
844void SYMBOL_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event )
845{
846 if( event.GetSelection() == wxNOT_FOUND )
847 return;
848
849 SetBodyStyle( event.GetSelection() + 1 );
850}
851
852
854{
855 if( m_symbol )
856 {
858
859 if( auto row = adapter->GetRow( m_symbol->GetLibNickname() ); row.has_value() )
860 {
861 if( ( *row )->Type() == SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) )
862 return true;
863 }
864 }
865
866 return false;
867}
868
869
871{
872 wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
873
874 if( !libNickname.empty() )
875 {
876 if( !PROJECT_SCH::SymbolLibAdapter( &Prj() )->HasLibrary( libNickname ) )
877 {
878 Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
879 libNickname = wxEmptyString;
880 }
881 }
882
883 return libNickname;
884}
885
886
887wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
888{
889 wxString old = GetCurLib();
890
891 if( aLibNickname.empty() || !PROJECT_SCH::SymbolLibAdapter( &Prj() )->HasLibrary( aLibNickname ) )
892 Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
893 else
895
896 return old;
897}
898
899
900void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
901{
902 wxCHECK( m_toolManager, /* void */ );
903
905 GetCanvas()->GetView()->Clear();
906 delete m_symbol;
907
908 m_symbol = aSymbol;
909
910 // select the current symbol in the tree widget
912 GetLibTree()->SelectLibId( m_symbol->GetLibId() );
913 else
914 GetLibTree()->Unselect();
915
916 wxString symbolName;
917 wxString libName;
918
919 if( m_symbol )
920 {
921 symbolName = m_symbol->GetName();
922 libName = UnescapeString( m_symbol->GetLibId().GetLibNickname() );
923 }
924
925 // retain in case this wxFrame is re-opened later on the same PROJECT
927
928 // Ensure synchronized pin edit can be enabled only symbols with interchangeable units
929 m_SyncPinEdit = aSymbol && aSymbol->IsRoot() && aSymbol->IsMultiUnit() && !aSymbol->UnitsLocked();
930
932
940
941 if( aUpdateZoom )
943
944 GetCanvas()->Refresh();
945 m_propertiesPanel->UpdateData();
946
947 WX_INFOBAR& infobar = *GetInfoBar();
948 infobar.RemoveAllButtons();
949
950 wxArrayString msgs;
951 int infobarFlags = wxICON_INFORMATION;
952
954 {
955 msgs.push_back( wxString::Format( _( "Editing symbol %s from schematic. Saving will "
956 "update the schematic only." ),
957 m_reference ) );
958
959 wxString link = wxString::Format( _( "Open symbol from library %s" ), libName );
960 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
961
962 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
963 [this, symbolName, libName]( wxHyperlinkEvent& aEvent )
964 {
966 } ) );
967
968 infobar.AddButton( button );
969 }
970 else if( IsSymbolFromLegacyLibrary() )
971 {
972 msgs.push_back( _( "Symbols in legacy libraries are not editable. Use Manage Symbol "
973 "Libraries to migrate to current format." ) );
974
975 wxString link = _( "Manage symbol libraries" );
976 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
977
978 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
979 [this]( wxHyperlinkEvent& aEvent )
980 {
982 } ) );
983
984 infobar.AddButton( button );
985 }
986 else if( IsSymbolAlias() )
987 {
988 msgs.push_back( wxString::Format( _( "Symbol %s is a derived symbol. Symbol graphics will "
989 "not be editable." ),
990 UnescapeString( symbolName ) ) );
991
992 // Don't assume the parent symbol shared pointer is still valid.
993 if( std::shared_ptr<LIB_SYMBOL> rootSymbol = m_symbol->GetRootSymbol() )
994 {
995 int unit = GetUnit();
996 int bodyStyle = GetBodyStyle();
997 wxString rootSymbolName = rootSymbol->GetName();
998 wxString link = wxString::Format( _( "Open %s" ), UnescapeString( rootSymbolName ) );
999
1000 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link,
1001 wxEmptyString );
1002
1003 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
1004 [this, rootSymbolName, unit, bodyStyle]( wxHyperlinkEvent& aEvent )
1005 {
1006 LoadSymbolFromCurrentLib( rootSymbolName, unit, bodyStyle );
1007 } ) );
1008
1009 infobar.AddButton( button );
1010 }
1011 }
1012
1013 if( m_symbol
1015 && m_libMgr->IsLibraryReadOnly( m_symbol->GetLibId().GetFullLibraryName() ) )
1016 {
1017 msgs.push_back( _( "Library is read-only. Changes cannot be saved to this library." ) );
1018
1019 wxString link = wxString::Format( _( "Create an editable copy" ) );
1020 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( &infobar, wxID_ANY, link, wxEmptyString );
1021
1022 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
1023 [this, symbolName, libName]( wxHyperlinkEvent& aEvent )
1024 {
1025 wxString msg = wxString::Format( _( "Create an editable copy of the symbol or "
1026 "the entire library (%s)?" ),
1027 libName );
1028
1029 KIDIALOG errorDlg( this, msg, _( "Select type of item to save" ),
1030 wxYES_NO | wxCANCEL | wxICON_QUESTION );
1031 // These buttons are in a weird order(?)
1032 errorDlg.SetYesNoCancelLabels( _( "Copy symbol" ), _( "Cancel" ),
1033 _( "Copy library" ) );
1034
1035 int choice = errorDlg.ShowModal();
1036
1037 switch( choice )
1038 {
1039 case wxID_YES:
1040 SaveSymbolCopyAs( true );
1041 break;
1042 case wxID_CANCEL:
1043 SaveLibraryAs();
1044 break;
1045 default:
1046 // Do nothing
1047 break;
1048 }
1049 } ) );
1050
1051 infobar.AddButton( button );
1052 }
1053
1054 if( msgs.empty() )
1055 {
1056 infobar.Dismiss();
1057 }
1058 else
1059 {
1060 wxString msg = wxJoin( msgs, '\n', '\0' );
1061 infobar.ShowMessage( msg, infobarFlags );
1062 }
1063}
1064
1065
1071
1072
1074{
1076
1078
1079 if( !IsSymbolFromSchematic() )
1081
1082 if( m_isClosing )
1083 return;
1084
1086
1087 if( !GetTitle().StartsWith( "*" ) )
1088 UpdateTitle();
1089}
1090
1091
1093{
1094 wxCHECK( aUnit > 0 && aUnit <= GetCurSymbol()->GetUnitCount(), /* void*/ );
1095
1096 if( m_unit == aUnit )
1097 return;
1098
1101
1102 m_unit = aUnit;
1103
1104 if( m_unitSelectBox->GetSelection() != ( m_unit - 1 ) )
1105 m_unitSelectBox->SetSelection( m_unit - 1 );
1106
1108 RebuildView();
1110}
1111
1112
1114{
1115 wxCHECK( aBodyStyle > 0 && aBodyStyle <= GetCurSymbol()->GetBodyStyleCount(), /* void */ );
1116
1117 if( m_bodyStyle == aBodyStyle )
1118 return;
1119
1122
1123 m_bodyStyle = aBodyStyle;
1124
1125 if( m_bodyStyleSelectBox->GetSelection() != ( m_bodyStyle - 1 ) )
1126 m_bodyStyleSelectBox->SetSelection( m_bodyStyle - 1 );
1127
1128
1130 RebuildView();
1132}
1133
1134
1136{
1137 return m_SyncPinEdit && m_symbol && m_symbol->IsMultiUnit() && !m_symbol->UnitsLocked();
1138}
1139
1140
1141wxString SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
1142{
1143 wxFileName fn = m_libMgr->GetUniqueLibraryName();
1144 bool useGlobalTable = true;
1145 FILEDLG_HOOK_NEW_LIBRARY tableChooser( useGlobalTable );
1146
1147 if( !LibraryFileBrowser( aCreateNew ? _( "New Symbol Library" ) : _( "Add Symbol Library" ),
1148 !aCreateNew, fn, FILEEXT::KiCadSymbolLibFileWildcard(),
1150 Pgm().GetSettingsManager().IsProjectOpenNotDummy() ? &tableChooser : nullptr ) )
1151 {
1152 return wxEmptyString;
1153 }
1154
1157
1158 LIBRARY_MANAGER& manager = Pgm().GetLibraryManager();
1159 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, scope );
1160
1161 wxCHECK( optTable.has_value(), wxEmptyString );
1162 LIBRARY_TABLE* table = optTable.value();
1163
1164 wxString libName = fn.GetName();
1165
1166 if( libName.IsEmpty() )
1167 return wxEmptyString;
1168
1170
1171 if( adapter->HasLibrary( libName ) )
1172 {
1173 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libName ) );
1174 return wxEmptyString;
1175 }
1176
1177 if( aCreateNew )
1178 {
1179 if( !m_libMgr->CreateLibrary( fn.GetFullPath(), scope ) )
1180 {
1181 DisplayError( this, wxString::Format( _( "Could not create the library file '%s'.\n"
1182 "Make sure you have write permissions and try again." ),
1183 fn.GetFullPath() ) );
1184 return wxEmptyString;
1185 }
1186 }
1187 else
1188 {
1189 if( !m_libMgr->AddLibrary( fn.GetFullPath(), scope ) )
1190 {
1191 DisplayError( this, _( "Could not open the library file." ) );
1192 return wxEmptyString;
1193 }
1194 }
1195
1196 bool success = true;
1197
1198 // Tables are reinitialized by m_libMgr->AddLibrary(). So reinit table reference.
1199 optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, scope );
1200 wxCHECK( optTable.has_value(), wxEmptyString );
1201 table = optTable.value();
1202
1203 table->Save().map_error(
1204 [&]( const LIBRARY_ERROR& aError )
1205 {
1206 KICAD_MESSAGE_DIALOG dlg( this, _( "Error saving library table." ), _( "File Save Error" ),
1207 wxOK | wxICON_ERROR );
1208 dlg.SetExtendedMessage( aError.message );
1209 dlg.ShowModal();
1210
1211 success = false;
1212 } );
1213
1214 if( success )
1215 adapter->LoadOne( fn.GetName() );
1216
1217 std::string packet = fn.GetFullPath().ToStdString();
1220
1221 return fn.GetFullPath();
1222}
1223
1224
1225void SYMBOL_EDIT_FRAME::DdAddLibrary( wxString aLibFile )
1226{
1227 wxFileName fn = wxFileName( aLibFile );
1228 wxString libName = fn.GetName();
1229
1230 if( libName.IsEmpty() )
1231 return;
1232
1233 LIBRARY_MANAGER& manager = Pgm().GetLibraryManager();
1235
1236 if( adapter->HasLibrary( libName ) )
1237 {
1238 DisplayError( this, wxString::Format( _( "Library '%s' already exists." ), libName ) );
1239 return;
1240 }
1241
1242 if( !m_libMgr->AddLibrary( fn.GetFullPath(), LIBRARY_TABLE_SCOPE::PROJECT ) )
1243 {
1244 DisplayError( this, _( "Could not open the library file." ) );
1245 return;
1246 }
1247
1248 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, LIBRARY_TABLE_SCOPE::PROJECT );
1249 wxCHECK( optTable.has_value(), /* void */ );
1250 LIBRARY_TABLE* table = optTable.value();
1251 bool success = true;
1252
1253 table->Save().map_error(
1254 [&]( const LIBRARY_ERROR& aError )
1255 {
1256 KICAD_MESSAGE_DIALOG dlg( this, _( "Error saving library table." ), _( "File Save Error" ),
1257 wxOK | wxICON_ERROR );
1258 dlg.SetExtendedMessage( aError.message );
1259 dlg.ShowModal();
1260
1261 success = false;
1262 } );
1263
1264 if( success )
1265 adapter->LoadOne( libName );
1266
1267 std::string packet = fn.GetFullPath().ToStdString();
1270}
1271
1272
1274{
1275 return GetLibTree()->GetSelectedLibId( aUnit );
1276}
1277
1278
1283
1284int SYMBOL_EDIT_FRAME::GetTreeLIBIDs( std::vector<LIB_ID>& aSelection ) const
1285{
1286 return GetLibTree()->GetSelectedLibIds( aSelection );
1287}
1288
1289
1291{
1292 if( IsLibraryTreeShown() )
1293 {
1294 LIB_ID libId = GetTreeLIBID();
1295
1296 if( libId.IsValid() )
1297 return m_libMgr->GetSymbol( libId.GetLibItemName(), libId.GetLibNickname() );
1298 }
1299
1300 return m_symbol;
1301}
1302
1303
1305{
1306 LIB_ID id;
1307
1308 if( IsLibraryTreeShown() )
1309 id = GetTreeLIBID();
1310
1311 if( id.GetLibNickname().empty() && m_symbol )
1312 id = m_symbol->GetLibId();
1313
1314 return id;
1315}
1316
1317
1318std::vector<LIB_ID> SYMBOL_EDIT_FRAME::GetSelectedLibIds() const
1319{
1320 std::vector<LIB_ID> ids;
1321 GetTreeLIBIDs( ids );
1322 return ids;
1323}
1324
1325
1327{
1328 return GetTargetLibId().GetLibNickname();
1329}
1330
1331
1332void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress, bool aPreloadCancelled,
1333 const wxString& aForceRefresh )
1334{
1335 LIB_ID selected;
1336
1337 if( m_treePane )
1338 selected = GetLibTree()->GetSelectedLibId();
1339
1340 // Ensure any in-progress background library preloading is complete before syncing the
1341 // tree. Without this, libraries still in LOADING state get skipped by Sync(), resulting
1342 // in an incomplete tree that requires a manual refresh to fully populate.
1344 adapter->BlockUntilLoaded();
1345
1346 if( aShowProgress )
1347 {
1348 APP_PROGRESS_DIALOG progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
1349 m_libMgr->GetAdapter()->GetLibrariesCount(), this );
1350
1351 m_libMgr->Sync( aForceRefresh,
1352 [&]( int progress, int max, const wxString& libName )
1353 {
1354 progressDlg.Update( progress, wxString::Format( _( "Loading library '%s'..." ), libName ) );
1355 } );
1356 }
1357 else if( !aPreloadCancelled )
1358 {
1359 m_libMgr->Sync( aForceRefresh,
1360 [&]( int progress, int max, const wxString& libName )
1361 {
1362 } );
1363 }
1364
1365 if( m_treePane )
1366 {
1367 wxDataViewItem found;
1368
1369 if( selected.IsValid() )
1370 {
1371 // Check if the previously selected item is still valid,
1372 // if not - it has to be unselected to prevent crash
1373 found = m_libMgr->GetAdapter()->FindItem( selected );
1374
1375 if( !found )
1376 GetLibTree()->Unselect();
1377 }
1378
1379 GetLibTree()->Regenerate( true );
1380
1381 // Try to select the parent library, in case the symbol is not found
1382 if( !found && selected.IsValid() )
1383 {
1384 selected.SetLibItemName( "" );
1385 found = m_libMgr->GetAdapter()->FindItem( selected );
1386
1387 if( found )
1388 GetLibTree()->SelectLibId( selected );
1389 }
1390
1391 // If no selection, see if there's a current symbol to centre
1392 if( !selected.IsValid() && m_symbol )
1393 {
1394 LIB_ID current( GetCurLib(), m_symbol->GetName() );
1395 GetLibTree()->CenterLibId( current );
1396 }
1397 }
1398}
1399
1400
1405
1406
1408{
1409 GetLibTree()->SelectLibId( aLibID );
1410}
1411
1412
1413void SYMBOL_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem, LIB_SYMBOL* aSymbol )
1414{
1415 if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
1416 // from file therefore not yet in tree.
1417 {
1418 static_cast<LIB_TREE_NODE_ITEM*>( aTreeItem.GetID() )->Update( aSymbol );
1420 }
1421}
1422
1423
1424bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt )
1425{
1426 if( aOriginalFile.FileExists() )
1427 {
1428 wxFileName backupFileName( aOriginalFile );
1429 backupFileName.SetExt( aBackupExt );
1430
1431 if( backupFileName.FileExists() )
1432 wxRemoveFile( backupFileName.GetFullPath() );
1433
1434 if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1435 {
1436 DisplayError( this, wxString::Format( _( "Failed to save backup to '%s'." ),
1437 backupFileName.GetFullPath() ) );
1438 return false;
1439 }
1440 }
1441
1442 return true;
1443}
1444
1445
1447{
1448 if( m_symbol && !GetCurLib().IsEmpty() && GetScreen()->IsContentModified() )
1449 m_libMgr->UpdateSymbol( m_symbol, GetCurLib() ); // UpdateSymbol() makes a copy
1450}
1451
1452
1454{
1455 // This will return the root symbol of any alias
1456 LIB_SYMBOL* symbol = m_libMgr->GetBufferedSymbol( aLibId.GetLibItemName(), aLibId.GetLibNickname() );
1457
1458 // Now we can compare the libId of the current symbol and the root symbol
1459 return ( symbol && m_symbol && symbol->GetLibId() == m_symbol->GetLibId() );
1460}
1461
1462
1464{
1465 GetLibTree()->Unselect();
1466 SetCurLib( wxEmptyString );
1467 SetCurSymbol( nullptr, false );
1471 Refresh();
1472}
1473
1474
1476{
1478
1480 {
1481 GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_ShowPinElectricalType;
1482 GetRenderSettings()->m_ShowHiddenPins = cfg->m_ShowHiddenPins;
1483 GetRenderSettings()->m_ShowHiddenFields = cfg->m_ShowHiddenFields;
1484 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_ShowPinAltIcons;
1485
1486 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1487 }
1488
1489 if( m_symbol )
1490 m_symbol->ClearCaches();
1491
1493
1495 GetCanvas()->Refresh();
1496
1498
1499 if( aFlags & ENVVARS_CHANGED )
1500 SyncLibraries( true );
1501
1502 Layout();
1503 SendSizeEvent();
1504}
1505
1506
1508{
1509 // call my base class
1511
1512 // tooltips in toolbars
1514
1515 // For some obscure reason, the AUI manager hides the first modified pane.
1516 // So force show panes
1517 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
1518 bool tree_shown = tree_pane_info.IsShown();
1519 tree_pane_info.Caption( _( "Libraries" ) );
1520 tree_pane_info.Show( tree_shown );
1521 m_auimgr.Update();
1522
1524
1525 // status bar
1527
1528 if( GetRenderSettings()->m_ShowPinsElectricalType )
1529 {
1531 GetCanvas()->Refresh();
1532 }
1533
1534 UpdateTitle();
1535}
1536
1537
1539{
1540 SCH_BASE_FRAME::SetScreen( aScreen );
1541
1542 // Let tools add things to the view if necessary
1543 if( m_toolManager )
1545}
1546
1547
1565
1566
1568{
1569 SyncLibraries( true );
1570
1571 if( m_symbol )
1572 {
1573 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
1574 SCH_SELECTION& selection = selectionTool->GetSelection();
1575
1576 for( SCH_ITEM& item : m_symbol->GetDrawItems() )
1577 {
1578 if( !alg::contains( selection, &item ) )
1579 item.ClearSelected();
1580 else
1581 item.SetSelected();
1582 }
1583
1584 m_symbol->ClearCaches();
1585 }
1586
1587 RebuildView();
1588}
1589
1590
1591const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1592{
1593 if( !m_symbol )
1594 {
1595 // Gives a reasonable drawing area size
1596 int width = schIUScale.mmToIU( 50 );
1597 int height = schIUScale.mmToIU( 30 );
1598
1599 return BOX2I( VECTOR2I( -width/2, -height/2 ), VECTOR2I( width, height ) );
1600 }
1601 else
1602 {
1603 return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_bodyStyle );
1604 }
1605}
1606
1607
1608void SYMBOL_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll )
1609{
1610 static KIID lastBrightenedItemID( niluuid );
1611
1612 SCH_ITEM* lastItem = nullptr;
1613
1614 // nullptr will clear the current focus
1615 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
1616 return;
1617
1618 if( m_symbol )
1619 {
1620 for( SCH_PIN* pin : m_symbol->GetGraphicalPins( 0, 0 ) )
1621 {
1622 if( pin->m_Uuid == lastBrightenedItemID )
1623 lastItem = pin;
1624 }
1625
1626 std::vector<SCH_FIELD*> fields;
1627 m_symbol->GetFields( fields );
1628
1629 for( SCH_FIELD* field : fields )
1630 {
1631 if( field->m_Uuid == lastBrightenedItemID )
1632 lastItem = field;
1633 }
1634 }
1635
1636 if( lastItem && lastItem != aItem )
1637 {
1638 lastItem->ClearBrightened();
1639
1640 UpdateItem( lastItem );
1641 lastBrightenedItemID = niluuid;
1642 }
1643
1644 if( aItem )
1645 {
1646 if( aItem->IsSCH_ITEM() )
1647 {
1648 SCH_ITEM* item = static_cast<SCH_ITEM*>( aItem );
1649
1650 if( int unit = item->GetUnit() )
1651 SetUnit( unit );
1652
1653 if( int bodyStyle = item->GetBodyStyle() )
1654 SetBodyStyle( bodyStyle );
1655 }
1656
1657 if( !aItem->IsBrightened() )
1658 {
1659 aItem->SetBrightened();
1660
1661 UpdateItem( aItem );
1662 lastBrightenedItemID = aItem->m_Uuid;
1663 }
1664
1665 FocusOnLocation( VECTOR2I( aItem->GetFocusPosition().x, aItem->GetFocusPosition().y ), aAllowScroll );
1666 }
1667}
1668
1669
1671{
1672 const std::string& payload = mail.GetPayload();
1673
1674 switch( mail.Command() )
1675 {
1676 case MAIL_LIB_EDIT:
1677 if( !payload.empty() )
1678 {
1679 wxString uri( payload );
1680 wxString libNickname;
1681 wxString msg;
1682
1684 std::optional<const LIBRARY_TABLE_ROW*> libTableRow = adapter->FindRowByURI( uri );
1685
1686 if( !libTableRow )
1687 {
1688 msg.Printf( _( "The current configuration does not include the symbol library '%s'." ),
1689 uri );
1690 msg += wxS( "\n" ) + _( "Use Manage Symbol Libraries to edit the configuration." );
1691 DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
1692 break;
1693 }
1694
1695 libNickname = ( *libTableRow )->Nickname();
1696
1697 if( !adapter->HasLibrary( libNickname, true ) )
1698 {
1699 msg.Printf( _( "The symbol library '%s' is not enabled in the current configuration." ),
1700 UnescapeString( libNickname ) );
1701 msg += wxS( "\n" ) + _( "Use Manage Symbol Libraries to edit the configuration." );
1702 DisplayErrorMessage( this, _( "Symbol library not enabled." ), msg );
1703 break;
1704 }
1705
1706 SetCurLib( libNickname );
1707
1708 if( m_treePane )
1709 {
1710 LIB_ID id( libNickname, wxEmptyString );
1711 GetLibTree()->SelectLibId( id );
1712 GetLibTree()->ExpandLibId( id );
1713 GetLibTree()->CenterLibId( id );
1714 }
1715 }
1716
1717 break;
1718
1719 case MAIL_RELOAD_LIB:
1720 {
1721 wxString currentLib = GetCurLib();
1722
1724
1725 // Check if the currently selected symbol library been removed or disabled.
1726 if( !currentLib.empty()
1727 && !PROJECT_SCH::SymbolLibAdapter( &Prj() )->HasLibrary( currentLib, true ) )
1728 {
1729 SetCurLib( wxEmptyString );
1730 emptyScreen();
1731 }
1732
1733 SyncLibraries( true );
1736
1737 break;
1738 }
1739
1741 {
1743 LIB_SYMBOL* symbol = GetCurSymbol();
1744
1745 wxLogTrace( traceLibWatch, "Received refresh symbol request for %s", payload );
1746
1747 if( !symbol )
1748 break;
1749
1750 wxString libName = symbol->GetLibId().GetLibNickname();
1751 std::optional<const LIBRARY_TABLE_ROW*> row = adapter->GetRow( libName );
1752
1753 if( !row )
1754 return;
1755
1756 wxFileName libfullname( LIBRARY_MANAGER::GetFullURI( *row, true ) );
1757
1758 wxFileName changedLib( mail.GetPayload() );
1759
1760 wxLogTrace( traceLibWatch, "Received refresh symbol request for %s, current symbols is %s",
1761 changedLib.GetFullPath(), libfullname.GetFullPath() );
1762
1763 if( changedLib == libfullname )
1764 {
1765 wxLogTrace( traceLibWatch, "Refreshing symbol %s", symbol->GetName() );
1766
1767 SetScreen( m_dummyScreen ); // UpdateLibraryBuffer will destroy the old screen
1768 m_libMgr->UpdateLibraryBuffer( libName );
1769
1770 if( LIB_SYMBOL* lib_symbol = m_libMgr->GetBufferedSymbol( symbol->GetName(), libName ) )
1771 {
1772 // The buffered screen for the symbol
1773 SCH_SCREEN* symbol_screen = m_libMgr->GetScreen( lib_symbol->GetName(), libName );
1774
1775 SetScreen( symbol_screen );
1776 SetCurSymbol( new LIB_SYMBOL( *lib_symbol ), false );
1778
1779 if( m_toolManager )
1781 }
1782 }
1783
1784 break;
1785 }
1786
1787 default:
1788 break;
1789 }
1790}
1791
1792
1793std::unique_ptr<GRID_HELPER> SYMBOL_EDIT_FRAME::MakeGridHelper()
1794{
1795 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1796}
1797
1798
1800{
1801 // switches currently used canvas ( Cairo / OpenGL):
1802 SCH_BASE_FRAME::SwitchCanvas( aCanvasType );
1803
1804 // Set options specific to symbol editor (axies are always enabled):
1805 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1807}
1808
1809
1811{
1812 wxCHECK( m_libMgr, false );
1813
1814 return m_libMgr->HasModifications();
1815}
1816
1817
1819{
1820 wxCHECK( m_libMgr, false );
1821
1822 // Test if the currently edited symbol is modified
1824 return true;
1825
1826 // Test if any library has been modified
1827 for( const wxString& libName : m_libMgr->GetLibraryNames() )
1828 {
1829 if( m_libMgr->IsLibraryModified( libName ) && !m_libMgr->IsLibraryReadOnly( libName ) )
1830 return true;
1831 }
1832
1833 return false;
1834}
1835
1836
1838{
1839 if( aItemCount == 0 )
1840 return;
1841
1842 UNDO_REDO_CONTAINER& list = ( whichList == UNDO_LIST ) ? m_undoList : m_redoList;
1843
1844 if( aItemCount < 0 )
1845 {
1846 list.ClearCommandList();
1847 }
1848 else
1849 {
1850 for( int ii = 0; ii < aItemCount; ii++ )
1851 {
1852 if( list.m_CommandsList.size() == 0 )
1853 break;
1854
1855 PICKED_ITEMS_LIST* curr_cmd = list.m_CommandsList[0];
1856 list.m_CommandsList.erase( list.m_CommandsList.begin() );
1857
1858 curr_cmd->ClearListAndDeleteItems( []( EDA_ITEM* aItem )
1859 {
1860 delete aItem;
1861 } );
1862 delete curr_cmd; // Delete command
1863 }
1864 }
1865}
1866
1867
1869{
1870 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
1871}
1872
1873
1875{
1876 std::unique_ptr<LIB_SYMBOL> symbol = aSymbol->GetLibSymbolRef()->Flatten();
1877 wxCHECK( symbol, /* void */ );
1878
1879 symbol->SetLibId( aSymbol->GetLibId() );
1880
1881 // Take in account the symbol orientation and mirroring. to calculate the field
1882 // positions in symbol editor (i.e. no rotation, no mirroring)
1883 int orientation = aSymbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
1884 int mirror = aSymbol->GetOrientation() & ( SYM_MIRROR_X | SYM_MIRROR_Y );
1885
1886 std::vector<SCH_FIELD> fullSetOfFields;
1887
1888 for( const SCH_FIELD& field : aSymbol->GetFields() )
1889 {
1890 VECTOR2I pos = field.GetPosition() - aSymbol->GetPosition();
1891 SCH_FIELD libField( symbol.get(), field.GetId() );
1892
1893 libField = field;
1894
1895 // The inverse transform is mirroring before, rotate after
1896 switch( mirror )
1897 {
1898 case SYM_MIRROR_X: pos.y = -pos.y; break;
1899 case SYM_MIRROR_Y: pos.x = -pos.x; break;
1900 default: break;
1901 }
1902
1903 switch( orientation )
1904 {
1905 case SYM_ORIENT_90:
1906 std::swap( pos.x, pos.y );
1907 pos.x = - pos.x;
1908 break;
1909 case SYM_ORIENT_270:
1910 std::swap( pos.x, pos.y );
1911 pos.y = - pos.y;
1912 break;
1913 case SYM_ORIENT_180:
1914 pos.x = - pos.x;
1915 pos.y = - pos.y;
1916 break;
1917 default:
1918 break;
1919 }
1920
1921 libField.SetPosition( pos );
1922
1923 fullSetOfFields.emplace_back( std::move( libField ) );
1924 }
1925
1926 symbol->SetFields( fullSetOfFields );
1927
1928 if( m_symbol )
1929 SetCurSymbol( nullptr, false );
1930
1932 m_schematicSymbolUUID = aSymbol->m_Uuid;
1933 m_reference = symbol->GetReferenceField().GetText();
1934 m_unit = std::max( 1, aSymbol->GetUnit() );
1935 m_bodyStyle = std::max( 1, aSymbol->GetBodyStyle() );
1936
1937 // Optimize default edit options for this symbol
1938 // Usually if units are locked, graphic items are specific to each unit
1939 // and if units are interchangeable, graphic items are common to units
1941 tools->SetDrawSpecificUnit( symbol->UnitsLocked() );
1942
1943 // The buffered screen for the symbol
1944 SCH_SCREEN* tmpScreen = new SCH_SCREEN();
1945
1946 SetScreen( tmpScreen );
1947 SetCurSymbol( symbol.release(), true );
1948 setSymWatcher( nullptr );
1949
1952
1953 if( IsLibraryTreeShown() )
1955
1956 UpdateTitle();
1959
1960 // Let tools add things to the view if necessary
1961 if( m_toolManager )
1963
1965 GetCanvas()->Refresh();
1966}
1967
1968
1969bool SYMBOL_EDIT_FRAME::addLibTableEntry( const wxString& aLibFile, LIBRARY_TABLE_SCOPE aScope )
1970{
1971 wxFileName fn = aLibFile;
1972 wxFileName libTableFileName( Prj().GetProjectPath(), FILEEXT::SymbolLibraryTableFileName );
1973 wxString libNickname = fn.GetName();
1975 LIBRARY_MANAGER& manager = Pgm().GetLibraryManager();
1976 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1977
1978 if( adapter->HasLibrary( libNickname ) )
1979 {
1980 wxString tmp;
1981 int suffix = 1;
1982
1983 while( adapter->HasLibrary( libNickname ) )
1984 {
1985 tmp.Printf( "%s%d", fn.GetName(), suffix );
1986 libNickname = tmp;
1987 suffix += 1;
1988 }
1989 }
1990
1991 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, aScope );
1992 wxCHECK( optTable.has_value(), false );
1993 LIBRARY_TABLE* table = optTable.value();
1994
1995 LIBRARY_TABLE_ROW* row = &table->InsertRow();
1996
1997 row->SetNickname( libNickname );
1998
1999 // We cannot normalize against the current project path when saving to global table.
2000 wxString normalizedPath = NormalizePath( aLibFile, &envVars,
2001 aScope == LIBRARY_TABLE_SCOPE::PROJECT ? Prj().GetProjectPath()
2002 : wxString( wxEmptyString ) );
2003
2004 row->SetURI( normalizedPath );
2006
2007 bool success = true;
2008
2009 table->Save().map_error(
2010 [&]( const LIBRARY_ERROR& aError )
2011 {
2012 KICAD_MESSAGE_DIALOG dlg( this, _( "Error saving library table." ), _( "File Save Error" ),
2013 wxOK | wxICON_ERROR );
2014 dlg.SetExtendedMessage( aError.message );
2015 dlg.ShowModal();
2016
2017 success = false;
2018 } );
2019
2020 if( success )
2021 {
2022 manager.ReloadTables( aScope, { LIBRARY_TABLE_TYPE::SYMBOL } );
2023 adapter->LoadOne( libNickname );
2024 }
2025
2026 return success;
2027}
2028
2029
2030bool SYMBOL_EDIT_FRAME::replaceLibTableEntry( const wxString& aLibNickname, const wxString& aLibFile )
2031{
2033 LIBRARY_MANAGER& manager = Pgm().GetLibraryManager();
2034 LIBRARY_TABLE* table = nullptr;
2036
2037 // Check the global library table first because checking the project library table
2038 // checks the global library table as well due to library chaining.
2039 if( adapter->GetRow( aLibNickname, scope ) )
2040 {
2041 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, scope );
2042 wxCHECK( optTable.has_value(), false );
2043 table = optTable.value();
2044 }
2045 else
2046 {
2048
2049 if( adapter->GetRow( aLibNickname, scope ) )
2050 {
2051 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, scope );
2052
2053 if( optTable.has_value() )
2054 table = optTable.value();
2055 }
2056 }
2057
2058 wxCHECK( table, false );
2059
2060 std::optional<LIBRARY_TABLE_ROW*> optRow = adapter->GetRow( aLibNickname, scope );
2061 wxCHECK( optRow.has_value(), false );
2062 LIBRARY_TABLE_ROW* row = optRow.value();
2063
2064 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
2065
2066 wxString projectPath;
2067
2068 if( scope == LIBRARY_TABLE_SCOPE::PROJECT )
2069 projectPath = Prj().GetProjectPath();
2070
2071 wxString normalizedPath = NormalizePath( aLibFile, &envVars, projectPath );
2072
2073 row->SetURI( normalizedPath );
2074 row->SetType( "KiCad" );
2075
2076 bool success = true;
2077
2078 table->Save().map_error(
2079 [&]( const LIBRARY_ERROR& aError )
2080 {
2081 KICAD_MESSAGE_DIALOG dlg( this, _( "Error saving library table." ), _( "File Save Error" ),
2082 wxOK | wxICON_ERROR );
2083 dlg.SetExtendedMessage( aError.message );
2084 dlg.ShowModal();
2085
2086 success = false;
2087 } );
2088
2089 if( success )
2090 {
2091 manager.ReloadTables( scope, { LIBRARY_TABLE_TYPE::SYMBOL } );
2092 adapter->LoadOne( aLibNickname );
2093 }
2094
2095 return success;
2096}
2097
2098
2100{
2101 return m_symbol && !m_symbol->IsRoot();
2102}
2103
2104
2109
2110
2111void SYMBOL_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2112{
2113 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2114
2115 if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem ) )
2116 {
2117 eda_text->ClearBoundingBoxCache();
2118 eda_text->ClearRenderCache();
2119 }
2120}
2121
2122
2124{
2125 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
2126 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
2127 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
2128
2129 // Don't give the selection filter its own visibility controls; instead show it if
2130 // anything else is visible
2131 bool showFilter = ( treePane.IsShown() && treePane.IsDocked() )
2132 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
2133
2134 selectionFilterPane.Show( showFilter );
2135}
2136
2137
2139{
2140 // Returns the current render option for invisible fields
2142}
2143
2144
2146{
2147 // Returns the current render option for invisible pins
2149}
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_16
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
BOX2< VECTOR2D > BOX2D
Definition box2.h:923
static TOOL_ACTION toggleGrid
Definition actions.h:198
static TOOL_ACTION paste
Definition actions.h:80
static TOOL_ACTION cancelInteractive
Definition actions.h:72
static TOOL_ACTION unselectAll
Definition actions.h:83
static TOOL_ACTION revert
Definition actions.h:62
static TOOL_ACTION showLibraryTree
Definition actions.h:164
static TOOL_ACTION copy
Definition actions.h:78
static TOOL_ACTION showDatasheet
Definition actions.h:267
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:157
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 doDelete
Definition actions.h:85
static TOOL_ACTION selectionTool
Definition actions.h:251
static TOOL_ACTION save
Definition actions.h:58
static TOOL_ACTION zoomFitScreen
Definition actions.h:142
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION deleteTool
Definition actions.h:86
static TOOL_ACTION zoomTool
Definition actions.h:146
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:224
static TOOL_ACTION showProperties
Definition actions.h:266
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:199
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.
wxString m_ColorTheme
Active color theme name.
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...
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
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
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...
ACTION_TOOLBAR * m_tbRight
TOOLBAR_SETTINGS * m_toolbarSettings
wxAuiManager m_auimgr
virtual void RecreateToolbars()
UNDO_REDO_CONTAINER m_redoList
ACTION_TOOLBAR * m_tbLeft
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
ACTION_TOOLBAR * m_tbTopMain
wxString m_aboutTitle
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
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void setupUnits(APP_SETTINGS_BASE *aCfg)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual void resolveCanvasType()
Determine the canvas type to load (with prompt if required) and initializes m_canvasType.
static const wxString PropertiesPaneName()
EDA_MSG_PANEL * m_messagePanel
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)
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
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:99
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition eda_item.h:285
const KIID m_Uuid
Definition eda_item.h:522
void ClearBrightened()
Definition eda_item.h:144
void SetBrightened()
Definition eda_item.h:141
bool IsBrightened() const
Definition eda_item.h:130
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
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 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.
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition kidialog.h:42
int ShowModal() override
Definition kidialog.cpp:93
bool m_axesEnabled
Crosshair drawing mode.
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:1148
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition view.cpp:1576
Definition kiid.h:49
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:38
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition kiway_mail.h:56
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition kiway_mail.h:48
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:295
void OnKiCadExit()
Definition kiway.cpp:760
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:407
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:505
Module editor specific tools.
std::optional< LIBRARY_TABLE_ROW * > FindRowByURI(const wxString &aUri, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::FindRowByURI but filtered to the LIBRARY_TABLE_TYPE of this adapter.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library tables.
std::optional< LIBRARY_TABLE_ROW * > GetRow(const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
void ReloadTables(LIBRARY_TABLE_SCOPE aScope, std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
std::optional< LIBRARY_TABLE * > Table(LIBRARY_TABLE_TYPE aType, LIBRARY_TABLE_SCOPE aScope)
Retrieves a given table; creating a new empty project table if a valid project is loaded and the give...
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
void SetURI(const wxString &aUri)
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
Symbol library management helper that is specific to the symbol library editor frame.
Define a library symbol object.
Definition lib_symbol.h:83
const LIB_ID & GetLibId() const override
Definition lib_symbol.h:152
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition lib_symbol.h:287
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition lib_symbol.h:202
wxString GetName() const override
Definition lib_symbol.h:145
bool IsMultiUnit() const override
Definition lib_symbol.h:770
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Node type: LIB_ID.
void Update(LIB_TREE_ITEM *aItem)
Update the node using data from a LIB_ALIAS object.
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:92
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:156
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:787
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:131
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:133
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...
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
@ SCH_LIBEDIT_CUR_LIB
Definition project.h:221
@ SCH_LIBEDIT_CUR_SYMBOL
Definition project.h:222
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:177
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:349
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:360
Action handler for the Properties panel.
Gather all the actions that are shared by tools.
Definition sch_actions.h:40
static TOOL_ACTION rotateCCW
static TOOL_ACTION importSymbol
static TOOL_ACTION newSymbol
static TOOL_ACTION saveLibraryAs
static TOOL_ACTION mirrorV
static TOOL_ACTION editLibSymbolWithLibEdit
static TOOL_ACTION drawArc
Definition sch_actions.h:97
static TOOL_ACTION pinTable
static TOOL_ACTION drawSymbolLines
static TOOL_ACTION placeSymbolPin
static TOOL_ACTION drawSymbolTextBox
static TOOL_ACTION drawRectangle
Definition sch_actions.h:95
static TOOL_ACTION drawCircle
Definition sch_actions.h:96
static TOOL_ACTION importGraphics
static TOOL_ACTION drawBezier
Definition sch_actions.h:98
static TOOL_ACTION saveSymbolCopyAs
static TOOL_ACTION rotateCW
static TOOL_ACTION showElectricalTypes
static TOOL_ACTION drawSymbolPolygon
static TOOL_ACTION showHiddenFields
static TOOL_ACTION placeSymbolAnchor
static TOOL_ACTION showHiddenPins
static TOOL_ACTION cycleBodyStyle
static TOOL_ACTION mirrorH
static TOOL_ACTION runERC
Inspection and Editing.
static TOOL_ACTION symbolProperties
static TOOL_ACTION placeSymbolText
static TOOL_ACTION toggleSyncedPinsMode
static TOOL_ACTION togglePinAltIcons
static TOOL_ACTION updateSymbolFields
static TOOL_ACTION saveSymbolAs
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
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.
void SyncView()
Mark all items for refresh.
PANEL_SCH_SELECTION_FILTER * m_selectionFilterPanel
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
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.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a symbol library using the file extension of aLibPath.
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
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:76
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
VECTOR2I GetPosition() const override
Definition sch_symbol.h:867
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:165
int GetOrientation() const override
Get the display symbol orientation.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:184
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.
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.
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.
void OnSelectBodyStyle(wxCommandEvent &event)
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
void RebuildSymbolUnitAndBodyStyleLists()
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
void HardRedraw() override
Rebuild the GAL and redraw the screen.
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
int GetTreeSelectionCount() const
bool addLibTableEntry(const wxString &aLibFile, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::GLOBAL)
Add aLibFile to the symbol library table defined by aScope.
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
void SetScreen(BASE_SCREEN *aScreen) override
void KiwayMailIn(KIWAY_MAIL_EVENT &mail) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
SYMBOL_EDITOR_SETTINGS * GetSettings() const
SCH_SCREEN * m_dummyScreen
< Helper screen used when no symbol is loaded
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)
SYMBOL_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
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...
void SetBodyStyle(int aBodyStyle)
int m_bodyStyle
Flag if the symbol being edited was loaded directly from a schematic.
bool saveAllLibraries(bool aRequireConfirmation)
Save the current symbol.
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 OnUpdateBodyStyle(wxUpdateUIEvent &event)
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 FocusOnItem(EDA_ITEM *aItem, bool aAllowScroll=true) override
Focus on a particular canvas item.
void configureToolbars() override
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
wxComboBox * m_bodyStyleSelectBox
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 ShowChangedLanguage() override
Redraw the menus and what not in current language.
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)
An interface to the global shared library manager that is schematic-specific and linked to one projec...
std::optional< LIB_STATUS > LoadOne(LIB_DATA *aLib) override
Loads or reloads the given library, if it exists.
Library Editor pane with symbol tree and symbol library table selector.
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
@ 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:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
A holder to handle a list of undo (or redo) commands.
bool empty() const
Definition utf8.h:109
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:77
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
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:177
This file is part of the common library.
#define KICAD_MESSAGE_DIALOG
Definition confirm.h:52
#define CHECK(x)
#define ENABLE(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:65
@ ID_LIBEDIT_SELECT_BODY_STYLE
Definition eeschema_id.h:66
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 SymbolLibraryTableFileName
static const std::string KiCadSymbolLibFileExtension
static wxString KiCadSymbolLibFileWildcard()
const wxChar *const traceLibWatch
Flag to enable debug output for library file watch refreshes.
@ ID_ON_GRID_SELECT
Definition id.h:113
@ ID_ON_ZOOM_SELECT
Definition id.h:112
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition kicad.cpp:642
KIID niluuid(0)
@ LAYER_SCHEMATIC_GRID_AXES
Definition layer_ids.h:487
LIBRARY_TABLE_SCOPE
@ 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
#define _HKI(x)
Definition page_info.cpp:44
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.
see class PGM_BASE
#define DEFAULT_THEME
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
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 ...
wxString message
@ 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)
#define DEMORGAN_ALT
#define DEMORGAN_STD
KIBIS_PIN * pin
#define ENVVARS_CHANGED
wxLogTrace helper definitions.
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.