diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 158dba9b6e..e6cf907539 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -507,6 +508,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) EE_GRID_HELPER grid( m_toolMgr ); KIGFX::VIEW_CONTROLS* controls = getViewControls(); SCH_ITEM* previewItem; + bool loggedInfoBarError = false; if( m_inSingleClickPlace ) return 0; @@ -635,15 +637,27 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) { if( !m_frame->GetScreen()->GetItem( cursorPos, 0, type ) ) { + if( type == SCH_JUNCTION_T ) + { + if( !m_frame->GetScreen()->IsJunctionNeeded( cursorPos ) ) + { + m_frame->ShowInfoBarError( _( "Junction location contains no joinable " + "wires and/or pins." ) ); + loggedInfoBarError = true; + continue; + } + else if( loggedInfoBarError ) + { + m_frame->GetInfoBar()->Dismiss(); + } + } + SCH_ITEM* newItem = static_cast( previewItem->Clone() ); newItem->SetPosition( cursorPos ); newItem->SetFlags( IS_NEW ); m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), newItem, false ); - if( type != SCH_SHEET_PIN_T ) - m_frame->SaveCopyForRepeatItem( newItem ); - if( type == SCH_JUNCTION_T ) m_frame->TestDanglingEnds(); else