KiCad PCB EDA Suite
symbol_editor_control.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) 2019 CERN
5  * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <kiway.h>
26 #include <sch_painter.h>
27 #include <tool/tool_manager.h>
28 #include <tools/ee_actions.h>
30 #include <symbol_edit_frame.h>
31 #include <symbol_library_manager.h>
32 #include <symbol_viewer_frame.h>
35 #include <gestfich.h>
36 #include <confirm.h>
37 
38 
40 {
41  m_frame = getEditFrame<SCH_BASE_FRAME>();
44 
45  if( m_isSymbolEditor )
46  {
47  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
48  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
49 
50  wxCHECK( editFrame, false );
51 
52  auto libSelectedCondition =
53  [ editFrame ]( const SELECTION& aSel )
54  {
55  LIB_ID sel = editFrame->GetTreeLIBID();
56  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
57  };
58  // The libInferredCondition allows you to do things like New Symbol and Paste with a
59  // symbol selected (in other words, when we know the library context even if the library
60  // itself isn't selected.
61  auto libInferredCondition =
62  [ editFrame ]( const SELECTION& aSel )
63  {
64  LIB_ID sel = editFrame->GetTreeLIBID();
65  return !sel.GetLibNickname().empty();
66  };
67  auto canEditLibrary =
68  [ editFrame ]( const SELECTION& aSel )
69  {
70  LIB_ID sel = editFrame->GetTreeLIBID();
71  return !editFrame->GetLibManager().IsLibraryReadOnly( sel.GetLibNickname() );
72  };
73  auto pinnedLibSelectedCondition =
74  [ editFrame ]( const SELECTION& aSel )
75  {
76  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
77  return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
78  };
79  auto unpinnedLibSelectedCondition =
80  [ editFrame ](const SELECTION& aSel )
81  {
82  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
83  return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
84  };
85  auto symbolSelectedCondition =
86  [ editFrame ]( const SELECTION& aSel )
87  {
88  LIB_ID sel = editFrame->GetTreeLIBID();
89  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
90  };
91  auto saveSymbolAsCondition =
92  [ editFrame ]( const SELECTION& aSel )
93  {
94  LIB_ID sel = editFrame->GetTargetLibId();
95  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
96  };
97 
98  ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
99  ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
100 
101  ctxMenu.AddSeparator();
102  ctxMenu.AddItem( EE_ACTIONS::newSymbol, libInferredCondition && canEditLibrary );
103 
104  ctxMenu.AddSeparator();
105  ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition || libInferredCondition );
106  ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition );
107  ctxMenu.AddItem( EE_ACTIONS::saveSymbolAs, saveSymbolAsCondition );
108  ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition || libInferredCondition );
109 
110  ctxMenu.AddSeparator();
111  ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition && canEditLibrary );
112  ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
113  ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libInferredCondition && canEditLibrary );
114  ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition && canEditLibrary );
115  ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition && canEditLibrary );
116 
117  ctxMenu.AddSeparator();
118  ctxMenu.AddItem( EE_ACTIONS::importSymbol, libInferredCondition && canEditLibrary);
119  ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
120  }
121 
122  return true;
123 }
124 
125 
127 {
128  bool createNew = aEvent.IsAction( &ACTIONS::newLibrary );
129 
131  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
132 
133  return 0;
134 }
135 
136 
138 {
140  {
141  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
142  int unit = 0;
143  LIB_ID partId = editFrame->GetTreeLIBID( &unit );
144 
145  editFrame->LoadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit );
146  }
147 
148  return 0;
149 }
150 
151 
153 {
155  {
156  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
157 
158  if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
159  editFrame->CreateNewPart();
160  else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
161  editFrame->ImportPart();
162  }
163 
164  return 0;
165 }
166 
167 
169 {
171  {
172  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
173 
174  if( aEvt.IsAction( &EE_ACTIONS::save ) )
175  editFrame->Save();
176  else if( aEvt.IsAction( &EE_ACTIONS::saveLibraryAs ) )
177  editFrame->SaveLibraryAs();
178  else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolAs ) )
179  editFrame->SaveSymbolAs();
180  else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
181  editFrame->SaveAll();
182  }
183 
184  return 0;
185 }
186 
187 
189 {
191  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->Revert();
192 
193  return 0;
194 }
195 
196 
198 {
200  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->ExportPart();
201 
202  return 0;
203 }
204 
205 
207 {
209  {
210  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
211 
213  editFrame->CopyPartToClipboard();
214 
216  editFrame->DeletePartFromLibrary();
217  }
218 
219  return 0;
220 }
221 
222 
224 {
226  {
227  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
228  editFrame->DuplicatePart( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
229  }
230 
231  return 0;
232 }
233 
234 
236 {
237  int convert = aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) ?
238  LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
239 
241  {
244 
245  SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
246  symbolEditor->SetConvert( convert );
247 
249  symbolEditor->RebuildView();
250  }
252  {
253  SYMBOL_VIEWER_FRAME* symbolViewer = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
254  symbolViewer->SetUnitAndConvert( symbolViewer->GetUnit(), convert );
255  }
256 
257  return 0;
258 }
259 
260 
262 {
264  {
265  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
266  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
267 
268  if( currentNode && !currentNode->m_Pinned )
269  {
270  currentNode->m_Pinned = true;
271  editFrame->RegenerateLibraryTree();
272  }
273  }
274 
275  return 0;
276 }
277 
278 
280 {
282  {
283  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
284  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
285 
286  if( currentNode && currentNode->m_Pinned )
287  {
288  currentNode->m_Pinned = false;
289  editFrame->RegenerateLibraryTree();
290  }
291  }
292 
293  return 0;
294 }
295 
296 
298 {
300  {
301  wxCommandEvent dummy;
302  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->OnToggleSearchTree( dummy );
303  }
304 
305  return 0;
306 }
307 
308 
310 {
312  renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
313 
314  // Update canvas
316  m_frame->GetCanvas()->Refresh();
317 
318  return 0;
319 }
320 
321 
323 {
324  if( !m_isSymbolEditor )
325  return 0;
326 
327  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
328  editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
329 
330  return 0;
331 }
332 
333 
335 {
336  if( !m_isSymbolEditor )
337  return 0;
338 
339  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
340  LIB_PART* part = editFrame->GetCurPart();
341 
342  if( !part )
343  {
344  wxMessageBox( _( "No symbol to export" ) );
345  return 0;
346  }
347 
348  wxString file_ext = wxT( "png" );
349  wxString mask = wxT( "*." ) + file_ext;
350  wxFileName fn( part->GetName() );
351  fn.SetExt( "png" );
352 
353  wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
354 
355  wxFileDialog dlg( editFrame, _( "Image File Name" ), projectPath, fn.GetFullName(),
356  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
357 
358  if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
359  {
360  // calling wxYield is mandatory under Linux, after closing the file selector dialog
361  // to refresh the screen before creating the PNG or JPEG image from screen
362  wxYield();
363 
364  if( !SaveCanvasImageToFile( editFrame, dlg.GetPath(), wxBITMAP_TYPE_PNG ) )
365  {
366  wxMessageBox( wxString::Format( _( "Can't save file \"%s\"." ), dlg.GetPath() ) );
367  }
368  }
369 
370  return 0;
371 }
372 
373 
375 {
376  if( !m_isSymbolEditor )
377  return 0;
378 
379  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
380  LIB_PART* part = editFrame->GetCurPart();
381 
382  if( !part )
383  {
384  wxMessageBox( _( "No symbol to export" ) );
385  return 0;
386  }
387 
388  wxString file_ext = wxT( "svg" );
389  wxString mask = wxT( "*." ) + file_ext;
390  wxFileName fn( part->GetName() );
391  fn.SetExt( file_ext );
392 
393  wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
394 
395  wxString fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir, fn.GetFullName(),
396  file_ext, mask, m_frame, wxFD_SAVE, true );
397 
398  if( !fullFileName.IsEmpty() )
399  {
400  PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
401  PAGE_INFO pageTemp = pageSave;
402 
403  wxSize componentSize = part->GetUnitBoundingBox( editFrame->GetUnit(),
404  editFrame->GetConvert() ).GetSize();
405 
406  // Add a small margin to the plot bounding box
407  pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
408  pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
409 
410  editFrame->GetScreen()->SetPageSettings( pageTemp );
411  editFrame->SVGPlotSymbol( fullFileName );
412  editFrame->GetScreen()->SetPageSettings( pageSave );
413  }
414 
415  return 0;
416 }
417 
418 
420 {
421  LIB_PART* part = nullptr;
422  LIB_ID libId;
423  int unit, convert;
424 
425  if( m_isSymbolEditor )
426  {
427  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
428 
429  part = editFrame->GetCurPart();
430  unit = editFrame->GetUnit();
431  convert = editFrame->GetConvert();
432 
433  if( part )
434  libId = part->GetLibId();
435  }
436  else
437  {
438  SYMBOL_VIEWER_FRAME* viewerFrame = getEditFrame<SYMBOL_VIEWER_FRAME>();
439 
440  if( viewerFrame->IsModal() )
441  {
442  // if we're modal then we just need to return the symbol selection; the caller is
443  // already in a EE_ACTIONS::placeSymbol coroutine.
444  viewerFrame->FinishModal();
445  return 0;
446  }
447  else
448  {
449  part = viewerFrame->GetSelectedSymbol();
450  unit = viewerFrame->GetUnit();
451  convert = viewerFrame->GetConvert();
452 
453  if( part )
454  libId = part->GetLibId();
455  }
456  }
457 
458  if( part )
459  {
460  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
461 
462  if( !schframe ) // happens when the schematic editor is not active (or closed)
463  {
464  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
465  return 0;
466  }
467 
468  wxCHECK( part->GetLibId().IsValid(), 0 );
469 
470  SCH_COMPONENT* symbol = new SCH_COMPONENT( *part, libId, &schframe->GetCurrentSheet(),
471  unit, convert );
472 
473  symbol->SetParent( schframe->GetCurrentSheet().LastScreen() );
474 
475  if( schframe->eeconfig()->m_AutoplaceFields.enable )
476  symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
477 
478  schframe->Raise();
479  schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, true, symbol );
480  }
481 
482  return 0;
483 }
484 
485 
487 {
493 
499 
509 
512 
518 }
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
Definition: actions.h:112
int ShowElectricalTypes(const TOOL_EVENT &aEvent)
void setTransitions() override
< Set up handlers for various events.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
LIB_ID GetLibId() const override
Definition: lib_symbol.h:131
static TOOL_ACTION pasteSymbol
Definition: ee_actions.h:175
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:266
This file is part of the common library TODO brief description.
wxString GetName() const override
Definition: lib_symbol.h:129
bool SaveCanvasImageToFile(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, wxBitmapType aBitmapType)
Save the current view as an image file.
Definition: bitmap.cpp:179
Model changes (required full reload)
Definition: tool_base.h:81
This file is part of the common library.
static TOOL_ACTION duplicateSymbol
Definition: ee_actions.h:171
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1412
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.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void Save()
Save the selected part or library.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
int ExportView(const TOOL_EVENT &aEvent)
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:188
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.
Definition: kiway.cpp:345
void SaveAll()
Save all modified parts and libraries.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static TOOL_ACTION unpinLibrary
Definition: actions.h:113
Schematic editor (Eeschema) main window.
static TOOL_ACTION showComponentTree
Definition: ee_actions.h:201
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:168
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:125
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:187
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
int CutCopyDelete(const TOOL_EVENT &aEvent)
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
void LoadPart(const wxString &aLibrary, const wxString &aPart, int Unit)
int EditSymbol(const TOOL_EVENT &aEvent)
EESCHEMA_SETTINGS * eeconfig() const
int AddLibrary(const TOOL_EVENT &aEvent)
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
static TOOL_ACTION editSymbol
Definition: ee_actions.h:170
AUTOPLACE_FIELDS m_AutoplaceFields
Item needs to be redrawn.
Definition: view_item.h:57
void SaveSymbolAs()
Save the currently selected symbol to a new name and/or location.
int ShowComponentTree(const TOOL_EVENT &aEvent)
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.
Definition: page_info.h:53
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.
static TOOL_ACTION save
Definition: actions.h:54
void DuplicatePart(bool aFromClipboard)
Insert a duplicate part.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:173
SYMBOL_LIBRARY_MANAGER & GetLibManager()
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
A helper function that wraps a call to wxFileSelector.
Definition: gestfich.cpp:52
static TOOL_ACTION deleteSymbol
Definition: ee_actions.h:172
Define a library symbol object.
Definition: lib_symbol.h:93
static TOOL_ACTION cutSymbol
Definition: ee_actions.h:173
Definition of file extensions used in Kicad.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
static TOOL_ACTION addLibrary
Definition: actions.h:52
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.
Definition: lib_id.h:92
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
int ToggleSyncedPinsMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION importSymbol
Definition: ee_actions.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:75
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
int DuplicateSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:164
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
static TOOL_ACTION newLibrary
Definition: actions.h:51
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:124
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...
Definition: kiway_player.h:170
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:200
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:257
static TOOL_ACTION exportSymbolView
Definition: ee_actions.h:204
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
wxString PngFileWildcard()
LIB_PART * GetSelectedSymbol() const
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static TOOL_ACTION newSymbol
Definition: ee_actions.h:169
static TOOL_ACTION exportSymbol
Definition: ee_actions.h:177
static TOOL_ACTION copySymbol
Definition: ee_actions.h:174
static TOOL_ACTION saveSymbolAs
Definition: ee_actions.h:168
int Save(const TOOL_EVENT &aEvt)
LIB_ID GetTargetLibId() const
SCH_SCREEN * LastScreen()
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
int UnpinLibrary(const TOOL_EVENT &aEvent)
enum TYPE m_Type
void CreateNewPart()
Create a new part in the selected library.
void SetWidthMils(int aWidthInMils)
Definition: page_info.cpp:243
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:794
Schematic symbol object.
Definition: sch_symbol.h:79
int OnDeMorgan(const TOOL_EVENT &aEvent)
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:72
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:194
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
int AddSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION saveAll
Definition: actions.h:57
void SaveLibraryAs()
Save the currently selected library to a new file.
int ExportSymbolAsSVG(const TOOL_EVENT &aEvent)
int PinLibrary(const TOOL_EVENT &aEvent)
void FinishModal()
Send the selected symbol back to the caller.
static TOOL_ACTION exportSymbolAsSVG
Definition: ee_actions.h:205
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION revert
Definition: actions.h:58
static TOOL_ACTION saveLibraryAs
Definition: ee_actions.h:167
void SVGPlotSymbol(const wxString &aFullFileName)
Create the SVG print file for the current edited symbol.
bool empty() const
Definition: utf8.h:103
The symbol library editor main window.