Improve validation of symbol fields editor.

Don't beep when inserting character from focused grid cell (but
before editor is opened).

Handle reference validation separately from name validation and
separately from user field value validation.  The old way of setting
the fieldId on the validator wasn't working because the validator
gets copied.

Run validation when leaving cell.  Don't just check for empty
(particularly for fields that CAN be empty).

Fixes: lp:1782917
* https://bugs.launchpad.net/kicad/+bug/1782917

(cherry picked from commit 79e04de)
This commit is contained in:
Jeff Young
2018-07-21 21:28:13 +01:00
parent 3a9e98c8c7
commit 07a665f4fd
9 changed files with 162 additions and 92 deletions
+6 -3
View File
@@ -41,12 +41,12 @@ GRID_CELL_TEXT_EDITOR::GRID_CELL_TEXT_EDITOR() : wxGridCellTextEditor()
}
void GRID_CELL_TEXT_EDITOR::SetValidator(const wxValidator& validator)
void GRID_CELL_TEXT_EDITOR::SetValidator( const wxValidator& validator )
{
// keep our own copy because wxGridCellTextEditor's is annoyingly private
m_validator.reset( static_cast<wxValidator*>( validator.Clone() ) );
wxGridCellTextEditor::SetValidator( validator );
wxGridCellTextEditor::SetValidator( *m_validator );
}
@@ -58,8 +58,11 @@ void GRID_CELL_TEXT_EDITOR::StartingKey( wxKeyEvent& event )
m_validator.get()->ProcessEvent( event );
}
if( !event.WasProcessed() )
if( event.GetSkipped() )
{
wxGridCellTextEditor::StartingKey( event );
event.Skip( false );
}
}