KiCad PCB EDA Suite
lib_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-2020 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>
29 #include <tools/lib_control.h>
30 #include <symbol_edit_frame.h>
31 #include <lib_view_frame.h>
34 #include <gestfich.h>
35 #include <confirm.h>
36 
37 
39 {
40  m_frame = getEditFrame<SCH_BASE_FRAME>();
43 
44  if( m_isSymbolEditor )
45  {
46  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
47  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
48 
49  auto libSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) {
50  LIB_ID sel = editFrame->GetTreeLIBID();
51  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
52  };
53  auto pinnedLibSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) {
54  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
55  return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
56  };
57  auto unpinnedLibSelectedCondition = [ editFrame ] (const SELECTION& aSel ) {
58  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
59  return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
60  };
61  auto symbolSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) {
62  LIB_ID sel = editFrame->GetTreeLIBID();
63  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
64  };
65 
66  ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
67  ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
68  ctxMenu.AddSeparator();
69 
70  ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
71  ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
72  ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
73 
74  ctxMenu.AddSeparator();
75  ctxMenu.AddItem( EE_ACTIONS::newSymbol, libSelectedCondition );
76  ctxMenu.AddItem( EE_ACTIONS::editSymbol, symbolSelectedCondition );
77 
78  ctxMenu.AddSeparator();
79  ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition );
80  ctxMenu.AddItem( ACTIONS::saveCopyAs, symbolSelectedCondition );
81  ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
82  ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
83  ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition );
84 
85  ctxMenu.AddSeparator();
86  ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition );
87  ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
88  ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libSelectedCondition );
89 
90  ctxMenu.AddSeparator();
91  ctxMenu.AddItem( EE_ACTIONS::importSymbol, libSelectedCondition );
92  ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
93  }
94 
95  return true;
96 }
97 
98 
99 int LIB_CONTROL::AddLibrary( const TOOL_EVENT& aEvent )
100 {
101  bool createNew = aEvent.IsAction( &ACTIONS::newLibrary );
102 
104  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
105 
106  return 0;
107 }
108 
109 
111 {
113  {
114  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
115  int unit = 0;
116  LIB_ID partId = editFrame->GetTreeLIBID( &unit );
117 
118  editFrame->LoadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit );
119  }
120 
121  return 0;
122 }
123 
124 
125 int LIB_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
126 {
128  {
129  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
130 
131  if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
132  editFrame->CreateNewPart();
133  else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
134  editFrame->ImportPart();
135  }
136 
137  return 0;
138 }
139 
140 
141 int LIB_CONTROL::Save( const TOOL_EVENT& aEvt )
142 {
144  {
145  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
146 
147  if( aEvt.IsAction( &EE_ACTIONS::save ) )
148  editFrame->Save();
149  else if( aEvt.IsAction( &EE_ACTIONS::saveAs ) || aEvt.IsAction( &EE_ACTIONS::saveCopyAs ) )
150  editFrame->SaveAs();
151  else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
152  editFrame->SaveAll();
153  }
154 
155  return 0;
156 }
157 
158 
159 int LIB_CONTROL::Revert( const TOOL_EVENT& aEvent )
160 {
162  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->Revert();
163 
164  return 0;
165 }
166 
167 
169 {
171  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->ExportPart();
172 
173  return 0;
174 }
175 
176 
178 {
180  {
181  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
182 
184  editFrame->CopyPartToClipboard();
185 
187  editFrame->DeletePartFromLibrary();
188  }
189 
190  return 0;
191 }
192 
193 
195 {
197  {
198  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
199  editFrame->DuplicatePart( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
200  }
201 
202  return 0;
203 }
204 
205 
207 {
208  int convert = aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) ?
209  LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
210 
212  {
215 
216  SYMBOL_EDIT_FRAME* libEditFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
217  libEditFrame->SetConvert( convert );
218 
220  libEditFrame->RebuildView();
221  }
223  {
224  LIB_VIEW_FRAME* libViewFrame = static_cast<LIB_VIEW_FRAME*>( m_frame );
225  libViewFrame->SetUnitAndConvert( libViewFrame->GetUnit(), convert );
226  }
227 
228  return 0;
229 }
230 
231 
233 {
235  {
236  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
237  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
238 
239  if( currentNode && !currentNode->m_Pinned )
240  {
241  currentNode->m_Pinned = true;
242  editFrame->RegenerateLibraryTree();
243  }
244  }
245 
246  return 0;
247 }
248 
249 
251 {
253  {
254  SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
255  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
256 
257  if( currentNode && currentNode->m_Pinned )
258  {
259  currentNode->m_Pinned = false;
260  editFrame->RegenerateLibraryTree();
261  }
262  }
263 
264  return 0;
265 }
266 
267 
269 {
271  {
272  wxCommandEvent dummy;
273  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->OnToggleSearchTree( dummy );
274  }
275 
276  return 0;
277 }
278 
279 
281 {
283  renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
284 
285  // Update canvas
287  m_frame->GetCanvas()->Refresh();
288 
289  return 0;
290 }
291 
292 
294 {
295  if( !m_isSymbolEditor )
296  return 0;
297 
298  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
299  editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
300 
301  return 0;
302 }
303 
304 
306 {
307  if( !m_isSymbolEditor )
308  return 0;
309 
310  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
311  LIB_PART* part = editFrame->GetCurPart();
312 
313  if( !part )
314  {
315  wxMessageBox( _( "No symbol to export" ) );
316  return 0;
317  }
318 
319  wxString file_ext = wxT( "png" );
320  wxString mask = wxT( "*." ) + file_ext;
321  wxFileName fn( part->GetName() );
322  fn.SetExt( "png" );
323 
324  wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
325 
326  wxFileDialog dlg( editFrame, _( "Image File Name" ), projectPath, fn.GetFullName(),
327  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
328 
329  if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
330  {
331  // calling wxYield is mandatory under Linux, after closing the file selector dialog
332  // to refresh the screen before creating the PNG or JPEG image from screen
333  wxYield();
334 
335  if( !SaveCanvasImageToFile( editFrame, dlg.GetPath(), wxBITMAP_TYPE_PNG ) )
336  {
337  wxMessageBox( wxString::Format( _( "Can't save file \"%s\"." ), dlg.GetPath() ) );
338  }
339  }
340 
341  return 0;
342 }
343 
344 
346 {
347  if( !m_isSymbolEditor )
348  return 0;
349 
350  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
351  LIB_PART* part = editFrame->GetCurPart();
352 
353  if( !part )
354  {
355  wxMessageBox( _( "No symbol to export" ) );
356  return 0;
357  }
358 
359  wxString file_ext = wxT( "svg" );
360  wxString mask = wxT( "*." ) + file_ext;
361  wxFileName fn( part->GetName() );
362  fn.SetExt( file_ext );
363 
364  wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
365 
366  wxString fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir, fn.GetFullName(),
367  file_ext, mask, m_frame, wxFD_SAVE, true );
368 
369  if( !fullFileName.IsEmpty() )
370  {
371  PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
372  PAGE_INFO pageTemp = pageSave;
373 
374  wxSize componentSize = part->GetUnitBoundingBox( editFrame->GetUnit(),
375  editFrame->GetConvert() ).GetSize();
376 
377  // Add a small margin to the plot bounding box
378  pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
379  pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
380 
381  editFrame->GetScreen()->SetPageSettings( pageTemp );
382  editFrame->SVGPlotSymbol( fullFileName );
383  editFrame->GetScreen()->SetPageSettings( pageSave );
384  }
385 
386  return 0;
387 }
388 
389 
391 {
392  LIB_PART* part = nullptr;
393  LIB_ID libId;
394  int unit, convert;
395 
396  if( m_isSymbolEditor )
397  {
398  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
399 
400  part = editFrame->GetCurPart();
401  unit = editFrame->GetUnit();
402  convert = editFrame->GetConvert();
403 
404  if( part )
405  libId = part->GetLibId();
406  }
407  else
408  {
409  LIB_VIEW_FRAME* viewFrame = getEditFrame<LIB_VIEW_FRAME>();
410 
411  if( viewFrame->IsModal() )
412  {
413  // if we're modal then we just need to return the symbol selection; the caller is
414  // already in a EE_ACTIONS::placeSymbol coroutine.
415  viewFrame->FinishModal();
416  return 0;
417  }
418  else
419  {
420  part = viewFrame->GetSelectedSymbol();
421  unit = viewFrame->GetUnit();
422  convert = viewFrame->GetConvert();
423 
424  if( part )
425  libId = part->GetLibId();
426  }
427  }
428 
429  if( part )
430  {
431  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
432 
433  if( !schframe ) // happens when the schematic editor is not active (or closed)
434  {
435  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
436  return 0;
437  }
438 
439  wxCHECK( part->GetLibId().IsValid(), 0 );
440 
441  SCH_COMPONENT* comp = new SCH_COMPONENT( *part, libId, &schframe->GetCurrentSheet(), unit,
442  convert );
443 
444  comp->SetParent( schframe->GetCurrentSheet().LastScreen() );
445 
446  if( schframe->eeconfig()->m_AutoplaceFields.enable )
447  comp->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
448 
449  schframe->Raise();
450  schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, true, comp );
451  }
452 
453  return 0;
454 }
455 
456 
458 {
459  wxCHECK( m_isSymbolEditor, 0 );
460 
461  SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
462 
463  wxCHECK( editFrame, 0 );
464 
465  LIB_PART* currentPart = editFrame->GetCurPart();
466 
467  wxCHECK( currentPart, 0 );
468 
469  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
470 
471  if( !schframe ) // happens when the schematic editor is not active (or closed)
472  {
473  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
474  return 0;
475  }
476 
477  schframe->UpdateSymbolFromEditor( *currentPart );
478 
479  SCH_SCREEN* currentScreen = editFrame->GetScreen();
480 
481  wxCHECK( currentScreen, 0 );
482 
483  currentScreen->ClrModify();
484 
485  return 0;
486 }
487 
488 
490 {
496 
497  Go( &LIB_CONTROL::Save, ACTIONS::save.MakeEvent() );
498  Go( &LIB_CONTROL::Save, ACTIONS::saveAs.MakeEvent() ); // for libraries
499  Go( &LIB_CONTROL::Save, ACTIONS::saveCopyAs.MakeEvent() ); // for symbols
500  Go( &LIB_CONTROL::Save, ACTIONS::saveAll.MakeEvent() );
501  Go( &LIB_CONTROL::Revert, ACTIONS::revert.MakeEvent() );
503  EE_ACTIONS::saveInSchematic.MakeEvent() );
504 
514 
517 
523 }
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
static TOOL_ACTION pinLibrary
Definition: actions.h:112
int UpdateSymbolInSchematic(const TOOL_EVENT &aEvent)
int AddLibrary(const TOOL_EVENT &aEvent)
Definition: lib_control.cpp:99
LIB_PART * GetSelectedSymbol() const
int UnpinLibrary(const TOOL_EVENT &aEvent)
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
int EditSymbol(const TOOL_EVENT &aEvent)
LIB_ID GetLibId() const override
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
static TOOL_ACTION pasteSymbol
Definition: ee_actions.h:176
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:253
This file is part of the common library TODO brief description.
wxString GetName() const override
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:82
This file is part of the common library.
int PinLibrary(const TOOL_EVENT &aEvent)
int ToggleSyncedPinsMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION duplicateSymbol
Definition: ee_actions.h:172
int AddSymbol(const TOOL_EVENT &aEvent)
int ShowElectricalTypes(const TOOL_EVENT &aEvent)
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
int GetUnit() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1417
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...
void SaveAs()
Saves the selected part or library to a new name and/or location.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:141
void Save()
Saves the selected part or library.
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:182
void SaveAll()
Saves all modified parts and libraries.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static TOOL_ACTION unpinLibrary
Definition: actions.h:113
int ExportView(const TOOL_EVENT &aEvent)
Schematic editor (Eeschema) main window.
static TOOL_ACTION showComponentTree
Definition: ee_actions.h:203
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
int ExportSymbol(const TOOL_EVENT &aEvent)
bool IsValid() const
Definition: lib_id.h:171
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:128
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:181
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
Symbol library viewer main window.
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:184
int GetConvert() const
static TOOL_ACTION saveCopyAs
Definition: actions.h:56
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
void LoadPart(const wxString &aLibrary, const wxString &aPart, int Unit)
EESCHEMA_SETTINGS * eeconfig() const
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:171
AUTOPLACE_FIELDS m_AutoplaceFields
Item is being added to the view.
Definition: view_item.h:62
void UpdateSymbolFromEditor(const LIB_PART &aSymbol)
Update the LIB_PART of the currently selected symbol.
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
void SetConvert(int aConvert)
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
static TOOL_ACTION save
Definition: actions.h:54
void DuplicatePart(bool aFromClipboard)
Inserts a duplicate part.
int Save(const TOOL_EVENT &aEvt)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT.
Definition: tool_event.h:171
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)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:52
static TOOL_ACTION deleteSymbol
Definition: ee_actions.h:173
Define a library symbol object.
static TOOL_ACTION cutSymbol
Definition: ee_actions.h:174
Definition of file extensions used in Kicad.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
static TOOL_ACTION addLibrary
Definition: actions.h:52
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:181
static TOOL_ACTION importSymbol
Definition: ee_actions.h:177
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:77
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:116
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:167
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
int AddSymbolToSchematic(const TOOL_EVENT &aEvent)
void setTransitions() override
Sets up handlers for various events.
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: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:178
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:202
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:257
static TOOL_ACTION exportSymbolView
Definition: ee_actions.h:206
static TOOL_ACTION saveInSchematic
Definition: ee_actions.h:181
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()
void AddSeparator(int aOrder=ANY_ORDER)
Adds a separator to the menu.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static TOOL_ACTION newSymbol
Definition: ee_actions.h:170
static TOOL_ACTION exportSymbol
Definition: ee_actions.h:178
static TOOL_ACTION copySymbol
Definition: ee_actions.h:175
int CutCopyDelete(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
SCH_SCREEN * LastScreen()
bool IsType(FRAME_T aType) const
static TOOL_ACTION saveAs
Definition: actions.h:55
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
#define _(s)
Definition: 3d_actions.cpp:33
void FinishModal()
Send the selected symbol back to the caller.
enum TYPE m_Type
void CreateNewPart()
Creates 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.
void ClrModify()
Definition: base_screen.h:121
Schematic symbol object.
Definition: sch_component.h:79
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:70
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:196
int ExportSymbolAsSVG(const TOOL_EVENT &aEvent)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:76
static TOOL_ACTION saveAll
Definition: actions.h:57
int DuplicateSymbol(const TOOL_EVENT &aEvent)
static TOOL_ACTION exportSymbolAsSVG
Definition: ee_actions.h:207
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Adds a menu entry to run a TOOL_ACTION on selected items.
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: lib_control.cpp:38
int ShowComponentTree(const TOOL_EVENT &aEvent)
static TOOL_ACTION revert
Definition: actions.h:58
int OnDeMorgan(const TOOL_EVENT &aEvent)
void SVGPlotSymbol(const wxString &aFullFileName)
Creates the SVG print file for the current edited symbol.
bool empty() const
Definition: utf8.h:108
The symbol library editor main window.