45#include <wx/clipbrd.h>
46#include <wx/filedlg.h>
65 title += wxS(
" " ) +
_(
"[from schematic]" );
75 title += wxS(
" " ) +
_(
"[Read Only Library]" );
79 title =
_(
"[no symbol loaded]" );
82 title += wxT(
" \u2014 " ) +
_(
"Symbol Editor" );
89 wxString selectedLib = aLibrary;
91 if( selectedLib.empty() )
94 if( !selectedLib.empty() )
127 wxString msg = wxString::Format(
_(
"Symbol library '%s' is not writable." ),
129 wxString msg2 =
_(
"You must save to a different location." );
152 if( lib->SchLibType() == SCH_IO_MGR::SCH_DATABASE
153 || lib->SchLibType() == SCH_IO_MGR::SCH_CADSTAR_ARCHIVE
154 || lib->SchLibType() == SCH_IO_MGR::SCH_HTTP )
168 msg.Printf(
_(
"Error loading symbol %s from library '%s'." ),
234 msg.Printf(
_(
"Error loading symbol %s from library '%s'." ),
259 int aUnit,
int aBodyStyle )
261 bool rebuildMenuAndToolbar =
false;
263 if( !aEntry || aLibrary.empty() )
266 if( aEntry->
GetName().IsEmpty() )
268 wxLogWarning(
"Symbol in library '%s' has empty name field.", aLibrary );
284 rebuildMenuAndToolbar =
true;
288 wxCHECK( lib_symbol,
false );
290 m_unit = aUnit > 0 ? aUnit : 1;
300 if( rebuildMenuAndToolbar )
345 wxArrayString symbolNames;
360 wxString _inheritSymbolName;
361 wxString _infoMessage;
366 if( !aInheritFrom.IsEmpty() )
370 if( inheritFromSymbol )
372 _inheritSymbolName = aInheritFrom;
373 _infoMessage = wxString::Format(
_(
"Deriving from symbol '%s'." ),
374 _inheritSymbolName );
378 _inheritSymbolName = aInheritFrom;
383 [&]( wxString newName )
385 if( newName.IsEmpty() )
387 wxMessageBox( _(
"Symbol must have a name." ) );
393 msg = wxString::Format( _(
"Symbol '%s' already exists in library '%s'." ),
397 KIDIALOG errorDlg( this, msg, _(
"Confirmation" ),
398 wxOK | wxCANCEL | wxICON_WARNING );
399 errorDlg.SetOKLabel( _(
"Overwrite" ) );
401 return errorDlg.ShowModal() == wxID_OK;
407 dlg.SetMinSize( dlg.GetSize() );
409 if( dlg.ShowModal() == wxID_CANCEL )
412 wxString
name = dlg.GetName();
416 wxString parentSymbolName = dlg.GetParentSymbolName();
418 if( parentSymbolName.IsEmpty() )
426 if( dlg.GetPinNameInside() )
441 new_symbol.
LockUnits( !dlg.GetUnitsInterchangeable() );
445 if( dlg.GetUnitCount() < 2 )
466 wxCHECK( parentField, );
468 *field = *parentField;
486 field->
SetText( wxEmptyString );
515 if( libName.empty() )
521 wxString msg = wxString::Format(
_(
"Symbol library '%s' is not writable." ),
523 wxString msg2 =
_(
"You must save to a different location." );
566 const wxString& aLibraryPreselect,
567 std::function<
bool( wxString libName, wxString symbolName )> aValidator ) :
575 wxArrayString headers;
576 std::vector<wxArrayString> itemsToDisplay;
578 headers.Add(
_(
"Nickname" ) );
579 headers.Add(
_(
"Description" ) );
581 for(
const wxString& nickname : libNicknames )
589 itemsToDisplay.push_back( item );
593 for(
const wxString& nickname : libNicknames )
599 item.Add( nickname );
601 itemsToDisplay.push_back( item );
605 initDialog( headers, itemsToDisplay, aLibraryPreselect );
610 wxBoxSizer* bNameSizer =
new wxBoxSizer( wxHORIZONTAL );
612 wxStaticText* label =
new wxStaticText(
this, wxID_ANY,
_(
"Name:" ) );
613 bNameSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
620 m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
622 GetSizer()->Prepend( bNameSizer, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5 );
625 [
this]( wxCommandEvent& )
639 GetSizer()->Fit(
this );
647 symbolName.Trim(
true );
648 symbolName.Trim(
false );
649 symbolName.Replace(
" ",
"_" );
661 std::function<bool( wxString libName, wxString symbolName )>
m_validator;
682 [&](
const wxString& newLib,
const wxString& newName )
684 if( newLib.IsEmpty() )
686 wxMessageBox( _(
"A library must be specified." ) );
690 if( newName.IsEmpty() )
692 wxMessageBox( _(
"Symbol must have a name." ) );
698 msg = wxString::Format( _(
"Symbol '%s' already exists in library '%s'." ),
701 KIDIALOG errorDlg( this, msg, _(
"Confirmation" ),
702 wxOK | wxCANCEL | wxICON_WARNING );
703 errorDlg.SetOKLabel( _(
"Overwrite" ) );
705 return errorDlg.ShowModal() == wxID_OK;
713 DisplayError( this, _(
"Derived symbols must be saved in the same library "
714 "as their parent symbol." ) );
721 int ret = dlg.ShowModal();
723 if( ret == wxID_CANCEL )
727 else if( ret == wxID_OK )
730 libraryName = dlg.GetTextSelection();
736 libraryName = newLibrary.GetName();
741 new_symbol.
SetName( symbolName );
743 if( valueFollowsName )
762 wxString msg = wxString::Format(
_(
"Symbol name '%s' already in use." ),
794 if( toDelete.empty() )
797 for(
LIB_ID& libId : toDelete )
800 && !
IsOK(
this, wxString::Format(
_(
"The symbol '%s' has been modified.\n"
801 "Do you want to remove it from the library?" ),
802 libId.GetUniStringLibItemName() ) ) )
812 _(
"The symbol %s is used to derive other symbols.\n"
813 "Deleting this symbol will delete all of the symbols derived from it.\n\n"
814 "Do you wish to delete this symbol and all of its derivatives?" ),
815 libId.GetLibItemName().wx_str() );
817 wxMessageDialog::ButtonLabel yesButtonLabel(
_(
"Delete Symbol" ) );
818 wxMessageDialog::ButtonLabel noButtonLabel(
_(
"Keep Symbol" ) );
820 wxMessageDialog dlg(
this, msg,
_(
"Warning" ),
821 wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION | wxCENTER );
822 dlg.SetYesNoLabels( yesButtonLabel, noButtonLabel );
824 if( dlg.ShowModal() == wxID_NO )
840 std::vector<LIB_ID> symbols;
847 for(
LIB_ID& libId : symbols )
850 libId.GetLibNickname() );
855 std::unique_ptr<LIB_SYMBOL> tmp = symbol->
Flatten();
861 auto clipboard = wxTheClipboard;
862 wxClipboardLocker clipboardLock( clipboard );
864 if( !clipboardLock || !clipboard->IsOpened() )
867 auto data =
new wxTextDataObject( wxString( formatter.
GetString().c_str(), wxConvUTF8 ) );
868 clipboard->SetData( data );
882 std::vector<LIB_SYMBOL*> newSymbols;
894 wxLogMessage( wxS(
"Can not paste: %s" ), e.
Problem() );
901 wxCHECK( srcSymbol, );
903 newSymbols.emplace_back(
new LIB_SYMBOL( *srcSymbol ) );
908 std::shared_ptr< LIB_SYMBOL > srcParent = srcSymbol->
GetParent().lock();
910 wxCHECK( srcParent, );
912 newSymbols.back()->SetParent( srcParent.get() );
916 if( newSymbols.empty() )
940 wxString newName = aSymbol->
GetName();
944 newName.Printf(
"%s_%d", aSymbol->
GetName(), i++ );
958 wxString msg = wxString::Format(
_(
"Revert '%s' to last version saved?" ),
959 symbolName.IsEmpty() ? libName : symbolName );
964 bool reload_currentSymbol =
false;
965 wxString curr_symbolName = symbolName;
971 if( symbolName.IsEmpty() )
976 if( reload_currentSymbol )
987 if( reload_currentSymbol )
990 if( symbolName.IsEmpty() )
1003 LoadSymbol( curr_symbolName, libName, unit );
1011 wxCHECK_RET(
m_libMgr,
"Library manager object not created." );
1036 DisplayError(
this, wxString::Format(
_(
"Symbol %s not found in library '%s'." ),
1058 SCH_IO_MGR::SCH_FILE_T
fileType = SCH_IO_MGR::SCH_FILE_T::SCH_KICAD;
1079 fn.SetName( aLibrary );
1084 wxFileDialog dlg(
this, wxString::Format(
_(
"Save Library '%s' As..." ), aLibrary ),
1085 default_path, fn.GetFullName(), wildcards,
1086 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1089 dlg.SetCustomizeHook( saveAsHook );
1091 if( dlg.ShowModal() == wxID_CANCEL )
1098 if( fn.GetExt().IsEmpty() )
1108 if(
fileType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
1124 msg.Printf(
_(
"Failed to save changes to symbol library file '%s'." ),
1140 bool resyncLibTree =
false;
1142 wxString forceRefresh;
1146 case SYMBOL_SAVEAS_TYPE::REPLACE_TABLE_ENTRY:
1148 forceRefresh = originalLibNickname;
1151 case SYMBOL_SAVEAS_TYPE::ADD_GLOBAL_TABLE_ENTRY:
1155 case SYMBOL_SAVEAS_TYPE::ADD_PROJECT_TABLE_ENTRY:
1172 msg.Printf(
_(
"Symbol library file '%s' saved." ), fn.GetFullPath() );
1184 bool applyToAll =
false;
1197 if( aRequireConfirmation && !applyToAll )
1199 msg.Printf(
_(
"Save changes to '%s' before closing?" ), libNickname );
1203 case wxID_YES: doSave =
true;
break;
1204 case wxID_NO: doSave =
false;
break;
1206 case wxID_CANCEL:
return false;
1216 msg.Printf(
_(
"Symbol library '%s' is not writable." ), libNickname );
1217 msg2 =
_(
"You must save to a different location." );
1219 if( dirtyCount == 1 )
1231 2000, wxICON_EXCLAMATION );
1271 msg = parent ? parent->GetName() :
_(
"Undefined!" );
1275 static wxChar UnitLetter[] = wxT(
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
1276 msg = UnitLetter[
m_unit];
1281 msg =
_(
"Alternate" );
1283 msg =
_(
"Standard" );
1290 msg =
_(
"Power Symbol" );
1292 msg =
_(
"Symbol" );
static TOOL_ACTION cancelInteractive
static TOOL_ACTION zoomFitScreen
void SetContentModified(bool aModified=true)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
void ReCreateMenuBar()
Recreates the menu bar.
WX_INFOBAR * GetInfoBar()
virtual void ClearMsgPanel()
Clear all messages from the message panel.
void AppendMsgPanel(const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
Append a message to the message panel.
virtual void SetParent(EDA_ITEM *aParent)
wxBoxSizer * m_ButtonsSizer
void SetOKLabel(const wxString &aLabel)
void initDialog(const wxArrayString &aItemHeaders, const std::vector< wxArrayString > &aItemList, const wxString &aPreselectText)
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetText(const wxString &aText)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const wxString Problem() const
what was the problem?
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Field object used in symbol libraries.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
wxString GetUniStringLibId() const
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const wxString GetUniStringLibNickname() const
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
bool HasAlternateBodyStyle() const
Test if symbol has more than one body conversion type (DeMorgan).
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
int GetPinNameOffset() const
wxString GetKeyWords() const
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
LIB_ID GetSourceLibId() const
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
LIB_ID GetLibId() const override
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
void SetExcludedFromBOM(bool aExcludeFromBOM)
Set or clear the exclude from schematic bill of materials flag.
void SetExcludedFromBoard(bool aExcludeFromBoard)
Set or clear exclude from board netlist flag.
LIB_FIELD & GetValueField()
Return reference to the value field.
wxString GetDescription() override
void SetHasAlternateBodyStyle(bool aHasAlternate, bool aDuplicatePins=true)
Set or clear the alternate body style (DeMorgan) for the symbol.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
LIB_SYMBOL_REF & GetParent()
virtual void SetName(const wxString &aName)
const wxString GetDescription(const wxString &aNickname)
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
static const wxString GetPinningSymbol()
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
The backing store for a PROJECT, in JSON format.
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
Container for project specific data.
virtual PROJECT_FILE & GetProjectFile() const
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...
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
bool TransferDataFromWindow() override
wxTextCtrl * m_symbolNameCtrl
SAVE_AS_DIALOG(SYMBOL_EDIT_FRAME *aParent, const wxString &aSymbolName, const wxString &aLibraryPreselect, std::function< bool(wxString libName, wxString symbolName)> aValidator)
std::function< bool(wxString libName, wxString symbolName)> m_validator
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
wxString SelectLibraryFromList()
Display a list of loaded libraries and allows the user to select a library.
void SetSymModificationTime(const wxDateTime &aTime)
Set the modification time of the symbol library table file.
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.
Schematic editor (Eeschema) main window.
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
static void FormatLibSymbol(LIB_SYMBOL *aPart, OUTPUTFORMATTER &aFormatter)
static std::vector< LIB_SYMBOL * > ParseLibSymbols(std::string &aSymbolText, std::string aSource, int aFileVersion=SEXPR_SCHEMATIC_FILE_VERSION)
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.
Look for files in a number of paths.
const wxString LastVisitedPath(const wxString &aSubPathToSearch=wxEmptyString)
A quirky function inherited from old code that seems to serve particular needs in the UI.
The symbol library editor main window.
bool m_isSymbolFromSchematic
void ClearMsgPanel() override
Clear all messages from the message panel.
void UpdateAfterSymbolProperties(wxString *aOldName=nullptr)
void SaveAll()
Save all modified symbols and libraries.
void DeleteSymbolFromLibrary()
bool addLibTableEntry(const wxString &aLibFile, TABLE_SCOPE aScope=GLOBAL_LIB_TABLE)
Add aLibFile to the symbol library table defined by aScope.
wxString getTargetLib() const
bool IsCurrentSymbol(const LIB_ID &aLibId) const
Restore the empty editor screen, without any symbol or library selected.
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Return currently edited symbol.
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.
LIB_ID GetTargetLibId() const
Return either the symbol selected in the symbol tree (if context menu is active) or the symbol on the...
void Save()
Save the selected symbol or library.
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)
bool IsSymbolTreeShown() const
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
void RebuildSymbolUnitsList()
void Revert(bool aConfirm=true)
Revert unsaved changes in a symbol, restoring to the last saved state.
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 IsSymbolFromSchematic() const
void SetScreen(BASE_SCREEN *aScreen) override
void SaveSymbolCopyAs()
Save the currently selected symbol to a new name and/or location.
void DuplicateSymbol(bool aFromClipboard)
Insert a duplicate symbol.
SCH_SCREEN * m_dummyScreen
< Helper screen used when no symbol is loaded
LIB_ID m_centerItemOnIdle
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)
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 ...
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 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 CreateNewSymbol(const wxString &newName=wxEmptyString)
Create a new symbol in the selected library.
wxString SetCurLib(const wxString &aLibNickname)
Set the current library nickname and returns the old library nickname.
void UpdateTitle()
Update the main window title bar with the current library name and read only status of the library.
void ReCreateHToolbar() override
SYMBOL_TREE_PANE * m_treePane
bool LoadOneLibrarySymbolAux(LIB_SYMBOL *aLibEntry, const wxString &aLibrary, int aUnit, int aBodyStyle)
Create a copy of aLibEntry into memory.
bool LoadSymbolFromCurrentLib(const wxString &aAliasName, int aUnit=0, int aBodyStyle=0)
Load a symbol from the current active library, optionally setting the selected unit and convert.
bool saveCurrentSymbol()
Store the currently modified symbol in the library manager buffer.
void CopySymbolToClipboard()
wxString AddLibraryFile(bool aCreateNew)
Create or add an existing library to the symbol library table.
void ensureUniqueName(LIB_SYMBOL *aSymbol, const wxString &aLibrary)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void SetShowDeMorgan(bool show)
void 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.
LIB_SYMBOL * getTargetSymbol() const
Return either the library selected in the symbol tree, if context menu is active or the library that ...
SYMBOL_SAVEAS_TYPE GetOption() const
LIB_SYMBOL * GetBufferedSymbol(const wxString &aAlias, const wxString &aLibrary)
Return the symbol copy from the buffer.
bool UpdateSymbolAfterRename(LIB_SYMBOL *aSymbol, const wxString &oldAlias, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol when the name has changed.
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
bool ClearSymbolModified(const wxString &aAlias, const wxString &aLibrary) const
Clear the modified flag for a symbol.
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
bool ClearLibraryModified(const wxString &aLibrary) const
Clear the modified flag for all symbols in a library.
LIB_SYMBOL * GetAlias(const wxString &aAlias, const wxString &aLibrary) const
Return either an alias of a working LIB_SYMBOL copy, or alias of the original symbol if there is no w...
SCH_SCREEN * GetScreen(const wxString &aAlias, const wxString &aLibrary)
Return the screen used to edit a specific symbol.
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
wxArrayString GetLibraryNames() const
Return the array of library names.
bool SymbolExists(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol with a specific alias exists in library (either original one or buffered).
bool RemoveSymbol(const wxString &aName, const wxString &aLibrary)
Remove the symbol from the symbol buffer.
bool IsSymbolModified(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol has unsaved modifications.
bool RevertLibrary(const wxString &aLibrary)
Revert unsaved changes for a symbolicular library.
void GetSymbolNames(const wxString &aLibName, wxArrayString &aSymbolNames, SYMBOL_NAME_FILTER aFilter=SYMBOL_NAME_FILTER::ALL)
bool RevertAll()
Revert all pending changes.
LIB_ID RevertSymbol(const wxString &aAlias, const wxString &aLibrary)
Revert unsaved changes for a symbolicular symbol.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
bool UpdateSymbol(LIB_SYMBOL *aSymbol, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol.
bool SaveLibrary(const wxString &aLibrary, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aFileType=SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY)
Save library to a file, including unsaved changes.
bool HasDerivedSymbols(const wxString &aSymbolName, const wxString &aLibraryName)
Check if symbol aSymbolName in library aLibraryName is a root symbol that has derived symbols.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_IO object i...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
LIB_TREE * GetLibTree() const
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aDetailedMessage, const wxString &aOKLabel, const wxString &aCancelLabel, bool *aApplyToAll)
Display a warning dialog with aMessage and returns the user response.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
int UnsavedChangesDialog(wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
bool ConfirmRevertDialog(wxWindow *parent, const wxString &aMessage)
Display a confirmation dialog for a revert action.
This file is part of the common library.
static bool empty(const wxTextEntryBase *aCtrl)
static const std::string KiCadSymbolLibFileExtension
static wxString KiCadSymbolLibFileWildcard()
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
@ ALL
All except INITIAL_ADD.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
wxString UnescapeString(const wxString &aSource)
std::vector< wxString > pinned_symbol_libs
static int ID_MAKE_NEW_LIBRARY
Definition for symbol library class.
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
Definition of file extensions used in Kicad.