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>
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." ) );
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 writable." ), 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 writable." ), 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  LIB_ID sel = editFrame->GetTargetLibId();
259  // DuplicateSymbol() is called to duplicate a symbol, or to paste a previously
260  // saved symbol in clipboard
261  bool isPasteAction = aEvent.IsAction( &EE_ACTIONS::pasteSymbol );
262  wxString msg;
263 
264  if( !sel.IsValid() && !isPasteAction )
265  {
266  // When duplicating a symbol, a source symbol must exists.
267  msg.Printf( _( "No symbol selected" ) );
268  m_frame->ShowInfoBarError( msg );
269  return 0;
270  }
271 
272  const wxString& libName = sel.GetLibNickname();
273 
274  if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
275  {
276  msg.Printf( _( "Symbol library '%s' is not writable." ), libName );
277  m_frame->ShowInfoBarError( msg );
278  return 0;
279  }
280 
281  editFrame->DuplicateSymbol( isPasteAction );
282  }
283 
284  return 0;
285 }
286 
287 
289 {
291  LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
292 
294  {
297 
298  SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
299  symbolEditor->SetConvert( convert );
300 
302  symbolEditor->RebuildView();
303  }
305  {
306  SYMBOL_VIEWER_FRAME* symbolViewer = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
307  symbolViewer->SetUnitAndConvert( symbolViewer->GetUnit(), convert );
308  }
309 
310  return 0;
311 }
312 
313 
315 {
317  {
318  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
319  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
320 
321  if( currentNode && !currentNode->m_Pinned )
322  {
323  currentNode->m_Pinned = true;
324  editFrame->RegenerateLibraryTree();
325  }
326  }
327 
328  return 0;
329 }
330 
331 
333 {
335  {
336  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
337  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
338 
339  if( currentNode && currentNode->m_Pinned )
340  {
341  currentNode->m_Pinned = false;
342  editFrame->RegenerateLibraryTree();
343  }
344  }
345 
346  return 0;
347 }
348 
349 
351 {
353  {
354  wxCommandEvent dummy;
355  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->OnToggleSymbolTree( dummy );
356  }
357 
358  return 0;
359 }
360 
361 
363 {
365  renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
366 
367  // Update canvas
369  m_frame->GetCanvas()->Refresh();
370 
371  return 0;
372 }
373 
374 
376 {
377  if( !m_isSymbolEditor )
378  return 0;
379 
380  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
381  editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
382 
383  return 0;
384 }
385 
386 
388 {
389  if( !m_isSymbolEditor )
390  return 0;
391 
392  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
393  LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
394 
395  if( !symbol )
396  {
397  wxMessageBox( _( "No symbol to export" ) );
398  return 0;
399  }
400 
401  wxString file_ext = wxT( "png" );
402  wxString mask = wxT( "*." ) + file_ext;
403  wxFileName fn( symbol->GetName() );
404  fn.SetExt( wxT( "png" ) );
405 
406  wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
407 
408  wxFileDialog dlg( editFrame, _( "Image File Name" ), projectPath, fn.GetFullName(),
409  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
410 
411  if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
412  {
413  // calling wxYield is mandatory under Linux, after closing the file selector dialog
414  // to refresh the screen before creating the PNG or JPEG image from screen
415  wxYield();
416 
417  if( !SaveCanvasImageToFile( editFrame, dlg.GetPath(), BITMAP_TYPE::PNG ) )
418  {
419  wxMessageBox( wxString::Format( _( "Can't save file '%s'." ), dlg.GetPath() ) );
420  }
421  }
422 
423  return 0;
424 }
425 
426 
428 {
429  if( !m_isSymbolEditor )
430  return 0;
431 
432  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
433  LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
434 
435  if( !symbol )
436  {
437  wxMessageBox( _( "No symbol to export" ) );
438  return 0;
439  }
440 
441  wxString file_ext = SVGFileExtension;
442  wxFileName fn( symbol->GetName() );
443  fn.SetExt( SVGFileExtension );
444 
445  wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
446 
447  wxString fullFileName = wxFileSelector( _( "SVG File Name" ), pro_dir, fn.GetFullName(),
448  SVGFileExtension, SVGFileWildcard(), wxFD_SAVE,
449  m_frame );
450 
451  if( !fullFileName.IsEmpty() )
452  {
453  PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
454  PAGE_INFO pageTemp = pageSave;
455 
456  wxSize symbolSize = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
457  editFrame->GetConvert() ).GetSize();
458 
459  // Add a small margin to the plot bounding box
460  pageTemp.SetWidthMils( int( symbolSize.x * 1.2 ) );
461  pageTemp.SetHeightMils( int( symbolSize.y * 1.2 ) );
462 
463  editFrame->GetScreen()->SetPageSettings( pageTemp );
464  editFrame->SVGPlotSymbol( fullFileName );
465  editFrame->GetScreen()->SetPageSettings( pageSave );
466  }
467 
468  return 0;
469 }
470 
471 
473 {
474  LIB_SYMBOL* libSymbol = nullptr;
475  LIB_ID libId;
476  int unit, convert;
477 
478  if( m_isSymbolEditor )
479  {
480  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
481 
482  libSymbol = editFrame->GetCurSymbol();
483  unit = editFrame->GetUnit();
484  convert = editFrame->GetConvert();
485 
486  if( libSymbol )
487  libId = libSymbol->GetLibId();
488  }
489  else
490  {
491  SYMBOL_VIEWER_FRAME* viewerFrame = getEditFrame<SYMBOL_VIEWER_FRAME>();
492 
493  if( viewerFrame->IsModal() )
494  {
495  // if we're modal then we just need to return the symbol selection; the caller is
496  // already in a EE_ACTIONS::placeSymbol coroutine.
497  viewerFrame->FinishModal();
498  return 0;
499  }
500  else
501  {
502  libSymbol = viewerFrame->GetSelectedSymbol();
503  unit = viewerFrame->GetUnit();
504  convert = viewerFrame->GetConvert();
505 
506  if( libSymbol )
507  libId = libSymbol->GetLibId();
508  }
509  }
510 
511  if( libSymbol )
512  {
513  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
514 
515  if( !schframe ) // happens when the schematic editor is not active (or closed)
516  {
517  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
518  return 0;
519  }
520 
521  wxCHECK( libSymbol->GetLibId().IsValid(), 0 );
522 
523  SCH_SYMBOL* symbol = new SCH_SYMBOL( *libSymbol, libId, &schframe->GetCurrentSheet(),
524  unit, convert );
525 
526  symbol->SetParent( schframe->GetScreen() );
527 
528  if( schframe->eeconfig()->m_AutoplaceFields.enable )
529  symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
530 
531  schframe->Raise();
532  schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, true, symbol );
533  }
534 
535  return 0;
536 }
537 
538 
540 {
546 
552 
562 
565 
572 }
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
wxString SVGFileWildcard()
static TOOL_ACTION pasteSymbol
Definition: ee_actions.h:179
static TOOL_ACTION hideSymbolTree
Definition: ee_actions.h:206
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
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:205
static TOOL_ACTION duplicateSymbol
Definition: ee_actions.h:175
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:1482
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:133
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:393
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:128
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:132
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:115
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:72
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
Definition: ee_actions.h:174
AUTOPLACE_FIELDS m_AutoplaceFields
Item needs to be redrawn.
Definition: view_item.h:52
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:207
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:868
static TOOL_ACTION deleteSymbol
Definition: ee_actions.h:176
static TOOL_ACTION cutSymbol
Definition: ee_actions.h:177
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:179
int ToggleSyncedPinsMode(const TOOL_EVENT &aEvent)
void DeleteSymbolFromLibrary()
static TOOL_ACTION importSymbol
Definition: ee_actions.h:180
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:78
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:168
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:127
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:204
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:257
static TOOL_ACTION exportSymbolView
Definition: ee_actions.h:209
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:173
static TOOL_ACTION exportSymbol
Definition: ee_actions.h:181
static TOOL_ACTION copySymbol
Definition: ee_actions.h:178
static TOOL_ACTION saveSymbolAs
Definition: ee_actions.h:172
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...
const std::string SVGFileExtension
int OnDeMorgan(const TOOL_EVENT &aEvent)
Store schematic specific render settings.
Definition: sch_painter.h:66
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:198
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:210
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:171
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.