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 <fctsys.h>
26 #include <kiway.h>
27 #include <sch_painter.h>
28 #include <tool/tool_manager.h>
29 #include <tools/ee_actions.h>
30 #include <tools/lib_control.h>
31 #include <lib_edit_frame.h>
32 #include <lib_view_frame.h>
35 #include <gestfich.h>
36 #include <confirm.h>
37 
38 
40 {
41  m_frame = getEditFrame<SCH_BASE_FRAME>();
44 
45  if( m_isLibEdit )
46  {
47  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
48  LIB_EDIT_FRAME* editFrame = getEditFrame<LIB_EDIT_FRAME>();
49 
50  auto libSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) {
51  LIB_ID sel = editFrame->GetTreeLIBID();
52  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
53  };
54  auto pinnedLibSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) {
55  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
56  return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
57  };
58  auto unpinnedLibSelectedCondition = [ editFrame ] (const SELECTION& aSel ) {
59  LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
60  return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
61  };
62  auto symbolSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) {
63  LIB_ID sel = editFrame->GetTreeLIBID();
64  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
65  };
66 
67  ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
68  ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
69  ctxMenu.AddSeparator();
70 
71  ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
72  ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
73  ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
74 
75  ctxMenu.AddSeparator();
76  ctxMenu.AddItem( EE_ACTIONS::newSymbol, libSelectedCondition );
77  ctxMenu.AddItem( EE_ACTIONS::editSymbol, symbolSelectedCondition );
78 
79  ctxMenu.AddSeparator();
80  ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition );
81  ctxMenu.AddItem( ACTIONS::saveCopyAs, symbolSelectedCondition );
82  ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
83  ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
84  ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition );
85 
86  ctxMenu.AddSeparator();
87  ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition );
88  ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
89  ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libSelectedCondition );
90 
91  ctxMenu.AddSeparator();
92  ctxMenu.AddItem( EE_ACTIONS::importSymbol, libSelectedCondition );
93  ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
94  }
95 
96  return true;
97 }
98 
99 
101 {
102  bool createNew = aEvent.IsAction( &ACTIONS::newLibrary );
103 
105  static_cast<LIB_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
106 
107  return 0;
108 }
109 
110 
112 {
114  {
115  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
116  int unit = 0;
117  LIB_ID partId = editFrame->GetTreeLIBID( &unit );
118 
119  editFrame->LoadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit );
120  }
121 
122  return 0;
123 }
124 
125 
126 int LIB_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
127 {
129  {
130  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
131 
132  if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
133  editFrame->CreateNewPart();
134  else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
135  editFrame->ImportPart();
136  }
137 
138  return 0;
139 }
140 
141 
142 int LIB_CONTROL::Save( const TOOL_EVENT& aEvt )
143 {
145  {
146  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
147 
148  if( aEvt.IsAction( &EE_ACTIONS::save ) )
149  editFrame->Save();
150  else if( aEvt.IsAction( &EE_ACTIONS::saveAs ) || aEvt.IsAction( &EE_ACTIONS::saveCopyAs ) )
151  editFrame->SaveAs();
152  else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
153  editFrame->SaveAll();
154  }
155 
156  return 0;
157 }
158 
159 
160 int LIB_CONTROL::Revert( const TOOL_EVENT& aEvent )
161 {
163  static_cast<LIB_EDIT_FRAME*>( m_frame )->Revert();
164 
165  return 0;
166 }
167 
168 
170 {
172  static_cast<LIB_EDIT_FRAME*>( m_frame )->ExportPart();
173 
174  return 0;
175 }
176 
177 
179 {
181  {
182  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
183 
185  editFrame->CopyPartToClipboard();
186 
188  editFrame->DeletePartFromLibrary();
189  }
190 
191  return 0;
192 }
193 
194 
196 {
198  {
199  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
200  editFrame->DuplicatePart( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
201  }
202 
203  return 0;
204 }
205 
206 
208 {
209  int convert = aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) ?
210  LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
211 
213  {
216 
217  LIB_EDIT_FRAME* libEditFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
218  libEditFrame->SetConvert( convert );
219 
221  libEditFrame->RebuildView();
222  }
224  {
225  LIB_VIEW_FRAME* libViewFrame = static_cast<LIB_VIEW_FRAME*>( m_frame );
226  libViewFrame->SetUnitAndConvert( libViewFrame->GetUnit(), convert );
227  }
228 
229  return 0;
230 }
231 
232 
234 {
236  {
237  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
238  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
239 
240  if( currentNode && !currentNode->m_Pinned )
241  {
242  currentNode->m_Pinned = true;
243  editFrame->RegenerateLibraryTree();
244  }
245  }
246 
247  return 0;
248 }
249 
250 
252 {
254  {
255  LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
256  LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
257 
258  if( currentNode && currentNode->m_Pinned )
259  {
260  currentNode->m_Pinned = false;
261  editFrame->RegenerateLibraryTree();
262  }
263  }
264 
265  return 0;
266 }
267 
268 
270 {
272  {
273  wxCommandEvent dummy;
274  static_cast<LIB_EDIT_FRAME*>( m_frame )->OnToggleSearchTree( dummy );
275  }
276 
277  return 0;
278 }
279 
280 
282 {
284  renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
285 
286  // Update canvas
288  m_frame->GetCanvas()->Refresh();
289 
290  return 0;
291 }
292 
293 
295 {
296  if( !m_isLibEdit )
297  return 0;
298 
299  LIB_EDIT_FRAME* editFrame = getEditFrame<LIB_EDIT_FRAME>();
300  editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
301 
302  return 0;
303 }
304 
305 
307 {
308  if( !m_isLibEdit )
309  return 0;
310 
311  LIB_EDIT_FRAME* editFrame = getEditFrame<LIB_EDIT_FRAME>();
312  LIB_PART* part = editFrame->GetCurPart();
313 
314  if( !part )
315  {
316  wxMessageBox( _( "No symbol to export" ) );
317  return 0;
318  }
319 
320  wxString file_ext = wxT( "png" );
321  wxString mask = wxT( "*." ) + file_ext;
322  wxFileName fn( part->GetName() );
323  fn.SetExt( "png" );
324 
325  wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
326 
327  wxFileDialog dlg( editFrame, _( "Image File Name" ), projectPath, fn.GetFullName(),
328  PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
329 
330  if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
331  {
332  // calling wxYield is mandatory under Linux, after closing the file selector dialog
333  // to refresh the screen before creating the PNG or JPEG image from screen
334  wxYield();
335 
336  if( !SaveCanvasImageToFile( editFrame, dlg.GetPath(), wxBITMAP_TYPE_PNG ) )
337  {
338  wxMessageBox( wxString::Format( _( "Can't save file \"%s\"." ), dlg.GetPath() ) );
339  }
340  }
341 
342  return 0;
343 }
344 
345 
347 {
348  if( !m_isLibEdit )
349  return 0;
350 
351  LIB_EDIT_FRAME* editFrame = getEditFrame<LIB_EDIT_FRAME>();
352  LIB_PART* part = editFrame->GetCurPart();
353 
354  if( !part )
355  {
356  wxMessageBox( _( "No symbol to export" ) );
357  return 0;
358  }
359 
360  wxString file_ext = wxT( "svg" );
361  wxString mask = wxT( "*." ) + file_ext;
362  wxFileName fn( part->GetName() );
363  fn.SetExt( file_ext );
364 
365  wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
366 
367  wxString fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir, fn.GetFullName(),
368  file_ext, mask, m_frame, wxFD_SAVE, true );
369 
370  if( !fullFileName.IsEmpty() )
371  {
372  PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
373  PAGE_INFO pageTemp = pageSave;
374 
375  wxSize componentSize = part->GetUnitBoundingBox( editFrame->GetUnit(),
376  editFrame->GetConvert() ).GetSize();
377 
378  // Add a small margin to the plot bounding box
379  pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
380  pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
381 
382  editFrame->GetScreen()->SetPageSettings( pageTemp );
383  editFrame->SVG_PlotComponent( fullFileName );
384  editFrame->GetScreen()->SetPageSettings( pageSave );
385  }
386 
387  return 0;
388 }
389 
390 
392 {
393  LIB_PART* part = nullptr;
394  LIB_ID libId;
395  int unit, convert;
396 
397  if( m_isLibEdit )
398  {
399  LIB_EDIT_FRAME* editFrame = getEditFrame<LIB_EDIT_FRAME>();
400 
401  part = editFrame->GetCurPart();
402  unit = editFrame->GetUnit();
403  convert = editFrame->GetConvert();
404 
405  if( part )
406  libId = part->GetLibId();
407  }
408  else
409  {
410  LIB_VIEW_FRAME* viewFrame = getEditFrame<LIB_VIEW_FRAME>();
411 
412  if( viewFrame->IsModal() )
413  {
414  // if we're modal then we just need to return the symbol selection; the caller is
415  // already in a EE_ACTIONS::placeSymbol coroutine.
416  viewFrame->FinishModal();
417  return 0;
418  }
419  else
420  {
421  part = viewFrame->GetSelectedSymbol();
422  unit = viewFrame->GetUnit();
423  convert = viewFrame->GetConvert();
424 
425  if( part )
426  libId = part->GetLibId();
427  }
428  }
429 
430  if( part )
431  {
432  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
433 
434  if( !schframe ) // happens when the schematic editor is not active (or closed)
435  {
436  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
437  return 0;
438  }
439 
440  wxCHECK( part->GetLibId().IsValid(), 0 );
441 
442  SCH_COMPONENT* comp =
443  new SCH_COMPONENT( *part, libId, &schframe->GetCurrentSheet(), unit, convert );
444 
445  comp->SetParent( schframe->GetCurrentSheet().LastScreen() );
446 
447  if( schframe->eeconfig()->m_AutoplaceFields.enable )
448  comp->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
449 
450  schframe->Raise();
451  schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, true, comp );
452  }
453 
454  return 0;
455 }
456 
457 
459 {
460  wxCHECK( m_isLibEdit, 0 );
461 
462  LIB_EDIT_FRAME* editFrame = getEditFrame<LIB_EDIT_FRAME>();
463 
464  wxCHECK( editFrame, 0 );
465 
466  LIB_PART* currentPart = editFrame->GetCurPart();
467 
468  wxCHECK( currentPart, 0 );
469 
470  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
471 
472  if( !schframe ) // happens when the schematic editor is not active (or closed)
473  {
474  DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
475  return 0;
476  }
477 
478  schframe->UpdateSymbolFromEditor( *currentPart );
479 
480  SCH_SCREEN* currentScreen = editFrame->GetScreen();
481 
482  wxCHECK( currentScreen, 0 );
483 
484  currentScreen->ClrModify();
485 
486  return 0;
487 }
488 
489 
491 {
497 
498  Go( &LIB_CONTROL::Save, ACTIONS::save.MakeEvent() );
499  Go( &LIB_CONTROL::Save, ACTIONS::saveAs.MakeEvent() ); // for libraries
500  Go( &LIB_CONTROL::Save, ACTIONS::saveCopyAs.MakeEvent() ); // for symbols
501  Go( &LIB_CONTROL::Save, ACTIONS::saveAll.MakeEvent() );
502  Go( &LIB_CONTROL::Revert, ACTIONS::revert.MakeEvent() );
504  EE_ACTIONS::saveInSchematic.MakeEvent() );
505 
515 
518 
524 }
void SVG_PlotComponent(const wxString &aFullFileName)
Creates the SVG print file for the current edited component.
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:107
int UpdateSymbolInSchematic(const TOOL_EVENT &aEvent)
void DuplicatePart(bool aFromClipboard)
Inserts a duplicate part.
int AddLibrary(const TOOL_EVENT &aEvent)
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:252
This file is part of the common library TODO brief description.
int GetConvert() const
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:177
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)
void LoadPart(const wxString &aLibrary, const wxString &aPart, int Unit)
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:1435
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:181
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static TOOL_ACTION unpinLibrary
Definition: actions.h:108
int ExportView(const TOOL_EVENT &aEvent)
Schematic editor (Eeschema) main window.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
static TOOL_ACTION showComponentTree
Definition: ee_actions.h:202
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
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:128
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:180
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: base_struct.h:196
int GetConvert() const
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
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 Save()
Saves the selected part or library.
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.
void SaveAs()
Saves the selected part or library to a new name and/or location.
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
int GetUnit() const
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:343
void SaveAll()
Saves all modified parts and libraries.
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
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:160
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:118
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.
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:176
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:201
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:257
static TOOL_ACTION exportSymbolView
Definition: ee_actions.h:205
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 ImportPart()
Definition: lib_export.cpp:37
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)
The symbol library editor main window.
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
SCH_SCREEN * LastScreen()
Function LastScreen.
bool IsType(FRAME_T aType) const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
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 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 CreateNewPart()
Creates a new part in the selected library.
void SetConvert(int aConvert)
void ClrModify()
Definition: base_screen.h:101
Schematic symbol object.
Definition: sch_component.h:80
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:195
int ExportSymbolAsSVG(const TOOL_EVENT &aEvent)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78
static TOOL_ACTION saveAll
Definition: actions.h:57
int DuplicateSymbol(const TOOL_EVENT &aEvent)
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION exportSymbolAsSVG
Definition: ee_actions.h:206
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:39
int ShowComponentTree(const TOOL_EVENT &aEvent)
static TOOL_ACTION revert
Definition: actions.h:58
int OnDeMorgan(const TOOL_EVENT &aEvent)
bool empty() const
Definition: utf8.h:108