Remove extra nag/grid assertion
When editing the properties, if you accidentally make an extra line, you should be able to remove the data and have it ignored.
This commit is contained in:
parent
36a4d5a511
commit
584eb9f531
|
@ -208,9 +208,8 @@ bool DIALOG_SHEET_PROPERTIES::Validate()
|
||||||
for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields->size(); ++i )
|
for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields->size(); ++i )
|
||||||
{
|
{
|
||||||
SCH_FIELD& field = m_fields->at( i );
|
SCH_FIELD& field = m_fields->at( i );
|
||||||
wxString fieldName = field.GetName( false );
|
|
||||||
|
|
||||||
if( fieldName.IsEmpty() )
|
if( field.GetName( false ).empty() && !field.GetText().empty() )
|
||||||
{
|
{
|
||||||
DisplayErrorMessage( this, _( "Fields must have a name." ) );
|
DisplayErrorMessage( this, _( "Fields must have a name." ) );
|
||||||
|
|
||||||
|
@ -367,7 +366,7 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
|
||||||
SCH_FIELD& field = m_fields->at( ii );
|
SCH_FIELD& field = m_fields->at( ii );
|
||||||
const wxString& fieldName = field.GetCanonicalName();
|
const wxString& fieldName = field.GetCanonicalName();
|
||||||
|
|
||||||
if( fieldName.IsEmpty() && field.GetText().IsEmpty() )
|
if( field.IsEmpty() )
|
||||||
m_fields->erase( m_fields->begin() + ii );
|
m_fields->erase( m_fields->begin() + ii );
|
||||||
else if( fieldName.IsEmpty() )
|
else if( fieldName.IsEmpty() )
|
||||||
field.SetName( _( "untitled" ) );
|
field.SetName( _( "untitled" ) );
|
||||||
|
|
|
@ -134,6 +134,18 @@ public:
|
||||||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if both the name and value of the field are empty. Whitespace
|
||||||
|
* does not count as non-empty
|
||||||
|
*/
|
||||||
|
bool IsEmpty()
|
||||||
|
{
|
||||||
|
wxString name( m_name );
|
||||||
|
wxString value( GetText() );
|
||||||
|
|
||||||
|
return name.Trim().empty() && value.Trim().empty();
|
||||||
|
}
|
||||||
|
|
||||||
COLOR4D GetFieldColor() const;
|
COLOR4D GetFieldColor() const;
|
||||||
|
|
||||||
void SetLastResolvedState( const SCH_ITEM* aItem ) override
|
void SetLastResolvedState( const SCH_ITEM* aItem ) override
|
||||||
|
|
Loading…
Reference in New Issue