From 4095edda0743289f16ad2da4177ef3eaf3b2b02c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 8 Oct 2020 18:03:58 +0100 Subject: [PATCH] Add Properties support to Junction and Bus Entry tools. Fixes https://gitlab.com/kicad/code/kicad/issues/5907 --- eeschema/tools/sch_drawing_tools.cpp | 63 ++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 4437680ac6..9d78aef3fd 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() : EE_TOOL_BASE( "eeschema.InteractiveDrawing" ), @@ -542,22 +544,19 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) { if( !m_frame->GetScreen()->GetItem( cursorPos, 0, type ) ) { + SCH_ITEM* newItem = static_cast( previewItem->Clone() ); + newItem->SetPosition( cursorPos ); + newItem->SetFlags( IS_NEW ); + + m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), newItem, false ); + m_frame->SaveCopyForRepeatItem( newItem ); + if( type == SCH_JUNCTION_T ) - { - m_frame->AddJunction( m_frame->GetScreen(), cursorPos, false ); - } + m_frame->TestDanglingEnds(); else - { - SCH_ITEM* newItem = static_cast( previewItem->Clone() ); - newItem->SetPosition( cursorPos ); - newItem->SetFlags( IS_NEW ); - - m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), newItem, false ); - m_frame->SaveCopyForRepeatItem( newItem ); - m_frame->SchematicCleanUp(); - m_frame->OnModify(); - } + + m_frame->OnModify(); } if( evt->IsDblClick( BUT_LEFT ) ) // Finish tool. @@ -604,6 +603,44 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) m_view->ClearPreview(); m_view->AddToPreview( previewItem->Clone() ); } + else if( evt->IsAction( &EE_ACTIONS::properties ) ) + { + switch( type ) + { + case SCH_BUS_WIRE_ENTRY_T: + { + std::deque strokeItems; + strokeItems.push_back( previewItem ); + + DIALOG_EDIT_LINE_STYLE dlg( m_frame, strokeItems ); + + if( dlg.ShowModal() == wxID_OK ) + { + m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); + m_frame->OnModify(); + } + } + break; + + case SCH_JUNCTION_T: + { + std::deque junctions; + junctions.push_back( static_cast( previewItem ) ); + + DIALOG_JUNCTION_PROPS dlg( m_frame, junctions ); + + if( dlg.ShowModal() == wxID_OK ) + { + m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); + m_frame->OnModify(); + } + } + break; + } + + m_view->ClearPreview(); + m_view->AddToPreview( previewItem->Clone() ); + } else { evt->SetPassEvent();