27 #include <wx/hyperlink.h> 98 m_unitSelectBox(
nullptr ),
99 m_isSymbolFromSchematic( false )
101 SetShowDeMorgan(
false );
102 m_SyncPinEdit =
false;
105 m_treePane =
nullptr;
109 m_aboutTitle =
_(
"KiCad Symbol Editor" );
112 wxIconBundle icon_bundle;
115 icon_bundle.AddIcon( icon );
117 icon_bundle.AddIcon( icon );
119 icon_bundle.AddIcon( icon );
121 SetIcons( icon_bundle );
124 LoadSettings( m_settings );
131 SetScreen( m_dummyScreen );
132 GetScreen()->m_Center =
true;
134 GetCanvas()->GetViewControls()->SetCrossHairCursorPosition(
VECTOR2D( 0, 0 ),
false );
136 GetRenderSettings()->LoadColors( GetColorSettings() );
143 SyncLibraries(
true );
149 ReCreateOptToolbar();
152 DisplaySymbolDatasheet();
153 RebuildSymbolUnitsList();
155 m_auimgr.SetManagedWindow(
this );
158 m_auimgr.AddPane( m_mainToolBar,
EDA_PANE().HToolbar().Name(
"MainToolbar" )
160 m_auimgr.AddPane( m_messagePanel,
EDA_PANE().Messages().Name(
"MsgPanel" )
161 .Bottom().Layer( 6 ) );
163 m_auimgr.AddPane( m_optionsToolBar,
EDA_PANE().VToolbar().Name(
"OptToolbar" )
164 .
Left().Layer( 3 ) );
165 m_auimgr.AddPane( m_treePane,
EDA_PANE().Palette().Name(
"ComponentTree" )
167 .Caption(
_(
"Libraries" ) )
168 .MinSize( 250, -1 ).BestSize( 250, -1 ) );
169 m_auimgr.AddPane( m_drawToolBar,
EDA_PANE().VToolbar().Name(
"ToolsToolbar" )
170 .
Right().Layer( 2 ) );
172 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name(
"DrawFrame" )
175 FinishAUIInitialization();
177 if( m_settings->m_LibWidth > 0 )
179 wxAuiPaneInfo& treePane = m_auimgr.GetPane(
"ComponentTree" );
183 treePane.MinSize( m_settings->m_LibWidth, -1 );
188 treePane.Resizable();
193 treePane.MinSize( 250, -1 );
200 GetCanvas()->GetView()->UseDrawPriority(
true );
201 GetCanvas()->GetGAL()->SetAxesEnabled(
true );
203 setupUnits( m_settings );
210 bbox.
SetOrigin( -max_size_x /2, -max_size_y/2 );
211 bbox.
SetSize( max_size_x, max_size_y );
212 GetCanvas()->GetView()->SetBoundary( bbox );
242 Pgm().GetSettingsManager().Save( libedit );
250 wxCHECK_RET(
m_settings,
"Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" );
265 wxCHECK_RET(
m_settings,
"Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" );
327 #define ENABLE( x ) ACTION_CONDITIONS().Enable( x ) 328 #define CHECK( x ) ACTION_CONDITIONS().Check( x ) 330 auto haveSymbolCond =
336 auto isEditableCond =
344 auto libModifiedCondition =
350 auto libSelectedCondition =
365 auto canEditProperties =
371 auto saveSymbolAsCondition =
416 auto showCompTreeCond =
431 auto demorganStandardCond =
434 return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
437 auto demorganAlternateCond =
440 return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
443 auto multiUnitModeCond =
449 auto syncedPinsModeCond =
455 auto haveDatasheetCond =
474 #define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) ) 505 _(
"Save changes to schematic before closing?" ),
514 case wxID_NO:
return true;
517 case wxID_CANCEL:
return false;
614 int i =
event.GetSelection();
616 if( ( i == wxNOT_FOUND ) || ( ( i + 1 ) ==
m_unit ) )
647 if( !libNickname.empty() )
649 if( !
Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
652 libNickname = wxEmptyString;
664 if( aLibNickname.empty() || !
Prj().SchSymbolLibTable()->HasLibrary( aLibNickname ) )
715 msg.Printf(
_(
"Editing symbol %s from schematic. Saving will update the schematic " 723 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY,
724 _(
"Manage symbol libraries" ),
727 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
728 [&]( wxHyperlinkEvent& aEvent )
735 infobar->
ShowMessage(
_(
"Symbols in legacy libraries are not editable. Use Manage " 736 "Symbol Libraries to migrate to current format." ),
737 wxICON_INFORMATION );
745 msg.Printf(
_(
"Symbol %s is derived from %s. Symbol graphics will not be editable." ),
749 link.Printf(
_(
"Open %s" ), parentPartName );
751 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
752 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
753 [&]( wxHyperlinkEvent& aEvent )
784 if( !GetTitle().StartsWith(
"*" ) )
813 wxString libName = fn.GetName();
815 if( libName.IsEmpty() )
829 "Check write permission." ),
830 fn.GetFullPath() ) );
838 DisplayError(
this,
_(
"Could not open the library file." ) );
906 [&](
int progress,
int max,
const wxString& libName )
908 progressDlg.Update( progress,
915 [&](
int progress,
int max,
const wxString& libName )
922 wxDataViewItem found;
937 if( !found && selected.
IsValid() )
970 if(
Prj().IsNullProject() )
976 wxMessageDialog dlg(
this,
_(
"Add the library to the global library table?" ),
977 _(
"Add To Global Library Table" ), wxYES_NO );
979 if( dlg.ShowModal() != wxID_OK )
986 wxArrayString libTableNames;
987 libTableNames.Add(
_(
"Global" ) );
988 libTableNames.Add(
_(
"Project" ) );
990 wxSingleChoiceDialog dlg(
this,
_(
"Choose the Library Table to add the library to:" ),
991 _(
"Add To Library Table" ), libTableNames );
995 dlg.FindWindow( wxID_CANCEL )->SetLabel(
_(
"Skip" ) );
996 dlg.FindWindow( wxID_OK )->SetLabel(
_(
"Add" ) );
999 if( dlg.ShowModal() != wxID_OK )
1002 switch( dlg.GetSelection() )
1005 case 1:
return Prj().SchSymbolLibTable();
1006 default:
return nullptr;
1013 if( aOriginalFile.FileExists() )
1015 wxFileName backupFileName( aOriginalFile );
1016 backupFileName.SetExt( aBackupExt );
1018 if( backupFileName.FileExists() )
1019 wxRemoveFile( backupFileName.GetFullPath() );
1021 if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1024 backupFileName.GetFullPath() ) );
1070 if( aEnvVarsChanged )
1123 item.ClearSelected();
1138 VECTOR2I( Mils2iu( 200 ), Mils2iu( 200 ) ) );
1151 const std::string& payload = mail.
GetPayload();
1156 if( !payload.empty() )
1158 wxString libFileName( payload );
1159 wxString libNickname;
1167 msg.Printf(
_(
"The current configuration does not include the library '%s'.\n" 1168 "Use Manage Symbol Libraries to edit the configuration." ),
1176 if( !libTable->
HasLibrary( libNickname,
true ) )
1178 msg.Printf(
_(
"The library '%s' is not enabled in the current configuration.\n" 1179 "Use Manage Symbol Libraries to edit the configuration." ),
1189 LIB_ID id( libNickname, wxEmptyString );
1244 if( aItemCount == 0 )
1267 std::unique_ptr<LIB_PART> part = aSymbol->
GetPartRef()->Flatten();
1270 std::vector<LIB_FIELD> fullSetOfFields;
1272 for(
int i = 0; i < (int) aSymbol->
GetFields().size(); ++i )
1281 libField.SetText( field.
GetText() );
1282 libField.SetEffects( field );
1283 libField.SetPosition( wxPoint( pos.x, -pos.y ) );
1285 fullSetOfFields.emplace_back( std::move( libField ) );
1288 part->SetFields( fullSetOfFields );
1323 wxFileName fn = aLibFile;
1324 wxFileName libTableFileName(
Prj().GetProjectPath(),
1326 wxString libNickname = fn.GetName();
1337 tmp.Printf(
"%s%d", fn.GetName(), suffix );
1346 wxString normalizedPath =
NormalizePath( aLibFile, &envVars,
Prj().GetProjectPath() );
1354 normalizedPath =
NormalizePath( aLibFile, &envVars, wxEmptyString );
1357 if( normalizedPath.IsEmpty() )
1358 normalizedPath = aLibFile;
1362 wxCHECK( libTable->
InsertRow( row ), false );
1366 libTable->
Save( libTableFileName.GetFullPath() );
1370 wxString msg = aScope ==
GLOBAL_LIB_TABLE ?
_(
"Error saving global library table." )
1371 :
_(
"Error saving project library table." );
1373 wxMessageDialog dlg(
this, msg,
_(
"File Save Error" ), wxOK | wxICON_ERROR );
1374 dlg.SetExtendedMessage( ioe.
What() );
1385 const wxString& aLibFile )
1389 bool isGlobalTable =
true;
1397 libTableFileName.SetPath(
Prj().GetProjectPath() );
1399 libTable =
Prj().SchSymbolLibTable();
1400 isGlobalTable =
false;
1401 row = libTable->
FindRow( aLibNickname );
1404 wxCHECK( row,
false );
1406 wxString projectPath;
1408 if( !isGlobalTable )
1411 wxString normalizedPath =
NormalizePath( aLibFile, &envVars, projectPath );
1413 if( normalizedPath.IsEmpty() )
1414 normalizedPath = aLibFile;
1421 libTable->
Save( libTableFileName.GetFullPath() );
1425 wxString msg = isGlobalTable ?
_(
"Error saving global library table." )
1426 :
_(
"Error saving project library table." );
1428 wxMessageDialog dlg(
this, msg,
_(
"File Save Error" ), wxOK | wxICON_ERROR );
1429 dlg.SetExtendedMessage( ioe.
What() );
Field Reference of part, i.e. "IC21".
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static TOOL_ACTION pinTable
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static const wxString & GetSymbolLibTableFileName()
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
COLOR_SETTINGS * GetColorSettings() const override
Returns a pointer to the active color theme settings.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
static TOOL_ACTION showDatasheet
Inspection and Editing.
int m_convert
Flag if the symbol being edited was loaded directly from a schematic.
static TOOL_ACTION placeSymbolText
static TOOL_ACTION drawSymbolLines
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
const UTF8 & GetLibItemName() const
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
LIB_PART * GetAlias(const wxString &aAlias, const wxString &aLibrary) const
Return either an alias of a working LIB_PART copy, or alias of the original part if there is no worki...
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
void DisplayComponent(LIB_PART *aComponent)
LIB_ID GetLibId() const override
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
SCH_SCREEN * m_dummyScreen
< Helper screen used when no part is loaded
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
wxString GetName() const override
static TOOL_ACTION runERC
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
This file is part of the common library.
static TOOL_ACTION doDelete
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Return currently edited part.
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Add an existing library.
virtual void SetScreen(BASE_SCREEN *aScreen)
UNDO_REDO_CONTAINER m_undoList
static TOOL_ACTION zoomTool
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
void SetScreen(BASE_SCREEN *aScreen) override
void SetShowDeMorgan(bool show)
void SetType(const wxString &aType) override
Change the schematic plugin type represented by this row.
wxString GetLibNickname() const override
SYMBOL_EDITOR_SETTINGS * GetSettings() const
bool IsContentModified() override
Get if any parts or libraries have been modified but not saved.
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
wxPoint GetPosition() const override
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
Field object used in symbol libraries.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
LIB_PART * getTargetPart() const
Return either the library selected in the symbol tree, if context menu is active or the library that ...
void OnUpdatePartNumber(wxUpdateUIEvent &event)
static TOOL_ACTION cancelInteractive
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
SYMBOL_TREE_PANE * m_treePane
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas ( Cairo / OpenGL).
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION millimetersUnits
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
void SetSize(const Vec &size)
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static bool m_showDeMorgan
Schematic editor (Eeschema) main window.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from aList element.
static TOOL_ACTION showComponentTree
const BITMAP_OPAQUE icon_libedit_16_xpm[1]
Manage TOOL_ACTION objects.
static TOOL_ACTION mirrorH
A logical library item identifier and consists of various portions much like a URI.
The base class for create windows for drawing purpose.
void SetName(const wxString &aName)
Set a user definable field name to aName.
bool IsValid() const
Check if this LID_ID is valid.
wxString m_reference
The reference of the symbol.
bool HasModifications() const
LIB_TREE_NODE * GetCurrentTreeNode() const
bool UpdatePart(LIB_PART *aPart, const wxString &aLibrary)
Update the part buffer with a new version of the part.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
static TOOL_ACTION showDeMorganAlternate
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
SYMBOL_LIB_TABLE * selectSymLibTable(bool aOptional=false)
Display a dialog asking the user to select a symbol library table.
void OnSelectUnit(wxCommandEvent &event)
virtual const wxString GetProjectPath() const
Return the full path of the project.
Class that groups generic conditions for editor states.
bool GetShowDeMorgan() const
bool IsSymbolFromSchematic() const
The base class for drawable items used by schematic library components.
bool m_isSymbolFromSchematic
static TOOL_ACTION mirrorV
static TOOL_ACTION rotateCW
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
static TOOL_ACTION drawSymbolRectangle
bool m_axesEnabled
Fullscreen crosshair or small cross.
Library Editor pane with component tree and symbol library table selector.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
#define LIB_EDIT_FRAME_NAME
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
BOX2I boundingBox(T aObject)
boundingBox template method
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
A holder to handle a list of undo (or redo) commands.
const wxString & GetNickName() const
LIB_PART * GetBufferedPart(const wxString &aAlias, const wxString &aLibrary)
Return the part copy from the buffer.
static TOOL_ACTION rotateCCW
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
static TOOL_ACTION placeSymbolPin
void RebuildSymbolUnitsList()
void DisplaySymbolDatasheet()
Display the documentation of the selected symbol.
void UpdateSymbolFromEditor(const LIB_PART &aSymbol)
Update the LIB_PART of the currently selected symbol.
void updateTitle()
Update the main window title bar with the current library name and read only status of the library.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
wxString GetUniqueLibraryName() const
Return a library name that is not currently in use.
int GetUnitCount() const override
For items with units, return the number of units.
VECTOR2< double > VECTOR2D
LIB_TREE_NODE * GetCurrentTreeNode() const
bool IsSymbolAlias() const
Restore the empty editor screen, without any part or library selected.
virtual const wxString What() const
A composite of Problem() and Where()
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
void Clear()
Remove all items from the view.
static TOOL_ACTION toggleGrid
Class to handle modifications to the symbol libraries.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
static TOOL_ACTION inchesUnits
Handles how to draw a screen (a board, a schematic ...)
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
coord_type GetWidth() const
static TOOL_ACTION symbolProperties
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
wxString getTargetLib() const
const wxString GetType() const override
Return the type of symbol library table represented by this row.
SYMBOL_LIBRARY_MANAGER & GetLibManager()
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit components, if the user selects the component itself rather than picking an individual...
void HardRedraw() override
Rebuild the GAL and redraw the screen.
static TOOL_ACTION drawSymbolCircle
Define a library symbol object.
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition of file extensions used in Kicad.
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
void ReCreateHToolbar() override
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
bool m_ShowGraphicsDisabled
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
AppSettings * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
bool replaceLibTableEntry(const wxString &aLibNickname, const wxString &aLibFile)
Replace the file path of the symbol library table entry aLibNickname with aLibFile.
wxString KiCadSymbolLibFileWildcard()
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
static TOOL_ACTION importSymbol
void SetCurPart(LIB_PART *aPart, bool aUpdateZoom)
Take ownership of aPart and notes that it is the one currently being edited.
static TOOL_ACTION clearSelection
Clears the current selection.
void storeCurrentPart()
Return true if aLibId is an alias for the editor screen part.
std::unique_ptr< LIB_PART > & GetPartRef()
void Sync(const wxString &aForceRefresh, std::function< void(int, int, const wxString &)> aProgressCallback)
Updates the SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table.
A holder to handle information on schematic or board items.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
int UnsavedChangesDialog(wxWindow *parent, wxString aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
bool m_ShowPinElectricalType
Handle actions that are shared between different applications.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
bool HasLibModifications() const
Check if any pending libraries have been modified.
void ReCreateMenuBar() override
Recreates the menu bar.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
Specialization of the wxAuiPaneInfo class for KiCad panels.
static TOOL_ACTION showDeMorganStandard
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
bool addLibTableEntry(const wxString &aLibFile, TABLE_SCOPE aScope=GLOBAL_LIB_TABLE)
Add aLibFile to the symbol library table defined by aScope.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static TOOL_ACTION showElectricalTypes
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
UNDO_REDO_CONTAINER m_redoList
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
static TOOL_ACTION milsUnits
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
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...
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Gather all the actions that are shared by tools.
COLOR_SETTINGS * m_colorSettings
The current canvas type.
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
UNDO_REDO_LIST
Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if nee...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void LoadSymbolFromSchematic(SCH_COMPONENT *aSymbol)
Load a symbol from the schematic to edit in place.
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
static TOOL_ACTION newSymbol
wxArrayString GetLibraryNames() const
Return the array of library names.
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
bool LoadSymbolFromCurrentLib(const wxString &aAliasName, int aUnit=0, int aConvert=0)
Load a symbol from the current active library, optionally setting the selected unit and convert.
static TOOL_ACTION saveSymbolAs
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
void doCloseWindow() override
A modified version of the wxInfoBar class that allows us to:
LIB_ID GetTargetLibId() const
const BITMAP_OPAQUE icon_libedit_xpm[1]
COLOR4D GetColor(int aLayer) const
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
static wxString GetDefaultUserSymbolsPath()
Gets the default path we point users to create projects.
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
void SetFullURI(const wxString &aFullURI)
Change the full URI for the library.
SYMBOL_EDITOR_SETTINGS * m_settings
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
~SYMBOL_EDIT_FRAME() override
void OnToggleSearchTree(wxCommandEvent &event)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetAdapter()
Return the adapter object that provides the stored data.
bool saveAllLibraries(bool aRequireConfirmation)
Save the current part.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
Tool that displays edit points allowing to modify items by dragging the points.
SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
void SetNickName(const wxString &aNickName)
Change the logical name of this library, useful for an editor.
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
void SetOrigin(const Vec &pos)
Handle the component boundary box.
static wxString SubReference(int aUnit, bool aAddSeparator=true)
wxProgressDialog with the option to also update the application progress on the taskbar
static bool empty(const wxTextEntryBase *aCtrl)
wxPoint GetPosition() const override
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
bool isCurrentPart(const LIB_ID &aLibId) const
Rename LIB_PART aliases to avoid conflicts before adding a symbol to a library.
static TOOL_ACTION drawSymbolArc
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
coord_type GetHeight() const
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void OnExitKiCad(wxCommandEvent &event)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
Color settings are a bit different than most of the settings objects in that there can be more than o...
WX_INFOBAR * GetInfoBar()
static TOOL_ACTION deleteTool
SYMBOL_LIBRARY_MANAGER * m_libMgr
const BITMAP_OPAQUE icon_libedit_32_xpm[1]
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Create an empty library and adds it to the library table.
static TOOL_ACTION toggleSyncedPinsMode
void OnGridSettings(wxCommandEvent &event)
static TOOL_ACTION toggleCursorStyle
static TOOL_ACTION saveAll
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
Definition for part library class.
const Vec & GetOrigin() const
bool AddLibraryFile(bool aCreateNew)
Create or add an existing library to the symbol library table.
void emptyScreen()
Return either the part selected in the symbol tree, if context menu is active or the currently modifi...
MAIL_T Command()
Returns the MAIL_T associated with this mail.
LIB_TREE * GetLibTree() const
BASE_SCREEN class implementation.
void SyncLibraries(bool aShowProgress, const wxString &aForceRefresh=wxEmptyString)
Synchronize the library manager to the symbol library table, and then the symbol tree to the library ...
Handle actions for the various symbol editor and viewers.
static constexpr int Millimeter2iu(double mm)
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
bool m_ShowPinsElectricalType
bool IsSymbolFromLegacyLibrary() const
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
wxString SetCurLib(const wxString &aLibNickname)
Set the current library nickname and returns the old library nickname.
static TOOL_ACTION selectAll
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
virtual const wxString & GetText() const
Return the string associated with the text object.
bool UnitsLocked() const
Check whether part units are interchangeable.
static TOOL_ACTION duplicate
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
static TOOL_ACTION placeSymbolAnchor
void ClearListAndDeleteItems()
Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to th...
static TOOL_ACTION revert
static TOOL_ACTION selectionTool
static TOOL_ACTION saveLibraryAs
wxComboBox * m_unitSelectBox
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
virtual void UpdateMsgPanel()
Redraw the message panel.
const std::string KiCadSymbolLibFileExtension
wxString m_ColorTheme
Active color theme name.
The symbol library editor main window.