Move Symbol Properties and Pin Table to actions.
Fixes: lp:1804273 * https://bugs.launchpad.net/kicad/+bug/1804273
This commit is contained in:
parent
7995b5cc3c
commit
5c39521149
|
@ -1,7 +1,3 @@
|
||||||
/**
|
|
||||||
* @file dialog_edit_component_in_lib.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
|
@ -305,8 +301,13 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() );
|
LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() );
|
||||||
|
// We need to keep the name and the value the same at the moment!
|
||||||
|
wxString newName = m_libEntry->GetValueField().GetText();
|
||||||
|
|
||||||
m_Parent->SaveCopyInUndoList( m_libEntry );
|
if( m_libEntry->GetName() != newName )
|
||||||
|
m_Parent->SaveCopyInUndoList( m_libEntry, UR_LIB_RENAME );
|
||||||
|
else
|
||||||
|
m_Parent->SaveCopyInUndoList( m_libEntry );
|
||||||
|
|
||||||
// The Y axis for components in lib is from bottom to top while the screen axis is top
|
// The Y axis for components in lib is from bottom to top while the screen axis is top
|
||||||
// to bottom: we must change the y coord sign when writing back to the library
|
// to bottom: we must change the y coord sign when writing back to the library
|
||||||
|
@ -324,7 +325,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
|
||||||
m_libEntry->SetFields( *m_fields );
|
m_libEntry->SetFields( *m_fields );
|
||||||
|
|
||||||
// We need to keep the name and the value the same at the moment!
|
// We need to keep the name and the value the same at the moment!
|
||||||
m_libEntry->SetName( m_libEntry->GetValueField().GetText() );
|
m_libEntry->SetName( newName );
|
||||||
|
|
||||||
rootAlias->SetDescription( m_DescCtrl->GetValue() );
|
rootAlias->SetDescription( m_DescCtrl->GetValue() );
|
||||||
rootAlias->SetKeyWords( m_KeywordCtrl->GetValue() );
|
rootAlias->SetKeyWords( m_KeywordCtrl->GetValue() );
|
||||||
|
|
|
@ -196,7 +196,7 @@ enum id_eeschema_frm
|
||||||
ID_LIBEDIT_EDIT_PIN_BY_TABLE,
|
ID_LIBEDIT_EDIT_PIN_BY_TABLE,
|
||||||
ID_LIBEDIT_VIEW_DOC,
|
ID_LIBEDIT_VIEW_DOC,
|
||||||
ID_LIBEDIT_CHECK_PART,
|
ID_LIBEDIT_CHECK_PART,
|
||||||
ID_LIBEDIT_GET_FRAME_EDIT_PART,
|
ID_LIBEDIT_SYMBOL_PROPERTIES,
|
||||||
ID_LIBEDIT_SELECT_PART_NUMBER,
|
ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||||
|
|
||||||
/* Library editor vertical toolbar IDs. */
|
/* Library editor vertical toolbar IDs. */
|
||||||
|
|
|
@ -117,13 +117,11 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_TOOL( ID_TO_LIBVIEW, LIB_EDIT_FRAME::OnOpenLibraryViewer )
|
EVT_TOOL( ID_TO_LIBVIEW, LIB_EDIT_FRAME::OnOpenLibraryViewer )
|
||||||
EVT_TOOL( wxID_UNDO, LIB_EDIT_FRAME::GetComponentFromUndoList )
|
EVT_TOOL( wxID_UNDO, LIB_EDIT_FRAME::GetComponentFromUndoList )
|
||||||
EVT_TOOL( wxID_REDO, LIB_EDIT_FRAME::GetComponentFromRedoList )
|
EVT_TOOL( wxID_REDO, LIB_EDIT_FRAME::GetComponentFromRedoList )
|
||||||
EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_PART, LIB_EDIT_FRAME::OnEditComponentProperties )
|
|
||||||
EVT_TOOL( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnCheckComponent )
|
EVT_TOOL( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnCheckComponent )
|
||||||
EVT_TOOL( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle )
|
EVT_TOOL( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle )
|
||||||
EVT_TOOL( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle )
|
EVT_TOOL( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle )
|
||||||
EVT_TOOL( ID_LIBEDIT_VIEW_DOC, LIB_EDIT_FRAME::OnViewEntryDoc )
|
EVT_TOOL( ID_LIBEDIT_VIEW_DOC, LIB_EDIT_FRAME::OnViewEntryDoc )
|
||||||
EVT_TOOL( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnSyncPinEditClick )
|
EVT_TOOL( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnSyncPinEditClick )
|
||||||
EVT_TOOL( ID_LIBEDIT_EDIT_PIN_BY_TABLE, LIB_EDIT_FRAME::OnOpenPinTable )
|
|
||||||
EVT_TOOL( ID_ADD_PART_TO_SCHEMATIC, LIB_EDIT_FRAME::OnAddPartToSchematic )
|
EVT_TOOL( ID_ADD_PART_TO_SCHEMATIC, LIB_EDIT_FRAME::OnAddPartToSchematic )
|
||||||
|
|
||||||
EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectUnit )
|
EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectUnit )
|
||||||
|
@ -160,7 +158,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_AS, LIB_EDIT_FRAME::OnUpdateHavePart )
|
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_AS, LIB_EDIT_FRAME::OnUpdateHavePart )
|
||||||
EVT_UPDATE_UI( ID_LIBEDIT_REVERT, LIB_EDIT_FRAME::OnUpdateRevert )
|
EVT_UPDATE_UI( ID_LIBEDIT_REVERT, LIB_EDIT_FRAME::OnUpdateRevert )
|
||||||
EVT_UPDATE_UI( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
EVT_UPDATE_UI( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||||
EVT_UPDATE_UI( ID_LIBEDIT_GET_FRAME_EDIT_PART, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
EVT_UPDATE_UI( ID_LIBEDIT_SYMBOL_PROPERTIES, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||||
EVT_UPDATE_UI( wxID_UNDO, LIB_EDIT_FRAME::OnUpdateUndo )
|
EVT_UPDATE_UI( wxID_UNDO, LIB_EDIT_FRAME::OnUpdateUndo )
|
||||||
EVT_UPDATE_UI( wxID_REDO, LIB_EDIT_FRAME::OnUpdateRedo )
|
EVT_UPDATE_UI( wxID_REDO, LIB_EDIT_FRAME::OnUpdateRedo )
|
||||||
EVT_UPDATE_UI( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnUpdateSyncPinEdit )
|
EVT_UPDATE_UI( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnUpdateSyncPinEdit )
|
||||||
|
@ -188,7 +186,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_DrawSpecificConvert = true;
|
m_DrawSpecificConvert = true;
|
||||||
m_DrawSpecificUnit = false;
|
m_DrawSpecificUnit = false;
|
||||||
m_hotkeysDescrList = g_Libedit_Hotkeys_Descr;
|
m_hotkeysDescrList = g_Libedit_Hotkeys_Descr;
|
||||||
m_syncPinEdit = false;
|
m_SyncPinEdit = false;
|
||||||
m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
|
m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
|
||||||
SetShowElectricalType( true );
|
SetShowElectricalType( true );
|
||||||
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
|
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
|
||||||
|
@ -532,7 +530,7 @@ void LIB_EDIT_FRAME::OnUpdateSyncPinEdit( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
LIB_PART* part = GetCurPart();
|
LIB_PART* part = GetCurPart();
|
||||||
event.Enable( part && part->IsMulti() && !part->UnitsLocked() );
|
event.Enable( part && part->IsMulti() && !part->UnitsLocked() );
|
||||||
event.Check( m_syncPinEdit );
|
event.Check( m_SyncPinEdit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -643,7 +641,7 @@ void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event )
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnSyncPinEditClick( wxCommandEvent& event )
|
void LIB_EDIT_FRAME::OnSyncPinEditClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_syncPinEdit = m_mainToolBar->GetToolToggled( ID_LIBEDIT_SYNC_PIN_EDIT );
|
m_SyncPinEdit = m_mainToolBar->GetToolToggled( ID_LIBEDIT_SYNC_PIN_EDIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -712,62 +710,13 @@ void LIB_EDIT_FRAME::SetCurPart( LIB_PART* aPart )
|
||||||
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName );
|
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName );
|
||||||
|
|
||||||
// Ensure synchronized pin edit can be enabled only symbols with interchangeable units
|
// Ensure synchronized pin edit can be enabled only symbols with interchangeable units
|
||||||
m_syncPinEdit = aPart && aPart->IsMulti() && !aPart->UnitsLocked();
|
m_SyncPinEdit = aPart && aPart->IsMulti() && !aPart->UnitsLocked();
|
||||||
|
|
||||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||||
RebuildView();
|
RebuildView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
bool partLocked = GetCurPart()->UnitsLocked();
|
|
||||||
wxString oldName = GetCurPart()->GetName();
|
|
||||||
wxArrayString oldAliases = GetCurPart()->GetAliasNames( false );
|
|
||||||
|
|
||||||
m_toolManager->RunAction( ACTIONS::cancelInteractive, true );
|
|
||||||
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
|
||||||
|
|
||||||
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this, GetCurPart() );
|
|
||||||
|
|
||||||
// This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
|
|
||||||
// frame. Therefore this dialog as a modal frame parent, MUST be run under
|
|
||||||
// quasimodal mode for the quasimodal frame support to work. So don't use
|
|
||||||
// the QUASIMODAL macros here.
|
|
||||||
if( dlg.ShowQuasiModal() != wxID_OK )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// if m_UnitSelectionLocked has changed, set some edit options or defaults
|
|
||||||
// to the best value
|
|
||||||
if( partLocked != GetCurPart()->UnitsLocked() )
|
|
||||||
{
|
|
||||||
// Enable synchronized pin edit mode for symbols with interchangeable units
|
|
||||||
m_syncPinEdit = !GetCurPart()->UnitsLocked();
|
|
||||||
// also set default edit options to the better value
|
|
||||||
// Usually if units are locked, graphic items are specific to each unit
|
|
||||||
// and if units are interchangeable, graphic items are common to units
|
|
||||||
m_DrawSpecificUnit = GetCurPart()->UnitsLocked();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( oldName != GetCurPart()->GetName() )
|
|
||||||
m_libMgr->UpdatePartAfterRename( GetCurPart(), oldName, GetCurLib() );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_libMgr->UpdatePart( GetCurPart(), GetCurLib() );
|
|
||||||
|
|
||||||
if( oldAliases != GetCurPart()->GetAliasNames( false ) )
|
|
||||||
SyncLibraries( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
RebuildSymbolUnitsList();
|
|
||||||
updateTitle();
|
|
||||||
DisplayCmpDoc();
|
|
||||||
|
|
||||||
RebuildView();
|
|
||||||
OnModify();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent )
|
void LIB_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
m_toolManager->DeactivateTool();
|
m_toolManager->DeactivateTool();
|
||||||
|
@ -797,29 +746,11 @@ void LIB_EDIT_FRAME::OnModify()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnOpenPinTable( wxCommandEvent& aEvent )
|
|
||||||
{
|
|
||||||
LIB_PART* part = GetCurPart();
|
|
||||||
|
|
||||||
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
|
||||||
|
|
||||||
SaveCopyInUndoList( part );
|
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN_TABLE dlg( this, part );
|
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
RebuildView();
|
|
||||||
OnModify();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool LIB_EDIT_FRAME::SynchronizePins()
|
bool LIB_EDIT_FRAME::SynchronizePins()
|
||||||
{
|
{
|
||||||
LIB_PART* part = GetCurPart();
|
LIB_PART* part = GetCurPart();
|
||||||
|
|
||||||
return m_syncPinEdit && part && part->IsMulti() && !part->UnitsLocked();
|
return m_SyncPinEdit && part && part->IsMulti() && !part->UnitsLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,27 +55,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
|
||||||
SYMBOL_TREE_PANE* m_treePane; ///< component search tree widget
|
SYMBOL_TREE_PANE* m_treePane; ///< component search tree widget
|
||||||
LIB_MANAGER* m_libMgr; ///< manager taking care of temporary modificatoins
|
LIB_MANAGER* m_libMgr; ///< manager taking care of temporary modificatoins
|
||||||
|
|
||||||
/**
|
|
||||||
* Set to true to not synchronize pins at the same position when editing
|
|
||||||
* symbols with multiple units or multiple body styles.
|
|
||||||
* Therefore deleting, moving pins are made for all pins at the same location
|
|
||||||
* When units are interchangeable, synchronizing editing of pins is usually
|
|
||||||
* the best way, because if units are interchangeable, it imply all similar
|
|
||||||
* pins are on the same location.
|
|
||||||
* When units are non interchangeable, do not synchronize editing of pins, because
|
|
||||||
* each part is specific, and there are no similar pins between units.
|
|
||||||
*
|
|
||||||
* Setting this to false allows editing each pin per part or body style
|
|
||||||
* regardless other pins at the same location.
|
|
||||||
* This requires the user to open each part or body style to make changes
|
|
||||||
* to the other pins at the same location.
|
|
||||||
* To know if others pins must be coupled when editing a pin, use
|
|
||||||
* SynchronizePins() instead of m_syncPinEdit, because SynchronizePins()
|
|
||||||
* is more reliable (takes in account the fact units are interchangeable,
|
|
||||||
* there are more than one unit).
|
|
||||||
*/
|
|
||||||
bool m_syncPinEdit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the option to show the pin electrical name in the component editor
|
* the option to show the pin electrical name in the component editor
|
||||||
*/
|
*/
|
||||||
|
@ -110,6 +89,27 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
|
||||||
int m_defaultLibWidth;
|
int m_defaultLibWidth;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Set to true to not synchronize pins at the same position when editing
|
||||||
|
* symbols with multiple units or multiple body styles.
|
||||||
|
* Therefore deleting, moving pins are made for all pins at the same location
|
||||||
|
* When units are interchangeable, synchronizing editing of pins is usually
|
||||||
|
* the best way, because if units are interchangeable, it imply all similar
|
||||||
|
* pins are on the same location.
|
||||||
|
* When units are non interchangeable, do not synchronize editing of pins, because
|
||||||
|
* each part is specific, and there are no similar pins between units.
|
||||||
|
*
|
||||||
|
* Setting this to false allows editing each pin per part or body style
|
||||||
|
* regardless other pins at the same location.
|
||||||
|
* This requires the user to open each part or body style to make changes
|
||||||
|
* to the other pins at the same location.
|
||||||
|
* To know if others pins must be coupled when editing a pin, use
|
||||||
|
* SynchronizePins() instead of m_syncPinEdit, because SynchronizePins()
|
||||||
|
* is more reliable (takes in account the fact units are interchangeable,
|
||||||
|
* there are more than one unit).
|
||||||
|
*/
|
||||||
|
bool m_SyncPinEdit;
|
||||||
|
|
||||||
/** Convert of the item currently being drawn. */
|
/** Convert of the item currently being drawn. */
|
||||||
bool m_DrawSpecificConvert;
|
bool m_DrawSpecificConvert;
|
||||||
|
|
||||||
|
@ -298,14 +298,10 @@ public:
|
||||||
bool IsSearchTreeShown();
|
bool IsSearchTreeShown();
|
||||||
void ClearSearchTreeSelection();
|
void ClearSearchTreeSelection();
|
||||||
|
|
||||||
void OnEditComponentProperties( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void OnViewEntryDoc( wxCommandEvent& event );
|
void OnViewEntryDoc( wxCommandEvent& event );
|
||||||
void OnCheckComponent( wxCommandEvent& event );
|
void OnCheckComponent( wxCommandEvent& event );
|
||||||
void OnSelectBodyStyle( wxCommandEvent& event );
|
void OnSelectBodyStyle( wxCommandEvent& event );
|
||||||
|
|
||||||
void OnOpenPinTable( wxCommandEvent& aEvent );
|
|
||||||
|
|
||||||
void OnUpdatePaste( wxUpdateUIEvent& event );
|
void OnUpdatePaste( wxUpdateUIEvent& event );
|
||||||
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
||||||
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
||||||
|
@ -322,7 +318,7 @@ public:
|
||||||
void OnUpdateElectricalType( wxUpdateUIEvent& aEvent );
|
void OnUpdateElectricalType( wxUpdateUIEvent& aEvent );
|
||||||
void OnUpdateSearchTreeTool( wxUpdateUIEvent& aEvent );
|
void OnUpdateSearchTreeTool( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
void UpdateAfterRename( LIB_PART* aPart, const wxString& aOldName, const wxString& aNewName );
|
void UpdateAfterSymbolProperties( wxString* aOldName, wxArrayString* aOldAliases );
|
||||||
void RebuildSymbolUnitsList();
|
void RebuildSymbolUnitsList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -488,20 +484,6 @@ private:
|
||||||
void GetComponentFromUndoList( wxCommandEvent& event );
|
void GetComponentFromUndoList( wxCommandEvent& event );
|
||||||
void GetComponentFromRedoList( wxCommandEvent& event );
|
void GetComponentFromRedoList( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare the displacement of a pin
|
|
||||||
*
|
|
||||||
* @param aPin the pin to prepare for movement.
|
|
||||||
*/
|
|
||||||
void StartMovePin( LIB_ITEM* aPin );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds copies of \a aPin in components with multiple units in all units
|
|
||||||
*
|
|
||||||
* @param aPin The pin to copy to others units.
|
|
||||||
*/
|
|
||||||
void CreateImagePins( LIB_PIN* aPin );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a component symbol file (*.sym ) and add graphic items to the current component.
|
* Read a component symbol file (*.sym ) and add graphic items to the current component.
|
||||||
*
|
*
|
||||||
|
@ -636,17 +618,6 @@ private:
|
||||||
///> Renames LIB_PART aliases to avoid conflicts before adding a component to a library
|
///> Renames LIB_PART aliases to avoid conflicts before adding a component to a library
|
||||||
void fixDuplicateAliases( LIB_PART* aPart, const wxString& aLibrary );
|
void fixDuplicateAliases( LIB_PART* aPart, const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies items selected in the current part to the internal clipboard.
|
|
||||||
*/
|
|
||||||
void copySelectedItems();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pastes items from the internal clipboard to the current part.
|
|
||||||
* @param aOffset is the offset where the pasted items should be located.
|
|
||||||
*/
|
|
||||||
void pasteClipboard( const wxPoint& aOffset );
|
|
||||||
|
|
||||||
///> Clipboard buffer storing LIB_ITEMs
|
///> Clipboard buffer storing LIB_ITEMs
|
||||||
BLOCK_SELECTOR m_clipboard;
|
BLOCK_SELECTOR m_clipboard;
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, in
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Enable synchronized pin edit mode for symbols with interchangeable units
|
// Enable synchronized pin edit mode for symbols with interchangeable units
|
||||||
m_syncPinEdit = !GetCurPart()->UnitsLocked();
|
m_SyncPinEdit = !GetCurPart()->UnitsLocked();
|
||||||
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
@ -546,30 +546,40 @@ void LIB_EDIT_FRAME::savePartAs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::UpdateAfterRename( LIB_PART* aPart, const wxString& aOldName,
|
void LIB_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName, wxArrayString* aOldAliases )
|
||||||
const wxString& aNewName )
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString lib = GetCurLib();
|
wxString lib = GetCurLib();
|
||||||
|
LIB_PART* part = GetCurPart();
|
||||||
|
|
||||||
// Test the current library for name conflicts
|
if( aOldName && *aOldName != part->GetName() )
|
||||||
if( !lib.empty() && m_libMgr->PartExists( aNewName, lib ) )
|
|
||||||
{
|
{
|
||||||
msg.Printf( _( "The name '%s' conflicts with an existing entry in the library '%s'." ),
|
// Test the current library for name conflicts
|
||||||
aNewName,
|
if( !lib.empty() && m_libMgr->PartExists( part->GetName(), lib ) )
|
||||||
lib );
|
{
|
||||||
|
msg.Printf( _( "The name '%s' conflicts with an existing entry in the library '%s'." ),
|
||||||
|
part->GetName(),
|
||||||
|
lib );
|
||||||
|
|
||||||
DisplayErrorMessage( this, msg );
|
DisplayErrorMessage( this, msg );
|
||||||
return;
|
part->SetName( *aOldName );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_libMgr->UpdatePartAfterRename( part, *aOldName, lib );
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCopyInUndoList( aPart, UR_LIB_RENAME );
|
if( aOldAliases && *aOldAliases != part->GetAliasNames( false ) )
|
||||||
aPart->SetName( aNewName );
|
SyncLibraries( false );
|
||||||
|
|
||||||
m_libMgr->UpdatePartAfterRename( aPart, aOldName, lib );
|
|
||||||
|
|
||||||
// Reselect the renamed part
|
// Reselect the renamed part
|
||||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, aNewName ) );
|
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
|
||||||
|
|
||||||
|
RebuildSymbolUnitsList();
|
||||||
|
updateTitle();
|
||||||
|
DisplayCmpDoc();
|
||||||
|
|
||||||
|
RebuildView();
|
||||||
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
|
|
||||||
AddMenuItem( editMenu,
|
AddMenuItem( editMenu,
|
||||||
ID_LIBEDIT_GET_FRAME_EDIT_PART,
|
ID_LIBEDIT_SYMBOL_PROPERTIES,
|
||||||
_( "&Properties..." ),
|
_( "&Properties..." ),
|
||||||
_( "Edit symbol properties" ),
|
_( "Edit symbol properties" ),
|
||||||
KiBitmap( part_properties_xpm ) );
|
KiBitmap( part_properties_xpm ) );
|
||||||
|
|
|
@ -146,7 +146,7 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
|
||||||
|
|
||||||
KiScaledSeparator( m_mainToolBar, this );
|
KiScaledSeparator( m_mainToolBar, this );
|
||||||
|
|
||||||
m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString,
|
m_mainToolBar->AddTool( ID_LIBEDIT_SYMBOL_PROPERTIES, wxEmptyString,
|
||||||
KiScaledBitmap( part_properties_xpm, this ),
|
KiScaledBitmap( part_properties_xpm, this ),
|
||||||
_( "Edit symbol properties" ) );
|
_( "Edit symbol properties" ) );
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,12 @@ OPT<TOOL_EVENT> EE_ACTIONS::TranslateLegacyId( int aId )
|
||||||
|
|
||||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||||
return EE_ACTIONS::deleteItemCursor.MakeEvent();
|
return EE_ACTIONS::deleteItemCursor.MakeEvent();
|
||||||
|
|
||||||
|
case ID_LIBEDIT_SYMBOL_PROPERTIES:
|
||||||
|
return EE_ACTIONS::symbolProperties.MakeEvent();
|
||||||
|
|
||||||
|
case ID_LIBEDIT_EDIT_PIN_BY_TABLE:
|
||||||
|
return EE_ACTIONS::pinTable.MakeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return OPT<TOOL_EVENT>();
|
return OPT<TOOL_EVENT>();
|
||||||
|
|
|
@ -161,6 +161,8 @@ public:
|
||||||
static TOOL_ACTION switchCursor;
|
static TOOL_ACTION switchCursor;
|
||||||
static TOOL_ACTION switchUnits;
|
static TOOL_ACTION switchUnits;
|
||||||
static TOOL_ACTION updateUnits;
|
static TOOL_ACTION updateUnits;
|
||||||
|
static TOOL_ACTION symbolProperties;
|
||||||
|
static TOOL_ACTION pinTable;
|
||||||
static TOOL_ACTION deleteItemCursor;
|
static TOOL_ACTION deleteItemCursor;
|
||||||
static TOOL_ACTION refreshPreview;
|
static TOOL_ACTION refreshPreview;
|
||||||
static TOOL_ACTION explicitCrossProbe;
|
static TOOL_ACTION explicitCrossProbe;
|
||||||
|
|
|
@ -215,24 +215,28 @@ bool EE_SELECTION_TOOL::Init()
|
||||||
menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
|
menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
|
||||||
|
|
||||||
menu.AddSeparator( EE_CONDITIONS::Empty, 100 );
|
menu.AddSeparator( EE_CONDITIONS::Empty, 100 );
|
||||||
menu.AddItem( EE_ACTIONS::startWire, !libEdit && EE_CONDITIONS::Empty, 100 );
|
menu.AddItem( EE_ACTIONS::startWire, !libEdit && EE_CONDITIONS::Empty, 100 );
|
||||||
menu.AddItem( EE_ACTIONS::startBus, !libEdit && EE_CONDITIONS::Empty, 100 );
|
menu.AddItem( EE_ACTIONS::startBus, !libEdit && EE_CONDITIONS::Empty, 100 );
|
||||||
|
|
||||||
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
||||||
menu.AddItem( EE_ACTIONS::finishWire, SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
menu.AddItem( EE_ACTIONS::finishWire, SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
||||||
|
|
||||||
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 );
|
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 );
|
||||||
menu.AddItem( EE_ACTIONS::finishBus, SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 );
|
menu.AddItem( EE_ACTIONS::finishBus, SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 );
|
||||||
|
|
||||||
menu.AddSeparator( EE_CONDITIONS::NotEmpty, 200 );
|
menu.AddSeparator( EE_CONDITIONS::NotEmpty, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::addJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::addJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::addLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::addLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 200 );
|
menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 200 );
|
||||||
|
|
||||||
|
menu.AddSeparator( libEdit && EE_CONDITIONS::Empty, 400 );
|
||||||
|
menu.AddItem( EE_ACTIONS::symbolProperties, libEdit && EE_CONDITIONS::Empty, 400 );
|
||||||
|
menu.AddItem( EE_ACTIONS::pinTable, libEdit && EE_CONDITIONS::Empty, 400 );
|
||||||
|
|
||||||
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
|
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
|
||||||
m_menu.AddStandardSubMenus( m_frame );
|
m_menu.AddStandardSubMenus( m_frame );
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include <dialogs/dialog_lib_edit_draw_item.h>
|
#include <dialogs/dialog_lib_edit_draw_item.h>
|
||||||
#include <dialogs/dialog_lib_edit_text.h>
|
#include <dialogs/dialog_lib_edit_text.h>
|
||||||
#include <dialogs/dialog_edit_one_field.h>
|
#include <dialogs/dialog_edit_one_field.h>
|
||||||
|
#include <dialogs/dialog_edit_component_in_lib.h>
|
||||||
|
#include <dialogs/dialog_lib_edit_pin_table.h>
|
||||||
#include <sch_legacy_plugin.h>
|
#include <sch_legacy_plugin.h>
|
||||||
#include "lib_edit_tool.h"
|
#include "lib_edit_tool.h"
|
||||||
|
|
||||||
|
@ -362,12 +364,10 @@ int LIB_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
SELECTION& selection = m_selectionTool->RequestSelection();
|
SELECTION& selection = m_selectionTool->RequestSelection();
|
||||||
|
|
||||||
if( selection.Empty() )
|
if( selection.Empty() || aEvent.IsAction( &EE_ACTIONS::symbolProperties ) )
|
||||||
{
|
{
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
if( m_frame->GetCurPart() )
|
||||||
|
editSymbolProperties();
|
||||||
cmd.SetId( ID_LIBEDIT_GET_FRAME_EDIT_PART );
|
|
||||||
m_frame->GetEventHandler()->ProcessEvent( cmd );
|
|
||||||
}
|
}
|
||||||
else if( selection.Size() == 1 )
|
else if( selection.Size() == 1 )
|
||||||
{
|
{
|
||||||
|
@ -488,13 +488,78 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
||||||
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
|
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
|
||||||
|
|
||||||
if( renamed )
|
if( renamed )
|
||||||
m_frame->UpdateAfterRename( parent, oldFieldValue, newFieldValue );
|
m_frame->SaveCopyInUndoList( parent, UR_LIB_RENAME );
|
||||||
|
else
|
||||||
|
m_frame->SaveCopyInUndoList( parent );
|
||||||
|
|
||||||
dlg.UpdateField( aField );
|
dlg.UpdateField( aField );
|
||||||
|
|
||||||
m_frame->GetCanvas()->GetView()->Update( aField );
|
if( renamed )
|
||||||
m_frame->GetCanvas()->Refresh();
|
{
|
||||||
m_frame->OnModify( );
|
parent->SetName( newFieldValue );
|
||||||
|
m_frame->UpdateAfterSymbolProperties( &oldFieldValue, nullptr );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_frame->GetCanvas()->GetView()->Update( aField );
|
||||||
|
m_frame->GetCanvas()->Refresh();
|
||||||
|
m_frame->OnModify( );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LIB_EDIT_TOOL::editSymbolProperties()
|
||||||
|
{
|
||||||
|
LIB_PART* part = m_frame->GetCurPart();
|
||||||
|
bool partLocked = part->UnitsLocked();
|
||||||
|
wxString oldName = part->GetName();
|
||||||
|
wxArrayString oldAliases = part->GetAliasNames( false );
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
|
||||||
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( m_frame, part );
|
||||||
|
|
||||||
|
// This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
|
||||||
|
// frame. Therefore this dialog as a modal frame parent, MUST be run under
|
||||||
|
// quasimodal mode for the quasimodal frame support to work. So don't use
|
||||||
|
// the QUASIMODAL macros here.
|
||||||
|
if( dlg.ShowQuasiModal() != wxID_OK )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// if m_UnitSelectionLocked has changed, set some edit options or defaults
|
||||||
|
// to the best value
|
||||||
|
if( partLocked != part->UnitsLocked() )
|
||||||
|
{
|
||||||
|
// Enable synchronized pin edit mode for symbols with interchangeable units
|
||||||
|
m_frame->m_SyncPinEdit = !part->UnitsLocked();
|
||||||
|
// also set default edit options to the better value
|
||||||
|
// Usually if units are locked, graphic items are specific to each unit
|
||||||
|
// and if units are interchangeable, graphic items are common to units
|
||||||
|
m_frame->m_DrawSpecificUnit = part->UnitsLocked();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_frame->UpdateAfterSymbolProperties( &oldName, &oldAliases );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
LIB_PART* part = m_frame->GetCurPart();
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
|
m_frame->SaveCopyInUndoList( part );
|
||||||
|
|
||||||
|
DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, part );
|
||||||
|
|
||||||
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
m_frame->RebuildView();
|
||||||
|
m_frame->OnModify();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -602,6 +667,8 @@ void LIB_EDIT_TOOL::setTransitions()
|
||||||
Go( &LIB_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteItemCursor.MakeEvent() );
|
Go( &LIB_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteItemCursor.MakeEvent() );
|
||||||
|
|
||||||
Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() );
|
Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() );
|
||||||
|
Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::symbolProperties.MakeEvent() );
|
||||||
|
Go( &LIB_EDIT_TOOL::PinTable, EE_ACTIONS::pinTable.MakeEvent() );
|
||||||
|
|
||||||
Go( &LIB_EDIT_TOOL::Cut, EE_ACTIONS::cut.MakeEvent() );
|
Go( &LIB_EDIT_TOOL::Cut, EE_ACTIONS::cut.MakeEvent() );
|
||||||
Go( &LIB_EDIT_TOOL::Copy, EE_ACTIONS::copy.MakeEvent() );
|
Go( &LIB_EDIT_TOOL::Copy, EE_ACTIONS::copy.MakeEvent() );
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
int Duplicate( const TOOL_EVENT& aEvent );
|
int Duplicate( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
int Properties( const TOOL_EVENT& aEvent );
|
int Properties( const TOOL_EVENT& aEvent );
|
||||||
|
int PinTable( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
int Cut( const TOOL_EVENT& aEvent );
|
int Cut( const TOOL_EVENT& aEvent );
|
||||||
int Copy( const TOOL_EVENT& aEvent );
|
int Copy( const TOOL_EVENT& aEvent );
|
||||||
|
@ -73,6 +74,7 @@ private:
|
||||||
void editGraphicProperties( LIB_ITEM* aItem );
|
void editGraphicProperties( LIB_ITEM* aItem );
|
||||||
void editTextProperties( LIB_ITEM* aItem );
|
void editTextProperties( LIB_ITEM* aItem );
|
||||||
void editFieldProperties( LIB_FIELD* aField );
|
void editFieldProperties( LIB_FIELD* aField );
|
||||||
|
void editSymbolProperties();
|
||||||
|
|
||||||
///> Sets up handlers for various events.
|
///> Sets up handlers for various events.
|
||||||
void setTransitions() override;
|
void setTransitions() override;
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool LIB_MOVE_TOOL::Init()
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
||||||
|
|
||||||
selToolMenu.AddItem( EE_ACTIONS::move, EE_CONDITIONS::Idle, 150 );
|
selToolMenu.AddItem( EE_ACTIONS::move, EE_CONDITIONS::IdleSelection, 150 );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,16 @@ TOOL_ACTION EE_ACTIONS::cleanupSheetPins( "eeschema.InteractiveEdit.cleanupSheet
|
||||||
_( "Cleanup Sheet Pins" ), _( "Delete unreferenced sheet pins" ),
|
_( "Cleanup Sheet Pins" ), _( "Delete unreferenced sheet pins" ),
|
||||||
nullptr );
|
nullptr );
|
||||||
|
|
||||||
|
TOOL_ACTION EE_ACTIONS::symbolProperties( "eeschema.InteractiveEdit.symbolProperties",
|
||||||
|
AS_GLOBAL, 0,
|
||||||
|
_( "Symbol Properties..." ), _( "Displays symbol properties dialog" ),
|
||||||
|
part_properties_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION EE_ACTIONS::pinTable( "eeschema.InteractiveEdit.pinTable",
|
||||||
|
AS_GLOBAL, 0,
|
||||||
|
_( "Pin Table..." ), _( "Displays pin table for bulk editing of pins" ),
|
||||||
|
pin_table_xpm );
|
||||||
|
|
||||||
TOOL_ACTION EE_ACTIONS::doDelete( "eeschema.InteractiveEdit.doDelete",
|
TOOL_ACTION EE_ACTIONS::doDelete( "eeschema.InteractiveEdit.doDelete",
|
||||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
|
||||||
_( "Delete" ), _( "Deletes selected item(s)" ),
|
_( "Delete" ), _( "Deletes selected item(s)" ),
|
||||||
|
|
Loading…
Reference in New Issue