Validators: drop unused is m_isLibEditor

This commit is contained in:
Mike Williams 2023-06-13 11:06:30 -04:00
parent ddafa2e75d
commit 7d84fa2a9d
6 changed files with 33 additions and 42 deletions

View File

@ -337,12 +337,9 @@ void KIUI::ValidatorTransferToWindowWithoutEvents( wxValidator& aValidator )
}
FIELD_VALIDATOR::FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxString* aValue ) :
wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue )
FIELD_VALIDATOR::FIELD_VALIDATOR( int aFieldId, wxString* aValue ) :
wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue ), m_fieldId( aFieldId )
{
m_fieldId = aFieldId;
m_isLibEditor = aIsLibEditor;
// Fields cannot contain carriage returns, line feeds, or tabs.
wxString excludes( wxT( "\r\n\t" ) );
@ -370,10 +367,8 @@ FIELD_VALIDATOR::FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxString* aVa
FIELD_VALIDATOR::FIELD_VALIDATOR( const FIELD_VALIDATOR& aValidator ) :
wxTextValidator( aValidator )
wxTextValidator( aValidator ), m_fieldId( aValidator.m_fieldId )
{
m_fieldId = aValidator.m_fieldId;
m_isLibEditor = aValidator.m_isLibEditor;
}

View File

@ -151,9 +151,6 @@ DIALOG_FIELD_PROPERTIES::~DIALOG_FIELD_PROPERTIES()
void DIALOG_FIELD_PROPERTIES::init()
{
SCH_BASE_FRAME* parent = GetParent();
bool isSymbolEditor = parent && parent->IsType( FRAME_SCH_SYMBOL_EDITOR );
// Disable options for graphic text editing which are not needed for fields.
m_CommonConvert->Show( false );
m_CommonUnit->Show( false );
@ -168,7 +165,7 @@ void DIALOG_FIELD_PROPERTIES::init()
if( use_validator )
{
m_TextCtrl->SetValidator( FIELD_VALIDATOR( isSymbolEditor, m_fieldId, &m_text ) );
m_TextCtrl->SetValidator( FIELD_VALIDATOR( m_fieldId, &m_text ) );
SetInitialFocus( m_TextCtrl );
m_StyledTextCtrl->Show( false );

View File

@ -58,8 +58,8 @@ DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL( EDA_DRAW_FRAME* aParent,
m_infoBar->ShowMessage( message );
}
m_textName->SetValidator( FIELD_VALIDATOR( true, VALUE_FIELD ) );
m_textReference->SetValidator( FIELD_VALIDATOR( true, REFERENCE_FIELD ) );
m_textName->SetValidator( FIELD_VALIDATOR( VALUE_FIELD ) );
m_textReference->SetValidator( FIELD_VALIDATOR( REFERENCE_FIELD ) );
m_pinTextPosition.SetValue( schIUScale.MilsToIU( DEFAULT_PIN_NAME_OFFSET ) );

View File

@ -78,7 +78,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
attr->SetEditor( new GRID_CELL_URL_EDITOR( this, Prj().SchSearchS() ) );
m_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr );
m_SymbolNameCtrl->SetValidator( FIELD_VALIDATOR( true, VALUE_FIELD ) );
m_SymbolNameCtrl->SetValidator( FIELD_VALIDATOR( VALUE_FIELD ) );
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );

View File

@ -97,12 +97,12 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a
m_parentType( SCH_SYMBOL_T ),
m_mandatoryFieldCount( MANDATORY_FIELDS ),
m_part( aSymbol ),
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE_FIELD ),
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME )
m_fieldNameValidator( FIELD_NAME ),
m_referenceValidator( REFERENCE_FIELD ),
m_valueValidator( VALUE_FIELD ),
m_urlValidator( FIELD_VALUE ),
m_nonUrlValidator( FIELD_VALUE ),
m_filepathValidator( SHEETFILENAME )
{
initGrid( aGrid );
}
@ -118,12 +118,12 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* a
m_mandatoryFieldCount( MANDATORY_FIELDS ),
m_part( aSymbol->GetLibSymbolRef().get() ),
m_symbolNetlist( netList( aSymbol, aFrame->GetCurrentSheet() ) ),
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE_FIELD ),
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME )
m_fieldNameValidator( FIELD_NAME ),
m_referenceValidator( REFERENCE_FIELD ),
m_valueValidator( VALUE_FIELD ),
m_urlValidator( FIELD_VALUE ),
m_nonUrlValidator( FIELD_VALUE ),
m_filepathValidator( SHEETFILENAME )
{
initGrid( aGrid );
}
@ -138,12 +138,12 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* a
m_parentType( SCH_SHEET_T ),
m_mandatoryFieldCount( SHEET_MANDATORY_FIELDS ),
m_part( nullptr ),
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETNAME_V ),
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME_V )
m_fieldNameValidator( FIELD_NAME ),
m_referenceValidator( SHEETNAME_V ),
m_valueValidator( VALUE_FIELD ),
m_urlValidator( FIELD_VALUE ),
m_nonUrlValidator( FIELD_VALUE ),
m_filepathValidator( SHEETFILENAME_V )
{
initGrid( aGrid );
}
@ -158,12 +158,12 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* a
m_parentType( SCH_LABEL_LOCATE_ANY_T ),
m_mandatoryFieldCount( aLabel->GetMandatoryFieldCount() ),
m_part( nullptr ),
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), 0 ),
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), 0 ),
m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), 0 )
m_fieldNameValidator( FIELD_NAME ),
m_referenceValidator( 0 ),
m_valueValidator( 0 ),
m_urlValidator( FIELD_VALUE ),
m_nonUrlValidator( FIELD_VALUE ),
m_filepathValidator( 0 )
{
initGrid( aGrid );
}

View File

@ -237,7 +237,7 @@ void ValidatorTransferToWindowWithoutEvents( wxValidator& aValidator );
class FIELD_VALIDATOR : public wxTextValidator
{
public:
FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxString* aValue = nullptr );
FIELD_VALIDATOR( int aFieldId, wxString* aValue = nullptr );
FIELD_VALIDATOR( const FIELD_VALIDATOR& aValidator );
@ -254,7 +254,6 @@ public:
private:
int m_fieldId;
bool m_isLibEditor;
};