45#include <wx/clipbrd.h>
46#include <wx/filedlg.h>
51#if wxCHECK_VERSION( 3, 1, 7 )
69 title += wxS(
" " ) +
_(
"[from schematic]" );
79 title += wxS(
" " ) +
_(
"[Read Only Library]" );
83 title =
_(
"[no symbol loaded]" );
86 title += wxT(
" \u2014 " ) +
_(
"Symbol Editor" );
93 wxString selectedLib = aLibrary;
95 if( selectedLib.empty() )
98 if( !selectedLib.empty() )
150 if( lib->SchLibType() == SCH_IO_MGR::SCH_DATABASE )
154 LIB_SYMBOL* dbSym =
Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
163 msg.Printf(
_(
"Error loading symbol %s from library '%s'." ),
222 alias =
Prj().SchSymbolLibTable()->LoadSymbol(
GetCurLib(), aAliasName );
228 msg.Printf(
_(
"Error loading symbol %s from library '%s'." ),
253 int aUnit,
int aConvert )
255 bool rebuildMenuAndToolbar =
false;
257 if( !aEntry || aLibrary.empty() )
260 if( aEntry->
GetName().IsEmpty() )
262 wxLogWarning(
"Symbol in library '%s' has empty name field.", aLibrary );
278 rebuildMenuAndToolbar =
true;
282 wxCHECK( lib_symbol,
false );
284 m_unit = aUnit > 0 ? aUnit : 1;
294 if( rebuildMenuAndToolbar )
327 wxArrayString rootSymbols;
343 dlg.SetMinSize( dlg.GetSize() );
345 if( dlg.ShowModal() == wxID_CANCEL )
350 wxMessageBox(
_(
"This new symbol has no name and cannot be created." ) );
357 name.Replace(
" ",
"_" );
362 wxString msg =
wxString::Format(
_(
"Symbol '%s' already exists in library '%s'." ),
366 KIDIALOG errorDlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
367 errorDlg.SetOKLabel(
_(
"Overwrite" ) );
370 if( errorDlg.
ShowModal() == wxID_CANCEL )
378 if( parentSymbolName.IsEmpty() )
426 wxCHECK( parentField, );
428 *field = *parentField;
446 field->
SetText( wxEmptyString );
496 wxString msg2 =
_(
"You must save to a different location." );
536 const wxString& aLibraryPreselect )
542 wxArrayString headers;
543 std::vector<wxArrayString> itemsToDisplay;
545 headers.Add(
_(
"Nickname" ) );
546 headers.Add(
_(
"Description" ) );
548 for(
const wxString& nickname : libNicknames )
556 itemsToDisplay.push_back( item );
560 for(
const wxString& nickname : libNicknames )
566 item.Add( nickname );
568 itemsToDisplay.push_back( item );
573 itemsToDisplay, aLibraryPreselect,
false );
578 wxBoxSizer* bNameSizer =
new wxBoxSizer( wxHORIZONTAL );
580 wxStaticText* label =
new wxStaticText( dlg, wxID_ANY,
_(
"Name:" ) );
581 bNameSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
583 wxTextCtrl* nameTextCtrl =
new wxTextCtrl( dlg,
ID_SAVE_AS_NAME, aSymbolName );
584 bNameSizer->Add( nameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
588 dlg->
m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
590 dlg->GetSizer()->Prepend( bNameSizer, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5 );
592 dlg->Bind( wxEVT_BUTTON,
593 [dlg]( wxCommandEvent& )
599 if( dlg->GetChildren().DeleteObject( nameTextCtrl ) )
600 dlg->GetChildren().Insert( nameTextCtrl );
605 dlg->GetSizer()->Fit( dlg );
622 std::unique_ptr<EDA_LIST_DIALOG> dlg;
628 int ret = dlg->ShowModal();
630 if( ret == wxID_CANCEL )
634 else if( ret == wxID_OK )
641 libraryName = newLibrary.GetName();
645 libraryName = dlg->GetTextSelection();
647 if( libraryName.IsEmpty() )
649 DisplayError(
this,
_(
"No library specified. Symbol could not be saved." ) );
658 DisplayError(
this,
_(
"Derived symbols must be saved in the same library as their "
659 "parent symbol." ) );
663 symbolName =
static_cast<wxTextCtrl*
>( dlg->FindWindow(
ID_SAVE_AS_NAME ) )->GetValue();
664 symbolName.Trim(
true );
665 symbolName.Trim(
false );
666 symbolName.Replace(
" ",
"_" );
668 if( symbolName.IsEmpty() )
677 wxString msg =
wxString::Format(
_(
"Symbol '%s' already exists in library '%s'" ),
681 KIDIALOG errorDlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
682 errorDlg.SetOKLabel(
_(
"Overwrite" ) );
685 if( errorDlg.
ShowModal() == wxID_CANCEL )
690 new_symbol.
SetName( symbolName );
743 if( toDelete.empty() )
746 for(
LIB_ID& libId : toDelete )
750 "Do you want to remove it from the library?" ),
751 libId.GetUniStringLibItemName() ) ) )
761 _(
"The symbol %s is used to derive other symbols.\n"
762 "Deleting this symbol will delete all of the symbols derived from it.\n\n"
763 "Do you wish to delete this symbol and all of its derivatives?" ),
764 libId.GetLibItemName().wx_str() );
766 wxMessageDialog::ButtonLabel yesButtonLabel(
_(
"Delete Symbol" ) );
767 wxMessageDialog::ButtonLabel noButtonLabel(
_(
"Keep Symbol" ) );
769 wxMessageDialog dlg(
this, msg,
_(
"Warning" ),
770 wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION | wxCENTER );
771 dlg.SetYesNoLabels( yesButtonLabel, noButtonLabel );
773 if( dlg.ShowModal() == wxID_NO )
789 std::vector<LIB_ID> symbols;
796 for(
LIB_ID& libId : symbols )
799 libId.GetLibNickname() );
804 std::unique_ptr<LIB_SYMBOL> tmp = symbol->
Flatten();
810 auto clipboard = wxTheClipboard;
811 wxClipboardLocker clipboardLock( clipboard );
813 if( !clipboardLock || !clipboard->IsOpened() )
816 auto data =
new wxTextDataObject( wxString( formatter.
GetString().c_str(), wxConvUTF8 ) );
817 clipboard->SetData( data );
831 std::vector<LIB_SYMBOL*> newSymbols;
837 auto clipboard = wxTheClipboard;
838 wxClipboardLocker clipboardLock( clipboard );
841 || !( clipboard->IsSupported( wxDF_TEXT )
842 || clipboard->IsSupported( wxDF_UNICODETEXT ) ) )
847 wxTextDataObject data;
848 clipboard->GetData( data );
849 wxString symbolSource = data.GetText();
851 std::unique_ptr<STRING_LINE_READER> reader = std::make_unique<STRING_LINE_READER>(
TO_UTF8( symbolSource ), wxS(
"Clipboard" ) );
862 wxLogMessage( wxS(
"Can not paste: %s" ), e.
Problem() );
867 newSymbols.emplace_back( newSymbol );
877 wxCHECK( srcSymbol, );
879 newSymbols.emplace_back(
new LIB_SYMBOL( *srcSymbol ) );
884 std::shared_ptr< LIB_SYMBOL > srcParent = srcSymbol->
GetParent().lock();
886 wxCHECK( srcParent, );
888 newSymbols.back()->SetParent( srcParent.get() );
892 if( newSymbols.empty() )
916 wxString newName = aSymbol->
GetName();
920 newName.Printf(
"%s_%d", aSymbol->
GetName(), i++ );
935 symbolName.IsEmpty() ? libName : symbolName );
940 bool reload_currentSymbol =
false;
941 wxString curr_symbolName = symbolName;
947 if( symbolName.IsEmpty() )
952 if( reload_currentSymbol )
963 if( reload_currentSymbol )
966 if( symbolName.IsEmpty() )
987 wxCHECK_RET(
m_libMgr,
"Library manager object not created." );
1033 SCH_IO_MGR::SCH_FILE_T
fileType = SCH_IO_MGR::SCH_FILE_T::SCH_KICAD;
1038 if( !aNewFile && ( aLibrary.empty() || !prj.SchSymbolLibTable()->HasLibrary( aLibrary ) ) )
1054 fn.SetName( aLibrary );
1059 wxFileDialog dlg(
this,
wxString::Format(
_(
"Save Library '%s' As..." ), aLibrary ),
1060 default_path, fn.GetFullName(), wildcards,
1061 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1063#if wxCHECK_VERSION( 3, 1, 7 )
1065 dlg.SetCustomizeHook( saveAsHook );
1070 if( dlg.ShowModal() == wxID_CANCEL )
1077 if( fn.GetExt().IsEmpty() )
1080#if wxCHECK_VERSION( 3, 1, 7 )
1085 wxCHECK( sah,
false );
1092 fn = prj.SchSymbolLibTable()->GetFullURI( aLibrary );
1108 msg.Printf(
_(
"Failed to save changes to symbol library file '%s'." ),
1120 bool resyncLibTree =
false;
1122 wxString forceRefresh;
1128 forceRefresh = originalLibNickname;
1152 msg.Printf(
_(
"Symbol library file '%s' saved." ), fn.GetFullPath() );
1164 bool applyToAll =
false;
1177 if( aRequireConfirmation && !applyToAll )
1179 msg.Printf(
_(
"Save changes to '%s' before closing?" ), libNickname );
1183 case wxID_YES: doSave =
true;
break;
1184 case wxID_NO: doSave =
false;
break;
1186 case wxID_CANCEL:
return false;
1201 msg.Printf(
_(
"Symbol library '%s' is not writable." ), libNickname );
1202 msg2 =
_(
"You must save to a different location." );
1204 if( dirtyCount == 1 )
1216 2000, wxICON_EXCLAMATION );
1252 msg = parent ? parent->GetName() :
_(
"Undefined!" );
1256 static wxChar UnitLetter[] = wxT(
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
1257 msg = UnitLetter[
m_unit];
1262 msg =
_(
"Convert" );
1264 msg =
_(
"Normal" );
1269 msg =
_(
"Power Symbol" );
1271 msg =
_(
"Symbol" );
static TOOL_ACTION cancelInteractive
static TOOL_ACTION zoomFitScreen
void SetContentModified(bool aModified=true)
wxString GetReference(void)
wxString GetParentSymbolName() const
wxString GetName(void) const override
bool GetIncludeOnBoard() const
bool GetShowPinNumber(void)
bool GetShowPinName(void)
bool GetAlternateBodyStyle(void)
int GetPinTextPosition(void)
bool GetPowerSymbol(void)
bool GetPinNameInside(void)
bool GetUnitsInterchangeable(void)
bool GetIncludeInBom() const
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
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 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?
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
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 UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
void SetIncludeOnBoard(bool aIncludeOnBoard)
Set or clear include in board netlist flag.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
int GetPinNameOffset() const
wxString GetKeyWords() const
void SetConversion(bool aSetConvert, bool aDuplicatePins=true)
Set or clear the alternate body style (DeMorgan) for the symbol.
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
wxString GetDescription() override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
void SetIncludeInBom(bool aIncludeInBom)
Set or clear the include in schematic bill of materials flag.
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.
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.
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxString SelectLibraryFromList()
Display a list of loaded libraries and allows the user to select a library.
Schematic editor (Eeschema) main window.
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a symbol library using the file extension of aLibPath.
static void FormatLibSymbol(LIB_SYMBOL *aPart, OUTPUTFORMATTER &aFormatter)
static LIB_SYMBOL * ParseLibSymbol(LINE_READER &aReader, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION)
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.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
bool m_isSymbolFromSchematic
void ClearMsgPanel() override
Clear all messages from the message panel.
int m_convert
Flag if the symbol being edited was loaded directly from a schematic.
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.
void updateTitle()
Update the main window title bar with the current library name and read only status of the library.
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_SYMBOL_LIBRARY_MANAGER * m_libMgr
bool LoadOneLibrarySymbolAux(LIB_SYMBOL *aLibEntry, const wxString &aLibrary, int aUnit, int aConvert)
Create a copy of aLibEntry into memory.
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 LoadSymbolFromCurrentLib(const wxString &aAliasName, int aUnit=0, int aConvert=0)
Load a symbol from the current active library, optionally setting the selected unit and convert.
void SaveSymbolAs()
Save the currently selected symbol to a new name and/or location.
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 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.
bool saveAllLibraries(bool aRequireConfirmation)
Save the current symbol.
EDA_LIST_DIALOG * buildSaveAsDialog(const wxString &aSymbolName, const wxString &aLibraryPreselect)
void UpdateMsgPanel() override
Redraw the message panel.
wxString SetCurLib(const wxString &aLibNickname)
Set the current library nickname and returns the old library nickname.
void ReCreateHToolbar() override
SYMBOL_TREE_PANE * m_treePane
void CreateNewSymbol()
Create a new symbol in the selected library.
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
Helper control to inquire user what to do on library save as operation.
SYMBOL_SAVEAS_TYPE GetOption() const
static SYMBOL_SAVEAS_TYPE m_option
static wxWindow * Create(wxWindow *aParent)
Create a new panel to add to a wxFileDialog object.
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.
void GetRootSymbolNames(const wxString &aLibName, wxArrayString &aRootSymbolNames)
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.
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.
bool FlushSymbol(const wxString &aAlias, const wxString &aLibrary)
Save symbol changes to the library copy used by the schematic editor.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
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)
const std::string KiCadSymbolLibFileExtension
wxString KiCadSymbolLibFileWildcard()
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
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.
FormatType fileType(const char *aFileName)
wxString UnescapeString(const wxString &aSource)
std::vector< wxString > pinned_symbol_libs
static int ID_MAKE_NEW_LIBRARY
static int ID_SAVE_AS_NAME
Definition for symbol library class.
@ ADD_PROJECT_TABLE_ENTRY
@ 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 4 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.