Select just reference number when editing reference field.
Fixes https://gitlab.com/kicad/code/kicad/issues/6004
This commit is contained in:
parent
b59c7e8632
commit
a6166c8ccc
|
@ -285,6 +285,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( SCH_EDIT
|
|||
m_width = 0;
|
||||
m_delayedFocusRow = REFERENCE;
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
m_delayedSelection = true;
|
||||
|
||||
#ifndef KICAD_SPICE
|
||||
m_spiceFieldsButton->Hide();
|
||||
|
@ -533,6 +534,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate()
|
|||
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
m_delayedFocusRow = REFERENCE;
|
||||
m_delayedSelection = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -549,6 +551,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate()
|
|||
|
||||
m_delayedFocusColumn = FDC_NAME;
|
||||
m_delayedFocusRow = i;
|
||||
m_delayedSelection = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -724,6 +727,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging( wxGridEvent& event
|
|||
event.Veto();
|
||||
m_delayedFocusRow = event.GetRow();
|
||||
m_delayedFocusColumn = event.GetCol();
|
||||
m_delayedSelection = false;
|
||||
}
|
||||
else if( event.GetCol() == FDC_NAME )
|
||||
{
|
||||
|
@ -741,6 +745,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging( wxGridEvent& event
|
|||
event.Veto();
|
||||
m_delayedFocusRow = event.GetRow();
|
||||
m_delayedFocusColumn = event.GetCol();
|
||||
m_delayedSelection = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -749,6 +754,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging( wxGridEvent& event
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridEditorShown( wxGridEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetRow() == REFERENCE && aEvent.GetCol() == FDC_VALUE )
|
||||
m_delayedSelection= true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_fieldsGrid->CommitPendingChanges() )
|
||||
|
@ -965,13 +977,25 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
m_fieldsGrid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn );
|
||||
m_fieldsGrid->SetGridCursor( m_delayedFocusRow, m_delayedFocusColumn );
|
||||
|
||||
|
||||
m_fieldsGrid->EnableCellEditControl( true );
|
||||
m_fieldsGrid->ShowCellEditControl();
|
||||
|
||||
m_delayedFocusRow = -1;
|
||||
m_delayedFocusColumn = -1;
|
||||
}
|
||||
|
||||
// Handle a delayed selection
|
||||
if( m_delayedSelection )
|
||||
{
|
||||
wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( REFERENCE, FDC_VALUE );
|
||||
|
||||
if( cellEditor->GetControl() )
|
||||
SelectReferenceNumber( dynamic_cast<wxTextEntry*>( cellEditor->GetControl() ) );
|
||||
|
||||
cellEditor->DecRef(); // we're done; must release
|
||||
|
||||
m_delayedSelection = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||
void OnCancelButtonClick( wxCommandEvent& event ) override;
|
||||
void OnInitDlg( wxInitDialogEvent& event ) override;
|
||||
void OnGridEditorShown( wxGridEvent& event ) override;
|
||||
|
||||
void OnEditSymbol( wxCommandEvent& ) override;
|
||||
void OnEditLibrarySymbol( wxCommandEvent& ) override;
|
||||
|
@ -94,6 +95,7 @@ private:
|
|||
int m_width;
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
bool m_delayedSelection;
|
||||
wxString m_shownColumns;
|
||||
|
||||
FIELDS_GRID_TABLE<SCH_FIELD>* m_fields;
|
||||
|
|
|
@ -326,7 +326,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
|
|||
m_stdDialogButtonSizer->AddButton( m_stdDialogButtonSizerCancel );
|
||||
m_stdDialogButtonSizer->Realize();
|
||||
|
||||
bSizerBottom->Add( m_stdDialogButtonSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
bSizerBottom->Add( m_stdDialogButtonSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
mainSizer->Add( bSizerBottom, 0, wxEXPAND, 5 );
|
||||
|
@ -339,6 +339,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
|
|||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnInitDlg ) );
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnUpdateUI ) );
|
||||
m_fieldsGrid->Connect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnGridEditorShown ), NULL, this );
|
||||
m_fieldsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSizeGrid ), NULL, this );
|
||||
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnAddField ), NULL, this );
|
||||
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnMoveUp ), NULL, this );
|
||||
|
@ -358,6 +359,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BAS
|
|||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnInitDlg ) );
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnUpdateUI ) );
|
||||
m_fieldsGrid->Disconnect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnGridEditorShown ), NULL, this );
|
||||
m_fieldsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSizeGrid ), NULL, this );
|
||||
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnAddField ), NULL, this );
|
||||
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnMoveUp ), NULL, this );
|
||||
|
|
|
@ -275,6 +275,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnGridEditorShown">OnGridEditorShown</event>
|
||||
<event name="OnSize">OnSizeGrid</event>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -80,6 +80,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE : public DIALOG_SHIM
|
|||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnGridEditorShown( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
Loading…
Reference in New Issue