Remove multi-label entry feature.

It was causing problems with surprising behaviour and issues with
allowing spaces in existing labels.  We'll work on something better
for 7.0....

Fixes https://gitlab.com/kicad/code/kicad/issues/6073
This commit is contained in:
Jeff Young 2020-10-20 22:51:29 +01:00
parent 2292c362c0
commit e5089d783d
6 changed files with 6 additions and 129 deletions

View File

@ -317,22 +317,13 @@ bool LIB_ID_VALIDATOR::Validate( wxWindow *aParent )
NETNAME_VALIDATOR::NETNAME_VALIDATOR( wxString *aVal ) :
wxTextValidator(),
m_allowSpaces( false )
wxTextValidator()
{
}
NETNAME_VALIDATOR::NETNAME_VALIDATOR( const NETNAME_VALIDATOR& aValidator ) :
wxTextValidator( aValidator ),
m_allowSpaces( aValidator.m_allowSpaces )
{
}
NETNAME_VALIDATOR::NETNAME_VALIDATOR( bool aAllowSpaces ) :
wxTextValidator(),
m_allowSpaces( aAllowSpaces )
wxTextValidator( aValidator )
{
}
@ -366,7 +357,7 @@ wxString NETNAME_VALIDATOR::IsValid( const wxString& str ) const
if( str.Contains( '\r' ) || str.Contains( '\n' ) )
return _( "Signal names cannot contain CR or LF characters" );
if( !m_allowSpaces && ( str.Contains( ' ' ) || str.Contains( '\t' ) ) )
if( str.Contains( ' ' ) || str.Contains( '\t' ) )
return _( "Signal names cannot contain spaces" );
return wxString();

View File

@ -48,7 +48,7 @@ class SCH_TEXT;
DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DIALOG_LABEL_EDITOR_BASE( aParent ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, false ),
m_netNameValidator( true ),
m_netNameValidator(),
m_scintillaTricks( nullptr ),
m_helpWindow( nullptr )
{

View File

@ -81,10 +81,6 @@ public:
NETNAME_VALIDATOR( aVal )
{ }
SCH_NETNAME_VALIDATOR( bool aAllowSpaces ) :
NETNAME_VALIDATOR( aAllowSpaces )
{ }
SCH_NETNAME_VALIDATOR( const SCH_NETNAME_VALIDATOR& aValidator ) :
NETNAME_VALIDATOR( aValidator )
{ }

View File

@ -664,28 +664,12 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
}
// History lists for placing labels and text
SCH_TEXT* SCH_DRAWING_TOOLS::getNextNewText()
{
if( m_queuedTexts.empty() )
return nullptr;
auto next_text = std::move( m_queuedTexts.front() );
m_queuedTexts.pop_front();
return next_text.release();
}
SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType )
{
SCHEMATIC* schematic = getModel<SCHEMATIC>();
SCHEMATIC_SETTINGS& settings = schematic->Settings();
SCH_TEXT* textItem = nullptr;
m_queuedTexts.clear();
switch( aType )
{
case LAYER_NOTES:
@ -727,80 +711,6 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
return nullptr;
}
if( aType != LAYER_NOTES )
{
UTF8 text( textItem->GetText() );
int brace_count = 0;
int bracket_count = 0;
bool last_space = false;
UTF8 token;
for( auto chIt = text.ubegin(); chIt != text.uend(); chIt++ )
{
switch( *chIt )
{
case '{':
brace_count++;
last_space = false;
break;
case '[':
bracket_count++;
last_space = false;
break;
case '}':
brace_count = std::max( 0, brace_count - 1 );
last_space = false;
break;
case ']':
bracket_count = std::max( 0, bracket_count - 1 );
last_space = false;
break;
case ' ':
case '\n':
case '\r':
case '\t':
if( !token.empty() && bracket_count == 0 && brace_count == 0 )
{
std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
nextitem->SetText( token.wx_str() );
m_queuedTexts.push_back( std::move( nextitem ) );
token.clear();
continue;
}
// Skip leading whitespace
if( token.empty() || last_space )
continue;
last_space = true;
break;
default:
last_space = false;
break;
}
token += *chIt;
}
if( !token.empty() )
{
std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
nextitem->SetText( token.wx_str() );
m_queuedTexts.push_back( std::move( nextitem ) );
}
delete textItem;
textItem = getNextNewText();
if( !textItem )
return nullptr;
}
m_lastTextBold = textItem->IsBold();
m_lastTextItalic = textItem->IsItalic();
m_lastTextOrientation = textItem->GetLabelSpinStyle();
@ -980,20 +890,9 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
item->ClearFlags( IS_MOVED );
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, false );
item = getNextNewText();
item = nullptr;
if( item )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
item->SetFlags( IS_NEW | IS_MOVED );
m_view->ClearPreview();
m_view->AddToPreview( item->Clone() );
m_selectionTool->AddItemToSel( item );
}
else
{
m_view->ClearPreview();
}
m_view->ClearPreview();
}
}
else if( evt->IsClick( BUT_RIGHT ) )

View File

@ -63,8 +63,6 @@ private:
* Gets the next queued text item
* @return next SCH_TEXT* or nullptr if empty
*/
SCH_TEXT* getNextNewText();
SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType );
void sizeSheet( SCH_SHEET* aSheet, VECTOR2I aPos );
@ -82,8 +80,6 @@ private:
bool m_lastTextBold;
bool m_lastTextItalic;
std::deque<std::unique_ptr<SCH_TEXT>> m_queuedTexts;
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
};

View File

@ -200,8 +200,6 @@ class NETNAME_VALIDATOR : public wxTextValidator
public:
NETNAME_VALIDATOR( wxString *aVal = nullptr );
NETNAME_VALIDATOR( bool aAllowSpaces );
NETNAME_VALIDATOR( const NETNAME_VALIDATOR& aValidator );
virtual wxObject* Clone() const override { return new NETNAME_VALIDATOR( *this ); }
@ -215,9 +213,6 @@ public:
protected:
// returns the error message if the contents of 'val' are invalid
wxString IsValid( const wxString& aVal ) const override;
private:
bool m_allowSpaces;
};