Cross-probing from Pin Table to Symbol Editor canvas.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8301
This commit is contained in:
parent
518741c52a
commit
30cbfc794f
|
@ -649,6 +649,11 @@ public:
|
||||||
return removedRow;
|
return removedRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIB_PINS GetRowPins( int aRow )
|
||||||
|
{
|
||||||
|
return m_rows[ aRow ];
|
||||||
|
}
|
||||||
|
|
||||||
bool IsEdited()
|
bool IsEdited()
|
||||||
{
|
{
|
||||||
return m_edited;
|
return m_edited;
|
||||||
|
@ -856,6 +861,11 @@ DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
|
||||||
// m_pins will already be empty.
|
// m_pins will already be empty.
|
||||||
for( LIB_PIN* pin : m_pins )
|
for( LIB_PIN* pin : m_pins )
|
||||||
delete pin;
|
delete pin;
|
||||||
|
|
||||||
|
WINDOW_THAWER thawer( m_editFrame );
|
||||||
|
|
||||||
|
m_editFrame->FocusOnItem( nullptr );
|
||||||
|
m_editFrame->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1018,6 +1028,34 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnCellEdited( wxGridEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_LIB_EDIT_PIN_TABLE::OnCellSelected( wxGridEvent& event )
|
||||||
|
{
|
||||||
|
LIB_PIN* pin = nullptr;
|
||||||
|
|
||||||
|
if( event.GetRow() >= 0 && event.GetRow() < m_dataModel->GetNumberRows() )
|
||||||
|
{
|
||||||
|
const LIB_PINS& pins = m_dataModel->GetRowPins( event.GetRow() );
|
||||||
|
|
||||||
|
if( pins.size() == 1 && m_editFrame->GetCurSymbol() )
|
||||||
|
{
|
||||||
|
for( LIB_PIN* candidate : m_editFrame->GetCurSymbol()->GetAllLibPins() )
|
||||||
|
{
|
||||||
|
if( candidate->GetNumber() == pins.at( 0 )->GetNumber() )
|
||||||
|
{
|
||||||
|
pin = candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WINDOW_THAWER thawer( m_editFrame );
|
||||||
|
|
||||||
|
m_editFrame->FocusOnItem( pin );
|
||||||
|
m_editFrame->GetCanvas()->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_LIB_EDIT_PIN_TABLE::IsDisplayGrouped()
|
bool DIALOG_LIB_EDIT_PIN_TABLE::IsDisplayGrouped()
|
||||||
{
|
{
|
||||||
return m_cbGroup->GetValue();
|
return m_cbGroup->GetValue();
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
void OnDeleteRow( wxCommandEvent& event ) override;
|
void OnDeleteRow( wxCommandEvent& event ) override;
|
||||||
void OnSize( wxSizeEvent& event ) override;
|
void OnSize( wxSizeEvent& event ) override;
|
||||||
void OnCellEdited( wxGridEvent& event ) override;
|
void OnCellEdited( wxGridEvent& event ) override;
|
||||||
|
void OnCellSelected( wxGridEvent& event ) override;
|
||||||
void OnRebuildRows( wxCommandEvent& event ) override;
|
void OnRebuildRows( wxCommandEvent& event ) override;
|
||||||
void OnGroupSelected( wxCommandEvent& event ) override;
|
void OnGroupSelected( wxCommandEvent& event ) override;
|
||||||
void OnFilterCheckBox( wxCommandEvent& event ) override;
|
void OnFilterCheckBox( wxCommandEvent& event ) override;
|
||||||
|
@ -77,10 +78,10 @@ public:
|
||||||
bool IsDisplayGrouped();
|
bool IsDisplayGrouped();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void updateSummary();
|
void updateSummary();
|
||||||
void adjustGridColumns();
|
void adjustGridColumns();
|
||||||
|
|
||||||
|
protected:
|
||||||
SYMBOL_EDIT_FRAME* m_editFrame;
|
SYMBOL_EDIT_FRAME* m_editFrame;
|
||||||
bool m_initialized = false;
|
bool m_initialized = false;
|
||||||
int m_originalColWidths[ COL_COUNT ];
|
int m_originalColWidths[ COL_COUNT ];
|
||||||
|
|
|
@ -185,6 +185,8 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnClose ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnClose ) );
|
||||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnUpdateUI ) );
|
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnUpdateUI ) );
|
||||||
m_grid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellEdited ), NULL, this );
|
m_grid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellEdited ), NULL, this );
|
||||||
|
m_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellSelected ), NULL, this );
|
||||||
|
m_grid->Connect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellSelected ), NULL, this );
|
||||||
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnSize ), NULL, this );
|
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnSize ), NULL, this );
|
||||||
m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnAddRow ), NULL, this );
|
m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnAddRow ), NULL, this );
|
||||||
m_deleteButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
m_deleteButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
||||||
|
@ -202,6 +204,8 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::~DIALOG_LIB_EDIT_PIN_TABLE_BASE()
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnClose ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnClose ) );
|
||||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnUpdateUI ) );
|
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnUpdateUI ) );
|
||||||
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellEdited ), NULL, this );
|
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellEdited ), NULL, this );
|
||||||
|
m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellSelected ), NULL, this );
|
||||||
|
m_grid->Disconnect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnCellSelected ), NULL, this );
|
||||||
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnSize ), NULL, this );
|
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnSize ), NULL, this );
|
||||||
m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnAddRow ), NULL, this );
|
m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnAddRow ), NULL, this );
|
||||||
m_deleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
m_deleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_TABLE_BASE::OnDeleteRow ), NULL, this );
|
||||||
|
|
|
@ -556,6 +556,8 @@
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
<event name="OnGridCellChange">OnCellEdited</event>
|
<event name="OnGridCellChange">OnCellEdited</event>
|
||||||
|
<event name="OnGridCellLeftClick">OnCellSelected</event>
|
||||||
|
<event name="OnGridEditorShown">OnCellSelected</event>
|
||||||
<event name="OnSize">OnSize</event>
|
<event name="OnSize">OnSize</event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -67,6 +67,7 @@ class DIALOG_LIB_EDIT_PIN_TABLE_BASE : public DIALOG_SHIM
|
||||||
virtual void OnClose( wxCloseEvent& event ) = 0;
|
virtual void OnClose( wxCloseEvent& event ) = 0;
|
||||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) = 0;
|
virtual void OnUpdateUI( wxUpdateUIEvent& event ) = 0;
|
||||||
virtual void OnCellEdited( wxGridEvent& event ) = 0;
|
virtual void OnCellEdited( wxGridEvent& event ) = 0;
|
||||||
|
virtual void OnCellSelected( wxGridEvent& event ) = 0;
|
||||||
virtual void OnSize( wxSizeEvent& event ) = 0;
|
virtual void OnSize( wxSizeEvent& event ) = 0;
|
||||||
virtual void OnAddRow( wxCommandEvent& event ) = 0;
|
virtual void OnAddRow( wxCommandEvent& event ) = 0;
|
||||||
virtual void OnDeleteRow( wxCommandEvent& event ) = 0;
|
virtual void OnDeleteRow( wxCommandEvent& event ) = 0;
|
||||||
|
|
|
@ -1303,6 +1303,54 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SYMBOL_EDIT_FRAME::FocusOnItem( LIB_ITEM* aItem )
|
||||||
|
{
|
||||||
|
static KIID lastBrightenedItemID( niluuid );
|
||||||
|
|
||||||
|
LIB_ITEM* lastItem = nullptr;
|
||||||
|
|
||||||
|
if( m_symbol )
|
||||||
|
{
|
||||||
|
for( LIB_PIN* pin : m_symbol->GetAllLibPins() )
|
||||||
|
{
|
||||||
|
if( pin->m_Uuid == lastBrightenedItemID )
|
||||||
|
lastItem = pin;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<LIB_FIELD*> fields;
|
||||||
|
|
||||||
|
m_symbol->GetFields( fields );
|
||||||
|
|
||||||
|
for( LIB_FIELD* field : fields )
|
||||||
|
{
|
||||||
|
if( field->m_Uuid == lastBrightenedItemID )
|
||||||
|
lastItem = field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( lastItem && lastItem != aItem )
|
||||||
|
{
|
||||||
|
lastItem->ClearBrightened();
|
||||||
|
|
||||||
|
UpdateItem( lastItem );
|
||||||
|
lastBrightenedItemID = niluuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( aItem )
|
||||||
|
{
|
||||||
|
if( !aItem->IsBrightened() )
|
||||||
|
{
|
||||||
|
aItem->SetBrightened();
|
||||||
|
|
||||||
|
UpdateItem( aItem );
|
||||||
|
lastBrightenedItemID = aItem->m_Uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusOnLocation( VECTOR2I( aItem->GetFocusPosition().x, -aItem->GetFocusPosition().y ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
void SYMBOL_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
{
|
{
|
||||||
const std::string& payload = mail.GetPayload();
|
const std::string& payload = mail.GetPayload();
|
||||||
|
|
|
@ -374,6 +374,8 @@ public:
|
||||||
|
|
||||||
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
||||||
|
|
||||||
|
void FocusOnItem( LIB_ITEM* aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a symbol from the schematic to edit in place.
|
* Load a symbol from the schematic to edit in place.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue