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 <bitmaps/bitmap_types.h>
37 #include <confirm.h>
38 #include <wx/filedlg.h>
39 
40 
42 {
43  m_frame = getEditFrame<SCH_BASE_FRAME>();
46 
47  if( m_isSymbolEditor )
48  {
49  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
50  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
51 
52  wxCHECK( editFrame, false );
53 
54  auto libSelectedCondition =
55  [ editFrame ]( const SELECTION& aSel )
56  {
57  LIB_ID sel = editFrame->GetTreeLIBID();
58  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
59  };
60  // The libInferredCondition allows you to do things like New Symbol and Paste with a
61  // symbol selected (in other words, when we know the library context even if the library
62  // itself isn't selected.
63  auto libInferredCondition =
64  [ editFrame ]( const SELECTION& aSel )
65  {
66  LIB_ID sel = editFrame->GetTreeLIBID();
67  return !sel.GetLibNickname().empty();
68  };
69  auto pinnedLibSelectedCondition =
70  [ editFrame ]( const SELECTION& aSel )
71  {
72  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
73  return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
74  };
75  auto unpinnedLibSelectedCondition =
76  [ editFrame ](const SELECTION& aSel )
77  {
78  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
79  return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
80  };
81  auto symbolSelectedCondition =
82  [ editFrame ]( const SELECTION& aSel )
83  {
84  LIB_ID sel = editFrame->GetTreeLIBID();
85  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
86  };
87  auto saveSymbolAsCondition =
88  [ editFrame ]( const SELECTION& aSel )
89  {
90  LIB_ID sel = editFrame->GetTargetLibId();
91  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
92  };
93 
94  ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
95  ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
96 
97  ctxMenu.AddSeparator();
98  ctxMenu.AddItem( EE_ACTIONS::newSymbol, libInferredCondition );
99 
100  ctxMenu.AddSeparator();
101  ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition || libInferredCondition );
102  ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition );
103  ctxMenu.AddItem( EE_ACTIONS::saveSymbolAs, saveSymbolAsCondition );
104  ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition || libInferredCondition );
105 
106  ctxMenu.AddSeparator();
107  ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition );
108  ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
109  ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libInferredCondition );
110  ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
111  ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
112 
113  ctxMenu.AddSeparator();
114  ctxMenu.AddItem( EE_ACTIONS::importSymbol, libInferredCondition );
115  ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
116 
117  // If we've got nothing else to show, at least show a hide tree option
118  ctxMenu.AddItem( EE_ACTIONS::hideSymbolTree, !libInferredCondition );
119  }
120 
121  return true;
122 }
123 
124 
126 {
127  bool createNew = aEvent.IsAction( &ACTIONS::newLibrary );
128 
130  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
131 
132  return 0;
133 }
134 
135 
137 {
139  {
140  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
141  int unit = 0;
142  LIB_ID partId = editFrame->GetTreeLIBID( &unit );
143 
144  editFrame->LoadSymbol( partId.GetLibItemName(), partId.GetLibNickname(), unit );
145  }
146 
147  return 0;
148 }
149 
150 
152 {
154  {
155  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
156 
157  LIB_ID sel = editFrame->GetTreeLIBID();
158  const wxString& libName = sel.GetLibNickname();
159  wxString msg;
160 
161  if( libName.IsEmpty() )
162  {
163  msg.Printf( _( "No symbol library selected." ), libName );
164  m_frame->ShowInfoBarError( msg );
165  return 0;
166  }
167 
168  if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
169  {
170  msg.Printf( _( "Symbol library '%s' is not writeable." ), libName );
171  m_frame->ShowInfoBarError( msg );
172  return 0;
173  }
174 
175  if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
176  editFrame->CreateNewSymbol();
177  else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
178  editFrame->ImportSymbol();
179  }
180 
181  return 0;
182 }
183 
184 
186 {
188  {
189  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
190 
191  if( aEvt.IsAction( &EE_ACTIONS::save ) )
192  editFrame->Save();
193  else if( aEvt.IsAction( &EE_ACTIONS::saveLibraryAs ) )
194  editFrame->SaveLibraryAs();
195  else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolAs ) )
196  editFrame->SaveSymbolAs();
197  else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
198  editFrame->SaveAll();
199  }
200 
201  return 0;
202 }
203 
204 
206 {
208  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->Revert();
209 
210  return 0;
211 }
212 
213 
215 {
217  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->ExportSymbol();
218 
219  return 0;
220 }
221 
222 
224 {
226  {
227  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
228 
230  editFrame->CopySymbolToClipboard();
231 
233  {
234  LIB_ID sel = editFrame->GetTreeLIBID();
235  const wxString& libName = sel.GetLibNickname();
236  wxString msg;
237 
238  if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
239  {
240  msg.Printf( _( "Symbol library '%s' is not writeable." ), libName );
241  m_frame->ShowInfoBarError( msg );
242  return 0;
243  }
244 
245  editFrame->DeleteSymbolFromLibrary();
246  }
247  }
248 
249  return 0;
250 }
251 
252 
254 {
256  {
257  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
258 
259  LIB_ID sel = editFrame->GetTreeLIBID();
260  const wxString& libName = sel.GetLibNickname();
261  wxString msg;
262 
263  if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
264  {
265  msg.Printf( _( "Symbol library '%s' is not writeable." ), libName );
266  m_frame->ShowInfoBarError( msg );
267  return 0;
268  }
269 
270  editFrame->DuplicateSymbol( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
271  }
272 
273  return 0;
274 }
275 
276 
278 {
280  LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
281 
283  {
286 
287  SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
288  symbolEditor->SetConvert( convert );
289 
291  symbolEditor->RebuildView();
292  }
294  {
295  SYMBOL_VIEWER_FRAME* symbolViewer = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
296  symbolViewer->SetUnitAndConvert( symbolViewer->GetUnit(), convert );
297  }
298 
299  return 0;
300 }
301 
302 
304 {
306  {
307  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
308  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
309 
310  if( currentNode && !currentNode->m_Pinned )
311  {
312  currentNode->m_Pinned = true;
313  editFrame->RegenerateLibraryTree();
314  }
315  }
316 
317  return 0;
318 }
319 
320 
322 {
324  {
325  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
326  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
327 
328  if( currentNode && currentNode->m_Pinned )
329  {
330  currentNode->m_Pinned = false;
331  editFrame->RegenerateLibraryTree();
332  }
333  }
334 
335  return 0;
336 }
337 
338 
340 {
342  {
343  wxCommandEvent dummy;
344  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->OnToggleSymbolTree( dummy );
345  }
346 
347  return 0;
348 }
349 
350 
352 {
354  renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
355 
356  // Update canvas
358  m_frame->GetCanvas()->Refresh();
359 
360  return 0;
361 }
362 
363 
365 {
366  if( !m_isSymbolEditor )
367  return 0;
368 
369  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
370  editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
371 
372  return 0;
373 }
374 
375 
377 {
378  if( !m_isSymbolEditor )
379  return 0;
380 
381  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
382  LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
383 
384  if( !symbol )
385  {
386  wxMessageBox( _( "No symbol to export" ) );
387  return 0;
388  }
389 
390  wxString file_ext = wxT( "png" );
391  wxString mask = wxT( "*." ) + file_ext;
392  wxFileName fn( symbol->GetName() );
393  fn.SetExt( "png" );
394 
395  wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
396 
397  wxFileDialog dlg( editFrame, _( "Image File Name" ), projectPath, fn.GetFullName(),
398  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
399 
400  if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
401  {
402  // calling wxYield is mandatory under Linux, after closing the file selector dialog
403  // to refresh the screen before creating the PNG or JPEG image from screen
404  wxYield();
405 
406  if( !SaveCanvasImageToFile( editFrame, dlg.GetPath(), BITMAP_TYPE::PNG ) )
407  {
408  wxMessageBox( wxString::Format( _( "Can't save file '%s'." ), dlg.GetPath() ) );
409  }
410  }
411 
412  return 0;
413 }
414 
415 
417 {
418  if( !m_isSymbolEditor )
419  return 0;
420 
421  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
422  LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
423 
424  if( !symbol )
425  {
426  wxMessageBox( _( "No symbol to export" ) );
427  return 0;
428  }
429 
430  wxString file_ext = wxT( "svg" );
431  wxString mask = wxT( "*." ) + file_ext;
432  wxFileName fn( symbol->GetName() );
433  fn.SetExt( file_ext );
434 
435  wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
436 
437  wxString fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir, fn.GetFullName(),
438  file_ext, mask, m_frame, wxFD_SAVE, true );
439 
440  if( !fullFileName.IsEmpty() )
441  {
442  PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
443  PAGE_INFO pageTemp = pageSave;
444 
445  wxSize symbolSize = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
446  editFrame->GetConvert() ).GetSize();
447 
448  // Add a small margin to the plot bounding box
449  pageTemp.SetWidthMils( int( symbolSize.x * 1.2 ) );
450  pageTemp.SetHeightMils( int( symbolSize.y * 1.2 ) );
451 
452  editFrame->GetScreen()->SetPageSettings( pageTemp );
453  editFrame->SVGPlotSymbol( fullFileName );
454  editFrame->GetScreen()->SetPageSettings( pageSave );
455  }
456 
457  return 0;
458 }
459 
460 
462 {
463  LIB_SYMBOL* libSymbol = nullptr;
464  LIB_ID libId;
465  int unit, convert;
466 
467  if( m_isSymbolEditor )
468  {
469  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
470 
471  libSymbol = editFrame->GetCurSymbol();
472  unit = editFrame->GetUnit();
473  convert = editFrame->GetConvert();
474 
475  if( libSymbol )
476  libId = libSymbol->GetLibId();
477  }
478  else
479  {
480  SYMBOL_VIEWER_FRAME* viewerFrame = getEditFrame<SYMBOL_VIEWER_FRAME>();
481 
482  if( viewerFrame->IsModal() )
483  {
484  // if we're modal then we just need to return the symbol selection; the caller is
485  // already in a EE_ACTIONS::placeSymbol coroutine.
486  viewerFrame->FinishModal();
487  return 0;
488  }
489  else
490  {
491  libSymbol = viewerFrame->GetSelectedSymbol();
492  unit = viewerFrame->GetUnit();
493  convert = viewerFrame->GetConvert();
494 
495  if( libSymbol )
496  libId = libSymbol->GetLibId();
497  }
498  }
499 
500  if( libSymbol )
501  {
502  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
503 
504  if( !schframe ) // happens when the schematic editor is not active (or closed)
505  {
506  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
507  return 0;
508  }
509 
510  wxCHECK( libSymbol->GetLibId().IsValid(), 0 );
511 
512  SCH_SYMBOL* symbol = new SCH_SYMBOL( *libSymbol, libId, &schframe->GetCurrentSheet(),
513  unit, convert );
514 
515  symbol->SetParent( schframe->GetScreen() );
516 
517  if( schframe->eeconfig()->m_AutoplaceFields.enable )
518  symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
519 
520  schframe->Raise();
521  schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, true, symbol );
522  }
523 
524  return 0;
525 }
526 
527 
529 {
535 
541 
551 
554 
561 }
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:109
int ShowElectricalTypes(const TOOL_EVENT &aEvent)
void setTransitions() override
< Set up handlers for various events.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
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:53
static TOOL_ACTION pasteSymbol
Definition: ee_actions.h:174
static TOOL_ACTION hideSymbolTree
Definition: ee_actions.h:201
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:265
This file is part of the common library TODO brief description.
Model changes (required full reload)
Definition: tool_base.h:80
This file is part of the common library.
wxString GetName() const override
Definition: lib_symbol.h:133
static TOOL_ACTION showSymbolTree
Definition: ee_actions.h:200
static TOOL_ACTION duplicateSymbol
Definition: ee_actions.h:170
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1415
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:143
void Save()
Save the selected symbol or library.
int ExportView(const TOOL_EVENT &aEvent)
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:125
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:382
void SaveAll()
Save all modified symbols and libraries.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static TOOL_ACTION unpinLibrary
Definition: actions.h:110
Schematic editor (Eeschema) main window.
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:159
Define a library symbol object.
Definition: lib_symbol.h:96
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:124
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:124
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:116
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:88
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.
Definition: sch_symbol.cpp:71
int AddLibrary(const TOOL_EVENT &aEvent)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
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
Definition: ee_actions.h:169
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.
bool SaveCanvasImageToFile(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
Definition: bitmap.cpp:204
LIB_ID GetLibId() const override
Definition: lib_symbol.h:135
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:51
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:152
SYMBOL_LIBRARY_MANAGER & GetLibManager()
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:805
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:171
static TOOL_ACTION cutSymbol
Definition: ee_actions.h:172
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:49
#define _(s)
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:90
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:177
int ToggleSyncedPinsMode(const TOOL_EVENT &aEvent)
void DeleteSymbolFromLibrary()
static TOOL_ACTION importSymbol
Definition: ee_actions.h:175
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:53
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:74
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:116
int DuplicateSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:163
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
Definition: actions.h:48
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:123
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:173
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:199
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:257
static TOOL_ACTION exportSymbolView
Definition: ee_actions.h:204
wxString PngFileWildcard()
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:168
static TOOL_ACTION exportSymbol
Definition: ee_actions.h:176
static TOOL_ACTION copySymbol
Definition: ee_actions.h:173
static TOOL_ACTION saveSymbolAs
Definition: ee_actions.h:167
int Save(const TOOL_EVENT &aEvt)
LIB_ID GetTargetLibId() const
int ToggleSymbolTree(const TOOL_EVENT &aEvent)
Schematic symbol object.
Definition: sch_symbol.h:78
bool IsType(FRAME_T aType) const
int UnpinLibrary(const TOOL_EVENT &aEvent)
enum TYPE m_Type
LIB_SYMBOL * GetSelectedSymbol() const
void SetWidthMils(int aWidthInMils)
Definition: page_info.cpp:243
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...
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
int OnDeMorgan(const TOOL_EVENT &aEvent)
Store schematic specific render settings.
Definition: sch_painter.h:70
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:193
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
int AddSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION saveAll
Definition: actions.h:54
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:55
static TOOL_ACTION saveLibraryAs
Definition: ee_actions.h:166
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.
bool empty() const
Definition: utf8.h:103
The symbol library editor main window.