From 984c64677e3e231be3cb408f67c455b72b48cdf0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 30 Oct 2019 23:20:11 +0000 Subject: [PATCH] Hook up rotate & flip to bus entries when drawing them. Also adds support for the bus entry shape hotkeys while drawing. Fixes: lp:1849967 * https://bugs.launchpad.net/kicad/+bug/1849967 --- eeschema/tools/sch_drawing_tools.cpp | 31 ++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 84fd66fa2a..511f3c8dd9 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -33,10 +33,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -524,6 +522,35 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) m_view->ClearPreview(); m_view->AddToPreview( previewItem->Clone() ); } + else if( evt->Category() == TC_COMMAND ) + { + if( ( type == SCH_BUS_BUS_ENTRY_T || type == SCH_BUS_WIRE_ENTRY_T ) + && ( evt->IsAction( &EE_ACTIONS::rotateCW ) + || evt->IsAction( &EE_ACTIONS::rotateCCW ) + || evt->IsAction( &EE_ACTIONS::mirrorX ) + || evt->IsAction( &EE_ACTIONS::mirrorY ) + || evt->IsAction( &EE_ACTIONS::toShapeBackslash ) + || evt->IsAction( &EE_ACTIONS::toShapeSlash ) ) ) + { + char shape; + + if( evt->IsAction( &EE_ACTIONS::toShapeSlash ) ) + shape = '/'; + else if( evt->IsAction( &EE_ACTIONS::toShapeBackslash ) ) + shape = '\\'; + else // everything else just flips the shape + shape = g_lastBusEntryShape == '/' ? '\\' : '/'; + + if( previewItem ) + { + static_cast( previewItem )->SetBusEntryShape( shape ); + m_view->ClearPreview(); + m_view->AddToPreview( previewItem->Clone() ); + } + + g_lastBusEntryShape = shape; + } + } else evt->SetPassEvent(); }