From a02f447daa5b8b44b2e0f9cdf8852157c0af1935 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 14 Feb 2019 16:26:45 -0800 Subject: [PATCH] pcbnew: Do not auto edit the 3d-model grid Auto-selecting of the first grid element is performed in the footprint editor to facility rapid editing. Rapid editing of the 3d-model fields is not as useful and requires multiple esc-keys to cancel. This limits the auto-edit to only the reference tab. Fixes: lp:1815456 * https://bugs.launchpad.net/kicad/+bug/1815456 --- .../dialog_edit_footprint_for_BoardEditor.cpp | 23 ++++++++++++------- .../dialog_edit_footprint_for_BoardEditor.h | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp index fdf683a7fe..c8ebc57da3 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp @@ -64,6 +64,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, false, 0 ), m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ), m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl, m_SolderPasteMarginUnits ), + m_initialFocus( true ), m_inSelect( false ) { m_config = Kiface().KifaceSettings(); @@ -862,17 +863,23 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnUpdateUI( wxUpdateUIEvent& ) grid->SetFocus(); grid->MakeCellVisible( row, col ); - grid->SetGridCursor( row, col ); - grid->EnableCellEditControl( true ); - grid->ShowCellEditControl(); - - if( grid == m_itemsGrid && row == 0 && col == 0 ) + // Selecting the first grid item only makes sense for the + // items grid + if( !m_initialFocus || grid == m_itemsGrid ) { - auto referenceEditor = grid->GetCellEditor( 0, 0 ); - SelectReferenceNumber( dynamic_cast( referenceEditor->GetControl() ) ); - referenceEditor->DecRef(); + grid->SetGridCursor( row, col ); + grid->EnableCellEditControl( true ); + grid->ShowCellEditControl(); + + if( grid == m_itemsGrid && row == 0 && col == 0 ) + { + auto referenceEditor = grid->GetCellEditor( 0, 0 ); + SelectReferenceNumber( dynamic_cast( referenceEditor->GetControl() ) ); + referenceEditor->DecRef(); + } } + m_initialFocus = false; } } diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h index 5ba00b4f1c..a043b8bcf4 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h @@ -65,6 +65,7 @@ private: wxGrid* m_delayedFocusGrid; int m_delayedFocusRow; int m_delayedFocusColumn; + bool m_initialFocus; bool m_inSelect;