diff --git a/common/validators.cpp b/common/validators.cpp index b3b3cc3397..e0141d8e80 100644 --- a/common/validators.cpp +++ b/common/validators.cpp @@ -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(); diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 21284809d7..0f24ca6f2e 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -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 ) { diff --git a/eeschema/sch_validators.h b/eeschema/sch_validators.h index 6bbc379176..3b22ae2afb 100644 --- a/eeschema/sch_validators.h +++ b/eeschema/sch_validators.h @@ -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 ) { } diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 01da9441f1..81524c255c 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -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_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 nextitem( static_cast( 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 nextitem( static_cast( 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 ) ) diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index c23f772da9..517a0a0021 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -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> m_queuedTexts; - std::unique_ptr m_statusPopup; }; diff --git a/include/validators.h b/include/validators.h index c3fc1635ca..4a9ac7f874 100644 --- a/include/validators.h +++ b/include/validators.h @@ -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; };