KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_edit_frame.h
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) 2014 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 * Copyright (C) 2017 CERN
8 * @author Maciej Suminski <[email protected]>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef SYMBOL_EDIT_FRAME_H
25#define SYMBOL_EDIT_FRAME_H
26
27#include <sch_base_frame.h>
28#include <sch_screen.h>
29#include <symbol_tree_pane.h>
31#include <memory>
32#include <optional>
33#include <vector>
34
35class SCH_EDIT_FRAME;
36class LIB_SYMBOL;
37class LIB_TREE_NODE;
38class LIB_ID;
44class EDA_LIST_DIALOG;
46
47
48#define UNITS_ALL _HKI( "ALL" )
49#define DEMORGAN_ALL _HKI( "ALL" )
50#define DEMORGAN_STD _HKI( "Standard" )
51#define DEMORGAN_ALT _HKI( "Alternate" )
52
53
58{
59 // Lets the headless tab tests drive the static undo/redo helpers without a full GUI frame.
61
62public:
63 SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
64
65 ~SYMBOL_EDIT_FRAME() override;
66
67 std::unique_ptr<GRID_HELPER> MakeGridHelper() override;
68
72 void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
73
79 bool IsContentModified() const override;
80
89 bool HasLibModifications() const;
90
91 bool CanCloseSymbolFromSchematic( bool doClose );
92
96 wxString GetCurLib() const;
97
101 wxString SetCurLib( const wxString& aLibNickname );
102
103 LIB_TREE* GetLibTree() const override { return m_treePane->GetLibTree(); }
104
109
113 void OnTabCharHook( wxKeyEvent& aEvent );
114
118 void clearSymbolTabsModifiedForLibrary( const wxString& aLibrary );
119
124 static void clearTabModifiedState( SYMBOL_EDITOR_TAB_CONTEXT& aContext, EDITOR_TABS_MODEL& aModel );
125
129 static void clearSymbolTabUndoRedo( SYMBOL_EDITOR_TAB_CONTEXT& aContext );
130
135 static void freeTransientUndoCommands( UNDO_REDO_CONTAINER& aList, const LIB_SYMBOL* aLiveSymbol );
136
142 static bool libTreeAutoHiddenForSchematicEdit( bool aWasFromSchematic, bool aRestorePending,
143 bool aTreeShownNow );
144
148 LIB_ID GetTreeLIBID( int* aUnit = nullptr ) const;
149
150 int GetTreeSelectionCount() const;
151
152 int GetTreeLIBIDs( std::vector<LIB_ID>& aSelection ) const;
153
159 LIB_SYMBOL* GetCurSymbol() const { return m_symbol; }
160
164 void SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom );
165
167
168 SELECTION& GetCurrentSelection() override;
169
170 // See comments for m_SyncPinEdit.
171 bool SynchronizePins();
172
176 wxString AddLibraryFile( bool aCreateNew );
177
181 void DdAddLibrary( wxString aLibFile );
182
189 void CreateNewSymbol( const wxString& newName = wxEmptyString );
190
191 void ImportSymbol();
192 void ExportSymbol();
193
197 void Save();
198
202 void SaveSymbolCopyAs( bool aOpenCopy );
203
207 void SaveLibraryAs();
208
212 void SaveAll();
213
217 void Revert( bool aConfirm = true );
218 void RevertAll();
219
221
226 void RenameSymbolTab( const LIB_ID& aOldId, const LIB_ID& aNewId );
227
229
230 void LoadSymbol( const wxString& aLibrary, const wxString& aSymbol, int Unit );
231
237 void DuplicateSymbol( bool aFromClipboard );
238
239 void OnSelectUnit( wxCommandEvent& event );
240 void OnSelectBodyStyle( wxCommandEvent& event );
241
242 void ToggleProperties() override;
243
244 void ToggleLibraryTree() override;
245 bool IsLibraryTreeShown() const override;
246 void FocusLibraryTreeInput() override;
247 void FreezeLibraryTree();
248 void ThawLibraryTree();
249
251
252 void OnUpdateUnitNumber( wxUpdateUIEvent& event );
253 void OnUpdateBodyStyle( wxUpdateUIEvent& event );
254
255 void UpdateAfterSymbolProperties( wxString* aOldName = nullptr );
257
258 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
259 void doCloseWindow() override;
260 void OnExitKiCad( wxCommandEvent& event );
261
262 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
263 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
264
266 {
267 return m_settings;
268 }
269
270 APP_SETTINGS_BASE* config() const override;
271
272 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
273
280 void CloseWindow( wxCommandEvent& event )
281 {
282 // Generate a wxCloseEvent
283 Close( false );
284 }
285
290 void OnModify() override;
291
292 int GetUnit() const { return m_unit; }
293 void SetUnit( int aUnit );
294
295 int GetBodyStyle() const { return m_bodyStyle; }
296 void SetBodyStyle( int aBodyStyle );
297
300
301 void ClearMsgPanel() override
302 {
304 }
305
306 void UpdateMsgPanel() override
307 {
309 }
310
315 void UpdateTitle();
316
318 {
319 // If we've already vetted closing this window, then we have no symbol anymore
320 if( m_isClosing )
321 return false;
322
324 }
325
326 bool IsSymbolFromLegacyLibrary() const;
327
332
333 // General editing
340 void SaveCopyInUndoList( const wxString& aDescription, LIB_SYMBOL* aSymbol,
341 UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT );
342
343 void PushSymbolToUndoList( const wxString& aDescription, LIB_SYMBOL* aSymbolCopy,
344 UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT );
345
348
361 void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
362
371 bool LoadSymbol( const LIB_ID& aLibId, int aUnit, int aBodyStyle );
372
378 void SVGPlotSymbol( const wxString& aFullFileName, const VECTOR2I& aOffset );
379
384 void SyncLibraries( bool aShowProgress, bool aPreloadCancelled = false,
385 const wxString& aForceRefresh = wxEmptyString );
386
390 void RefreshLibraryTree();
391
395 void UpdateLibraryTree( const wxDataViewItem& aTreeItem, LIB_SYMBOL* aSymbol );
396
401 LIB_ID GetTargetLibId() const override;
402
406 std::vector<LIB_ID> GetSelectedLibIds() const;
407
408 void FocusOnLibId( const LIB_ID& aLibID );
409
413 void CommonSettingsChanged( int aFlags ) override;
414
415 void ShowChangedLanguage() override;
416
417 void SetScreen( BASE_SCREEN* aScreen ) override;
418
419 const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
420
421 void RebuildView();
422
423 void UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete = false,
424 bool aUpdateRtree = false ) override;
425
429 void HardRedraw() override;
430
431 void KiwayMailIn( KIWAY_MAIL_EVENT& mail ) override;
432
433 void FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll = true ) override;
434
440 void LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol );
441
452 bool IsSymbolEditable() const;
453
454 bool IsSymbolAlias() const;
455
457 bool IsCurrentSymbol( const LIB_ID& aLibId ) const;
458
460 void emptyScreen();
461
462 void ClearToolbarControl( int aId ) override;
463
464protected:
465 void configureToolbars() override;
466 void setupUIConditions() override;
467
468 void doReCreateMenuBar() override;
469
470 void updateSelectionFilterVisbility() override;
471
472private:
473 // Set up the tool framework
474 void setupTools();
475
476 void saveSymbolCopyAs( bool aOpenCopy );
477
488 bool saveLibrary( const wxString& aLibrary, bool aNewFile );
489
496 void SelectActiveLibrary( const wxString& aLibrary = wxEmptyString );
497
507 bool LoadSymbolFromCurrentLib( const wxString& aSymbolName, int aUnit = 0, int aBodyStyle = 0 );
508
519 bool LoadOneLibrarySymbolAux( LIB_SYMBOL* aLibEntry, const wxString& aLibrary, int aUnit,
520 int aBodyStyle );
521
523 bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
524
527
530 wxString getTargetLib() const;
531
532 void centerItemIdleHandler( wxIdleEvent& aEvent );
533
534 /*
535 * Return true when the operation has succeeded (all requested libraries have been saved
536 * or none was selected and confirmed by OK).
537 *
538 * @param aRequireConfirmation when true, the user must be asked to confirm.
539 */
540 bool saveAllLibraries( bool aRequireConfirmation );
541
543 bool saveCurrentSymbol();
544
546 void storeCurrentSymbol();
547
549 void ensureUniqueName( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
550
560 bool addLibTableEntry( const wxString& aLibFile,
562
573 bool replaceLibTableEntry( const wxString& aLibNickname, const wxString& aLibFile );
574
579
585
589 SYMBOL_EDITOR_TAB_CONTEXT* findOrCreateSymbolTab( const wxString& aLib, const wxString& aName,
590 int aUnit, int aBodyStyle, bool aAsPreview,
591 bool* aWasCreated = nullptr );
592
602 const KIID& aSchematicSymbolUUID,
603 const wxString& aReference, int aUnit,
604 int aBodyStyle );
605
611
615 SYMBOL_EDITOR_TAB_CONTEXT* symbolTabContextForKey( const wxString& aKey ) const;
616
621 void dropSymbolTabContext( const wxString& aKey );
622
626 bool promptAndCloseSymbolTab( int aIdx );
627
634
639 bool hasDirtyInactiveInstanceTabs() const;
640
646
651 void closeSymbolTab( const LIB_ID& aLibId );
652
657
662
666 std::vector<KIID> captureSymbolSelectionKiids() const;
667
671 void restoreSymbolSelectionKiids( const std::vector<KIID>& aKiids );
672
677
682
683 DECLARE_EVENT_TABLE()
684
685public:
708
709private:
712
713 LIB_SYMBOL* m_symbol; // a symbol I own, it is not in any library, but a copy could be.
714 wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the
715 // symbol has multiple units)
716 wxComboBox* m_bodyStyleSelectBox; // a ComboBox to select a body style to edit (if the symbol has
717 // multiple body styles)
718 SYMBOL_TREE_PANE* m_treePane; // symbol search tree widget
719 LIB_SYMBOL_LIBRARY_MANAGER* m_libMgr; // manager taking care of temporary modifications
720 SYMBOL_EDITOR_SETTINGS* m_settings; // Handle to the settings
721
722 // Tabbed editing. One context per open symbol, owning a working symbol/screen copy plus its
723 // per-tab undo/redo and view/selection snapshot. The active tab lends its objects to the frame
724 // and reclaims them on detach. m_activeTab is the context currently bound to the frame.
728
729 // Guards against re-entering tab activation while a tab is being created or restored, since
730 // AddTab() activates synchronously.
731 bool m_loadingSymbolTab = false;
732
733 // While true, promptAndCloseSymbolTab() skips the unsaved-changes dialog.
735
737
738 // The unit number to edit and show
740
741 // Show the normal shape (m_bodyStyle <= 1) or the DeMorgan converted shape (m_bodyStyle > 1)
743
746
749
751
753 wxString m_reference;
754
755 // True to force DeMorgan/normal tools selection enabled.
756 // They are enabled when the loaded symbol has graphic items for converted shape
757 // But under some circumstances (New symbol created) these tools must left enabled
758 static bool m_showDeMorgan;
759
760 // Guard against re-entrant SyncLibraries calls. The progress dialog used during sync
761 // yields the event loop, which can dispatch queued UI events (e.g. menu clicks that
762 // accumulated while the app was busy). Without this guard, opening the symbol library
763 // table dialog from within an active SyncLibraries call corrupts the library tree.
765};
766
767#endif // SYMBOL_EDIT_FRAME_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
Color settings are a bit different than most of the settings objects in that there can be more than o...
UNDO_REDO_LIST
Specify whether we are interacting with the undo or redo stacks.
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
A dialog which shows:
GUI-free preview/dirty/close state machine.
The tab strip plus the single shared GAL canvas.
Definition kiid.h:44
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:34
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Symbol library management helper that is specific to the symbol library editor frame.
Define a library symbol object.
Definition lib_symbol.h:80
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
Widget displaying a tree of symbols with optional search text control and description panel.
Definition lib_tree.h:46
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
Schematic editor (Eeschema) main window.
Schematic symbol object.
Definition sch_symbol.h:69
One open symbol tab owning a working LIB_SYMBOL and screen lent to the frame while active.
std::vector< std::unique_ptr< SYMBOL_EDITOR_TAB_CONTEXT > > m_tabContexts
bool m_isSymbolFromSchematic
True while a schematic-edit auto-hide of the library tree still needs restoring on save.
void restoreSymbolTabsFromSettings()
Recreate tabs from the persisted open-tab list once the libraries have loaded.
void ClearMsgPanel() override
Clear all messages from the message panel.
void OnExitKiCad(wxCommandEvent &event)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
bool promptToSaveInactiveInstanceTabs()
Prompt to save each dirty instance (schematic) tab that is not the active one, since the active tab's...
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 UpdateAfterSymbolProperties(wxString *aOldName=nullptr)
void SaveAll()
Save all modified symbols and libraries.
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 hasDirtyInactiveInstanceTabs() const
True if any non-active instance (schematic) tab has unsaved edits.
bool IsLibraryTreeShown() const override
void RenameSymbolTab(const LIB_ID &aOldId, const LIB_ID &aNewId)
Update the open tab for aOldId, if any, to the renamed symbol aNewId so its label and key track the r...
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.
static void freeTransientUndoCommands(UNDO_REDO_CONTAINER &aList, const LIB_SYMBOL *aLiveSymbol)
Free every command in the list and the UR_TRANSIENT-flagged copies it owns, which the shared deleters...
void OnSelectBodyStyle(wxCommandEvent &event)
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Return currently edited symbol.
EDITOR_TABS_PANEL * m_tabsPanel
SYMBOL_EDITOR_TAB_CONTEXT * findOrCreateSymbolInstanceTab(LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen, const KIID &aSchematicSymbolUUID, const wxString &aReference, int aUnit, int aBodyStyle)
Find or create the instance tab for a placed schematic symbol and make it active.
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 restoreSymbolSelectionKiids(const std::vector< KIID > &aKiids)
Reselect the items named by aKiids after a reload rebuilt the view.
void FocusLibraryTreeInput() override
wxComboBox * m_unitSelectBox
static void clearTabModifiedState(SYMBOL_EDITOR_TAB_CONTEXT &aContext, EDITOR_TABS_MODEL &aModel)
Clear a tab's dirty state on both the context (read on repaint) and the strip model (read on close),...
EDITOR_TABS_PANEL * GetTabsPanel() const
The tab strip fronting the shared canvas, or nullptr before it is mounted.
friend struct SYMBOL_EDITOR_TABS_TEST_FIXTURE
void RebuildSymbolUnitAndBodyStyleLists()
int GetTreeLIBIDs(std::vector< LIB_ID > &aSelection) const
void OnTabCharHook(wxKeyEvent &aEvent)
Cycle symbol tabs from the char hook, since GTK cannot register WXK_TAB as an accelerator.
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 ClearToolbarControl(int aId) override
void FocusOnLibId(const LIB_ID &aLibID)
void SVGPlotSymbol(const wxString &aFullFileName, const VECTOR2I &aOffset)
Create the SVG print file for the current edited symbol.
bool IsSymbolAlias() const
Return true if aLibId is an alias for the editor screen symbol.
void ToggleProperties() override
void Save()
Save the selected symbol or library.
SYMBOL_EDITOR_SETTINGS * m_settings
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)
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
void dropSymbolTabContext(const wxString &aKey)
Drop the inactive context for aKey from m_tabContexts, freeing its undo/redo.
bool addLibTableEntry(const wxString &aLibFile, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::GLOBAL)
Add aLibFile to the symbol library table defined by aScope.
void PushSymbolToUndoList(const wxString &aDescription, LIB_SYMBOL *aSymbolCopy, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
bool CanCloseSymbolFromSchematic(bool doClose)
void Revert(bool aConfirm=true)
Revert unsaved changes in a symbol, restoring to the last saved state.
bool IsSymbolFromLegacyLibrary() const
void centerItemIdleHandler(wxIdleEvent &aEvent)
bool replaceLibTableEntry(const wxString &aLibNickname, const wxString &aLibFile)
Replace the file path of the symbol library table entry aLibNickname with aLibFile.
bool IsSyncLibrariesInProgress() const
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_TAB_CONTEXT * m_activeTab
void SaveCopyInUndoList(const wxString &aDescription, LIB_SYMBOL *aSymbol, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT)
Create a copy of the current symbol, and save it in the undo list.
SYMBOL_EDITOR_SETTINGS * GetSettings() const
void DuplicateSymbol(bool aFromClipboard)
Insert a duplicate symbol.
SCH_SCREEN * m_dummyScreen
< Helper screen used when no symbol is loaded
void saveSymbolCopyAs(bool aOpenCopy)
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)
EDITOR_TAB_CONTEXT::VIEW_SNAPSHOT captureSymbolViewSnapshot() const
Capture the current view zoom/center for the active tab's snapshot.
static bool libTreeAutoHiddenForSchematicEdit(bool aWasFromSchematic, bool aRestorePending, bool aTreeShownNow)
Resolve whether the library tree's auto-hide for a schematic edit still needs restoring on save.
void restoreSymbolViewSnapshot(const EDITOR_TAB_CONTEXT::VIEW_SNAPSHOT &aSnapshot)
Restore a previously captured view zoom/center.
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 ...
SYMBOL_EDITOR_TAB_CONTEXT * findOrCreateSymbolTab(const wxString &aLib, const wxString &aName, int aUnit, int aBodyStyle, bool aAsPreview, bool *aWasCreated=nullptr)
Open aName from aLib in a tab, creating it when absent, and return the activated context.
void OnSelectUnit(wxCommandEvent &event)
SYMBOL_EDITOR_TAB_CONTEXT * symbolTabContextForKey(const wxString &aKey) const
Resolve the tab context for a tab key, or nullptr.
void storeSymbolTabsToSettings()
Write the current tab set into the editor settings for the next session.
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)
bool saveLibrary(const wxString &aLibrary, bool aNewFile)
Save the changes to the current library.
void SelectActiveLibrary(const wxString &aLibrary=wxEmptyString)
Set the current active library to aLibrary.
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.
void CreateNewSymbol(const wxString &newName=wxEmptyString)
Create a new symbol in the selected library.
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.
bool promptAndCloseSymbolTab(int aIdx)
Prompt for unsaved changes on the tab and drop its context.
SYMBOL_TREE_PANE * m_treePane
void LoadSymbolFromSchematic(SCH_SYMBOL *aSymbol)
Load a symbol from the schematic to edit in place.
bool LoadOneLibrarySymbolAux(LIB_SYMBOL *aLibEntry, const wxString &aLibrary, int aUnit, int aBodyStyle)
Create a copy of aLibEntry into memory.
std::vector< KIID > captureSymbolSelectionKiids() const
Capture the KIIDs of the current selection for the active tab's snapshot.
void closeSymbolTab(const LIB_ID &aLibId)
Close the open tab for aLibId, if any, without prompting and leaving the other tabs open.
bool saveCurrentSymbol()
Store the currently modified symbol in the library manager buffer.
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 clearSymbolTabsModifiedForLibrary(const wxString &aLibrary)
Clear the unsaved-edits flag on every tab in a saved library so its dirty indicator clears.
void doCloseWindow() override
SYMBOL_EDITOR_TAB_CONTEXT * symbolTabContextForIndex(int aIdx) const
Resolve the tab context for a panel tab index, or nullptr.
static void clearSymbolTabUndoRedo(SYMBOL_EDITOR_TAB_CONTEXT &aContext)
Free a detached context's undo/redo, which the frame's own teardown path never reaches.
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 ensureUniqueName(LIB_SYMBOL *aSymbol, const wxString &aLibrary)
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
wxComboBox * m_bodyStyleSelectBox
void detachActiveSymbolTab()
Snapshot the active tab's view and selection into its context without deleting the document.
void activateSymbolTab(SYMBOL_EDITOR_TAB_CONTEXT *aContext)
Make aContext the active tab, borrowing its working symbol, undo/redo, view and selection,...
void UpdateLibraryTree(const wxDataViewItem &aTreeItem, LIB_SYMBOL *aSymbol)
Update a symbol node in the library tree.
void closeAllSymbolTabsSilently()
Close every tab without prompting and return the frame to the empty state.
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
void doReCreateMenuBar() 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)
Library Editor pane with symbol tree and symbol library table selector.
A holder to handle a list of undo (or redo) commands.
STL class.
LIBRARY_TABLE_SCOPE
STL namespace.
View snapshot captured on detach, restored on activate.
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683