KiCad PCB EDA Suite
lib_edit_frame.h
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) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
7  * Copyright (C) 2017 CERN
8  * @author Maciej Suminski <maciej.suminski@cern.ch>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, you may find one here:
22  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23  * or you may search the http://www.gnu.org website for the version 2 license,
24  * or you may write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26  */
27 
33 #ifndef LIB_EDIT_FRAME_H
34 #define LIB_EDIT_FRAME_H
35 
36 #include <sch_base_frame.h>
37 #include <sch_screen.h>
38 #include <lib_draw_item.h>
39 #include <lib_collectors.h>
40 #include <core/optional.h>
41 
42 class SCH_EDIT_FRAME;
43 class SYMBOL_LIB_TABLE;
44 class LIB_PART;
45 class LIB_ALIAS;
46 class LIB_FIELD;
48 class SYMBOL_TREE_PANE;
49 class LIB_ID;
50 class LIB_MANAGER;
51 
52 
57 {
61  wxComboBox* m_partSelectBox;
64 
65  // Copy/cut/paste buffer to move parts between libraries
66  std::unique_ptr<LIB_PART> m_copiedPart;
67 
70 
78 
99 
104 
107 
109  static int m_drawLineWidth;
110 
112 
113  // The unit number to edit and show
114  static int m_unit;
115 
116  // Show the normal shape ( m_convert <= 1 ) or the converted shape
117  // ( m_convert > 1 )
118  static int m_convert;
119 
120  // true to force DeMorgan/normal tools selection enabled.
121  // They are enabled when the loaded component has
122  // Graphic items for converted shape
123  // But under some circumstances (New component created)
124  // these tools must left enabled
125  static bool m_showDeMorgan;
126 
128  static int m_textSize;
129 
131  static double m_current_text_angle;
132 
135 
138 
140  static int m_defaultPinLength;
141 
144 
145  static wxSize m_clientSize;
146 
147  friend class DIALOG_LIB_EDIT_TEXT;
148 
149  LIB_ITEM* locateItem( const wxPoint& aPosition, const KICAD_T aFilterList[] );
150 
151 public:
152 
153  LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
154 
155  ~LIB_EDIT_FRAME();
156 
158  wxString GetCurLib() const;
159 
161  wxString SetCurLib( const wxString& aLibNickname );
162 
169  {
170  return m_my_part;
171  }
172 
176  void SetCurPart( LIB_PART* aPart );
177 
181  static void SetPinNumDefaultSize( int aSize ) { m_textPinNumDefaultSize = aSize; }
182 
186  static void SetPinNameDefaultSize( int aSize ) { m_textPinNameDefaultSize = aSize; }
187 
190  static int GetDefaultPinLength() { return m_defaultPinLength; }
191 
194  static void SetDefaultPinLength( int aLength ) { m_defaultPinLength = aLength; }
195 
200  int GetRepeatPinStep() const { return m_repeatPinStep; }
201 
207  void SetRepeatPinStep( int aStep) { m_repeatPinStep = aStep; }
208 
209 
210  void ReCreateMenuBar() override;
211 
212  void InstallConfigFrame( wxCommandEvent& event );
213  void OnPreferencesOptions( wxCommandEvent& event );
214  void Process_Config( wxCommandEvent& event );
215 
224  bool SynchronizePins();
225 
229  void OnPlotCurrentComponent( wxCommandEvent& event );
230  void Process_Special_Functions( wxCommandEvent& event );
231  void OnSelectTool( wxCommandEvent& aEvent );
232 
236  void OnCreateNewLibrary( wxCommandEvent& aEvent )
237  {
238  addLibraryFile( true );
239  }
240 
244  void OnAddLibrary( wxCommandEvent& aEvent )
245  {
246  addLibraryFile( false );
247  }
248 
252  void OnCreateNewPart( wxCommandEvent& aEvent );
253 
257  void OnEditPart( wxCommandEvent& aEvent );
258 
265  void OnImportPart( wxCommandEvent& event );
266 
271  void OnExportPart( wxCommandEvent& event );
272 
276  void OnSave( wxCommandEvent& aEvent );
277 
281  void OnSaveAs( wxCommandEvent& aEvent );
282 
286  void OnSaveAll( wxCommandEvent& aEvent );
287 
291  void OnRevert( wxCommandEvent& aEvent );
292 
296  void OnRemovePart( wxCommandEvent& aEvent );
297 
298  void OnDuplicatePart( wxCommandEvent& aEvent );
299  void OnCopyCutPart( wxCommandEvent& aEvent );
300  void OnPasteDuplicatePart( wxCommandEvent& aEvent );
301 
302  void OnSelectPart( wxCommandEvent& event );
303 
307  void OnShowElectricalType( wxCommandEvent& event );
308 
309  void OnToggleSearchTree( wxCommandEvent& event );
310 
311  void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override;
312 
313  bool IsSearchTreeShown();
315 
316  void OnEditComponentProperties( wxCommandEvent& event );
317 
318  void OnViewEntryDoc( wxCommandEvent& event );
319  void OnCheckComponent( wxCommandEvent& event );
320  void OnSelectBodyStyle( wxCommandEvent& event );
321  void OnEditPin( wxCommandEvent& event );
322  void OnSelectItem( wxCommandEvent& aEvent );
323 
324  void OnOpenPinTable( wxCommandEvent& aEvent );
325 
326  void OnUpdatePaste( wxUpdateUIEvent& event );
327  void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
328  void OnUpdateEditingPart( wxUpdateUIEvent& event );
329  void OnUpdateHavePart( wxUpdateUIEvent& aEvent );
330  void OnUpdateSave( wxUpdateUIEvent& aEvent );
331  void OnUpdateSaveAs( wxUpdateUIEvent& aEvent );
332  void OnUpdateRevert( wxUpdateUIEvent& aEvent );
333  void OnUpdateUndo( wxUpdateUIEvent& event );
334  void OnUpdateRedo( wxUpdateUIEvent& event );
335  void OnUpdateSyncPinEdit( wxUpdateUIEvent& event );
336  void OnUpdatePinTable( wxUpdateUIEvent& event );
337  void OnUpdatePartNumber( wxUpdateUIEvent& event );
338  void OnUpdateDeMorganNormal( wxUpdateUIEvent& event );
339  void OnUpdateDeMorganConvert( wxUpdateUIEvent& event );
340  void OnUpdateElectricalType( wxUpdateUIEvent& aEvent );
341  void OnUpdateSearchTreeTool( wxUpdateUIEvent& aEvent );
342 
343  void UpdatePartSelectList();
344 
354  void RedrawComponent( wxDC* aDC, wxPoint aOffset );
355 
361  void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
362 
363  void OnCloseWindow( wxCloseEvent& Event );
364  void ReCreateHToolbar() override;
365  void ReCreateVToolbar() override;
366  void ReCreateOptToolbar();
367  void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
368  bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
369  double BestZoom() override; // Returns the best zoom
370  void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
371 
373  EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
374 
375  bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
376 
377  bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
378 
379  void LoadSettings( wxConfigBase* aCfg ) override;
380 
381  void SaveSettings( wxConfigBase* aCfg ) override;
382 
389  void CloseWindow( wxCommandEvent& event )
390  {
391  // Generate a wxCloseEvent
392  Close( false );
393  }
394 
399  void OnModify();
400 
401  int GetUnit() { return m_unit; }
402 
403  void SetUnit( int unit )
404  {
405  wxASSERT( unit >= 1 );
406  m_unit = unit;
407  }
408 
409  int GetConvert() { return m_convert; }
410 
411  void SetConvert( int convert )
412  {
413  wxASSERT( convert >= 0 );
414  m_convert = convert;
415  }
416 
418 
419  void SetLastDrawItem( LIB_ITEM* drawItem )
420  {
421  m_lastDrawItem = drawItem;
422  }
423 
424  LIB_ITEM* GetDrawItem() const { return GetScreen()->GetCurLibItem(); }
425 
426  void SetDrawItem( LIB_ITEM* drawItem ) { GetScreen()->SetCurLibItem( drawItem ); }
427 
428  bool GetShowDeMorgan() { return m_showDeMorgan; }
429 
430  void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
431 
433 
434  void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
435 
437 
443  void TempCopyComponent();
444 
449  void RestoreComponent();
450 
455 
459  void ClearTempCopyComponent();
460 
462 
463 private:
464  void loadPart( const wxString& aLibrary, const wxString& aPart, int Unit );
465 
466  void savePartAs();
467 
477  bool saveLibrary( const wxString& aLibrary, bool aNewFile );
478 
483  void updateTitle();
484 
490  virtual void OnActivate( wxActivateEvent& event ) override;
491 
492  // General:
493 
500  void SelectActiveLibrary( const wxString& aLibrary = wxEmptyString );
501 
511  bool LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aConvert = 0 );
512 
523  bool LoadOneLibraryPartAux( LIB_ALIAS* aLibEntry, const wxString& aLibrary,
524  int aUnit, int aConvert );
525 
529  void DisplayCmpDoc();
530 
534  void OnRotate( wxCommandEvent& aEvent );
535 
539  void OnOrient( wxCommandEvent& aEvent );
540 
547  void deleteItem( wxDC* aDC, LIB_ITEM* aItem );
548 
549  // General editing
550 public:
557  void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType = UR_LIBEDIT );
558 
559 private:
560  void GetComponentFromUndoList( wxCommandEvent& event );
561  void GetComponentFromRedoList( wxCommandEvent& event );
562 
563  // Editing pins
564  void CreatePin( wxDC* DC );
565 
571  void StartMovePin( LIB_ITEM* aPin );
572 
578  void CreateImagePins( LIB_PIN* aPin );
579 
586  void PlaceAnchor();
587 
588  // Editing graphic items
589  LIB_ITEM* CreateGraphicItem( LIB_PART* LibEntry, wxDC* DC );
590  void GraphicItemBeginDraw( wxDC* DC );
591  void StartMoveDrawSymbol( wxDC* DC, LIB_ITEM* aItem );
592  void StartModifyDrawSymbol( wxDC* DC, LIB_ITEM* aItem ); //<! Modify the item, adjust size etc.
593  void EndDrawGraphicItem( wxDC* DC );
594 
600  void LoadOneSymbol();
601 
608  void SaveOneSymbol();
609 
610  void EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem );
611  void EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem );
612  LIB_ITEM* LocateItemUsingCursor( const wxPoint& aPosition,
613  const KICAD_T aFilterList[] = LIB_COLLECTOR::AllItems );
614  void EditField( LIB_FIELD* Field );
615 
616  void refreshSchematic();
617 
618 public:
627  bool LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert );
628 
629  /* Block commands: */
630 
635  virtual int BlockCommand( EDA_KEY aKey ) override;
636 
640  virtual void HandleBlockPlace( wxDC* DC ) override;
641 
648  virtual bool HandleBlockEnd( wxDC* DC ) override;
649 
654  void PlacePin();
655 
669  void GlobalSetPins( LIB_PIN* aMasterPin, int aId );
670 
671  // Automatic placement of pins
672  void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
673 
680  void CreateImageFile( const wxString& aFileName, wxBitmapType aBitmapType = wxBITMAP_TYPE_PNG );
681 
690  virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
691  bool aPrintMirrorMode, void* aData = NULL ) override;
692 
698  void SVG_PlotComponent( const wxString& aFullFileName );
699 
704  void SyncLibraries( bool aShowProgress );
705 
709  void InstallPreferences( PAGED_DIALOG* aParent ) override;
710 
714  void CommonSettingsChanged() override;
715 
716  void ShowChangedLanguage() override;
717 
718  virtual void SetScreen( BASE_SCREEN* aScreen ) override;
719 
720  virtual const BOX2I GetDocumentExtents() const override;
721 
722  void RebuildView();
723 
727  void HardRedraw() override;
728 
742  int BlockSelectItems( LIB_PART* aPart, BLOCK_SELECTOR* aBlock, int aUnit, int aConvert, bool aSyncPinEdit );
743 
747  void BlockClearSelectedItems( LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
748 
749  void BlockMoveSelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
750  void BlockDeleteSelectedItems( LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
751  void BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
752 
753  void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
754 
755 private:
758 
764  SYMBOL_LIB_TABLE* selectSymLibTable( bool aOptional = false );
765 
767  bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
768 
770  LIB_PART* getTargetPart() const;
771 
774  LIB_ID getTargetLibId() const;
775 
778  wxString getTargetLib() const;
779 
780  /* Returns true when the operation has succeded (all requested libraries have been saved or
781  * none was selected and confirmed by OK).
782  * @param aRequireConfirmation when true, the user must be asked to confirm.
783  */
784  bool saveAllLibraries( bool aRequireConfirmation );
785 
787  bool saveCurrentPart();
788 
790  bool addLibraryFile( bool aCreateNew );
791 
793  void storeCurrentPart();
794 
796  bool isCurrentPart( const LIB_ID& aLibId ) const;
797 
799  void emptyScreen();
800 
802  void fixDuplicateAliases( LIB_PART* aPart, const wxString& aLibrary );
803 
804  void InitBlockPasteInfos() override;
805 
809  void copySelectedItems();
810 
815  void pasteClipboard( const wxPoint& aOffset );
816 
819 
820  DECLARE_EVENT_TABLE()
821 };
822 
823 #endif // LIB_EDIT_FRAME_H
void OnViewEntryDoc(wxCommandEvent &event)
void SVG_PlotComponent(const wxString &aFullFileName)
Creates the SVG print file for the current edited component.
void OnToggleSearchTree(wxCommandEvent &event)
void OnCheckComponent(wxCommandEvent &event)
Definition: pinedit.cpp:590
void OnSaveAll(wxCommandEvent &aEvent)
Saves all modified parts and libraries.
Definition: libedit.cpp:243
void OnUpdateEditingPart(wxUpdateUIEvent &event)
static void SetPinNameDefaultSize(int aSize)
void OnUpdatePartNumber(wxUpdateUIEvent &event)
Class LIB_COLLECTOR.
void SaveOneSymbol()
Saves the current symbol to a symbol file.
Definition: symbedit.cpp:152
Class KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
static double m_current_text_angle
Current text angle setting.
Part library alias object definition.
void InstallConfigFrame(wxCommandEvent &event)
std::unique_ptr< LIB_PART > m_copiedPart
void ReCreateOptToolbar()
Definition: tool_lib.cpp:201
int BlockSelectItems(LIB_PART *aPart, BLOCK_SELECTOR *aBlock, int aUnit, int aConvert, bool aSyncPinEdit)
Checks all draw objects of part to see if they are with block.
bool LoadComponentFromCurrentLib(const wxString &aAliasName, int aUnit=0, int aConvert=0)
Loads a symbol from the current active library, optionally setting the selected unit and convert...
Definition: libedit.cpp:119
int GetRepeatPinStep() const
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
virtual int BlockCommand(EDA_KEY aKey) override
Returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the aKey (ALT...
static int m_convert
void OnExportPart(wxCommandEvent &event)
Creates a new library and backup the current component in this library or exports the component of th...
Definition: lib_export.cpp:101
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void RestoreComponent()
Restore the current edited component from its temporary copy.
void SetConvert(int convert)
void OnCreateNewPart(wxCommandEvent &aEvent)
Creates a new part in the selected library.
Definition: libedit.cpp:251
void ClearTempCopyComponent()
Delete temporary copy of the current component and clear pointer.
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
void savePartAs()
Definition: libedit.cpp:376
bool m_syncPinEdit
Set to true to not synchronize pins at the same position when editing symbols with multiple units or ...
double BestZoom() override
Return the zoom level which displays the full page on screen.
void CommonSettingsChanged() override
Called after the preferences dialog is run.
void OnEditPin(wxCommandEvent &event)
Definition: pinedit.cpp:94
void OnUpdateSyncPinEdit(wxUpdateUIEvent &event)
void SetRepeatPinStep(int aStep)
Sets the repeat step value for pins repeat command.
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
void ClearSearchTreeSelection()
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
bool isCurrentPart(const LIB_ID &aLibId) const
Returns true if aLibId is an alias for the editor screen part.
Field object used in symbol libraries.
Definition: lib_field.h:59
virtual void OnActivate(wxActivateEvent &event) override
Called when the frame is activated.
void OnCloseWindow(wxCloseEvent &Event)
void OnImportPart(wxCommandEvent &event)
Routine to read one part.
Definition: lib_export.cpp:39
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
static int GetDefaultPinLength()
void OnUpdateUndo(wxUpdateUIEvent &event)
void OnRotate(wxCommandEvent &aEvent)
Rotates the current item.
void SelectActiveLibrary(const wxString &aLibrary=wxEmptyString)
Set the current active library to aLibrary.
Definition: libedit.cpp:70
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
void GlobalSetPins(LIB_PIN *aMasterPin, int aId)
Definition: pinedit.cpp:448
bool InEditMode() const
Return the draw item editing mode status.
void OnUpdateRedo(wxUpdateUIEvent &event)
LIB_ID getTargetLibId() const
Returns either the part selected in the component tree, if context menu is active or the currently mo...
void Process_Config(wxCommandEvent &event)
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
void OnSelectBodyStyle(wxCommandEvent &event)
void OnUpdateDeMorganNormal(wxUpdateUIEvent &event)
void LoadOneSymbol()
Read a component symbol file (*.sym ) and add graphic items to the current component.
Definition: symbedit.cpp:46
Schematic editor (Eeschema) main window.
bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
Perform application specific control using aDC at aPosition in logical units.
Definition: controller.cpp:47
bool OnRightClick(const wxPoint &MousePos, wxMenu *PopMenu) override
void BlockClearSelectedItems(LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
Clears all the draw items marked by a block select.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void InstallPreferences(PAGED_DIALOG *aParent) override
Allows Libedit to install its preferences panel into the preferences dialog.
void OnUpdateSave(wxUpdateUIEvent &aEvent)
void copySelectedItems()
Copies items selected in the current part to the internal clipboard.
void OnUpdatePaste(wxUpdateUIEvent &event)
void fixDuplicateAliases(LIB_PART *aPart, const wxString &aLibrary)
Renames LIB_PART aliases to avoid conflicts before adding a component to a library ...
Definition: libedit.cpp:539
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro: ...
void StartMoveDrawSymbol(wxDC *DC, LIB_ITEM *aItem)
Definition: symbdraw.cpp:269
void OnUpdateDeMorganConvert(wxUpdateUIEvent &event)
void OnUpdateRevert(wxUpdateUIEvent &aEvent)
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
void OnAddLibrary(wxCommandEvent &aEvent)
Adds an existing library.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual bool HandleBlockEnd(wxDC *DC) override
Performs a block end command.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void RepeatPinItem(wxDC *DC, LIB_PIN *Pin)
Definition: pinedit.cpp:499
void SetShowDeMorgan(bool show)
Library Editor pane with component tree and symbol library table selector.
void pasteClipboard(const wxPoint &aOffset)
Pastes items from the internal clipboard to the current part.
void OnOrient(wxCommandEvent &aEvent)
Handles the ID_LIBEDIT_MIRROR_X and ID_LIBEDIT_MIRROR_Y events.
void OnPreferencesOptions(wxCommandEvent &event)
void StartModifyDrawSymbol(wxDC *DC, LIB_ITEM *aItem)
Definition: symbdraw.cpp:292
static const KICAD_T AllItems[]
A scan list for all schematic items.
void OnEditComponentProperties(wxCommandEvent &event)
void OnSave(wxCommandEvent &aEvent)
Saves the selected part or library.
Definition: libedit.cpp:338
static int GetPinNumDefaultSize()
Class LSET is a set of PCB_LAYER_IDs.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
FILL_T GetFillStyle()
LIB_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
bool saveLibrary(const wxString &aLibrary, bool aNewFile)
Saves the changes to the current library.
Definition: libedit.cpp:644
virtual const BOX2I GetDocumentExtents() const override
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
void SetDrawItem(LIB_ITEM *drawItem)
LIB_COLLECTOR m_collectedItems
Used for hit testing.
void OnPasteDuplicatePart(wxCommandEvent &aEvent)
Definition: libedit.cpp:510
void OnUpdatePinTable(wxUpdateUIEvent &event)
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
void CreateImageFile(const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
Creates an image (screenshot) of the current symbol.
wxComboBox * m_partSelectBox
a Box to select a part to edit (if any)
static void SetPinNumDefaultSize(int aSize)
void OnRemovePart(wxCommandEvent &aEvent)
Removes a part from the working copy of a library.
Definition: libedit.cpp:473
LIB_ITEM * locateItem(const wxPoint &aPosition, const KICAD_T aFilterList[])
void TempCopyComponent()
Create a temporary copy of the current edited component.
void GraphicItemBeginDraw(wxDC *DC)
Definition: symbdraw.cpp:229
bool addLibraryFile(bool aCreateNew)
Creates or adds an existing library to the symbol library table.
Define a library symbol object.
void GetComponentFromRedoList(wxCommandEvent &event)
void OnPlotCurrentComponent(wxCommandEvent &event)
Plot the current symbol in SVG or PNG format.
void CreateImagePins(LIB_PIN *aPin)
Adds copies of aPin in components with multiple units in all units.
Definition: pinedit.cpp:398
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
uint32_t EDA_KEY
Definition: common.h:73
void SetLastDrawItem(LIB_ITEM *drawItem)
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
static int m_textPinNumDefaultSize
The default pin num text size setting.
bool LoadOneLibraryPartAux(LIB_ALIAS *aLibEntry, const wxString &aLibrary, int aUnit, int aConvert)
Create a copy of aLibEntry into memory.
Definition: libedit.cpp:155
static LIB_ITEM * m_lastDrawItem
static int m_textSize
The current text size setting.
virtual void PrintPage(wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL) override
Print a page.
void OnSelectTool(wxCommandEvent &aEvent)
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
void OnShowElectricalType(wxCommandEvent &event)
From Option toolbar: option to show the electrical pin type name.
bool LoadComponentAndSelectLib(const LIB_ID &aLibId, int aUnit, int aConvert)
Selects the currently active library and loads the symbol from aLibId.
Definition: libedit.cpp:103
void CreatePin(wxDC *DC)
Definition: pinedit.cpp:348
void Process_Special_Functions(wxCommandEvent &event)
void emptyScreen()
Restores the empty editor screen, without any part or library selected.
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:772
void updateTitle()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:58
LIB_PART * GetTempCopyComponent()
void SetShowElectricalType(bool aShow)
void OnUpdateSaveAs(wxUpdateUIEvent &aEvent)
void BlockCopySelectedItems(const wxPoint &aOffset, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
static int m_textPinNameDefaultSize
The default pin name text size setting.
Class to handle modifications to the symbol libraries.
Definition: lib_manager.h:49
void EditSymbolText(wxDC *DC, LIB_ITEM *DrawItem)
void deleteItem(wxDC *aDC, LIB_ITEM *aItem)
Deletes the currently selected draw item.
void PlacePin()
Place at cursor location the pin currently moved (i.e.
Definition: pinedit.cpp:181
Definitions for the Eeschema program SCH_SCREEN class.
void BlockMoveSelectedItems(const wxPoint &aOffset, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
void OnSaveAs(wxCommandEvent &aEvent)
Saves the selected part or library to a new name and/or location.
Definition: libedit.cpp:360
void storeCurrentPart()
Stores the currently modified part in the library manager buffer.
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Creates a backup copy of a file with requested extension
void OnSelectItem(wxCommandEvent &aEvent)
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
void SyncLibraries(bool aShowProgress)
Synchronize the library manager to the symbol library table, and then the symbol tree to the library ...
void OnOpenPinTable(wxCommandEvent &aEvent)
wxString getTargetLib() const
Returns either the library selected in the component tree, if context menu is active or the library t...
void OnUpdateSelectTool(wxUpdateUIEvent &aEvent)
LIB_ITEM * LocateItemUsingCursor(const wxPoint &aPosition, const KICAD_T aFilterList[]=LIB_COLLECTOR::AllItems)
The symbol library editor main window.
BLOCK_SELECTOR m_clipboard
Clipboard buffer storing LIB_ITEMs
LIB_ITEM * CreateGraphicItem(LIB_PART *LibEntry, wxDC *DC)
Definition: symbdraw.cpp:134
void ReCreateHToolbar() override
Definition: tool_lib.cpp:103
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
bool GetShowDeMorgan()
void ShowChangedLanguage() override
Function ShowChangedLanguage redraws the menus and what not in current language.
static int m_unit
bool saveCurrentPart()
Saves the current part.
Definition: libedit.cpp:84
LIB_ITEM * GetCurLibItem() const
Definition: sch_screen.h:197
bool saveAllLibraries(bool aRequireConfirmation)
Definition: libedit.cpp:728
static int GetPinNameDefaultSize()
void OnRevert(wxCommandEvent &aEvent)
Reverts unsaved changes in a part, restoring to the last saved state.
Definition: libedit.cpp:566
void OnEditPart(wxCommandEvent &aEvent)
Opens the selected part for editing.
Definition: libedit.cpp:330
void OnCopyCutPart(wxCommandEvent &aEvent)
Definition: libedit.cpp:494
void SetCurPart(LIB_PART *aPart)
Take ownership of aPart and notes that it is the one currently being edited.
void RedrawComponent(wxDC *aDC, wxPoint aOffset)
Redraw the current component loaded in library editor Display reference like in schematic (a referenc...
Definition: libedit.cpp:193
void OnDuplicatePart(wxCommandEvent &aEvent)
void OnCreateNewLibrary(wxCommandEvent &aEvent)
Creates a new library.
virtual void HandleBlockPlace(wxDC *DC) override
Handles the block place command.
LIB_ITEM * GetLastDrawItem()
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
virtual void SetScreen(BASE_SCREEN *aScreen) override
void EndDrawGraphicItem(wxDC *DC)
Definition: symbdraw.cpp:306
LIB_ITEM * GetDrawItem() const
void OnLeftDClick(wxDC *DC, const wxPoint &MousePos) override
void BlockDeleteSelectedItems(LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
void InitBlockPasteInfos() override
static int m_defaultPinLength
Default pin length.
void EditGraphicSymbol(wxDC *DC, LIB_ITEM *DrawItem)
Definition: symbdraw.cpp:54
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
int m_repeatPinStep
Default repeat offset for pins in repeat place pin.
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:54
bool SynchronizePins()
Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable b...
void OnUpdateElectricalType(wxUpdateUIEvent &aEvent)
bool IsEditingDrawItem()
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
void OnUpdateHavePart(wxUpdateUIEvent &aEvent)
void EditField(LIB_FIELD *Field)
Definition: libfield.cpp:42
wxString SetCurLib(const wxString &aLibNickname)
Sets the current library nickname and returns the old library nickname.
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
bool m_drawSpecificConvert
Convert of the item currently being drawn.
void PlaceAnchor()
Places an anchor reference coordinate for the current component.
Definition: symbedit.cpp:213
SYMBOL_LIB_TABLE * selectSymLibTable(bool aOptional=false)
Displays a dialog asking the user to select a symbol library table.
static bool m_showDeMorgan
static void SetDefaultPinLength(int aLength)
Set the default pin len.
SYMBOL_TREE_PANE * m_treePane
component search tree widget
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
void RedrawActiveWindow(wxDC *DC, bool EraseBg) override
Redraw the current component loaded in library editor, an axes Display reference like in schematic (a...
Definition: libedit.cpp:215
void OnSelectPart(wxCommandEvent &event)
void GetComponentFromUndoList(wxCommandEvent &event)
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME, and it brings in a common way of handling the provided virtual functions for the derived classes.
void SetCurLibItem(LIB_ITEM *aItem)
Definition: sch_screen.h:205
void UpdatePartSelectList()
LIB_PART * getTargetPart() const
Returns currently edited part.
static wxSize m_clientSize
void OnUpdateSearchTreeTool(wxUpdateUIEvent &aEvent)
bool GetShowElectricalType()
void loadPart(const wxString &aLibrary, const wxString &aPart, int Unit)
Definition: libedit.cpp:617
void StartMovePin(LIB_ITEM *aPin)
Prepare the displacement of a pin.
Definition: pinedit.cpp:278
void SetUnit(int unit)
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
void ReCreateVToolbar() override
Definition: tool_lib.cpp:48