38 #include <wx/filedlg.h> 43 m_frame = getEditFrame<SCH_BASE_FRAME>();
52 wxCHECK( editFrame,
false );
54 auto libSelectedCondition =
63 auto libInferredCondition =
69 auto pinnedLibSelectedCondition =
75 auto unpinnedLibSelectedCondition =
81 auto symbolSelectedCondition =
87 auto saveSymbolAsCondition =
130 static_cast<SYMBOL_EDIT_FRAME*>(
m_frame )->AddLibraryFile( createNew );
161 if( libName.IsEmpty() )
163 msg.Printf(
_(
"No symbol library selected." ) );
170 msg.Printf(
_(
"Symbol library '%s' is not writable." ), libName );
208 static_cast<SYMBOL_EDIT_FRAME*>(
m_frame )->Revert();
217 static_cast<SYMBOL_EDIT_FRAME*>(
m_frame )->ExportSymbol();
240 msg.Printf(
_(
"Symbol library '%s' is not writable." ), libName );
264 if( !sel.
IsValid() && !isPasteAction )
267 msg.Printf(
_(
"No symbol selected" ) );
276 msg.Printf(
_(
"Symbol library '%s' is not writable." ), libName );
291 LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
321 if( currentNode && !currentNode->
m_Pinned )
339 if( currentNode && currentNode->
m_Pinned )
354 wxCommandEvent
dummy;
355 static_cast<SYMBOL_EDIT_FRAME*>(
m_frame )->OnToggleSymbolTree(
dummy );
397 wxMessageBox(
_(
"No symbol to export" ) );
401 wxString file_ext = wxT(
"png" );
402 wxString mask = wxT(
"*." ) + file_ext;
403 wxFileName fn( symbol->
GetName() );
404 fn.SetExt( wxT(
"png" ) );
408 wxFileDialog dlg( editFrame,
_(
"Image File Name" ), projectPath, fn.GetFullName(),
411 if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
437 wxMessageBox(
_(
"No symbol to export" ) );
442 wxFileName fn( symbol->
GetName() );
447 wxString fullFileName = wxFileSelector(
_(
"SVG File Name" ), pro_dir, fn.GetFullName(),
451 if( !fullFileName.IsEmpty() )
529 symbol->AutoplaceFields(
nullptr,
false );
int ExportSymbol(const TOOL_EVENT &aEvent)
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static TOOL_ACTION pinLibrary
int ShowElectricalTypes(const TOOL_EVENT &aEvent)
void setTransitions() override
< Set up handlers for various events.
const UTF8 & GetLibItemName() const
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
wxString SVGFileWildcard()
static TOOL_ACTION pasteSymbol
static TOOL_ACTION hideSymbolTree
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
wxString GetName() const override
static TOOL_ACTION showSymbolTree
static TOOL_ACTION duplicateSymbol
static TOOL_ACTION cancelInteractive
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
bool Init() override
Init() is called once upon a registration of the tool.
void Save()
Save the selected symbol or library.
int ExportView(const TOOL_EVENT &aEvent)
void SetPageSettings(const PAGE_INFO &aPageSettings)
Symbol library viewer main window.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
void SaveAll()
Save all modified symbols and libraries.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static TOOL_ACTION unpinLibrary
Schematic editor (Eeschema) main window.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
Define a library symbol object.
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION showDeMorganAlternate
const PAGE_INFO & GetPageSettings() const
int CutCopyDelete(const TOOL_EVENT &aEvent)
virtual void SetParent(EDA_ITEM *aParent)
int EditSymbol(const TOOL_EVENT &aEvent)
EESCHEMA_SETTINGS * eeconfig() const
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
int AddLibrary(const TOOL_EVENT &aEvent)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
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...
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)
static TOOL_ACTION editSymbol
AUTOPLACE_FIELDS m_AutoplaceFields
Item needs to be redrawn.
void SaveSymbolAs()
Save the currently selected symbol to a new name and/or location.
bool SaveCanvasImageToFile(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
LIB_ID GetLibId() const override
void SetConvert(int aConvert)
int Revert(const TOOL_EVENT &aEvent)
Describe the page size and margins of a paper page on which to eventually print or plot.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
int AddSymbolToSchematic(const TOOL_EVENT &aEvent)
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SYMBOL_LIBRARY_MANAGER & GetLibManager()
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
static TOOL_ACTION deleteSymbol
static TOOL_ACTION cutSymbol
Definition of file extensions used in Kicad.
static TOOL_ACTION addLibrary
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
int ToggleSyncedPinsMode(const TOOL_EVENT &aEvent)
void DeleteSymbolFromLibrary()
static TOOL_ACTION importSymbol
static TOOL_ACTION clearSelection
Clears the current selection.
static TOOL_ACTION placeSymbol
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
int DuplicateSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION addSymbolToSchematic
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
static TOOL_ACTION newLibrary
static TOOL_ACTION showDeMorganStandard
bool IsModal() const override
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
static TOOL_ACTION showElectricalTypes
void SetHeightMils(int aHeightInMils)
static TOOL_ACTION exportSymbolView
wxString PngFileWildcard()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static TOOL_ACTION newSymbol
static TOOL_ACTION exportSymbol
static TOOL_ACTION copySymbol
static TOOL_ACTION saveSymbolAs
int Save(const TOOL_EVENT &aEvt)
LIB_ID GetTargetLibId() const
int ToggleSymbolTree(const TOOL_EVENT &aEvent)
bool IsType(FRAME_T aType) const
int UnpinLibrary(const TOOL_EVENT &aEvent)
LIB_SYMBOL * GetSelectedSymbol() const
void SetWidthMils(int aWidthInMils)
void DuplicateSymbol(bool aFromClipboard)
Insert a duplicate symbol.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
const std::string SVGFileExtension
int OnDeMorgan(const TOOL_EVENT &aEvent)
Store schematic specific render settings.
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION toggleSyncedPinsMode
int AddSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION saveAll
void CopySymbolToClipboard()
void SaveLibraryAs()
Save the currently selected library to a new file.
int ExportSymbolAsSVG(const TOOL_EVENT &aEvent)
int PinLibrary(const TOOL_EVENT &aEvent)
bool m_ShowPinsElectricalType
void FinishModal()
Send the selected symbol back to the caller.
static TOOL_ACTION exportSymbolAsSVG
static TOOL_ACTION revert
static TOOL_ACTION saveLibraryAs
void CreateNewSymbol()
Create a new symbol in the selected library.
void SVGPlotSymbol(const wxString &aFullFileName)
Create the SVG print file for the current edited symbol.
The symbol library editor main window.