diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index d538155bcf..646e401951 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -1302,28 +1302,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event ) m_grid->ClearSelection(); m_grid->SetGridCursor( event.GetRow(), event.GetCol() ); - int flag = m_dataModel->GetRowFlags( event.GetRow() ); m_dataModel->ExpandCollapseRow( event.GetRow() ); - std::vector refs = m_dataModel->GetRowReferences( event.GetRow() ); - - // Focus Eeschema view on the symbol selected in the dialog - // TODO: Highlight or select more than one unit - if( ( flag == GROUP_SINGLETON || flag == CHILD_ITEM ) && refs.size() >= 1 ) - { - SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool(); - - std::sort( refs.begin(), refs.end(), - []( const SCH_REFERENCE& a, const SCH_REFERENCE& b ) - { - return a.GetUnit() < b.GetUnit(); - } ); - - // search and highlight the symbol found by its full path. - // It allows select of not yet annotated or duplicaded symbols - wxString symbol_path = refs[0].GetFullPath(); - // wxString reference = refs[0].GetRef() + refs[0].GetRefNumber(); // Not used - editor->FindSymbolAndItem( &symbol_path, nullptr, true, HIGHLIGHT_SYMBOL, wxEmptyString ); - } } else { @@ -1331,6 +1310,45 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event ) } } +void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& event ) +{ + wxGridCellCoordsArray selectedCells = m_grid->GetSelectedCells(); + + if( selectedCells.GetCount() == 1 ) + { + int row = selectedCells[0].GetRow(); + int col = selectedCells[0].GetCol(); + + if( col == REFERENCE_FIELD ) + { + int flag = m_dataModel->GetRowFlags( row ); + std::vector refs = m_dataModel->GetRowReferences( row ); + + // Focus Eeschema view on the symbol selected in the dialog + // TODO: Highlight or select more than one unit + if( ( flag == GROUP_SINGLETON || flag == CHILD_ITEM ) && refs.size() >= 1 ) + { + SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool(); + + std::sort( refs.begin(), refs.end(), + []( const SCH_REFERENCE& a, const SCH_REFERENCE& b ) + { + return a.GetUnit() < b.GetUnit(); + } ); + + // search and highlight the symbol found by its full path. + // It allows select of not yet annotated or duplicaded symbols + wxString symbol_path = refs[0].GetFullPath(); + // wxString reference = refs[0].GetRef() + refs[0].GetRefNumber(); // Not used + editor->FindSymbolAndItem( &symbol_path, nullptr, true, HIGHLIGHT_SYMBOL, wxEmptyString ); + } + + return; + } + } + + event.Skip(); +} void DIALOG_SYMBOL_FIELDS_TABLE::OnTableItemContextMenu( wxGridEvent& event ) { diff --git a/eeschema/dialogs/dialog_symbol_fields_table.h b/eeschema/dialogs/dialog_symbol_fields_table.h index 9856c70577..5508e5c805 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.h +++ b/eeschema/dialogs/dialog_symbol_fields_table.h @@ -60,6 +60,7 @@ private: void OnRegroupSymbols( wxCommandEvent& aEvent ) override; void OnTableValueChanged( wxGridEvent& event ) override; void OnTableCellClick( wxGridEvent& event ) override; + void OnTableRangeSelected( wxGridRangeSelectEvent& event ) override; void OnTableItemContextMenu( wxGridEvent& event ) override; void OnTableColSize( wxGridSizeEvent& event ) override; void OnSizeFieldList( wxSizeEvent& event ) override; diff --git a/eeschema/dialogs/dialog_symbol_fields_table_base.cpp b/eeschema/dialogs/dialog_symbol_fields_table_base.cpp index 0ef879f0c0..e6aa5dc457 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table_base.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -165,6 +165,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare m_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableCellClick ), NULL, this ); m_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableItemContextMenu ), NULL, this ); m_grid->Connect( wxEVT_GRID_COL_SIZE, wxGridSizeEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableColSize ), NULL, this ); + m_grid->Connect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableRangeSelected ), NULL, this ); m_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExport ), NULL, this ); m_buttonApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnSaveAndContinue ), NULL, this ); m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnCancel ), NULL, this ); @@ -188,6 +189,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::~DIALOG_SYMBOL_FIELDS_TABLE_BASE() m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableCellClick ), NULL, this ); m_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableItemContextMenu ), NULL, this ); m_grid->Disconnect( wxEVT_GRID_COL_SIZE, wxGridSizeEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableColSize ), NULL, this ); + m_grid->Disconnect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableRangeSelected ), NULL, this ); m_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExport ), NULL, this ); m_buttonApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnSaveAndContinue ), NULL, this ); m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnCancel ), NULL, this ); diff --git a/eeschema/dialogs/dialog_symbol_fields_table_base.fbp b/eeschema/dialogs/dialog_symbol_fields_table_base.fbp index 43302e907b..56635c06f3 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table_base.fbp +++ b/eeschema/dialogs/dialog_symbol_fields_table_base.fbp @@ -872,6 +872,7 @@ OnTableCellClick OnTableItemContextMenu OnTableColSize + OnTableRangeSelected diff --git a/eeschema/dialogs/dialog_symbol_fields_table_base.h b/eeschema/dialogs/dialog_symbol_fields_table_base.h index df1347f714..b5e973fbea 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table_base.h +++ b/eeschema/dialogs/dialog_symbol_fields_table_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -78,6 +78,7 @@ class DIALOG_SYMBOL_FIELDS_TABLE_BASE : public DIALOG_SHIM virtual void OnTableCellClick( wxGridEvent& event ) { event.Skip(); } virtual void OnTableItemContextMenu( wxGridEvent& event ) { event.Skip(); } virtual void OnTableColSize( wxGridSizeEvent& event ) { event.Skip(); } + virtual void OnTableRangeSelected( wxGridRangeSelectEvent& event ) { event.Skip(); } virtual void OnExport( wxCommandEvent& event ) { event.Skip(); } virtual void OnSaveAndContinue( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }